From bcfbc9f7b33a9d2b4a1c454ea89d2d409c80cda0 Mon Sep 17 00:00:00 2001 From: James Booth Date: Sat, 8 Nov 2014 22:35:47 +0000 Subject: Added time to xmlconsole, handle newlines in messages --- src/ui/core.c | 13 ++++++------- src/ui/window.c | 5 ++++- 2 files changed, 10 insertions(+), 8 deletions(-) (limited to 'src/ui') diff --git a/src/ui/core.c b/src/ui/core.c index e959e94e..07434e2f 100644 --- a/src/ui/core.c +++ b/src/ui/core.c @@ -246,13 +246,13 @@ _ui_handle_stanza(const char * const msg) ProfWin *xmlconsole = wins_get_xmlconsole(); if (g_str_has_prefix(msg, "SENT:")) { - win_save_print(xmlconsole, '-', NULL, NO_DATE, 0, "", "SENT:"); - win_save_print(xmlconsole, '-', NULL, NO_DATE, COLOUR_ONLINE, "", &msg[6]); - win_save_print(xmlconsole, '-', NULL, NO_DATE, COLOUR_ONLINE, "", ""); + win_save_print(xmlconsole, '-', NULL, 0, 0, "", "SENT:"); + win_save_print(xmlconsole, '-', NULL, 0, COLOUR_ONLINE, "", &msg[6]); + win_save_print(xmlconsole, '-', NULL, 0, COLOUR_ONLINE, "", ""); } else if (g_str_has_prefix(msg, "RECV:")) { - win_save_print(xmlconsole, '-', NULL, NO_DATE, 0, "", "RECV:"); - win_save_print(xmlconsole, '-', NULL, NO_DATE, COLOUR_AWAY, "", &msg[6]); - win_save_print(xmlconsole, '-', NULL, NO_DATE, COLOUR_AWAY, "", ""); + win_save_print(xmlconsole, '-', NULL, 0, 0, "", "RECV:"); + win_save_print(xmlconsole, '-', NULL, 0, COLOUR_AWAY, "", &msg[6]); + win_save_print(xmlconsole, '-', NULL, 0, COLOUR_AWAY, "", ""); } } } @@ -3216,4 +3216,3 @@ ui_init_module(void) ui_room_occupant_role_and_affiliation_change = _ui_room_occupant_role_and_affiliation_change; ui_redraw_all_room_rosters = _ui_redraw_all_room_rosters; } - diff --git a/src/ui/window.c b/src/ui/window.c index 00d95bbb..a9dac466 100644 --- a/src/ui/window.c +++ b/src/ui/window.c @@ -604,9 +604,12 @@ _win_print_wrapped(WINDOW *win, const char * const message) if (message[linei] == ' ') { wprintw(win, " "); linei++; + } else if (message[linei] == '\n') { + wprintw(win, "\n "); + linei++; } else { wordi = 0; - while (message[linei] != ' ' && message[linei] != '\0') { + while (message[linei] != ' ' && message[linei] != '\n' && message[linei] != '\0') { word[wordi++] = message[linei++]; } word[wordi] = '\0'; -- cgit 1.4.1-2-gfad0