diff --git a/src/event/server_events.c b/src/event/server_events.c index 37db7cec..bfac6ddd 100644 --- a/src/event/server_events.c +++ b/src/event/server_events.c @@ -521,7 +521,10 @@ sv_ev_roster_update(const char *const barejid, const char *const name, void sv_ev_xmpp_stanza(const char *const msg) { - xmlwin_show(msg); + ProfXMLWin *xmlwin = wins_get_xmlconsole(); + if (xmlwin) { + xmlwin_show(xmlwin, msg); + } } void diff --git a/src/ui/ui.h b/src/ui/ui.h index 6520358a..52389a11 100644 --- a/src/ui/ui.h +++ b/src/ui/ui.h @@ -209,7 +209,7 @@ void chatwin_otr_smp_event(ProfChatWin *chatwin, prof_otr_smp_event_t event, voi #endif // xml console -void xmlwin_show(const char *const msg); +void xmlwin_show(ProfXMLWin *xmlwin, const char *const msg); // Input window char* inp_readline(void); diff --git a/src/ui/xmlwin.c b/src/ui/xmlwin.c index d793fd05..31921390 100644 --- a/src/ui/xmlwin.c +++ b/src/ui/xmlwin.c @@ -32,16 +32,15 @@ * */ +#include + #include "ui/win_types.h" #include "window_list.h" void -xmlwin_show(const char *const msg) +xmlwin_show(ProfXMLWin *xmlwin, const char *const msg) { - ProfXMLWin *xmlwin = wins_get_xmlconsole(); - if (!xmlwin) { - return; - } + assert(xmlwin != NULL); ProfWin *window = (ProfWin*)xmlwin; if (g_str_has_prefix(msg, "SENT:")) { diff --git a/tests/unittests/ui/stub_ui.c b/tests/unittests/ui/stub_ui.c index 03142652..d146341a 100644 --- a/tests/unittests/ui/stub_ui.c +++ b/tests/unittests/ui/stub_ui.c @@ -165,7 +165,7 @@ char *ui_get_line(void) return NULL; } -void xmlwin_show(const char * const msg) {} +void xmlwin_show(ProfXMLWin *xmlwin, const char * const msg) {} // ui events void ui_contact_online(char *barejid, Resource *resource, GDateTime *last_activity)