about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorJames Booth <boothj5@gmail.com>2014-11-08 22:35:47 +0000
committerJames Booth <boothj5@gmail.com>2014-11-08 22:35:47 +0000
commitbcfbc9f7b33a9d2b4a1c454ea89d2d409c80cda0 (patch)
treed30d9de284eb9cf9d301ca7d7794615b7805e8b6
parentda376b26d6e9ea688ce3ad575151011b16c75ac4 (diff)
downloadprofani-tty-bcfbc9f7b33a9d2b4a1c454ea89d2d409c80cda0.tar.gz
Added time to xmlconsole, handle newlines in messages
-rw-r--r--src/ui/core.c13
-rw-r--r--src/ui/window.c5
2 files changed, 10 insertions, 8 deletions
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';