Fri, 18 Nov 2011 19:54:07 +0000
propagate from branch 'im.pidgin.pidgin' (head 78b626b30c43634f501b1eb61233cef2735ddf6a)
to branch 'im.pidgin.soc.2008.masterpassword' (head 5450e39dd3c5846f7906d6edc6ae29a3dc7ba202)
--- a/pidgin/gtkconv-theme.c Sat Nov 12 08:51:36 2011 +0000 +++ b/pidgin/gtkconv-theme.c Fri Nov 18 19:54:07 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 Sat Nov 12 08:51:36 2011 +0000 +++ b/pidgin/gtkconv.c Fri Nov 18 19:54:07 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;