diff options
-rw-r--r-- | src/event/server_events.c | 5 | ||||
-rw-r--r-- | src/ui/mucwin.c | 13 | ||||
-rw-r--r-- | src/ui/ui.h | 2 | ||||
-rw-r--r-- | tests/unittests/ui/stub_ui.c | 3 |
4 files changed, 11 insertions, 12 deletions
diff --git a/src/event/server_events.c b/src/event/server_events.c index e9b756e3..7168828a 100644 --- a/src/event/server_events.c +++ b/src/event/server_events.c @@ -637,7 +637,10 @@ sv_ev_muc_occupant_online(const char *const room, const char *const nick, const // handle nickname change char *old_nick = muc_roster_nick_change_complete(room, nick); if (old_nick) { - mucwin_occupant_nick_change(room, old_nick, nick); + ProfMucWin *mucwin = wins_get_muc(room); + if (mucwin) { + mucwin_occupant_nick_change(mucwin, old_nick, nick); + } free(old_nick); occupantswin_occupants(room); return; diff --git a/src/ui/mucwin.c b/src/ui/mucwin.c index 2051d8a6..9288293e 100644 --- a/src/ui/mucwin.c +++ b/src/ui/mucwin.c @@ -314,15 +314,12 @@ mucwin_occupant_presence(ProfMucWin *mucwin, const char *const nick, } void -mucwin_occupant_nick_change(const char *const roomjid, - const char *const old_nick, const char *const nick) +mucwin_occupant_nick_change(ProfMucWin *mucwin, const char *const old_nick, const char *const nick) { - ProfWin *window = (ProfWin*)wins_get_muc(roomjid); - if (window == NULL) { - log_error("Received nick change for room participant %s, but no window open for %s.", old_nick, roomjid); - } else { - win_vprint(window, '!', 0, NULL, 0, THEME_THEM, "", "** %s is now known as %s", old_nick, nick); - } + assert(mucwin != NULL); + + ProfWin *window = (ProfWin*)mucwin; + win_vprint(window, '!', 0, NULL, 0, THEME_THEM, "", "** %s is now known as %s", old_nick, nick); } void diff --git a/src/ui/ui.h b/src/ui/ui.h index 6790cd51..80073843 100644 --- a/src/ui/ui.h +++ b/src/ui/ui.h @@ -191,7 +191,7 @@ void mucwin_broadcast(const char *const roomjid, const char *const message); void mucwin_occupant_offline(ProfMucWin *mucwin, const char *const nick); void mucwin_occupant_online(ProfMucWin *mucwin, const char *const nick, const char *const roles, const char *const affiliation, const char *const show, const char *const status); -void mucwin_occupant_nick_change(const char *const roomjid, const char *const old_nick, const char *const nick); +void mucwin_occupant_nick_change(ProfMucWin *mucwin, const char *const old_nick, const char *const nick); void mucwin_nick_change(const char *const roomjid, const char *const nick); void mucwin_occupant_presence(ProfMucWin *mucwin, const char *const nick, const char *const show, const char *const status); diff --git a/tests/unittests/ui/stub_ui.c b/tests/unittests/ui/stub_ui.c index 93adc4a9..eec4af29 100644 --- a/tests/unittests/ui/stub_ui.c +++ b/tests/unittests/ui/stub_ui.c @@ -230,8 +230,7 @@ void mucwin_broadcast(const char * const roomjid, void mucwin_occupant_offline(ProfMucWin *mucwin, const char * const nick) {} void mucwin_occupant_online(ProfMucWin *mucwin, const char * const nick, const char * const roles, const char * const affiliation, const char * const show, const char * const status) {} -void mucwin_occupant_nick_change(const char * const roomjid, - const char * const old_nick, const char * const nick) {} +void mucwin_occupant_nick_change(ProfMucWin *mucwin, const char * const old_nick, const char * const nick) {} void mucwin_nick_change(const char * const roomjid, const char * const nick) {} void mucwin_occupant_presence(ProfMucWin *mucwin, const char * const nick, const char * const show, const char * const status) {} |