Fix for bug 3420 - we now use GUID if it's provided by the feed RCL_3
authorSebastian Brannstrom <sebastianb@symbian.org>
Sat, 16 Oct 2010 20:33:45 +0100
branchRCL_3
changeset 258 f02d87cb8d1f
parent 257 f5377b5817a0
child 259 af83e0ffbf4b
Fix for bug 3420 - we now use GUID if it's provided by the feed
engine/inc/FeedParser.h
engine/src/FeedParser.cpp
--- a/engine/inc/FeedParser.h	Sat Oct 16 20:10:01 2010 +0100
+++ b/engine/inc/FeedParser.h	Sat Oct 16 20:33:45 2010 +0100
@@ -35,6 +35,7 @@
 _LIT(KTagChannel, "channel");
 _LIT(KTagEnclosure, "enclosure");
 _LIT(KTagPubDate, "pubDate");
+_LIT(KTagGuid, "guid");
 _LIT(KTagLastBuildDate, "lastBuildDate");
 _LIT(KTagHref, "href");
 
@@ -52,7 +53,8 @@
 	EStateItemLink,
 	EStateItemEnclosure,
 	EStateItemDescription,
-	EStateItemPubDate
+	EStateItemPubDate,
+	EStateItemGuid
 };
 
 enum TEncoding {
@@ -93,7 +95,7 @@
 	CFeedInfo *iActiveFeed;
 
 	TBuf<KBufferLength> iBuffer;
-	
+	TUint iUid;
 	TUint iMaxItems;
 	TUint iItemsParsed;
 	TBool iStoppedParsing;
--- a/engine/src/FeedParser.cpp	Sat Oct 16 20:10:01 2010 +0100
+++ b/engine/src/FeedParser.cpp	Sat Oct 16 20:33:45 2010 +0100
@@ -24,6 +24,7 @@
 #include <xml/stringdictionarycollection.h>
 #include <utf.h>
 #include <tinternetdate.h>
+#include <e32hashtab.h>
 #include "debug.h"
 #include "podcastutils.h"
 
@@ -159,6 +160,7 @@
 		}
 		break;
 	case EStateItem:
+		iUid = 0;
 		// <channel> <item> <title>
 		if (str.CompareF(KTagTitle) == 0) {
 			iFeedState=EStateItemTitle;
@@ -197,6 +199,9 @@
 		} else if (str.CompareF(KTagPubDate) == 0) {
 			//DP("LastBuildDate BEGIN");
 			iFeedState = EStateItemPubDate;
+		// <channel> <item> <guid>
+		} else if (str.CompareF(KTagGuid) == 0) {
+			iFeedState = EStateItemGuid;
 		}
 		break;
 	default:
@@ -273,9 +278,7 @@
 		case EStateItem:
 			if (str.CompareF(KTagItem) == 0) 
 				{
-				
 				// check if we have a valid pubdate
-				
 				if (iActiveShow->PubDate().Int64() == 0)
 					{
 					// set pubDate to present time
@@ -292,6 +295,10 @@
 					iActiveShow->SetPubDate(now);
 					}
 				
+				if (iUid)
+					{
+					iActiveShow->SetUid(iUid);
+					}
 						
 				iCallbacks.NewShowL(*iActiveShow);
 				
@@ -386,6 +393,10 @@
 			}
 			iFeedState=EStateItem;
 			break;
+		case EStateItemGuid:
+			iUid = DefaultHash::Des16(iBuffer);
+			iFeedState=EStateItem;
+			break;
 		case EStateItemTitle:
 			//DP1("title: %S", &iBuffer);
 			iActiveShow->SetTitleL(iBuffer);