From ce0763e1607b1a6ee70a458f68cf00a44593b54d Mon Sep 17 00:00:00 2001 From: James Booth Date: Mon, 2 Nov 2015 00:57:13 +0000 Subject: mucwin_update_occupants takes ProfMucWin --- src/command/commands.c | 4 ++-- src/ui/mucwin.c | 10 ++++++---- src/ui/ui.h | 2 +- tests/unittests/ui/stub_ui.c | 2 +- 4 files changed, 10 insertions(+), 8 deletions(-) diff --git a/src/command/commands.c b/src/command/commands.c index 98d2ec8a..dc0c0137 100644 --- a/src/command/commands.c +++ b/src/command/commands.c @@ -3171,14 +3171,14 @@ cmd_occupants(ProfWin *window, const char *const command, gchar **args) if (g_strcmp0(args[0], "show") == 0) { if (g_strcmp0(args[1], "jid") == 0) { mucwin->showjid = TRUE; - mucwin_update_occupants(mucwin->roomjid); + mucwin_update_occupants(mucwin); } else { mucwin_show_occupants(mucwin->roomjid); } } else if (g_strcmp0(args[0], "hide") == 0) { if (g_strcmp0(args[1], "jid") == 0) { mucwin->showjid = FALSE; - mucwin_update_occupants(mucwin->roomjid); + mucwin_update_occupants(mucwin); } else { mucwin_hide_occupants(mucwin->roomjid); } diff --git a/src/ui/mucwin.c b/src/ui/mucwin.c index a1a5c850..777ee461 100644 --- a/src/ui/mucwin.c +++ b/src/ui/mucwin.c @@ -750,11 +750,13 @@ mucwin_info(ProfMucWin *mucwin) } void -mucwin_update_occupants(const char *const roomjid) +mucwin_update_occupants(ProfMucWin *mucwin) { - ProfWin *window = (ProfWin*)wins_get_muc(roomjid); - if (window && win_has_active_subwin(window)) { - occupantswin_occupants(roomjid); + assert(mucwin != NULL); + + ProfWin *window = (ProfWin*)mucwin; + if (win_has_active_subwin(window)) { + occupantswin_occupants(mucwin->roomjid); } } diff --git a/src/ui/ui.h b/src/ui/ui.h index a483bc81..469765ad 100644 --- a/src/ui/ui.h +++ b/src/ui/ui.h @@ -194,7 +194,7 @@ void mucwin_occupant_nick_change(ProfMucWin *mucwin, const char *const old_nick, void mucwin_nick_change(ProfMucWin *mucwin, const char *const nick); void mucwin_occupant_presence(ProfMucWin *mucwin, const char *const nick, const char *const show, const char *const status); -void mucwin_update_occupants(const char *const roomjid); +void mucwin_update_occupants(ProfMucWin *mucwin); void mucwin_show_occupants(const char *const roomjid); void mucwin_hide_occupants(const char *const roomjid); void mucwin_affiliation_list_error(ProfMucWin *mucwin, const char *const affiliation, const char *const error); diff --git a/tests/unittests/ui/stub_ui.c b/tests/unittests/ui/stub_ui.c index 77887a97..c5c75c51 100644 --- a/tests/unittests/ui/stub_ui.c +++ b/tests/unittests/ui/stub_ui.c @@ -231,7 +231,7 @@ void mucwin_occupant_nick_change(ProfMucWin *mucwin, const char * const old_nick void mucwin_nick_change(ProfMucWin *mucwin, const char * const nick) {} void mucwin_occupant_presence(ProfMucWin *mucwin, const char * const nick, const char * const show, const char * const status) {} -void mucwin_update_occupants(const char * const roomjid) {} +void mucwin_update_occupants(ProfMucWin *mucwin) {} void mucwin_show_occupants(const char * const roomjid) {} void mucwin_hide_occupants(const char * const roomjid) {} void ui_show_roster(void) {} -- cgit 1.4.1-2-gfad0