diff options
-rw-r--r-- | src/ui/mucwin.c | 10 | ||||
-rw-r--r-- | src/ui/ui.h | 3 | ||||
-rw-r--r-- | src/xmpp/iq.c | 5 | ||||
-rw-r--r-- | tests/unittests/ui/stub_ui.c | 3 |
4 files changed, 11 insertions, 10 deletions
diff --git a/src/ui/mucwin.c b/src/ui/mucwin.c index a7668479..92ab02e7 100644 --- a/src/ui/mucwin.c +++ b/src/ui/mucwin.c @@ -527,13 +527,13 @@ mucwin_broadcast(ProfMucWin *mucwin, const char *const message) } void -mucwin_affiliation_list_error(const char *const roomjid, const char *const affiliation, +mucwin_affiliation_list_error(ProfMucWin *mucwin, const char *const affiliation, const char *const error) { - ProfWin *window = (ProfWin*)wins_get_muc(roomjid); - if (window) { - win_vprint(window, '!', 0, NULL, 0, THEME_ERROR, "", "Error retrieving %s list: %s", affiliation, error); - } + assert(mucwin != NULL); + + ProfWin *window = (ProfWin*)mucwin; + win_vprint(window, '!', 0, NULL, 0, THEME_ERROR, "", "Error retrieving %s list: %s", affiliation, error); } void diff --git a/src/ui/ui.h b/src/ui/ui.h index 38c66a05..05cc6a84 100644 --- a/src/ui/ui.h +++ b/src/ui/ui.h @@ -197,8 +197,7 @@ void mucwin_occupant_presence(ProfMucWin *mucwin, const char *const nick, const void mucwin_update_occupants(const char *const roomjid); void mucwin_show_occupants(const char *const roomjid); void mucwin_hide_occupants(const char *const roomjid); -void mucwin_affiliation_list_error(const char *const roomjid, const char *const affiliation, - const char *const error); +void mucwin_affiliation_list_error(ProfMucWin *mucwin, const char *const affiliation, const char *const error); void mucwin_handle_affiliation_list(const char *const roomjid, const char *const affiliation, GSList *jids); void mucwin_affiliation_set_error(const char *const roomjid, const char *const jid, const char *const affiliation, const char *const error); diff --git a/src/xmpp/iq.c b/src/xmpp/iq.c index e8b41235..e352c26b 100644 --- a/src/xmpp/iq.c +++ b/src/xmpp/iq.c @@ -1343,7 +1343,10 @@ _room_affiliation_list_result_handler(xmpp_conn_t *const conn, xmpp_stanza_t *co if (g_strcmp0(type, STANZA_TYPE_ERROR) == 0) { char *error_message = stanza_get_error_message(stanza); log_debug("Error retrieving %s list for room %s: %s", affiliation, from, error_message); - mucwin_affiliation_list_error(from, affiliation, error_message); + ProfMucWin *mucwin = wins_get_muc(from); + if (mucwin) { + mucwin_affiliation_list_error(mucwin, affiliation, error_message); + } free(error_message); free(affiliation); return 0; diff --git a/tests/unittests/ui/stub_ui.c b/tests/unittests/ui/stub_ui.c index 9b1be95f..3b3e03d6 100644 --- a/tests/unittests/ui/stub_ui.c +++ b/tests/unittests/ui/stub_ui.c @@ -271,8 +271,7 @@ void ui_handle_room_configuration(const char * const roomjid, DataForm *form) {} void ui_handle_room_configuration_form_error(const char * const roomjid, const char * const message) {} void ui_handle_room_config_submit_result(const char * const roomjid) {} void ui_handle_room_config_submit_result_error(const char * const roomjid, const char * const message) {} -void mucwin_affiliation_list_error(const char * const roomjid, const char * const affiliation, - const char * const error) {} +void mucwin_affiliation_list_error(ProfMucWin *mucwin, const char * const affiliation, const char * const error) {} void mucwin_handle_affiliation_list(const char * const roomjid, const char * const affiliation, GSList *jids) {} void mucwin_affiliation_set_error(const char * const roomjid, const char * const jid, const char * const affiliation, const char * const error) {} |