about summary refs log tree commit diff stats
path: root/src/xmpp
diff options
context:
space:
mode:
authorJames Booth <boothj5@gmail.com>2014-10-02 22:17:56 +0100
committerJames Booth <boothj5@gmail.com>2014-10-02 22:17:56 +0100
commitba6aded2b4e2a827fbd036aef61019c54eb503da (patch)
tree0caa696d0012659b95d61af6cb0480aa71eb66fb /src/xmpp
parent3e6048582e3672dfb416f905cb0a9cce94127091 (diff)
parent1423ee7a75a494e57dded274296bec11e58eeb92 (diff)
downloadprofani-tty-ba6aded2b4e2a827fbd036aef61019c54eb503da.tar.gz
Merge branch 'master' into muc_roles
Diffstat (limited to 'src/xmpp')
-rw-r--r--src/xmpp/roster.c25
1 files changed, 15 insertions, 10 deletions
diff --git a/src/xmpp/roster.c b/src/xmpp/roster.c
index 63729e7c..5f9fa6f9 100644
--- a/src/xmpp/roster.c
+++ b/src/xmpp/roster.c
@@ -245,6 +245,11 @@ _roster_set_handler(xmpp_conn_t * const conn, xmpp_stanza_t * const stanza,
     const char *sub = xmpp_stanza_get_attribute(item, STANZA_ATTR_SUBSCRIPTION);
     const char *ask = xmpp_stanza_get_attribute(item, STANZA_ATTR_ASK);
 
+    // do not set nickname to empty string, set to NULL instead
+    if (name && (strlen(name) == 0)) {
+        name = NULL;
+    }
+
     // remove from roster
     if (g_strcmp0(sub, "remove") == 0) {
         // remove barejid and name
@@ -290,17 +295,18 @@ _roster_result_handler(xmpp_conn_t * const conn, xmpp_stanza_t * const stanza,
 
     // handle initial roster response
     if (g_strcmp0(id, "roster") == 0) {
-        xmpp_stanza_t *query = xmpp_stanza_get_child_by_name(stanza,
-            STANZA_NAME_QUERY);
+        xmpp_stanza_t *query = xmpp_stanza_get_child_by_name(stanza, STANZA_NAME_QUERY);
         xmpp_stanza_t *item = xmpp_stanza_get_children(query);
 
         while (item != NULL) {
-            const char *barejid =
-                xmpp_stanza_get_attribute(item, STANZA_ATTR_JID);
-            const char *name =
-                xmpp_stanza_get_attribute(item, STANZA_ATTR_NAME);
-            const char *sub =
-                xmpp_stanza_get_attribute(item, STANZA_ATTR_SUBSCRIPTION);
+            const char *barejid = xmpp_stanza_get_attribute(item, STANZA_ATTR_JID);
+            const char *name = xmpp_stanza_get_attribute(item, STANZA_ATTR_NAME);
+            const char *sub = xmpp_stanza_get_attribute(item, STANZA_ATTR_SUBSCRIPTION);
+
+            // do not set nickname to empty string, set to NULL instead
+            if (name && (strlen(name) == 0)) {
+                name = NULL;
+            }
 
             gboolean pending_out = FALSE;
             const char *ask = xmpp_stanza_get_attribute(item, STANZA_ATTR_ASK);
@@ -319,8 +325,7 @@ _roster_result_handler(xmpp_conn_t * const conn, xmpp_stanza_t * const stanza,
             item = xmpp_stanza_get_next(item);
         }
 
-        resource_presence_t conn_presence =
-            accounts_get_login_presence(jabber_get_account_name());
+        resource_presence_t conn_presence = accounts_get_login_presence(jabber_get_account_name());
         presence_update(conn_presence, NULL, 0);
     }