mobilemessaging/unieditor/mmsplugin/src/UniMmsPlugin.cpp
branchRCL_3
changeset 60 7fdbb852d323
parent 0 72b543305e3a
equal deleted inserted replaced
57:ebe688cedc25 60:7fdbb852d323
       
     1 /*
       
     2 * Copyright (c) 2005-2008 Nokia Corporation and/or its subsidiary(-ies).
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description:  
       
    15 *       Provides UniEditor Mms Plugin methods.
       
    16 *
       
    17 */
       
    18 
       
    19 
       
    20 
       
    21 
       
    22 // INCLUDE FILES
       
    23 #include <e32base.h>
       
    24 #include <f32file.h>
       
    25 #include <implementationproxy.h>
       
    26 #include <ecom.h>
       
    27 
       
    28 #include <msvapi.h>
       
    29 #include <mtclreg.h>
       
    30 #include <cmsvrecipientlist.h>
       
    31 
       
    32 #include <commdb.h>
       
    33 #include <mmsapselect.h>
       
    34  
       
    35 #include <mmsconst.h>
       
    36 #include <mmsclient.h>
       
    37 #include <mmsheaders.h>
       
    38 #include <mmssettings.h>
       
    39 #include <mmsmsventry.h>
       
    40 #include <AknQueryDialog.h>
       
    41 #include <UniMmsPluginD.rsg>
       
    42 #include <bautils.h>
       
    43 #include <data_caging_path_literals.hrh> 
       
    44 // Possible values for mms validity period in seconds
       
    45 const TInt32 KUniMmsValidityPeriod1h = 3600;
       
    46 const TInt32 KUniMmsValidityPeriod6h = 21600;
       
    47 const TInt32 KUniMmsValidityPeriod24h = 86400;
       
    48 const TInt32 KUniMmsValidityPeriod3Days = 259200;
       
    49 const TInt32 KUniMmsValidityPeriodWeek = 604800;
       
    50 const TInt32 KUniMmsValidityPeriodMax = 0;
       
    51 
       
    52 #include <SenduiMtmUids.h>
       
    53 
       
    54 #include <MuiuOperationWait.h>
       
    55 
       
    56 #include "UniMsvEntry.h"
       
    57 #include "UniMmsPlugin.h"
       
    58 #include "UniSendingSettings.h"
       
    59 #include "UniClientMtm.h"
       
    60 #include "UniEditorUids.hrh"
       
    61 
       
    62 //DEBUG LOGGING
       
    63 #include "UniEditorLogging.h"
       
    64 
       
    65 // CONSTANTS   
       
    66 const TImplementationProxy KImplementationTable[] = 
       
    67 	{
       
    68 	IMPLEMENTATION_PROXY_ENTRY( KUidUniEditorMmsPlugin, CUniMmsPlugin::NewL)
       
    69 	};
       
    70 	
       
    71 const TInt  KMaxDetailsLength = 64;   // Copy max this many chars to TMsvEntry::iDetails
       
    72 _LIT( KAddressSeparator, ";" );
       
    73 
       
    74 _LIT( KUniMmsPluginResourceFile,     	"UniMmsPluginD.rsc" );
       
    75 
       
    76 // -----------------------------------------------------------------------------
       
    77 // Two-phased constructor.
       
    78 // -----------------------------------------------------------------------------
       
    79 //
       
    80 CUniMmsPlugin* CUniMmsPlugin::NewL( TAny* aConstructionParameters )
       
    81     {
       
    82     UNILOGGER_ENTERFN("CUniMmsPlugin::NewL");
       
    83 	TUniPluginParams* params = reinterpret_cast<TUniPluginParams*>( aConstructionParameters );
       
    84     CUniMmsPlugin* self = new ( ELeave ) CUniMmsPlugin( params->iSession, params->iUniMtm ); 
       
    85     UNILOGGER_LEAVEFN("CUniSmsPlugin::NewL");
       
    86     return self;
       
    87     }
       
    88 
       
    89 // -----------------------------------------------------------------------------
       
    90 // Destructor
       
    91 // -----------------------------------------------------------------------------
       
    92 //
       
    93 CUniMmsPlugin::~CUniMmsPlugin()
       
    94     {
       
    95     //In case there is no settings at all leave occurs and resource not freed
       
    96     if( iResourceOffset )
       
    97         {
       
    98         CCoeEnv::Static()->DeleteResourceFile( iResourceOffset );
       
    99         }
       
   100     delete iCommsDb;
       
   101     delete iMmsSettings;
       
   102     delete iMmsHeader;
       
   103     delete iMmsMtm;
       
   104     delete iMtmRegistry;
       
   105     }
       
   106 
       
   107 // -----------------------------------------------------------------------------
       
   108 // C++ default constructor
       
   109 // -----------------------------------------------------------------------------
       
   110 //
       
   111 CUniMmsPlugin::CUniMmsPlugin( CMsvSession& aSession, CUniClientMtm& aUniMtm )
       
   112     : iSession( aSession ),
       
   113       iUniMtm( aUniMtm ),
       
   114       iResourceOffset ( 0 )
       
   115     {
       
   116     }
       
   117 
       
   118 // -----------------------------------------------------------------------------
       
   119 // LoadHeadersL
       
   120 // -----------------------------------------------------------------------------
       
   121 //
       
   122 void CUniMmsPlugin::LoadHeadersL( CMsvStore* aStore )
       
   123     {
       
   124     UNILOGGER_ENTERFN("CUniMmsPlugin::LoadHeadersL");  
       
   125     delete iMmsHeader;
       
   126     iMmsHeader = NULL;
       
   127 	iMmsHeader = CMmsHeaders::NewL();
       
   128 	if ( aStore && aStore->IsPresentL( KUidMmsHeaderStream ) )
       
   129 	    {
       
   130     	iMmsHeader->RestoreL( *aStore );
       
   131 	    }
       
   132     else
       
   133         {
       
   134         CMmsSettings* settings = CMmsSettings::NewL();
       
   135         CleanupStack::PushL( settings );
       
   136         settings->LoadSettingsL();
       
   137         iMmsHeader->SetSettings( settings );
       
   138         CleanupStack::PopAndDestroy( settings );
       
   139         }
       
   140     UNILOGGER_LEAVEFN("CUniSmsPlugin::LoadHeadersL"); 
       
   141     }
       
   142 
       
   143 // -----------------------------------------------------------------------------
       
   144 // SaveHeadersL
       
   145 // -----------------------------------------------------------------------------
       
   146 //
       
   147 void CUniMmsPlugin::SaveHeadersL( CMsvStore& aStore )
       
   148     {
       
   149     if ( iMmsHeader )
       
   150         {
       
   151         iMmsHeader->StoreL( aStore );
       
   152         }
       
   153     }
       
   154 
       
   155 // -----------------------------------------------------------------------------
       
   156 // ConvertFromL
       
   157 // -----------------------------------------------------------------------------
       
   158 //
       
   159 TMsvId CUniMmsPlugin::ConvertFromL( TMsvId aId )
       
   160     {
       
   161     UNILOGGER_ENTERFN("CUniMmsPlugin::ConvertFromL");
       
   162     MmsMtmL()->SwitchCurrentEntryL( aId );
       
   163     MmsMtmL()->LoadMessageL();
       
   164     iUniMtm.SwitchCurrentEntryL( aId );
       
   165     iUniMtm.LoadMessageL();
       
   166 
       
   167     // Copy MMS stuff.
       
   168     const CMsvRecipientList& mmsRecipients = MmsMtmL()->AddresseeList();
       
   169     while ( mmsRecipients.Count() )
       
   170         {
       
   171         iUniMtm.AddAddresseeL( 
       
   172             mmsRecipients.Type( 0 ),
       
   173             TMmsGenUtils::PureAddress( mmsRecipients[ 0 ] ),
       
   174             TMmsGenUtils::Alias( mmsRecipients[ 0 ] ) );
       
   175         MmsMtmL()->RemoveAddressee( 0 );
       
   176         }
       
   177     
       
   178     iUniMtm.SetSubjectL( MmsMtmL()->SubjectL() );
       
   179     MmsMtmL()->SetSubjectL( KNullDesC );
       
   180     
       
   181     
       
   182     //Get MMS Client MTM Message root and set it to UniMTM
       
   183     iUniMtm.SetMessageRoot( MmsMtmL()->MessageRootAttachment() );
       
   184     
       
   185     MmsMtmL()->SaveMessageL();
       
   186     iUniMtm.SaveMessageL();
       
   187     
       
   188     TMmsMsvEntry mmsEntry = static_cast<TMmsMsvEntry>( MmsMtmL( )->Entry( ).Entry( ) );
       
   189     
       
   190     TMsvEntry uniEntry = iUniMtm.Entry().Entry();
       
   191     uniEntry.iMtm.iUid = KUidUniMtm;
       
   192 
       
   193 	// Lets convert the bits to Uni mode
       
   194 	TUniMsvEntry::SetForwardedMessage( uniEntry, mmsEntry.IsForwardedMessage( ));
       
   195 	TUniMsvEntry::SetMmsUpload( uniEntry, mmsEntry.iBioType == KUidMsgSubTypeMmsUpload.iUid );
       
   196 	TUniMsvEntry::SetEditorOriented( uniEntry, mmsEntry.EditorOriented( ) );
       
   197 
       
   198     iUniMtm.Entry().ChangeL( uniEntry );
       
   199     UNILOGGER_LEAVEFN("CUniSmsPlugin::ConvertFromL");    
       
   200     return aId;
       
   201     }
       
   202 
       
   203 // -----------------------------------------------------------------------------
       
   204 // ConvertToL
       
   205 // -----------------------------------------------------------------------------
       
   206 //
       
   207 TMsvId CUniMmsPlugin::ConvertToL( TMsvId aId )
       
   208     {
       
   209     UNILOGGER_ENTERFN("CUniMmsPlugin::ConvertToL");
       
   210     MmsMtmL()->SwitchCurrentEntryL( aId );
       
   211     MmsMtmL()->LoadMessageL();
       
   212     iUniMtm.SwitchCurrentEntryL( aId );
       
   213     iUniMtm.LoadMessageL();
       
   214 
       
   215     // Copy MMS stuff.
       
   216     const CMsvRecipientList& uniRecipients = iUniMtm.AddresseeList();
       
   217     while ( uniRecipients.Count() )
       
   218         {
       
   219         MmsMtmL()->AddAddresseeL( 
       
   220             uniRecipients.Type( 0 ),
       
   221             TMmsGenUtils::PureAddress( uniRecipients[ 0 ] ),
       
   222             TMmsGenUtils::Alias( uniRecipients[ 0 ] ) );
       
   223         iUniMtm.RemoveAddressee( 0 );
       
   224         }
       
   225     
       
   226     MmsMtmL()->SetSubjectL( iUniMtm.SubjectL() );
       
   227     iUniMtm.SetSubjectL( KNullDesC );
       
   228     
       
   229     //Let's set the message root to point to smil
       
   230     MmsMtmL()->SetMessageRootL ( iUniMtm.MessageRoot() );
       
   231     
       
   232     iUniMtm.SaveMessageL();
       
   233     MmsMtmL()->SaveMessageL();
       
   234     
       
   235     TMsvEntry uniEntry = iUniMtm.Entry( ).Entry( );
       
   236     TMsvEntry tEntry = MmsMtmL()->Entry().Entry();
       
   237 
       
   238     TBuf<KMaxDetailsLength> detailsBuf;
       
   239     MakeDetailsL( detailsBuf );
       
   240     tEntry.iDetails.Set( detailsBuf );
       
   241     
       
   242     tEntry.iMtm.iUid = KSenduiMtmMmsUidValue;
       
   243     
       
   244 	// Lets convert the bits to mms mode
       
   245     TMmsMsvEntry mmsEntry = static_cast<TMmsMsvEntry>( tEntry );
       
   246     mmsEntry.SetForwardedMessage( TUniMsvEntry::IsForwardedMessage( uniEntry ) );
       
   247     mmsEntry.SetEditorOriented( TUniMsvEntry::IsEditorOriented( uniEntry ) );
       
   248     if( TUniMsvEntry::IsMmsUpload( uniEntry ) )
       
   249     	{
       
   250 	    mmsEntry.iBioType = KUidMsgSubTypeMmsUpload.iUid; 
       
   251     	}
       
   252     
       
   253     MmsMtmL()->Entry().ChangeL( mmsEntry );
       
   254     UNILOGGER_LEAVEFN("CUniSmsPlugin::ConvertToL");    
       
   255     return aId;
       
   256     }
       
   257 
       
   258 // -----------------------------------------------------------------------------
       
   259 // CreateReplyL
       
   260 // -----------------------------------------------------------------------------
       
   261 //
       
   262 TMsvId CUniMmsPlugin::CreateReplyL( TMsvId aSrc, TMsvId aDest, TMsvPartList aParts )
       
   263     {
       
   264     return DoCreateReplyOrForwardL( ETrue, aSrc, aDest, aParts );
       
   265     }
       
   266 
       
   267 // -----------------------------------------------------------------------------
       
   268 // CreateForwardL
       
   269 // -----------------------------------------------------------------------------
       
   270 //
       
   271 TMsvId CUniMmsPlugin::CreateForwardL( TMsvId aSrc, TMsvId aDest, TMsvPartList aParts )
       
   272     {
       
   273     return DoCreateReplyOrForwardL( EFalse, aSrc, aDest, aParts );
       
   274     }
       
   275    
       
   276 // -----------------------------------------------------------------------------
       
   277 // SendL
       
   278 // -----------------------------------------------------------------------------
       
   279 //
       
   280 void CUniMmsPlugin::SendL( TMsvId aId )
       
   281     {
       
   282     MmsMtmL()->SwitchCurrentEntryL( aId );
       
   283     MmsMtmL()->LoadMessageL();
       
   284     CMuiuOperationWait* wait = CMuiuOperationWait::NewLC();
       
   285     CMsvOperation* oper = MmsMtmL()->SendL( wait->iStatus );
       
   286     CleanupStack::PushL( oper );
       
   287     wait->Start();
       
   288     CleanupStack::PopAndDestroy( oper );
       
   289     CleanupStack::PopAndDestroy( wait );
       
   290     }
       
   291 
       
   292 // -----------------------------------------------------------------------------
       
   293 // ValidateServiceL
       
   294 // -----------------------------------------------------------------------------
       
   295 //
       
   296 TBool CUniMmsPlugin::ValidateServiceL( TBool /*aEmailOverSms*/ )
       
   297     {
       
   298     TMsvId service = MmsMtmL()->DefaultServiceL();
       
   299     TBool valid( MmsMtmL()->ValidateService( service ) == KErrNone );
       
   300     if ( !valid )
       
   301         {
       
   302         iFileParse.Set( KUniMmsPluginResourceFile, &KDC_RESOURCE_FILES_DIR, NULL );
       
   303    
       
   304         iFileName = iFileParse.FullName();
       
   305     
       
   306         CEikonEnv* env = CEikonEnv::Static( );
       
   307      
       
   308         BaflUtils::NearestLanguageFile( env->FsSession(), iFileName );
       
   309      
       
   310         iResourceOffset = env->AddResourceFileL( iFileName );
       
   311         //First, a confirmation query must be shown  
       
   312         CAknQueryDialog* settingsNotOkQuery = CAknQueryDialog::NewL();
       
   313         if ( settingsNotOkQuery->ExecuteLD( R_UNIEDITOR_QUERY_AP_ERROR ) )
       
   314             {
       
   315             EditAccessPointL();
       
   316             valid = ( MmsMtmL()->ValidateService( service ) == KErrNone );	
       
   317             }
       
   318        env->DeleteResourceFile( iResourceOffset );    
       
   319        iResourceOffset = 0;    
       
   320        }
       
   321     return valid;
       
   322     }
       
   323 
       
   324 
       
   325 // ---------------------------------------------------------
       
   326 // EditAccessPointL
       
   327 // ---------------------------------------------------------
       
   328 //
       
   329 void CUniMmsPlugin::EditAccessPointL()
       
   330     {
       
   331     if ( !iMmsSettings )
       
   332         {
       
   333         iMmsSettings = CMmsSettings::NewL();
       
   334         }
       
   335     MmsMtmL()->RestoreSettingsL();
       
   336     iMmsSettings->CopyL( MmsMtmL()->MmsSettings() );
       
   337 
       
   338     if ( !iCommsDb )
       
   339         {
       
   340         iCommsDb = CCommsDatabase::NewL( EDatabaseTypeIAP );
       
   341         }
       
   342 
       
   343     TUint32 currentAp = iMmsSettings->AccessPointCount()
       
   344         ? iMmsSettings->AccessPoint( 0 )
       
   345         : KMaxTUint32; // Invalid value
       
   346     TUint32 selectedAp( KMaxTUint32 );
       
   347     
       
   348     // Ignore return value...
       
   349     MmsApSelect::SelectMmsAccessPointL(
       
   350         *iCommsDb,
       
   351         currentAp,
       
   352         selectedAp,
       
   353         EApBearerTypeGPRS );
       
   354 
       
   355     if ( selectedAp != KMaxTUint32 &&
       
   356         selectedAp != currentAp )
       
   357         {
       
   358         // Ap was changed.
       
   359         while ( iMmsSettings->AccessPointCount() )
       
   360             {
       
   361             iMmsSettings->DeleteAccessPointL( 0 );
       
   362             }
       
   363         if ( selectedAp != 0 )
       
   364             {
       
   365             // Something else than "None" selected.
       
   366             iMmsSettings->AddAccessPointL( selectedAp, 0 );
       
   367             }
       
   368         MmsMtmL()->SetSettingsL( *iMmsSettings );
       
   369         MmsMtmL()->StoreSettingsL();
       
   370         }
       
   371     }
       
   372 
       
   373 // -----------------------------------------------------------------------------
       
   374 // GetSendingSettingsL
       
   375 // -----------------------------------------------------------------------------
       
   376 //
       
   377 void CUniMmsPlugin::GetSendingSettingsL( TUniSendingSettings& aSettings )
       
   378     {
       
   379     // Modify only the settings this mtm plugin supports
       
   380     switch ( iMmsHeader->MessagePriority() )
       
   381         {
       
   382         case EMmsPriorityLow:
       
   383             aSettings.iPriority = TUniSendingSettings::EUniPriorityLow;
       
   384             break;
       
   385         case EMmsPriorityHigh:
       
   386             aSettings.iPriority = TUniSendingSettings::EUniPriorityHigh;
       
   387             break;
       
   388         case EMmsPriorityNormal:
       
   389         default:
       
   390             aSettings.iPriority = TUniSendingSettings::EUniPriorityNormal;
       
   391             break;
       
   392         }
       
   393 
       
   394     aSettings.iDeliveryReport = iMmsHeader->DeliveryReport();
       
   395 
       
   396     switch ( iMmsHeader->ExpiryInterval() )
       
   397         {
       
   398         case KUniMmsValidityPeriod1h:
       
   399             aSettings.iValidityPeriod = TUniSendingSettings::EUniValidityPeriod1h;
       
   400             break;
       
   401         case KUniMmsValidityPeriod6h:
       
   402             aSettings.iValidityPeriod = TUniSendingSettings::EUniValidityPeriod6h;
       
   403             break;
       
   404         case KUniMmsValidityPeriod3Days:
       
   405             aSettings.iValidityPeriod = TUniSendingSettings::EUniValidityPeriod3Days;
       
   406             break;
       
   407         case KUniMmsValidityPeriodWeek:
       
   408             aSettings.iValidityPeriod = TUniSendingSettings::EUniValidityPeriodWeek;
       
   409             break;
       
   410         case KUniMmsValidityPeriodMax:
       
   411             aSettings.iValidityPeriod = TUniSendingSettings::EUniValidityPeriodMax;
       
   412             break;
       
   413         default: // default to 24h
       
   414         case KUniMmsValidityPeriod24h:
       
   415             aSettings.iValidityPeriod = TUniSendingSettings::EUniValidityPeriod24h;
       
   416             break;
       
   417         }
       
   418     }
       
   419     
       
   420 // -----------------------------------------------------------------------------
       
   421 // SetSendingSettingsL
       
   422 // -----------------------------------------------------------------------------
       
   423 //
       
   424 void CUniMmsPlugin::SetSendingSettingsL( TUniSendingSettings& aSettings )
       
   425     {
       
   426     switch ( aSettings.iPriority )
       
   427         {
       
   428         case TUniSendingSettings::EUniPriorityLow:
       
   429             iMmsHeader->SetMessagePriority( EMmsPriorityLow );
       
   430             break;
       
   431         case TUniSendingSettings::EUniPriorityHigh:
       
   432             iMmsHeader->SetMessagePriority( EMmsPriorityHigh );
       
   433             break;
       
   434         case TUniSendingSettings::EUniPriorityNormal:
       
   435         default:
       
   436             iMmsHeader->SetMessagePriority( EMmsPriorityNormal );
       
   437             break;
       
   438         }
       
   439     }
       
   440 
       
   441 // -----------------------------------------------------------------------------
       
   442 // IsServiceValidL
       
   443 // -----------------------------------------------------------------------------
       
   444 //
       
   445 TBool CUniMmsPlugin::IsServiceValidL()
       
   446     {
       
   447     return MmsMtmL()->ValidateService( MmsMtmL()->DefaultServiceL() ) == KErrNone;
       
   448     }
       
   449 
       
   450 // -----------------------------------------------------------------------------
       
   451 // MmsMtmL
       
   452 // -----------------------------------------------------------------------------
       
   453 //
       
   454 CMmsClientMtm* CUniMmsPlugin::MmsMtmL()
       
   455     {
       
   456     if ( !iMmsMtm )
       
   457         {
       
   458         if ( !iMtmRegistry )
       
   459             {            
       
   460             iMtmRegistry = CClientMtmRegistry::NewL( iSession );
       
   461             }
       
   462         iMmsMtm = static_cast<CMmsClientMtm*>( iMtmRegistry->NewMtmL( KSenduiMtmMmsUid ) );
       
   463         }
       
   464     return iMmsMtm;
       
   465     }
       
   466 
       
   467 // -----------------------------------------------------------------------------
       
   468 // DoCreateReplyOrForwardL
       
   469 // -----------------------------------------------------------------------------
       
   470 //
       
   471 TMsvId CUniMmsPlugin::DoCreateReplyOrForwardL( TBool aReply, 
       
   472                                                TMsvId aSrc, 
       
   473                                                TMsvId aDest, 
       
   474                                                TMsvPartList aParts )
       
   475     {
       
   476     MmsMtmL()->SwitchCurrentEntryL( aSrc );
       
   477     
       
   478     CMuiuOperationWait* wait = CMuiuOperationWait::NewLC();
       
   479     
       
   480     CMsvOperation* oper = aReply
       
   481         ? MmsMtmL()->ReplyL( aDest, aParts, wait->iStatus )
       
   482         : MmsMtmL()->ForwardL( aDest, aParts, wait->iStatus );
       
   483         
       
   484     CleanupStack::PushL( oper );
       
   485     wait->Start();
       
   486 
       
   487     TMsvId newId;
       
   488     TPckgC<TMsvId> paramPack( newId );
       
   489     const TDesC8& progress = oper->FinalProgress();
       
   490     paramPack.Set( progress );
       
   491     newId = paramPack();
       
   492     CleanupStack::PopAndDestroy( oper );
       
   493     CleanupStack::PopAndDestroy( wait );
       
   494     return ConvertFromL( newId );   
       
   495     }
       
   496 
       
   497 // ---------------------------------------------------------
       
   498 // MakeDetails
       
   499 // ---------------------------------------------------------
       
   500 //
       
   501 void CUniMmsPlugin::MakeDetailsL( TDes& aDetails )
       
   502     {
       
   503     // This very same code can be found in CUniAddressHandler. 
       
   504     // They should be put in common location some day...
       
   505     const CMsvRecipientList& addresses = MmsMtmL()->AddresseeList();
       
   506     TInt addrCnt = addresses.Count();
       
   507 
       
   508     TPtrC stringToAdd;
       
   509     for ( TInt i = 0; i < addrCnt; i++)
       
   510         {
       
   511         // Only address is converted to western. 
       
   512         // There may numbers in contact name - they must not be converted 
       
   513         TPtrC alias = TMmsGenUtils::Alias( addresses[i] );
       
   514         HBufC* addressBuf = NULL;
       
   515         
       
   516         if ( alias.Length() != 0 )
       
   517             {
       
   518             stringToAdd.Set( alias );
       
   519             }
       
   520         else
       
   521             {
       
   522             TPtrC address = TMmsGenUtils::PureAddress( addresses[i] );
       
   523             addressBuf = HBufC::NewLC( address.Length() );
       
   524             TPtr addressPtr = addressBuf->Des();
       
   525             addressPtr.Copy( address );
       
   526             stringToAdd.Set( addressPtr );
       
   527 
       
   528             // Internal data structures always holds the address data in western format.
       
   529             // UI is responsible of doing language specific conversions.    
       
   530             AknTextUtils::ConvertDigitsTo( addressPtr, EDigitTypeWestern );      
       
   531             }
       
   532         
       
   533         if ( ( aDetails.Length() != 0 ) &&   // Not a first address
       
   534              ( aDetails.Length() + KAddressSeparator().Length() < KMaxDetailsLength ) )
       
   535             {
       
   536             // Add separator
       
   537             aDetails.Append( KAddressSeparator() );
       
   538             }
       
   539 
       
   540         if ( aDetails.Length() + stringToAdd.Length() < KMaxDetailsLength ) 
       
   541             {
       
   542             // whole string fits. Add it.
       
   543             aDetails.Append( stringToAdd );
       
   544             if ( addressBuf )
       
   545                 {
       
   546                 CleanupStack::PopAndDestroy( addressBuf );
       
   547                 }
       
   548             }
       
   549         else
       
   550             {
       
   551             // Only part of the string fits
       
   552             TInt charsToAdd = KMaxDetailsLength - aDetails.Length();
       
   553 
       
   554             if ( charsToAdd <= 0 )
       
   555                 {
       
   556                 // Cannot add any more chars 
       
   557                 break;
       
   558                 }
       
   559 
       
   560             if ( charsToAdd >= stringToAdd.Length() )
       
   561                 {
       
   562                 // Guarantee that charsToAdd is not larger that stringToAdd lenght 
       
   563                 charsToAdd = stringToAdd.Length();
       
   564                 }
       
   565 
       
   566             aDetails.Append( stringToAdd.Left( charsToAdd ) );
       
   567             if ( addressBuf )
       
   568                 {
       
   569                 CleanupStack::PopAndDestroy( addressBuf );
       
   570                 }
       
   571             break;
       
   572             }
       
   573         }
       
   574     }
       
   575 
       
   576 // ========================== OTHER EXPORTED FUNCTIONS =========================
       
   577 
       
   578 // -----------------------------------------------------------------------------
       
   579 // ImplementationProxy
       
   580 // -----------------------------------------------------------------------------
       
   581 //
       
   582 EXPORT_C const TImplementationProxy* ImplementationGroupProxy( TInt& aTableCount )
       
   583 	{
       
   584 	aTableCount = sizeof( KImplementationTable ) / sizeof( TImplementationProxy );
       
   585 	return KImplementationTable;
       
   586 	}
       
   587 
       
   588 //------------------------------------------------------------------------------
       
   589 // CUniMmsPlugin::SetEncodingSetings
       
   590 // Turkish SMS-PREQ2265 Specific
       
   591 // To Set encoding settings like encoding type, character support
       
   592 // and alternative encoding if any
       
   593 //------------------------------------------------------------------------------
       
   594 void CUniMmsPlugin::SetEncodingSettings(TBool aUnicodeMode, TSmsEncoding aAlternativeEncodingType, TInt aCharSupportType)
       
   595     {
       
   596     //Do nothing for MMS.
       
   597     }
       
   598 
       
   599 //------------------------------------------------------------------------------
       
   600 // CUniMmsPlugin::GetNumPDUs
       
   601 // Turkish SMS-PREQ2265 Specific
       
   602 // To get PDU Info: extracts details of number of PDUs, number of remaining chars in last PDU
       
   603 // and encoding types used.
       
   604 //------------------------------------------------------------------------------
       
   605 void CUniMmsPlugin::GetNumPDUsL (
       
   606         TDesC& aBuf,
       
   607         TInt& aNumOfRemainingChars,
       
   608         TInt& aNumOfPDUs,
       
   609         TBool& aUnicodeMode, 
       
   610         TSmsEncoding& aAlternativeEncodingType)
       
   611     {
       
   612     //Do nothing for MMS
       
   613     }
       
   614 
       
   615 //  End of File