280 lines
10 KiB
Plaintext
280 lines
10 KiB
Plaintext
$OpenBSD: patch-src_rss_c,v 1.4 2011/09/22 10:55:13 jasper Exp $
|
|
|
|
From 62d6e9a7a68dc90abd244431afb47de9826cb423 Mon Sep 17 00:00:00 2001
|
|
From: Lucian Langa <lucilanga@gnome.org>
|
|
Date: Thu, 07 Jul 2011 20:34:45 +0000
|
|
Subject: Avoid camel_stream_printf().
|
|
|
|
--- src/rss.c.orig Sun Jun 19 17:27:29 2011
|
|
+++ src/rss.c Thu Sep 22 12:43:43 2011
|
|
@@ -2174,6 +2174,7 @@ void org_gnome_cooly_format_rss(void *ep, EMFormatHook
|
|
GdkPixbuf *pix;
|
|
gchar *feed_dir, *feed_file, *iconfile;
|
|
gchar *tmp_path, *tmp_file;
|
|
+ gchar *str;
|
|
#if EVOLUTION_VERSION >= 22900 //kb//
|
|
GdkColor color;
|
|
#endif
|
|
@@ -2261,10 +2262,11 @@ void org_gnome_cooly_format_rss(void *ep, EMFormatHook
|
|
pobj->website = g_strstrip(g_strdup((gchar *)website));
|
|
pobj->stream = t->stream;
|
|
pobj->object.free = free_rss_controls;
|
|
- camel_stream_printf (
|
|
- t->stream,
|
|
+ str = g_strdup_printf (
|
|
"<object classid=%s></object>\n",
|
|
classid);
|
|
+ camel_stream_write_string (t->stream, str, NULL, NULL);
|
|
+ g_free(str);
|
|
g_free (classid);
|
|
|
|
|
|
@@ -2288,14 +2290,18 @@ void org_gnome_cooly_format_rss(void *ep, EMFormatHook
|
|
pobj->format = (EMFormatHTML *)t->format;
|
|
pobj->object.free = free_rss_browser;
|
|
pobj->part = t->part;
|
|
- camel_stream_printf(t->stream,
|
|
+ str = g_strdup_printf (
|
|
"<table style=\"border: solid #%06x 1px; background-color: #%06x; color: #%06x;\" cellpadding=1 cellspacing=0><tr><td align=center>",
|
|
frame_colour & 0xffffff,
|
|
frame_colour & 0xffffff,
|
|
text_colour & 0xffffff);
|
|
- camel_stream_printf (t->stream,
|
|
+ camel_stream_write_string (t->stream, str, NULL, NULL);
|
|
+ g_free (str);
|
|
+ str = g_strdup_printf (
|
|
"<object classid=%s></object></td></tr></table>",//</div>\n",
|
|
classid);
|
|
+ camel_stream_write_string (t->stream, str, NULL, NULL);
|
|
+ g_free (str);
|
|
g_free (classid);
|
|
goto out;
|
|
}
|
|
@@ -2306,16 +2312,17 @@ void org_gnome_cooly_format_rss(void *ep, EMFormatHook
|
|
//we do not need to setup a pop error menu since we're in
|
|
//formatting process. But instead display mail body an error
|
|
//such proxy error or transport error
|
|
- camel_stream_printf (t->stream,
|
|
+ str = g_strdup_printf (
|
|
"<div style=\"border: solid #%06x 1px; background-color: #%06x; color: #%06x;\">\n",
|
|
frame_colour & 0xffffff,
|
|
content_colour & 0xffffff,
|
|
text_colour & 0xffffff);
|
|
- camel_stream_printf(t->stream,
|
|
- "<div style=\"border: solid 0px; padding: 4px;\">\n");
|
|
- camel_stream_printf (t->stream, "<h3>Error!</h3>");
|
|
- camel_stream_printf (t->stream, "%s", err->message);
|
|
- camel_stream_printf (t->stream, "</div>");
|
|
+ camel_stream_write_string (t->stream, str, NULL, NULL);
|
|
+ g_free (str);
|
|
+ camel_stream_write_string (t->stream, "<div style=\"border: solid 0px; padding: 4px;\">\n", NULL, NULL);
|
|
+ camel_stream_write_string (t->stream, "<h3>Error!</h3>", NULL, NULL);
|
|
+ camel_stream_write_string (t->stream, err->message, NULL, NULL);
|
|
+ camel_stream_write_string (t->stream, "</div>", NULL, NULL);
|
|
goto out;
|
|
}
|
|
|
|
@@ -2329,30 +2336,39 @@ void org_gnome_cooly_format_rss(void *ep, EMFormatHook
|
|
} else
|
|
goto out;
|
|
|
|
- camel_stream_printf (fstream,
|
|
+ str = g_strdup_printf (
|
|
"<div style=\"border: solid #%06x 1px; background-color: #%06x; color: #%06x;\">\n",
|
|
frame_colour & 0xffffff,
|
|
content_colour & 0xffffff,
|
|
text_colour & 0xffffff);
|
|
- camel_stream_printf (fstream,
|
|
+ camel_stream_write_string (fstream, str, NULL, NULL);
|
|
+ g_free (str);
|
|
+ str = g_strdup_printf (
|
|
"<div style=\"border: solid 0px; background-color: #%06x; padding: 2px; color: #%06x;\">"
|
|
"<b><font size=+1><a href=%s>%s</a></font></b></div>",
|
|
content_colour & 0xEDECEB & 0xffffff,
|
|
text_colour & 0xffffff,
|
|
website, subject);
|
|
- if (category)
|
|
- camel_stream_printf(fstream,
|
|
+ camel_stream_write_string (fstream, str, NULL, NULL);
|
|
+ g_free (str);
|
|
+ if (category) {
|
|
+ str = g_strdup_printf (
|
|
"<div style=\"border: solid 0px; background-color: #%06x; padding: 2px; color: #%06x;\">"
|
|
"<b><font size=-1>%s: %s</font></b></div>",
|
|
content_colour & 0xEDECEB & 0xffffff, text_colour & 0xffffff,
|
|
_("Posted under"), category);
|
|
- camel_stream_printf (fstream,
|
|
+ camel_stream_write_string (fstream, str, NULL, NULL);
|
|
+ g_free (str);
|
|
+ }
|
|
+ str = g_strdup_printf (
|
|
"<div style=\"border: solid #%06x 0px; background-color: #%06x; padding: 2px; color: #%06x;\">"
|
|
"%s</div>",
|
|
frame_colour & 0xffffff,
|
|
content_colour & 0xffffff,
|
|
text_colour & 0xffffff,
|
|
buff);
|
|
+ camel_stream_write_string (fstream, str, NULL, NULL);
|
|
+ g_free (str);
|
|
|
|
g_string_free(content, 1);
|
|
} else {
|
|
@@ -2479,15 +2495,16 @@ pixdone: g_free(real_image);
|
|
feed_file = g_strdup(tmp_path);
|
|
#endif
|
|
|
|
- camel_stream_printf (
|
|
- fstream,
|
|
+ str = g_strdup_printf (
|
|
"<div style=\"border: solid #%06x 1px; background-color: #%06x; padding: 2px; color: #%06x;\">",
|
|
frame_colour & 0xffffff,
|
|
content_colour & 0xEDECEB & 0xffffff,
|
|
text_colour & 0xffffff);
|
|
+ camel_stream_write_string (fstream, str, NULL, NULL);
|
|
+ g_free (str);
|
|
if (g_file_test(tmp_path, G_FILE_TEST_EXISTS)){
|
|
if ((pixbuf = gdk_pixbuf_new_from_file(tmp_path, NULL))) {
|
|
- camel_stream_printf (fstream,
|
|
+ str = g_strdup_printf (
|
|
"<div style=\"border: solid 0px; background-color: #%06x; padding: 2px; color: #%06x;\">"
|
|
"<img height=16 src=%s>"
|
|
"<b><font size=+1><a href=%s>%s</a></font></b></div>",
|
|
@@ -2496,6 +2513,8 @@ pixdone: g_free(real_image);
|
|
feed_file,
|
|
website,
|
|
subject);
|
|
+ camel_stream_write_string (fstream, str, NULL, NULL);
|
|
+ g_free (str);
|
|
g_object_unref(pixbuf);
|
|
g_free(feed_file);
|
|
goto render_body;
|
|
@@ -2511,38 +2530,47 @@ pixdone: g_free(real_image);
|
|
iconfile = g_strdup(tmp_file);
|
|
#endif
|
|
g_free(tmp_file);
|
|
- camel_stream_printf (fstream,
|
|
+ str = g_strdup_printf (
|
|
"<div style=\"border: solid 0px; background-color: #%06x; padding: 2px; color: #%06x;\">"
|
|
"<img height=16 src=%s>"
|
|
"<b><font size=+1><a href=%s>%s</a></font></b></div>",
|
|
content_colour & 0xEDECEB & 0xffffff, text_colour & 0xffffff,
|
|
iconfile, website, subject);
|
|
+ camel_stream_write_string (fstream, str, NULL, NULL);
|
|
+ g_free (str);
|
|
g_free(iconfile);
|
|
g_free(feed_file);
|
|
|
|
-render_body: if (category)
|
|
- camel_stream_printf(fstream,
|
|
+render_body: if (category) {
|
|
+ str = g_strdup_printf (
|
|
"<div style=\"border: solid 0px; background-color: #%06x; padding: 2px; color: #%06x;\">"
|
|
"<b><font size=-1>Posted under: %s</font></b></div>",
|
|
content_colour & 0xEDECEB & 0xffffff,
|
|
text_colour & 0xffffff,
|
|
category);
|
|
- camel_stream_printf (fstream,
|
|
- "<div style=\"border: solid #%06x 0px; background-color: #%06x; padding: 10px; color: #%06x;\">"
|
|
- "%s</div>",
|
|
- frame_colour & 0xffffff,
|
|
- content_colour & 0xffffff,
|
|
- text_colour & 0xffffff,
|
|
- buff);
|
|
+ camel_stream_write_string (fstream, str, NULL, NULL);
|
|
+ g_free (str);
|
|
+ }
|
|
+ str = g_strdup_printf (
|
|
+ "<div style=\"border: solid #%06x 0px; background-color: #%06x; padding: 10px; color: #%06x;\">"
|
|
+ "%s</div>",
|
|
+ frame_colour & 0xffffff,
|
|
+ content_colour & 0xffffff,
|
|
+ text_colour & 0xffffff,
|
|
+ buff);
|
|
+ camel_stream_write_string (fstream, str, NULL, NULL);
|
|
+ g_free (str);
|
|
if (comments && gconf_client_get_bool (rss_gconf,
|
|
GCONF_KEY_SHOW_COMMENTS,
|
|
NULL)) {
|
|
if (commstream) {
|
|
- camel_stream_printf (fstream,
|
|
+ str = g_strdup_printf (
|
|
"<div style=\"border: solid #%06x 0px; background-color: #%06x; padding: 2px; color: #%06x;\">",
|
|
frame_colour & 0xffffff,
|
|
content_colour & 0xEDECEB & 0xffffff,
|
|
text_colour & 0xffffff);
|
|
+ camel_stream_write_string (fstream, str, NULL, NULL);
|
|
+ g_free (str);
|
|
result = print_comments(comments, commstream, (EMFormatHTML *)t->format);
|
|
g_free(commstream);
|
|
rfrclsid = g_strdup_printf ("org-gnome-rss-controls-%d",
|
|
@@ -2558,15 +2586,19 @@ render_body: if (category)
|
|
pobj->website = g_strdup(comments);
|
|
//this might not be needed but we want to make sure po->html is destroyed
|
|
pobj->object.free = free_rss_controls;
|
|
- camel_stream_printf(fstream,
|
|
+ str = g_strdup_printf (
|
|
"<object height=25 classid=%s></object>", rfrclsid);
|
|
+ camel_stream_write_string (fstream, str, NULL, NULL);
|
|
+ g_free (str);
|
|
if (result && strlen(result)) {
|
|
- camel_stream_printf(fstream,
|
|
+ str = g_strdup_printf (
|
|
"<div style=\"border: solid #%06x 0px; background-color: #%06x; padding: 10px; color: #%06x;\">%s",
|
|
frame_colour & 0xffffff,
|
|
content_colour & 0xffffff,
|
|
text_colour & 0xffffff,
|
|
result);
|
|
+ camel_stream_write_string (fstream, str, NULL, NULL);
|
|
+ g_free (str);
|
|
g_free(result);
|
|
}
|
|
g_free(rfrclsid);
|
|
@@ -2576,9 +2608,9 @@ render_body: if (category)
|
|
rf->hr, g_strstrip(feedid)));
|
|
fetch_comments(comments, g_strdup(uri), (EMFormatHTML *)t->format);
|
|
}
|
|
- camel_stream_printf (fstream, "</div>");
|
|
+ camel_stream_write_string (fstream, "</div>", NULL, NULL);
|
|
}
|
|
- camel_stream_printf (fstream, "</div>");
|
|
+ camel_stream_write_string (fstream, "</div>", NULL, NULL);
|
|
}
|
|
|
|
//this is required for proper charset rendering when html
|
|
@@ -2617,16 +2649,19 @@ out: if (addr)
|
|
g_free(addr);
|
|
return;
|
|
fmerror:
|
|
- camel_stream_printf (t->stream,
|
|
+ str = g_strdup_printf (
|
|
"<div style=\"border: solid #%06x 1px; background-color: #%06x; color: #%06x;\">\n",
|
|
frame_colour & 0xffffff, content_colour & 0xffffff, text_colour & 0xffffff);
|
|
- camel_stream_printf(t->stream,
|
|
- "<div style=\"border: solid 0px; padding: 4px;\">\n");
|
|
- camel_stream_printf (t->stream,
|
|
+ camel_stream_write_string (t->stream, str, NULL, NULL);
|
|
+ g_free (str);
|
|
+ camel_stream_write_string (t->stream,
|
|
+ "<div style=\"border: solid 0px; padding: 4px;\">\n",
|
|
+ NULL, NULL);
|
|
+ camel_stream_write_string (t->stream,
|
|
"<h3>Formatting error!</h3>"
|
|
- "Feed article corrupted! Cannot format article.");
|
|
- camel_stream_printf (t->stream,
|
|
- "</div></div>");
|
|
+ "Feed article corrupted! Cannot format article.",
|
|
+ NULL, NULL);
|
|
+ camel_stream_write_string (t->stream, "</div></div>", NULL, NULL);
|
|
return;
|
|
}
|
|
|
|
@@ -5139,7 +5174,7 @@ create_mail(create_feed *CF)
|
|
camel_content_type_unref (type);
|
|
stream = camel_stream_mem_new ();
|
|
// w/out an format argument this throws and seg fault
|
|
- camel_stream_printf (stream, "%s", CF->body);
|
|
+ camel_stream_write_string (stream, CF->body, NULL, NULL);
|
|
#if (DATASERVER_VERSION >= 2033001)
|
|
/*FIXME may block */
|
|
camel_data_wrapper_construct_from_stream_sync (rtext, stream, NULL, NULL);
|