comparison mcabber/mcabber/hooks.c @ 2156:a54c084af4d6

Add a "carbon" parameter to the hook-{pre,post}-message-in hooks
author Mikael Berthe <mikael@lilotux.net>
date Sat, 04 Oct 2014 20:38:41 +0200
parents 8dc418af3e72
children 9e40d8f5bbe6
comparison
equal deleted inserted replaced
2155:a053629321ed 2156:a54c084af4d6
181 181
182 static const char *COMMAND_ME = "/me "; 182 static const char *COMMAND_ME = "/me ";
183 183
184 void hk_message_in(const char *bjid, const char *resname, 184 void hk_message_in(const char *bjid, const char *resname,
185 time_t timestamp, const char *msg, LmMessageSubType type, 185 time_t timestamp, const char *msg, LmMessageSubType type,
186 guint encrypted) 186 guint encrypted, gboolean carbon)
187 { 187 {
188 int new_guy = FALSE; 188 int new_guy = FALSE;
189 int is_groupchat = FALSE; // groupchat message 189 int is_groupchat = FALSE; // groupchat message
190 int is_room = FALSE; // window is a room window 190 int is_room = FALSE; // window is a room window
191 int log_muc_conf = FALSE; 191 int log_muc_conf = FALSE;
249 { "resource", resname }, 249 { "resource", resname },
250 { "message", msg }, 250 { "message", msg },
251 { "groupchat", is_groupchat ? "true" : "false" }, 251 { "groupchat", is_groupchat ? "true" : "false" },
252 { "delayed", strdelay }, 252 { "delayed", strdelay },
253 { "error", error_msg_subtype ? "true" : "false" }, 253 { "error", error_msg_subtype ? "true" : "false" },
254 { "carbon", carbon ? "true" : "false" },
254 { NULL, NULL }, 255 { NULL, NULL },
255 }; 256 };
256 h_result = hk_run_handlers(HOOK_PRE_MESSAGE_IN, args); 257 h_result = hk_run_handlers(HOOK_PRE_MESSAGE_IN, args);
257 if (h_result == HOOK_HANDLER_RESULT_NO_MORE_HANDLER_DROP_DATA) { 258 if (h_result == HOOK_HANDLER_RESULT_NO_MORE_HANDLER_DROP_DATA) {
258 scr_LogPrint(LPRINT_DEBUG, "Message dropped (hook result)."); 259 scr_LogPrint(LPRINT_DEBUG, "Message dropped (hook result).");
403 { "message", msg }, 404 { "message", msg },
404 { "groupchat", is_groupchat ? "true" : "false" }, 405 { "groupchat", is_groupchat ? "true" : "false" },
405 { "attention", attention ? "true" : "false" }, 406 { "attention", attention ? "true" : "false" },
406 { "delayed", strdelay }, 407 { "delayed", strdelay },
407 { "error", error_msg_subtype ? "true" : "false" }, 408 { "error", error_msg_subtype ? "true" : "false" },
409 { "carbon", carbon ? "true" : "false" },
408 { NULL, NULL }, 410 { NULL, NULL },
409 }; 411 };
410 hk_run_handlers(HOOK_POST_MESSAGE_IN, args); 412 hk_run_handlers(HOOK_POST_MESSAGE_IN, args);
411 } 413 }
412 #endif 414 #endif