diff mcabber/src/hooks.c @ 1444:3bf11085c6a5

New external "UNREAD" event (suggested by Viacheslav Chumushuk) Thanks to Viacheslav for the suggestion and sample patch.
author Mikael Berthe <mikael@lilotux.net>
date Sun, 02 Mar 2008 11:14:42 +0100
parents a64778f5f26b
children ba706e97d6ec
line wrap: on
line diff
--- a/mcabber/src/hooks.c	Fri Feb 29 14:55:55 2008 +0100
+++ b/mcabber/src/hooks.c	Sun Mar 02 11:14:42 2008 +0100
@@ -405,23 +405,24 @@
   char *arg_data = NULL;
   char status_str[2];
   char *datafname = NULL;
+  char unread_str[16];
 
   if (!extcmd) return;
 
   // Prepare arg_* (external command parameters)
   switch (type) {
-    case 'M':
+    case 'M': /* Normal message */
         arg_type = "MSG";
         if (info == 'R')
           arg_info = "IN";
         else if (info == 'S')
           arg_info = "OUT";
         break;
-    case 'G':
+    case 'G': /* Groupchat message */
         arg_type = "MSG";
         arg_info = "MUC";
         break;
-    case 'S':
+    case 'S': /* Status change */
         arg_type = "STATUS";
         if (strchr(imstatus2char, tolower(info))) {
           status_str[0] = toupper(info);
@@ -429,6 +430,11 @@
           arg_info = status_str;
         }
         break;
+    case 'U': /* Unread buffer count */
+        arg_type = "UNREAD";
+        g_snprintf(unread_str, sizeof unread_str, "%d", info);
+        arg_info = unread_str;  /* number of remaining unread bjids */
+        break;
     default:
         return;
   }