diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/command/commands.c | 7 | ||||
-rw-r--r-- | src/ui/core.c | 56 | ||||
-rw-r--r-- | src/ui/ui.h | 1 |
3 files changed, 27 insertions, 37 deletions
diff --git a/src/command/commands.c b/src/command/commands.c index 5da5f3f8..037ec453 100644 --- a/src/command/commands.c +++ b/src/command/commands.c @@ -4397,10 +4397,11 @@ cmd_vercheck(ProfWin *window, const char *const command, gchar **args) gboolean cmd_xmlconsole(ProfWin *window, const char *const command, gchar **args) { - if (!ui_xmlconsole_exists()) { - ui_create_xmlconsole_win(); - } else { + ProfXMLWin *xmlwin = wins_get_xmlconsole(); + if (xmlwin) { ui_open_xmlconsole_win(); + } else { + ui_create_xmlconsole_win(); } return TRUE; diff --git a/src/ui/core.c b/src/ui/core.c index f5b365be..340d54d5 100644 --- a/src/ui/core.c +++ b/src/ui/core.c @@ -222,33 +222,39 @@ ui_load_colours(void) } } -gboolean -ui_xmlconsole_exists(void) +void +ui_create_xmlconsole_win(void) +{ + ProfWin *window = wins_new_xmlconsole(); + ui_switch_win(window); +} + +void +ui_open_xmlconsole_win(void) { ProfXMLWin *xmlwin = wins_get_xmlconsole(); if (xmlwin) { - return TRUE; - } else { - return FALSE; + ui_switch_win((ProfWin*)xmlwin); } } void ui_handle_stanza(const char *const msg) { - if (ui_xmlconsole_exists()) { - ProfXMLWin *xmlconsole = wins_get_xmlconsole(); - ProfWin *window = (ProfWin*) xmlconsole; + ProfXMLWin *xmlwin = wins_get_xmlconsole(); + if (!xmlwin) { + return; + } - if (g_str_has_prefix(msg, "SENT:")) { - win_print(window, '-', 0, NULL, 0, 0, "", "SENT:"); - win_print(window, '-', 0, NULL, 0, THEME_ONLINE, "", &msg[6]); - win_print(window, '-', 0, NULL, 0, THEME_ONLINE, "", ""); - } else if (g_str_has_prefix(msg, "RECV:")) { - win_print(window, '-', 0, NULL, 0, 0, "", "RECV:"); - win_print(window, '-', 0, NULL, 0, THEME_AWAY, "", &msg[6]); - win_print(window, '-', 0, NULL, 0, THEME_AWAY, "", ""); - } + ProfWin *window = (ProfWin*)xmlwin; + if (g_str_has_prefix(msg, "SENT:")) { + win_print(window, '-', 0, NULL, 0, 0, "", "SENT:"); + win_print(window, '-', 0, NULL, 0, THEME_ONLINE, "", &msg[6]); + win_print(window, '-', 0, NULL, 0, THEME_ONLINE, "", ""); + } else if (g_str_has_prefix(msg, "RECV:")) { + win_print(window, '-', 0, NULL, 0, 0, "", "RECV:"); + win_print(window, '-', 0, NULL, 0, THEME_AWAY, "", &msg[6]); + win_print(window, '-', 0, NULL, 0, THEME_AWAY, "", ""); } } @@ -898,22 +904,6 @@ ui_new_private_win(const char *const fulljid) } void -ui_create_xmlconsole_win(void) -{ - ProfWin *window = wins_new_xmlconsole(); - ui_switch_win(window); -} - -void -ui_open_xmlconsole_win(void) -{ - ProfXMLWin *xmlwin = wins_get_xmlconsole(); - if (xmlwin) { - ui_switch_win((ProfWin*)xmlwin); - } -} - -void ui_outgoing_private_msg(ProfPrivateWin *privwin, const char *const message) { win_print((ProfWin*)privwin, '-', 0, NULL, 0, THEME_TEXT_ME, "me", message); diff --git a/src/ui/ui.h b/src/ui/ui.h index 5ea836c5..909e9d5d 100644 --- a/src/ui/ui.h +++ b/src/ui/ui.h @@ -189,7 +189,6 @@ void ui_statusbar_new(const int win); void ui_write(char *line, int offset); void ui_invalid_command_usage(const char *const cmd, void (*setting_func)(void)); void ui_create_xmlconsole_win(void); -gboolean ui_xmlconsole_exists(void); void ui_open_xmlconsole_win(void); gboolean ui_win_has_unsaved_form(int num); void ui_inp_history_append(char *inp); |