pushmtm/Plugins/PushContentHandler/CSIContentHandler.cpp
changeset 32 92a061761a7b
parent 0 84ad3b177aa3
equal deleted inserted replaced
31:868cceedabd3 32:92a061761a7b
    26 #include "PushMtmUiDef.h"
    26 #include "PushMtmUiDef.h"
    27 #include "StringResourceReader.h"
    27 #include "StringResourceReader.h"
    28 #include "PushContentHandlerPanic.h"
    28 #include "PushContentHandlerPanic.h"
    29 #include "si_dict.h"
    29 #include "si_dict.h"
    30 #include "PushContentHandlerUtils.h"
    30 #include "PushContentHandlerUtils.h"
    31 #include <CSIPushMsgEntry.h>
    31 #include <push/CSIPushMsgEntry.h>
    32 #include <msvids.h>
    32 #include <msvids.h>
    33 #include <PushMtmUi.rsg>
    33 #include <PushMtmUi.rsg>
    34 #include <nw_dom_node.h>
    34 #include <nw_dom_node.h>
    35 #include <nw_dom_document.h>
    35 #include <nw_dom_document.h>
    36 #include <nw_dom_element.h>
    36 #include <nw_dom_element.h>
   128 // ---------------------------------------------------------
   128 // ---------------------------------------------------------
   129 // CSIContentHandler::CSIContentHandler
   129 // CSIContentHandler::CSIContentHandler
   130 // ---------------------------------------------------------
   130 // ---------------------------------------------------------
   131 //
   131 //
   132 CSIContentHandler::CSIContentHandler()
   132 CSIContentHandler::CSIContentHandler()
   133 :   CPushContentHandlerBase(), 
   133 :   CPushContentHandlerBase(),
   134     iSavedMsgId( KMsvNullIndexEntryId ), 
   134     iSavedMsgId( KMsvNullIndexEntryId ),
   135     iPushMsgAction( KErrNotFound ), 
   135     iPushMsgAction( KErrNotFound ),
   136     iExpiresTime( Time::NullTTime() ), 
   136     iExpiresTime( Time::NullTTime() ),
   137     iCreatedTime( Time::NullTTime() )
   137     iCreatedTime( Time::NullTTime() )
   138 	{
   138 	{
   139 	}
   139 	}
   140 
   140 
   141 // ---------------------------------------------------------
   141 // ---------------------------------------------------------
   185         {
   185         {
   186         PUSHLOG_WRITE("CSIContentHandler::ParsePushMsgL: Empty body")
   186         PUSHLOG_WRITE("CSIContentHandler::ParsePushMsgL: Empty body")
   187         User::Leave( KErrCorrupt );
   187         User::Leave( KErrCorrupt );
   188         }
   188         }
   189 
   189 
   190     // Get content type. It will tell us wheather the msg body is encoded or 
   190     // Get content type. It will tell us wheather the msg body is encoded or
   191     // textual.
   191     // textual.
   192     TPtrC contentType;
   192     TPtrC contentType;
   193 	iMessage->GetContentType( contentType );
   193 	iMessage->GetContentType( contentType );
   194     PUSHLOG_WRITE_FORMAT("CSIContentHandler::ParsePushMsgL: HTTP header - Content type <%S>",&contentType);
   194     PUSHLOG_WRITE_FORMAT("CSIContentHandler::ParsePushMsgL: HTTP header - Content type <%S>",&contentType);
   195 
   195 
   203     PUSHLOG_WRITE_FORMAT(" HTTP header - Content encoding <%S>",&encodingBuf);
   203     PUSHLOG_WRITE_FORMAT(" HTTP header - Content encoding <%S>",&encodingBuf);
   204     #endif // __TEST_LOG__
   204     #endif // __TEST_LOG__
   205     */
   205     */
   206 
   206 
   207     // Add SI dictionary.
   207     // Add SI dictionary.
   208     NW_WBXML_Dictionary_t* dictArray[ KNoOfDictArrays ] = 
   208     NW_WBXML_Dictionary_t* dictArray[ KNoOfDictArrays ] =
   209         { (NW_WBXML_Dictionary_t*)&NW_SI_WBXMLDictionary };
   209         { (NW_WBXML_Dictionary_t*)&NW_SI_WBXMLDictionary };
   210 
   210 
   211     NW_Status_t stat = NW_STAT_SUCCESS;
   211     NW_Status_t stat = NW_STAT_SUCCESS;
   212 
   212 
   213     RWbxmlDictionary wbxmlDict;
   213     RWbxmlDictionary wbxmlDict;
   216 
   216 
   217     NW_TinyDom_Handle_t domHandle;
   217     NW_TinyDom_Handle_t domHandle;
   218     NW_Byte* buffer = (NW_Byte*)bodyPtr.Ptr();
   218     NW_Byte* buffer = (NW_Byte*)bodyPtr.Ptr();
   219     NW_Int32 length = (NW_Int32)bodyPtr.Size();
   219     NW_Int32 length = (NW_Int32)bodyPtr.Size();
   220     // Let's use the content type now.
   220     // Let's use the content type now.
   221     NW_Bool encoded = ( contentType.CompareF( KSiTextContentType ) == 0 ) ? 
   221     NW_Bool encoded = ( contentType.CompareF( KSiTextContentType ) == 0 ) ?
   222                                                          NW_FALSE : NW_TRUE;
   222                                                          NW_FALSE : NW_TRUE;
   223     // SI public identifier.
   223     // SI public identifier.
   224     NW_Uint32 publicID = NW_SI_PublicId;
   224     NW_Uint32 publicID = NW_SI_PublicId;
   225     NW_Bool extTNotStringTable = NW_FALSE;
   225     NW_Bool extTNotStringTable = NW_FALSE;
   226     NW_DOM_NodeType_t type = 0;
   226     NW_DOM_NodeType_t type = 0;
   228     *   Root of DOM
   228     *   Root of DOM
   229     ***********************************/
   229     ***********************************/
   230     CDocumentTreeOwner* docTreeOwner = new (ELeave) CDocumentTreeOwner;
   230     CDocumentTreeOwner* docTreeOwner = new (ELeave) CDocumentTreeOwner;
   231     CleanupStack::PushL( docTreeOwner );
   231     CleanupStack::PushL( docTreeOwner );
   232     NW_DOM_DocumentNode_t* domNode = NW_DOM_DocumentNode_BuildTree
   232     NW_DOM_DocumentNode_t* domNode = NW_DOM_DocumentNode_BuildTree
   233         ( 
   233         (
   234                             &domHandle, 
   234                             &domHandle,
   235                             buffer, 
   235                             buffer,
   236                             length, 
   236                             length,
   237                             encoded, 
   237                             encoded,
   238                             publicID, 
   238                             publicID,
   239                             extTNotStringTable 
   239                             extTNotStringTable
   240         );
   240         );
   241 	if (!domNode)
   241 	if (!domNode)
   242 		{
   242 		{
   243 		PUSHLOG_WRITE("CSIContentHandler::ParsePushMsgL: domNode is Null")
   243 		PUSHLOG_WRITE("CSIContentHandler::ParsePushMsgL: domNode is Null")
   244 		}
   244 		}
   272         PUSHLOG_WRITE("CSIContentHandler::ParsePushMsgL: No SI element present in the dom tree. Message corrupted.")
   272         PUSHLOG_WRITE("CSIContentHandler::ParsePushMsgL: No SI element present in the dom tree. Message corrupted.")
   273         User::Leave( KErrCorrupt );
   273         User::Leave( KErrCorrupt );
   274         }
   274         }
   275 
   275 
   276 	PUSHLOG_WRITE("CSIContentHandler::ParsePushMsgL: before calling getDocumentElement")
   276 	PUSHLOG_WRITE("CSIContentHandler::ParsePushMsgL: before calling getDocumentElement")
   277     NW_DOM_ElementNode_t* siElement = 
   277     NW_DOM_ElementNode_t* siElement =
   278         NW_DOM_DocumentNode_getDocumentElement( domNode );
   278         NW_DOM_DocumentNode_getDocumentElement( domNode );
   279 	PUSHLOG_WRITE("CSIContentHandler::ParsePushMsgL: after calling getDocumentElement")
   279 	PUSHLOG_WRITE("CSIContentHandler::ParsePushMsgL: after calling getDocumentElement")
   280 	if (!siElement)
   280 	if (!siElement)
   281 		{
   281 		{
   282 		PUSHLOG_WRITE("CSIContentHandler::ParsePushMsgL: siElement is Null")
   282 		PUSHLOG_WRITE("CSIContentHandler::ParsePushMsgL: siElement is Null")
   334             stringOwner->SetString( name );
   334             stringOwner->SetString( name );
   335             stat = NW_DOM_Node_getNodeName( node, name );
   335             stat = NW_DOM_Node_getNodeName( node, name );
   336 			PUSHLOG_WRITE_FORMAT("CSIContentHandler::ParsePushMsgL: getNodeName ErrCode: %d", NwxStatusToErrCode( stat ))
   336 			PUSHLOG_WRITE_FORMAT("CSIContentHandler::ParsePushMsgL: getNodeName ErrCode: %d", NwxStatusToErrCode( stat ))
   337             User::LeaveIfError( NwxStatusToErrCode( stat ) );
   337             User::LeaveIfError( NwxStatusToErrCode( stat ) );
   338             NW_Byte*  nameBuf = NW_String_getStorage( name );
   338             NW_Byte*  nameBuf = NW_String_getStorage( name );
   339             NW_Uint16 nameLen = NW_String_getCharCount( name, 
   339             NW_Uint16 nameLen = NW_String_getCharCount( name,
   340                                                         iCharEncoding );
   340                                                         iCharEncoding );
   341             TPtrC8 namePtr( nameBuf, nameLen );
   341             TPtrC8 namePtr( nameBuf, nameLen );
   342 
   342 
   343             if ( type == NW_DOM_ELEMENT_NODE && 
   343             if ( type == NW_DOM_ELEMENT_NODE &&
   344                  namePtr.CompareF( KIndication ) == 0 )
   344                  namePtr.CompareF( KIndication ) == 0 )
   345                 {
   345                 {
   346                 // We found the indication element. Parse it.
   346                 // We found the indication element. Parse it.
   347                 PUSHLOG_WRITE("CSIContentHandler::ParsePushMsgL: indication under si found.")
   347                 PUSHLOG_WRITE("CSIContentHandler::ParsePushMsgL: indication under si found.")
   348                 indicationFound = ETrue;
   348                 indicationFound = ETrue;
   349                 NW_DOM_ElementNode_t* indicationElement = 
   349                 NW_DOM_ElementNode_t* indicationElement =
   350                     REINTERPRET_CAST( NW_DOM_ElementNode_t*, node );
   350                     REINTERPRET_CAST( NW_DOM_ElementNode_t*, node );
   351                 ParseIndicationL( *indicationElement );
   351                 ParseIndicationL( *indicationElement );
   352                 }
   352                 }
   353 
   353 
   354             CleanupStack::PopAndDestroy( stringOwner ); // stringOwner
   354             CleanupStack::PopAndDestroy( stringOwner ); // stringOwner
   414     /**********************************
   414     /**********************************
   415     *   PCDATA of ELEMENT indication
   415     *   PCDATA of ELEMENT indication
   416     ***********************************/
   416     ***********************************/
   417     if ( NW_DOM_Node_hasChildNodes( &aIndication ) )
   417     if ( NW_DOM_Node_hasChildNodes( &aIndication ) )
   418         {
   418         {
   419         NW_DOM_TextNode_t* textNode = 
   419         NW_DOM_TextNode_t* textNode =
   420             NW_DOM_Node_getFirstChild( &aIndication );
   420             NW_DOM_Node_getFirstChild( &aIndication );
   421         User::LeaveIfNull( textNode );
   421         User::LeaveIfNull( textNode );
   422 
   422 
   423         type = NW_DOM_Node_getNodeType( textNode );
   423         type = NW_DOM_Node_getNodeType( textNode );
   424         if ( type != NW_DOM_TEXT_NODE )
   424         if ( type != NW_DOM_TEXT_NODE )
   435 
   435 
   436 // ---------------------------------------------------------
   436 // ---------------------------------------------------------
   437 // CSIContentHandler::ParseIndAttributeL
   437 // CSIContentHandler::ParseIndAttributeL
   438 // ---------------------------------------------------------
   438 // ---------------------------------------------------------
   439 //
   439 //
   440 void CSIContentHandler::ParseIndAttributeL( NW_DOM_AttributeHandle_t& 
   440 void CSIContentHandler::ParseIndAttributeL( NW_DOM_AttributeHandle_t&
   441                                             aAttrHandle )
   441                                             aAttrHandle )
   442 	{
   442 	{
   443     PUSHLOG_ENTERFN("CSIContentHandler::ParseIndAttributeL")
   443     PUSHLOG_ENTERFN("CSIContentHandler::ParseIndAttributeL")
   444 
   444 
   445     NW_Status_t stat = NW_STAT_SUCCESS;
   445     NW_Status_t stat = NW_STAT_SUCCESS;
   490             stat = NW_DOM_AttributeHandle_getValue( &aAttrHandle, val );
   490             stat = NW_DOM_AttributeHandle_getValue( &aAttrHandle, val );
   491             if ( stat != NW_STAT_DOM_NO_STRING_RETURNED )
   491             if ( stat != NW_STAT_DOM_NO_STRING_RETURNED )
   492                 {
   492                 {
   493                 User::LeaveIfError( NwxStatusToErrCode( stat ) );
   493                 User::LeaveIfError( NwxStatusToErrCode( stat ) );
   494                 NW_Byte* storage = NW_String_getStorage( val );
   494                 NW_Byte* storage = NW_String_getStorage( val );
   495                 NW_Uint16 length = NW_String_getCharCount( val, 
   495                 NW_Uint16 length = NW_String_getCharCount( val,
   496                                                            iCharEncoding );
   496                                                            iCharEncoding );
   497                 if ( length == 0 )
   497                 if ( length == 0 )
   498                     {
   498                     {
   499                     // Zero length href attribute is considered as missing.
   499                     // Zero length href attribute is considered as missing.
   500                     PUSHLOG_WRITE(" Zero length HrefFlag");
   500                     PUSHLOG_WRITE(" Zero length HrefFlag");
   572             CleanupStack::PushL( stringOwner );
   572             CleanupStack::PushL( stringOwner );
   573 
   573 
   574             NW_String_t* val = NW_String_new();
   574             NW_String_t* val = NW_String_new();
   575             User::LeaveIfNull( val );
   575             User::LeaveIfNull( val );
   576             stringOwner->SetString( val );
   576             stringOwner->SetString( val );
   577             stat = NW_DOM_AttributeHandle_getValue( &aAttrHandle, val ); 
   577             stat = NW_DOM_AttributeHandle_getValue( &aAttrHandle, val );
   578             User::LeaveIfError( NwxStatusToErrCode( stat ) );
   578             User::LeaveIfError( NwxStatusToErrCode( stat ) );
   579             NW_Byte* storage = NW_String_getStorage( val );
   579             NW_Byte* storage = NW_String_getStorage( val );
   580             NW_Uint16 length = NW_String_getCharCount( val, iCharEncoding );
   580             NW_Uint16 length = NW_String_getCharCount( val, iCharEncoding );
   581             TPtrC8 actionPtr( storage, length );
   581             TPtrC8 actionPtr( storage, length );
   582 
   582 
   587             CleanupStack::PopAndDestroy( stringOwner ); // stringOwner
   587             CleanupStack::PopAndDestroy( stringOwner ); // stringOwner
   588             }
   588             }
   589         }
   589         }
   590     else
   590     else
   591         {
   591         {
   592         __ASSERT_DEBUG( EFalse, 
   592         __ASSERT_DEBUG( EFalse,
   593             ContHandPanic( EPushContHandPanUnexpSiToken ) );
   593             ContHandPanic( EPushContHandPanUnexpSiToken ) );
   594         }
   594         }
   595 
   595 
   596     CleanupStack::PopAndDestroy( stringOwner ); // stringOwner
   596     CleanupStack::PopAndDestroy( stringOwner ); // stringOwner
   597 
   597 
   705             ucs2buffer = HBufC::NewLC( ptr.Length() );
   705             ucs2buffer = HBufC::NewLC( ptr.Length() );
   706             resultOnStack = ETrue;
   706             resultOnStack = ETrue;
   707             }
   707             }
   708         else
   708         else
   709             {
   709             {
   710             __ASSERT_DEBUG( resultOnStack, 
   710             __ASSERT_DEBUG( resultOnStack,
   711                 ContHandPanic( EPushContHandPanSiResNotOnStack ) );
   711                 ContHandPanic( EPushContHandPanSiResNotOnStack ) );
   712             // This may change the address of ucs2buffer so we need to put
   712             // This may change the address of ucs2buffer so we need to put
   713             // it on the cleanup stack again!!
   713             // it on the cleanup stack again!!
   714             ucs2buffer = ucs2buffer->ReAllocL
   714             ucs2buffer = ucs2buffer->ReAllocL
   715                 ( ucs2buffer->Length() + ptr.Length() );
   715                 ( ucs2buffer->Length() + ptr.Length() );
   829 
   829 
   830     // Source
   830     // Source
   831     PUSHLOG_WRITE_FORMAT(" Storage: 0x%x",NW_String_getStorage(&aString));
   831     PUSHLOG_WRITE_FORMAT(" Storage: 0x%x",NW_String_getStorage(&aString));
   832     PUSHLOG_WRITE_FORMAT(" Byte count: %d",NW_String_getByteCount(&aString)-1);
   832     PUSHLOG_WRITE_FORMAT(" Byte count: %d",NW_String_getByteCount(&aString)-1);
   833 
   833 
   834     // We will use NW_String_getByteCount(&aString)-1 as size, because 
   834     // We will use NW_String_getByteCount(&aString)-1 as size, because
   835     // NW_String_getByteCount(&aString) includes NULL terminator.
   835     // NW_String_getByteCount(&aString) includes NULL terminator.
   836     const TPtrC8 src( NW_String_getStorage(&aString), 
   836     const TPtrC8 src( NW_String_getStorage(&aString),
   837                       NW_String_getByteCount(&aString)-1 );
   837                       NW_String_getByteCount(&aString)-1 );
   838     HBufC16* ucs2buffer = ConvertToUnicodeL( src, id );
   838     HBufC16* ucs2buffer = ConvertToUnicodeL( src, id );
   839 
   839 
   840     PUSHLOG_LEAVEFN("CSIContentHandler::ConvertToUnicodeL");
   840     PUSHLOG_LEAVEFN("CSIContentHandler::ConvertToUnicodeL");
   841     return ucs2buffer;
   841     return ucs2buffer;
   850     PUSHLOG_ENTERFN("CSIContentHandler::InitialiseCharacterSetConverterL")
   850     PUSHLOG_ENTERFN("CSIContentHandler::InitialiseCharacterSetConverterL")
   851 
   851 
   852     iCharacterSetConverter = CCnvCharacterSetConverter::NewL();
   852     iCharacterSetConverter = CCnvCharacterSetConverter::NewL();
   853 
   853 
   854     RFs& fs = iMsvSession->FileSession();
   854     RFs& fs = iMsvSession->FileSession();
   855     iCharacterSetsAvailable = 
   855     iCharacterSetsAvailable =
   856         CCnvCharacterSetConverter::CreateArrayOfCharacterSetsAvailableL( fs );
   856         CCnvCharacterSetConverter::CreateArrayOfCharacterSetsAvailableL( fs );
   857 
   857 
   858     PUSHLOG_LEAVEFN("CSIContentHandler::InitialiseCharacterSetConverterL")
   858     PUSHLOG_LEAVEFN("CSIContentHandler::InitialiseCharacterSetConverterL")
   859     }
   859     }
   860 
   860 
   896 
   896 
   897 // ---------------------------------------------------------
   897 // ---------------------------------------------------------
   898 // CSIContentHandler::SetSIPushMsgEntryFieldsL
   898 // CSIContentHandler::SetSIPushMsgEntryFieldsL
   899 // ---------------------------------------------------------
   899 // ---------------------------------------------------------
   900 //
   900 //
   901 void CSIContentHandler::SetSIPushMsgEntryFieldsL( CSIPushMsgEntry& 
   901 void CSIContentHandler::SetSIPushMsgEntryFieldsL( CSIPushMsgEntry&
   902                                                   aSIPushMsgEntry )
   902                                                   aSIPushMsgEntry )
   903 	{
   903 	{
   904     PUSHLOG_ENTERFN("CSIContentHandler::SetSIPushMsgEntryFieldsL")
   904     PUSHLOG_ENTERFN("CSIContentHandler::SetSIPushMsgEntryFieldsL")
   905 
   905 
   906 	if ( SiIdFlag() || HrefFlag() )
   906 	if ( SiIdFlag() || HrefFlag() )
   922             aSIPushMsgEntry.SetIdL( *iSiIdBuf );
   922             aSIPushMsgEntry.SetIdL( *iSiIdBuf );
   923             aSIPushMsgEntry.SetUrlL( *iHrefBuf );
   923             aSIPushMsgEntry.SetUrlL( *iHrefBuf );
   924             }
   924             }
   925 		}
   925 		}
   926 
   926 
   927     __ASSERT_DEBUG( ActionFlag(), 
   927     __ASSERT_DEBUG( ActionFlag(),
   928                     ContHandPanic( EPushContHandPanUnspecSiAction ) );
   928                     ContHandPanic( EPushContHandPanUnspecSiAction ) );
   929 	if ( ActionFlag() )
   929 	if ( ActionFlag() )
   930         {
   930         {
   931 		aSIPushMsgEntry.SetAction( iPushMsgAction );
   931 		aSIPushMsgEntry.SetAction( iPushMsgAction );
   932         }
   932         }
   958 
   958 
   959     // First line in Inbox: TMsvEntry::iDetails.
   959     // First line in Inbox: TMsvEntry::iDetails.
   960     if ( srvAddress.Length() == 0 )
   960     if ( srvAddress.Length() == 0 )
   961         {
   961         {
   962         // Read from resource.
   962         // Read from resource.
   963         HBufC* details = 
   963         HBufC* details =
   964             iStrRscReader->AllocReadResourceLC( R_PUSHMISC_UNK_SENDER );
   964             iStrRscReader->AllocReadResourceLC( R_PUSHMISC_UNK_SENDER );
   965         aSIPushMsgEntry.SetMsgDetailsL( *details );
   965         aSIPushMsgEntry.SetMsgDetailsL( *details );
   966         CleanupStack::PopAndDestroy( details );
   966         CleanupStack::PopAndDestroy( details );
   967         }
   967         }
   968     else
   968     else
   969         {
   969         {
   970         // Convert the "From" information to the format required by the UI 
   970         // Convert the "From" information to the format required by the UI
   971         // spec and then decode it.
   971         // spec and then decode it.
   972         HBufC* details = iWapPushUtils->ConvertDetailsL( srvAddress );
   972         HBufC* details = iWapPushUtils->ConvertDetailsL( srvAddress );
   973         CleanupStack::PushL( details );
   973         CleanupStack::PushL( details );
   974         HBufC* convertedFrom = 
   974         HBufC* convertedFrom =
   975             CPushMtmUtil::ConvertUriToDisplayFormL( *details );
   975             CPushMtmUtil::ConvertUriToDisplayFormL( *details );
   976         CleanupStack::PushL( convertedFrom );
   976         CleanupStack::PushL( convertedFrom );
   977         //
   977         //
   978         aSIPushMsgEntry.SetMsgDetailsL( *convertedFrom );
   978         aSIPushMsgEntry.SetMsgDetailsL( *convertedFrom );
   979         //
   979         //
   987 		aSIPushMsgEntry.SetMsgDescriptionL( *iData );
   987 		aSIPushMsgEntry.SetMsgDescriptionL( *iData );
   988         }
   988         }
   989     else
   989     else
   990         {
   990         {
   991         // Display URL.
   991         // Display URL.
   992         __ASSERT_DEBUG( HrefFlag(), 
   992         __ASSERT_DEBUG( HrefFlag(),
   993                         ContHandPanic( EPushContHandPanUnspecSiHref ) );
   993                         ContHandPanic( EPushContHandPanUnspecSiHref ) );
   994         const TPtrC url = aSIPushMsgEntry.Url();
   994         const TPtrC url = aSIPushMsgEntry.Url();
   995         HBufC* convertedUrl = CPushMtmUtil::ConvertUriToDisplayFormL( url );
   995         HBufC* convertedUrl = CPushMtmUtil::ConvertUriToDisplayFormL( url );
   996         CleanupStack::PushL( convertedUrl );
   996         CleanupStack::PushL( convertedUrl );
   997         //
   997         //
  1001         }
  1001         }
  1002 
  1002 
  1003     // ******** Push MTM specific processing *********
  1003     // ******** Push MTM specific processing *********
  1004 
  1004 
  1005     /*
  1005     /*
  1006     * Unfortunately in CPushMsgEntryBase there is no such functionality 
  1006     * Unfortunately in CPushMsgEntryBase there is no such functionality
  1007     * with which we can reach TMsvEntry as non-const, but we have to 
  1007     * with which we can reach TMsvEntry as non-const, but we have to
  1008     * modify the entry's iMtmData2 member somehow. We can do it 
  1008     * modify the entry's iMtmData2 member somehow. We can do it
  1009     * with either casting or with modifying and saving the entry 
  1009     * with either casting or with modifying and saving the entry
  1010     * manually after it has been saved by CSIPushMsgEntry. The latter 
  1010     * manually after it has been saved by CSIPushMsgEntry. The latter
  1011     * solution is more expensive so we choose the first.
  1011     * solution is more expensive so we choose the first.
  1012     */
  1012     */
  1013     TMsvEntry& tEntry = CONST_CAST( TMsvEntry&, aSIPushMsgEntry.Entry() );
  1013     TMsvEntry& tEntry = CONST_CAST( TMsvEntry&, aSIPushMsgEntry.Entry() );
  1014     if ( HrefFlag() )
  1014     if ( HrefFlag() )
  1015         {
  1015         {
  1036 	{
  1036 	{
  1037     PUSHLOG_ENTERFN("CSIContentHandler::ProcessingPushMsgEntryL")
  1037     PUSHLOG_ENTERFN("CSIContentHandler::ProcessingPushMsgEntryL")
  1038 
  1038 
  1039 	TBool deletePushMsg( EFalse );
  1039 	TBool deletePushMsg( EFalse );
  1040 
  1040 
  1041     __ASSERT_DEBUG( ActionFlag(), 
  1041     __ASSERT_DEBUG( ActionFlag(),
  1042                     ContHandPanic( EPushContHandPanUnspecSiAction ) );
  1042                     ContHandPanic( EPushContHandPanUnspecSiAction ) );
  1043 
  1043 
  1044     // S60 requirement: if both the href and the message is empty then 
  1044     // S60 requirement: if both the href and the message is empty then
  1045     // delete the msg.
  1045     // delete the msg.
  1046     if ( HrefFlag() == EFalse && DataFlag() == EFalse )
  1046     if ( HrefFlag() == EFalse && DataFlag() == EFalse )
  1047         {
  1047         {
  1048         deletePushMsg = ETrue;
  1048         deletePushMsg = ETrue;
  1049         }
  1049         }
  1073             PUSHLOG_WRITE("CSIContentHandler already expired")
  1073             PUSHLOG_WRITE("CSIContentHandler already expired")
  1074 		    deletePushMsg = ETrue;
  1074 		    deletePushMsg = ETrue;
  1075 		    }
  1075 		    }
  1076         }
  1076         }
  1077 
  1077 
  1078 	// An SI with the action attribute set to “delete” MUST have an 
  1078 	// An SI with the action attribute set to “delete” MUST have an
  1079     // explicitly assigned value for si-id.
  1079     // explicitly assigned value for si-id.
  1080 	if ( !deletePushMsg && ActionFlag() )
  1080 	if ( !deletePushMsg && ActionFlag() )
  1081 		{
  1081 		{
  1082 		if ( iPushMsgAction == CSIPushMsgEntry::ESIPushMsgDelete )
  1082 		if ( iPushMsgAction == CSIPushMsgEntry::ESIPushMsgDelete )
  1083             {
  1083             {
  1097         }
  1097         }
  1098 
  1098 
  1099     if ( !deletePushMsg && ActionFlag() )
  1099     if ( !deletePushMsg && ActionFlag() )
  1100         {
  1100         {
  1101         // SI with action=signal-none must not be presented to the end-user.
  1101         // SI with action=signal-none must not be presented to the end-user.
  1102         // Note. In S60 signal-none behaves the same as delete: the 
  1102         // Note. In S60 signal-none behaves the same as delete: the
  1103         // message is discarded after processing it!
  1103         // message is discarded after processing it!
  1104         if ( iPushMsgAction == CSIPushMsgEntry::ESIPushMsgSignalNone )
  1104         if ( iPushMsgAction == CSIPushMsgEntry::ESIPushMsgSignalNone )
  1105             {
  1105             {
  1106             deletePushMsg = ETrue;
  1106             deletePushMsg = ETrue;
  1107             }
  1107             }
  1117         {
  1117         {
  1118 		StoreSIMessageL( matchingEntryId );
  1118 		StoreSIMessageL( matchingEntryId );
  1119         }
  1119         }
  1120     else
  1120     else
  1121         {
  1121         {
  1122         // The new entry must be discarded. 
  1122         // The new entry must be discarded.
  1123         // Delete the corresponding matching entry, too.
  1123         // Delete the corresponding matching entry, too.
  1124         if ( matchingEntryId != KMsvNullIndexEntryId )
  1124         if ( matchingEntryId != KMsvNullIndexEntryId )
  1125             {
  1125             {
  1126             iWapPushUtils->DeleteEntryL( matchingEntryId );
  1126             iWapPushUtils->DeleteEntryL( matchingEntryId );
  1127             }
  1127             }
  1148     {
  1148     {
  1149        PUSHLOG_WRITE("Matching SI found");
  1149        PUSHLOG_WRITE("Matching SI found");
  1150        //Delete this old entry
  1150        //Delete this old entry
  1151        iWapPushUtils->DeleteEntryL( aMatchingEntryId );
  1151        iWapPushUtils->DeleteEntryL( aMatchingEntryId );
  1152     }
  1152     }
  1153    
  1153 
  1154     SetSIPushMsgEntryFieldsL( *siEntry );
  1154     SetSIPushMsgEntryFieldsL( *siEntry );
  1155     iSavedMsgId = siEntry->SaveL( *iMsvSession, KMsvGlobalInBoxIndexEntryId );
  1155     iSavedMsgId = siEntry->SaveL( *iMsvSession, KMsvGlobalInBoxIndexEntryId );
  1156 
  1156 
  1157 #ifdef __TEST_LOG__
  1157 #ifdef __TEST_LOG__
  1158         _LIT( KDateFormat, "%E%D%X%N%Y %1 %2 %3" );
  1158         _LIT( KDateFormat, "%E%D%X%N%Y %1 %2 %3" );
  1177 //
  1177 //
  1178 TBool CSIContentHandler::HandleMsgOrderReceptionL( TMsvId& aMatchingEntryId )
  1178 TBool CSIContentHandler::HandleMsgOrderReceptionL( TMsvId& aMatchingEntryId )
  1179 	{
  1179 	{
  1180     PUSHLOG_ENTERFN("CSIContentHandler::HandleMsgOrderReceptionL")
  1180     PUSHLOG_ENTERFN("CSIContentHandler::HandleMsgOrderReceptionL")
  1181 
  1181 
  1182     __ASSERT_DEBUG( ( SiIdFlag() || HrefFlag() ), 
  1182     __ASSERT_DEBUG( ( SiIdFlag() || HrefFlag() ),
  1183             ContHandPanic( EPushContHandPanNoSiIdOrHrefAttr ) );
  1183             ContHandPanic( EPushContHandPanNoSiIdOrHrefAttr ) );
  1184     __ASSERT_DEBUG( CreatedFlag(), 
  1184     __ASSERT_DEBUG( CreatedFlag(),
  1185             ContHandPanic( EPushContHandPanNoCreatedAttr ) );
  1185             ContHandPanic( EPushContHandPanNoCreatedAttr ) );
  1186 
  1186 
  1187     CMsvEntrySelection* matchingIdList = NULL;
  1187     CMsvEntrySelection* matchingIdList = NULL;
  1188 	TBool discardPushMsg( EFalse );
  1188 	TBool discardPushMsg( EFalse );
  1189 
  1189 
  1205 	if ( 0 < matchingListCount && CreatedFlag() )
  1205 	if ( 0 < matchingListCount && CreatedFlag() )
  1206 		{
  1206 		{
  1207 		CSIPushMsgEntry* siEntry = CSIPushMsgEntry::NewL();
  1207 		CSIPushMsgEntry* siEntry = CSIPushMsgEntry::NewL();
  1208 		CleanupStack::PushL( siEntry );
  1208 		CleanupStack::PushL( siEntry );
  1209 
  1209 
  1210 		// Delete older stored messages and/or mark current message for 
  1210 		// Delete older stored messages and/or mark current message for
  1211         // deletion if same date or older than stored messages
  1211         // deletion if same date or older than stored messages
  1212         TBool foundOneToBeReplaced = EFalse;
  1212         TBool foundOneToBeReplaced = EFalse;
  1213 		for ( TInt count = 0; count < matchingListCount; ++count )
  1213 		for ( TInt count = 0; count < matchingListCount; ++count )
  1214 			{
  1214 			{
  1215 			TMsvId matchingSiMsgEntryId( matchingIdList->At(count) );
  1215 			TMsvId matchingSiMsgEntryId( matchingIdList->At(count) );
  1216 
  1216 
  1217             siEntry->RetrieveL( *iMsvSession, matchingSiMsgEntryId );
  1217             siEntry->RetrieveL( *iMsvSession, matchingSiMsgEntryId );
  1218 
  1218 
  1219 			// Skip date comparisons if creation date not valid - 
  1219 			// Skip date comparisons if creation date not valid -
  1220             // SI without created attribute never gets replaced.
  1220             // SI without created attribute never gets replaced.
  1221 			TTime existingSiCreatedTime( siEntry->Created() );
  1221 			TTime existingSiCreatedTime( siEntry->Created() );
  1222 
  1222 
  1223 			if ( existingSiCreatedTime == Time::NullTTime() )
  1223 			if ( existingSiCreatedTime == Time::NullTTime() )
  1224                 {
  1224                 {
  1225 				// continue;
  1225 				// continue;
  1226                 }
  1226                 }
  1227             else
  1227             else
  1228                 {
  1228                 {
  1229                 __ASSERT_DEBUG( !foundOneToBeReplaced, 
  1229                 __ASSERT_DEBUG( !foundOneToBeReplaced,
  1230                                 ContHandPanic( EPushContHandPanTooManySi ) );
  1230                                 ContHandPanic( EPushContHandPanTooManySi ) );
  1231                 if ( foundOneToBeReplaced )
  1231                 if ( foundOneToBeReplaced )
  1232                     {
  1232                     {
  1233                     PUSHLOG_WRITE(" Already found one")
  1233                     PUSHLOG_WRITE(" Already found one")
  1234                     // Only one SI has to be found.
  1234                     // Only one SI has to be found.
  1235                     // If the program runs into it, then make a 
  1235                     // If the program runs into it, then make a
  1236                     // garbage collection to ensure consistency and 
  1236                     // garbage collection to ensure consistency and
  1237                     // remove other messages found.
  1237                     // remove other messages found.
  1238                     iWapPushUtils->DeleteEntryL( matchingSiMsgEntryId );
  1238                     iWapPushUtils->DeleteEntryL( matchingSiMsgEntryId );
  1239                     // After the 'for' only one SI is allowed that has created 
  1239                     // After the 'for' only one SI is allowed that has created
  1240                     // attribute.
  1240                     // attribute.
  1241                     }
  1241                     }
  1242                 else
  1242                 else
  1243                     {
  1243                     {
  1244                     foundOneToBeReplaced = ETrue; // A match was found.
  1244                     foundOneToBeReplaced = ETrue; // A match was found.
  1245                     // Check if received SI is newer than existing stored Si 
  1245                     // Check if received SI is newer than existing stored Si
  1246                     // (out of order).
  1246                     // (out of order).
  1247                     if ( iCreatedTime > existingSiCreatedTime ) 
  1247                     if ( iCreatedTime > existingSiCreatedTime )
  1248 	                    {
  1248 	                    {
  1249                         PUSHLOG_WRITE(" Replacing...")
  1249                         PUSHLOG_WRITE(" Replacing...")
  1250                         // The new SI replaces the existing.
  1250                         // The new SI replaces the existing.
  1251                         aMatchingEntryId = matchingSiMsgEntryId;
  1251                         aMatchingEntryId = matchingSiMsgEntryId;
  1252                         discardPushMsg = EFalse;
  1252                         discardPushMsg = EFalse;
  1261                 }
  1261                 }
  1262 			}
  1262 			}
  1263 
  1263 
  1264 		CleanupStack::PopAndDestroy( siEntry ); // siEntry
  1264 		CleanupStack::PopAndDestroy( siEntry ); // siEntry
  1265 		}
  1265 		}
  1266 		
  1266 
  1267 	CleanupStack::PopAndDestroy( matchingIdList ); // matchingIdList
  1267 	CleanupStack::PopAndDestroy( matchingIdList ); // matchingIdList
  1268 
  1268 
  1269     PUSHLOG_LEAVEFN("CSIContentHandler::HandleMsgOrderReceptionL")
  1269     PUSHLOG_LEAVEFN("CSIContentHandler::HandleMsgOrderReceptionL")
  1270     return discardPushMsg;
  1270     return discardPushMsg;
  1271 	}
  1271 	}
  1272 
  1272 
  1273 // ---------------------------------------------------------
  1273 // ---------------------------------------------------------
  1274 // CSIContentHandler::ConvertDateTimeL
  1274 // CSIContentHandler::ConvertDateTimeL
  1275 // ---------------------------------------------------------
  1275 // ---------------------------------------------------------
  1276 //
  1276 //
  1277 TBool CSIContentHandler::ConvertDateTimeL( const TDesC& aDateTime, 
  1277 TBool CSIContentHandler::ConvertDateTimeL( const TDesC& aDateTime,
  1278                                            TTime& aConvertedDate ) const
  1278                                            TTime& aConvertedDate ) const
  1279 	{
  1279 	{
  1280     PUSHLOG_ENTERFN("CSIContentHandler::ConvertDateTimeL")
  1280     PUSHLOG_ENTERFN("CSIContentHandler::ConvertDateTimeL")
  1281 
  1281 
  1282 	TTime convertedTime = Time::NullTTime();
  1282 	TTime convertedTime = Time::NullTTime();
  1299             User::Leave( KErrCorrupt );
  1299             User::Leave( KErrCorrupt );
  1300             }
  1300             }
  1301         else
  1301         else
  1302 			{
  1302 			{
  1303             // Now 'str' is in format YYYYMMDD:HHMMSS
  1303             // Now 'str' is in format YYYYMMDD:HHMMSS
  1304 			// Adjust UTC time to zero offset TTime. Only month and day 
  1304 			// Adjust UTC time to zero offset TTime. Only month and day
  1305             // is effected.
  1305             // is effected.
  1306 			const TInt KFirstMonthChar = KValidTTimeMonthStart;
  1306 			const TInt KFirstMonthChar = KValidTTimeMonthStart;
  1307 			const TInt KSecondMonthChar = KFirstMonthChar + 1;
  1307 			const TInt KSecondMonthChar = KFirstMonthChar + 1;
  1308 			const TInt KFirstDayChar = KValidTTimeDayStart;
  1308 			const TInt KFirstDayChar = KValidTTimeDayStart;
  1309 			const TInt KSecondDayChar = KFirstDayChar + 1;
  1309 			const TInt KSecondDayChar = KFirstDayChar + 1;
  1334 				// day value is between 1 and 9 so reduce day by one
  1334 				// day value is between 1 and 9 so reduce day by one
  1335 				// eg 29 becomes 28, 11 bcomes 10, 31 becomes 30
  1335 				// eg 29 becomes 28, 11 bcomes 10, 31 becomes 30
  1336 				str[KSecondDayChar]--;
  1336 				str[KSecondDayChar]--;
  1337                 }
  1337                 }
  1338 
  1338 
  1339 			// string is now syntaxically correct, but Set() will return an 
  1339 			// string is now syntaxically correct, but Set() will return an
  1340             // error if it's semantically incorrect.
  1340             // error if it's semantically incorrect.
  1341             User::LeaveIfError( convertedTime.Set( str ) );
  1341             User::LeaveIfError( convertedTime.Set( str ) );
  1342 			convertedOK = ETrue;
  1342 			convertedOK = ETrue;
  1343 			}
  1343 			}
  1344 		}
  1344 		}
  1385             }
  1385             }
  1386         convertedPtr.Append( TChar(KAsciiZeroCharCode + high) );
  1386         convertedPtr.Append( TChar(KAsciiZeroCharCode + high) );
  1387         convertedPtr.Append( TChar(KAsciiZeroCharCode + low) );
  1387         convertedPtr.Append( TChar(KAsciiZeroCharCode + low) );
  1388         }
  1388         }
  1389 
  1389 
  1390     // A valid UTC %Datetime contains 14 numerical characters and 6 
  1390     // A valid UTC %Datetime contains 14 numerical characters and 6
  1391     // non-numerical: “1999-04-30T06:40:00Z”.
  1391     // non-numerical: “1999-04-30T06:40:00Z”.
  1392     // So fill the remaining bytes with zeros.
  1392     // So fill the remaining bytes with zeros.
  1393     for ( i = convertedPtr.Length(); i < KValidUTCNumericals; ++i )
  1393     for ( i = convertedPtr.Length(); i < KValidUTCNumericals; ++i )
  1394         {
  1394         {
  1395         convertedPtr.Append( TChar('0') );
  1395         convertedPtr.Append( TChar('0') );
  1441         }
  1441         }
  1442     else
  1442     else
  1443         {
  1443         {
  1444 	    // strip out formatting characters
  1444 	    // strip out formatting characters
  1445 	    TInt formatCharPos = 4;
  1445 	    TInt formatCharPos = 4;
  1446 	    aDateTime.Delete( formatCharPos, 1 ); 
  1446 	    aDateTime.Delete( formatCharPos, 1 );
  1447 	    // now move through two characters at a time and remove other chars 
  1447 	    // now move through two characters at a time and remove other chars
  1448 	    // to just leave digits
  1448 	    // to just leave digits
  1449 	    const TInt KRemainingFormatChars = 5;
  1449 	    const TInt KRemainingFormatChars = 5;
  1450         TInt i( 0 );
  1450         TInt i( 0 );
  1451 	    for ( i = 0; i < KRemainingFormatChars; ++i )
  1451 	    for ( i = 0; i < KRemainingFormatChars; ++i )
  1452 		    {
  1452 		    {
  1454 		    aDateTime.Delete( formatCharPos, 1 );
  1454 		    aDateTime.Delete( formatCharPos, 1 );
  1455 		    }
  1455 		    }
  1456 
  1456 
  1457         // Now aDateTime has to be in format YYYYMMDDHHMMSS
  1457         // Now aDateTime has to be in format YYYYMMDDHHMMSS
  1458 
  1458 
  1459         __ASSERT_DEBUG( aDateTime.Length() == KValidTTimeLength, 
  1459         __ASSERT_DEBUG( aDateTime.Length() == KValidTTimeLength,
  1460                         ContHandPanic( EPushContHandPanBadTTimeLength ) );
  1460                         ContHandPanic( EPushContHandPanBadTTimeLength ) );
  1461 
  1461 
  1462         // now have UTC string stripped of format characters - check remaining 
  1462         // now have UTC string stripped of format characters - check remaining
  1463         // characters are all digits - YYYYMMDDHHMMSS
  1463         // characters are all digits - YYYYMMDDHHMMSS
  1464         TChar ch;
  1464         TChar ch;
  1465         for ( i = 0; i < KValidTTimeLength; ++i )
  1465         for ( i = 0; i < KValidTTimeLength; ++i )
  1466 		    {
  1466 		    {
  1467 		    ch = aDateTime[i];
  1467 		    ch = aDateTime[i];
  1472                 }
  1472                 }
  1473 		    }
  1473 		    }
  1474 
  1474 
  1475         if ( isValid )
  1475         if ( isValid )
  1476             {
  1476             {
  1477             /* 
  1477             /*
  1478             In YYYYMMDDHHMMSS
  1478             In YYYYMMDDHHMMSS
  1479             YYYY = 4 digit year ("0000" ... "9999")
  1479             YYYY = 4 digit year ("0000" ... "9999")
  1480             MM = 2 digit month ("01"=January, "02"=February ... "12"=December)
  1480             MM = 2 digit month ("01"=January, "02"=February ... "12"=December)
  1481             DD = 2 digit day ("01", "02" ... "31")
  1481             DD = 2 digit day ("01", "02" ... "31")
  1482             HH = 2 digit hour, 24-hour timekeeping system ("00" ... "23")
  1482             HH = 2 digit hour, 24-hour timekeeping system ("00" ... "23")
  1485             */
  1485             */
  1486             TInt err;
  1486             TInt err;
  1487             TUint val;
  1487             TUint val;
  1488             // Do not check year. There are no restrictions.
  1488             // Do not check year. There are no restrictions.
  1489             // Check month.
  1489             // Check month.
  1490             TLex parser( aDateTime.Mid( KValidTTimeMonthStart, 
  1490             TLex parser( aDateTime.Mid( KValidTTimeMonthStart,
  1491                                         KValidTTimeBlockLength ) );
  1491                                         KValidTTimeBlockLength ) );
  1492             err = parser.Val( val, EDecimal );
  1492             err = parser.Val( val, EDecimal );
  1493             if ( err )
  1493             if ( err )
  1494                 {
  1494                 {
  1495                 isValid = EFalse;
  1495                 isValid = EFalse;
  1504                     }
  1504                     }
  1505                 }
  1505                 }
  1506             // Check day.
  1506             // Check day.
  1507             if ( isValid )
  1507             if ( isValid )
  1508                 {
  1508                 {
  1509                 parser = aDateTime.Mid( KValidTTimeDayStart, 
  1509                 parser = aDateTime.Mid( KValidTTimeDayStart,
  1510                                         KValidTTimeBlockLength );
  1510                                         KValidTTimeBlockLength );
  1511                 err = parser.Val( val, EDecimal );
  1511                 err = parser.Val( val, EDecimal );
  1512                 if ( err )
  1512                 if ( err )
  1513                     {
  1513                     {
  1514                     isValid = EFalse;
  1514                     isValid = EFalse;
  1524                     }
  1524                     }
  1525                 }
  1525                 }
  1526             // Check hour.
  1526             // Check hour.
  1527             if ( isValid )
  1527             if ( isValid )
  1528                 {
  1528                 {
  1529                 parser = aDateTime.Mid( KValidTTimeHourStart, 
  1529                 parser = aDateTime.Mid( KValidTTimeHourStart,
  1530                                         KValidTTimeBlockLength );
  1530                                         KValidTTimeBlockLength );
  1531                 err = parser.Val( val, EDecimal );
  1531                 err = parser.Val( val, EDecimal );
  1532                 if ( err )
  1532                 if ( err )
  1533                     {
  1533                     {
  1534                     isValid = EFalse;
  1534                     isValid = EFalse;
  1544                     }
  1544                     }
  1545                 }
  1545                 }
  1546             // Check minute.
  1546             // Check minute.
  1547             if ( isValid )
  1547             if ( isValid )
  1548                 {
  1548                 {
  1549                 parser = aDateTime.Mid( KValidTTimeMinuteStart, 
  1549                 parser = aDateTime.Mid( KValidTTimeMinuteStart,
  1550                                         KValidTTimeBlockLength );
  1550                                         KValidTTimeBlockLength );
  1551                 err = parser.Val( val, EDecimal );
  1551                 err = parser.Val( val, EDecimal );
  1552                 if ( err )
  1552                 if ( err )
  1553                     {
  1553                     {
  1554                     isValid = EFalse;
  1554                     isValid = EFalse;
  1564                     }
  1564                     }
  1565                 }
  1565                 }
  1566             // Check second.
  1566             // Check second.
  1567             if ( isValid )
  1567             if ( isValid )
  1568                 {
  1568                 {
  1569                 parser = aDateTime.Mid( KValidTTimeSecondStart, 
  1569                 parser = aDateTime.Mid( KValidTTimeSecondStart,
  1570                                         KValidTTimeBlockLength );
  1570                                         KValidTTimeBlockLength );
  1571                 err = parser.Val( val, EDecimal );
  1571                 err = parser.Val( val, EDecimal );
  1572                 if ( err )
  1572                 if ( err )
  1573                     {
  1573                     {
  1574                     isValid = EFalse;
  1574                     isValid = EFalse;
  1599 // ---------------------------------------------------------
  1599 // ---------------------------------------------------------
  1600 // CSIContentHandler::AttributeToTTimeL
  1600 // CSIContentHandler::AttributeToTTimeL
  1601 // ---------------------------------------------------------
  1601 // ---------------------------------------------------------
  1602 //
  1602 //
  1603 TBool CSIContentHandler::AttributeToTTimeL
  1603 TBool CSIContentHandler::AttributeToTTimeL
  1604                         ( NW_DOM_AttributeHandle_t& aAttrHandle, 
  1604                         ( NW_DOM_AttributeHandle_t& aAttrHandle,
  1605                           TTime& aConvertedDate ) const
  1605                           TTime& aConvertedDate ) const
  1606     {
  1606     {
  1607     PUSHLOG_ENTERFN("CSIContentHandler::AttributeToTTimeL")
  1607     PUSHLOG_ENTERFN("CSIContentHandler::AttributeToTTimeL")
  1608 
  1608 
  1609     TBool gotDate = EFalse;
  1609     TBool gotDate = EFalse;
  1638             TPtrC8 dataPtr( storage, length );
  1638             TPtrC8 dataPtr( storage, length );
  1639             HBufC* dataBuf = HBufC::NewMaxLC( dataPtr.Length() );
  1639             HBufC* dataBuf = HBufC::NewMaxLC( dataPtr.Length() );
  1640             dataBuf->Des().Copy( dataPtr );
  1640             dataBuf->Des().Copy( dataPtr );
  1641             gotDate = ConvertDateTimeL( *dataBuf, aConvertedDate );
  1641             gotDate = ConvertDateTimeL( *dataBuf, aConvertedDate );
  1642 
  1642 
  1643             CleanupStack::PopAndDestroy( 2, stringOwner ); // dataBuf, 
  1643             CleanupStack::PopAndDestroy( 2, stringOwner ); // dataBuf,
  1644                                                            // stringOwner
  1644                                                            // stringOwner
  1645             }
  1645             }
  1646         else if ( valType == NW_DOM_ATTR_VAL_OPAQUE )
  1646         else if ( valType == NW_DOM_ATTR_VAL_OPAQUE )
  1647             {
  1647             {
  1648             NW_Uint32 len = 0;
  1648             NW_Uint32 len = 0;
  1667 
  1667 
  1668 // ---------------------------------------------------------
  1668 // ---------------------------------------------------------
  1669 // CSIContentHandler::HandleMessageL
  1669 // CSIContentHandler::HandleMessageL
  1670 // ---------------------------------------------------------
  1670 // ---------------------------------------------------------
  1671 //
  1671 //
  1672 void CSIContentHandler::HandleMessageL( CPushMessage* aPushMsg, 
  1672 void CSIContentHandler::HandleMessageL( CPushMessage* aPushMsg,
  1673                                         TRequestStatus& aStatus )
  1673                                         TRequestStatus& aStatus )
  1674 	{
  1674 	{
  1675     PUSHLOG_ENTERFN("CSIContentHandler::HandleMessageL")
  1675     PUSHLOG_ENTERFN("CSIContentHandler::HandleMessageL")
  1676 
  1676 
  1677     __ASSERT_DEBUG( aPushMsg != NULL, 
  1677     __ASSERT_DEBUG( aPushMsg != NULL,
  1678                     ContHandPanic( EPushContHandPanMsgNull ) );
  1678                     ContHandPanic( EPushContHandPanMsgNull ) );
  1679 
  1679 
  1680 #ifdef __TEST_LOG__
  1680 #ifdef __TEST_LOG__
  1681     TPtrC8 bodyPtr;
  1681     TPtrC8 bodyPtr;
  1682     aPushMsg->GetMessageBody( bodyPtr );
  1682     aPushMsg->GetMessageBody( bodyPtr );
  1699 //
  1699 //
  1700 void CSIContentHandler::HandleMessageL( CPushMessage* aPushMsg )
  1700 void CSIContentHandler::HandleMessageL( CPushMessage* aPushMsg )
  1701 	{
  1701 	{
  1702     PUSHLOG_ENTERFN("CSIContentHandler::HandleMessageL")
  1702     PUSHLOG_ENTERFN("CSIContentHandler::HandleMessageL")
  1703 
  1703 
  1704     __ASSERT_DEBUG( aPushMsg != NULL, 
  1704     __ASSERT_DEBUG( aPushMsg != NULL,
  1705                     ContHandPanic( EPushContHandPanMsgNull ) );
  1705                     ContHandPanic( EPushContHandPanMsgNull ) );
  1706 
  1706 
  1707 #ifdef __TEST_LOG__
  1707 #ifdef __TEST_LOG__
  1708     TPtrC8 bodyPtr;
  1708     TPtrC8 bodyPtr;
  1709     aPushMsg->GetMessageBody( bodyPtr );
  1709     aPushMsg->GetMessageBody( bodyPtr );