emailservices/emailclientapi/src/emailmessage.cpp
branchRCL_3
changeset 64 3533d4323edc
parent 63 d189ee25cf9d
equal deleted inserted replaced
63:d189ee25cf9d 64:3533d4323edc
     1 /*
     1 /*
     2 * Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). 
     2 * Copyright (c) 2009 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".
    31 #include "emailinterfacefactoryimpl.h"
    31 #include "emailinterfacefactoryimpl.h"
    32 #include "emailcontent.h"
    32 #include "emailcontent.h"
    33 #include "emailtextcontent.h"
    33 #include "emailtextcontent.h"
    34 #include "emailmultipart.h"
    34 #include "emailmultipart.h"
    35 #include "emailattachment.h"
    35 #include "emailattachment.h"
    36 #include "CFSMailPlugin.h"
    36 #include "cfsmailplugin.h"
    37 #include "CFSMailClient.h"
    37 #include "FreestyleEmailUiConstants.h"
    38 
    38 #include "cfsmailclient.h"
    39 #include <xqservicerequest.h>
       
    40 #include "email_services_api.h"
       
    41 
       
    42 const TInt KSendMessageRequestId = 100;
       
    43 
    39 
    44 // -----------------------------------------------------------------------------
    40 // -----------------------------------------------------------------------------
    45 // 
    41 // 
    46 // -----------------------------------------------------------------------------
    42 // -----------------------------------------------------------------------------
    47 CEmailMessage* CEmailMessage::NewL( CPluginData& aPluginData,
    43 CEmailMessage* CEmailMessage::NewL( CPluginData& aPluginData,
    49                                     const TDataOwner aOwner )
    45                                     const TDataOwner aOwner )
    50     {
    46     {
    51     CEmailMessage* message = new ( ELeave ) CEmailMessage( aPluginData, aFsMessage, aOwner );
    47     CEmailMessage* message = new ( ELeave ) CEmailMessage( aPluginData, aFsMessage, aOwner );
    52     CleanupStack::PushL( message );
    48     CleanupStack::PushL( message );
    53     message->ConstructL();
    49     message->ConstructL();
    54     CleanupStack::Pop( message );
    50     CleanupStack::Pop();
    55     return message;
    51     return message;
    56     }
    52     }
    57 
    53     
    58 // -----------------------------------------------------------------------------
    54 // -----------------------------------------------------------------------------
    59 // 
    55 // 
    60 // -----------------------------------------------------------------------------
    56 // -----------------------------------------------------------------------------
    61 CEmailMessage::CEmailMessage(
    57 CEmailMessage::CEmailMessage( 
    62         CPluginData& aPluginData,
    58         CPluginData& aPluginData,
    63         CFSMailMessage *aFsMessage,
    59         CFSMailMessage *aFsMessage,
    64         const TDataOwner aOwner)
    60         const TDataOwner aOwner)
    65         : iPluginData( aPluginData ), iPluginMessage( aFsMessage ), iOwner( aOwner )
    61         : iPluginData( aPluginData ), iPluginMessage( aFsMessage ), iOwner( aOwner )
    66     {
    62     {
    68 
    64 
    69 // -----------------------------------------------------------------------------
    65 // -----------------------------------------------------------------------------
    70 // 
    66 // 
    71 // -----------------------------------------------------------------------------
    67 // -----------------------------------------------------------------------------
    72 void CEmailMessage::ConstructL()
    68 void CEmailMessage::ConstructL()
    73     {
    69     {    
    74     User::LeaveIfNull( iPluginMessage );
       
    75     iPlugin = iPluginData.ClaimInstanceL();
    70     iPlugin = iPluginData.ClaimInstanceL();
    76     if ( iPluginMessage )
    71     if ( iPluginMessage )
    77         {
    72         {
    78         iMessageId = TMessageId( 
    73         iMessageId = TMessageId( 
    79             iPluginMessage->GetMessageId().Id(),
    74             iPluginMessage->GetMessageId().Id(),
    80             iPluginMessage->GetFolderId().Id(), 
    75             iPluginMessage->GetFolderId().Id(), 
    81             iPluginMessage->GetMailBoxId().Id() );
    76             iPluginMessage->GetMailBoxId().Id() );
    82 
    77         
    83         // Copy the message flags
    78         // Copy the message flags
    84         InitializeFlagValues();
    79         InitializeFlagValues();
    85         }
    80         }
    86     }
    81     }
    87 
    82 
    88 // -----------------------------------------------------------------------------
    83 // -----------------------------------------------------------------------------
    89 // 
    84 // 
    90 // -----------------------------------------------------------------------------
    85 // -----------------------------------------------------------------------------
    91 CEmailMessage::~CEmailMessage()
    86 CEmailMessage::~CEmailMessage()
    92     {
    87     {
    93     delete iPluginMessage;
    88     delete iPluginMessage;    
    94     delete iSender;
    89     delete iSender;
    95     delete iReplyTo;
    90     delete iReplyTo;
    96     delete iTextContent;
    91     delete iTextContent;
    97     delete iContent;
    92     delete iContent;
    98     iPluginData.ReleaseInstance();
    93     iPluginData.ReleaseInstance();
   112 // -----------------------------------------------------------------------------
   107 // -----------------------------------------------------------------------------
   113 void CEmailMessage::Release()
   108 void CEmailMessage::Release()
   114     {
   109     {
   115     if ( iOwner == EClientOwns )
   110     if ( iOwner == EClientOwns )
   116         {
   111         {
   117         delete this;
   112         delete this;        
   118         }
   113         }
   119     }
   114     }
   120 
   115     
   121 // -----------------------------------------------------------------------------
   116 // -----------------------------------------------------------------------------
   122 // 
   117 // 
   123 // -----------------------------------------------------------------------------
   118 // -----------------------------------------------------------------------------
   124 const TMessageId& CEmailMessage::MessageId() const
   119 const TMessageId& CEmailMessage::MessageId() const
   125     {
   120     {
   126     return iMessageId;
   121     return iMessageId;
   127     }
   122     }
   128 
   123     
   129 // -----------------------------------------------------------------------------
   124 // -----------------------------------------------------------------------------
   130 // 
   125 // 
   131 // -----------------------------------------------------------------------------
   126 // -----------------------------------------------------------------------------
   132 MEmailAddress* CEmailMessage::SenderAddressL() const
   127 MEmailAddress* CEmailMessage::SenderAddressL() const
   133     {
   128     {
   134     User::LeaveIfNull( iPluginMessage );
       
   135 
       
   136     CFSMailAddress* fsAddress = iPluginMessage->GetSender();
   129     CFSMailAddress* fsAddress = iPluginMessage->GetSender();
   137     if ( fsAddress )
   130     if (fsAddress)
   138         {
   131         {
   139         if ( !iSender )
   132         if (!iSender)
   140             {
   133             {
   141             iSender = CEmailAddress::NewL( MEmailAddress::ESender, EAPIOwns );
   134             iSender = CEmailAddress::NewL( MEmailAddress::ESender, EAPIOwns );
   142             }
   135             }
   143         iSender->SetAddressL(fsAddress->GetEmailAddress());
   136         iSender->SetAddressL(fsAddress->GetEmailAddress());
   144         iSender->SetDisplayNameL(fsAddress->GetDisplayName());
   137         iSender->SetDisplayNameL(fsAddress->GetDisplayName());
   149         delete iSender;
   142         delete iSender;
   150         iSender = NULL;
   143         iSender = NULL;
   151         }
   144         }
   152     return iSender;
   145     return iSender;
   153     }
   146     }
   154 
   147     
   155 // -----------------------------------------------------------------------------
   148 // -----------------------------------------------------------------------------
   156 // 
   149 // 
   157 // -----------------------------------------------------------------------------
   150 // -----------------------------------------------------------------------------
   158 MEmailAddress* CEmailMessage::ReplyToAddressL() const
   151 MEmailAddress* CEmailMessage::ReplyToAddressL() const
   159     {
   152     {
   160     User::LeaveIfNull( iPluginMessage );
       
   161 
       
   162     const CFSMailAddress& fsAddress = iPluginMessage->GetReplyToAddress();
   153     const CFSMailAddress& fsAddress = iPluginMessage->GetReplyToAddress();
   163     if ( &fsAddress )
   154     if ( &fsAddress )
   164         {
   155         {
   165         if ( !iReplyTo )
   156         if (!iReplyTo)
   166             {
   157             {
   167             iReplyTo = CEmailAddress::NewL( MEmailAddress::EReplyTo, EAPIOwns );
   158             iReplyTo = CEmailAddress::NewL( MEmailAddress::EReplyTo, EAPIOwns );
   168             }
   159             }
   169         iReplyTo->SetAddressL( fsAddress.GetEmailAddress() );
   160         iReplyTo->SetAddressL( fsAddress.GetEmailAddress() );
   170         iReplyTo->SetDisplayNameL( fsAddress.GetDisplayName() );
   161         iReplyTo->SetDisplayNameL( fsAddress.GetDisplayName() );
   174         delete iReplyTo;
   165         delete iReplyTo;
   175         iReplyTo = NULL;
   166         iReplyTo = NULL;
   176         }
   167         }
   177     return iReplyTo;
   168     return iReplyTo;
   178     }
   169     }
   179 
   170     
   180 // -----------------------------------------------------------------------------
   171 // -----------------------------------------------------------------------------
   181 // 
   172 // 
   182 // -----------------------------------------------------------------------------
   173 // -----------------------------------------------------------------------------
   183 void CEmailMessage::SetReplyToAddressL( const MEmailAddress& aSender )
   174 void CEmailMessage::SetReplyToAddressL( const MEmailAddress& aSender )
   184     {
   175     {
   185     User::LeaveIfNull( iPluginMessage );
       
   186     
       
   187     CFSMailAddress *fsAddress = CFSMailAddress::NewLC();
   176     CFSMailAddress *fsAddress = CFSMailAddress::NewLC();
   188     if ( !iReplyTo )
   177     if (!iReplyTo)
   189         {
   178         {
   190         iReplyTo = CEmailAddress::NewL( MEmailAddress::EReplyTo, EAPIOwns );
   179         iReplyTo = CEmailAddress::NewL( MEmailAddress::EReplyTo, EAPIOwns);
   191         }
   180         }
   192     fsAddress->SetDisplayName( aSender.DisplayName() );
   181     fsAddress->SetDisplayName( aSender.DisplayName() );
   193     fsAddress->SetEmailAddress( aSender.Address() );
   182     fsAddress->SetEmailAddress( aSender.Address() );
   194     iPluginMessage->SetReplyToAddress( fsAddress );
   183     iPluginMessage->SetReplyToAddress( fsAddress );
   195     iReplyTo->SetAddressL( fsAddress->GetEmailAddress() );
   184     iReplyTo->SetAddressL( fsAddress->GetEmailAddress() );
   196     iReplyTo->SetDisplayNameL( fsAddress->GetDisplayName() );
   185     iReplyTo->SetDisplayNameL( fsAddress->GetDisplayName() );
   197     CleanupStack::Pop();
   186     CleanupStack::Pop();
   198     }
   187     }       
   199 
   188     
   200 // -----------------------------------------------------------------------------
   189 // -----------------------------------------------------------------------------
   201 // 
   190 // 
   202 // -----------------------------------------------------------------------------
   191 // -----------------------------------------------------------------------------
   203 TInt CEmailMessage::GetRecipientsL( const MEmailAddress::TRole aRole,
   192 TInt CEmailMessage::GetRecipientsL( const MEmailAddress::TRole aRole,
   204         REmailAddressArray& aRecipients ) const
   193         REmailAddressArray& aRecipients ) const
   205     {
   194     {
   206     if( aRole == MEmailAddress::EReplyTo ||
   195     if( aRole == MEmailAddress::EReplyTo ||
   207         aRole == MEmailAddress::ESender )
   196         aRole == MEmailAddress::ESender    )
   208         {
   197         {
   209         User::Leave( KErrArgument );
   198         User::Leave( KErrArgument );
   210         }
   199         }
   211     else 
   200     else
   212         {
   201         {
   213         User::LeaveIfNull( iPluginMessage );
       
   214         
       
   215         if( aRole == MEmailAddress::ETo || 
   202         if( aRole == MEmailAddress::ETo || 
   216             aRole == MEmailAddress::EUndefined )
   203             aRole == MEmailAddress::EUndefined )
   217             {
   204             {
   218             const RPointerArray<CFSMailAddress>& toRecipients =
   205             RPointerArray<CFSMailAddress>& toRecipients = 
   219                 iPluginMessage->GetToRecipients();
   206                 iPluginMessage->GetToRecipients();
   220             ConvertAddressArrayL( 
   207             ConvertAddressArrayL( 
   221                     MEmailAddress::ETo, 
   208                     MEmailAddress::ETo, 
   222                     toRecipients, aRecipients );
   209                     toRecipients, aRecipients );
   223             }
   210             }
   224         if( aRole == MEmailAddress::ECc || 
   211         if( aRole == MEmailAddress::ECc || 
   225             aRole == MEmailAddress::EUndefined )
   212             aRole == MEmailAddress::EUndefined )
   226             {
   213             {
   227             const RPointerArray<CFSMailAddress>& ccRecipients =
   214             RPointerArray<CFSMailAddress>& ccRecipients = 
   228                 iPluginMessage->GetCCRecipients();
   215                 iPluginMessage->GetCCRecipients();
   229             ConvertAddressArrayL( 
   216             ConvertAddressArrayL( 
   230                     MEmailAddress::ECc, 
   217                     MEmailAddress::ECc, 
   231                     ccRecipients, aRecipients );
   218                     ccRecipients, aRecipients );
   232             }
   219             }
   233         if( aRole == MEmailAddress::EBcc || 
   220         if( aRole == MEmailAddress::EBcc || 
   234             aRole == MEmailAddress::EUndefined )
   221             aRole == MEmailAddress::EUndefined )
   235             {
   222             {
   236             const RPointerArray<CFSMailAddress>& bccRecipients =
   223             RPointerArray<CFSMailAddress>& bccRecipients = 
   237                 iPluginMessage->GetBCCRecipients();
   224                 iPluginMessage->GetBCCRecipients();
   238             ConvertAddressArrayL( 
   225             ConvertAddressArrayL( 
   239                     MEmailAddress::EBcc, 
   226                     MEmailAddress::EBcc, 
   240                     bccRecipients, aRecipients );
   227                     bccRecipients, aRecipients );
   241             }
   228             }
   242         }
   229         }
   243     return aRecipients.Count();
   230     return aRecipients.Count();
   244     }
   231     }            
   245     
   232     
   246 // -----------------------------------------------------------------------------
   233 // -----------------------------------------------------------------------------
   247 // 
   234 // 
   248 // -----------------------------------------------------------------------------
   235 // -----------------------------------------------------------------------------
   249 void CEmailMessage::SetRecipientsL( const MEmailAddress::TRole aRole,
   236 void CEmailMessage::SetRecipientsL( const MEmailAddress::TRole aRole, 
   250         REmailAddressArray& aRecipients )
   237         REmailAddressArray& aRecipients )
   251     {
   238     {
   252     TInt count( aRecipients.Count() );
   239     TInt count( aRecipients.Count() );
   253 
   240     
   254     for( TInt i=0;i<count;i++ )
   241     for( TInt i=0;i<count;i++ )
   255         {
   242         {
   256         const MEmailAddress* address = aRecipients[i];
   243         const MEmailAddress* address = aRecipients[i];
   257         CFSMailAddress* fsAddress = CFSMailAddress::NewLC();
   244         CFSMailAddress* fsAddress = CFSMailAddress::NewLC();
   258         fsAddress->SetEmailAddress( address->Address() );
   245         fsAddress->SetEmailAddress( address->Address() );
   259         fsAddress->SetDisplayName( address->DisplayName() );
   246         fsAddress->SetDisplayName( address->DisplayName() );
   260         
   247         
   261         User::LeaveIfNull( iPluginMessage );
       
   262         
       
   263         if( aRole == MEmailAddress::ETo )
   248         if( aRole == MEmailAddress::ETo )
   264             {
   249             {
   265             iPluginMessage->AppendToRecipient( fsAddress );
   250             iPluginMessage->AppendToRecipient( fsAddress );
   266             }
   251             }
   267         else if( aRole == MEmailAddress::ECc )
   252         else if( aRole == MEmailAddress::ECc )
   277             User::Leave( KErrArgument );
   262             User::Leave( KErrArgument );
   278             }
   263             }
   279         CleanupStack::Pop( fsAddress );
   264         CleanupStack::Pop( fsAddress );
   280         }
   265         }
   281     }
   266     }
   282 
   267     
   283 // -----------------------------------------------------------------------------
   268 // -----------------------------------------------------------------------------
   284 // 
   269 // 
   285 // -----------------------------------------------------------------------------
   270 // -----------------------------------------------------------------------------
   286 void CEmailMessage::RemoveRecipientL( const MEmailAddress& /*aRecipient*/ )
   271 void CEmailMessage::RemoveRecipientL( const MEmailAddress& aRecipient )
   287     {
   272     {
   288     User::Leave( KErrNotSupported );
   273     TInt err( KErrNotFound );
   289     }
   274     RPointerArray<CFSMailAddress>* recipients = NULL;
   290 
   275 
       
   276     switch (aRecipient.Role())
       
   277         {
       
   278         case MEmailAddress::ETo:
       
   279             recipients = &iPluginMessage->GetToRecipients();
       
   280             break;
       
   281         case MEmailAddress::ECc:
       
   282             recipients = &iPluginMessage->GetCCRecipients();
       
   283             break;
       
   284         case MEmailAddress::EBcc:
       
   285             recipients = &iPluginMessage->GetBCCRecipients();
       
   286             break;
       
   287         default:
       
   288             User::Leave( KErrArgument );
       
   289             break;
       
   290         }
       
   291     
       
   292     for( TInt i = 0; i < recipients->Count(); i++ )
       
   293         {
       
   294         if ( !aRecipient.Address().Compare( (*recipients)[i]->GetEmailAddress() ) )
       
   295             {
       
   296             recipients->Remove(i);
       
   297             err = KErrNone;
       
   298             // We could break now. But let's loop if there are several entries
       
   299             }
       
   300         }
       
   301     User::LeaveIfError( err );
       
   302     }
       
   303     
   291 // -----------------------------------------------------------------------------
   304 // -----------------------------------------------------------------------------
   292 // 
   305 // 
   293 // -----------------------------------------------------------------------------
   306 // -----------------------------------------------------------------------------
   294 TPtrC CEmailMessage::Subject() const
   307 TPtrC CEmailMessage::Subject() const
   295     {
   308     {
   296     if ( !iPluginMessage )
       
   297         return KNullDesC();
       
   298     return iPluginMessage->GetSubject();
   309     return iPluginMessage->GetSubject();
   299     }
   310     }
   300 
   311 
   301 // -----------------------------------------------------------------------------
   312 // -----------------------------------------------------------------------------
   302 // 
   313 // 
   303 // -----------------------------------------------------------------------------
   314 // -----------------------------------------------------------------------------
   304 void  CEmailMessage::SetSubjectL( const TPtrC& aSubject )
   315 void  CEmailMessage::SetSubjectL( const TPtrC& aSubject)
   305     {
   316     {
   306     User::LeaveIfNull( iPluginMessage );
       
   307     iPluginMessage->SetSubject( aSubject );
   317     iPluginMessage->SetSubject( aSubject );
   308     }
   318     }
   309 
   319     
   310 // -----------------------------------------------------------------------------
   320 // -----------------------------------------------------------------------------
   311 // 
   321 // 
   312 // -----------------------------------------------------------------------------
   322 // -----------------------------------------------------------------------------
   313 TTime CEmailMessage::Date() const
   323 TTime CEmailMessage::Date() const
   314     {
   324     {
   315     TTime time;
   325     return iPluginMessage->GetDate();
   316 
       
   317     if ( iPluginMessage ) {
       
   318         time = iPluginMessage->GetDate();
       
   319     }
       
   320 
       
   321     return time;
       
   322     }
   326     }
   323 
   327 
   324 // -----------------------------------------------------------------------------
   328 // -----------------------------------------------------------------------------
   325 // 
   329 // 
   326 // -----------------------------------------------------------------------------
   330 // -----------------------------------------------------------------------------
   334 // -----------------------------------------------------------------------------
   338 // -----------------------------------------------------------------------------
   335 void CEmailMessage::SetFlag( const TUint aFlag )
   339 void CEmailMessage::SetFlag( const TUint aFlag )
   336     {
   340     {
   337     iFlags |= aFlag;
   341     iFlags |= aFlag;
   338     TUint flag = MapFlags( aFlag );
   342     TUint flag = MapFlags( aFlag );
   339     if ( iPluginMessage )
   343     iPluginMessage->SetFlag( flag );
   340         iPluginMessage->SetFlag( flag );
   344     }
   341     }
   345     
   342 
       
   343 // -----------------------------------------------------------------------------
   346 // -----------------------------------------------------------------------------
   344 // 
   347 // 
   345 // -----------------------------------------------------------------------------
   348 // -----------------------------------------------------------------------------
   346 void CEmailMessage::ResetFlag( const TUint aFlag )
   349 void CEmailMessage::ResetFlag( const TUint aFlag )
   347     {
   350     {
   348     iFlags &= ~aFlag;
   351     iFlags &= ~aFlag;
   349     TUint flag = MapFlags( aFlag );
   352     TUint flag = MapFlags( aFlag );
   350     if ( iPluginMessage )
   353     iPluginMessage->ResetFlag( flag );
   351         iPluginMessage->ResetFlag( flag );
       
   352     }
   354     }
   353 
   355 
   354 // -----------------------------------------------------------------------------
   356 // -----------------------------------------------------------------------------
   355 // 
   357 // 
   356 // -----------------------------------------------------------------------------
   358 // -----------------------------------------------------------------------------
   357 void CEmailMessage::InitializeFlagValues()
   359 void CEmailMessage::InitializeFlagValues()
   358     {
   360     {
   359     if ( !iPluginMessage )
       
   360         return;
       
   361     // 1st reset member value, then start copying different flags
   361     // 1st reset member value, then start copying different flags
   362     iFlags = 0;
   362     iFlags = 0;
   363     
   363     
   364     // EFlag_Read
   364     // EFlag_Read
   365     if ( iPluginMessage->IsFlagSet( EFSMsgFlag_Read ) )
   365     if ( iPluginMessage->IsFlagSet( EFSMsgFlag_Read ) )
   492 // -----------------------------------------------------------------------------
   492 // -----------------------------------------------------------------------------
   493 // 
   493 // 
   494 // -----------------------------------------------------------------------------
   494 // -----------------------------------------------------------------------------
   495 MEmailMessageContent* CEmailMessage::ContentL() const
   495 MEmailMessageContent* CEmailMessage::ContentL() const
   496     {
   496     {
   497     if ( iTextContent )
   497     if (iTextContent)
   498         {
   498         {
   499         return iTextContent;
   499         return iTextContent;        
   500         }
   500         }
   501     if ( iContent )
   501     if (iContent)
   502         {
   502         {
   503         return iContent;
   503         return iContent;
   504         }
   504         }
   505 
   505 
   506     User::LeaveIfNull( iPluginMessage );
       
   507     
       
   508     RPointerArray<CFSMailMessagePart> parts;
   506     RPointerArray<CFSMailMessagePart> parts;
   509     CleanupResetAndDestroyPushL( parts );
   507     CleanupResetAndDestroyPushL( parts );
   510     iPluginMessage->ChildPartsL( parts );
   508     iPluginMessage->ChildPartsL( parts );
   511     TInt count( parts.Count() );
   509     TInt count( parts.Count() );
   512     if( count == 0 )
   510     if( count == 0 )
   514         /* No content, return NULL */
   512         /* No content, return NULL */
   515         CleanupStack::PopAndDestroy( &parts ); // in case heap allocated but not used
   513         CleanupStack::PopAndDestroy( &parts ); // in case heap allocated but not used
   516         return NULL;
   514         return NULL;
   517         }
   515         }
   518     CFSMailMessagePart* part = parts[0];
   516     CFSMailMessagePart* part = parts[0];
   519     TContentType contentType( part->GetContentType() );
   517     TContentType contentType( part->GetContentType() ); 
   520     TMessageContentId msgContentId = TMessageContentId(
   518     TMessageContentId msgContentId = TMessageContentId( 
   521                         part->GetPartId().Id(),
   519                         part->GetPartId().Id(),
   522                         iMessageId.iId,
   520                         iMessageId.iId,
   523                         iMessageId.iFolderId.iId,
   521                         iMessageId.iFolderId.iId,
   524                         iMessageId.iFolderId.iMailboxId );
   522                         iMessageId.iFolderId.iMailboxId ); 
   525 
   523 
   526     if ( contentType.Equals( KFSMailContentTypeTextPlain ) ||
   524     if ( contentType.Equals( KFSMailContentTypeTextPlain ) || 
   527         contentType.Equals( KFSMailContentTypeTextHtml ) )
   525         contentType.Equals( KFSMailContentTypeTextHtml ) )
   528         {                                
   526         {                                
   529         iTextContent = CEmailTextContent::NewL(iPluginData, msgContentId, part, EAPIOwns );
   527         iTextContent = CEmailTextContent::NewL(iPluginData, msgContentId, part, EAPIOwns );
   530         parts[0] = NULL; // ownership of part transferred
   528         parts[0] = NULL; // ownership of part transferred
   531         }
   529         }
   538         iContent = CEmailMultipart::NewL(iPluginData, msgContentId, part, EAPIOwns);
   536         iContent = CEmailMultipart::NewL(iPluginData, msgContentId, part, EAPIOwns);
   539         parts[0] = NULL; // ownership of part transferred
   537         parts[0] = NULL; // ownership of part transferred
   540         }
   538         }
   541 
   539 
   542     CleanupStack::PopAndDestroy( &parts ); // parts
   540     CleanupStack::PopAndDestroy( &parts ); // parts
   543 
   541     
   544     if (iTextContent)
   542     if (iTextContent)
   545         {
   543         {
   546         return iTextContent;
   544         return iTextContent;        
   547         }
   545         }
   548     return iContent;
   546     return iContent;
   549     }
   547     }
   550 
   548 
   551 // -----------------------------------------------------------------------------
   549 // -----------------------------------------------------------------------------
   552 // 
   550 // 
   553 // -----------------------------------------------------------------------------
   551 // -----------------------------------------------------------------------------
   554 void CEmailMessage::SetContentL( const MEmailMessageContent*  aContent )
   552 void CEmailMessage::SetContentL( const MEmailMessageContent*  aContent )
   555     {
   553     {
   556     User::LeaveIfNull( aContent );
       
   557     MEmailTextContent* textContent = aContent->AsTextContentOrNull();
   554     MEmailTextContent* textContent = aContent->AsTextContentOrNull();
   558     if ( textContent )
   555     if (textContent)
   559         {
   556         {
   560         if ( iTextContent )
   557         if (iTextContent)
   561             {
   558             {
   562             delete iTextContent; // Destroy old content
   559             delete iTextContent; // Destroy old content
   563             }
   560             }
   564         iTextContent = dynamic_cast<CEmailTextContent*>( textContent );
   561         iTextContent = dynamic_cast<CEmailTextContent*>(textContent);
   565         if ( iTextContent )
   562 		if ( iTextContent )
   566             {
   563 			{
   567             iTextContent->SetOwner( EAPIOwns );
   564 			iTextContent->SetOwner( EAPIOwns );
   568             }
   565 			}
   569         return;
   566         return;
   570         }
   567         }
   571     MEmailMultipart* mPart = aContent->AsMultipartOrNull();
   568     MEmailMultipart* mPart = aContent->AsMultipartOrNull();
   572     if ( mPart )
   569     if (mPart)
   573         {
   570         {
   574         if ( iContent )
   571         if (iContent)
   575             {
   572             {
   576             delete iContent;
   573             delete iContent;
   577             }
   574             }
   578         iContent = dynamic_cast<CEmailMultipart*>( mPart );
   575         iContent = dynamic_cast<CEmailMultipart*>(mPart);
   579         if ( iContent )
   576 		if ( iContent )
   580             {
   577 			{
   581             iContent->SetOwner( EAPIOwns );
   578 			iContent->SetOwner( EAPIOwns );
   582             }
   579 			}
   583         }    
   580         }    
   584     }
   581     }
   585 
   582     
   586 // -----------------------------------------------------------------------------
   583 // -----------------------------------------------------------------------------
   587 // 
   584 // 
   588 // -----------------------------------------------------------------------------
   585 // -----------------------------------------------------------------------------
   589 void CEmailMessage::SetPlainTextBodyL( const TDesC& aPlainText )
   586 void CEmailMessage::SetPlainTextBodyL( const TDesC& aPlainText )
   590     {
   587     {
   591     if ( iTextContent )
   588     if (iTextContent)
   592         {
   589         {
   593         iTextContent->SetTextL( MEmailTextContent::EPlainText, aPlainText );
   590         iTextContent->SetTextL( MEmailTextContent::EPlainText, aPlainText );
   594         return;
   591         return;
   595         }
   592         }
   596 
       
   597     User::LeaveIfNull( iPluginMessage );
       
   598 
       
   599     CFSMailMessagePart* msgTextPart = iPluginMessage->PlainTextBodyPartL();
   593     CFSMailMessagePart* msgTextPart = iPluginMessage->PlainTextBodyPartL();
   600     
   594     
   601     if( !msgTextPart )
   595     if( !msgTextPart )
   602         {
   596         {
   603         msgTextPart = iPluginMessage->NewChildPartL( TFSMailMsgId(), KFSMailContentTypeTextPlain );
   597         msgTextPart = iPluginMessage->NewChildPartL( TFSMailMsgId(), KFSMailContentTypeTextPlain );        
   604         }
   598         }
   605     CleanupStack::PushL( msgTextPart );
   599     CleanupStack::PushL( msgTextPart );
   606 
   600     
   607     TMessageContentId msgContentId = MessageContentId( msgTextPart->GetPartId().Id() );
   601     TMessageContentId msgContentId = TMessageContentId( 
   608 
   602                         msgTextPart->GetPartId().Id(),
   609     msgTextPart->SetContentType( KFSMailContentTypeTextPlain );
   603                         iMessageId.iId,
       
   604                         iMessageId.iFolderId.iId,
       
   605                         iMessageId.iFolderId.iMailboxId );
       
   606     
       
   607     msgTextPart->SetContentType( KFSMailContentTypeTextPlain );    
   610     iTextContent = CEmailTextContent::NewL( iPluginData, msgContentId, msgTextPart, EAPIOwns );
   608     iTextContent = CEmailTextContent::NewL( iPluginData, msgContentId, msgTextPart, EAPIOwns );
   611     if (iTextContent)
   609     if (iTextContent)
   612         {
   610         {
   613         iTextContent->SetTextL( MEmailTextContent::EPlainText, aPlainText );
   611         iTextContent->SetTextL( MEmailTextContent::EPlainText, aPlainText );
   614         }
   612         }
   615     CleanupStack::Pop( msgTextPart );
   613     CleanupStack::Pop(); // msgTextPart
   616 
   614     
   617     return;
   615     return;
   618 
   616     
   619     }
   617     }
   620 
   618 
   621 // -----------------------------------------------------------------------------
   619 // -----------------------------------------------------------------------------
   622 // 
   620 // 
   623 // -----------------------------------------------------------------------------
   621 // -----------------------------------------------------------------------------
   624 MEmailAttachment* CEmailMessage::AddAttachmentL( const TDesC& aFullPath )
   622 MEmailAttachment* CEmailMessage::AddAttachmentL( const TDesC& aFullPath )
   625     {
   623     {
   626     User::LeaveIfNull( iPluginMessage );
   624     CFSMailMessagePart* part = iPluginMessage->AddNewAttachmentL(aFullPath, TFSMailMsgId());
   627 
       
   628     CFSMailMessagePart* part = iPluginMessage->AddNewAttachmentL( aFullPath, TFSMailMsgId() );
       
   629     CleanupStack::PushL( part );    
   625     CleanupStack::PushL( part );    
   630     CEmailAttachment* att = CEmailAttachment::NewLC( iPluginData, iMsgContentId, part, EAPIOwns );
   626     CEmailAttachment* att = CEmailAttachment::NewLC(iPluginData, iMsgContentId, part, EAPIOwns);
   631     iAttachments.AppendL( att );
   627     iAttachments.AppendL( att );
   632     CleanupStack::Pop( 2, part );
   628     CleanupStack::Pop(2); // part, att
   633 
   629     
   634     return att;
   630     return att;
   635     }
   631     }
   636 
   632     
   637 // -----------------------------------------------------------------------------
   633 // -----------------------------------------------------------------------------
   638 // 
   634 // 
   639 // -----------------------------------------------------------------------------
   635 // -----------------------------------------------------------------------------
       
   636 
   640 MEmailAttachment* CEmailMessage::AddAttachmentL( RFile& aFile )
   637 MEmailAttachment* CEmailMessage::AddAttachmentL( RFile& aFile )
   641     {
   638     {
   642     User::LeaveIfNull( iPluginMessage );
       
   643     TBufC8 <1> mime;
   639     TBufC8 <1> mime;
   644     CFSMailMessagePart* part = iPluginMessage->AddNewAttachmentL( aFile, mime );
   640     CFSMailMessagePart* part = iPluginMessage->AddNewAttachmentL(aFile, mime);
   645     CleanupStack::PushL( part );
   641     CleanupStack::PushL( part );
   646     CEmailAttachment* att = CEmailAttachment::NewLC( iPluginData, iMsgContentId, part, EAPIOwns );
   642     CEmailAttachment* att = CEmailAttachment::NewLC(iPluginData, iMsgContentId, part, EAPIOwns);
   647     iAttachments.AppendL( att );
   643     iAttachments.AppendL( att );
   648 
   644     CleanupStack::Pop(2); // part, att
   649     CleanupStack::Pop( 2, part );
   645     
   650 
       
   651     return att;
   646     return att;
   652     }
   647     }
   653 
   648 
   654 // -----------------------------------------------------------------------------
   649 // -----------------------------------------------------------------------------
   655 // 
   650 // 
   656 // -----------------------------------------------------------------------------
   651 // -----------------------------------------------------------------------------
   657 TInt CEmailMessage::GetAttachmentsL( REmailAttachmentArray& aAttachments )
   652 TInt CEmailMessage::GetAttachmentsL( REmailAttachmentArray& aAttachments )
   658     {
   653     {
   659     User::LeaveIfNull( iPluginMessage );
       
   660 
       
   661     RPointerArray<CFSMailMessagePart> attachments;
   654     RPointerArray<CFSMailMessagePart> attachments;
   662     CleanupResetAndDestroyPushL( attachments );
   655     CleanupResetAndDestroyPushL( attachments );
   663     iPluginMessage->AttachmentListL( attachments );
   656     iPluginMessage->AttachmentListL(attachments);
   664     const TInt count( attachments.Count() );
   657     const TInt count( attachments.Count() );
   665     for (TInt i = 0; i < count; i++)
   658     for (TInt i = 0; i < count; i++)
   666         {
   659         {
   667         TMessageContentId msgContentId = MessageContentId( attachments[i]->GetPartId().Id() );
   660             TMessageContentId msgContentId = TMessageContentId( 
   668 
   661                             attachments[i]->GetPartId().Id(),
   669         CEmailAttachment* att = CEmailAttachment::NewL( 
   662                             iMessageId.iId,
   670             iPluginData, msgContentId, attachments[i], EClientOwns );
   663                             iMessageId.iFolderId.iId,
   671 
   664                             iMessageId.iFolderId.iMailboxId ); 
   672         aAttachments.AppendL( att );
   665 
   673         }
   666             CEmailAttachment* att = CEmailAttachment::NewL(iPluginData, msgContentId, attachments[i], EClientOwns);
   674     CleanupStack::Pop( &attachments );
   667             
   675     return count;
   668             aAttachments.AppendL(att);
   676     }
   669         }
   677 
   670     CleanupStack::Pop(); // attachments
   678 // -----------------------------------------------------------------------------
   671     return count;    
   679 // 
   672     }
   680 // -----------------------------------------------------------------------------
   673     
   681 void CEmailMessage::RemoveAttachmentL( const MEmailAttachment& /*aAttachment*/ )
   674 // -----------------------------------------------------------------------------
   682     {
   675 // 
   683     User::Leave( KErrNotSupported );
   676 // -----------------------------------------------------------------------------
       
   677 void CEmailMessage::RemoveAttachmentL( const MEmailAttachment& aAttachment  )
       
   678     {
       
   679     iPluginMessage->RemoveChildPartL(FsMsgId( iPluginData, aAttachment.Id()));
   684     }
   680     }
   685 
   681 
   686 // -----------------------------------------------------------------------------
   682 // -----------------------------------------------------------------------------
   687 // 
   683 // 
   688 // -----------------------------------------------------------------------------
   684 // -----------------------------------------------------------------------------
   694 // -----------------------------------------------------------------------------
   690 // -----------------------------------------------------------------------------
   695 // 
   691 // 
   696 // -----------------------------------------------------------------------------
   692 // -----------------------------------------------------------------------------
   697 void CEmailMessage::SaveChangesL()
   693 void CEmailMessage::SaveChangesL()
   698     {
   694     {
   699     User::LeaveIfNull( iPluginMessage );
       
   700     
       
   701     TFSMailMsgId mailboxId( 
   695     TFSMailMsgId mailboxId( 
   702             FsMsgId( iPluginData, iMessageId.iFolderId.iMailboxId ) );
   696             FsMsgId( iPluginData, iMessageId.iFolderId.iMailboxId ) );
   703     
   697     
   704     iPlugin->StoreMessageL( mailboxId, *iPluginMessage );
   698     iPlugin->StoreMessageL( mailboxId, *iPluginMessage );
   705     }
   699     }
   707 // -----------------------------------------------------------------------------
   701 // -----------------------------------------------------------------------------
   708 // 
   702 // 
   709 // -----------------------------------------------------------------------------
   703 // -----------------------------------------------------------------------------
   710 void CEmailMessage::SendL()
   704 void CEmailMessage::SendL()
   711     {
   705     {
   712     User::LeaveIfNull( iPluginMessage );
       
   713     
       
   714     if ( iEventLoop.isRunning() )
       
   715         User::Leave( KErrInUse );
       
   716     
       
   717     SaveChangesL();
   706     SaveChangesL();
   718     iError = KErrNone;
   707     iPlugin->SendMessageL( *iPluginMessage );
   719     iPlugin->SendMessageL( *iPluginMessage, *this, KSendMessageRequestId );
   708     }
   720     iEventLoop.exec();
   709 
   721 
   710 // -----------------------------------------------------------------------------
   722     User::LeaveIfError( iError );
   711 // 
   723     }
   712 // -----------------------------------------------------------------------------
   724 
   713 void CEmailMessage::ConvertAddressArrayL( 
   725 // -----------------------------------------------------------------------------
       
   726 // 
       
   727 // -----------------------------------------------------------------------------
       
   728 void CEmailMessage::RequestResponseL( TFSProgress aEvent, TInt aRequestId )
       
   729     {
       
   730     iError = aEvent.iError;
       
   731 
       
   732     if ( aRequestId == KSendMessageRequestId &&
       
   733             aEvent.iProgressStatus == TFSProgress::EFSStatus_RequestComplete )
       
   734         iEventLoop.quit();
       
   735     }
       
   736 
       
   737 // -----------------------------------------------------------------------------
       
   738 // 
       
   739 // -----------------------------------------------------------------------------
       
   740 void CEmailMessage::ConvertAddressArrayL(
       
   741         const MEmailAddress::TRole aRole,
   714         const MEmailAddress::TRole aRole,
   742         const RPointerArray<CFSMailAddress>& aSrc,
   715         RPointerArray<CFSMailAddress>& aSrc, 
   743         REmailAddressArray& aDst ) const
   716         REmailAddressArray& aDst ) const
   744     {
   717     {
   745     for ( TInt i=0; i<aSrc.Count(); i++ )
   718     for ( TInt i=0; i<aSrc.Count(); i++ )
   746         {
   719         {
   747         CEmailAddress* recipient = CreateAddressLC( aRole, *aSrc[i] );
   720         CEmailAddress* recipient = CreateAddressLC( aRole, *aSrc[i] );
   751     }
   724     }
   752 
   725 
   753 // -----------------------------------------------------------------------------
   726 // -----------------------------------------------------------------------------
   754 //
   727 //
   755 // -----------------------------------------------------------------------------
   728 // -----------------------------------------------------------------------------
   756 CEmailAddress* CEmailMessage::CreateAddressLC(
   729 //
       
   730 CEmailAddress* CEmailMessage::CreateAddressLC( 
   757         const MEmailAddress::TRole aRole, 
   731         const MEmailAddress::TRole aRole, 
   758         CFSMailAddress& aFsAddress ) const
   732         CFSMailAddress& aFsAddress ) const
   759     {
   733     {
   760     CEmailAddress* address = CEmailAddress::NewLC( aRole, EClientOwns );
   734     CEmailAddress* address = CEmailAddress::NewLC( aRole, EClientOwns );
   761     TDesC& temp1 = aFsAddress.GetEmailAddress();
   735     TDesC& temp1 = aFsAddress.GetEmailAddress();
   772     }
   746     }
   773 
   747 
   774 // -----------------------------------------------------------------------------
   748 // -----------------------------------------------------------------------------
   775 //
   749 //
   776 // -----------------------------------------------------------------------------
   750 // -----------------------------------------------------------------------------
       
   751 //
   777 TUint CEmailMessage::MapFlags( const TUint& aFlag )
   752 TUint CEmailMessage::MapFlags( const TUint& aFlag )
   778     {
   753     {
   779     TUint flag = 0;
   754     TUint flag = 0;
   780     switch( aFlag )
   755     switch( aFlag )
   781         {
   756         {
   825             break;
   800             break;
   826         }
   801         }
   827     return flag;
   802     return flag;
   828     }
   803     }
   829 
   804 
       
   805 void CEmailMessage::ShowMessageViewerL( )
       
   806     {   
       
   807     THtmlViewerActivationData htmlData;
       
   808     htmlData.iActivationDataType = THtmlViewerActivationData::EMailMessage;
       
   809     htmlData.iMailBoxId = FsMsgId(iPluginData, iMessageId.iFolderId.iMailboxId);
       
   810     htmlData.iFolderId = FsMsgId(iPluginData, iMessageId.iFolderId);
       
   811     htmlData.iMessageId = FsMsgId(iPluginData, iMessageId);
       
   812     TPckgBuf<THtmlViewerActivationData> pckgData( htmlData );
       
   813     CVwsSessionWrapper* viewSrvSession = CVwsSessionWrapper::NewLC();
       
   814     viewSrvSession->ActivateView(TVwsViewId(KFSEmailUiUid, HtmlViewerId), KHtmlViewerOpenNew, pckgData);
       
   815     CleanupStack::PopAndDestroy();
       
   816     }    
       
   817 
       
   818 /** 
       
   819  * Launches Email application and new reply message in editor. 
       
   820  * The method follows "fire and forget" pattern, returns immediately.
       
   821  */
       
   822 void CEmailMessage::ReplyToMessageL( const TBool aReplyToAll )
       
   823     {
       
   824     TEditorLaunchParams editorLaunchData;
       
   825     editorLaunchData.iExtra = NULL;
       
   826     editorLaunchData.iMailboxId = FsMsgId(iPluginData, iMessageId.iFolderId.iMailboxId);
       
   827     editorLaunchData.iFolderId = FsMsgId(iPluginData, iMessageId.iFolderId);
       
   828     editorLaunchData.iMsgId = FsMsgId(iPluginData, iMessageId);
       
   829     editorLaunchData.iActivatedExternally = ETrue; 
       
   830     
       
   831     TPckgBuf<TEditorLaunchParams> pckgData( editorLaunchData );
       
   832     CVwsSessionWrapper* viewSrvSession = CVwsSessionWrapper::NewLC();
       
   833     TUid command = TUid::Uid(KEditorCmdReplyAll);
       
   834     if ( !aReplyToAll )
       
   835         {
       
   836         command = TUid::Uid(KEditorCmdReply);
       
   837         }
       
   838     viewSrvSession->ActivateView(TVwsViewId(KFSEmailUiUid, MailEditorId), command, pckgData);
       
   839     CleanupStack::PopAndDestroy();   
       
   840     }
       
   841 
       
   842 void CEmailMessage::ForwardMessageL()
       
   843     {
       
   844     TEditorLaunchParams editorLaunchData;
       
   845     editorLaunchData.iExtra = NULL;
       
   846     editorLaunchData.iMailboxId = FsMsgId(iPluginData, iMessageId.iFolderId.iMailboxId);
       
   847     editorLaunchData.iFolderId = FsMsgId(iPluginData, iMessageId.iFolderId);
       
   848     editorLaunchData.iMsgId = FsMsgId(iPluginData, iMessageId);
       
   849     editorLaunchData.iActivatedExternally = ETrue; 
       
   850     
       
   851     TPckgBuf<TEditorLaunchParams> pckgData( editorLaunchData );
       
   852     CVwsSessionWrapper* viewSrvSession = CVwsSessionWrapper::NewLC();
       
   853     TUid command = TUid::Uid(KEditorCmdForward);
       
   854     viewSrvSession->ActivateView(TVwsViewId(KFSEmailUiUid, MailEditorId), command, pckgData);
       
   855     CleanupStack::PopAndDestroy();   
       
   856     }
       
   857 
   830 // -----------------------------------------------------------------------------
   858 // -----------------------------------------------------------------------------
   831 //
   859 //
   832 // -----------------------------------------------------------------------------
   860 // -----------------------------------------------------------------------------
   833 void CEmailMessage::ShowMessageViewerL()
       
   834     {   
       
   835     bool syncronous;
       
   836 
       
   837     XQServiceRequest request(
       
   838        emailInterfaceNameMessage,
       
   839        emailOperationViewMessage,
       
   840        syncronous );
       
   841 
       
   842     TFSMailMsgId mailboxId = FsMsgId( iPluginData, iMessageId.iFolderId.iMailboxId );
       
   843     TFSMailMsgId folderId = FsMsgId( iPluginData, iMessageId.iFolderId );
       
   844     TFSMailMsgId messageId = FsMsgId( iPluginData, iMessageId );
       
   845 
       
   846     QList<QVariant> list;
       
   847     list.append( mailboxId.Id() );
       
   848     list.append( folderId.Id() );
       
   849     list.append( messageId.Id() );
       
   850     request.setArguments( list );
       
   851 
       
   852     QVariant returnValue;
       
   853     if ( !request.send( returnValue ) )
       
   854         User::Leave( KErrGeneral );
       
   855     }
       
   856 
       
   857 // -----------------------------------------------------------------------------
       
   858 // Launches Email application and new reply message in editor. 
       
   859 // The method follows "fire and forget" pattern, returns immediately.
       
   860 // -----------------------------------------------------------------------------
       
   861 void CEmailMessage::ReplyToMessageL( const TBool /*aReplyToAll*/ )
       
   862     {
       
   863     User::Leave( KErrNotSupported );
       
   864     }
       
   865 
       
   866 // -----------------------------------------------------------------------------
       
   867 //
   861 //
   868 // -----------------------------------------------------------------------------
       
   869 void CEmailMessage::ForwardMessageL()
       
   870     {
       
   871     User::Leave( KErrNotSupported );
       
   872     }
       
   873 
       
   874 // -----------------------------------------------------------------------------
       
   875 //
       
   876 // -----------------------------------------------------------------------------
       
   877 TMessageContentId CEmailMessage::MessageContentId( TEntryId aContentId ) const
       
   878     {
       
   879     TMessageContentId msgContentId = TMessageContentId( 
       
   880                     aContentId,
       
   881                     iMessageId.iId,
       
   882                     iMessageId.iFolderId.iId,
       
   883                     iMessageId.iFolderId.iMailboxId );
       
   884     return msgContentId;
       
   885     }
       
   886 
       
   887 // -----------------------------------------------------------------------------
       
   888 //
       
   889 // -----------------------------------------------------------------------------
       
   890 TContentType::TContentType( const TDesC& aContentType ) : iContentType( aContentType )
   862 TContentType::TContentType( const TDesC& aContentType ) : iContentType( aContentType )
   891     {
   863     {
   892     _LIT( KSeparator, ";" );
   864     _LIT( KSeparator, ";" );
   893     TInt end = aContentType.Find( KSeparator );
   865     TInt end = aContentType.Find( KSeparator );
   894     if ( end != KErrNotFound )
   866     if ( end != KErrNotFound )
   898     }
   870     }
   899 
   871 
   900 // -----------------------------------------------------------------------------
   872 // -----------------------------------------------------------------------------
   901 //
   873 //
   902 // -----------------------------------------------------------------------------
   874 // -----------------------------------------------------------------------------
       
   875 //
   903 TBool TContentType::Equals( const TDesC& aContentType )
   876 TBool TContentType::Equals( const TDesC& aContentType )
   904     {
   877     {
   905     TBool ret = iContentType.CompareF( aContentType );
   878 	TBool ret = iContentType.CompareF( aContentType );
   906     if ( ret == 0  )
   879     if ( ret == 0  )
   907         return ETrue;
   880     	return ETrue;
   908     else
   881     else
   909         return EFalse;
   882     	return EFalse;
   910     }
   883     }
   911 
   884 
   912 // End of file
   885 // End of file.