merge of '6cc03d25d5f27238ff6eb3f1317be0a8ebb2d7ae' soc.2008.masterpassword

Sat, 19 Nov 2011 23:58:01 +0000

author
Elliott Sales de Andrade <qulogic@pidgin.im>
date
Sat, 19 Nov 2011 23:58:01 +0000
branch
soc.2008.masterpassword
changeset 34075
b94bb43be5d2
parent 34074
6cc03d25d5f2 (diff)
parent 34073
5da1137555a8 (current diff)
child 34076
64e389ae5cc3

merge of '6cc03d25d5f27238ff6eb3f1317be0a8ebb2d7ae'
and '5da1137555a881451f0b717e79a9aa8d7231e62a'

--- a/pidgin/gtkconv-theme.c	Mon Nov 14 07:30:24 2011 +0000
+++ b/pidgin/gtkconv-theme.c	Sat Nov 19 23:58:01 2011 +0000
@@ -111,6 +111,23 @@
 	return val;
 }
 
+/* The template path can either come from the theme, or can
+ * be stock Template.html that comes with Pidgin */
+static char *
+get_template_path(const char *dir)
+{
+	char *file;
+
+	file = g_build_filename(dir, "Contents", "Resources", "Template.html", NULL);
+
+	if (!g_file_test(file, G_FILE_TEST_EXISTS)) {
+		g_free(file);
+		file = g_build_filename(DATADIR, "pidgin", "theme", "conversation", "Template.html", NULL);
+	}
+
+	return file;
+}
+
 static const char *
 get_template_html(PidginConvThemePrivate *priv, const char *dir)
 {
@@ -119,14 +136,7 @@
 	if (priv->template_html)
 		return priv->template_html;
 
-	/* The template path can either come from the theme, or can
-	 * be stock Template.html that comes with the plugin */
-	file = g_build_filename(dir, "Contents", "Resources", "Template.html", NULL);
-
-	if (!g_file_test(file, G_FILE_TEST_EXISTS)) {
-		g_free(file);
-		file = g_build_filename(DATADIR, "pidgin", "webkit", "Template.html", NULL);
-	}
+	file = get_template_path(dir);
 
 	if (!g_file_get_contents(file, &priv->template_html, NULL, NULL)) {
 		purple_debug_error("webkit", "Could not locate a Template.html (%s)\n", file);
@@ -371,6 +381,7 @@
 	if (!g_file_get_contents(file, &priv->outgoing_next_context_html, NULL, NULL)) {
 		priv->outgoing_next_context_html = g_strdup(get_outgoing_context_html(priv, dir));
 	}
+	g_free(file);
 
 	return priv->outgoing_next_context_html;
 }
@@ -708,19 +719,12 @@
 pidgin_conversation_theme_get_template_path(PidginConvTheme *theme)
 {
 	const char *dir;
-	char *filename;
 
 	g_return_val_if_fail(theme != NULL, NULL);
 
 	dir = purple_theme_get_dir(PURPLE_THEME(theme));
-	filename = g_build_filename(dir, "Contents", "Resources", "Template.html", NULL);
 
-	if (!g_file_test(filename, G_FILE_TEST_EXISTS)) {
-		g_free(filename);
-		filename = g_build_filename(DATADIR, "pidgin", "webkit", "Template.html", NULL);
-	}
-
-	return filename;
+	return get_template_path(dir);
 }
 
 char *
--- a/pidgin/gtkconv.c	Mon Nov 14 07:30:24 2011 +0000
+++ b/pidgin/gtkconv.c	Sat Nov 19 23:58:01 2011 +0000
@@ -5098,7 +5098,11 @@
 			replace = purple_utf8_strftime(format ? format : "%X", NULL);
 			g_free(format);
 
+		} else if (g_str_has_prefix(cur, "%dateOpened%")) {
+			replace = purple_date_format_short(NULL);
+
 		} else {
+			cur++;
 			continue;
 		}
 
@@ -6129,6 +6133,9 @@
 			replace = purple_utf8_strftime(format ? format : "%X", NULL);
 			g_free(format);
 
+		} else if (g_str_has_prefix(cur, "%shortTime%")) {
+			replace = purple_utf8_strftime("%H:%M", NULL);
+
 		} 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)) {
@@ -6158,6 +6165,9 @@
 		} else if (g_str_has_prefix(cur, "%service%")) {
 			replace = purple_account_get_protocol_name(purple_conversation_get_account(conv));
 
+		} else if (g_str_has_prefix(cur, "%messageDirection%")) {
+			replace = purple_markup_is_rtl(message) ? "rtl" : "ltr";
+
 		} else {
 			cur++;
 			continue;

mercurial