diff --git a/src/ui/mucwin.c b/src/ui/mucwin.c index 8217faf5..c508b676 100644 --- a/src/ui/mucwin.c +++ b/src/ui/mucwin.c @@ -725,13 +725,13 @@ mucwin_affiliation_set_error(ProfMucWin *mucwin, const char *const jid, const ch } void -mucwin_role_set_error(const char *const roomjid, const char *const nick, const char *const role, +mucwin_role_set_error(ProfMucWin *mucwin, const char *const nick, const char *const role, const char *const error) { - ProfWin *window = (ProfWin*)wins_get_muc(roomjid); - if (window) { - win_vprint(window, '!', 0, NULL, 0, THEME_ERROR, "", "Error setting %s role for %s: %s", role, nick, error); - } + assert(mucwin != NULL); + + ProfWin *window = (ProfWin*)mucwin; + win_vprint(window, '!', 0, NULL, 0, THEME_ERROR, "", "Error setting %s role for %s: %s", role, nick, error); } void diff --git a/src/ui/ui.h b/src/ui/ui.h index 351998c3..a483bc81 100644 --- a/src/ui/ui.h +++ b/src/ui/ui.h @@ -201,8 +201,7 @@ void mucwin_affiliation_list_error(ProfMucWin *mucwin, const char *const affilia void mucwin_handle_affiliation_list(ProfMucWin *mucwin, const char *const affiliation, GSList *jids); void mucwin_affiliation_set_error(ProfMucWin *mucwin, const char *const jid, const char *const affiliation, const char *const error); -void mucwin_role_set_error(const char *const roomjid, const char *const nick, const char *const role, - const char *const error); +void mucwin_role_set_error(ProfMucWin *mucwin, const char *const nick, const char *const role, const char *const error); void mucwin_role_list_error(ProfMucWin *mucwin, const char *const role, const char *const error); void mucwin_handle_role_list(ProfMucWin *mucwin, const char *const role, GSList *nicks); void mucwin_kick_error(ProfMucWin *mucwin, const char *const nick, const char *const error); diff --git a/src/xmpp/iq.c b/src/xmpp/iq.c index 9d0763df..252dcd71 100644 --- a/src/xmpp/iq.c +++ b/src/xmpp/iq.c @@ -1317,7 +1317,10 @@ _room_role_set_result_handler(xmpp_conn_t *const conn, xmpp_stanza_t *const stan if (g_strcmp0(type, STANZA_TYPE_ERROR) == 0) { char *error_message = stanza_get_error_message(stanza); log_debug("Error setting role %s list for room %s, user %s: %s", role_set->privilege, from, role_set->item, error_message); - mucwin_role_set_error(from, role_set->item, role_set->privilege, error_message); + ProfMucWin *mucwin = wins_get_muc(from); + if (mucwin) { + mucwin_role_set_error(mucwin, role_set->item, role_set->privilege, error_message); + } free(error_message); } diff --git a/tests/unittests/ui/stub_ui.c b/tests/unittests/ui/stub_ui.c index 2dc55567..77887a97 100644 --- a/tests/unittests/ui/stub_ui.c +++ b/tests/unittests/ui/stub_ui.c @@ -275,7 +275,7 @@ void mucwin_affiliation_list_error(ProfMucWin *mucwin, const char * const affili void mucwin_handle_affiliation_list(ProfMucWin *mucwin, const char * const affiliation, GSList *jids) {} void mucwin_affiliation_set_error(ProfMucWin *mucwin, const char * const jid, const char * const affiliation, const char * const error) {} -void mucwin_role_set_error(const char * const roomjid, const char * const nick, const char * const role, +void mucwin_role_set_error(ProfMucWin *mucwin, const char * const nick, const char * const role, const char * const error) {} void mucwin_role_list_error(ProfMucWin *mucwin, const char * const role, const char * const error) {} void mucwin_handle_role_list(ProfMucWin *mucwin, const char * const role, GSList *nicks) {}