sfeed

simple feed reader - forked from git.codemadness.org/sfeed
git clone git://src.gearsix.net/sfeed
Log | Files | Refs | Atom | README | LICENSE

commit 584c14eb5dd080bb1c0435f48b67e10e88e34a77
parent bad5f90cb1b0a06c0315cf3408b3ed4c2023dc21
Author: Hiltjo Posthuma <hiltjo@codemadness.org>
Date:   Sat,  3 Jan 2015 21:45:02 +0100

clear some fields if they are set previously (some feeds define multiple date field)

Diffstat:
Msfeed.c | 9++++++++-
1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/sfeed.c b/sfeed.c @@ -505,7 +505,6 @@ xml_handler_attr(XMLParser *p, const char *tag, size_t taglen, } if(ctx.item.feedtype == FeedTypeAtom) { - /*if(ctx.tagid == AtomTagContent || ctx.tagid == AtomTagSummary) {*/ if(ISCONTENTTAG(ctx)) { if(isattr(name, namelen, STRP("type")) && (isattr(value, valuelen, STRP("xhtml")) || @@ -591,11 +590,15 @@ xml_handler_start_element(XMLParser *p, const char *name, size_t namelen) if(!(ctx.tagid == RSSTagDescription && ctx.item.content.len)) { ctx.iscontenttag = 1; ctx.field = &ctx.item.content; + return; } } else if(ctx.tagid == RSSTagGuid) ctx.field = &ctx.item.id; else if(ctx.tagid == RSSTagAuthor || ctx.tagid == RSSTagDccreator) ctx.field = &ctx.item.author; + /* clear field */ + if(ctx.field) + string_clear(ctx.field); } else if(ctx.item.feedtype == FeedTypeAtom) { if(ctx.tagid == AtomTagPublished || ctx.tagid == AtomTagUpdated) ctx.field = &ctx.item.timestamp; @@ -609,6 +612,7 @@ xml_handler_start_element(XMLParser *p, const char *name, size_t namelen) if(!(ctx.tagid == AtomTagSummary && ctx.item.content.len)) { ctx.iscontenttag = 1; ctx.field = &ctx.item.content; + return; } } else if(ctx.tagid == AtomTagId) ctx.field = &ctx.item.id; @@ -616,6 +620,9 @@ xml_handler_start_element(XMLParser *p, const char *name, size_t namelen) ctx.field = &ctx.item.link; else if(ctx.tagid == AtomTagAuthor) ctx.field = &ctx.item.author; + /* clear field */ + if(ctx.field) + string_clear(ctx.field); } }