changeset 1526:eefa0ae248d8

Add option "fifo_ignore" (Suggested by T. Glaser) This new option can be used for switching the FIFO on and off from within the session.
author Mikael Berthe <mikael@lilotux.net>
date Thu, 02 Oct 2008 21:24:20 +0200
parents 68580b6be895
children ac87eef9050f
files mcabber/mcabberrc.example mcabber/src/fifo.c
diffstat 2 files changed, 12 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/mcabber/mcabberrc.example	Thu Oct 02 20:00:11 2008 +0200
+++ b/mcabber/mcabberrc.example	Thu Oct 02 21:24:20 2008 +0200
@@ -234,10 +234,14 @@
 # FIFO
 # mcabber can create a FIFO named pipe and listen to this pipe for commands.
 # Default: disabled.
-# Set fifo_hide_commands to 1 if you don't want to see the FIFO commands
+# Set 'fifo_hide_commands' to 1 if you don't want to see the FIFO commands
 # in the log window (they will still be written to the tracelog file).
+# When FIFO  is configured, you can turn it off and on in real time with
+# the 'fifo_ignore' option (default: 0).  When set to 1, the FIFO input is
+# still read but it is discarded.
 #set fifo_name = ~/.mcabber/mcabber.fifo
 #set fifo_hide_commands = 0
+#set fifo_ignore = 0
 
 # Traces logging
 # If you want advanced traces, please specify a file and a level here.
--- a/mcabber/src/fifo.c	Thu Oct 02 20:00:11 2008 +0200
+++ b/mcabber/src/fifo.c	Thu Oct 02 21:24:20 2008 +0200
@@ -146,6 +146,7 @@
   if (getbuf) {
     guint logflag;
     char *eol = buf;
+    guint fifo_ignore = settings_opt_get_int("fifo_ignore");
 
     // Strip trailing newlines
     for ( ; *eol ; eol++)
@@ -159,9 +160,12 @@
       logflag = LPRINT_LOG;
     else
       logflag = LPRINT_LOGNORM;
-    scr_LogPrint(logflag, "Executing FIFO command: %s", buf);
-    if (process_command(buf, TRUE) == 255)
-      mcabber_set_terminate_ui();
+    scr_LogPrint(logflag, "%s FIFO command: %s",
+                 (fifo_ignore ? "Ignoring" : "Executing"), buf);
+    if (!fifo_ignore) {
+      if (process_command(buf, TRUE) == 255)
+        mcabber_set_terminate_ui();
+    }
   } else {
     if (feof(sfd))
       fifo_init(NULL);  // Reopen the FIFO on EOF