about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorMichael Vetter <jubalh@iodoru.org>2019-08-23 09:50:53 +0200
committerMichael Vetter <jubalh@iodoru.org>2019-08-23 09:50:53 +0200
commitdacbe25d93ebc7b6bb60fac8f25e7ff7ea8c9adc (patch)
treeeec8e509b8f6375798e08eb2f9730be6122aab97
parent13088e0a1a022698b1cc6d0710d23ef599f150ba (diff)
downloadprofani-tty-dacbe25d93ebc7b6bb60fac8f25e7ff7ea8c9adc.tar.gz
Remove duplicate code in roster_update
Part of what `roster_update()` does manually is actually done in
`roster_change_name()`.
-rw-r--r--src/xmpp/roster_list.c10
1 files changed, 1 insertions, 9 deletions
diff --git a/src/xmpp/roster_list.c b/src/xmpp/roster_list.c
index dee7e362..82c2f073 100644
--- a/src/xmpp/roster_list.c
+++ b/src/xmpp/roster_list.c
@@ -303,15 +303,7 @@ roster_update(const char *const barejid, const char *const name, GSList *groups,
     p_contact_set_subscription(contact, subscription);
     p_contact_set_pending_out(contact, pending_out);
 
-    const char * const new_name = name;
-    char * current_name = NULL;
-    if (p_contact_name(contact)) {
-        current_name = strdup(p_contact_name(contact));
-    }
-
-    p_contact_set_name(contact, new_name);
-    _replace_name(current_name, new_name, barejid);
-    free(current_name);
+    roster_change_name(contact, name);
 
     GSList *curr_new_group = groups;
     while (curr_new_group) {