diff --git a/src/event/server_events.c b/src/event/server_events.c index 3982f14c..6254d725 100644 --- a/src/event/server_events.c +++ b/src/event/server_events.c @@ -664,7 +664,10 @@ sv_ev_muc_occupant_online(const char *const room, const char *const nick, const // role changed } else if (g_strcmp0(role, old_role) != 0) { - mucwin_occupant_role_change(room, nick, role, actor, reason); + ProfMucWin *mucwin = wins_get_muc(room); + if (mucwin) { + mucwin_occupant_role_change(mucwin, nick, role, actor, reason); + } // affiliation changed } else if (g_strcmp0(affiliation, old_affiliation) != 0) { diff --git a/src/ui/mucwin.c b/src/ui/mucwin.c index 8f9aabf8..692d884a 100644 --- a/src/ui/mucwin.c +++ b/src/ui/mucwin.c @@ -92,10 +92,12 @@ mucwin_role_and_affiliation_change(ProfMucWin *mucwin, const char *const role, c void -mucwin_occupant_role_change(const char *const roomjid, const char *const nick, const char *const role, +mucwin_occupant_role_change(ProfMucWin *mucwin, const char *const nick, const char *const role, const char *const actor, const char *const reason) { - ProfWin *window = (ProfWin*)wins_get_muc(roomjid); + assert(mucwin != NULL); + + ProfWin *window = (ProfWin*)mucwin; win_vprint(window, '!', 0, NULL, NO_EOL, THEME_ROOMINFO, "", "%s's role has been changed to: %s", nick, role); if (actor) { win_vprint(window, '!', 0, NULL, NO_DATE | NO_EOL, THEME_ROOMINFO, "", ", by: %s", actor); diff --git a/src/ui/ui.h b/src/ui/ui.h index 58f96929..5409fa8f 100644 --- a/src/ui/ui.h +++ b/src/ui/ui.h @@ -166,7 +166,7 @@ void mucwin_affiliation_change(ProfMucWin *mucwin, const char *const affiliation const char *const reason); void mucwin_role_and_affiliation_change(ProfMucWin *mucwin, const char *const role, const char *const affiliation, const char *const actor, const char *const reason); -void mucwin_occupant_role_change(const char *const roomjid, const char *const nick, const char *const role, +void mucwin_occupant_role_change(ProfMucWin *mucwin, const char *const nick, const char *const role, const char *const actor, const char *const reason); void mucwin_occupant_affiliation_change(const char *const roomjid, const char *const nick, const char *const affiliation, const char *const actor, const char *const reason); diff --git a/tests/unittests/ui/stub_ui.c b/tests/unittests/ui/stub_ui.c index 3f672c18..907d765a 100644 --- a/tests/unittests/ui/stub_ui.c +++ b/tests/unittests/ui/stub_ui.c @@ -197,7 +197,7 @@ void mucwin_affiliation_change(ProfMucWin *mucwin, const char * const affiliatio const char * const reason) {} void mucwin_role_and_affiliation_change(ProfMucWin *mucwin, const char * const role, const char * const affiliation, const char * const actor, const char * const reason) {} -void mucwin_occupant_role_change(const char * const roomjid, const char * const nick, const char * const role, +void mucwin_occupant_role_change(ProfMucWin *mucwin, const char * const nick, const char * const role, const char * const actor, const char * const reason) {} void mucwin_occupant_affiliation_change(const char * const roomjid, const char * const nick, const char * const affiliation, const char * const actor, const char * const reason) {}