changeset 676:80d4959422ca

New "eventcmd_checkstatus" option
author Mikael Berthe <mikael@lilotux.net>
date Thu, 26 Jan 2006 23:14:17 +0100
parents ae7016aae014
children 633a0522bd37
files mcabber/mcabberrc.example mcabber/src/main.c
diffstat 2 files changed, 15 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/mcabber/mcabberrc.example	Wed Jan 25 22:00:06 2006 +0100
+++ b/mcabber/mcabberrc.example	Thu Jan 26 23:14:17 2006 +0100
@@ -97,6 +97,12 @@
 #set event_log_files = 0
 #set event_log_dir = /home/mikael/.mcabber/event_files
 
+# External command status check
+# You can request mcabber to inspect exit status value after each
+# events_command.  If this option is set, mcabber will beep if the
+# exit value is 2.
+#set eventcmd_checkstatus = 0
+
 # Traces logging
 # If you want advanced traces, please specify a file and a level here.
 # There are currently 2 traceloglog levels:
--- a/mcabber/src/main.c	Wed Jan 25 22:00:06 2006 +0100
+++ b/mcabber/src/main.c	Thu Jan 26 23:14:17 2006 +0100
@@ -122,6 +122,15 @@
     pid_t pid;
     do {
       pid = waitpid (WAIT_ANY, &status, WNOHANG);
+      // Check the exit status value if 'eventcmd_checkstatus' is set
+      if (settings_opt_get_int("eventcmd_checkstatus")) {
+        if (pid > 0) {
+          // exit status 2 -> beep
+          if (WIFEXITED(status) && WEXITSTATUS(status) == 2) {
+            scr_Beep();
+          }
+        }
+      }
     } while (pid > 0);
     //if (pid < 0)
     //  scr_LogPrint(LPRINT_LOGNORM, "Error in waitpid: errno=%d", errno);