diff mcabber/mcabber/xmpp.c @ 2036:f8958ab545ac

Make message delivery receipts more backward-compatible
author Mikael Berthe <mikael@lilotux.net>
date Mon, 15 Oct 2012 19:53:02 +0200
parents a37fbc3ac6aa
children c00b919cf4ac
line wrap: on
line diff
--- a/mcabber/mcabber/xmpp.c	Sun Oct 14 18:06:50 2012 +0200
+++ b/mcabber/mcabber/xmpp.c	Mon Oct 15 19:53:02 2012 +0200
@@ -423,7 +423,7 @@
     lm_message_node_set_attribute(lm_message_node_add_child(x->node, "request",
                                                             NULL),
                                   "xmlns", NS_RECEIPTS);
-    *xep184 = g_strdup(lm_message_node_get_attribute(x->node, "id"));
+    *xep184 = g_strdup(lm_message_get_id(x));
   }
   g_free(barejid);
 
@@ -1297,6 +1297,10 @@
     if (received && !g_strcmp0(lm_message_node_get_attribute(received, "xmlns"), NS_RECEIPTS)) {
       char       *jid = jidtodisp(from);
       const char *id  = lm_message_node_get_attribute(received, "id");
+      // This is for backward compatibility; if the remote client didn't add
+      // the id as an attribute of the 'received' tag, we use the message id:
+      if (!id)
+        id = lm_message_get_id(m);
       scr_remove_receipt_flag(jid, id);
       g_free(jid);
     }