diff --git a/src/ui/mucwin.c b/src/ui/mucwin.c index 238db218..f4e104ca 100644 --- a/src/ui/mucwin.c +++ b/src/ui/mucwin.c @@ -497,14 +497,12 @@ mucwin_subject(ProfMucWin *mucwin, const char *const nick, const char *const sub } void -mucwin_kick_error(const char *const roomjid, const char *const nick, const char *const error) +mucwin_kick_error(ProfMucWin *mucwin, const char *const nick, const char *const error) { - ProfWin *window = (ProfWin*)wins_get_muc(roomjid); - if (window == NULL) { - log_error("Kick error received for %s, but no window open for %s.", nick, roomjid); - } else { - win_vprint(window, '!', 0, NULL, 0, THEME_ERROR, "", "Error kicking %s: %s", nick, error); - } + assert(mucwin != NULL); + + ProfWin *window = (ProfWin*)mucwin; + win_vprint(window, '!', 0, NULL, 0, THEME_ERROR, "", "Error kicking %s: %s", nick, error); } void diff --git a/src/ui/ui.h b/src/ui/ui.h index 3ce0fea7..5cfa3c8e 100644 --- a/src/ui/ui.h +++ b/src/ui/ui.h @@ -206,7 +206,7 @@ void mucwin_role_set_error(const char *const roomjid, const char *const nick, co const char *const error); void mucwin_role_list_error(const char *const roomjid, const char *const role, const char *const error); void mucwin_handle_role_list(const char *const roomjid, const char *const role, GSList *nicks); -void mucwin_kick_error(const char *const roomjid, const char *const nick, const char *const error); +void mucwin_kick_error(ProfMucWin *mucwin, const char *const nick, const char *const error); // xml console void xmlwin_show(ProfXMLWin *xmlwin, const char *const msg); diff --git a/src/xmpp/iq.c b/src/xmpp/iq.c index 6029fe2b..e8b41235 100644 --- a/src/xmpp/iq.c +++ b/src/xmpp/iq.c @@ -1462,12 +1462,11 @@ _room_kick_result_handler(xmpp_conn_t *const conn, xmpp_stanza_t *const stanza, } // handle error responses - if (g_strcmp0(type, STANZA_TYPE_ERROR) == 0) { + ProfMucWin *mucwin = wins_get_muc(from); + if (mucwin && (g_strcmp0(type, STANZA_TYPE_ERROR) == 0)) { char *error_message = stanza_get_error_message(stanza); - mucwin_kick_error(from, nick, error_message); + mucwin_kick_error(mucwin, nick, error_message); free(error_message); - free(nick); - return 0; } free(nick); diff --git a/tests/unittests/ui/stub_ui.c b/tests/unittests/ui/stub_ui.c index 35ecc824..25f353b5 100644 --- a/tests/unittests/ui/stub_ui.c +++ b/tests/unittests/ui/stub_ui.c @@ -281,7 +281,7 @@ void mucwin_role_set_error(const char * const roomjid, const char * const nick, const char * const error) {} void mucwin_role_list_error(const char * const roomjid, const char * const role, const char * const error) {} void mucwin_handle_role_list(const char * const roomjid, const char * const role, GSList *nicks) {} -void mucwin_kick_error(const char * const roomjid, const char * const nick, const char * const error) {} +void mucwin_kick_error(ProfMucWin *mucwin, const char * const nick, const char * const error) {} void ui_show_form(ProfMucConfWin *confwin) {} void ui_show_form_field(ProfWin *window, DataForm *form, char *tag) {} void ui_show_form_help(ProfMucConfWin *confwin) {}