sipvoipprovider/src/svpuriparser.cpp
branchRCL_3
changeset 23 755430a7d64b
parent 22 d38647835c2e
equal deleted inserted replaced
22:d38647835c2e 23:755430a7d64b
   692     HBufC8* utf8 = HBufC8::NewLC( aRemoteParty.Length() ); // CS:1
   692     HBufC8* utf8 = HBufC8::NewLC( aRemoteParty.Length() ); // CS:1
   693     ( utf8->Des() ).Copy( aRemoteParty );
   693     ( utf8->Des() ).Copy( aRemoteParty );
   694     
   694     
   695     // Escape decode
   695     // Escape decode
   696     CSVPUriParser::EscapeDecodeSipUriL( utf8 );
   696     CSVPUriParser::EscapeDecodeSipUriL( utf8 );
   697     
   697 
   698     // Convert from UTF8 to unicode
   698     // Create SIP From header
   699     HBufC* unicode16 = EscapeUtils::ConvertToUnicodeFromUtf8L( *utf8 );
   699     CSIPFromHeader* originatorHdr = CSIPFromHeader::DecodeL( *utf8 );
   700     CleanupStack::PopAndDestroy( utf8 ); // CS:0
   700     CleanupStack::PopAndDestroy( utf8 ); // CS:0
   701     CleanupStack::PushL( unicode16 ); // CS:1
       
   702     HBufC8* unicode8 = HBufC8::NewL( unicode16->Length() );
       
   703     ( unicode8->Des() ).Copy( *unicode16 );
       
   704     CleanupStack::PopAndDestroy( unicode16 ); // CS:0
       
   705     CleanupStack::PushL( unicode8 ); // CS:1
       
   706     
       
   707     // Create SIP From header
       
   708     CSIPFromHeader* originatorHdr = CSIPFromHeader::DecodeL( *unicode8 );
       
   709     CleanupStack::PopAndDestroy( unicode8 ); // CS:0
       
   710     CleanupStack::PushL( originatorHdr ); // CS:1
   701     CleanupStack::PushL( originatorHdr ); // CS:1
   711     
   702     
   712     // Extract and parse display name, format is "..."
   703     // Extract and parse display name, format is "..."
   713     HBufC8* displayName8 = originatorHdr->SIPAddress().DisplayName().AllocL();
   704     HBufC8* displayName8 = originatorHdr->SIPAddress().DisplayName().AllocL();
   714     CleanupStack::PopAndDestroy( originatorHdr ); // CS:0
   705     CleanupStack::PopAndDestroy( originatorHdr ); // CS:0
   759         displayName->Des().Copy( KNullDesC );
   750         displayName->Des().Copy( KNullDesC );
   760         }
   751         }
   761 
   752 
   762     SVPDEBUG2( "CSVPUriParser::ParseDisplayNameL, display name: %S", 
   753     SVPDEBUG2( "CSVPUriParser::ParseDisplayNameL, display name: %S", 
   763         displayName )
   754         displayName )
   764     return displayName;
   755     
       
   756     CleanupStack::PushL( displayName );
       
   757     HBufC8* utf8DisplayName8 = HBufC8::NewL( displayName->Length() );
       
   758     ( utf8DisplayName8->Des() ).Copy( *displayName );
       
   759     CleanupStack::PopAndDestroy( displayName );
       
   760 
       
   761     CleanupStack::PushL( utf8DisplayName8 ); 
       
   762     // Convert from UTF8 to unicode
       
   763     HBufC* unicodeDisplayName = EscapeUtils::ConvertToUnicodeFromUtf8L( *utf8DisplayName8 );
       
   764     CleanupStack::PopAndDestroy(utf8DisplayName8);
       
   765 
       
   766     return unicodeDisplayName;
   765     }
   767     }
   766 
   768 
   767 // ---------------------------------------------------------------------------
   769 // ---------------------------------------------------------------------------
   768 // CSVPUriParser::ParseRemotePartyUriL
   770 // CSVPUriParser::ParseRemotePartyUriL
   769 // ---------------------------------------------------------------------------
   771 // ---------------------------------------------------------------------------
   780     ( utf8->Des() ).Copy( aRemoteParty );
   782     ( utf8->Des() ).Copy( aRemoteParty );
   781 
   783 
   782     // Escape decode
   784     // Escape decode
   783     CSVPUriParser::EscapeDecodeSipUriL( utf8 );
   785     CSVPUriParser::EscapeDecodeSipUriL( utf8 );
   784     
   786     
   785     // Convert from UTF8 to unicode
   787     // Create SIP From header
   786     HBufC* unicode16 = EscapeUtils::ConvertToUnicodeFromUtf8L( *utf8 );
   788     CSIPFromHeader* originatorHdr = CSIPFromHeader::DecodeL( *utf8 );
   787     CleanupStack::PopAndDestroy( utf8 ); // CS:0
   789     CleanupStack::PopAndDestroy( utf8 ); // CS:0
   788     CleanupStack::PushL( unicode16 ); // CS:1
       
   789     HBufC8* unicode8 = HBufC8::NewL( unicode16->Length() );
       
   790     ( unicode8->Des() ).Copy( *unicode16 );
       
   791     CleanupStack::PopAndDestroy( unicode16 ); // CS:0
       
   792     CleanupStack::PushL( unicode8 ); // CS:1
       
   793     
       
   794     // Create SIP From header
       
   795     CSIPFromHeader* originatorHdr = CSIPFromHeader::DecodeL( *unicode8 );
       
   796     CleanupStack::PopAndDestroy( unicode8 ); // CS:0
       
   797     CleanupStack::PushL( originatorHdr ); // CS:1
   790     CleanupStack::PushL( originatorHdr ); // CS:1
   798         
   791         
   799     // Extract URI, returned without angle brackets
   792     // Extract URI, returned without angle brackets
   800     HBufC8* uri8 = originatorHdr->SIPAddress().Uri8().Uri().UriDes().AllocL();
   793     HBufC8* uri8 = originatorHdr->SIPAddress().Uri8().Uri().UriDes().AllocL();
   801     CleanupStack::PopAndDestroy( originatorHdr ); // CS:0
   794     CleanupStack::PopAndDestroy( originatorHdr ); // CS:0
   805     TInt posSemiColon = uri8->FindF( KSVPSemiCln );
   798     TInt posSemiColon = uri8->FindF( KSVPSemiCln );
   806     if ( KErrNotFound != posSemiColon )
   799     if ( KErrNotFound != posSemiColon )
   807         {
   800         {
   808         uri8->Des().Delete( posSemiColon, uri8->Length() - posSemiColon );
   801         uri8->Des().Delete( posSemiColon, uri8->Length() - posSemiColon );
   809         }
   802         }
   810 
   803     
   811     // Convert to 16-bit
   804     // Convert from UTF8 to unicode
   812     HBufC* uri = HBufC::NewL( uri8->Length() );
   805     HBufC* uri = EscapeUtils::ConvertToUnicodeFromUtf8L( *uri8 );
   813     ( uri->Des() ).Copy( *uri8 );
       
   814     CleanupStack::PopAndDestroy( uri8 ); // CS:0
   806     CleanupStack::PopAndDestroy( uri8 ); // CS:0
   815 
   807 
   816     // Handle anonymous
   808     // Handle anonymous
   817     if ( KErrNotFound != uri->Des().FindF( KSVPAnonymous ) )
   809     if ( KErrNotFound != uri->Des().FindF( KSVPAnonymous ) )
   818         {
   810         {