From 6a2bc79ca6a241982a95b64f4941aceea613366b Mon Sep 17 00:00:00 2001 From: James Booth Date: Fri, 10 Oct 2014 02:25:52 +0100 Subject: [PATCH] Fixed nick changes --- src/muc.c | 2 ++ src/server_events.c | 7 +++++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/src/muc.c b/src/muc.c index 9d49518d..731505b8 100644 --- a/src/muc.c +++ b/src/muc.c @@ -322,6 +322,8 @@ muc_nick_change_complete(const char * const room, const char * const nick) { ChatRoom *chat_room = g_hash_table_lookup(rooms, room); if (chat_room) { + g_hash_table_remove(chat_room->roster, chat_room->nick); + autocomplete_remove(chat_room->nick_ac, chat_room->nick); free(chat_room->nick); chat_room->nick = strdup(nick); chat_room->pending_nick_change = FALSE; diff --git a/src/server_events.c b/src/server_events.c index 3514809d..1fcfeec4 100644 --- a/src/server_events.c +++ b/src/server_events.c @@ -730,6 +730,7 @@ void handle_muc_occupant_online(const char * const room, const char * const nick, const char * const jid, const char * const role, const char * const affiliation, const char * const show, const char * const status) { + gboolean existing = muc_roster_contains_nick(room, nick); gboolean updated = muc_roster_add(room, nick, jid, role, affiliation, show, status); if (!muc_roster_complete(room)) { @@ -740,15 +741,17 @@ handle_muc_occupant_online(const char * const room, const char * const nick, con if (old_nick) { ui_room_member_nick_change(room, old_nick, nick); free(old_nick); + ui_muc_roster(room); return; } - if (!muc_roster_contains_nick(room, nick)) { + if (!existing) { char *muc_status_pref = prefs_get_string(PREF_STATUSES_MUC); if (g_strcmp0(muc_status_pref, "none") != 0) { ui_room_member_online(room, nick, show, status); } prefs_free_string(muc_status_pref); + ui_muc_roster(room); return; } @@ -758,7 +761,7 @@ handle_muc_occupant_online(const char * const room, const char * const nick, con ui_room_member_presence(room, nick, show, status); } prefs_free_string(muc_status_pref); + ui_muc_roster(room); } - ui_muc_roster(room); } \ No newline at end of file