about summary refs log tree commit diff stats
path: root/src
diff options
context:
space:
mode:
authorJames Booth <boothj5@gmail.com>2014-01-28 20:55:02 +0000
committerJames Booth <boothj5@gmail.com>2014-01-28 20:55:02 +0000
commitc3ea8f8d0bc3a8e4f5660a76e3988847e18de824 (patch)
tree3f90b758b812aa9d7932e554cfe1e7259c325fcc /src
parent8f6ead2b7b0d4e0d67f7821c914070a46cc5160e (diff)
downloadprofani-tty-c3ea8f8d0bc3a8e4f5660a76e3988847e18de824.tar.gz
Added generated id's to presence stanzas
Diffstat (limited to 'src')
-rw-r--r--src/xmpp/presence.c6
-rw-r--r--src/xmpp/stanza.c7
2 files changed, 12 insertions, 1 deletions
diff --git a/src/xmpp/presence.c b/src/xmpp/presence.c
index 538898f8..f30c8373 100644
--- a/src/xmpp/presence.c
+++ b/src/xmpp/presence.c
@@ -116,6 +116,8 @@ _presence_subscription(const char * const jid, const jabber_subscr_t action)
     }
 
     xmpp_stanza_t *presence = xmpp_stanza_new(ctx);
+    char *id = generate_unique_id("sub");
+    xmpp_stanza_set_id(presence, id);
     xmpp_stanza_set_name(presence, STANZA_NAME_PRESENCE);
     xmpp_stanza_set_type(presence, type);
     xmpp_stanza_set_attribute(presence, STANZA_ATTR_TO, jidp->barejid);
@@ -211,6 +213,8 @@ _presence_update(const resource_presence_t presence_type, const char * const msg
     connection_set_priority(pri);
 
     xmpp_stanza_t *presence = stanza_create_presence(ctx);
+    char *id = generate_unique_id("presence");
+    xmpp_stanza_set_id(presence, id);
     stanza_attach_show(ctx, presence, show);
     stanza_attach_status(ctx, presence, msg);
     stanza_attach_priority(ctx, presence, pri);
@@ -602,7 +606,7 @@ _get_caps_key(xmpp_stanza_t * const stanza)
     if ((hash_type != NULL) && (strcmp(hash_type, "sha-1") == 0)) {
         log_debug("Hash type %s supported.", hash_type);
         caps_key = strdup(node);
-        id = "capsreq";
+        char *id = generate_unique_id("caps");
 
         _send_caps_request(node, caps_key, id, from);
 
diff --git a/src/xmpp/stanza.c b/src/xmpp/stanza.c
index 756d3d44..bb2388ad 100644
--- a/src/xmpp/stanza.c
+++ b/src/xmpp/stanza.c
@@ -27,6 +27,7 @@
 #include <strophe.h>
 
 #include "common.h"
+#include "log.h"
 #include "xmpp/connection.h"
 #include "xmpp/stanza.h"
 #include "xmpp/capabilities.h"
@@ -253,6 +254,8 @@ stanza_create_room_join_presence(xmpp_ctx_t * const ctx,
     xmpp_stanza_t *presence = xmpp_stanza_new(ctx);
     xmpp_stanza_set_name(presence, STANZA_NAME_PRESENCE);
     xmpp_stanza_set_attribute(presence, STANZA_ATTR_TO, full_room_jid);
+    char *id = generate_unique_id("join");
+    xmpp_stanza_set_id(presence, id);
 
     xmpp_stanza_t *x = xmpp_stanza_new(ctx);
     xmpp_stanza_set_name(x, STANZA_NAME_X);
@@ -268,6 +271,8 @@ stanza_create_room_newnick_presence(xmpp_ctx_t *ctx,
     const char * const full_room_jid)
 {
     xmpp_stanza_t *presence = xmpp_stanza_new(ctx);
+    char *id = generate_unique_id("sub");
+    xmpp_stanza_set_id(presence, id);
     xmpp_stanza_set_name(presence, STANZA_NAME_PRESENCE);
     xmpp_stanza_set_attribute(presence, STANZA_ATTR_TO, full_room_jid);
 
@@ -286,6 +291,8 @@ stanza_create_room_leave_presence(xmpp_ctx_t *ctx, const char * const room,
     xmpp_stanza_set_name(presence, STANZA_NAME_PRESENCE);
     xmpp_stanza_set_type(presence, STANZA_TYPE_UNAVAILABLE);
     xmpp_stanza_set_attribute(presence, STANZA_ATTR_TO, full_jid->str);
+    char *id = generate_unique_id("leave");
+    xmpp_stanza_set_id(presence, id);
 
     g_string_free(full_jid, TRUE);