realtimenetprots/sipfw/SIP/Codec/src/CSIPAddress.cpp
changeset 0 307788aac0a8
equal deleted inserted replaced
-1:000000000000 0:307788aac0a8
       
     1 // Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies).
       
     2 // All rights reserved.
       
     3 // This component and the accompanying materials are made available
       
     4 // under the terms of "Eclipse Public License v1.0"
       
     5 // which accompanies this distribution, and is available
       
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     7 //
       
     8 // Initial Contributors:
       
     9 // Nokia Corporation - initial contribution.
       
    10 //
       
    11 // Contributors:
       
    12 //
       
    13 // Description:
       
    14 // Name          : CSIPAddress.cpp
       
    15 // Part of       : SIP Codec
       
    16 // Version       : SIP/4.0 
       
    17 //
       
    18 
       
    19 
       
    20 
       
    21 
       
    22 #include "sipaddress.h"
       
    23 #include "sipuri.h"
       
    24 #include "sipcodecerr.h"
       
    25 #include "SIPSyntaxCheck.h"
       
    26 #include "uricontainer.h"
       
    27 #include "_sipcodecdefs.h"
       
    28 
       
    29 
       
    30 _LIT8 (KLaQuot, "<");
       
    31 _LIT8 (KRaQuot, ">");
       
    32 
       
    33 // ----------------------------------------------------------------------------
       
    34 // CSIPAddress::DecodeL
       
    35 // ----------------------------------------------------------------------------
       
    36 //
       
    37 EXPORT_C CSIPAddress* CSIPAddress::DecodeL (const TDesC8& aValue)
       
    38 	{
       
    39 	__ASSERT_ALWAYS (aValue.Length() > 0, 
       
    40 		User::Leave (KErrSipCodecSIPAddress));
       
    41 
       
    42 	TLex8 lex(aValue);
       
    43 	lex.SkipSpace();
       
    44 	if (lex.Peek() == 0) 
       
    45         {
       
    46         User::Leave (KErrSipCodecSIPAddress);
       
    47         }
       
    48 	TPtrC8 value(lex.Remainder());
       
    49 
       
    50 	CSIPAddress* sipAddress = new(ELeave)CSIPAddress;
       
    51 	CleanupStack::PushL(sipAddress);
       
    52 	sipAddress->ConstructL();	
       
    53 	TInt doubleQuotePos = value.Locate ('"');
       
    54 	if (doubleQuotePos == 0) // has display-name as quoted string and URI
       
    55 		{
       
    56 		const TInt KMinQuotedStrLength = 2;
       
    57 		TInt quotedStrLen = sipAddress->QuotedStringLength(value);
       
    58 		if (quotedStrLen < KMinQuotedStrLength || 
       
    59 		    quotedStrLen == value.Length()) 
       
    60 			{
       
    61 			User::Leave (KErrSipCodecSIPAddress);
       
    62 			}
       
    63 		sipAddress->SetDisplayNameL (value.Left(quotedStrLen));
       
    64 		sipAddress->ParseURIInAngleBracketsL (value.Mid(quotedStrLen));
       
    65 		}
       
    66 	else if (doubleQuotePos < 0)
       
    67 		{
       
    68 		TInt openingAngleBracketPos = value.Locate('<');
       
    69 		if (openingAngleBracketPos < 0) // has only URI
       
    70 			{
       
    71 			sipAddress->ParseURIL (value);
       
    72 			}
       
    73 		else if (openingAngleBracketPos == 0) // has only URI in angle brackets
       
    74 			{
       
    75 			sipAddress->ParseURIInAngleBracketsL (value);
       
    76 			}
       
    77 		else // has both display-name and URI 
       
    78 			{
       
    79 			TPtrC8 displayName (value.Left(openingAngleBracketPos));
       
    80 			sipAddress->SetDisplayNameL (displayName);
       
    81 			value.Set(value.Mid(openingAngleBracketPos));
       
    82 			sipAddress->ParseURIInAngleBracketsL (value);
       
    83 			}
       
    84 		}
       
    85 	else
       
    86 		{
       
    87 		User::Leave (KErrSipCodecSIPAddress);
       
    88 		}
       
    89 	CleanupStack::Pop(sipAddress);
       
    90 	return sipAddress;
       
    91 	}
       
    92 
       
    93 // ----------------------------------------------------------------------------
       
    94 // CSIPAddress::NewL
       
    95 // ----------------------------------------------------------------------------
       
    96 //
       
    97 EXPORT_C CSIPAddress* CSIPAddress::NewL (CUri8* aUri8)
       
    98 	{
       
    99 	CSIPAddress* self = CSIPAddress::NewLC (aUri8);
       
   100 	CleanupStack::Pop(self);
       
   101 	return self;
       
   102 	}
       
   103 
       
   104 // ----------------------------------------------------------------------------
       
   105 // CSIPAddress::NewLC
       
   106 // ----------------------------------------------------------------------------
       
   107 //
       
   108 EXPORT_C CSIPAddress* CSIPAddress::NewLC (CUri8* aUri8)
       
   109 	{
       
   110 	CSIPAddress* self = new(ELeave)CSIPAddress;
       
   111 	CleanupStack::PushL(self);
       
   112 	self->ConstructL(aUri8);
       
   113 	return self;
       
   114 	}
       
   115 
       
   116 // ----------------------------------------------------------------------------
       
   117 // CSIPAddress::NewL
       
   118 // ----------------------------------------------------------------------------
       
   119 //
       
   120 EXPORT_C CSIPAddress* 
       
   121 CSIPAddress::NewL (const TDesC8& aDisplayName, CUri8* aUri8)
       
   122 	{
       
   123 	CSIPAddress* self = CSIPAddress::NewLC (aDisplayName, aUri8);
       
   124 	CleanupStack::Pop(self);
       
   125 	return self;
       
   126 	}
       
   127 
       
   128 // ----------------------------------------------------------------------------
       
   129 // CSIPAddress::NewLC
       
   130 // ----------------------------------------------------------------------------
       
   131 //
       
   132 EXPORT_C CSIPAddress* 
       
   133 CSIPAddress::NewLC (const TDesC8& aDisplayName, CUri8* aUri8)
       
   134 	{
       
   135 	CSIPAddress* self = new(ELeave)CSIPAddress;
       
   136 	CleanupStack::PushL(self);
       
   137 	self->ConstructL(aDisplayName, aUri8);
       
   138 	return self;
       
   139 	}
       
   140 
       
   141 // ----------------------------------------------------------------------------
       
   142 // CSIPAddress::NewL
       
   143 // ----------------------------------------------------------------------------
       
   144 //
       
   145 EXPORT_C CSIPAddress* CSIPAddress::NewL (const CSIPAddress& aSIPAddress)
       
   146 	{
       
   147 	CSIPAddress* self = CSIPAddress::NewLC (aSIPAddress);
       
   148 	CleanupStack::Pop(self);
       
   149 	return self;
       
   150 	}
       
   151 
       
   152 // ----------------------------------------------------------------------------
       
   153 // CSIPAddress::NewLC
       
   154 // ----------------------------------------------------------------------------
       
   155 //
       
   156 EXPORT_C CSIPAddress* CSIPAddress::NewLC (const CSIPAddress& aSIPAddress)
       
   157 	{
       
   158 	CSIPAddress* self = new(ELeave)CSIPAddress;
       
   159 	CleanupStack::PushL(self);
       
   160 	self->ConstructL(aSIPAddress);
       
   161 	return self;
       
   162 	}
       
   163 
       
   164 // ----------------------------------------------------------------------------
       
   165 // CSIPAddress::NewLC
       
   166 // ----------------------------------------------------------------------------
       
   167 //
       
   168 CSIPAddress* CSIPAddress::NewLC(CURIContainer* aURI)
       
   169     {
       
   170 	CSIPAddress* self = new(ELeave)CSIPAddress;
       
   171 	CleanupStack::PushL(self);
       
   172 	self->ConstructL(aURI);
       
   173 	return self;    
       
   174     }
       
   175 
       
   176 // ----------------------------------------------------------------------------
       
   177 // CSIPAddress::CSIPAddress
       
   178 // ----------------------------------------------------------------------------
       
   179 //
       
   180 CSIPAddress::CSIPAddress()
       
   181 	{
       
   182 	}
       
   183 
       
   184 // ----------------------------------------------------------------------------
       
   185 // CSIPAddress::ConstructL
       
   186 // ----------------------------------------------------------------------------
       
   187 //
       
   188 void CSIPAddress::ConstructL ()
       
   189 	{
       
   190 	iDisplayName = KNullDesC8().AllocL();
       
   191 	}
       
   192 
       
   193 // ----------------------------------------------------------------------------
       
   194 // CSIPAddress::ConstructL
       
   195 // ----------------------------------------------------------------------------
       
   196 //
       
   197 void CSIPAddress::ConstructL (CUri8* aUri)
       
   198 	{
       
   199     iDisplayName = KNullDesC8().AllocL();
       
   200 	SetUri8L (aUri);
       
   201 	}
       
   202 
       
   203 // ----------------------------------------------------------------------------
       
   204 // CSIPAddress::ConstructL
       
   205 // ----------------------------------------------------------------------------
       
   206 //
       
   207 void CSIPAddress::ConstructL (const TDesC8& aDisplayName, CUri8* aUri)
       
   208 	{
       
   209 	SetDisplayNameL (aDisplayName);
       
   210 	SetUri8L (aUri);
       
   211 	}
       
   212 
       
   213 // ----------------------------------------------------------------------------
       
   214 // CSIPAddress::ConstructL
       
   215 // ----------------------------------------------------------------------------
       
   216 //
       
   217 void CSIPAddress::ConstructL (const CSIPAddress& aSIPAddress)
       
   218 	{
       
   219 	__ASSERT_ALWAYS (aSIPAddress.iURI != 0, User::Leave(KErrArgument));
       
   220 
       
   221 	if (aSIPAddress.HasDisplayName())
       
   222 		{
       
   223 		SetDisplayNameL(aSIPAddress.DisplayName());
       
   224 		}
       
   225     else
       
   226         {
       
   227         iDisplayName = KNullDesC8().AllocL();
       
   228         }
       
   229     if(aSIPAddress.URI().IsSIPURI())
       
   230         {
       
   231         HBufC8* value = aSIPAddress.iURI->SIPURI()->ToTextL();
       
   232         CleanupStack::PushL(value);
       
   233         TPtrC8 valuePtr(value->Des());
       
   234         iURI = CURIContainer::DecodeL(valuePtr);
       
   235         CleanupStack::PopAndDestroy(value);
       
   236         }
       
   237     else
       
   238         {
       
   239         iURI = CURIContainer::DecodeL(aSIPAddress.iURI->Uri8()->Uri().UriDes());
       
   240         }	
       
   241 	}
       
   242 	
       
   243 // ----------------------------------------------------------------------------
       
   244 // CSIPAddress::ConstructL
       
   245 // ----------------------------------------------------------------------------
       
   246 //
       
   247 void CSIPAddress::ConstructL (CURIContainer* aURI)
       
   248 	{
       
   249     __ASSERT_ALWAYS (aURI != 0, User::Leave(KErrArgument));	
       
   250     
       
   251     iDisplayName = KNullDesC8().AllocL();
       
   252 	iURI = aURI;
       
   253 	}	
       
   254 
       
   255 // ----------------------------------------------------------------------------
       
   256 // CSIPAddress::~CSIPAddress
       
   257 // ----------------------------------------------------------------------------
       
   258 //
       
   259 EXPORT_C CSIPAddress::~CSIPAddress()
       
   260 	{
       
   261 	delete iDisplayName;
       
   262 	delete iURI;
       
   263 	}
       
   264 
       
   265 // ----------------------------------------------------------------------------
       
   266 // CSIPAddress::operator==
       
   267 // ----------------------------------------------------------------------------
       
   268 //
       
   269 EXPORT_C TBool CSIPAddress::operator==(const CSIPAddress& aSIPAddress) const
       
   270 	{
       
   271 	if (aSIPAddress.HasDisplayName() != HasDisplayName()) 
       
   272 		{
       
   273 		return EFalse;
       
   274 		}
       
   275 
       
   276 	if (aSIPAddress.HasDisplayName())
       
   277 		{
       
   278 		// In quoted strings the case sensitivity matters.
       
   279 		if (aSIPAddress.DisplayName().Locate('"') == 0)
       
   280 			{
       
   281 			if (aSIPAddress.DisplayName().Compare(*iDisplayName) != 0)
       
   282 				{
       
   283 				return EFalse;
       
   284 				}
       
   285 			}
       
   286 		else
       
   287 			{
       
   288 			if (aSIPAddress.DisplayName().CompareF(*iDisplayName) != 0)
       
   289 				{
       
   290 				return EFalse;
       
   291 				}
       
   292 			}
       
   293 		}
       
   294 
       
   295 	return (*(aSIPAddress.iURI) == *iURI);
       
   296 	}
       
   297 
       
   298 // ----------------------------------------------------------------------------
       
   299 // CSIPAddress::DisplayName
       
   300 // ----------------------------------------------------------------------------
       
   301 //
       
   302 EXPORT_C const TDesC8& CSIPAddress::DisplayName() const
       
   303 	{
       
   304 	return *iDisplayName;
       
   305 	}
       
   306 
       
   307 // ----------------------------------------------------------------------------
       
   308 // CSIPAddress::SetDisplayNameL
       
   309 // ----------------------------------------------------------------------------
       
   310 //
       
   311 EXPORT_C void CSIPAddress::SetDisplayNameL(const TDesC8& aDisplayName)
       
   312 	{
       
   313 	HBufC8* tmp = aDisplayName.AllocLC();
       
   314 	tmp->Des().Trim();
       
   315 	__ASSERT_ALWAYS (CheckDisplayName(*tmp),
       
   316 	                 User::Leave(KErrSipCodecDisplayName));
       
   317 	CleanupStack::Pop(tmp);
       
   318 	delete iDisplayName;
       
   319 	iDisplayName = tmp;
       
   320 	}
       
   321 
       
   322 // ----------------------------------------------------------------------------
       
   323 // CSIPAddress::URI
       
   324 // ----------------------------------------------------------------------------
       
   325 //
       
   326 EXPORT_C const CURIContainer& CSIPAddress::URI() const
       
   327 	{
       
   328 	return *iURI;
       
   329 	}
       
   330 
       
   331 // ----------------------------------------------------------------------------
       
   332 // CSIPAddress::URI
       
   333 // ----------------------------------------------------------------------------
       
   334 //
       
   335 EXPORT_C CURIContainer& CSIPAddress::URI()
       
   336 	{
       
   337 	return *iURI;
       
   338 	}
       
   339 
       
   340 // ----------------------------------------------------------------------------
       
   341 // CSIPAddress::Uri8
       
   342 // ----------------------------------------------------------------------------
       
   343 //
       
   344 EXPORT_C const CUri8& CSIPAddress::Uri8() const
       
   345     {
       
   346     return *(iURI->Uri8());
       
   347     }
       
   348 
       
   349 // ----------------------------------------------------------------------------
       
   350 // CSIPAddress::SetURIL
       
   351 // ----------------------------------------------------------------------------
       
   352 //
       
   353 EXPORT_C void CSIPAddress::SetUri8L (CUri8* aUri8)
       
   354 	{
       
   355 	__ASSERT_ALWAYS(aUri8 != 0, User::Leave(KErrArgument));
       
   356 
       
   357     CURIContainer* tmp = CURIContainer::DecodeL(aUri8->Uri().UriDes());
       
   358     delete aUri8;
       
   359     delete iURI;
       
   360     iURI = 0;
       
   361     iURI = tmp;
       
   362 	}
       
   363 
       
   364 // ----------------------------------------------------------------------------
       
   365 // CSIPAddress::ToTextLC
       
   366 // ----------------------------------------------------------------------------
       
   367 //
       
   368 EXPORT_C HBufC8* CSIPAddress::ToTextLC(TBool aUseAngleBrackets) const
       
   369 	{
       
   370 	TUint encodedLength = 0;
       
   371 	if (HasDisplayName()) 
       
   372         {
       
   373         encodedLength += iDisplayName->Length() + 1; // SP
       
   374         }
       
   375 	HBufC8* encodedURI = iURI->ToTextL();
       
   376 	CleanupStack::PushL (encodedURI);
       
   377 	encodedLength += encodedURI->Length();
       
   378 
       
   379 	TBool uriContainsSeparators = ContainsSeparators(*encodedURI);
       
   380 
       
   381 	if (HasDisplayName() || uriContainsSeparators || aUseAngleBrackets)
       
   382 		{
       
   383 		encodedLength += KLaQuot().Length();
       
   384 		encodedLength += KRaQuot().Length();
       
   385 		}
       
   386 
       
   387 	HBufC8* encodedSIPAddress = HBufC8::NewL (encodedLength);
       
   388 	TPtr8 encodedPtr = encodedSIPAddress->Des();
       
   389 
       
   390 	if (HasDisplayName())
       
   391 		{
       
   392 		encodedPtr.Append(*iDisplayName);
       
   393 		encodedPtr.Append(' '); // SP
       
   394 		}
       
   395 
       
   396 	if (HasDisplayName() || uriContainsSeparators || aUseAngleBrackets)
       
   397 		{
       
   398 		encodedPtr.Append(KLaQuot);
       
   399 		}
       
   400 
       
   401 	encodedPtr.Append(*encodedURI);
       
   402 	
       
   403 	if (HasDisplayName() || uriContainsSeparators || aUseAngleBrackets)
       
   404 		{
       
   405 		encodedPtr.Append(KRaQuot);
       
   406 		}
       
   407 
       
   408 	CleanupStack::PopAndDestroy(encodedURI);
       
   409 	CleanupStack::PushL (encodedSIPAddress);
       
   410 	return encodedSIPAddress;
       
   411 	}
       
   412 
       
   413 // ----------------------------------------------------------------------------
       
   414 // CSIPAddress::InternalizeL
       
   415 // ----------------------------------------------------------------------------
       
   416 //
       
   417 EXPORT_C CSIPAddress* CSIPAddress::InternalizeL(RReadStream& aReadStream)
       
   418 	{
       
   419 	CSIPAddress* self = new(ELeave)CSIPAddress;
       
   420 	CleanupStack::PushL(self);
       
   421 	self->DoInternalizeL(aReadStream);
       
   422 	CleanupStack::Pop(self);
       
   423 	return self;
       
   424 	}
       
   425 
       
   426 // ----------------------------------------------------------------------------
       
   427 // CSIPAddress::ExternalizeL
       
   428 // ----------------------------------------------------------------------------
       
   429 //
       
   430 EXPORT_C void CSIPAddress::ExternalizeL (RWriteStream& aWriteStream)
       
   431 	{
       
   432     iURI->ExternalizeL(aWriteStream);
       
   433 
       
   434 	if (HasDisplayName())
       
   435 		{
       
   436 		aWriteStream.WriteUint8L(1);
       
   437 		aWriteStream.WriteUint32L (iDisplayName->Length());
       
   438 		aWriteStream.WriteL (*iDisplayName, iDisplayName->Length());
       
   439 		}
       
   440 	else
       
   441 		{
       
   442 		aWriteStream.WriteUint8L(0);
       
   443 		}
       
   444 	}
       
   445 
       
   446 // ----------------------------------------------------------------------------
       
   447 // CSIPAddress::DoInternalizeL
       
   448 // ----------------------------------------------------------------------------
       
   449 //
       
   450 void CSIPAddress::DoInternalizeL (RReadStream& aReadStream)
       
   451 	{
       
   452 	iURI = CURIContainer::InternalizeL(aReadStream);
       
   453 
       
   454 	if (aReadStream.ReadUint8L() == 1) // has display name
       
   455 		{
       
   456 		TUint32 displayNameLength = aReadStream.ReadUint32L();
       
   457 		iDisplayName = HBufC8::NewL (displayNameLength);
       
   458 		TPtr8 displayName(iDisplayName->Des());
       
   459 		aReadStream.ReadL (displayName,displayNameLength);
       
   460 		}
       
   461 	else
       
   462 		{
       
   463 		iDisplayName = KNullDesC8().AllocL();	
       
   464 		}
       
   465 	}
       
   466 
       
   467 // ----------------------------------------------------------------------------
       
   468 // CSIPAddress::QuotedStringLength
       
   469 // ----------------------------------------------------------------------------
       
   470 //
       
   471 TInt CSIPAddress::QuotedStringLength (const TDesC8& aValue)
       
   472 	{
       
   473 	if (aValue.Length() == 0) 
       
   474         {
       
   475         return KErrNotFound;
       
   476         }
       
   477 	TLex8 lex(aValue);
       
   478 	if (lex.Get() != '"')
       
   479         {
       
   480         return KErrNotFound;
       
   481         }
       
   482 	TUint chrCount = 1;
       
   483 	TChar currChr = lex.Get();
       
   484 	TBool endOfQuotedStringFound = EFalse;
       
   485 	TBool previousWasBackSlash = EFalse;
       
   486 	while (currChr != 0 && !endOfQuotedStringFound)
       
   487 		{
       
   488 		if (currChr == '\\')
       
   489 			{
       
   490 			// Backslash can be used to quote another backslash
       
   491 			previousWasBackSlash = !previousWasBackSlash;
       
   492 			}
       
   493 		else
       
   494 			{
       
   495 			if (currChr == '"' && !previousWasBackSlash)
       
   496 				{
       
   497 				endOfQuotedStringFound = ETrue;
       
   498 				}
       
   499 			previousWasBackSlash = EFalse;
       
   500 			}
       
   501 		chrCount++;		
       
   502 		currChr = lex.Get();
       
   503 		}
       
   504 	if (!endOfQuotedStringFound) 
       
   505         {
       
   506         return KErrNotFound;
       
   507         }
       
   508 	return chrCount;
       
   509 	}
       
   510 
       
   511 // ----------------------------------------------------------------------------
       
   512 // CSIPAddress::CheckDisplayName
       
   513 // ----------------------------------------------------------------------------
       
   514 //
       
   515 TBool CSIPAddress::CheckDisplayName (const TDesC8& aValue)
       
   516 	{
       
   517 	if (aValue.Length() == 0) return EFalse;
       
   518 	TLex8 lex(aValue);
       
   519 	lex.SkipSpace();
       
   520 	if (lex.Peek() == '"') // quoted-string
       
   521 		{
       
   522 		return SIPSyntaxCheck::QuotedString(aValue);
       
   523 		}
       
   524 	else // *(token LWS)
       
   525 		{
       
   526 		TPtrC8 token(lex.NextToken());
       
   527 		while (token.Length() > 0)
       
   528 			{
       
   529 			if (!SIPSyntaxCheck::Token(token)) 
       
   530                 {
       
   531                 return EFalse;
       
   532                 }
       
   533 			token.Set(lex.NextToken());
       
   534 			}
       
   535 		}
       
   536 	return ETrue;
       
   537 	}
       
   538 
       
   539 // ----------------------------------------------------------------------------
       
   540 // CSIPAddress::ParseURIInAngleBracketsL
       
   541 // ----------------------------------------------------------------------------
       
   542 //
       
   543 void CSIPAddress::ParseURIInAngleBracketsL (const TDesC8& aValue)
       
   544 	{
       
   545 	__ASSERT_ALWAYS (aValue.Length() > 0, 
       
   546 		User::Leave (KErrSipCodecSIPAddress));
       
   547 
       
   548     HBufC8* trimmedValue = aValue.AllocLC();
       
   549     TPtr8 trimmedValuePtr(trimmedValue->Des());
       
   550     trimmedValuePtr.Trim();
       
   551 
       
   552 	TInt openingAngleBracketPos = trimmedValuePtr.Locate('<');
       
   553 	if (openingAngleBracketPos != 0) 
       
   554 		{
       
   555 		User::Leave (KErrSipCodecSIPAddress);
       
   556 		}
       
   557 	
       
   558 	TInt closingAngleBracketPos = trimmedValuePtr.LocateReverse('>');
       
   559 	if (closingAngleBracketPos < 0 ||
       
   560 		closingAngleBracketPos != trimmedValuePtr.Length()-1)
       
   561 		{
       
   562 		User::Leave (KErrSipCodecSIPAddress);
       
   563 		}
       
   564 
       
   565     const TInt KURIStartPos = 1;
       
   566     const TInt KURIEndPos = trimmedValuePtr.Length()-2;
       
   567 	ParseURIL (trimmedValuePtr.Mid(KURIStartPos,KURIEndPos));
       
   568 	
       
   569 	CleanupStack::PopAndDestroy(trimmedValue);	
       
   570 	}
       
   571 
       
   572 // ----------------------------------------------------------------------------
       
   573 // CSIPAddress::ParseURIL
       
   574 // ----------------------------------------------------------------------------
       
   575 //
       
   576 void CSIPAddress::ParseURIL (const TDesC8& aValue)
       
   577 	{
       
   578 	__ASSERT_ALWAYS (aValue.Length() > 0, 
       
   579 		             User::Leave (KErrSipCodecURI));
       
   580 
       
   581 	CURIContainer* uri = CURIContainer::DecodeL (aValue);
       
   582 	delete iURI;
       
   583 	iURI = uri;
       
   584 	}
       
   585 
       
   586 // ----------------------------------------------------------------------------
       
   587 // CSIPAddress::ContainsSeparators
       
   588 // ----------------------------------------------------------------------------
       
   589 //
       
   590 TBool CSIPAddress::ContainsSeparators(const TDesC8& aValue) const
       
   591 	{
       
   592 	TLex8 lex(aValue);
       
   593 	TChar chr = lex.Get();
       
   594 	while (chr)
       
   595 		{
       
   596 		if (chr == ',' || chr == '?' || chr == ';') 
       
   597             {
       
   598             return ETrue;
       
   599             }
       
   600 		chr = lex.Get();
       
   601 		}	
       
   602 	return EFalse;
       
   603 	}
       
   604 	
       
   605 // ----------------------------------------------------------------------------
       
   606 // CSIPAddress::HasDisplayName
       
   607 // ----------------------------------------------------------------------------
       
   608 //	
       
   609 TBool CSIPAddress::HasDisplayName() const
       
   610 	{
       
   611 	return (DisplayName().Length() > 0);
       
   612 	}