[evolution-rss/evolution-rss-0-2-0] use ref alternate in atom feeds to get link



commit fe0a819625b5dc403264d30161a46da6bc956df1
Author: Lucian Langa <lucilanga gnome org>
Date:   Wed Jan 19 23:54:27 2011 +0200

    use ref alternate in atom feeds to get link

 src/parser.c |   15 +++++++++------
 1 files changed, 9 insertions(+), 6 deletions(-)
---
diff --git a/src/parser.c b/src/parser.c
index 6cf9e9a..059662c 100644
--- a/src/parser.c
+++ b/src/parser.c
@@ -685,7 +685,6 @@ layer_query_find_prop (xmlNodePtr node,
 		const char *attrprop,
 		xmlChar *prop)
 {
-	node = node->children;
 	while (node!=NULL) {
 		if (!g_ascii_strcasecmp((gchar *)node->name, match)
 		&& (!g_ascii_strcasecmp((gchar *)xmlGetProp(node, attr), attrprop)
@@ -824,7 +823,7 @@ tree_walk (xmlNodePtr root, RDF *r)
 				}
 				r->base = (gchar *)xmlGetProp(walk, (xmlChar *)"base");
 				if (!r->base)
-					r->base = layer_query_find_prop (walk,
+					r->base = layer_query_find_prop (node->children,
 							"link",
 							(xmlChar *)"rel",
 							"alternate", (xmlChar *)"href");
@@ -983,10 +982,14 @@ parse_channel_line(xmlNode *top, gchar *feed_name, RDF *r, gchar **article_uid)
 	//we have to free this somehow
 	//<link></link>
 	link = g_strdup(layer_find (top, "link", NULL));		//RSS,
-	if (!link)								// <link href=>
-		link = (gchar *)layer_find_innerelement(
-				top, "link", "href",
-				g_strdup(_("No Information")));	//ATOM
+	if (!link) {								// <link href=>
+		if (!(link = layer_query_find_prop (top,
+				"link",
+				(xmlChar *)"rel",
+				"alternate", (xmlChar *)"href")))	//ATOM
+			link = g_strdup(_("No Information"));
+	}
+
 	id = (gchar *)layer_find (top, (gchar *)"id",				//ATOM
 			layer_find (top, (gchar *)"guid", NULL));		//RSS 2.0
 	feed = g_strdup_printf("%s\n", id ? id : link);



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]