author | Sebastian Brannstrom <sebastianb@symbian.org> |
Sat, 04 Dec 2010 15:35:24 +0000 | |
branch | RCL_3 |
changeset 392 | 6a9baa40b241 |
parent 376 | 31968c23152c |
permissions | -rw-r--r-- |
2 | 1 |
/* |
2 |
* Copyright (c) 2007-2010 Sebastian Brannstrom, Lars Persson, EmbedDev AB |
|
3 |
* |
|
4 |
* All rights reserved. |
|
5 |
* This component and the accompanying materials are made available |
|
6 |
* under the terms of the License "Eclipse Public License v1.0" |
|
7 |
* which accompanies this distribution, and is available |
|
8 |
* at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
9 |
* |
|
10 |
* Initial Contributors: |
|
11 |
* EmbedDev AB - initial contribution. |
|
12 |
* |
|
13 |
* Contributors: |
|
14 |
* |
|
15 |
* Description: |
|
16 |
* |
|
17 |
*/ |
|
18 |
||
19 |
#include "FeedParser.h" |
|
20 |
#include <f32file.h> |
|
21 |
#include <bautils.h> |
|
22 |
#include <s32file.h> |
|
23 |
#include <charconv.h> |
|
24 |
#include <xml/stringdictionarycollection.h> |
|
25 |
#include <utf.h> |
|
26 |
#include <tinternetdate.h> |
|
258
f02d87cb8d1f
Fix for bug 3420 - we now use GUID if it's provided by the feed
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
255
diff
changeset
|
27 |
#include <e32hashtab.h> |
2 | 28 |
#include "debug.h" |
123 | 29 |
#include "podcastutils.h" |
2 | 30 |
|
31 |
using namespace Xml; |
|
32 |
const TInt KMaxParseBuffer = 1024; |
|
33 |
const TInt KMaxStringBuffer = 100; |
|
34 |
||
35 |
CFeedParser::CFeedParser(MFeedParserObserver& aCallbacks, RFs& aFs) : iCallbacks(aCallbacks), iRfs(aFs) |
|
36 |
{ |
|
37 |
} |
|
38 |
||
39 |
CFeedParser::~CFeedParser() |
|
40 |
{ |
|
41 |
} |
|
42 |
||
43 |
void CFeedParser::ParseFeedL(const TFileName &feedFileName, CFeedInfo *info, TUint aMaxItems) |
|
44 |
{ |
|
45 |
//DP1("ParseFeedL BEGIN: %S", &feedFileName); |
|
46 |
||
47 |
_LIT8(KXmlMimeType, "text/xml"); |
|
48 |
// Contruct the parser object |
|
49 |
CParser* parser = CParser::NewLC(KXmlMimeType, *this); |
|
50 |
iActiveFeed = info; |
|
51 |
iFeedState = EStateRoot; |
|
52 |
iActiveShow = NULL; |
|
53 |
iItemsParsed = 0; |
|
54 |
iMaxItems = aMaxItems; |
|
55 |
iStoppedParsing = EFalse; |
|
56 |
iEncoding = ELatin1; |
|
376
31968c23152c
Merging fixes from Symbian 1
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
369
diff
changeset
|
57 |
if (iNewestShow) |
31968c23152c
Merging fixes from Symbian 1
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
369
diff
changeset
|
58 |
delete iNewestShow; |
31968c23152c
Merging fixes from Symbian 1
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
369
diff
changeset
|
59 |
iNewestShow = 0; |
31968c23152c
Merging fixes from Symbian 1
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
369
diff
changeset
|
60 |
|
31968c23152c
Merging fixes from Symbian 1
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
369
diff
changeset
|
61 |
iNewFeed = (iActiveFeed->LastUpdated() == 0) ? ETrue : EFalse; |
2 | 62 |
|
342
9441fb8fd60d
Fix for bug 2780 - we now compare file sizes as well as lastPubDate to tell if a feed is updated
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
330
diff
changeset
|
63 |
TEntry entry; |
9441fb8fd60d
Fix for bug 2780 - we now compare file sizes as well as lastPubDate to tell if a feed is updated
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
330
diff
changeset
|
64 |
User::LeaveIfError(iRfs.Entry(feedFileName, entry)); |
9441fb8fd60d
Fix for bug 2780 - we now compare file sizes as well as lastPubDate to tell if a feed is updated
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
330
diff
changeset
|
65 |
iFileSize = entry.iSize; |
9441fb8fd60d
Fix for bug 2780 - we now compare file sizes as well as lastPubDate to tell if a feed is updated
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
330
diff
changeset
|
66 |
|
2 | 67 |
ParseL(*parser, iRfs, feedFileName); |
68 |
||
69 |
CleanupStack::PopAndDestroy(parser); |
|
70 |
||
71 |
//DP("ParseFeedL END"); |
|
72 |
} |
|
73 |
||
74 |
// from MContentHandler |
|
75 |
void CFeedParser::OnStartDocumentL(const RDocumentParameters& aDocParam, TInt /*aErrorCode*/) |
|
76 |
{ |
|
77 |
DP("OnStartDocumentL()"); |
|
78 |
HBufC* charset = HBufC::NewLC(KMaxParseBuffer); |
|
79 |
charset->Des().Copy(aDocParam.CharacterSetName().DesC()); |
|
80 |
iEncoding = EUtf8; |
|
369
c683165bec63
More catchup with 5th edition
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
342
diff
changeset
|
81 |
iFeedDirection = EFeedUnknown; |
c683165bec63
More catchup with 5th edition
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
342
diff
changeset
|
82 |
iPreviousPubDate = 0; |
2 | 83 |
if (charset->CompareF(_L("utf-8")) == 0) { |
84 |
DP("setting UTF8"); |
|
85 |
iEncoding = EUtf8; |
|
86 |
} else if (charset->CompareF(_L("ISO-8859-1")) == 0) { |
|
87 |
iEncoding = EUtf8; //Latin1; |
|
88 |
} else { |
|
89 |
DP1("unknown charset: %S", &charset); |
|
90 |
} |
|
91 |
CleanupStack::PopAndDestroy(charset);//buffer |
|
92 |
} |
|
93 |
||
94 |
void CFeedParser::OnEndDocumentL(TInt /*aErrorCode*/) |
|
95 |
{ |
|
96 |
//DP("OnEndDocumentL()"); |
|
376
31968c23152c
Merging fixes from Symbian 1
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
369
diff
changeset
|
97 |
if (iNewFeed) |
31968c23152c
Merging fixes from Symbian 1
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
369
diff
changeset
|
98 |
{ |
31968c23152c
Merging fixes from Symbian 1
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
369
diff
changeset
|
99 |
// if the feed adds at bottom, this |
31968c23152c
Merging fixes from Symbian 1
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
369
diff
changeset
|
100 |
if (iNewestShow) |
31968c23152c
Merging fixes from Symbian 1
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
369
diff
changeset
|
101 |
{ |
31968c23152c
Merging fixes from Symbian 1
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
369
diff
changeset
|
102 |
iNewestShow->SetPlayState(ENeverPlayed); |
31968c23152c
Merging fixes from Symbian 1
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
369
diff
changeset
|
103 |
iCallbacks.ParserShowUpdatedL(*iNewestShow); |
31968c23152c
Merging fixes from Symbian 1
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
369
diff
changeset
|
104 |
delete iNewestShow; |
31968c23152c
Merging fixes from Symbian 1
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
369
diff
changeset
|
105 |
iNewestShow = 0; |
31968c23152c
Merging fixes from Symbian 1
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
369
diff
changeset
|
106 |
} |
31968c23152c
Merging fixes from Symbian 1
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
369
diff
changeset
|
107 |
} |
31968c23152c
Merging fixes from Symbian 1
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
369
diff
changeset
|
108 |
|
2 | 109 |
iCallbacks.ParsingCompleteL(iActiveFeed); |
110 |
} |
|
111 |
||
112 |
void CFeedParser::OnStartElementL(const RTagInfo& aElement, const RAttributeArray& aAttributes, TInt /*aErrorCode*/) |
|
113 |
{ |
|
114 |
if (iStoppedParsing) { |
|
115 |
iActiveShow = NULL; |
|
116 |
return; |
|
117 |
} |
|
118 |
||
119 |
TBuf<KMaxStringBuffer> str; |
|
120 |
str.Copy(aElement.LocalName().DesC()); |
|
121 |
//DP2("OnStartElementL START state=%d, element=%S", iFeedState, &str); |
|
122 |
iBuffer.Zero(); |
|
123 |
switch (iFeedState) { |
|
124 |
case EStateRoot: |
|
125 |
// <channel> |
|
126 |
if (str.CompareF(KTagChannel) == 0) { |
|
127 |
iFeedState = EStateChannel; |
|
128 |
} |
|
129 |
break; |
|
130 |
case EStateChannel: |
|
131 |
// <channel> <item> |
|
132 |
if(str.CompareF(KTagItem) == 0) { |
|
133 |
//DP("New item"); |
|
134 |
iFeedState=EStateItem; |
|
135 |
||
136 |
iActiveShow = NULL; |
|
137 |
iActiveShow = CShowInfo::NewL(); |
|
138 |
if (iActiveShow == NULL) { |
|
139 |
DP("Out of memory!"); |
|
140 |
iStoppedParsing = ETrue; |
|
141 |
return; |
|
142 |
} |
|
143 |
iActiveShow->SetFeedUid(iActiveFeed->Uid()); |
|
144 |
||
145 |
// <channel> <lastBuildDate> |
|
146 |
} else if (str.CompareF(KTagLastBuildDate) == 0) { |
|
147 |
DP("LastBuildDate BEGIN"); |
|
148 |
iFeedState=EStateChannelLastBuildDate; |
|
149 |
// <channel> <link> |
|
150 |
}else if (str.CompareF(KTagTitle) == 0) { |
|
151 |
iFeedState=EStateChannelTitle; |
|
152 |
// <channel> <link> |
|
153 |
} else if (str.CompareF(KTagLink) == 0) { |
|
154 |
iFeedState = EStateChannelLink; |
|
155 |
// <channel> <description> |
|
156 |
} else if (str.CompareF(KTagDescription) == 0) { |
|
157 |
iFeedState=EStateChannelDescription; |
|
158 |
// <channel> <image> |
|
159 |
} else if (str.CompareF(KTagImage) == 0) { |
|
160 |
for (int i=0;i<aAttributes.Count();i++) { |
|
161 |
RAttribute attr = aAttributes[i]; |
|
162 |
TBuf<KMaxStringBuffer> attr16; |
|
163 |
attr16.Copy(attr.Attribute().LocalName().DesC().Left(KMaxStringBuffer)); |
|
164 |
HBufC* val16 = CnvUtfConverter::ConvertToUnicodeFromUtf8L(attr.Value().DesC().Left(KMaxParseBuffer)); |
|
165 |
CleanupStack::PushL(val16); |
|
166 |
||
167 |
// href=... |
|
168 |
if (attr16.Compare(KTagHref) == 0) { |
|
169 |
iActiveFeed->SetImageUrlL(*val16); |
|
170 |
} |
|
171 |
CleanupStack::PopAndDestroy(val16); |
|
172 |
} |
|
173 |
||
174 |
iFeedState=EStateChannelImage; |
|
175 |
} |
|
176 |
break; |
|
177 |
case EStateChannelImage: |
|
178 |
// <channel> <image> <url> |
|
179 |
if (str.CompareF(KTagUrl) == 0) { |
|
180 |
iFeedState=EStateChannelImageUrl; |
|
181 |
} else { |
|
182 |
iFeedState=EStateChannelImage; |
|
183 |
} |
|
184 |
break; |
|
185 |
case EStateItem: |
|
258
f02d87cb8d1f
Fix for bug 3420 - we now use GUID if it's provided by the feed
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
255
diff
changeset
|
186 |
iUid = 0; |
2 | 187 |
// <channel> <item> <title> |
188 |
if (str.CompareF(KTagTitle) == 0) { |
|
189 |
iFeedState=EStateItemTitle; |
|
190 |
// <channel> <item> <link> |
|
191 |
} else if (str.CompareF(KTagLink) == 0) { |
|
192 |
iFeedState=EStateItemLink; |
|
193 |
// <channel> <item> <enclosure ...> |
|
194 |
} else if (str.CompareF(KTagEnclosure) == 0) { |
|
195 |
//DP("Enclosure START"); |
|
196 |
for (int i=0;i<aAttributes.Count();i++) { |
|
197 |
RAttribute attr = aAttributes[i]; |
|
198 |
TBuf<KMaxStringBuffer> attr16; |
|
199 |
attr16.Copy(attr.Attribute().LocalName().DesC()); |
|
200 |
// url=... |
|
201 |
if (attr16.Compare(KTagUrl) == 0) { |
|
202 |
HBufC* val16 = HBufC::NewLC(KMaxParseBuffer); |
|
203 |
val16->Des().Copy(attr.Value().DesC()); |
|
204 |
iActiveShow->SetUrlL(*val16); |
|
123 | 205 |
|
206 |
if (PodcastUtils::IsVideoShow(*val16)) { |
|
207 |
iActiveShow->SetShowType(EVideoPodcast); |
|
208 |
} |
|
2 | 209 |
CleanupStack::PopAndDestroy(val16); |
210 |
// length=... |
|
211 |
} else if (attr16.Compare(KTagLength) == 0) { |
|
212 |
TLex8 lex(attr.Value().DesC()); |
|
213 |
TUint size = 0; |
|
214 |
lex.Val(size, EDecimal); |
|
215 |
iActiveShow->SetShowSize(size); |
|
216 |
} |
|
217 |
} |
|
218 |
// <channel> <item> <description> |
|
219 |
} else if (str.CompareF(KTagDescription) == 0) { |
|
220 |
iFeedState=EStateItemDescription; |
|
221 |
// <channel> <item> <pubdate> |
|
222 |
} else if (str.CompareF(KTagPubDate) == 0) { |
|
223 |
//DP("LastBuildDate BEGIN"); |
|
224 |
iFeedState = EStateItemPubDate; |
|
258
f02d87cb8d1f
Fix for bug 3420 - we now use GUID if it's provided by the feed
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
255
diff
changeset
|
225 |
// <channel> <item> <guid> |
f02d87cb8d1f
Fix for bug 3420 - we now use GUID if it's provided by the feed
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
255
diff
changeset
|
226 |
} else if (str.CompareF(KTagGuid) == 0) { |
f02d87cb8d1f
Fix for bug 3420 - we now use GUID if it's provided by the feed
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
255
diff
changeset
|
227 |
iFeedState = EStateItemGuid; |
2 | 228 |
} |
229 |
break; |
|
230 |
default: |
|
231 |
//DP2("Ignoring tag %S when in state %d", &str, iFeedState); |
|
232 |
break; |
|
233 |
} |
|
234 |
// DP1("OnStartElementL END state=%d", iFeedState); |
|
235 |
} |
|
236 |
||
237 |
void CFeedParser::OnEndElementL(const RTagInfo& aElement, TInt /*aErrorCode*/) |
|
238 |
{ |
|
239 |
||
240 |
if (iStoppedParsing) { |
|
241 |
return; |
|
242 |
} |
|
243 |
||
244 |
iBuffer.Trim(); |
|
245 |
||
246 |
TDesC8 lName = aElement.LocalName().DesC(); |
|
247 |
TBuf<KMaxStringBuffer> str; |
|
248 |
str.Copy(aElement.LocalName().DesC()); |
|
249 |
||
250 |
//DP2("OnEndElementL START state=%d, element=%S", iFeedState, &str); |
|
251 |
||
252 |
switch (iFeedState) { |
|
253 |
case EStateChannelTitle: |
|
254 |
if(str.CompareF(KTagTitle) == 0) { |
|
255 |
if (iActiveFeed->CustomTitle() == EFalse) { |
|
256 |
iActiveFeed->SetTitleL(iBuffer); |
|
257 |
} |
|
258 |
iFeedState = EStateChannel; |
|
259 |
} |
|
260 |
break; |
|
261 |
case EStateChannelLink: |
|
262 |
iActiveFeed->SetLinkL(iBuffer); |
|
263 |
iFeedState = EStateChannel; |
|
264 |
break; |
|
265 |
case EStateChannelDescription: |
|
266 |
iActiveFeed->SetDescriptionL(iBuffer); |
|
267 |
iFeedState = EStateChannel; |
|
268 |
break; |
|
269 |
case EStateChannelLastBuildDate: |
|
270 |
{ |
|
271 |
//DP("LastBuildDate END"); |
|
272 |
TInternetDate internetDate; |
|
273 |
TBuf8<128> temp; |
|
274 |
temp.Copy(iBuffer); |
|
275 |
||
342
9441fb8fd60d
Fix for bug 2780 - we now compare file sizes as well as lastPubDate to tell if a feed is updated
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
330
diff
changeset
|
276 |
DP2("iFileSize=%d, iActiveFeed->FeedFileSize()=%d", iFileSize, iActiveFeed->FeedFileSize()); |
9441fb8fd60d
Fix for bug 2780 - we now compare file sizes as well as lastPubDate to tell if a feed is updated
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
330
diff
changeset
|
277 |
|
2 | 278 |
TRAPD(parseError, internetDate.SetDateL(temp)); |
279 |
if(parseError == KErrNone) { |
|
280 |
if (TTime(internetDate.DateTime()) > iActiveFeed->BuildDate()) { |
|
281 |
DP("Successfully parsed build date"); |
|
282 |
iActiveFeed->SetBuildDate(TTime(internetDate.DateTime())); |
|
342
9441fb8fd60d
Fix for bug 2780 - we now compare file sizes as well as lastPubDate to tell if a feed is updated
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
330
diff
changeset
|
283 |
} else if (iFileSize == iActiveFeed->FeedFileSize()){ |
2 | 284 |
DP("*** Nothing new, aborting parsing"); |
285 |
iStoppedParsing = ETrue; |
|
286 |
} |
|
287 |
} else { |
|
288 |
DP("Failed to parse last build date"); |
|
289 |
} |
|
342
9441fb8fd60d
Fix for bug 2780 - we now compare file sizes as well as lastPubDate to tell if a feed is updated
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
330
diff
changeset
|
290 |
iActiveFeed->SetFeedFileSize(iFileSize); |
2 | 291 |
iFeedState = EStateChannel; |
292 |
} |
|
293 |
break; |
|
294 |
case EStateChannelImageUrl: |
|
295 |
//DP1("Image url: %S", &iBuffer); |
|
296 |
iActiveFeed->SetImageUrlL(iBuffer); |
|
297 |
iFeedState = EStateChannelImage; |
|
298 |
break; |
|
299 |
case EStateChannelImage: |
|
300 |
if(str.CompareF(KTagImage) == 0) { |
|
301 |
iFeedState = EStateChannel; |
|
302 |
} |
|
303 |
break; |
|
304 |
case EStateItem: |
|
305 |
if (str.CompareF(KTagItem) == 0) |
|
254
042bb9038b32
Fix for bug 3540 - show sorting when pubDate is not set in feed
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
126
diff
changeset
|
306 |
{ |
042bb9038b32
Fix for bug 3540 - show sorting when pubDate is not set in feed
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
126
diff
changeset
|
307 |
// check if we have a valid pubdate |
042bb9038b32
Fix for bug 3540 - show sorting when pubDate is not set in feed
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
126
diff
changeset
|
308 |
if (iActiveShow->PubDate().Int64() == 0) |
042bb9038b32
Fix for bug 3540 - show sorting when pubDate is not set in feed
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
126
diff
changeset
|
309 |
{ |
042bb9038b32
Fix for bug 3540 - show sorting when pubDate is not set in feed
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
126
diff
changeset
|
310 |
// set pubDate to present time |
042bb9038b32
Fix for bug 3540 - show sorting when pubDate is not set in feed
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
126
diff
changeset
|
311 |
TTime now; |
042bb9038b32
Fix for bug 3540 - show sorting when pubDate is not set in feed
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
126
diff
changeset
|
312 |
now.UniversalTime(); |
042bb9038b32
Fix for bug 3540 - show sorting when pubDate is not set in feed
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
126
diff
changeset
|
313 |
|
042bb9038b32
Fix for bug 3540 - show sorting when pubDate is not set in feed
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
126
diff
changeset
|
314 |
// but we want reverse sorting, so let's do a little trick... |
042bb9038b32
Fix for bug 3540 - show sorting when pubDate is not set in feed
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
126
diff
changeset
|
315 |
TTimeIntervalHours delta; |
042bb9038b32
Fix for bug 3540 - show sorting when pubDate is not set in feed
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
126
diff
changeset
|
316 |
delta = iItemsParsed; |
042bb9038b32
Fix for bug 3540 - show sorting when pubDate is not set in feed
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
126
diff
changeset
|
317 |
|
042bb9038b32
Fix for bug 3540 - show sorting when pubDate is not set in feed
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
126
diff
changeset
|
318 |
// ... remove an hour per show we've parsed so far |
042bb9038b32
Fix for bug 3540 - show sorting when pubDate is not set in feed
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
126
diff
changeset
|
319 |
now -= delta; |
042bb9038b32
Fix for bug 3540 - show sorting when pubDate is not set in feed
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
126
diff
changeset
|
320 |
|
042bb9038b32
Fix for bug 3540 - show sorting when pubDate is not set in feed
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
126
diff
changeset
|
321 |
iActiveShow->SetPubDate(now); |
042bb9038b32
Fix for bug 3540 - show sorting when pubDate is not set in feed
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
126
diff
changeset
|
322 |
} |
042bb9038b32
Fix for bug 3540 - show sorting when pubDate is not set in feed
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
126
diff
changeset
|
323 |
|
369
c683165bec63
More catchup with 5th edition
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
342
diff
changeset
|
324 |
if (iFeedDirection == EFeedUnknown) |
c683165bec63
More catchup with 5th edition
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
342
diff
changeset
|
325 |
{ |
c683165bec63
More catchup with 5th edition
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
342
diff
changeset
|
326 |
if (iPreviousPubDate.Int64() != 0) { |
c683165bec63
More catchup with 5th edition
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
342
diff
changeset
|
327 |
if (iActiveShow->PubDate() > iPreviousPubDate) |
c683165bec63
More catchup with 5th edition
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
342
diff
changeset
|
328 |
{ |
c683165bec63
More catchup with 5th edition
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
342
diff
changeset
|
329 |
DP("Feed adds at bottom"); |
c683165bec63
More catchup with 5th edition
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
342
diff
changeset
|
330 |
iFeedDirection = EFeedAddsAtBottom; |
c683165bec63
More catchup with 5th edition
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
342
diff
changeset
|
331 |
} |
c683165bec63
More catchup with 5th edition
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
342
diff
changeset
|
332 |
else |
c683165bec63
More catchup with 5th edition
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
342
diff
changeset
|
333 |
{ |
c683165bec63
More catchup with 5th edition
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
342
diff
changeset
|
334 |
DP("Feed adds at top"); |
c683165bec63
More catchup with 5th edition
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
342
diff
changeset
|
335 |
iFeedDirection = EFeedAddsAtTop; |
c683165bec63
More catchup with 5th edition
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
342
diff
changeset
|
336 |
} |
c683165bec63
More catchup with 5th edition
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
342
diff
changeset
|
337 |
} |
c683165bec63
More catchup with 5th edition
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
342
diff
changeset
|
338 |
iPreviousPubDate = iActiveShow->PubDate(); |
c683165bec63
More catchup with 5th edition
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
342
diff
changeset
|
339 |
} |
c683165bec63
More catchup with 5th edition
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
342
diff
changeset
|
340 |
|
258
f02d87cb8d1f
Fix for bug 3420 - we now use GUID if it's provided by the feed
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
255
diff
changeset
|
341 |
if (iUid) |
f02d87cb8d1f
Fix for bug 3420 - we now use GUID if it's provided by the feed
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
255
diff
changeset
|
342 |
{ |
f02d87cb8d1f
Fix for bug 3420 - we now use GUID if it's provided by the feed
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
255
diff
changeset
|
343 |
iActiveShow->SetUid(iUid); |
f02d87cb8d1f
Fix for bug 3420 - we now use GUID if it's provided by the feed
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
255
diff
changeset
|
344 |
} |
376
31968c23152c
Merging fixes from Symbian 1
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
369
diff
changeset
|
345 |
|
31968c23152c
Merging fixes from Symbian 1
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
369
diff
changeset
|
346 |
if (iNewFeed) |
31968c23152c
Merging fixes from Symbian 1
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
369
diff
changeset
|
347 |
{ |
31968c23152c
Merging fixes from Symbian 1
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
369
diff
changeset
|
348 |
// set all played, except for the newest one |
31968c23152c
Merging fixes from Symbian 1
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
369
diff
changeset
|
349 |
iActiveShow->SetPlayState(EPlayed); |
31968c23152c
Merging fixes from Symbian 1
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
369
diff
changeset
|
350 |
|
31968c23152c
Merging fixes from Symbian 1
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
369
diff
changeset
|
351 |
if (!iNewestShow || iActiveShow->PubDate() > iNewestShow->PubDate()) |
31968c23152c
Merging fixes from Symbian 1
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
369
diff
changeset
|
352 |
{ |
31968c23152c
Merging fixes from Symbian 1
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
369
diff
changeset
|
353 |
if (iNewestShow) |
31968c23152c
Merging fixes from Symbian 1
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
369
diff
changeset
|
354 |
delete iNewestShow; |
254
042bb9038b32
Fix for bug 3540 - show sorting when pubDate is not set in feed
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
126
diff
changeset
|
355 |
|
376
31968c23152c
Merging fixes from Symbian 1
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
369
diff
changeset
|
356 |
iNewestShow = new CShowInfo(iActiveShow); |
31968c23152c
Merging fixes from Symbian 1
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
369
diff
changeset
|
357 |
} |
31968c23152c
Merging fixes from Symbian 1
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
369
diff
changeset
|
358 |
} |
31968c23152c
Merging fixes from Symbian 1
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
369
diff
changeset
|
359 |
|
2 | 360 |
iCallbacks.NewShowL(*iActiveShow); |
361 |
||
362 |
delete iActiveShow; |
|
363 |
||
364 |
// We should now be finished with the show. |
|
365 |
iActiveShow = NULL; |
|
366 |
||
367 |
iItemsParsed++; |
|
126 | 368 |
DP2("iItemsParsed: %d, iMaxItems: %d", iItemsParsed, iMaxItems); |
369
c683165bec63
More catchup with 5th edition
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
342
diff
changeset
|
369 |
// we stop parsing after iMaxItems, but not if feed builds at bottom |
c683165bec63
More catchup with 5th edition
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
342
diff
changeset
|
370 |
if (iItemsParsed >= iMaxItems && iFeedDirection != EFeedAddsAtBottom) |
321
7a0fb290f9c6
Re-enabled max items parsed, because disabling this causes shows to turn up as new multiple times. This again breaks feeds that add new shows at the bottom, so we need to solve this properly.
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
258
diff
changeset
|
371 |
{ |
7a0fb290f9c6
Re-enabled max items parsed, because disabling this causes shows to turn up as new multiple times. This again breaks feeds that add new shows at the bottom, so we need to solve this properly.
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
258
diff
changeset
|
372 |
iStoppedParsing = ETrue; |
7a0fb290f9c6
Re-enabled max items parsed, because disabling this causes shows to turn up as new multiple times. This again breaks feeds that add new shows at the bottom, so we need to solve this properly.
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
258
diff
changeset
|
373 |
DP("*** Too many items, aborting parsing"); |
7a0fb290f9c6
Re-enabled max items parsed, because disabling this causes shows to turn up as new multiple times. This again breaks feeds that add new shows at the bottom, so we need to solve this properly.
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
258
diff
changeset
|
374 |
} |
2 | 375 |
|
376 |
iFeedState=EStateChannel; |
|
377 |
} |
|
378 |
break; |
|
379 |
case EStateItemPubDate: |
|
380 |
DP1("PubDate END: iBuffer='%S'", &iBuffer); |
|
381 |
if (str.CompareF(KTagPubDate) == 0) { |
|
330
4cf89a7d3476
Fix for bug 3911 - Podcatcher still crashes when trying to update some feeds
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
321
diff
changeset
|
382 |
DP1("iBuffer.Length()=%d", iBuffer.Length()); |
2 | 383 |
|
330
4cf89a7d3476
Fix for bug 3911 - Podcatcher still crashes when trying to update some feeds
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
321
diff
changeset
|
384 |
if (iBuffer.Length() > 6) |
4cf89a7d3476
Fix for bug 3911 - Podcatcher still crashes when trying to update some feeds
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
321
diff
changeset
|
385 |
{ |
4cf89a7d3476
Fix for bug 3911 - Podcatcher still crashes when trying to update some feeds
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
321
diff
changeset
|
386 |
// hack for feeds that don't always write day as two digits |
4cf89a7d3476
Fix for bug 3911 - Podcatcher still crashes when trying to update some feeds
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
321
diff
changeset
|
387 |
TChar five(iBuffer[5]); |
4cf89a7d3476
Fix for bug 3911 - Podcatcher still crashes when trying to update some feeds
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
321
diff
changeset
|
388 |
TChar six(iBuffer[6]); |
4cf89a7d3476
Fix for bug 3911 - Podcatcher still crashes when trying to update some feeds
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
321
diff
changeset
|
389 |
|
4cf89a7d3476
Fix for bug 3911 - Podcatcher still crashes when trying to update some feeds
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
321
diff
changeset
|
390 |
if (five.IsDigit() && !six.IsDigit()) { |
4cf89a7d3476
Fix for bug 3911 - Podcatcher still crashes when trying to update some feeds
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
321
diff
changeset
|
391 |
TBuf<KMaxStringBuffer> fix; |
4cf89a7d3476
Fix for bug 3911 - Podcatcher still crashes when trying to update some feeds
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
321
diff
changeset
|
392 |
fix.Copy(iBuffer.Left(4)); |
4cf89a7d3476
Fix for bug 3911 - Podcatcher still crashes when trying to update some feeds
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
321
diff
changeset
|
393 |
fix.Append(_L(" 0")); |
4cf89a7d3476
Fix for bug 3911 - Podcatcher still crashes when trying to update some feeds
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
321
diff
changeset
|
394 |
fix.Append(iBuffer.Mid(5)); |
4cf89a7d3476
Fix for bug 3911 - Podcatcher still crashes when trying to update some feeds
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
321
diff
changeset
|
395 |
iBuffer.Copy(fix); |
4cf89a7d3476
Fix for bug 3911 - Podcatcher still crashes when trying to update some feeds
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
321
diff
changeset
|
396 |
} |
4cf89a7d3476
Fix for bug 3911 - Podcatcher still crashes when trying to update some feeds
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
321
diff
changeset
|
397 |
// end hack |
4cf89a7d3476
Fix for bug 3911 - Podcatcher still crashes when trying to update some feeds
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
321
diff
changeset
|
398 |
} |
2 | 399 |
|
330
4cf89a7d3476
Fix for bug 3911 - Podcatcher still crashes when trying to update some feeds
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
321
diff
changeset
|
400 |
if (iBuffer.Length() > 11) |
4cf89a7d3476
Fix for bug 3911 - Podcatcher still crashes when trying to update some feeds
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
321
diff
changeset
|
401 |
{ |
4cf89a7d3476
Fix for bug 3911 - Podcatcher still crashes when trying to update some feeds
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
321
diff
changeset
|
402 |
// hack for feeds that write out months in full |
2 | 403 |
|
330
4cf89a7d3476
Fix for bug 3911 - Podcatcher still crashes when trying to update some feeds
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
321
diff
changeset
|
404 |
if (iBuffer[11] != ' ') { |
4cf89a7d3476
Fix for bug 3911 - Podcatcher still crashes when trying to update some feeds
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
321
diff
changeset
|
405 |
TPtrC midPtr = iBuffer.Mid(8); |
4cf89a7d3476
Fix for bug 3911 - Podcatcher still crashes when trying to update some feeds
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
321
diff
changeset
|
406 |
|
4cf89a7d3476
Fix for bug 3911 - Podcatcher still crashes when trying to update some feeds
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
321
diff
changeset
|
407 |
int spacePos = midPtr.Find(_L(" ")); |
2 | 408 |
|
330
4cf89a7d3476
Fix for bug 3911 - Podcatcher still crashes when trying to update some feeds
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
321
diff
changeset
|
409 |
if (spacePos != KErrNotFound) { |
4cf89a7d3476
Fix for bug 3911 - Podcatcher still crashes when trying to update some feeds
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
321
diff
changeset
|
410 |
//DP1("Month: %S", &midPtr.Left(spacePos)); |
4cf89a7d3476
Fix for bug 3911 - Podcatcher still crashes when trying to update some feeds
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
321
diff
changeset
|
411 |
|
4cf89a7d3476
Fix for bug 3911 - Podcatcher still crashes when trying to update some feeds
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
321
diff
changeset
|
412 |
TBuf16<KBufferLength> newBuffer; |
4cf89a7d3476
Fix for bug 3911 - Podcatcher still crashes when trying to update some feeds
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
321
diff
changeset
|
413 |
newBuffer.Copy(iBuffer.Left(11)); |
4cf89a7d3476
Fix for bug 3911 - Podcatcher still crashes when trying to update some feeds
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
321
diff
changeset
|
414 |
newBuffer.Append(_L(" ")); |
4cf89a7d3476
Fix for bug 3911 - Podcatcher still crashes when trying to update some feeds
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
321
diff
changeset
|
415 |
newBuffer.Append(iBuffer.Mid(11+spacePos)); |
4cf89a7d3476
Fix for bug 3911 - Podcatcher still crashes when trying to update some feeds
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
321
diff
changeset
|
416 |
//DP1("newBuffer: %S", &newBuffer); |
4cf89a7d3476
Fix for bug 3911 - Podcatcher still crashes when trying to update some feeds
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
321
diff
changeset
|
417 |
iBuffer.Copy(newBuffer); |
4cf89a7d3476
Fix for bug 3911 - Podcatcher still crashes when trying to update some feeds
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
321
diff
changeset
|
418 |
} |
2 | 419 |
} |
330
4cf89a7d3476
Fix for bug 3911 - Podcatcher still crashes when trying to update some feeds
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
321
diff
changeset
|
420 |
|
4cf89a7d3476
Fix for bug 3911 - Podcatcher still crashes when trying to update some feeds
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
321
diff
changeset
|
421 |
// hack for feeds that write days and months as UPPERCASE |
4cf89a7d3476
Fix for bug 3911 - Podcatcher still crashes when trying to update some feeds
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
321
diff
changeset
|
422 |
TChar one(iBuffer[1]); |
4cf89a7d3476
Fix for bug 3911 - Podcatcher still crashes when trying to update some feeds
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
321
diff
changeset
|
423 |
TChar two(iBuffer[2]); |
4cf89a7d3476
Fix for bug 3911 - Podcatcher still crashes when trying to update some feeds
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
321
diff
changeset
|
424 |
TChar nine(iBuffer[9]); |
4cf89a7d3476
Fix for bug 3911 - Podcatcher still crashes when trying to update some feeds
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
321
diff
changeset
|
425 |
TChar ten(iBuffer[10]); |
4cf89a7d3476
Fix for bug 3911 - Podcatcher still crashes when trying to update some feeds
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
321
diff
changeset
|
426 |
|
4cf89a7d3476
Fix for bug 3911 - Podcatcher still crashes when trying to update some feeds
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
321
diff
changeset
|
427 |
one.LowerCase(); |
4cf89a7d3476
Fix for bug 3911 - Podcatcher still crashes when trying to update some feeds
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
321
diff
changeset
|
428 |
two.LowerCase(); |
4cf89a7d3476
Fix for bug 3911 - Podcatcher still crashes when trying to update some feeds
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
321
diff
changeset
|
429 |
nine.LowerCase(); |
4cf89a7d3476
Fix for bug 3911 - Podcatcher still crashes when trying to update some feeds
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
321
diff
changeset
|
430 |
ten.LowerCase(); |
4cf89a7d3476
Fix for bug 3911 - Podcatcher still crashes when trying to update some feeds
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
321
diff
changeset
|
431 |
|
4cf89a7d3476
Fix for bug 3911 - Podcatcher still crashes when trying to update some feeds
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
321
diff
changeset
|
432 |
iBuffer[1] = one; |
4cf89a7d3476
Fix for bug 3911 - Podcatcher still crashes when trying to update some feeds
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
321
diff
changeset
|
433 |
iBuffer[2] = two; |
4cf89a7d3476
Fix for bug 3911 - Podcatcher still crashes when trying to update some feeds
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
321
diff
changeset
|
434 |
iBuffer[9] = nine; |
4cf89a7d3476
Fix for bug 3911 - Podcatcher still crashes when trying to update some feeds
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
321
diff
changeset
|
435 |
iBuffer[10] = ten; |
4cf89a7d3476
Fix for bug 3911 - Podcatcher still crashes when trying to update some feeds
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
321
diff
changeset
|
436 |
} |
2 | 437 |
|
438 |
TBuf8<128> temp; |
|
439 |
temp.Copy(iBuffer); |
|
440 |
TInternetDate internetDate; |
|
441 |
TRAPD(parseError, internetDate.SetDateL(temp)); |
|
442 |
if(parseError == KErrNone) { |
|
443 |
//DP1("PubDate parse success: '%S'", &iBuffer); |
|
444 |
iActiveShow->SetPubDate(TTime(internetDate.DateTime())); |
|
445 |
||
446 |
||
447 |
DP6("Successfully parsed pubdate %d/%d/%d %d:%d:%d", |
|
448 |
iActiveShow->PubDate().DateTime().Year(), |
|
449 |
iActiveShow->PubDate().DateTime().Month(), |
|
450 |
iActiveShow->PubDate().DateTime().Day(), |
|
451 |
iActiveShow->PubDate().DateTime().Hour(), |
|
452 |
iActiveShow->PubDate().DateTime().Minute(), |
|
453 |
iActiveShow->PubDate().DateTime().Second()); |
|
454 |
||
455 |
} else { |
|
456 |
DP2("Pubdate parse error: '%S', error=%d", &iBuffer, parseError); |
|
457 |
} |
|
458 |
} |
|
459 |
iFeedState=EStateItem; |
|
460 |
break; |
|
258
f02d87cb8d1f
Fix for bug 3420 - we now use GUID if it's provided by the feed
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
255
diff
changeset
|
461 |
case EStateItemGuid: |
f02d87cb8d1f
Fix for bug 3420 - we now use GUID if it's provided by the feed
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
255
diff
changeset
|
462 |
iUid = DefaultHash::Des16(iBuffer); |
f02d87cb8d1f
Fix for bug 3420 - we now use GUID if it's provided by the feed
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
255
diff
changeset
|
463 |
iFeedState=EStateItem; |
f02d87cb8d1f
Fix for bug 3420 - we now use GUID if it's provided by the feed
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
255
diff
changeset
|
464 |
break; |
2 | 465 |
case EStateItemTitle: |
466 |
//DP1("title: %S", &iBuffer); |
|
467 |
iActiveShow->SetTitleL(iBuffer); |
|
468 |
iFeedState = EStateItem; |
|
469 |
break; |
|
470 |
case EStateItemLink: |
|
471 |
if (iActiveShow->Url().Length() == 0) { |
|
472 |
iActiveShow->SetUrlL(iBuffer); |
|
123 | 473 |
|
474 |
if (PodcastUtils::IsVideoShow(iBuffer)) { |
|
475 |
iActiveShow->SetShowType(EVideoPodcast); |
|
476 |
} |
|
2 | 477 |
} |
478 |
iFeedState = EStateItem; |
|
479 |
break; |
|
480 |
case EStateItemDescription: |
|
481 |
iActiveShow->SetDescriptionL(iBuffer); |
|
482 |
iFeedState = EStateItem; |
|
483 |
break; |
|
484 |
default: |
|
485 |
// fall back to channel level when in doubt |
|
486 |
iFeedState = EStateChannel; |
|
487 |
//DP2("Don't know how to handle end tag %S when in state %d", &str, iFeedState); |
|
488 |
break; |
|
489 |
} |
|
490 |
||
491 |
//DP1("OnEndElementL END state=%d", iFeedState); |
|
492 |
} |
|
493 |
||
494 |
void CFeedParser::OnContentL(const TDesC8& aBytes, TInt /*aErrorCode*/) |
|
495 |
{ |
|
496 |
TBuf<KBufferLength> temp; |
|
497 |
if (iEncoding == EUtf8) { |
|
498 |
CnvUtfConverter::ConvertToUnicodeFromUtf8(temp, aBytes); |
|
499 |
} else { |
|
500 |
temp.Copy(aBytes); |
|
501 |
} |
|
502 |
||
503 |
if(temp.Length() + iBuffer.Length() < KBufferLength) { |
|
504 |
iBuffer.Append(temp); |
|
505 |
} |
|
506 |
} |
|
507 |
||
508 |
void CFeedParser::OnStartPrefixMappingL(const RString& /*aPrefix*/, const RString& /*aUri*/, TInt /*aErrorCode*/) |
|
509 |
{ |
|
510 |
DP("OnStartPrefixMappingL()"); |
|
511 |
} |
|
512 |
||
513 |
void CFeedParser::OnEndPrefixMappingL(const RString& /*aPrefix*/, TInt /*aErrorCode*/) |
|
514 |
{ |
|
515 |
DP("OnEndPrefixMappingL()"); |
|
516 |
} |
|
517 |
||
518 |
void CFeedParser::OnIgnorableWhiteSpaceL(const TDesC8& /*aBytes*/, TInt /*aErrorCode*/) |
|
519 |
{ |
|
520 |
DP("OnIgnorableWhiteSpaceL()"); |
|
521 |
} |
|
522 |
||
523 |
void CFeedParser::OnSkippedEntityL(const RString& /*aName*/, TInt /*aErrorCode*/) |
|
524 |
{ |
|
525 |
DP("OnSkippedEntityL()"); |
|
526 |
} |
|
527 |
||
528 |
void CFeedParser::OnProcessingInstructionL(const TDesC8& /*aTarget*/, const TDesC8& /*aData*/, TInt /*aErrorCode*/) |
|
529 |
{ |
|
530 |
DP("OnProcessingInstructionL()"); |
|
531 |
} |
|
532 |
||
533 |
void CFeedParser::OnError(TInt aErrorCode) |
|
534 |
{ |
|
535 |
DP1("CFeedParser::OnError %d", aErrorCode); |
|
536 |
} |
|
537 |
||
538 |
TAny* CFeedParser::GetExtendedInterface(const TInt32 /*aUid*/) |
|
539 |
{ |
|
540 |
DP("GetExtendedInterface()"); |
|
541 |
return NULL; |
|
542 |
} |
|
543 |
||
544 |
CFeedInfo& CFeedParser::ActiveFeed() |
|
545 |
{ |
|
546 |
return *iActiveFeed; |
|
547 |
} |