comparison mcabber/mcabber/hooks.c @ 1892:ea3f9b4f3558

Add "delayed" argument to the message-in hooks
author Mikael Berthe <mikael@lilotux.net>
date Sun, 11 Apr 2010 17:20:32 +0200
parents b210c3d0de1f
children 5d37cee8c6c6
comparison
equal deleted inserted replaced
1891:88c01c561a40 1892:ea3f9b4f3558
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 #ifdef MODULES_ENABLE
201 gchar strdelay[32];
202
203 if (timestamp)
204 to_iso8601(strdelay, timestamp);
205 else
206 strdelay[0] = '\0';
207 #endif
200 208
201 if (encrypted == ENCRYPTED_PGP) 209 if (encrypted == ENCRYPTED_PGP)
202 message_flags |= HBB_PREFIX_PGPCRYPT; 210 message_flags |= HBB_PREFIX_PGPCRYPT;
203 else if (encrypted == ENCRYPTED_OTR) 211 else if (encrypted == ENCRYPTED_OTR)
204 message_flags |= HBB_PREFIX_OTRCRYPT; 212 message_flags |= HBB_PREFIX_OTRCRYPT;
238 hk_arg_t args[] = { 246 hk_arg_t args[] = {
239 { "jid", bjid }, 247 { "jid", bjid },
240 { "resource", resname }, 248 { "resource", resname },
241 { "message", msg }, 249 { "message", msg },
242 { "groupchat", is_groupchat ? "true" : "false" }, 250 { "groupchat", is_groupchat ? "true" : "false" },
251 { "delayed", strdelay },
243 { NULL, NULL }, 252 { NULL, NULL },
244 }; 253 };
245 h_result = hk_run_handlers(HOOK_PRE_MESSAGE_IN, args); 254 h_result = hk_run_handlers(HOOK_PRE_MESSAGE_IN, args);
246 if (h_result == HOOK_HANDLER_RESULT_NO_MORE_HANDLER_DROP_DATA) { 255 if (h_result == HOOK_HANDLER_RESULT_NO_MORE_HANDLER_DROP_DATA) {
247 scr_LogPrint(LPRINT_DEBUG, "Message dropped (hook result)."); 256 scr_LogPrint(LPRINT_DEBUG, "Message dropped (hook result).");
387 { "jid", bjid }, 396 { "jid", bjid },
388 { "resource", resname }, 397 { "resource", resname },
389 { "message", msg }, 398 { "message", msg },
390 { "groupchat", is_groupchat ? "true" : "false" }, 399 { "groupchat", is_groupchat ? "true" : "false" },
391 { "attention", attention ? "true" : "false" }, 400 { "attention", attention ? "true" : "false" },
401 { "delayed", strdelay },
392 { NULL, NULL }, 402 { NULL, NULL },
393 }; 403 };
394 hk_run_handlers(HOOK_POST_MESSAGE_IN, args); 404 hk_run_handlers(HOOK_POST_MESSAGE_IN, args);
395 } 405 }
396 #endif 406 #endif