ipsservices/ipssosplugin/inc/ipsplgsosbaseplugin.h
changeset 0 8466d47a6819
child 8 e1b6206813b4
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 CIpsPlgSosBasePlugin.
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef IPSPLGSOSBASEPLUGIN_H
       
    20 #define IPSPLGSOSBASEPLUGIN_H
       
    21 
       
    22 //<cmail>
       
    23 #include "CFSMailPlugin.h"
       
    24 #include "MFSMailRequestObserver.h"
       
    25 //</cmail>
       
    26 #include <rconnmon.h>
       
    27 
       
    28 #include "ipsplgsosbaseplugin.hrh"
       
    29 #include "ipsplgcommon.h"
       
    30 #include "ipsplgsingleopwatcher.h"
       
    31 #include "ipsplgtimeroperation.h"
       
    32 
       
    33 class CMsvSession;
       
    34 class CIpsPlgTimerOperation;
       
    35 class CIpsPlgMsgMapper;
       
    36 class CImEmailMessage;
       
    37 class CIpsPlgMruList;
       
    38 class CIpsPlgSettingsObserver;
       
    39 class CRepository;
       
    40 class CIpsPlgSearch;
       
    41 class CIpsSetDataApi;
       
    42 class CIpsPlgSmtpService;
       
    43 class CIpsPlgSyncStateHandler;
       
    44 class CIpsPlgEventHandler;
       
    45 
       
    46 /**
       
    47  *  FreestyleIpsServices plugin class
       
    48  *
       
    49  *  @lib ipssosplugin.lib
       
    50  *  @since FSEmail 2.0
       
    51  */
       
    52 class CIpsPlgSosBasePlugin :
       
    53     public CFSMailPlugin,
       
    54                              public MIpsPlgSingleOpWatcher,
       
    55                              public MFSMailRequestObserver, // a dummy observer
       
    56                              public MIpsPlgTimerOperationCallBack
       
    57     {
       
    58 
       
    59 public:
       
    60 
       
    61     /**
       
    62     * ~CIpsPlgSosBasePlugin
       
    63     * Destructor
       
    64     */
       
    65     IMPORT_C virtual ~CIpsPlgSosBasePlugin();
       
    66 
       
    67 public: //from MIpsPlgSingleOpWatcher
       
    68 
       
    69     /**
       
    70     *
       
    71     */
       
    72     void OpCompleted(
       
    73         CIpsPlgSingleOpWatcher& aOpWatcher,
       
    74         TInt aCompletionCode );
       
    75 
       
    76 public: //from MFSMailRequestObserver
       
    77 
       
    78     /**
       
    79     * no real implementation for this. we're just a dummy observer,
       
    80     * so we can internally run our own operations, like DisconnectL
       
    81     */
       
    82     virtual void RequestResponseL( TFSProgress aEvent, TInt aRequestId );
       
    83 
       
    84 public: // from MIpsPlgTimerOperationCallBack
       
    85 
       
    86     /**
       
    87     * Called when activity timer fires
       
    88     */
       
    89     virtual void HandleTimerFiredL( const TFSMailMsgId& aMailboxId );
       
    90 
       
    91 public: // from CFSMailPlugin
       
    92 
       
    93     virtual void SetMailboxName(
       
    94          const TFSMailMsgId& aMailboxId,
       
    95          const TDesC& aMailboxName );
       
    96 
       
    97     virtual TFSMailBoxStatus GetMailBoxStatus(
       
    98          const TFSMailMsgId& aMailBoxId );
       
    99 
       
   100     virtual TFSMailMsgId SpecifiedSendingMailbox();
       
   101 
       
   102     virtual void ListMailBoxesL( RArray<TFSMailMsgId>& aMailboxes);
       
   103 
       
   104     virtual CFSMailBox* GetMailBoxByUidL( const TFSMailMsgId& aMailBoxId);
       
   105 
       
   106     virtual void DeleteMailBoxByUidL(
       
   107         const TFSMailMsgId& aMailBoxId,
       
   108         MFSMailRequestObserver& aOperationObserver,
       
   109         const TInt aRequestId );
       
   110 
       
   111     virtual TDesC& GetBrandingIdL( const TFSMailMsgId& aMailBoxId);
       
   112 
       
   113     virtual void MoveMessagesL(
       
   114         const TFSMailMsgId& aMailBoxId,
       
   115         const RArray<TFSMailMsgId>& aMessageIds,
       
   116         const TFSMailMsgId& aSourceFolderId,
       
   117         const TFSMailMsgId& aDestinationFolderId );
       
   118 
       
   119     virtual TInt MoveMessagesL(
       
   120         const TFSMailMsgId& aMailBoxId,
       
   121         const RArray<TFSMailMsgId>& aMessageIds,
       
   122         const TFSMailMsgId& aSourceFolderId,
       
   123         const TFSMailMsgId& aDestinationFolderId,
       
   124         MFSMailRequestObserver& aOperationObserver,
       
   125         TInt aRequestId );
       
   126 
       
   127     virtual void CopyMessagesL(
       
   128         const TFSMailMsgId& aMailBoxId,
       
   129         const RArray<TFSMailMsgId>& aMessageIds,
       
   130         RArray<TFSMailMsgId>& aNewMessages,
       
   131         const TFSMailMsgId& aSourceFolderId,
       
   132         const TFSMailMsgId& aDestinationFolderId );
       
   133 
       
   134     virtual MDesCArray* GetMrusL( const TFSMailMsgId& aMailBoxId );
       
   135 
       
   136     virtual void SetMrusL(
       
   137             const TFSMailMsgId& aMailBoxId,
       
   138             MDesCArray* aNewMruList );
       
   139 
       
   140     virtual const TFSProgress GetLastSyncStatusL(
       
   141         const TFSMailMsgId& aMailBoxId );
       
   142 
       
   143     virtual TInt CancelSyncL( const TFSMailMsgId& aMailBoxId );
       
   144 
       
   145     // FOLDER HANDLING
       
   146 
       
   147     virtual CFSMailFolder* GetFolderByUidL(
       
   148         const TFSMailMsgId& aMailBoxId,
       
   149         const TFSMailMsgId& aFolderId );
       
   150 
       
   151     virtual CFSMailFolder* CreateFolderL(
       
   152         const TFSMailMsgId& aMailBoxId,
       
   153         const TFSMailMsgId& aFolderId,
       
   154         const TDesC& aFolderName,
       
   155         const TBool aSync );
       
   156 
       
   157     virtual void DeleteFolderByUidL(
       
   158         const TFSMailMsgId& aMailBoxId,
       
   159         const TFSMailMsgId& aFolderId);
       
   160 
       
   161     // MESSAGE FETCH AND STORE
       
   162 
       
   163     virtual MFSMailIterator* ListMessagesL(
       
   164         const TFSMailMsgId& aMailBoxId,
       
   165         const TFSMailMsgId& aFolderId,
       
   166         const TFSMailDetails aDetails,
       
   167         const RArray<TFSMailSortCriteria>& aSorting );
       
   168 
       
   169     virtual CFSMailMessage* GetMessageByUidL(
       
   170         const TFSMailMsgId& aMailBoxId,
       
   171         const TFSMailMsgId& aFolderId,
       
   172         const TFSMailMsgId& aMessageId,
       
   173         const TFSMailDetails aDetails);
       
   174 
       
   175     virtual void DeleteMessagesByUidL(
       
   176         const TFSMailMsgId& aMailBoxId,
       
   177         const TFSMailMsgId& aFolderId,
       
   178         const RArray<TFSMailMsgId>& aMessages );
       
   179 
       
   180     // MESSAGE STORE OPERATIONS
       
   181 
       
   182     virtual CFSMailMessage* CreateMessageToSendL(
       
   183         const TFSMailMsgId& aMailBoxId );
       
   184 
       
   185     virtual CFSMailMessage* CreateForwardMessageL(
       
   186         const TFSMailMsgId& aMailBoxId,
       
   187         const TFSMailMsgId& aOriginalMessageId,
       
   188         const TDesC& aHeaderDescriptor );
       
   189 
       
   190     virtual CFSMailMessage* CreateReplyMessageL(
       
   191         const TFSMailMsgId& aMailBoxId,
       
   192         const TFSMailMsgId& aOriginalMessageId,
       
   193         const TBool aReplyToAll,
       
   194         const TDesC& aHeaderDescriptor );
       
   195 
       
   196     virtual void StoreMessageL(
       
   197         const TFSMailMsgId& aMailBoxId,
       
   198         CFSMailMessage& aMessage );
       
   199 
       
   200     virtual void GetMessagesL(
       
   201         const TFSMailMsgId& aMailBoxId,
       
   202         const TFSMailMsgId& aFolderId,
       
   203         const RArray<TFSMailMsgId>& aMessageIds,
       
   204         RPointerArray<CFSMailMessage>& aMessageList,
       
   205         const TFSMailDetails aDetails );
       
   206 
       
   207     virtual void ChildPartsL(
       
   208         const TFSMailMsgId& aMailBoxId,
       
   209         const TFSMailMsgId& aParentFolderId,
       
   210         const TFSMailMsgId& aMessageId,
       
   211         const TFSMailMsgId& aParentId,
       
   212         RPointerArray<CFSMailMessagePart>& aParts);
       
   213 
       
   214     virtual CFSMailMessagePart* NewChildPartL(
       
   215         const TFSMailMsgId& aMailBoxId,
       
   216         const TFSMailMsgId& aParentFolderId,
       
   217         const TFSMailMsgId& aMessageId,
       
   218         const TFSMailMsgId& aParentPartId,
       
   219         const TFSMailMsgId& aInsertBefore,
       
   220         const TDesC& aContentType);
       
   221 
       
   222     virtual CFSMailMessagePart* NewChildPartFromFileL(
       
   223         const TFSMailMsgId& aMailBoxId,
       
   224         const TFSMailMsgId& aParentFolderId,
       
   225         const TFSMailMsgId& aMessageId,
       
   226         const TFSMailMsgId& aParentPartId,
       
   227         const TDesC& aContentType,
       
   228         const TDesC& aFilePath );
       
   229 
       
   230     /**
       
   231      * Creates attachment based on file handle
       
   232      * @param aMailBoxId specifies the mailbox
       
   233      * @param aParentFolderId specifies the folder where message is
       
   234      * @param aMessageId specifies message
       
   235      * @param aParentPartId
       
   236      * @param aContentType mime type
       
   237      * @param aFile handle to open file
       
   238      */
       
   239     virtual CFSMailMessagePart* NewChildPartFromFileL(
       
   240         const TFSMailMsgId& aMailBoxId,
       
   241         const TFSMailMsgId& aParentFolderId,
       
   242         const TFSMailMsgId& aMessageId,
       
   243         const TFSMailMsgId& aParentPartId,
       
   244         const TDesC& aContentType,
       
   245         RFile& aFile );
       
   246 
       
   247     virtual CFSMailMessagePart* CopyMessageAsChildPartL(
       
   248         const TFSMailMsgId& aMailBoxId,
       
   249         const TFSMailMsgId& aParentFolderId,
       
   250         const TFSMailMsgId& aMessageId,
       
   251         const TFSMailMsgId& aParentPartId,
       
   252         const TFSMailMsgId& aInsertBefore,
       
   253         const CFSMailMessage& aMessage);
       
   254 
       
   255     virtual void RemoveChildPartL(
       
   256         const TFSMailMsgId& aMailBoxId,
       
   257         const TFSMailMsgId& aParentFolderId,
       
   258         const TFSMailMsgId& aMessageId,
       
   259         const TFSMailMsgId& aParentPartId,
       
   260         const TFSMailMsgId& aPartId);
       
   261 
       
   262     virtual CFSMailMessagePart* MessagePartL(
       
   263         const TFSMailMsgId& aMailBoxId,
       
   264         const TFSMailMsgId& aParentFolderId,
       
   265         const TFSMailMsgId& aMessageId,
       
   266         const TFSMailMsgId& aMessagePartId);
       
   267 
       
   268     virtual TInt GetMessagePartFileL(
       
   269         const TFSMailMsgId& aMailBoxId,
       
   270         const TFSMailMsgId& aParentFolderId,
       
   271         const TFSMailMsgId& aMessageId,
       
   272         const TFSMailMsgId& aMessagePartId,
       
   273         RFile& aFileHandle);
       
   274 
       
   275     virtual void CopyMessagePartFileL(
       
   276         const TFSMailMsgId& aMailBoxId,
       
   277         const TFSMailMsgId& aParentFolderId,
       
   278         const TFSMailMsgId& aMessageId,
       
   279         const TFSMailMsgId& aMessagePartId,
       
   280         const TDesC& aFilePath);
       
   281 
       
   282     virtual void GetContentToBufferL(
       
   283         const TFSMailMsgId& aMailBoxId,
       
   284         const TFSMailMsgId& aParentFolderId,
       
   285         const TFSMailMsgId& aMessageId,
       
   286         const TFSMailMsgId& aMessagePartId,
       
   287         TDes& aBuffer,
       
   288         const TUint aStartOffset);
       
   289 
       
   290     virtual void SetContentL(
       
   291         const TDesC& aBuffer,
       
   292         const TFSMailMsgId& aMailBoxId,
       
   293         const TFSMailMsgId& aParentFolderId,
       
   294         const TFSMailMsgId& aMessageId,
       
   295         const TFSMailMsgId& aMessagePartId);
       
   296 
       
   297     virtual void RemovePartContentL(
       
   298         const TFSMailMsgId& aMailBoxId,
       
   299         const TFSMailMsgId& aParentFolderId,
       
   300         const TFSMailMsgId& aMessageId,
       
   301         const RArray<TFSMailMsgId>& aPartIds);
       
   302 
       
   303     virtual void SetPartContentFromFileL(
       
   304         const TFSMailMsgId& aMailBoxId,
       
   305         const TFSMailMsgId& aParentFolderId,
       
   306         const TFSMailMsgId& aMessageId,
       
   307         const TFSMailMsgId& aMessagePartId,
       
   308         const TDesC& aFilePath);
       
   309 
       
   310     virtual void StoreMessagePartL(
       
   311         const TFSMailMsgId& aMailBoxId,
       
   312         const TFSMailMsgId& aParentFolderId,
       
   313         const TFSMailMsgId& aMessageId,
       
   314         CFSMailMessagePart& aMessagePart);
       
   315 
       
   316     virtual void UnregisterRequestObserver( TInt aRequestId );
       
   317 
       
   318     // MESSAGE SENDING
       
   319 
       
   320     virtual void SendL(TFSMailMsgId aMessageId );
       
   321 
       
   322     virtual void SendMessageL( CFSMailMessage& aMessage );
       
   323 
       
   324     // OPERATION HANDLING
       
   325 
       
   326     virtual void GoOnlineL( const TFSMailMsgId& aMailBoxId );
       
   327 
       
   328     virtual void GoOfflineL( const TFSMailMsgId& aMailBoxId );
       
   329 
       
   330     virtual TFSProgress StatusL(const TInt aRequestId);
       
   331 
       
   332     virtual void CancelL(const TInt aRequestId);
       
   333 
       
   334     // Search API
       
   335 
       
   336     virtual void SearchL(
       
   337         const TFSMailMsgId& aMailBoxId,
       
   338         const RArray<TFSMailMsgId>& aFolderIds,
       
   339         const RPointerArray<TDesC>& aSearchStrings,
       
   340         const TFSMailSortCriteria& aSortCriteria,
       
   341         MFSMailBoxSearchObserver& aSearchObserver );
       
   342 
       
   343     virtual void CancelSearch( const TFSMailMsgId& aMailBoxId );
       
   344 
       
   345     virtual void ClearSearchResultCache( const TFSMailMsgId& aMailBoxId );
       
   346 
       
   347     virtual void AddObserverL(MFSMailEventObserver& aObserver);
       
   348 
       
   349     virtual void RemoveObserver(MFSMailEventObserver& aObserver);
       
   350 
       
   351     virtual void SubscribeMailboxEventsL(const TFSMailMsgId& aMailBoxId,
       
   352         MFSMailEventObserver& aObserver);
       
   353 
       
   354     virtual void UnsubscribeMailboxEvents(
       
   355         const TFSMailMsgId& aMailBoxId,
       
   356         MFSMailEventObserver& aObserver);
       
   357 
       
   358     virtual TSSMailSyncState CurrentSyncState(
       
   359         const TFSMailMsgId& aMailBoxId);
       
   360 
       
   361     virtual TInt WizardDataAvailableL( );
       
   362 
       
   363     /**
       
   364      * reads connection id from plugin
       
   365      *
       
   366      * @param  aConnectionId reference to connection id
       
   367      * @return KErrNone or error code
       
   368      */
       
   369      virtual TInt GetConnectionId( TFSMailMsgId aMailBoxId, TUint32& aConnectionId );
       
   370 
       
   371     /**
       
   372      * checks from plugin if connection is allowed when roaming
       
   373      *
       
   374      * @param  aConnectionAllowed
       
   375      * @return KErrNone or error code
       
   376      */
       
   377      virtual TInt IsConnectionAllowedWhenRoaming(
       
   378              TFSMailMsgId aMailBoxId,
       
   379              TBool& aConnectionAllowed );
       
   380 
       
   381     virtual void AuthenticateL(
       
   382         MFSMailRequestObserver& aOperationObserver,
       
   383         TInt aRequestId );
       
   384 
       
   385     virtual void SetCredentialsL(
       
   386        const TFSMailMsgId& aMailBoxId,
       
   387        const TDesC& aUsername,
       
   388        const TDesC& aPassword );
       
   389 
       
   390 public:
       
   391 
       
   392     /**
       
   393     * Function to identify which protocol plugin we are working with
       
   394     * @return MTM id
       
   395     * @since FSEmail 2.0
       
   396     */
       
   397     TUid MtmId() const;
       
   398 
       
   399     /**
       
   400      * Returns the implementation ID of the plugin
       
   401      *
       
   402      * @return Implementation ID of the plugin
       
   403      * @since FSEmail 2.0
       
   404      */
       
   405    TUint PluginId() const;
       
   406 
       
   407     /**
       
   408      * Disconnects mailbox
       
   409      *
       
   410      * @param aMailbox unique mailbox id
       
   411      * @param FSObserver can be pointed at this class (dummy observer)
       
   412      * @param aRequestId FS async operation request id, can be zero (dummy)
       
   413      * @param aRemoveAccountAlso boolean to indicate should accound be
       
   414      *                           removed afted disconnect, default is EFalse
       
   415      * @since FSEmail 2.0
       
   416      */
       
   417     virtual void DisconnectL(
       
   418         const TFSMailMsgId& aMailBoxId,
       
   419         MFSMailRequestObserver& aObserver,
       
   420         const TInt aRequestId,
       
   421         TBool aRemoveAccountAlso = EFalse );
       
   422 
       
   423     /**
       
   424      * Fetch content of new mail, used in event handler
       
   425      * needed because imap idle
       
   426      *
       
   427      * @param aMailbox unique mailbox id
       
   428      * @param aNewId msv id of new mail
       
   429      * @param aParentId new mail's parent entry id
       
   430      * @since FSEmail 2.0
       
   431      */
       
   432     virtual void PopulateNewMailL(
       
   433         const TFSMailMsgId& aMailboxId,
       
   434         TMsvId aNewId,
       
   435         TMsvId aParentId ) = 0;
       
   436 
       
   437     /**
       
   438      * Gets reference to activity timer object, used when clearing
       
   439      * activity timer in operation complete function (online operation)
       
   440      * activity timer disconnects mailbox if no operations are running in
       
   441      * certain period of time
       
   442      *
       
   443      * @param aMailbox unique mailbox id
       
   444      * @return reference to mailbox's activity timer object
       
   445      * @since FSEmail 2.0
       
   446      */
       
   447     CIpsPlgTimerOperation& ActivityTimerL( const TFSMailMsgId& aMailBoxId );
       
   448 
       
   449     /*
       
   450      * Gets reference to sync state handler class
       
   451      * @return reference to sync state handler
       
   452      * @since FSEmail 2.0
       
   453      */
       
   454     CIpsPlgSyncStateHandler& GetSyncStateHandler();
       
   455 
       
   456     /**
       
   457      * This is called after msv session ready event comes from msv server
       
   458      * @since FSEmail 2.0
       
   459      */
       
   460     void CompleteConstructL();
       
   461 
       
   462 
       
   463     /**
       
   464      * called if session terminated event is sent by msv server
       
   465      * @since FSEmail 2.0
       
   466      */
       
   467     void SessionTerminated();
       
   468 
       
   469     /**
       
   470     * Does checks to see is connection attempt possible and allowed
       
   471     * @param aMailboxId mailbox to do the checks to
       
   472     * @param aReason (possible) reason code if EFalse is returned
       
   473     * @return EFalse if can't proceed with connect
       
   474     * @since FSEmail 2.0
       
   475     */
       
   476     TBool CanConnectL( const TFSMailMsgId& aMailboxId,
       
   477         TInt& aReason );
       
   478 
       
   479     /*
       
   480      * Gludge type check is plugin instance running under ui process
       
   481      * needed in event handler
       
   482      * @since FSEmail 2.0
       
   483      */
       
   484     TBool IsUnderUiProcess();
       
   485 
       
   486 protected:
       
   487 
       
   488     /*
       
   489      * Constructor
       
   490      * @param aFSPluginId uint of fs plugin implementation, imap or pop
       
   491      */
       
   492     CIpsPlgSosBasePlugin( const TUint aFSPluginId );
       
   493 
       
   494     /*
       
   495      * Called in subclasses ConstructL functions
       
   496      */
       
   497     void BaseConstructL();
       
   498 
       
   499     /**
       
   500      * passes completion event to protocol plugin
       
   501      * If certain operation completion requires special handling,
       
   502      * protocol plugin should keep the id of the operation
       
   503      * so it can know, that this certain operation has completed.
       
   504      */
       
   505     virtual void HandleOpCompletedL(
       
   506         CIpsPlgSingleOpWatcher& aOpWatcher,
       
   507         TInt aCompletionCode ) = 0;
       
   508 
       
   509     /**
       
   510     * Sends pending messages from outbox, if user manually start
       
   511     * send-receive operation.
       
   512     */
       
   513     void EmptyOutboxL( const TFSMailMsgId& aMailBoxId );
       
   514 
       
   515     /**
       
   516     * Checks if offline mode is activated
       
   517     */
       
   518     TBool OfflineModeSetL();
       
   519 
       
   520     /**
       
   521     * Checks if given local feature is turned on
       
   522     */
       
   523     TBool CIpsPlgSosBasePlugin::LocalFeatureL(
       
   524         const TUid& aCenRepUid,
       
   525         const TUint32 aKeyId,
       
   526         const TUint32 aFlag );
       
   527 
       
   528     /**
       
   529     * Checks if we are roaming and are we allowed to
       
   530     * connect if we are.
       
   531     */
       
   532     TBool RoamingCheckL();
       
   533 
       
   534     /**
       
   535     * Check network registration status i.e. are we in gsm or wlan network
       
   536     */
       
   537     TInt RegistrationStatusL();
       
   538 
       
   539     /**
       
   540     * Called from Imap Plugin's MoveMessagesL if destination folder
       
   541     * is draft folder.
       
   542     */
       
   543     void MoveMessagesToDraftL(
       
   544         const TFSMailMsgId& aMailBoxId,
       
   545         const RArray<TFSMailMsgId>& aMessageIds,
       
   546         const TFSMailMsgId& aSourceFolderId,
       
   547         const TFSMailMsgId& aDestinationFolderId );
       
   548 
       
   549 private:
       
   550 
       
   551     /**
       
   552      * Returns a cached entry objects or creates new objects and keeps them
       
   553      * in the cache.
       
   554      * Returned objects should not be deleted in the calling method.
       
   555      * Pointers are set NULL in the case of error.
       
   556      * Pointers are valid until the method is called next time
       
   557      * Method should be used only for entries representing messages (not
       
   558      * folders or attachements).
       
   559      */
       
   560     void GetMessageEntryL(
       
   561         TMsvId aId,
       
   562         CMsvEntry*& aMessageEntry,
       
   563         CImEmailMessage*& aImEmailMessage );
       
   564 
       
   565     /*
       
   566      * Cleans up the cached messages entries that have accessed with
       
   567      * GetMessageEntryL()
       
   568      */
       
   569     void CleanCachedMessageEntries();
       
   570 
       
   571     /**
       
   572     * Cancel all online operations, use before disconnect
       
   573     */
       
   574     void CancelAllOnlineOperations( const TFSMailMsgId& aMailboxId );
       
   575 
       
   576     /**
       
   577     * Checks is there any connect operations running, meaning
       
   578     * that we are "connected" state
       
   579     */
       
   580     TBool ConnOpRunning( const TFSMailMsgId& aMailBoxId  );
       
   581 
       
   582     /**
       
   583     * Cancel, delete and remove operation from iOperations array.
       
   584     * Send Sync Completed event to plugin if operation is sync op
       
   585     */
       
   586     void DeleteAndRemoveOperation(
       
   587             const TInt aOpArrayIndex, TInt aCompleteCode );
       
   588 
       
   589 private:
       
   590 
       
   591     /**
       
   592     * Maps symbian msv api's folder type to fs folder type
       
   593     */
       
   594     TFSFolderType GetFolderType(
       
   595             CMsvEntry* aEntry,
       
   596             TFSMailMsgId aFolderId );
       
   597 
       
   598     /**
       
   599     * Set folders to blocklist in online, offline or in both cases.
       
   600     * Operations (move/copy) allowed only between remote folders
       
   601     * (+IMAP inbox) in online mode and Outbox->Drafts
       
   602     */
       
   603     void BlockCopyMoveFromFoldersL(
       
   604         CMsvEntry* aFolderEntry,
       
   605         TFSMailMsgId aFolderId,
       
   606         CFSMailFolder& aFSMailFolder );
       
   607 
       
   608     /**
       
   609      * Set IMEI code to service's TEntry.iDescription
       
   610      */
       
   611     void StoreIMEIToMailboxL( const TMsvId aMailboxId );
       
   612 
       
   613     /**
       
   614      * Deletes the activity timer related to the specified mailbox, if it exists.
       
   615      * If no timer is found, method returns silently
       
   616      * @param aMailBoxId specifies the mailbox
       
   617      */
       
   618     void DeleteActivityTimer( const TFSMailMsgId& aMailBoxId  );
       
   619 
       
   620 protected: // internal enumerations and data structures
       
   621 
       
   622     enum TSyncStatesInCenRep
       
   623         {
       
   624         ESyncFinishedSuccessfully = 103,
       
   625         ESyncError,
       
   626         ESyncCancelled
       
   627         };
       
   628 
       
   629 private:
       
   630 
       
   631     CIpsPlgSosBasePlugin();
       
   632 
       
   633 protected:
       
   634 
       
   635     // uint of fs plugin implementation, pop of imap
       
   636     const TUint iFSPluginId;
       
   637 
       
   638     // Symbian message server session
       
   639     CMsvSession* iSession;
       
   640 
       
   641     // Message mapper instance
       
   642     CIpsPlgMsgMapper* iMsgMapper;
       
   643 
       
   644     //array of operation watchers
       
   645     RPointerArray<CIpsPlgSingleOpWatcher>   iOperations;
       
   646 
       
   647     //array of activity timers
       
   648     RPointerArray<CIpsPlgTimerOperation>   iActivitytimers;
       
   649 
       
   650     // contains smtp protocol related functions
       
   651 	CIpsPlgSmtpService* iSmtpService;
       
   652 
       
   653     // Cached Symbian message data structures
       
   654     CMsvEntry* iCachedEntry;
       
   655     CImEmailMessage* iCachedEmailMessage;
       
   656 
       
   657     // read and write most recent used address list
       
   658     CIpsPlgMruList* iMruList;
       
   659 
       
   660     // Search Engine
       
   661     CIpsPlgSearch*  iSearch;
       
   662 
       
   663     // interface to mailbox settings
       
   664     CIpsSetDataApi*     iSettingsApi;
       
   665 
       
   666     // maps symbian events to fs events
       
   667     CIpsPlgEventHandler*    iEventHandler;
       
   668 
       
   669     // keeps track is sync started in some plugin instance
       
   670     // or in always online needed when mailbox status is asked
       
   671     CIpsPlgSyncStateHandler* iSyncStateHandler;
       
   672 
       
   673     RConnectionMonitor              iConMon;
       
   674 
       
   675     // flag indicates is msv session ready
       
   676     TBool iSessionOk;
       
   677 
       
   678     TBuf<KIpsPlgMaxPhoneIdLength>  iIMEI;
       
   679 
       
   680     // branding id i.e. "yahoo.com" or "google"
       
   681     HBufC*  iBrandingId;
       
   682 
       
   683     // flag indicates is instance under FSEmail.exe
       
   684     TBool iIsUnderUiProcess;
       
   685 
       
   686     // <cmail> delete draft synchronously
       
   687     CActiveSchedulerWait iWait;
       
   688 	// </cmail>
       
   689 	};
       
   690 
       
   691 #endif /* IPSPLGSOSBASEPLUGIN_H */
       
   692 
       
   693 // End of File