319 } |
319 } |
320 break; |
320 break; |
321 case EStateItemPubDate: |
321 case EStateItemPubDate: |
322 DP1("PubDate END: iBuffer='%S'", &iBuffer); |
322 DP1("PubDate END: iBuffer='%S'", &iBuffer); |
323 if (str.CompareF(KTagPubDate) == 0) { |
323 if (str.CompareF(KTagPubDate) == 0) { |
324 // hack for feeds that don't always write day as two digits |
324 DP1("iBuffer.Length()=%d", iBuffer.Length()); |
325 TChar five(iBuffer[5]); |
325 |
326 TChar six(iBuffer[6]); |
326 if (iBuffer.Length() > 6) |
327 |
327 { |
328 if (five.IsDigit() && !six.IsDigit()) { |
328 // hack for feeds that don't always write day as two digits |
329 TBuf<KMaxStringBuffer> fix; |
329 TChar five(iBuffer[5]); |
330 fix.Copy(iBuffer.Left(4)); |
330 TChar six(iBuffer[6]); |
331 fix.Append(_L(" 0")); |
331 |
332 fix.Append(iBuffer.Mid(5)); |
332 if (five.IsDigit() && !six.IsDigit()) { |
333 iBuffer.Copy(fix); |
333 TBuf<KMaxStringBuffer> fix; |
334 } |
334 fix.Copy(iBuffer.Left(4)); |
335 // end hack |
335 fix.Append(_L(" 0")); |
336 |
336 fix.Append(iBuffer.Mid(5)); |
337 // hack for feeds that write out months in full |
337 iBuffer.Copy(fix); |
338 |
338 } |
339 if (iBuffer[11] != ' ') { |
339 // end hack |
340 TPtrC midPtr = iBuffer.Mid(8); |
340 } |
341 |
341 |
342 int spacePos = midPtr.Find(_L(" ")); |
342 if (iBuffer.Length() > 11) |
343 |
343 { |
344 if (spacePos != KErrNotFound) { |
344 // hack for feeds that write out months in full |
345 //DP1("Month: %S", &midPtr.Left(spacePos)); |
345 |
|
346 if (iBuffer[11] != ' ') { |
|
347 TPtrC midPtr = iBuffer.Mid(8); |
346 |
348 |
347 TBuf16<KBufferLength> newBuffer; |
349 int spacePos = midPtr.Find(_L(" ")); |
348 newBuffer.Copy(iBuffer.Left(11)); |
350 |
349 newBuffer.Append(_L(" ")); |
351 if (spacePos != KErrNotFound) { |
350 newBuffer.Append(iBuffer.Mid(11+spacePos)); |
352 //DP1("Month: %S", &midPtr.Left(spacePos)); |
351 //DP1("newBuffer: %S", &newBuffer); |
353 |
352 iBuffer.Copy(newBuffer); |
354 TBuf16<KBufferLength> newBuffer; |
353 } |
355 newBuffer.Copy(iBuffer.Left(11)); |
354 } |
356 newBuffer.Append(_L(" ")); |
355 |
357 newBuffer.Append(iBuffer.Mid(11+spacePos)); |
356 // hack for feeds that write days and months as UPPERCASE |
358 //DP1("newBuffer: %S", &newBuffer); |
357 TChar one(iBuffer[1]); |
359 iBuffer.Copy(newBuffer); |
358 TChar two(iBuffer[2]); |
360 } |
359 TChar nine(iBuffer[9]); |
361 } |
360 TChar ten(iBuffer[10]); |
362 |
361 |
363 // hack for feeds that write days and months as UPPERCASE |
362 one.LowerCase(); |
364 TChar one(iBuffer[1]); |
363 two.LowerCase(); |
365 TChar two(iBuffer[2]); |
364 nine.LowerCase(); |
366 TChar nine(iBuffer[9]); |
365 ten.LowerCase(); |
367 TChar ten(iBuffer[10]); |
366 |
368 |
367 iBuffer[1] = one; |
369 one.LowerCase(); |
368 iBuffer[2] = two; |
370 two.LowerCase(); |
369 iBuffer[9] = nine; |
371 nine.LowerCase(); |
370 iBuffer[10] = ten; |
372 ten.LowerCase(); |
371 |
373 |
|
374 iBuffer[1] = one; |
|
375 iBuffer[2] = two; |
|
376 iBuffer[9] = nine; |
|
377 iBuffer[10] = ten; |
|
378 } |
|
379 |
372 TBuf8<128> temp; |
380 TBuf8<128> temp; |
373 temp.Copy(iBuffer); |
381 temp.Copy(iBuffer); |
374 |
|
375 TInternetDate internetDate; |
382 TInternetDate internetDate; |
376 TRAPD(parseError, internetDate.SetDateL(temp)); |
383 TRAPD(parseError, internetDate.SetDateL(temp)); |
377 if(parseError == KErrNone) { |
384 if(parseError == KErrNone) { |
378 //DP1("PubDate parse success: '%S'", &iBuffer); |
385 //DP1("PubDate parse success: '%S'", &iBuffer); |
379 iActiveShow->SetPubDate(TTime(internetDate.DateTime())); |
386 iActiveShow->SetPubDate(TTime(internetDate.DateTime())); |