ipsservices/ipssosplugin/inc/ipsplgsmtpservice.h
changeset 0 8466d47a6819
child 4 e7aa27f58ae1
equal deleted inserted replaced
-1:000000000000 0:8466d47a6819
       
     1 /*
       
     2 * Copyright (c) 2007 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: This file defines class CIpsPlgSmtpService.
       
    15  *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef IPSPLGSMTPSERVICE_H
       
    20 #define IPSPLGSMTPSERVICE_H
       
    21 
       
    22 class CIpsPlgSosBasePlugin;
       
    23 class CIpsPlgMsgMapper;
       
    24 
       
    25 /**
       
    26  *  Freestyle message send and creation implementation
       
    27  *  
       
    28  *  Encapsulates message creation and send operations using
       
    29  *  Symbian os smtp services.
       
    30  *
       
    31  *
       
    32  *  @lib ipssosplugin.lib
       
    33  *  @since FS 1.0
       
    34  */
       
    35 NONSHARABLE_CLASS( CIpsPlgSmtpService ) : public CBase
       
    36     {
       
    37 
       
    38 public:
       
    39 
       
    40     /**
       
    41      * Symbian 2nd phase construcror
       
    42      *
       
    43      * @since FS 1.0
       
    44      * @return None
       
    45      */
       
    46     IMPORT_C static CIpsPlgSmtpService* NewL(
       
    47         CMsvSession& aSession,
       
    48         CIpsPlgSosBasePlugin& aPlugin );
       
    49 
       
    50     /**
       
    51      * Symbian 2nd phase construcror
       
    52      *
       
    53      * @since FS 1.0
       
    54      * @return None
       
    55      */
       
    56     IMPORT_C static CIpsPlgSmtpService* NewLC( 
       
    57         CMsvSession& aSession,
       
    58         CIpsPlgSosBasePlugin& aPlugin );
       
    59 
       
    60     /**
       
    61      * Class destructor
       
    62      *
       
    63      * @since FS 1.0
       
    64      * @return None
       
    65      */
       
    66     virtual ~CIpsPlgSmtpService();
       
    67 
       
    68     /**
       
    69      * Stores message to symbian message store
       
    70      *
       
    71      * @param aMailboxId id for corresponding mailbox
       
    72      * @param aMessage FS Email message object
       
    73      * @param aSession MsvSession
       
    74      * @since FS 1.0
       
    75      */
       
    76     void StoreMessageL(
       
    77         TFSMailMsgId aMailBoxId,
       
    78         CFSMailMessage& aMessage );
       
    79 
       
    80     /**
       
    81      * Creates new email message to message store
       
    82      *
       
    83      * @param aMailBoxId msv entry id to mailbox which setting are used
       
    84      * @param aSession Msv Session
       
    85      * @since FS 1.0
       
    86      * @return pointer created fs message object
       
    87      */
       
    88     CFSMailMessage* CreateNewSmtpMessageL(
       
    89         const TFSMailMsgId& aMailBoxId );
       
    90 
       
    91     CFSMailMessage* CreateForwardSmtpMessageL(
       
    92         const TFSMailMsgId& aMailBoxId,
       
    93         const TFSMailMsgId& aOriginalMessageId );
       
    94 
       
    95     CFSMailMessage* CreateReplySmtpMessageL(
       
    96         const TFSMailMsgId& aMailBoxId,
       
    97         const TFSMailMsgId& aOriginalMessageId,
       
    98         TBool aReplyToAll );
       
    99 
       
   100 protected:
       
   101 
       
   102     /**
       
   103      * Class constructor
       
   104      *
       
   105      * @since FS 1.0
       
   106      * @return None
       
   107      */
       
   108     CIpsPlgSmtpService( CMsvSession& aSession,
       
   109                     CIpsPlgSosBasePlugin& aPlugin );
       
   110 
       
   111     /**
       
   112      * Constructor for leaving methods
       
   113      *
       
   114      * @since FS 1.0
       
   115      * @return None
       
   116      */
       
   117     void ConstructL();
       
   118 
       
   119 private:
       
   120 
       
   121     /**
       
   122      * Combines alias and email address to one string
       
   123      * format : Alias<email_address>
       
   124      *
       
   125      * @since FS 1.0
       
   126      * @param TDesC& aAliasName alias
       
   127      * @param TDesC& aEmailName email address
       
   128      * @return result of combination
       
   129      */
       
   130     HBufC* CreateDisplayStringLC( const TDesC& aDisplayName, 
       
   131                               const TDesC& aEmailName );
       
   132 
       
   133     /**
       
   134      * Changes messages service id
       
   135      *
       
   136      * @since FS 1.0
       
   137      * @param aEntry Original message entry 
       
   138      * @return None
       
   139      */
       
   140     void ChangeServiceIdL( TMsvEntry& aEntry );
       
   141     
       
   142     /**
       
   143      * Changes messages service id to the given id
       
   144      *
       
   145      * @param aEntry message entry
       
   146      * @param aServiceId new service id
       
   147      * @return None
       
   148      */
       
   149     void ChangeServiceIdL( TMsvEntry& aEntry, TMsvId aServiceId );
       
   150 
       
   151     /**
       
   152      * Creates proper fs message object and set flags
       
   153      * to correspond orginal message flags
       
   154      *
       
   155      * @since FS 1.0
       
   156      * @param aMessageId id of created message
       
   157      * @param aOrginalMsgId id of orginal message
       
   158      * @param aMailboxId mailbox id
       
   159      * @return TMscId
       
   160      */
       
   161     CFSMailMessage* CreateFSMessageAndSetFlagsL(
       
   162        TMsvId aMessageId, TMsvId aOriginalMsgId, TMsvId aMailboxId );
       
   163     
       
   164     /**
       
   165      * Gets MsvId from msv operations final progress 
       
   166      * descriptor, leaves if msvId is null entry
       
   167      *
       
   168      * @since FS 1.0
       
   169      * @param aProg progress descriptor
       
   170      * @return TMscId
       
   171      */
       
   172     inline static TMsvId GetIdFromProgressL( const TDesC8& aProg );
       
   173 
       
   174     /**
       
   175      * Gets character set from original message
       
   176      * @param aOriginalMsgId id of original message
       
   177      * */
       
   178     TUid GetOriginalCharsetL( TMsvId aOriginalMsgId );
       
   179     
       
   180     /**
       
   181      * Sets the charset for outgoing messages 
       
   182      * @param aEntry message where the charset is to be set
       
   183      * @param aCharset the charset to be set
       
   184      */
       
   185     void SetCharactersetL( CMsvEntry& aEntry, TUid aCharset );
       
   186 private: // data
       
   187 
       
   188     CIpsPlgSosBasePlugin& iPlugin;
       
   189 
       
   190     CMsvSession& iSession;
       
   191     
       
   192     CIpsPlgMsgMapper* iMsgMapper;
       
   193 
       
   194     };
       
   195 
       
   196 #endif /* IPSPLGSMTPSERVICE_H*/
       
   197 
       
   198 // End of File