changeset 2141:e702073612de

Add "hook-mdr-received" hook This hook is triggered when a XEP-0184 Message Delivery Report is received.
author Mikael Berthe <mikael@lilotux.net>
date Sun, 06 Jul 2014 14:48:59 +0200
parents 77cb7f328723
children 0e8a25503ee1
files mcabber/doc/HOWTO_modules.txt mcabber/mcabber/hooks.h mcabber/mcabber/xmpp.c
diffstat 3 files changed, 13 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/mcabber/doc/HOWTO_modules.txt	Sun Jul 06 14:48:51 2014 +0200
+++ b/mcabber/doc/HOWTO_modules.txt	Sun Jul 06 14:48:59 2014 +0200
@@ -215,6 +215,8 @@
  - hook-message-out (HOOK_MESSAGE_OUT) with parameters
    * jid - recipient of the outgoing message
    * message - message body, converted to locale charset
+ - hook-mdr-received (HOOK_MDR_RECEIVED) with parameter
+   * jid - recipient of the outgoing message
  - hook-status-change (HOOK_STATUS_CHANGE) with
    parameters
    * jid - buddy, whose status has changed
--- a/mcabber/mcabber/hooks.h	Sun Jul 06 14:48:51 2014 +0200
+++ b/mcabber/mcabber/hooks.h	Sun Jul 06 14:48:59 2014 +0200
@@ -17,6 +17,7 @@
 #define HOOK_PRE_MESSAGE_IN     "hook-pre-message-in"
 #define HOOK_POST_MESSAGE_IN    "hook-post-message-in"
 #define HOOK_MESSAGE_OUT        "hook-message-out"
+#define HOOK_MDR_RECEIVED       "hook-mdr-received"
 #define HOOK_STATUS_CHANGE      "hook-status-change"
 #define HOOK_MY_STATUS_CHANGE   "hook-my-status-change"
 #define HOOK_POST_CONNECT       "hook-post-connect"
--- a/mcabber/mcabber/xmpp.c	Sun Jul 06 14:48:51 2014 +0200
+++ b/mcabber/mcabber/xmpp.c	Sun Jul 06 14:48:59 2014 +0200
@@ -1344,6 +1344,16 @@
         id = lm_message_get_id(m);
       scr_remove_receipt_flag(jid, id);
       g_free(jid);
+
+#ifdef MODULES_ENABLE
+      {
+        hk_arg_t args[] = {
+          { "jid", from },
+          { NULL, NULL },
+        };
+        hk_run_handlers("hook-mdr-received", args);
+      }
+#endif
     }
   }