changeset 16808:422bcef3154c

Fix ticket #559: Message Timestamp Formats Parentheses Bug If you choose "Force traditional..." or set the date to be displayed always in the conversation window, there are no longer parentheses around the date/time.
author Stu Tomlinson <stu@nosnilmot.com>
date Thu, 03 May 2007 13:12:16 +0000
parents f7466b0379e8
children 2a98d8b6095e
files pidgin/plugins/timestamp_format.c
diffstat 1 files changed, 7 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/pidgin/plugins/timestamp_format.c	Thu May 03 08:34:53 2007 +0000
+++ b/pidgin/plugins/timestamp_format.c	Thu May 03 13:12:16 2007 +0000
@@ -58,7 +58,8 @@
                                  time_t t,
                                  gboolean show_date,
                                  gboolean force,
-                                 const char *dates)
+                                 const char *dates,
+								 gboolean parens)
 {
 	g_return_val_if_fail(dates != NULL, NULL);
 
@@ -68,15 +69,15 @@
 	{
 		struct tm *tm = localtime(&t);
 		if (force)
-			return g_strdup(purple_utf8_strftime("%Y-%m-%d %H:%M:%S", tm));
+			return g_strdup_printf("%s%s%s", parens ? "(" : "", purple_utf8_strftime("%Y-%m-%d %H:%M:%S", tm), parens ? ")" : "");
 		else
-			return g_strdup(purple_date_format_long(tm));
+			return g_strdup_printf("%s%s%s", parens ? "(" : "", purple_date_format_long(tm), parens ? ")" : "");
 	}
 
 	if (force)
 	{
 		struct tm *tm = localtime(&t);
-		return g_strdup(purple_utf8_strftime("%H:%M:%S", tm));
+		return g_strdup_printf("%s%s%s", parens ? "(" : "", purple_utf8_strftime("%H:%M:%S", tm), parens ? ")" : "");
 	}
 
 	return NULL;
@@ -92,7 +93,7 @@
 
 	g_return_val_if_fail(conv != NULL, NULL);
 
-	return timestamp_cb_common(conv, t, show_date, force, dates);
+	return timestamp_cb_common(conv, t, show_date, force, dates, TRUE);
 }
 
 static char *log_timestamp_cb(PurpleLog *log, time_t t, gboolean show_date, gpointer data)
@@ -104,7 +105,7 @@
 
 	g_return_val_if_fail(log != NULL, NULL);
 
-	return timestamp_cb_common(log->conv, t, show_date, force, dates);
+	return timestamp_cb_common(log->conv, t, show_date, force, dates, FALSE);
 }
 
 static gboolean