Bug 97874 - Fails to find a date for Atom entries without a "created" element
Summary: Fails to find a date for Atom entries without a "created" element
Status: RESOLVED FIXED
Alias: None
Product: akregator
Classification: Applications
Component: general (show other bugs)
Version: 1.0-beta8
Platform: Debian testing Linux
: NOR normal
Target Milestone: ---
Assignee: kdepim bugs
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-01-25 15:19 UTC by sami-kde
Modified: 2005-05-16 13:33 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 sami-kde 2005-01-25 15:19:14 UTC
Version:           1.0-beta8 (using KDE KDE 3.3.2)
Installed from:    Debian testing/unstable Packages
Compiler:          g++ 3.3.5 
OS:                Linux

Some Atom feeds don't have a "created" element for each entry, causing akregator to substitute it with the current date. As a result, entries aren't shown in the actual chronological order.

According to the Atom v0.3 specification, the "created" element is not necessary (section 4.13.8). I personally fixed this by changing the line 96 of "src/librss/article.cpp" to read "issued" instead of "created". I am not sure if this is the correct fix though. Perhaps the "modified" element should be used instead?
Comment 1 Sashmit Bhaduri 2005-01-25 21:58:31 UTC
can you give the URL of such a feed?
Comment 2 sami-kde 2005-01-25 22:26:12 UTC
Sure, many feeds from LiveJournal seem to omit the "created" element for some entries. Here's a random example that has several entries with only "issued" and "modified" elements:

http://www.livejournal.com/users/thejonhill/data/atom

Not that it should matter anyway, the specification clearly says the "created" tag is not required, while "issued" and "modified" are:

http://www.atomenabled.org/developers/syndication/atom-format-spec.php#rfc.section.4.13.8
Comment 3 sami-kde 2005-03-07 10:49:18 UTC
This problem still exists in beta10. Having tested the proposed fix for a month or so now, it appears to be correct.
Comment 4 Eckhart Wörner 2005-04-24 21:11:51 UTC
Quote from the specification:

"atom:entry elements MAY contain an atom:created element
[...]
If atom:created is not present, its content MUST considered to be the same as that of atom:modified."

The bug is still present in HEAD.
Comment 5 Frank Osterfeld 2005-05-16 12:41:21 UTC
SVN commit 414555 by osterfeld:

Atom: Use <issued> instead of <created> as pubdate.
BUG: 97874


 M  +21 -18    trunk/KDE/kdepim/akregator/src/librss/article.cpp  


--- trunk/KDE/kdepim/akregator/src/librss/article.cpp #414554:414555
@@ -86,36 +86,39 @@
     if (d->description.isEmpty())
     {
 		if (!(elemText = extractNode(node, QString::fromLatin1("body"), false)).isNull())
-	    	d->description = elemText;
+			d->description = elemText;
     
 		if (d->description.isEmpty())  // 3rd try: see http://www.intertwingly.net/blog/1299.html
 		{
 			if (!(elemText = extractNode(node, QString::fromLatin1((format==AtomFeed)? "summary" : "description"), false)).isNull())
 				d->description = elemText;
 		}
-    }
+	}
     
