* use toplevel thingie tag to detect whether we're RSS or ATOM.
authorWilfried Göesgens <willi@citadel.org>
Sat, 21 Nov 2009 18:20:42 +0000 (18:20 +0000)
committerWilfried Göesgens <willi@citadel.org>
Sat, 21 Nov 2009 18:20:42 +0000 (18:20 +0000)
citadel/modules/rssclient/serv_rssclient.c

index b6517242b23eab2aa93e9d598c0afbad2d24a62f..f35f84c43a3a52027502a1f79d32ceb946d87304 100644 (file)
@@ -470,20 +470,27 @@ void rss_xml_start(void *data, const char *supplied_el, const char **attr) {
                strcpy(el, ++sep);
        }
 
-       if (((rssc->Cfg->ItemType == RSS_UNSET) || 
-            (rssc->Cfg->ItemType == RSS_RSS)) &&
+       if ((rssc->Cfg->ItemType == RSS_UNSET) &&
+           !strcasecmp(el, "rss")) 
+       {
+               rssc->Cfg->ItemType = RSS_RSS;
+       }
+       else if ((rssc->Cfg->ItemType == RSS_UNSET) &&
+           !strcasecmp(el, "feed")) 
+       {
+               rssc->Cfg->ItemType = RSS_ATOM;
+       }
+       else if ((rssc->Cfg->ItemType == RSS_RSS) &&
            !strcasecmp(el, "item")) 
        {
                ri->item_tag_nesting ++ ;
-               rssc->Cfg->ItemType = RSS_RSS;
                flush_rss_ite(ri);
        }
-       else if (((rssc->Cfg->ItemType == RSS_UNSET) || 
-                 (rssc->Cfg->ItemType == RSS_ATOM)) &&
-                !strcasecmp(el, "entry")) { /* Atom feed... */
+       else if ( (rssc->Cfg->ItemType == RSS_ATOM) &&
+                !strcasecmp(el, "entry")) 
+       { /* Atom feed... */
                CtdlLogPrintf(0, "RSS: found atom...\n");
                ++ri->item_tag_nesting;
-               rssc->Cfg->ItemType = RSS_ATOM;
                flush_rss_ite(ri);
        }
        else if ((rssc->Cfg->ItemType == RSS_ATOM) &&