pidgin: f7aa873b: Ensure timestamps in header all all the ...

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


----------------------------------------------------------------------
Revision: f7aa873b9699de75db73441a0ca52795d63cfae1
Parent:   98a926c696454699c53475810b4e8182dfd1e71d
Author:   qulogic at pidgin.im
Date:     01/02/12 04:13:39
Branch:   im.pidgin.pidgin
URL: http://d.pidgin.im/viewmtn/revision/info/f7aa873b9699de75db73441a0ca52795d63cfae1

Changelog: 

Ensure timestamps in header all all the same.

Changes against parent 98a926c696454699c53475810b4e8182dfd1e71d

  patched  pidgin/gtkconv.c

-------------- next part --------------
============================================================
--- pidgin/gtkconv.c	2fd2b52359ada2e15efa8069634d05bd59221f58
+++ pidgin/gtkconv.c	4cd809b7260bcefb30aeab9687d22caf04394d2d
@@ -5045,6 +5045,8 @@ replace_header_tokens(PurpleConversation
 	GString *str;
 	const char *cur = text;
 	const char *prev = cur;
+	time_t mtime;
+	struct tm *tm = NULL;
 
 	if (text == NULL || *text == '\0')
 		return NULL;
@@ -5081,6 +5083,7 @@ replace_header_tokens(PurpleConversation
 		} else if (g_str_has_prefix(cur, "%timeOpened")) {
 			const char *tmp = cur + strlen("%timeOpened");
 			char *format = NULL;
+
 			if (*tmp == '{') {
 				const char *end;
 				tmp++;
@@ -5090,12 +5093,23 @@ replace_header_tokens(PurpleConversation
 				format = g_strndup(tmp, end - tmp);
 				fin = end + 1;
 			}
-			replace = purple_utf8_strftime(format ? format : "%X", NULL);
+
+			if (!tm) {
+				mtime = time(NULL);
+				tm = localtime(&mtime);
+			}
+
+			replace = purple_utf8_strftime(format ? format : "%X", tm);
 			g_free(format);
 
 		} else if (g_str_has_prefix(cur, "%dateOpened%")) {
-			replace = purple_date_format_short(NULL);
+			if (!tm) {
+				mtime = time(NULL);
+				tm = localtime(&mtime);
+			}
 
+			replace = purple_date_format_short(tm);
+
 		} else {
 			cur++;
 			continue;


More information about the Commits mailing list