[libgrss] Fixed management of "link" and "geo" tags Updated NEWS file with latest changes, to be included in r



commit 467fa23dd3f03978187aa28e74d0892e649c949d
Author: Roberto Guido <bob4mail gmail com>
Date:   Tue Mar 30 00:45:15 2010 +0200

    Fixed management of "link" and "geo" tags
    Updated NEWS file with latest changes, to be included in release 0.4

 NEWS              |    7 +++++++
 src/feed-parser.c |   15 ++++++++++-----
 src/ns-handler.c  |   21 ++++++++++++---------
 3 files changed, 29 insertions(+), 14 deletions(-)
---
diff --git a/NEWS b/NEWS
index 5745e7e..81db985 100644
--- a/NEWS
+++ b/NEWS
@@ -1,3 +1,10 @@
+libgrss 0.4 (UNRELEASED)
+==============================================================================
+- Added FeedsGroup class, abstraction to parse and produce list of feeds
+- Added OPML files parser
+- Cleanup of headers
+- Bugfixes
+
 libgrss 0.3
 ==============================================================================
 - Added support for geo:* namespace
diff --git a/src/feed-parser.c b/src/feed-parser.c
index 11b8620..35d1ef1 100644
--- a/src/feed-parser.c
+++ b/src/feed-parser.c
@@ -51,6 +51,7 @@ struct _FeedParserPrivate {
 
 enum {
 	FEED_PARSER_PARSE_ERROR,
+	FEED_PARSER_FORMAT_ERROR
 };
 
 G_DEFINE_TYPE (FeedParser, feed_parser, G_TYPE_OBJECT)
@@ -174,16 +175,18 @@ feed_parser_parse (FeedParser *parser, FeedChannel *feed, xmlDocPtr doc, GError
 	items = NULL;
 
 	do {
-		g_set_error (error, FEED_PARSER_ERROR, FEED_PARSER_PARSE_ERROR, "Empty document!");
-
-		if ((cur = xmlDocGetRootElement (doc)) == NULL)
+		if ((cur = xmlDocGetRootElement (doc)) == NULL) {
+			g_set_error (error, FEED_PARSER_ERROR, FEED_PARSER_PARSE_ERROR, "Empty document!");
 			break;
+		}
 
 		while (cur && xmlIsBlankNode (cur))
 			cur = cur->next;
 
-		if (!cur)
+		if (!cur) {
+			g_set_error (error, FEED_PARSER_ERROR, FEED_PARSER_PARSE_ERROR, "Empty document!");
 			break;
+		}
 
 		if (!cur->name) {
 			g_set_error (error, FEED_PARSER_ERROR, FEED_PARSER_PARSE_ERROR, "Invalid XML!");
@@ -191,8 +194,10 @@ feed_parser_parse (FeedParser *parser, FeedChannel *feed, xmlDocPtr doc, GError
 		}
 
 		handler = retrieve_feed_handler (parser, doc, cur);
-		if (handler == NULL)
+		if (handler == NULL) {
+			g_set_error (error, FEED_PARSER_ERROR, FEED_PARSER_FORMAT_ERROR, "Unknow format");
 			break;
+		}
 
 		items = feed_handler_parse (handler, feed, doc, error);
 
diff --git a/src/ns-handler.c b/src/ns-handler.c
index f9d976d..895f40e 100644
--- a/src/ns-handler.c
+++ b/src/ns-handler.c
@@ -449,16 +449,19 @@ ns_atom10_channel (FeedChannel *feed, xmlNodePtr cur)
 	gchar *relation;
 
 	if (!xmlStrcmp (BAD_CAST "link", cur->name)) {
-		href = (gchar*) xmlGetNsProp (cur, BAD_CAST "href", NULL);
 		relation = (gchar*) xmlGetNsProp (cur, BAD_CAST "rel", NULL);
 
-		if (strcmp (relation, "self") == 0)
-			feed_channel_set_pubsubhub (feed, NULL, href);
-		else if (strcmp (relation, "hub") == 0)
-			feed_channel_set_pubsubhub (feed, href, NULL);
+		if (relation != NULL) {
+			href = (gchar*) xmlGetNsProp (cur, BAD_CAST "href", NULL);
 
-		g_free (relation);
-		g_free (href);
+			if (strcmp (relation, "self") == 0)
+				feed_channel_set_pubsubhub (feed, NULL, href);
+			else if (strcmp (relation, "hub") == 0)
+				feed_channel_set_pubsubhub (feed, href, NULL);
+
+			g_free (relation);
+			g_free (href);
+		}
 	}
 }
 
@@ -635,7 +638,7 @@ ns_handler_channel (NSHandler *handler, FeedChannel *feed, xmlNodePtr cur)
 
 	nsh = retrieve_internal_handler (handler, cur);
 
-	if (nsh != NULL) {
+	if (nsh != NULL && nsh->handle_channel != NULL) {
 		nsh->handle_channel (feed, cur);
 		return TRUE;
 	}
@@ -662,7 +665,7 @@ ns_handler_item (NSHandler *handler, FeedItem *item, xmlNodePtr cur)
 
 	nsh = retrieve_internal_handler (handler, cur);
 
-	if (nsh != NULL) {
+	if (nsh != NULL && nsh->handle_item != NULL) {
 		nsh->handle_item (item, cur);
 		return TRUE;
 	}



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