about summary refs log tree commit diff stats
path: root/src/xmpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/xmpp')
-rw-r--r--src/xmpp/roster.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/src/xmpp/roster.c b/src/xmpp/roster.c
index 3da8c7d3..a70436e7 100644
--- a/src/xmpp/roster.c
+++ b/src/xmpp/roster.c
@@ -255,7 +255,15 @@ _roster_handle_push(xmpp_conn_t * const conn, xmpp_stanza_t * const stanza,
         GSList *groups = _get_groups_from_item(item);
 
         // update the local roster
-        roster_update(barejid, name, groups, sub, pending_out);
+        PContact contact = roster_get_contact(barejid);
+        if (contact == NULL) {
+            gboolean added = roster_add(barejid, name, groups, sub, pending_out);
+            if (added) {
+                handle_roster_add(barejid, name);
+            }
+        } else {
+            roster_update(barejid, name, groups, sub, pending_out);
+        }
     }
 
     return 1;
@@ -289,7 +297,7 @@ _roster_handle_result(xmpp_conn_t * const conn, xmpp_stanza_t * const stanza,
 
             GSList *groups = _get_groups_from_item(item);
 
-            gboolean added = roster_add(barejid, name, groups, sub, pending_out, TRUE);
+            gboolean added = roster_add(barejid, name, groups, sub, pending_out);
 
             if (!added) {
                 log_warning("Attempt to add contact twice: %s", barejid);