Mercurial > ~mikael > mcabber > hg
comparison 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 |
comparison
equal
deleted
inserted
replaced
1912:ee8657ff9aa8 | 1913:3cabdacf58df |
---|---|
195 char *wmsg = NULL, *bmsg = NULL, *mmsg = NULL; | 195 char *wmsg = NULL, *bmsg = NULL, *mmsg = NULL; |
196 GSList *roster_usr; | 196 GSList *roster_usr; |
197 unsigned mucnicklen = 0; | 197 unsigned mucnicklen = 0; |
198 const char *ename = NULL; | 198 const char *ename = NULL; |
199 gboolean attention = FALSE, mucprivmsg = FALSE; | 199 gboolean attention = FALSE, mucprivmsg = FALSE; |
200 gboolean error_msg_subtype = (type == LM_MESSAGE_SUB_TYPE_ERROR); | |
200 #ifdef MODULES_ENABLE | 201 #ifdef MODULES_ENABLE |
201 gchar strdelay[32]; | 202 gchar strdelay[32]; |
202 | 203 |
203 if (timestamp) | 204 if (timestamp) |
204 to_iso8601(strdelay, timestamp); | 205 to_iso8601(strdelay, timestamp); |
247 { "jid", bjid }, | 248 { "jid", bjid }, |
248 { "resource", resname }, | 249 { "resource", resname }, |
249 { "message", msg }, | 250 { "message", msg }, |
250 { "groupchat", is_groupchat ? "true" : "false" }, | 251 { "groupchat", is_groupchat ? "true" : "false" }, |
251 { "delayed", strdelay }, | 252 { "delayed", strdelay }, |
253 { "error", error_msg_subtype ? "true" : "false" }, | |
252 { NULL, NULL }, | 254 { NULL, NULL }, |
253 }; | 255 }; |
254 h_result = hk_run_handlers(HOOK_PRE_MESSAGE_IN, args); | 256 h_result = hk_run_handlers(HOOK_PRE_MESSAGE_IN, args); |
255 if (h_result == HOOK_HANDLER_RESULT_NO_MORE_HANDLER_DROP_DATA) { | 257 if (h_result == HOOK_HANDLER_RESULT_NO_MORE_HANDLER_DROP_DATA) { |
256 scr_LogPrint(LPRINT_DEBUG, "Message dropped (hook result)."); | 258 scr_LogPrint(LPRINT_DEBUG, "Message dropped (hook result)."); |
330 } | 332 } |
331 } | 333 } |
332 } | 334 } |
333 } | 335 } |
334 | 336 |
335 if (type == LM_MESSAGE_SUB_TYPE_ERROR) { | 337 if (error_msg_subtype) { |
336 message_flags = HBB_PREFIX_ERR | HBB_PREFIX_IN; | 338 message_flags = HBB_PREFIX_ERR | HBB_PREFIX_IN; |
337 scr_LogPrint(LPRINT_LOGNORM, "Error message received from <%s>", bjid); | 339 scr_LogPrint(LPRINT_LOGNORM, "Error message received from <%s>", bjid); |
338 } | 340 } |
339 | 341 |
340 // Note: the hlog_write should not be called first, because in some | 342 // Note: the hlog_write should not be called first, because in some |
397 { "resource", resname }, | 399 { "resource", resname }, |
398 { "message", msg }, | 400 { "message", msg }, |
399 { "groupchat", is_groupchat ? "true" : "false" }, | 401 { "groupchat", is_groupchat ? "true" : "false" }, |
400 { "attention", attention ? "true" : "false" }, | 402 { "attention", attention ? "true" : "false" }, |
401 { "delayed", strdelay }, | 403 { "delayed", strdelay }, |
404 { "error", error_msg_subtype ? "true" : "false" }, | |
402 { NULL, NULL }, | 405 { NULL, NULL }, |
403 }; | 406 }; |
404 hk_run_handlers(HOOK_POST_MESSAGE_IN, args); | 407 hk_run_handlers(HOOK_POST_MESSAGE_IN, args); |
405 } | 408 } |
406 #endif | 409 #endif |