From 949488f695afa21bffc11d9b352b183370757022 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Guido=20G=C3=BCnther?= Date: Sun, 21 Oct 2018 17:24:22 +0200 Subject: [PATCH 1/2] ChattyConversation: Don't skip the first digit on time stamps This fixes 14:03:42 being displayed as 4:03:42 Also skip the opening brace in parse_message so we don't let the actual format leak into other functions. --- src/chatty-conversation.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/chatty-conversation.c b/src/chatty-conversation.c index eec2d2c6..09bb282b 100644 --- a/src/chatty-conversation.c +++ b/src/chatty-conversation.c @@ -475,11 +475,12 @@ parse_message (const gchar* msg) /* Separate the timestamp from the rest of the message */ timesplit = g_strsplit (msg, ") ", -1); - if (timesplit[0] == NULL) + /* Format is '(x:y:z' */ + if (timesplit[0] == NULL || strlen (timesplit[0]) < 6) return NULL; log = g_new0 (ChattyLog, 1); - log->time_stamp = g_strdup(timesplit[0]); + log->time_stamp = g_strdup(&(timesplit[0][1])); if (timesplit[1] == NULL) return log; @@ -592,7 +593,7 @@ chatty_add_message_history_to_conv (gpointer data) log_data = msgs->data; if (msgs == (g_list_last (msgs))) { - time_stamp = log_data->time_stamp + 2; + time_stamp = log_data->time_stamp; } else { time_stamp = NULL; } -- GitLab From 9664124fe4e79e1dfd922917c69436ce64c55c75 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Guido=20G=C3=BCnther?= Date: Sun, 21 Oct 2018 17:43:33 +0200 Subject: [PATCH 2/2] ChattyConversation: Split messages into two parts maximum Otherwise messages containing e.g. a ': ' will be cut off --- src/chatty-conversation.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/chatty-conversation.c b/src/chatty-conversation.c index 09bb282b..10491ea2 100644 --- a/src/chatty-conversation.c +++ b/src/chatty-conversation.c @@ -474,7 +474,7 @@ parse_message (const gchar* msg) return NULL; /* Separate the timestamp from the rest of the message */ - timesplit = g_strsplit (msg, ") ", -1); + timesplit = g_strsplit (msg, ") ", 2); /* Format is '(x:y:z' */ if (timesplit[0] == NULL || strlen (timesplit[0]) < 6) return NULL; @@ -485,12 +485,12 @@ parse_message (const gchar* msg) if (timesplit[1] == NULL) return log; - accountsplit = g_strsplit (timesplit[1], ": ", -1); + accountsplit = g_strsplit (timesplit[1], ": ", 2); if (accountsplit[0] == NULL) return log; - namesplit = g_strsplit (accountsplit[0], "/", -1); + namesplit = g_strsplit (accountsplit[0], "/", 2); log->name = g_strdup (namesplit[0]); if (accountsplit[1] == NULL) -- GitLab