Mercurial > pidgin
changeset 32425:2abaa6070134
Ensure all timestamps in a message are the same. Based on something
pointed out by dvpdiner2.
author | Elliott Sales de Andrade <qulogic@pidgin.im> |
---|---|
date | Mon, 02 Jan 2012 07:10:34 +0000 |
parents | fb45c0e52648 |
children | 4dfafe26e51d |
files | pidgin/gtkconv.c |
diffstat | 1 files changed, 11 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/pidgin/gtkconv.c Mon Jan 02 06:53:19 2012 +0000 +++ b/pidgin/gtkconv.c Mon Jan 02 07:10:34 2012 +0000 @@ -6096,6 +6096,7 @@ GString *str; const char *cur = text; const char *prev = cur; + struct tm *tm = NULL; if (text == NULL || *text == '\0') return NULL; @@ -6116,6 +6117,7 @@ } else if (g_str_has_prefix(cur, "%time")) { const char *tmp = cur + strlen("%time"); char *format = NULL; + if (*tmp == '{') { char *end; tmp++; @@ -6125,11 +6127,18 @@ format = g_strndup(tmp, end - tmp); fin = end + 1; } - replace = purple_utf8_strftime(format ? format : "%X", NULL); + + if (!tm) + tm = localtime(&mtime); + + replace = purple_utf8_strftime(format ? format : "%X", tm); g_free(format); } else if (g_str_has_prefix(cur, "%shortTime%")) { - replace = purple_utf8_strftime("%H:%M", NULL); + if (!tm) + tm = localtime(&mtime); + + replace = purple_utf8_strftime("%H:%M", tm); } else if (g_str_has_prefix(cur, "%userIconPath%")) { if (flags & PURPLE_MESSAGE_SEND) {