diff -r 34d89dcecc9b -r e1b50abc07bb pidgin/gtkconv.c --- a/pidgin/gtkconv.c Wed Jun 13 19:33:03 2012 -0400 +++ b/pidgin/gtkconv.c Fri Jun 15 03:35:32 2012 -0400 @@ -1058,12 +1058,10 @@ static void savelog_writefile_cb(void *user_data, const char *filename) { - /* TODO WEBKIT: I don't know how to support this using webkit yet. */ -#if 0 PurpleConversation *conv = (PurpleConversation *)user_data; + GtkWebView *webview; FILE *fp; const char *name; - char **lines; gchar *text; if ((fp = g_fopen(filename, "w+")) == NULL) { @@ -1071,22 +1069,27 @@ return; } + webview = GTK_WEBVIEW(PIDGIN_CONVERSATION(conv)->webview); name = purple_conversation_get_name(conv); - fprintf(fp, "\n\n"); + fprintf(fp, "\n"); + + fprintf(fp, "\n"); fprintf(fp, "\n"); - fprintf(fp, "%s\n\n\n", name); - fprintf(fp, _("

Conversation with %s

\n"), name); - - lines = gtk_imhtml_get_markup_lines( - GTK_IMHTML(PIDGIN_CONVERSATION(conv)->imhtml)); - text = g_strjoinv("
\n", lines); + fprintf(fp, "%s\n", name); + text = gtk_webview_get_head_html(webview); fprintf(fp, "%s", text); g_free(text); - g_strfreev(lines); - - fprintf(fp, "\n\n\n"); + fprintf(fp, "\n"); + + fprintf(fp, "\n"); + fprintf(fp, _("

Conversation with %s

\n"), name); + text = gtk_webview_get_body_html(webview); + fprintf(fp, "%s", text); + g_free(text); + fprintf(fp, "\n\n"); + + fprintf(fp, "\n"); fclose(fp); -#endif /* if 0 */ } /* @@ -5089,6 +5092,7 @@ str = g_string_new(NULL); while ((cur = strchr(cur, '%'))) { + char *freeval = NULL; const char *replace = NULL; const char *fin = NULL; @@ -5118,7 +5122,6 @@ } else if (g_str_has_prefix(cur, "%timeOpened")) { const char *tmp = cur + strlen("%timeOpened"); - char *format = NULL; if (*tmp == '{') { const char *end; @@ -5126,18 +5129,21 @@ end = strstr(tmp, "}%"); if (!end) /* Invalid string */ continue; - format = g_strndup(tmp, end - tmp); + if (!tm) { + mtime = time(NULL); + tm = localtime(&mtime); + } + replace = freeval = purple_uts35_to_str(tmp, end - tmp, tm); fin = end + 1; + } else { + if (!tm) { + mtime = time(NULL); + tm = localtime(&mtime); + } + + replace = purple_utf8_strftime("%X", tm); } - 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%")) { if (!tm) { mtime = time(NULL); @@ -5162,6 +5168,8 @@ } else { prev = cur = strchr(cur + 1, '%') + 1; } + g_free(freeval); + freeval = NULL; } /* And wrap it up */ @@ -6204,7 +6212,6 @@ } else if (g_str_has_prefix(cur, "%time")) { const char *tmp = cur + strlen("%time"); - char *format = NULL; if (*tmp == '{') { char *end; @@ -6212,16 +6219,17 @@ end = strstr(tmp, "}%"); if (!end) /* Invalid string */ continue; - format = g_strndup(tmp, end - tmp); + if (!tm) + tm = localtime(&mtime); + replace = freeval = purple_uts35_to_str(tmp, end - tmp, tm); fin = end + 1; + } else { + if (!tm) + tm = localtime(&mtime); + + replace = purple_utf8_strftime("%X", tm); } - if (!tm) - tm = localtime(&mtime); - - replace = purple_utf8_strftime(format ? format : "%X", tm); - g_free(format); - } else if (g_str_has_prefix(cur, "%shortTime%")) { if (!tm) tm = localtime(&mtime);