Be sure to handle feed panel elements as HTML rather than text

While we are at it, use the new metadata API of KatzeItem.
This commit is contained in:
Dale Whittaker 2009-08-14 23:33:10 +02:00 committed by Christian Dywan
parent 74457cfd75
commit f48f47f372
2 changed files with 19 additions and 25 deletions

View file

@ -11,12 +11,6 @@
#include "feed-atom.h" #include "feed-atom.h"
#define atom_get_link_attribute(item, attribute) \
(gchar*)g_object_get_data (G_OBJECT (item), attribute)
#define atom_set_link_attribute(item, attribute, value) \
g_object_set_data (G_OBJECT (item), attribute, value)
static gboolean static gboolean
atom_is_valid (FeedParser* fparser) atom_is_valid (FeedParser* fparser)
{ {
@ -102,8 +96,8 @@ atom_get_link (KatzeItem* item,
gboolean newlink; gboolean newlink;
newlink = FALSE; newlink = FALSE;
oldtype = atom_get_link_attribute (item, "linktype"); oldtype = (gchar*)katze_item_get_meta_string (item, "feedpanel:linktype");
oldrel = atom_get_link_attribute (item, "linkrel"); oldrel = (gchar*)katze_item_get_meta_string (item, "feedpanel:linkrel");
newtype = (gchar*)xmlGetProp (node, BAD_CAST "type"); newtype = (gchar*)xmlGetProp (node, BAD_CAST "type");
newrel = (gchar*)xmlGetProp (node, BAD_CAST "rel"); newrel = (gchar*)xmlGetProp (node, BAD_CAST "rel");
@ -127,21 +121,21 @@ atom_get_link (KatzeItem* item,
if (newlink) if (newlink)
{ {
katze_item_set_uri (item, href); katze_item_set_uri (item, href);
atom_set_link_attribute (item, "linkrel", newrel); katze_item_set_meta_string (item, "feedpanel:linkrel", newrel);
atom_set_link_attribute (item, "linktype", newrel); katze_item_set_meta_string (item, "feedpanel:linktype", newtype);
}
else
{
xmlFree (href);
xmlFree (newrel);
xmlFree (newtype);
} }
xmlFree (href);
xmlFree (newrel);
xmlFree (newtype);
} }
static gchar* static gchar*
atom_get_title (FeedParser* fparser) atom_get_title (FeedParser* fparser)
{ {
if (!katze_item_get_name (fparser->item)) const gchar* name;
if (!(name = katze_item_get_name (fparser->item)))
{ {
gchar* type; gchar* type;
@ -159,8 +153,9 @@ atom_get_title (FeedParser* fparser)
if (content) if (content)
return content; return content;
} }
return feed_get_element_string (fparser);
} }
return feed_get_element_string (fparser); return g_strdup (name);
} }
static void static void
@ -245,8 +240,8 @@ atom_postparse_entry (FeedParser* fparser)
if (KATZE_IS_ITEM (fparser->item)) if (KATZE_IS_ITEM (fparser->item))
{ {
atom_set_link_attribute (fparser->item, "linkrel", NULL); katze_item_set_meta_string (fparser->item, "feedpanel:linkrel", NULL);
atom_set_link_attribute (fparser->item, "linktype", NULL); katze_item_set_meta_string (fparser->item, "feedpanel:linktype", NULL);
if (*fparser->error) if (*fparser->error)
{ {
@ -330,8 +325,8 @@ atom_postparse_feed (FeedParser* fparser)
{ {
if (KATZE_IS_ARRAY (fparser->item)) if (KATZE_IS_ARRAY (fparser->item))
{ {
atom_set_link_attribute (fparser->item, "linkrel", NULL); katze_item_set_meta_string (fparser->item, "feedpanel:linkrel", NULL);
atom_set_link_attribute (fparser->item, "linktype", NULL); katze_item_set_meta_string (fparser->item, "feedpanel:linktype", NULL);
} }
if (!*fparser->error) if (!*fparser->error)

View file

@ -19,11 +19,10 @@
#define UPDATE_FREQ 10 #define UPDATE_FREQ 10
#define feed_get_flags(feed) \ #define feed_get_flags(feed) \
GPOINTER_TO_INT (g_object_get_data (G_OBJECT ((feed)), "flags")) katze_item_get_meta_integer (KATZE_ITEM ((feed)), "feedpanel:flags")
#define feed_set_flags(feed, flags) \ #define feed_set_flags(feed, flags) \
g_object_set_data (G_OBJECT ((feed)), "flags", \ katze_item_set_meta_integer (KATZE_ITEM ((feed)), "feedpanel:flags", (flags))
GINT_TO_POINTER ((flags)))
#define feed_has_flags(feed, flags) \ #define feed_has_flags(feed, flags) \
((flags) & feed_get_flags ((feed))) ((flags) & feed_get_flags ((feed)))