diff options
-rw-r--r-- | src/event/server_events.c | 4 | ||||
-rw-r--r-- | src/ui/mucwin.c | 48 | ||||
-rw-r--r-- | src/ui/ui.h | 2 | ||||
-rw-r--r-- | tests/unittests/ui/stub_ui.c | 2 |
4 files changed, 26 insertions, 30 deletions
diff --git a/src/event/server_events.c b/src/event/server_events.c index b05dc22c..ce0da5b8 100644 --- a/src/event/server_events.c +++ b/src/event/server_events.c @@ -597,7 +597,9 @@ sv_ev_muc_self_online(const char *const room, const char *const nick, gboolean c // room configuration required if (config_required) { muc_set_requires_config(room, TRUE); - mucwin_requires_config(room); + if (mucwin) { + mucwin_requires_config(mucwin); + } } // check for change in role/affiliation diff --git a/src/ui/mucwin.c b/src/ui/mucwin.c index 95908875..9b77cf7d 100644 --- a/src/ui/mucwin.c +++ b/src/ui/mucwin.c @@ -434,37 +434,31 @@ mucwin_message(ProfMucWin *mucwin, const char *const nick, const char *const mes } void -mucwin_requires_config(const char *const roomjid) +mucwin_requires_config(ProfMucWin *mucwin) { - ProfWin *window = (ProfWin*)wins_get_muc(roomjid); - if (window == NULL) { - log_error("Received room config request, but no window open for %s.", roomjid); - } else { - int num = wins_get_num(window); - int ui_index = num; - if (ui_index == 10) { - ui_index = 0; - } + assert(mucwin != NULL); - win_print(window, '-', 0, NULL, 0, 0, "", ""); - win_vprint(window, '!', 0, NULL, 0, THEME_ROOMINFO, "", - "Room locked, requires configuration."); - win_vprint(window, '!', 0, NULL, 0, THEME_ROOMINFO, "", - "Use '/room accept' to accept the defaults"); - win_vprint(window, '!', 0, NULL, 0, THEME_ROOMINFO, "", - "Use '/room destroy' to cancel and destroy the room"); - win_vprint(window, '!', 0, NULL, 0, THEME_ROOMINFO, "", - "Use '/room config' to edit the room configuration"); - win_print(window, '-', 0, NULL, 0, 0, "", ""); + ProfWin *window = (ProfWin*)mucwin; + int num = wins_get_num(window); + int ui_index = num; + if (ui_index == 10) { + ui_index = 0; + } - // currently in groupchat window - if (wins_is_current(window)) { - status_bar_active(num); + win_print(window, '-', 0, NULL, 0, 0, "", ""); + win_vprint(window, '!', 0, NULL, 0, THEME_ROOMINFO, "", "Room locked, requires configuration."); + win_vprint(window, '!', 0, NULL, 0, THEME_ROOMINFO, "", "Use '/room accept' to accept the defaults"); + win_vprint(window, '!', 0, NULL, 0, THEME_ROOMINFO, "", "Use '/room destroy' to cancel and destroy the room"); + win_vprint(window, '!', 0, NULL, 0, THEME_ROOMINFO, "", "Use '/room config' to edit the room configuration"); + win_print(window, '-', 0, NULL, 0, 0, "", ""); - // not currently on groupchat window - } else { - status_bar_new(num); - } + // currently in groupchat window + if (wins_is_current(window)) { + status_bar_active(num); + + // not currently on groupchat window + } else { + status_bar_new(num); } } diff --git a/src/ui/ui.h b/src/ui/ui.h index db22a3ed..a85e429f 100644 --- a/src/ui/ui.h +++ b/src/ui/ui.h @@ -176,7 +176,7 @@ void mucwin_roster(ProfMucWin *mucwin, GList *occupants, const char *const prese void mucwin_history(ProfMucWin *mucwin, const char *const nick, GDateTime *timestamp, const char *const message); void mucwin_message(ProfMucWin *mucwin, const char *const nick, const char *const message); void mucwin_subject(const char *const roomjid, const char *const nick, const char *const subject); -void mucwin_requires_config(const char *const roomjid); +void mucwin_requires_config(ProfMucWin *mucwin); void mucwin_info(ProfMucWin *mucwin); void mucwin_show_role_list(ProfMucWin *mucwin, muc_role_t role); void mucwin_show_affiliation_list(ProfMucWin *mucwin, muc_affiliation_t affiliation); diff --git a/tests/unittests/ui/stub_ui.c b/tests/unittests/ui/stub_ui.c index d1812d9d..41d240dc 100644 --- a/tests/unittests/ui/stub_ui.c +++ b/tests/unittests/ui/stub_ui.c @@ -207,7 +207,7 @@ void mucwin_roster(ProfMucWin *mucwin, GList *occupants, const char * const pres void mucwin_history(ProfMucWin *mucwin, const char * const nick, GDateTime *timestamp, const char * const message) {} void mucwin_message(ProfMucWin *mucwin, const char * const nick, const char * const message) {} void mucwin_subject(const char * const roomjid, const char * const nick, const char * const subject) {} -void mucwin_requires_config(const char * const roomjid) {} +void mucwin_requires_config(ProfMucWin *mucwin) {} void ui_room_destroy(const char * const roomjid) {} void mucwin_info(ProfMucWin *mucwin) {} void mucwin_show_role_list(ProfMucWin *mucwin, muc_role_t role) {} |