diff mcabber/mcabber/hooks.c @ 1913:3cabdacf58df

Add "error" field to the message-in hooks Bump API number
author Mikael Berthe <mikael@lilotux.net>
date Sun, 16 May 2010 13:14:18 +0200
parents 5d37cee8c6c6
children 8dc418af3e72
line wrap: on
line diff
--- a/mcabber/mcabber/hooks.c	Fri May 14 11:58:13 2010 +0200
+++ b/mcabber/mcabber/hooks.c	Sun May 16 13:14:18 2010 +0200
@@ -197,6 +197,7 @@
   unsigned mucnicklen = 0;
   const char *ename = NULL;
   gboolean attention = FALSE, mucprivmsg = FALSE;
+  gboolean error_msg_subtype = (type == LM_MESSAGE_SUB_TYPE_ERROR);
 #ifdef MODULES_ENABLE
   gchar strdelay[32];
 
@@ -249,6 +250,7 @@
       { "message", msg },
       { "groupchat", is_groupchat ? "true" : "false" },
       { "delayed", strdelay },
+      { "error", error_msg_subtype ? "true" : "false" },
       { NULL, NULL },
     };
     h_result = hk_run_handlers(HOOK_PRE_MESSAGE_IN, args);
@@ -332,7 +334,7 @@
     }
   }
 
-  if (type  == LM_MESSAGE_SUB_TYPE_ERROR) {
+  if (error_msg_subtype) {
     message_flags = HBB_PREFIX_ERR | HBB_PREFIX_IN;
     scr_LogPrint(LPRINT_LOGNORM, "Error message received from <%s>", bjid);
   }
@@ -399,6 +401,7 @@
       { "groupchat", is_groupchat ? "true" : "false" },
       { "attention", attention ? "true" : "false" },
       { "delayed", strdelay },
+      { "error", error_msg_subtype ? "true" : "false" },
       { NULL, NULL },
     };
     hk_run_handlers(HOOK_POST_MESSAGE_IN, args);