changeset 2033:a37fbc3ac6aa

Delivery receipts: Use LM-generated messages id
author Mikael Berthe <mikael@lilotux.net>
date Sun, 14 Oct 2012 17:41:56 +0200
parents f740c4128f76
children c7d40b9b2bb9
files mcabber/mcabber/xmpp.c mcabber/mcabber/xmpp_helper.c mcabber/mcabber/xmpp_helper.h
diffstat 3 files changed, 4 insertions(+), 14 deletions(-) [+]
line wrap: on
line diff
--- a/mcabber/mcabber/xmpp.c	Sun Oct 14 17:39:11 2012 +0200
+++ b/mcabber/mcabber/xmpp.c	Sun Oct 14 17:41:56 2012 +0200
@@ -423,8 +423,7 @@
     lm_message_node_set_attribute(lm_message_node_add_child(x->node, "request",
                                                             NULL),
                                   "xmlns", NS_RECEIPTS);
-    *xep184 = lm_get_uid ();
-    lm_message_node_set_attribute (x->node, "id", (const gchar *)*xep184);
+    *xep184 = g_strdup(lm_message_node_get_attribute(x->node, "id"));
   }
   g_free(barejid);
 
@@ -1356,7 +1355,7 @@
                           lm_message_node_get_attribute(info, "xml:lang"));
         info = info->next;
     }
-    
+
     info = lm_message_node_get_child(query, "feature");
     while (info) {
       if (!g_strcmp0(info->name, "feature"))
@@ -1416,7 +1415,7 @@
 
     if (caps_verify(ver, hash))
       caps_copy_to_persistent(ver, lm_message_node_to_string(query));
-    else 
+    else
       caps_move_to_local(ver, bjid);
   }
 
@@ -2188,7 +2187,7 @@
 
   if (!bookmarks || !bjid)
     return 0;
-  
+
   // Walk through the storage bookmark tags
   for (x = bookmarks->children ; x; x = x->next) {
     // If the node is a conference item, check the jid.
--- a/mcabber/mcabber/xmpp_helper.c	Sun Oct 14 17:39:11 2012 +0200
+++ b/mcabber/mcabber/xmpp_helper.c	Sun Oct 14 17:41:56 2012 +0200
@@ -104,13 +104,6 @@
 }
 #endif
 
-// The caller must g_free this after use
-gchar *lm_get_uid ()
-{
-  static guint xmpp_uid = 0;
-  return g_strdup_printf ("mc%u", ++xmpp_uid);
-}
-
 const gchar* lm_message_node_get_child_value(LmMessageNode *node,
                                              const gchar *child)
 {
--- a/mcabber/mcabber/xmpp_helper.h	Sun Oct 14 17:39:11 2012 +0200
+++ b/mcabber/mcabber/xmpp_helper.h	Sun Oct 14 17:41:56 2012 +0200
@@ -29,8 +29,6 @@
 void xmpp_del_feature (const char *xmlns);
 #endif
 
-gchar *lm_get_uid (void);
-
 LmMessageNode *lm_message_node_new(const gchar *name, const gchar *xmlns);
 LmMessageNode *lm_message_node_find_xmlns(LmMessageNode *node,
                                           const char *xmlns);