Refactored roster_change_name
This commit is contained in:
@@ -30,8 +30,8 @@
|
||||
#include "contact.h"
|
||||
#include "jid.h"
|
||||
#include "tools/autocomplete.h"
|
||||
#include "xmpp/xmpp.h"
|
||||
#include "profanity.h"
|
||||
#include "xmpp/xmpp.h"
|
||||
|
||||
// nicknames
|
||||
static Autocomplete name_ac;
|
||||
@@ -157,21 +157,19 @@ roster_free(void)
|
||||
}
|
||||
|
||||
void
|
||||
roster_change_name(const char * const barejid, const char * const new_name)
|
||||
roster_change_name(PContact contact, const char * const new_name)
|
||||
{
|
||||
PContact contact = g_hash_table_lookup(contacts, barejid);
|
||||
const char * current_name = NULL;
|
||||
assert(contact != NULL);
|
||||
|
||||
const char *current_name = NULL;
|
||||
const char *barejid = p_contact_barejid(contact);
|
||||
|
||||
if (p_contact_name(contact) != NULL) {
|
||||
current_name = strdup(p_contact_name(contact));
|
||||
}
|
||||
|
||||
if (contact != NULL) {
|
||||
p_contact_set_name(contact, new_name);
|
||||
_replace_name(current_name, new_name, barejid);
|
||||
|
||||
GSList *groups = p_contact_groups(contact);
|
||||
roster_send_name_change(barejid, new_name, groups);
|
||||
}
|
||||
p_contact_set_name(contact, new_name);
|
||||
_replace_name(current_name, new_name, barejid);
|
||||
}
|
||||
|
||||
void
|
||||
|
||||
Reference in New Issue
Block a user