1
0
mirror of https://github.com/profanity-im/profanity.git synced 2024-12-04 14:46:46 -05:00

Added time to xmlconsole, handle newlines in messages

This commit is contained in:
James Booth 2014-11-08 22:35:47 +00:00
parent da376b26d6
commit bcfbc9f7b3
2 changed files with 10 additions and 8 deletions

View File

@ -246,13 +246,13 @@ _ui_handle_stanza(const char * const msg)
ProfWin *xmlconsole = wins_get_xmlconsole(); ProfWin *xmlconsole = wins_get_xmlconsole();
if (g_str_has_prefix(msg, "SENT:")) { if (g_str_has_prefix(msg, "SENT:")) {
win_save_print(xmlconsole, '-', NULL, NO_DATE, 0, "", "SENT:"); win_save_print(xmlconsole, '-', NULL, 0, 0, "", "SENT:");
win_save_print(xmlconsole, '-', NULL, NO_DATE, COLOUR_ONLINE, "", &msg[6]); win_save_print(xmlconsole, '-', NULL, 0, COLOUR_ONLINE, "", &msg[6]);
win_save_print(xmlconsole, '-', NULL, NO_DATE, COLOUR_ONLINE, "", ""); win_save_print(xmlconsole, '-', NULL, 0, COLOUR_ONLINE, "", "");
} else if (g_str_has_prefix(msg, "RECV:")) { } else if (g_str_has_prefix(msg, "RECV:")) {
win_save_print(xmlconsole, '-', NULL, NO_DATE, 0, "", "RECV:"); win_save_print(xmlconsole, '-', NULL, 0, 0, "", "RECV:");
win_save_print(xmlconsole, '-', NULL, NO_DATE, COLOUR_AWAY, "", &msg[6]); win_save_print(xmlconsole, '-', NULL, 0, COLOUR_AWAY, "", &msg[6]);
win_save_print(xmlconsole, '-', NULL, NO_DATE, COLOUR_AWAY, "", ""); 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_room_occupant_role_and_affiliation_change = _ui_room_occupant_role_and_affiliation_change;
ui_redraw_all_room_rosters = _ui_redraw_all_room_rosters; ui_redraw_all_room_rosters = _ui_redraw_all_room_rosters;
} }

View File

@ -604,9 +604,12 @@ _win_print_wrapped(WINDOW *win, const char * const message)
if (message[linei] == ' ') { if (message[linei] == ' ') {
wprintw(win, " "); wprintw(win, " ");
linei++; linei++;
} else if (message[linei] == '\n') {
wprintw(win, "\n ");
linei++;
} else { } else {
wordi = 0; wordi = 0;
while (message[linei] != ' ' && message[linei] != '\0') { while (message[linei] != ' ' && message[linei] != '\n' && message[linei] != '\0') {
word[wordi++] = message[linei++]; word[wordi++] = message[linei++];
} }
word[wordi] = '\0'; word[wordi] = '\0';