Bug 123140 - akregator ignores alternate link in atom feeds
Summary: akregator ignores alternate link in atom feeds
Status: RESOLVED FIXED
Alias: None
Product: akregator
Classification: Applications
Component: general (show other bugs)
Version: 1.2.1
Platform: unspecified Linux
: NOR normal
Target Milestone: ---
Assignee: kdepim bugs
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2006-03-05 22:54 UTC by Roman Cheplyaka
Modified: 2006-03-09 08:47 UTC (History)
0 users

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Roman Cheplyaka 2006-03-05 22:54:28 UTC
Version:           1.2.1 (using KDE 3.5.1, Debian Package 4:3.5.1-2 (testing/unstable))
Compiler:          Target: i486-linux-gnu
OS:                Linux (i686) release 2.6.15.4

<link rel="alternate" type="text/html" href="..." /> inside <feed> tag isn't used as Atom feed's homepage when right-clicking on feed item or pressing Ctrl+H.
Comment 1 Frank Osterfeld 2006-03-09 00:07:25 UTC
Confirmed.
Comment 2 Frank Osterfeld 2006-03-09 00:55:55 UTC
SVN commit 516877 by osterfeld:

read summary, link for Atom feeds
BUG: 123140


 M  +4 -0      ChangeLog  
 M  +1 -1      src/librss/article.cpp  
 M  +23 -3     src/librss/document.cpp  


--- branches/KDE/3.5/kdepim/akregator/ChangeLog #516876:516877
@@ -7,6 +7,10 @@
 
 Bug fixes:
 
+ 2006/03/09 Read more feed metadata for Atom feeds (title, link) (#123140) -fo
+ 2006/03/09 Use "refresh" cache mode as default, ignoring konq settings. 
+            ("refresh" == Use cache after verifying with server) 
+            This should make disabling the "Use browser cache" option unnecessary. -fo
  2006/02/21 Set "rel" attribute default to "alternate", as requested by Atom specification (#122409) -ew
  2006/02/21 Disable category support in the metakit backend, so it should support about 500
             instead of 340 feeds now with the default 1024 open files limit on most systems. -fo
--- branches/KDE/3.5/kdepim/akregator/src/librss/article.cpp #516876:516877
@@ -77,7 +77,7 @@
 		for (n = node.firstChild(); !n.isNull(); n = n.nextSibling()) {
 			const QDomElement e = n.toElement();
 			if ( (e.tagName()==QString::fromLatin1("link")) &&
-				(e.attribute(QString::fromLatin1("rel"), QString::fromLatin1("alternate"))==QString::fromLatin1("alternate")))
+				(e.attribute(QString::fromLatin1("rel"), QString::fromLatin1("alternate")) == QString::fromLatin1("alternate")))
 				{   
 					d->link=n.toElement().attribute(QString::fromLatin1("href"));
 					break;
--- branches/KDE/3.5/kdepim/akregator/src/librss/document.cpp #516876:516877
@@ -72,6 +72,25 @@
     *this = other;
 }
 
+static QString extractLink(const QDomNode& node, Format format)
+{
+    if (format == AtomFeed)
+    {
+        QDomNode n;
+        for (n = node.firstChild(); !n.isNull(); n = n.nextSibling()) {
+            const QDomElement e = n.toElement();
+            if ( (e.tagName() == QString::fromLatin1("link")) 
+                  && (e.attribute(QString::fromLatin1("rel"), QString::fromLatin1("alternate")) == QString::fromLatin1("alternate")))
+            {   
+                return n.toElement().attribute(QString::fromLatin1("href"));
+            }
+        }
+    }
+
+    return extractNode(node, QString::fromLatin1("link"));
+    
+}
+
 Document::Document(const QDomDocument &doc) : d(new Private)
 {
     QString elemText;
@@ -148,10 +167,11 @@
 
     if (!(elemText = extractTitle(channelNode)).isNull())
         d->title = elemText;
-    if (!(elemText = extractNode(channelNode, QString::fromLatin1("description"))).isNull())
+    if (!(elemText = extractNode(channelNode, QString::fromLatin1((d->format==AtomFeed)? "summary" : "description"), 
+false)).isNull())
         d->description = elemText;
-    if (!(elemText = extractNode(channelNode, QString::fromLatin1("link"))).isNull())
-        d->link = elemText;
+        
+    d->link = extractLink(channelNode, d->format);
 
     
     /* This is ugly but necessary since RSS 0.90 and 1.0 have a different parent
Comment 3 Frank Osterfeld 2006-03-09 08:47:34 UTC
SVN commit 516912 by osterfeld:

eh, it's "subtitle"/"tagline", not "summary" for feeds (as opposed to articles)
CCBUG: 123140


 M  +11 -2     document.cpp  


--- branches/KDE/3.5/kdepim/akregator/src/librss/document.cpp #516911:516912
@@ -167,8 +167,17 @@
 
     if (!(elemText = extractTitle(channelNode)).isNull())
         d->title = elemText;
-    if (!(elemText = extractNode(channelNode, QString::fromLatin1((d->format==AtomFeed)? "summary" : "description"), 
-false)).isNull())
+    QString descriptionTagName = "description";
+    
+    if (d->format == AtomFeed)
+    {
+        if (d->version == vAtom_1_0)
+            descriptionTagName = "subtitle";
+        else
+            descriptionTagName = "tagline";
+    }
+    
+    if (!(elemText = extractNode(channelNode, descriptionTagName)).isNull())
         d->description = elemText;
         
     d->link = extractLink(channelNode, d->format);