omads/omadsextensions/adapters/sms/src/smsadaptermsvapi.cpp
changeset 64 a62b67d1f67c
parent 40 b63e67867dcd
equal deleted inserted replaced
62:262aa4f075d6 64:a62b67d1f67c
     1 /*
     1 /*
     2 * Copyright (c) 2005-2007 Nokia Corporation and/or its subsidiary(-ies). 
     2 * Copyright (c) 2005-2010 Nokia Corporation and/or its subsidiary(-ies). 
     3 * All rights reserved.
     3 * All rights reserved.
     4 * This component and the accompanying materials are made available
     4 * This component and the accompanying materials are made available
     5 * under the terms of "Eclipse Public License v1.0"
     5 * under the terms of "Eclipse Public License v1.0"
     6 * which accompanies this distribution, and is available
     6 * which accompanies this distribution, and is available
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
    34 #include "smsdataproviderdefs.h"
    34 #include "smsdataproviderdefs.h"
    35 
    35 
    36 
    36 
    37 // CONSTANTS
    37 // CONSTANTS
    38 
    38 
    39 _LIT16(KSmsNonUnicodeChars, "èéùìòÇØøÅåÆæßÉ£$¥¡ÄÖÑܧ¿äöñüà");
    39 // The following string is "èéùìòÇØøÅåÆæßÉ£$¥¡ÄÖÑܧ¿äöñüà", expressed as standard \xNN escape codes
       
    40 _LIT16(KSmsNonUnicodeChars, "\xe8\xe9\xf9\xec\xf2\xc7\xd8\xf8\xc5\xe5\xc6\xe6\xdf\xc9\xa3$\xa5\xa1\xc4\xd6\xd1\xdc\xa7\xbf\xe4\xf6\xf1\xfc\xe0");
       
    41 
    40         
    42         
    41 // OTHER DEFINITIONS
    43 // OTHER DEFINITIONS
    42 
    44 
    43 
    45 
    44 
    46 
   335 		const CMsvRecipientList& recipients = iMtm->AddresseeList();
   337 		const CMsvRecipientList& recipients = iMtm->AddresseeList();
   336 		for (TInt i = 0; i < recipients.Count(); i++)
   338 		for (TInt i = 0; i < recipients.Count(); i++)
   337 			{
   339 			{
   338 			CVMessageParser::TTelephoneNumber recipientInfo;
   340 			CVMessageParser::TTelephoneNumber recipientInfo;
   339 			aSm.ParseTelephoneNumber( recipients[i], recipientInfo );
   341 			aSm.ParseTelephoneNumber( recipients[i], recipientInfo );
   340 			aSm.iRecipients.Append( recipientInfo );
   342 			aSm.iRecipients.AppendL( recipientInfo );
   341 			}
   343 			}
   342 		}	
   344 		}	
   343 
   345 
   344 	LOGGER_LEAVEFN( "CSmsAdapterMsvApi::RetrieveSML" );
   346 	LOGGER_LEAVEFN( "CSmsAdapterMsvApi::RetrieveSML" );
   345     }
   347     }
   680 			FetchNameFromContactsL(aSm.iSender.iNumber, addrBookName);
   682 			FetchNameFromContactsL(aSm.iSender.iNumber, addrBookName);
   681 			if (addrBookName.Length() > 0)
   683 			if (addrBookName.Length() > 0)
   682 				{
   684 				{
   683 				newEntry.iDetails.Set( addrBookName );
   685 				newEntry.iDetails.Set( addrBookName );
   684 				header.SetFromAddressL( addrBookName );
   686 				header.SetFromAddressL( addrBookName );
       
   687 				
   685 				}
   688 				}
   686 			else
   689 			else
   687 				{		
   690 				{		
   688 				newEntry.iDetails.Set( aSm.iSender.iNumber );
   691 				newEntry.iDetails.Set( aSm.iSender.iNumber );
   689 				header.SetFromAddressL( aSm.iSender.iNumber );
   692 				header.SetFromAddressL( aSm.iSender.iNumber );
   691 			}
   694 			}
   692 		CSmsMessage& smsMsg = header.Message();
   695 		CSmsMessage& smsMsg = header.Message();
   693 		CSmsPDU& smsPdu = smsMsg.SmsPDU();
   696 		CSmsPDU& smsPdu = smsMsg.SmsPDU();
   694 		CSmsDeliver* smsDeliver = reinterpret_cast<CSmsDeliver*>( &smsPdu );	
   697 		CSmsDeliver* smsDeliver = reinterpret_cast<CSmsDeliver*>( &smsPdu );	
   695 		smsDeliver->SetServiceCenterTimeStamp( newEntry.iDate );
   698 		smsDeliver->SetServiceCenterTimeStamp( newEntry.iDate );
       
   699 		if (aSm.iSender.iNumber.Length() > 0)
       
   700 		    {
       
   701             TGsmSmsTelNumber telNum;
       
   702             telNum.iTelNumber.Copy( aSm.iSender.iNumber );
       
   703             smsDeliver->SetParsedToFromAddressL( telNum );
       
   704 		    }
   696 		}
   705 		}
   697 	else // message to be sent
   706 	else // message to be sent
   698 		{
   707 		{
   699 		if (!aNewSm)
   708 		if (!aNewSm)
   700 			{
   709 			{
  1109 		}
  1118 		}
  1110 	CleanupStack::PushL(contactIds);		
  1119 	CleanupStack::PushL(contactIds);		
  1111  
  1120  
  1112 	CContactItem* item = iContactsDb->ReadContactLC((*contactIds)[0]);
  1121 	CContactItem* item = iContactsDb->ReadContactLC((*contactIds)[0]);
  1113 	CContactItemFieldSet& fieldSet = item->CardFields();
  1122 	CContactItemFieldSet& fieldSet = item->CardFields();
  1114 		
  1123 	
       
  1124 	TFileName database;
       
  1125 	iContactsDb->GetCurrentDatabase(database);
       
  1126 	
  1115 	TPtrC familyName;
  1127 	TPtrC familyName;
  1116 	TPtrC givenName;
  1128 	TPtrC givenName;
  1117 	TInt pos;
  1129 	TInt pos;
  1118 	
  1130 	
  1119 	pos = fieldSet.Find(KUidContactFieldFamilyName);
  1131 	pos = fieldSet.Find(KUidContactFieldFamilyName);