Mercurial > ~mikael > mcabber > hg
comparison mcabber/mcabber/hooks.c @ 1797:246c5d359c97
Add "hook-pre-message-in" hook
author | Mikael Berthe <mikael@lilotux.net> |
---|---|
date | Sat, 20 Mar 2010 14:57:03 +0100 |
parents | 5e2db25fdb17 |
children | 07e73049f7c5 |
comparison
equal
deleted
inserted
replaced
1796:5e2db25fdb17 | 1797:246c5d359c97 |
---|---|
229 wmsg = mmsg = g_strdup_printf("*%s %s", shortid, msg+4); | 229 wmsg = mmsg = g_strdup_printf("*%s %s", shortid, msg+4); |
230 g_free(shortid); | 230 g_free(shortid); |
231 } else | 231 } else |
232 wmsg = (char*) msg; | 232 wmsg = (char*) msg; |
233 } | 233 } |
234 | |
235 #ifdef MODULES_ENABLE | |
236 { | |
237 guint h_result; | |
238 hk_arg_t args[] = { | |
239 { "jid", bjid }, | |
240 { "resource", resname }, | |
241 { "message", wmsg }, | |
242 { "groupchat", is_groupchat ? "true" : "false" }, | |
243 { NULL, NULL }, | |
244 }; | |
245 h_result = hk_run_handlers(HOOK_PRE_MESSAGE_IN, args); | |
246 if (h_result == HOOK_HANDLER_RESULT_NO_MORE_HOOK_DROP_DATA) { | |
247 scr_LogPrint(LPRINT_DEBUG, "Message dropped (hook result)."); | |
248 g_free(bmsg); | |
249 g_free(mmsg); | |
250 return; | |
251 } | |
252 } | |
253 #endif | |
234 | 254 |
235 // If this user isn't in the roster, we add it | 255 // If this user isn't in the roster, we add it |
236 roster_usr = roster_find(bjid, jidsearch, 0); | 256 roster_usr = roster_find(bjid, jidsearch, 0); |
237 if (!roster_usr) { | 257 if (!roster_usr) { |
238 new_guy = TRUE; | 258 new_guy = TRUE; |
346 { "groupchat", is_groupchat ? "true" : "false" }, | 366 { "groupchat", is_groupchat ? "true" : "false" }, |
347 { "urgent", urgent ? "true" : "false" }, | 367 { "urgent", urgent ? "true" : "false" }, |
348 { NULL, NULL }, | 368 { NULL, NULL }, |
349 }; | 369 }; |
350 hk_run_handlers(HOOK_POST_MESSAGE_IN, args); | 370 hk_run_handlers(HOOK_POST_MESSAGE_IN, args); |
351 // TODO: check (and use) return value | |
352 } | 371 } |
353 #endif | 372 #endif |
354 | 373 |
355 // External command | 374 // External command |
356 // - We do not call hk_ext_cmd() for history lines in MUC | 375 // - We do not call hk_ext_cmd() for history lines in MUC |