# HG changeset patch # User Mikael Berthe # Date 1270999232 -7200 # Node ID ea3f9b4f35581da828cbc99fd75b0b14c5297de9 # Parent 88c01c561a400dafd7f2a440e610dccc8d993d39 Add "delayed" argument to the message-in hooks diff -r 88c01c561a40 -r ea3f9b4f3558 mcabber/doc/HOWTO_modules.txt --- a/mcabber/doc/HOWTO_modules.txt Sun Apr 11 16:20:18 2010 +0200 +++ b/mcabber/doc/HOWTO_modules.txt Sun Apr 11 17:20:32 2010 +0200 @@ -198,6 +198,8 @@ * resource - resource of the incoming message * message - message body, converted to locale charset * groupchat - ("true" or "false") + * delayed - message timestamp (ISO-8601 string) or empty string if + the message wasn't delayed - hook-post-message-in (HOOK_POST_MESSAGE_IN) with parameters * jid - sender of the incoming message * resource - resource of the incoming message @@ -206,6 +208,8 @@ * attention - In a MUC message, true if you've been highlighted In a regular message, true if the sender has requested your attention (only implemented for MUC currently) + * delayed - message timestamp (ISO-8601 string) or empty string if + the message wasn't delayed - hook-message-out (HOOK_MESSAGE_OUT) with parameters * jid - recipient of the outgoing message * message - message body, converted to locale charset diff -r 88c01c561a40 -r ea3f9b4f3558 mcabber/mcabber/api.h --- a/mcabber/mcabber/api.h Sun Apr 11 16:20:18 2010 +0200 +++ b/mcabber/mcabber/api.h Sun Apr 11 17:20:32 2010 +0200 @@ -3,7 +3,7 @@ #include // For MCABBER_BRANCH -#define MCABBER_API_VERSION 13 +#define MCABBER_API_VERSION 14 #define MCABBER_API_MIN 13 extern const gchar *mcabber_branch; diff -r 88c01c561a40 -r ea3f9b4f3558 mcabber/mcabber/hooks.c --- a/mcabber/mcabber/hooks.c Sun Apr 11 16:20:18 2010 +0200 +++ b/mcabber/mcabber/hooks.c Sun Apr 11 17:20:32 2010 +0200 @@ -197,6 +197,14 @@ unsigned mucnicklen = 0; const char *ename = NULL; gboolean attention = FALSE, mucprivmsg = FALSE; +#ifdef MODULES_ENABLE + gchar strdelay[32]; + + if (timestamp) + to_iso8601(strdelay, timestamp); + else + strdelay[0] = '\0'; +#endif if (encrypted == ENCRYPTED_PGP) message_flags |= HBB_PREFIX_PGPCRYPT; @@ -240,6 +248,7 @@ { "resource", resname }, { "message", msg }, { "groupchat", is_groupchat ? "true" : "false" }, + { "delayed", strdelay }, { NULL, NULL }, }; h_result = hk_run_handlers(HOOK_PRE_MESSAGE_IN, args); @@ -389,6 +398,7 @@ { "message", msg }, { "groupchat", is_groupchat ? "true" : "false" }, { "attention", attention ? "true" : "false" }, + { "delayed", strdelay }, { NULL, NULL }, }; hk_run_handlers(HOOK_POST_MESSAGE_IN, args);