From 79c857fb2a1290d9b70cf3acacc7fbe6a194458c Mon Sep 17 00:00:00 2001 From: James Booth Date: Tue, 22 Jul 2014 22:16:17 +0100 Subject: [PATCH] Fixed bug with chat room history times being coloured --- src/ui/core.c | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/src/ui/core.c b/src/ui/core.c index e8d66985..edaa1eb6 100644 --- a/src/ui/core.c +++ b/src/ui/core.c @@ -1584,7 +1584,27 @@ _ui_room_history(const char * const room_jid, const char * const nick, { ProfWin *window = wins_get_by_recipient(room_jid); - win_save_vprint(window, '-', (&tv_stamp), NO_COLOUR_FROM, 0, nick, message); + GString *line = g_string_new(""); + + GDateTime *time = g_date_time_new_from_timeval_utc(&tv_stamp); + gchar *date_fmt = g_date_time_format(time, "%H:%M:%S"); + g_string_append(line, date_fmt); + g_string_append(line, " - "); + g_date_time_unref(time); + g_free(date_fmt); + + if (strncmp(message, "/me ", 4) == 0) { + g_string_append(line, "*"); + g_string_append(line, nick); + g_string_append(line, message + 4); + } else { + g_string_append(line, nick); + g_string_append(line, ": "); + g_string_append(line, message); + } + + win_save_print(window, '-', NULL, NO_DATE, 0, "", line->str); + g_string_free(line, TRUE); if (wins_is_current(window)) { win_update_virtual(window);