1
0
mirror of https://github.com/profanity-im/profanity.git synced 2024-11-03 19:37:16 -05:00

Fixed nick changes

This commit is contained in:
James Booth 2014-10-10 02:25:52 +01:00
parent ed9266f959
commit 6a2bc79ca6
2 changed files with 7 additions and 2 deletions

View File

@ -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); ChatRoom *chat_room = g_hash_table_lookup(rooms, room);
if (chat_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); free(chat_room->nick);
chat_room->nick = strdup(nick); chat_room->nick = strdup(nick);
chat_room->pending_nick_change = FALSE; chat_room->pending_nick_change = FALSE;

View File

@ -730,6 +730,7 @@ void
handle_muc_occupant_online(const char * const room, const char * const nick, const char * const jid, 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) 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); gboolean updated = muc_roster_add(room, nick, jid, role, affiliation, show, status);
if (!muc_roster_complete(room)) { 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) { if (old_nick) {
ui_room_member_nick_change(room, old_nick, nick); ui_room_member_nick_change(room, old_nick, nick);
free(old_nick); free(old_nick);
ui_muc_roster(room);
return; return;
} }
if (!muc_roster_contains_nick(room, nick)) { if (!existing) {
char *muc_status_pref = prefs_get_string(PREF_STATUSES_MUC); char *muc_status_pref = prefs_get_string(PREF_STATUSES_MUC);
if (g_strcmp0(muc_status_pref, "none") != 0) { if (g_strcmp0(muc_status_pref, "none") != 0) {
ui_room_member_online(room, nick, show, status); ui_room_member_online(room, nick, show, status);
} }
prefs_free_string(muc_status_pref); prefs_free_string(muc_status_pref);
ui_muc_roster(room);
return; 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); ui_room_member_presence(room, nick, show, status);
} }
prefs_free_string(muc_status_pref); prefs_free_string(muc_status_pref);
ui_muc_roster(room);
} }
ui_muc_roster(room);
} }