63 _LIT8( KMessagesWaiting8, "messages-waiting" ); |
63 _LIT8( KMessagesWaiting8, "messages-waiting" ); |
64 _LIT8( KNewMessages8, "yes" ); |
64 _LIT8( KNewMessages8, "yes" ); |
65 _LIT8( KMessageAccount8, "message-account" ); |
65 _LIT8( KMessageAccount8, "message-account" ); |
66 _LIT8( KVoiceMessage8, "voice-message" ); |
66 _LIT8( KVoiceMessage8, "voice-message" ); |
67 _LIT8( KSlash8, "/" ); |
67 _LIT8( KSlash8, "/" ); |
68 _LIT8( KLParen8, "(" ); |
|
69 _LIT8( KRParen8, ")" ); |
|
70 _LIT8( KColon8, ":" ); |
68 _LIT8( KColon8, ":" ); |
71 _LIT8( KCrlf8, "\r\n" ); |
69 _LIT8( KCrlf8, "\r\n" ); |
72 _LIT8( KEndLine8, "\n" ); |
70 _LIT8( KEndLine8, "\n" ); |
73 _LIT8( KHTab8, "\t"); |
71 _LIT8( KHTab8, "\t"); |
74 _LIT8( KSpace8, " "); |
72 _LIT8( KSpace8, " "); |
193 ESubPropertyVMBXMWIAddress, |
191 ESubPropertyVMBXMWIAddress, |
194 *mwiAddress ) ); |
192 *mwiAddress ) ); |
195 User::LeaveIfError( mwiAddress->GetValue( ptrvoiceMailUri16 ) ); |
193 User::LeaveIfError( mwiAddress->GetValue( ptrvoiceMailUri16 ) ); |
196 if ( ptrvoiceMailUri16.Length() < KMinIpVoiceMailBoxUriLength ) |
194 if ( ptrvoiceMailUri16.Length() < KMinIpVoiceMailBoxUriLength ) |
197 { |
195 { |
|
196 IPVMEPRINT( "CIpVmbxEngine::SubscribeProfileL - MWI not found, Leaving..." ); |
198 User::Leave( KErrNotFound ); |
197 User::Leave( KErrNotFound ); |
199 } |
198 } |
200 IPVMEPRINT( "CIpVmbxEngine::MWI found" ); |
199 IPVMEPRINT( "CIpVmbxEngine::SubscribeProfileL - MWI found" ); |
201 if ( KErrNotFound == ptrvoiceMailUri16.Find( KSipString ) ) |
200 if ( KErrNotFound == ptrvoiceMailUri16.Find( KSipString ) ) |
202 { |
201 { |
203 ptrvoiceMailUri16.Insert( 0, KSipString ); |
202 ptrvoiceMailUri16.Insert( 0, KSipString ); |
204 } |
203 } |
205 CleanupStack::PopAndDestroy( mwiAddress ); |
204 CleanupStack::PopAndDestroy( mwiAddress ); |
358 |
357 |
359 if ( ptrNewMessages8 == KNoMessages ) |
358 if ( ptrNewMessages8 == KNoMessages ) |
360 { |
359 { |
361 // protocol test fix, new message should not be created |
360 // protocol test fix, new message should not be created |
362 // if new message count is 0 |
361 // if new message count is 0 |
|
362 IPVMEPRINT( "CIpVmbxEngine::EventReceivedL - No new messages" ); |
363 createSMS = EFalse; |
363 createSMS = EFalse; |
364 } |
364 } |
365 if ( 0 == ptrFrom8.Length() ) |
365 if ( 0 == ptrFrom8.Length() ) |
366 { |
366 { |
367 ptrFrom8 = subscription->VmbxUrl(); |
367 ptrFrom8 = subscription->VmbxUrl(); |
386 |
386 |
387 TBool statusChanged = EFalse; |
387 TBool statusChanged = EFalse; |
388 if ( totalMsgs != curTotal || newMsgs != curNew ) |
388 if ( totalMsgs != curTotal || newMsgs != curNew ) |
389 { |
389 { |
390 statusChanged = ETrue; |
390 statusChanged = ETrue; |
|
391 IPVMEPRINT( "CIpVmbxEngine::EventReceivedL - Status changed" ); |
391 subscription->SetAccountMessageCount( totalMsgs, newMsgs ); |
392 subscription->SetAccountMessageCount( totalMsgs, newMsgs ); |
392 } |
393 } |
393 |
394 |
394 if ( createSMS && statusChanged ) |
395 if ( createSMS && statusChanged ) |
395 { |
396 { |
|
397 IPVMEPRINT( "CIpVmbxEngine::EventReceivedL - Create message body" ); |
396 TBuf8< KSmsLength > messageBody8; |
398 TBuf8< KSmsLength > messageBody8; |
397 CreateMessageBodyL( |
399 CreateMessageBodyL( |
398 *content8, |
400 *content8, |
399 ptrTotalMessages8, |
401 ptrTotalMessages8, |
400 ptrNewMessages8, |
402 ptrNewMessages8, |
608 TDes8& aContent8, |
610 TDes8& aContent8, |
609 TDes8& aTotalMessages8, |
611 TDes8& aTotalMessages8, |
610 TDes8& aNewMessages8, |
612 TDes8& aNewMessages8, |
611 TDes8& aFrom8 ) const |
613 TDes8& aFrom8 ) const |
612 { |
614 { |
613 IPVMEPRINT( "CIpVmbxEngine::ParseNotifyContentL - IN" ); |
615 #ifdef _DEBUG |
|
616 TBuf<128> tmpStr; |
|
617 tmpStr.Copy( aContent8 ); |
|
618 IPVMEPRINT2( "CIpVmbxEngine::ParseNotifyContentL - aContent8:%S", &tmpStr ) |
|
619 #endif // _DEBUG |
614 aCreateSms = EFalse; |
620 aCreateSms = EFalse; |
615 |
621 |
616 // check required content |
622 // check required content |
617 TLex8 analyzer8; |
623 TLex8 analyzer8; |
618 TPtrC8 posPtr8; |
624 TPtrC8 posPtr8; |
640 posPtr8.Set( aContent8.Mid( messagePtr8.Length() ) ); |
646 posPtr8.Set( aContent8.Mid( messagePtr8.Length() ) ); |
641 analyzer8.Assign( posPtr8 ); |
647 analyzer8.Assign( posPtr8 ); |
642 } |
648 } |
643 else |
649 else |
644 { |
650 { |
|
651 IPVMEPRINT( "CIpVmbxEngine::ParseNotifyContentL - leave with KErrCorrupt" ); |
645 // malformed critical part of message |
652 // malformed critical part of message |
646 User::Leave( KErrCorrupt ); |
653 User::Leave( KErrCorrupt ); |
647 } |
654 } |
648 |
655 |
649 if ( KErrNotFound != atPosAccount && KErrNotFound != atPosMessage ) |
656 if ( KErrNotFound != atPosAccount && KErrNotFound != atPosMessage ) |
650 { |
657 { |
651 // both optionals found |
658 // both optionals found |
652 if ( !( atPosAccount < atPosMessage ) ) |
659 if ( !( atPosAccount < atPosMessage ) ) |
653 { |
660 { |
|
661 IPVMEPRINT( "CIpVmbxEngine::ParseNotifyContentL - leave with KErrCorrupt 2" ); |
654 // incorrect format |
662 // incorrect format |
655 User::Leave( KErrCorrupt ); |
663 User::Leave( KErrCorrupt ); |
656 } |
664 } |
657 } |
665 } |
658 |
666 |
659 if ( KErrNotFound != atPosAccount && aCreateSms ) |
667 if ( KErrNotFound != atPosAccount && aCreateSms ) |
660 { |
668 { |
661 // get account |
669 // get account |
|
670 IPVMEPRINT( "CIpVmbxEngine::ParseNotifyContentL - get account" ); |
662 messagePtr8.Set( FetchMessagePartL( posPtr8 ) ); |
671 messagePtr8.Set( FetchMessagePartL( posPtr8 ) ); |
663 analyzer8.Assign( |
672 analyzer8.Assign( |
664 messagePtr8.Mid( messagePtr8.Find( KColon8 ) + KOneChar ) ); |
673 messagePtr8.Mid( messagePtr8.Find( KColon8 ) + KOneChar ) ); |
665 dataPtr8.Set( analyzer8.NextToken() ); |
674 dataPtr8.Set( analyzer8.NextToken() ); |
666 posPtr8.Set( posPtr8.Mid( messagePtr8.Length() ) ); |
675 posPtr8.Set( posPtr8.Mid( messagePtr8.Length() ) ); |
686 analyzer8.SkipSpace(); |
695 analyzer8.SkipSpace(); |
687 User::LeaveIfError( KSlash8().Locate( analyzer8.Get() ) ); |
696 User::LeaveIfError( KSlash8().Locate( analyzer8.Get() ) ); |
688 |
697 |
689 analyzer8.SkipSpace(); |
698 analyzer8.SkipSpace(); |
690 User::LeaveIfError( analyzer8.Val( oldMessageCount ) ); |
699 User::LeaveIfError( analyzer8.Val( oldMessageCount ) ); |
691 // save result here because of leaving parts above |
700 |
692 aNewMessages8.Num( newMessageCount ); |
|
693 // result saved here in case of leave from optional parsing of optional part below |
|
694 aTotalMessages8.Num( ( TInt64 ) oldMessageCount + ( TInt64 ) newMessageCount ); |
|
695 |
|
696 analyzer8.SkipSpace(); |
|
697 if ( KErrNotFound != KLParen8().Locate( analyzer8.Get() ) ) |
|
698 { |
|
699 // urgent messages found |
|
700 TUint urgentNew = 0; |
|
701 TUint urgentOld = 0; |
|
702 User::LeaveIfError( analyzer8.Val( urgentNew ) ); |
|
703 analyzer8.SkipSpace(); |
|
704 User::LeaveIfError( KSlash8().Locate( analyzer8.Get() ) ); |
|
705 |
|
706 User::LeaveIfError( analyzer8.Val( urgentOld ) ); |
|
707 newMessageCount += urgentNew; |
|
708 oldMessageCount += urgentOld; |
|
709 analyzer8.SkipSpace(); |
|
710 User::LeaveIfError( KRParen8().Locate( analyzer8.Get() ) ); |
|
711 } |
|
712 // save status again, might have updated |
|
713 aNewMessages8.Num( newMessageCount ); |
701 aNewMessages8.Num( newMessageCount ); |
714 aTotalMessages8.Num( ( TInt64 ) oldMessageCount + ( TInt64 ) newMessageCount ); |
702 aTotalMessages8.Num( ( TInt64 ) oldMessageCount + ( TInt64 ) newMessageCount ); |
715 |
703 |
716 posPtr8.Set( posPtr8.Mid( messagePtr8.Length() ) ); |
704 posPtr8.Set( posPtr8.Mid( messagePtr8.Length() ) ); |
717 } |
705 } |