[Commits] opml.c 1.1.2.6 1.1.2.7

ticho at claws-mail.org ticho at claws-mail.org
Fri Apr 6 19:24:58 CEST 2012


Update of /home/claws-mail/plugins/rssyl/src
In directory srv:/tmp/cvs-serv11587/src

Modified Files:
      Tag: gtk2
	opml.c 
Log Message:
2012-04-06 [ticho]	0.32.0cvs4

	* src/opml.c
		Generate XML with proper ampersand entities when
		making an OPML export.

Index: opml.c
===================================================================
RCS file: /home/claws-mail/plugins/rssyl/src/Attic/opml.c,v
retrieving revision 1.1.2.6
retrieving revision 1.1.2.7
diff -u -d -r1.1.2.6 -r1.1.2.7
--- opml.c	14 Aug 2008 18:09:51 -0000	1.1.2.6
+++ opml.c	6 Apr 2012 17:24:56 -0000	1.1.2.7
@@ -36,6 +36,7 @@
 #include "date.h"
 #include "feed.h"
 #include "rssyl.h"
+#include "strreplace.h"
 
 #define RSSYL_OPML_FILE	"rssyl-feedlist.opml"
 
@@ -61,6 +62,7 @@
 	gboolean isfolder = FALSE, err = FALSE;
 	gboolean haschildren = FALSE;
 	gchar *indent = NULL, *xmlurl = NULL;
+	gchar *tmpoffn = NULL, *tmpurl = NULL, *tmpname = NULL;
 	gint depth;
 
 	if( !IS_RSSYL_FOLDER_ITEM(item) )
@@ -83,7 +85,9 @@
 	if( ritem->url == NULL ) {
 		isfolder = TRUE;
 	} else {
-		xmlurl = g_strdup_printf("xmlUrl=\"%s\"", ritem->url);
+		tmpurl = rssyl_strreplace(ritem->url, "&", "&");
+		xmlurl = g_strdup_printf("xmlUrl=\"%s\"", tmpurl);
+		g_free(tmpurl);
 	}
 
 	if( g_node_n_children(item->node) )
@@ -91,16 +95,22 @@
 
 	indent = g_strnfill(ctx->depth, '\t');
 
+	tmpname = rssyl_strreplace(item->name, "&", "&");
+	if (ritem->official_name != NULL)
+		tmpoffn = rssyl_strreplace(item->name, "&", "&");
+	else
+		tmpoffn = g_strdup(tmpname);
+
 	err |= (fprintf(ctx->f,
 				"%s<outline title=\"%s\" text=\"%s\" description=\"%s\" type=\"%s\" %s%s>\n",
-				indent, item->name,
-				(ritem->official_name ? ritem->official_name : item->name),
-				(ritem->official_name ? ritem->official_name : item->name),
+				indent, tmpname, tmpoffn, tmpoffn,
 				(isfolder ? "folder" : "rss"),
 				(xmlurl ? xmlurl : ""), (haschildren ? "" : "/")) < 0);
 
 	g_free(indent);
 	g_free(xmlurl);
+	g_free(tmpname);
+	g_free(tmpoffn);
 	
 	if( err ) {
 		log_warning(LOG_PROTOCOL,



More information about the Commits mailing list