diff options
author | James Booth <boothj5@gmail.com> | 2014-04-15 23:45:17 +0100 |
---|---|---|
committer | James Booth <boothj5@gmail.com> | 2014-04-15 23:45:17 +0100 |
commit | ef776e52ca77c95a3f2cfb8a42d675009c257f00 (patch) | |
tree | db425431a6f639498b2842e377a40c1c6a5224a6 | |
parent | e6e0a13e8935e6e87190bf4255c8ed313fd6afc2 (diff) | |
download | profani-tty-ef776e52ca77c95a3f2cfb8a42d675009c257f00.tar.gz |
Tidied xmlconsole
-rw-r--r-- | src/command/command.c | 1 | ||||
-rw-r--r-- | src/ui/core.c | 24 | ||||
-rw-r--r-- | src/ui/statusbar.c | 8 | ||||
-rw-r--r-- | src/ui/window.c | 8 | ||||
-rw-r--r-- | src/ui/window.h | 1 |
5 files changed, 24 insertions, 18 deletions
diff --git a/src/command/command.c b/src/command/command.c index 3520535b..23d5bae4 100644 --- a/src/command/command.c +++ b/src/command/command.c @@ -1382,6 +1382,7 @@ cmd_execute_default(const char * const inp) break; case WIN_CONSOLE: + case WIN_XML: cons_show("Unknown command: %s", inp); break; diff --git a/src/ui/core.c b/src/ui/core.c index f80c6ad2..b6acc925 100644 --- a/src/ui/core.c +++ b/src/ui/core.c @@ -230,17 +230,21 @@ _ui_handle_stanza(const char * const msg) { if (ui_xmlconsole_exists()) { ProfWin *xmlconsole = wins_get_xmlconsole(); - + if (g_str_has_prefix(msg, "SENT:")) { - win_vprint_line(xmlconsole, '!', COLOUR_ONLINE, "<- %s", &msg[6]); - } else if (g_str_has_prefix(msg, "RECV:")) { - win_vprint_line(xmlconsole, '!', COLOUR_AWAY, "-> %s", &msg[6]); - } - - win_update_virtual(xmlconsole); - if (wins_is_current(xmlconsole)) { - ui_current_page_off(); - } + win_print_line_no_time(xmlconsole, 0, "SENT:"); + win_print_line_no_time(xmlconsole, COLOUR_ONLINE, &msg[6]); + win_print_line_no_time(xmlconsole, COLOUR_ONLINE, ""); + } else if (g_str_has_prefix(msg, "RECV:")) { + win_print_line_no_time(xmlconsole, 0, "RECV:"); + win_print_line_no_time(xmlconsole, COLOUR_AWAY, &msg[6]); + win_print_line_no_time(xmlconsole, COLOUR_ONLINE, ""); + } + + if (wins_is_current(xmlconsole)) { + win_update_virtual(xmlconsole); + ui_current_page_off(); + } } } diff --git a/src/ui/statusbar.c b/src/ui/statusbar.c index 9ab0b69d..00e7353a 100644 --- a/src/ui/statusbar.c +++ b/src/ui/statusbar.c @@ -302,14 +302,6 @@ status_bar_clear(void) message = NULL; } - int i; - is_active[1] = TRUE; - is_new[1] = FALSE; - for (i = 2; i < 12; i++) { - is_active[i] = FALSE; - is_new[i] = FALSE; - } - werase(status_bar); int cols = getmaxx(stdscr); diff --git a/src/ui/window.c b/src/ui/window.c index 0b3f90f8..63d83600 100644 --- a/src/ui/window.c +++ b/src/ui/window.c @@ -90,6 +90,14 @@ win_print_line(ProfWin *window, const char show_char, int attrs, } void +win_print_line_no_time(ProfWin *window, int attrs, const char * const msg) +{ + wattron(window->win, attrs); + wprintw(window->win, "%s\n", msg); + wattroff(window->win, attrs); +} + +void win_vprint_line(ProfWin *window, const char show_char, int attrs, const char * const msg, ...) { diff --git a/src/ui/window.h b/src/ui/window.h index 874e6307..9208e497 100644 --- a/src/ui/window.h +++ b/src/ui/window.h @@ -63,6 +63,7 @@ void win_vprint_line(ProfWin *self, const char show_char, int attrs, const char * const msg, ...); void win_print_line(ProfWin *self, const char show_char, int attrs, const char * const msg); +void win_print_line_no_time(ProfWin *window, int attrs, const char * const msg); void win_update_virtual(ProfWin *window); void win_move_to_end(ProfWin *window); void win_print_time(ProfWin *window, char show_char); |