pidgin: 3a5d7f22: Ensure all timestamps in a message are t...

qulogic at pidgin.im qulogic at pidgin.im
Tue Jan 3 04:41:17 EST 2012


----------------------------------------------------------------------
Revision: 3a5d7f229b67636ceed3ded528a4de65426e1e70
Parent:   6766246c96469cc9e6799c64e7da00ab9dbd5b7e
Author:   qulogic at pidgin.im
Date:     01/02/12 02:10:34
Branch:   im.pidgin.pidgin
URL: http://d.pidgin.im/viewmtn/revision/info/3a5d7f229b67636ceed3ded528a4de65426e1e70

Changelog: 

Ensure all timestamps in a message are the same. Based on something
pointed out by dvpdiner2.

Changes against parent 6766246c96469cc9e6799c64e7da00ab9dbd5b7e

  patched  pidgin/gtkconv.c

-------------- next part --------------
============================================================
--- pidgin/gtkconv.c	80062a5fb51c8ecd1b74ca4b4a188448ff3afece
+++ pidgin/gtkconv.c	f246310cae8bb33de50cc3e584f0a770c4e55da5
@@ -6096,6 +6096,7 @@ replace_message_tokens(
 	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 @@ replace_message_tokens(
 		} else if (g_str_has_prefix(cur, "%time")) {
 			const char *tmp = cur + strlen("%time");
 			char *format = NULL;
+
 			if (*tmp == '{') {
 				char *end;
 				tmp++;
@@ -6125,12 +6127,19 @@ replace_message_tokens(
 				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) {
 				if (purple_account_get_bool(purple_conversation_get_account(conv), "use-global-buddyicon", TRUE)) {


More information about the Commits mailing list