# HG changeset patch # User Mikael Berthe # Date 1412447921 -7200 # Node ID a54c084af4d65f4888aebbea32b26fb37092a69a # Parent a053629321ed68da13a63325b16d64391dc7297b Add a "carbon" parameter to the hook-{pre,post}-message-in hooks diff -r a053629321ed -r a54c084af4d6 mcabber/doc/HOWTO_modules.txt --- a/mcabber/doc/HOWTO_modules.txt Sat Oct 04 18:49:52 2014 +0200 +++ b/mcabber/doc/HOWTO_modules.txt Sat Oct 04 20:38:41 2014 +0200 @@ -201,6 +201,7 @@ * delayed - message timestamp (ISO-8601 string) or empty string if the message wasn't delayed * error - "true" if this is an error message + * carbon - "true" if this is a message carbon (cf. XEP-0280) - hook-post-message-in (HOOK_POST_MESSAGE_IN) with parameters * jid - sender of the incoming message * resource - resource of the incoming message @@ -212,6 +213,7 @@ * delayed - message timestamp (ISO-8601 string) or empty string if the message wasn't delayed * error - "true" if this is an error message + * carbon - "true" if this is a message carbon (cf. XEP-0280) - hook-message-out (HOOK_MESSAGE_OUT) with parameters * jid - recipient of the outgoing message * message - message body, converted to locale charset diff -r a053629321ed -r a54c084af4d6 mcabber/mcabber/hooks.c --- a/mcabber/mcabber/hooks.c Sat Oct 04 18:49:52 2014 +0200 +++ b/mcabber/mcabber/hooks.c Sat Oct 04 20:38:41 2014 +0200 @@ -183,7 +183,7 @@ void hk_message_in(const char *bjid, const char *resname, time_t timestamp, const char *msg, LmMessageSubType type, - guint encrypted) + guint encrypted, gboolean carbon) { int new_guy = FALSE; int is_groupchat = FALSE; // groupchat message @@ -251,6 +251,7 @@ { "groupchat", is_groupchat ? "true" : "false" }, { "delayed", strdelay }, { "error", error_msg_subtype ? "true" : "false" }, + { "carbon", carbon ? "true" : "false" }, { NULL, NULL }, }; h_result = hk_run_handlers(HOOK_PRE_MESSAGE_IN, args); @@ -405,6 +406,7 @@ { "attention", attention ? "true" : "false" }, { "delayed", strdelay }, { "error", error_msg_subtype ? "true" : "false" }, + { "carbon", carbon ? "true" : "false" }, { NULL, NULL }, }; hk_run_handlers(HOOK_POST_MESSAGE_IN, args); diff -r a053629321ed -r a54c084af4d6 mcabber/mcabber/hooks.h --- a/mcabber/mcabber/hooks.h Sat Oct 04 18:49:52 2014 +0200 +++ b/mcabber/mcabber/hooks.h Sat Oct 04 20:38:41 2014 +0200 @@ -47,7 +47,7 @@ void hk_message_in(const char *bjid, const char *resname, time_t timestamp, const char *msg, LmMessageSubType type, - guint encrypted); + guint encrypted, gboolean carbon); void hk_message_out(const char *bjid, const char *nickname, time_t timestamp, const char *msg, guint encrypted, gpointer xep184); diff -r a053629321ed -r a54c084af4d6 mcabber/mcabber/xmpp.c --- a/mcabber/mcabber/xmpp.c Sat Oct 04 18:49:52 2014 +0200 +++ b/mcabber/mcabber/xmpp.c Sat Oct 04 20:38:41 2014 +0200 @@ -1191,8 +1191,7 @@ fullbody = g_strdup_printf("[%s]\n", subject); body = fullbody; } - // XXX/TODO: pass the carbon status (Mikael) - hk_message_in(bjid, rname, timestamp, body, type, encrypted); + hk_message_in(bjid, rname, timestamp, body, type, encrypted, carbon); g_free(fullbody); }