-	if (!(elemText = extractNode(node, QString::fromLatin1((format==AtomFeed)? "created": "pubDate"))).isNull())
-    {
-		time_t _time;
-		if (format==AtomFeed)
-		   _time = parseISO8601Date(elemText); 
-		else
-		   _time = KRFCDate::parseDate(elemText);
+	time_t time = 0;
 
-        // 0 means invalid, not epoch (it returns epoch+1 when it parsed epoch, see the KRFCDate::parseDate() docs)
-        if (_time != 0)
-		  d->pubDate.setTime_t(_time);
+	if (format == AtomFeed)
+	{
+		elemText = extractNode(node, QString::fromLatin1("issued"));
+		if (!elemText.isNull())
+			time = parseISO8601Date(elemText); 	
 	}
+	else 
+	{
+		elemText = extractNode(node, QString::fromLatin1("pubDate"));
+		if (!elemText.isNull())
+			time = KRFCDate::parseDate(elemText);
+	}
+	
 	if (!(elemText = extractNode(node, QString::fromLatin1("dc:date"))).isNull())
-    {
-		time_t _time = parseISO8601Date(elemText);
-
-        // 0 means invalid, not epoch (it returns epoch+1 when it parsed epoch, see the KRFCDate::parseDate() docs)
-        if (_time != 0)
-		  d->pubDate.setTime_t(_time);
+	{
+		time = parseISO8601Date(elemText);
 	}
 
+	// 0 means invalid, not epoch (parsers return epoch+1 when parsing epoch, see the KRFCDate::parseDate() docs)
+        if (time != 0)
+		d->pubDate.setTime_t(time);
+
 	if (!(elemText = extractNode(node, QString::fromLatin1("wfw:comment"))).isNull()) {
 		d->commentsLink = elemText;
 	}
Comment 6 Frank Osterfeld 2005-05-16 12:46:42 UTC
SVN commit 414559 by osterfeld:

backport: Atom: use <issued> instead of <created> for pubdates
CCBUG: 97874


 M  +21 -18    branches/KDE/3.4/kdepim/akregator/src/librss/article.cpp  


--- branches/KDE/3.4/kdepim/akregator/src/librss/article.cpp #414558:414559
@@ -86,36 +86,39 @@
     if (d->description.isEmpty())
     {
 		if (!(elemText = extractNode(node, QString::fromLatin1("body"), false)).isNull())
-	    	d->description = elemText;
+			d->description = elemText;
     
 		if (d->description.isEmpty())  // 3rd try: see http://www.intertwingly.net/blog/1299.html
 		{
 			if (!(elemText = extractNode(node, QString::fromLatin1((format==AtomFeed)? "summary" : "description"), false)).isNull())
 				d->description = elemText;
 		}
-    }
+	}
     
-	if (!(elemText = extractNode(node, QString::fromLatin1((format==AtomFeed)? "created": "pubDate"))).isNull())
-    {
-		time_t _time;
-		if (format==AtomFeed)
-		   _time = parseISO8601Date(elemText); 
-		else
-		   _time = KRFCDate::parseDate(elemText);
+	time_t time = 0;
 
-        // 0 means invalid, not epoch (it returns epoch+1 when it parsed epoch, see the KRFCDate::parseDate() docs)
-        if (_time != 0)
-		  d->pubDate.setTime_t(_time);
+	if (format == AtomFeed)
+	{
+		elemText = extractNode(node, QString::fromLatin1("issued"));
+		if (!elemText.isNull())
+			time = parseISO8601Date(elemText); 	
 	}
+	else 
+	{
+		elemText = extractNode(node, QString::fromLatin1("pubDate"));
+		if (!elemText.isNull())
+			time = KRFCDate::parseDate(elemText);
+	}
+	
 	if (!(elemText = extractNode(node, QString::fromLatin1("dc:date"))).isNull())
-    {
-		time_t _time = parseISO8601Date(elemText);
-
-        // 0 means invalid, not epoch (it returns epoch+1 when it parsed epoch, see the KRFCDate::parseDate() docs)
-        if (_time != 0)
-		  d->pubDate.setTime_t(_time);
+	{
+		time = parseISO8601Date(elemText);
 	}
 
+	// 0 means invalid, not epoch (parsers return epoch+1 when parsing epoch, see the KRFCDate::parseDate() docs)
+        if (time != 0)
+		d->pubDate.setTime_t(time);
+
 	if (!(elemText = extractNode(node, QString::fromLatin1("wfw:comment"))).isNull()) {
 		d->commentsLink = elemText;
 	}
Comment 7 Frank Osterfeld 2005-05-16 13:33:01 UTC
SVN commit 414571 by osterfeld:

backport of 97874: clear search bar when selecting nodes
CCBUG: 97874


 M  +13 -5     branches/KDE/3.4/kdepim/akregator/src/akregator_view.cpp  


--- branches/KDE/3.4/kdepim/akregator/src/akregator_view.cpp #414570:414571
@@ -843,6 +843,8 @@
     
     m_tabs->showPage(m_mainTab);
 
+    slotClearFilter();
+
     if (m_viewMode == CombinedView)
         m_articleViewer->slotShowNode(node);
     else
@@ -1342,16 +1344,22 @@
 
 void View::slotSearchComboChanged(int index)
 {
-    Settings::setQuickFilter( index );
-    updateSearch();
+    if (index != Settings::quickFilter())
+    {
+        Settings::setQuickFilter( index );
+        updateSearch();
+    }
 }
 
 // from klistviewsearchline
 void View::slotSearchTextChanged(const QString &search)
 {
-    m_queuedSearches++;
-    m_queuedSearch = search;
-    QTimer::singleShot(200, this, SLOT(slotActivateSearch()));
+    if (m_queuedSearch != search)
+    {
+        m_queuedSearches++;
+        m_queuedSearch = search;
+        QTimer::singleShot(200, this, SLOT(slotActivateSearch()));
+    }
 }
 
 void View::slotActivateSearch()