diff options
author | James Booth <boothj5@gmail.com> | 2015-11-02 00:14:16 +0000 |
---|---|---|
committer | James Booth <boothj5@gmail.com> | 2015-11-02 00:14:16 +0000 |
commit | b3150ef8e122f5c48dc0794cd1337c7f72ad7653 (patch) | |
tree | 37a1db5c4d13b77e0d7f716c4360da74a4c66d49 | |
parent | d505a92d1e2f9c47d2e46c4ac934f16abb131308 (diff) | |
download | profani-tty-b3150ef8e122f5c48dc0794cd1337c7f72ad7653.tar.gz |
mucwin_occupant_presence takes ProfMucWin
-rw-r--r-- | src/event/server_events.c | 5 | ||||
-rw-r--r-- | src/ui/mucwin.c | 12 | ||||
-rw-r--r-- | src/ui/ui.h | 2 | ||||
-rw-r--r-- | tests/unittests/ui/stub_ui.c | 4 |
4 files changed, 11 insertions, 12 deletions
diff --git a/src/event/server_events.c b/src/event/server_events.c index d1e8380b..e9b756e3 100644 --- a/src/event/server_events.c +++ b/src/event/server_events.c @@ -658,8 +658,9 @@ sv_ev_muc_occupant_online(const char *const room, const char *const nick, const // presence updated if (updated) { char *muc_status_pref = prefs_get_string(PREF_STATUSES_MUC); - if (g_strcmp0(muc_status_pref, "all") == 0) { - mucwin_occupant_presence(room, nick, show, status); + ProfMucWin *mucwin = wins_get_muc(room); + if (mucwin && (g_strcmp0(muc_status_pref, "all") == 0)) { + mucwin_occupant_presence(mucwin, nick, show, status); } prefs_free_string(muc_status_pref); occupantswin_occupants(room); diff --git a/src/ui/mucwin.c b/src/ui/mucwin.c index b7d41800..2051d8a6 100644 --- a/src/ui/mucwin.c +++ b/src/ui/mucwin.c @@ -304,15 +304,13 @@ mucwin_occupant_online(ProfMucWin *mucwin, const char *const nick, const char *c } void -mucwin_occupant_presence(const char *const roomjid, const char *const nick, +mucwin_occupant_presence(ProfMucWin *mucwin, const char *const nick, const char *const show, const char *const status) { - ProfWin *window = (ProfWin*)wins_get_muc(roomjid); - if (window == NULL) { - log_error("Received presence for room participant %s, but no window open for %s.", nick, roomjid); - } else { - win_show_status_string(window, nick, show, status, NULL, "++", "online"); - } + assert(mucwin != NULL); + + ProfWin *window = (ProfWin*)mucwin; + win_show_status_string(window, nick, show, status, NULL, "++", "online"); } void diff --git a/src/ui/ui.h b/src/ui/ui.h index 25212f27..6790cd51 100644 --- a/src/ui/ui.h +++ b/src/ui/ui.h @@ -193,7 +193,7 @@ void mucwin_occupant_online(ProfMucWin *mucwin, const char *const nick, const ch const char *const affiliation, const char *const show, const char *const status); void mucwin_occupant_nick_change(const char *const roomjid, const char *const old_nick, const char *const nick); void mucwin_nick_change(const char *const roomjid, const char *const nick); -void mucwin_occupant_presence(const char *const roomjid, const char *const nick, const char *const show, +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_show_occupants(const char *const roomjid); diff --git a/tests/unittests/ui/stub_ui.c b/tests/unittests/ui/stub_ui.c index 375368ec..93adc4a9 100644 --- a/tests/unittests/ui/stub_ui.c +++ b/tests/unittests/ui/stub_ui.c @@ -233,8 +233,8 @@ void mucwin_occupant_online(ProfMucWin *mucwin, const char * const nick, const c void mucwin_occupant_nick_change(const char * const roomjid, const char * const old_nick, const char * const nick) {} void mucwin_nick_change(const char * const roomjid, const char * const nick) {} -void mucwin_occupant_presence(const char * const roomjid, - const char * const nick, const char * const show, const char * const status) {} +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_show_occupants(const char * const roomjid) {} void mucwin_hide_occupants(const char * const roomjid) {} |