ipsservices/ipssosplugin/inc/ipsplgsosbaseplugin.h
changeset 23 2dc6caa42ec3
parent 20 ecc8def7944a
child 30 759dc5235cdb
equal deleted inserted replaced
20:ecc8def7944a 23:2dc6caa42ec3
     1 /*
     1 /*
     2 * Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). 
     2 * Copyright (c) 2007 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".
    36 class CImEmailMessage;
    36 class CImEmailMessage;
    37 class CIpsPlgMruList;
    37 class CIpsPlgMruList;
    38 class CIpsPlgSettingsObserver;
    38 class CIpsPlgSettingsObserver;
    39 class CRepository;
    39 class CRepository;
    40 class CIpsPlgSearch;
    40 class CIpsPlgSearch;
       
    41 // <qmail> CIpsSetDataApi removed
    41 class CIpsPlgSmtpService;
    42 class CIpsPlgSmtpService;
    42 class CIpsPlgSyncStateHandler;
    43 class CIpsPlgSyncStateHandler;
    43 class CIpsPlgEventHandler;
    44 class CIpsPlgEventHandler;
    44 
    45 
    45 /**
    46 /**
    46  *  FreestyleIpsServices plugin class 
    47  *  FreestyleIpsServices plugin class
    47  * 
    48  *
    48  *  @lib ipssosplugin.lib
    49  *  @lib ipssosplugin.lib
    49  *  @since FSEmail 2.0
    50  *  @since FSEmail 2.0
    50  */
    51  */
    51 NONSHARABLE_CLASS ( CIpsPlgSosBasePlugin ) :
    52 NONSHARABLE_CLASS ( CIpsPlgSosBasePlugin ) :
    52     public CFSMailPlugin,
    53     public CFSMailPlugin,
    53                              public MIpsPlgSingleOpWatcher,
    54                              public MIpsPlgSingleOpWatcher,
    54                              public MFSMailRequestObserver, // a dummy observer
    55                              public MFSMailRequestObserver, // a dummy observer
    55                              public MIpsPlgTimerOperationCallBack
    56                              public MIpsPlgTimerOperationCallBack
    56     {  
    57     {
    57     
    58 
    58 public:
    59 public:
    59 		
    60 
    60     /**
    61     /**
    61     * ~CIpsPlgSosBasePlugin
    62     * ~CIpsPlgSosBasePlugin
    62     * Destructor
    63     * Destructor
    63     */
    64     */
    64     IMPORT_C virtual ~CIpsPlgSosBasePlugin();
    65     IMPORT_C virtual ~CIpsPlgSosBasePlugin();
    65 
    66 
    66 public: //from MIpsPlgSingleOpWatcher
    67 public: //from MIpsPlgSingleOpWatcher
    67 
    68 
    68     /**
    69     /**
    69     * 
    70     *
    70     */
    71     */
    71     void OpCompleted( 
    72     void OpCompleted(
    72         CIpsPlgSingleOpWatcher& aOpWatcher, 
    73         CIpsPlgSingleOpWatcher& aOpWatcher,
    73         TInt aCompletionCode );
    74         TInt aCompletionCode );
    74 
    75 
    75 public: //from MFSMailRequestObserver
    76 public: //from MFSMailRequestObserver
    76     
    77 
    77     /**
    78     /**
    78     * no real implementation for this. we're just a dummy observer,
    79     * no real implementation for this. we're just a dummy observer,
    79     * so we can internally run our own operations, like DisconnectL
    80     * so we can internally run our own operations, like DisconnectL
    80     */
    81     */
    81     virtual void RequestResponseL( TFSProgress aEvent, TInt aRequestId );
    82     virtual void RequestResponseL( TFSProgress aEvent, TInt aRequestId );
    82     
    83 
    83 public: // from MIpsPlgTimerOperationCallBack
    84 public: // from MIpsPlgTimerOperationCallBack
    84     
    85 
    85     /**
    86     /**
    86     * Called when activity timer fires
    87     * Called when activity timer fires
    87     */    
    88     */
    88     virtual void HandleTimerFiredL( const TFSMailMsgId& aMailboxId );
    89     virtual void HandleTimerFiredL( const TFSMailMsgId& aMailboxId );
    89     
    90 
    90 public: // from CFSMailPlugin
    91 public: // from CFSMailPlugin
    91 
    92 
    92     virtual void SetMailboxName(
    93     virtual void SetMailboxName(
    93          const TFSMailMsgId& aMailboxId, 
    94          const TFSMailMsgId& aMailboxId,
    94          const TDesC& aMailboxName );
    95          const TDesC& aMailboxName );
    95     
    96 
    96     virtual TFSMailBoxStatus GetMailBoxStatus( 
    97     virtual TFSMailBoxStatus GetMailBoxStatus(
    97          const TFSMailMsgId& aMailBoxId );
    98          const TFSMailMsgId& aMailBoxId );
    98 
    99 
    99     virtual TFSMailMsgId SpecifiedSendingMailbox();
   100     virtual TFSMailMsgId SpecifiedSendingMailbox();
   100 
   101 
   101     virtual void ListMailBoxesL( RArray<TFSMailMsgId>& aMailboxes);
   102     virtual void ListMailBoxesL( RArray<TFSMailMsgId>& aMailboxes);
   108         const TInt aRequestId );
   109         const TInt aRequestId );
   109 
   110 
   110     virtual TDesC& GetBrandingIdL( const TFSMailMsgId& aMailBoxId);
   111     virtual TDesC& GetBrandingIdL( const TFSMailMsgId& aMailBoxId);
   111 
   112 
   112     virtual void MoveMessagesL(
   113     virtual void MoveMessagesL(
   113         const TFSMailMsgId& aMailBoxId, 
   114         const TFSMailMsgId& aMailBoxId,
   114         const RArray<TFSMailMsgId>& aMessageIds, 
   115         const RArray<TFSMailMsgId>& aMessageIds,
   115         const TFSMailMsgId& aSourceFolderId, 
   116         const TFSMailMsgId& aSourceFolderId,
   116         const TFSMailMsgId& aDestinationFolderId );     
   117         const TFSMailMsgId& aDestinationFolderId );
   117 
   118 
   118     virtual void CopyMessagesL( 
   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(
   119         const TFSMailMsgId& aMailBoxId,
   128         const TFSMailMsgId& aMailBoxId,
   120         const RArray<TFSMailMsgId>& aMessageIds,
   129         const RArray<TFSMailMsgId>& aMessageIds,
   121         RArray<TFSMailMsgId>& aNewMessages,
   130         RArray<TFSMailMsgId>& aNewMessages,
   122         const TFSMailMsgId& aSourceFolderId,
   131         const TFSMailMsgId& aSourceFolderId,
   123         const TFSMailMsgId& aDestinationFolderId );
   132         const TFSMailMsgId& aDestinationFolderId );
   124 
   133 
   125     virtual MDesCArray* GetMrusL( const TFSMailMsgId& aMailBoxId );
   134     virtual MDesCArray* GetMrusL( const TFSMailMsgId& aMailBoxId );
   126 
   135 
   127     virtual void SetMrusL( 
   136     virtual void SetMrusL(
   128             const TFSMailMsgId& aMailBoxId, 
   137             const TFSMailMsgId& aMailBoxId,
   129             MDesCArray* aNewMruList );
   138             MDesCArray* aNewMruList );
   130 
   139 
   131     virtual const TFSProgress GetLastSyncStatusL( 
   140     virtual const TFSProgress GetLastSyncStatusL(
   132         const TFSMailMsgId& aMailBoxId );
   141         const TFSMailMsgId& aMailBoxId );
   133 
   142 
   134     virtual TInt CancelSyncL( const TFSMailMsgId& aMailBoxId );
   143     virtual TInt CancelSyncL( const TFSMailMsgId& aMailBoxId );
   135 
   144 
   136     // FOLDER HANDLING
   145     // FOLDER HANDLING
   137 
   146 
   138     virtual CFSMailFolder* GetFolderByUidL( 
   147     virtual CFSMailFolder* GetFolderByUidL(
   139         const TFSMailMsgId& aMailBoxId, 
   148         const TFSMailMsgId& aMailBoxId,
   140         const TFSMailMsgId& aFolderId );
   149         const TFSMailMsgId& aFolderId );
   141 
   150 
   142     virtual CFSMailFolder* CreateFolderL( 
   151     virtual CFSMailFolder* CreateFolderL(
   143         const TFSMailMsgId& aMailBoxId, 
   152         const TFSMailMsgId& aMailBoxId,
   144         const TFSMailMsgId& aFolderId,
   153         const TFSMailMsgId& aFolderId,
   145         const TDesC& aFolderName, 
   154         const TDesC& aFolderName,
   146         const TBool aSync );
   155         const TBool aSync );
   147 
   156 
   148     virtual void DeleteFolderByUidL(
   157     virtual void DeleteFolderByUidL(
   149         const TFSMailMsgId& aMailBoxId, 
   158         const TFSMailMsgId& aMailBoxId,
   150         const TFSMailMsgId& aFolderId);
   159         const TFSMailMsgId& aFolderId);
   151 
   160 
   152     // MESSAGE FETCH AND STORE
   161     // MESSAGE FETCH AND STORE
   153 
   162 
   154     virtual MFSMailIterator* ListMessagesL(
   163     virtual MFSMailIterator* ListMessagesL(
   155         const TFSMailMsgId& aMailBoxId,
   164         const TFSMailMsgId& aMailBoxId,
   156         const TFSMailMsgId& aFolderId,
   165         const TFSMailMsgId& aFolderId,
   157         const TFSMailDetails aDetails,
   166         const TFSMailDetails aDetails,
   158         const RArray<TFSMailSortCriteria>& aSorting );
   167         const RArray<TFSMailSortCriteria>& aSorting );
   159 
   168 
   160     virtual CFSMailMessage* GetMessageByUidL( 
   169     virtual CFSMailMessage* GetMessageByUidL(
   161         const TFSMailMsgId& aMailBoxId, 
   170         const TFSMailMsgId& aMailBoxId,
   162         const TFSMailMsgId& aFolderId,
   171         const TFSMailMsgId& aFolderId,
   163         const TFSMailMsgId& aMessageId, 
   172         const TFSMailMsgId& aMessageId,
   164         const TFSMailDetails aDetails);
   173         const TFSMailDetails aDetails);
   165 
   174 
   166     virtual void DeleteMessagesByUidL( 
   175     virtual void DeleteMessagesByUidL(
   167         const TFSMailMsgId& aMailBoxId,
   176         const TFSMailMsgId& aMailBoxId,
   168         const TFSMailMsgId& aFolderId,
   177         const TFSMailMsgId& aFolderId,
   169         const RArray<TFSMailMsgId>& aMessages );
   178         const RArray<TFSMailMsgId>& aMessages );
   170 
   179 
   171     // MESSAGE STORE OPERATIONS
   180     // MESSAGE STORE OPERATIONS
   172 
   181 
   173     virtual CFSMailMessage* CreateMessageToSendL( 
   182     virtual CFSMailMessage* CreateMessageToSendL(
   174         const TFSMailMsgId& aMailBoxId );
   183         const TFSMailMsgId& aMailBoxId );
   175     
   184     
   176 // <qmail>
   185 // <qmail>
   177     /**
   186     /**
   178      * Creates new email message to message store asynchronously
   187      * Creates new email message to message store asynchronously
   185 	    const TFSMailMsgId& aMailBoxId,
   194 	    const TFSMailMsgId& aMailBoxId,
   186         MFSMailRequestObserver& aOperationObserver,
   195         MFSMailRequestObserver& aOperationObserver,
   187         const TInt aRequestId );
   196         const TInt aRequestId );
   188 // </qmail>
   197 // </qmail>
   189 
   198 
   190     virtual CFSMailMessage* CreateForwardMessageL( 
   199     virtual CFSMailMessage* CreateForwardMessageL(
   191         const TFSMailMsgId& aMailBoxId, 
   200         const TFSMailMsgId& aMailBoxId,
   192         const TFSMailMsgId& aOriginalMessageId,
   201         const TFSMailMsgId& aOriginalMessageId,
   193         const TDesC& aHeaderDescriptor );
   202         const TDesC& aHeaderDescriptor );
   194 
   203 
   195 // <qmail>
   204 // <qmail>
   196     /**
   205     /**
   207         MFSMailRequestObserver& aOperationObserver,
   216         MFSMailRequestObserver& aOperationObserver,
   208         const TInt aRequestId,
   217         const TInt aRequestId,
   209         const TDesC& aHeaderDescriptor = KNullDesC );
   218         const TDesC& aHeaderDescriptor = KNullDesC );
   210 // </qmail>
   219 // </qmail>
   211 
   220 
   212     virtual CFSMailMessage* CreateReplyMessageL( 
   221     virtual CFSMailMessage* CreateReplyMessageL(
   213         const TFSMailMsgId& aMailBoxId, 
   222         const TFSMailMsgId& aMailBoxId,
   214         const TFSMailMsgId& aOriginalMessageId,
   223         const TFSMailMsgId& aOriginalMessageId,
   215         const TBool aReplyToAll,
   224         const TBool aReplyToAll,
   216         const TDesC& aHeaderDescriptor );
   225         const TDesC& aHeaderDescriptor );
   217 
   226 
   218 // <qmail>
   227 // <qmail>
   232         MFSMailRequestObserver& aOperationObserver,
   241         MFSMailRequestObserver& aOperationObserver,
   233         const TInt aRequestId,
   242         const TInt aRequestId,
   234         const TDesC& aHeaderDescriptor );
   243         const TDesC& aHeaderDescriptor );
   235 // </qmail>
   244 // </qmail>
   236        
   245        
   237     virtual void StoreMessageL( 
   246     virtual void StoreMessageL(
   238         const TFSMailMsgId& aMailBoxId, 
   247         const TFSMailMsgId& aMailBoxId,
   239         CFSMailMessage& aMessage );
   248         CFSMailMessage& aMessage );
   240 
   249 
   241 
   250 
   242     // <qmail>
   251     // <qmail>
   243     virtual void StoreMessagesL(
   252     virtual void StoreMessagesL(
   246             MFSMailRequestObserver& aOperationObserver,
   255             MFSMailRequestObserver& aOperationObserver,
   247             const TInt aRequestId );
   256             const TInt aRequestId );
   248     // </qmail>
   257     // </qmail>
   249             
   258             
   250     virtual void GetMessagesL(
   259     virtual void GetMessagesL(
   251         const TFSMailMsgId& aMailBoxId, 
   260         const TFSMailMsgId& aMailBoxId,
   252         const TFSMailMsgId& aFolderId,
   261         const TFSMailMsgId& aFolderId,
   253         const RArray<TFSMailMsgId>& aMessageIds,
   262         const RArray<TFSMailMsgId>& aMessageIds,
   254         RPointerArray<CFSMailMessage>& aMessageList,
   263         RPointerArray<CFSMailMessage>& aMessageList,
   255         const TFSMailDetails aDetails );
   264         const TFSMailDetails aDetails );
   256     						
   265 
   257     virtual void ChildPartsL( 
   266     virtual void ChildPartsL(
   258         const TFSMailMsgId& aMailBoxId,
   267         const TFSMailMsgId& aMailBoxId,
   259         const TFSMailMsgId& aParentFolderId,
   268         const TFSMailMsgId& aParentFolderId,
   260         const TFSMailMsgId& aMessageId,
   269         const TFSMailMsgId& aMessageId,
   261         const TFSMailMsgId& aParentId,
   270         const TFSMailMsgId& aParentId,
   262         RPointerArray<CFSMailMessagePart>& aParts);
   271         RPointerArray<CFSMailMessagePart>& aParts);
   263     						
   272 
   264     virtual CFSMailMessagePart* NewChildPartL(
   273     virtual CFSMailMessagePart* NewChildPartL(
   265         const TFSMailMsgId& aMailBoxId,
   274         const TFSMailMsgId& aMailBoxId,
   266         const TFSMailMsgId& aParentFolderId,
   275         const TFSMailMsgId& aParentFolderId,
   267         const TFSMailMsgId& aMessageId,
   276         const TFSMailMsgId& aMessageId,
   268         const TFSMailMsgId& aParentPartId,
   277         const TFSMailMsgId& aParentPartId,
   330         const TFSMailMsgId& aPartId,
   339         const TFSMailMsgId& aPartId,
   331         MFSMailRequestObserver& aOperationObserver,
   340         MFSMailRequestObserver& aOperationObserver,
   332         const TInt aRequestId );
   341         const TInt aRequestId );
   333     // </qmail>
   342     // </qmail>
   334         
   343         
   335     virtual CFSMailMessagePart* MessagePartL(  
   344     virtual CFSMailMessagePart* MessagePartL(
   336         const TFSMailMsgId& aMailBoxId, 
   345         const TFSMailMsgId& aMailBoxId,
   337         const TFSMailMsgId& aParentFolderId,
   346         const TFSMailMsgId& aParentFolderId,
   338         const TFSMailMsgId& aMessageId,
   347         const TFSMailMsgId& aMessageId,
   339         const TFSMailMsgId& aMessagePartId);
   348         const TFSMailMsgId& aMessagePartId);
   340 
   349 
   341     virtual TInt GetMessagePartFileL(  
   350     virtual TInt GetMessagePartFileL(
   342         const TFSMailMsgId& aMailBoxId, 
   351         const TFSMailMsgId& aMailBoxId,
   343         const TFSMailMsgId& aParentFolderId,
   352         const TFSMailMsgId& aParentFolderId,
   344         const TFSMailMsgId& aMessageId,
   353         const TFSMailMsgId& aMessageId,
   345         const TFSMailMsgId& aMessagePartId, 
   354         const TFSMailMsgId& aMessagePartId,
   346         RFile& aFileHandle);
   355         RFile& aFileHandle);
   347 
   356 
   348     virtual void CopyMessagePartFileL( 
   357     virtual void CopyMessagePartFileL(
   349         const TFSMailMsgId& aMailBoxId, 
   358         const TFSMailMsgId& aMailBoxId,
   350         const TFSMailMsgId& aParentFolderId,
   359         const TFSMailMsgId& aParentFolderId,
   351         const TFSMailMsgId& aMessageId,
   360         const TFSMailMsgId& aMessageId,
   352         const TFSMailMsgId& aMessagePartId, 
   361         const TFSMailMsgId& aMessagePartId,
   353         const TDesC& aFilePath);
   362         const TDesC& aFilePath);
   354 
   363 
   355     virtual void GetContentToBufferL(	
   364     virtual void GetContentToBufferL(
   356         const TFSMailMsgId& aMailBoxId,
   365         const TFSMailMsgId& aMailBoxId,
   357         const TFSMailMsgId& aParentFolderId,
   366         const TFSMailMsgId& aParentFolderId,
   358         const TFSMailMsgId& aMessageId,
   367         const TFSMailMsgId& aMessageId,
   359         const TFSMailMsgId& aMessagePartId,
   368         const TFSMailMsgId& aMessagePartId,
   360         TDes& aBuffer,
   369         TDes& aBuffer,
   361         const TUint aStartOffset);
   370         const TUint aStartOffset);
   362     						 
   371 
   363     virtual void SetContentL(
   372     virtual void SetContentL(
   364         const TDesC& aBuffer, 
   373         const TDesC& aBuffer,
   365         const TFSMailMsgId& aMailBoxId,
   374         const TFSMailMsgId& aMailBoxId,
   366         const TFSMailMsgId& aParentFolderId,
   375         const TFSMailMsgId& aParentFolderId,
   367         const TFSMailMsgId& aMessageId, 
   376         const TFSMailMsgId& aMessageId,
   368         const TFSMailMsgId& aMessagePartId); 
   377         const TFSMailMsgId& aMessagePartId);
   369 
   378 
   370     virtual void RemovePartContentL( 
   379     virtual void RemovePartContentL(
   371         const TFSMailMsgId& aMailBoxId, 
   380         const TFSMailMsgId& aMailBoxId,
   372         const TFSMailMsgId& aParentFolderId,
   381         const TFSMailMsgId& aParentFolderId,
   373         const TFSMailMsgId& aMessageId,
   382         const TFSMailMsgId& aMessageId,
   374         const RArray<TFSMailMsgId>& aPartIds);
   383         const RArray<TFSMailMsgId>& aPartIds);
   375         
   384 
   376     virtual void SetPartContentFromFileL(
   385     virtual void SetPartContentFromFileL(
   377         const TFSMailMsgId& aMailBoxId,
   386         const TFSMailMsgId& aMailBoxId,
   378         const TFSMailMsgId& aParentFolderId,
   387         const TFSMailMsgId& aParentFolderId,
   379         const TFSMailMsgId& aMessageId,
   388         const TFSMailMsgId& aMessageId,
   380         const TFSMailMsgId& aMessagePartId,
   389         const TFSMailMsgId& aMessagePartId,
   395 
   404 
   396     virtual void UnregisterRequestObserver( TInt aRequestId );
   405     virtual void UnregisterRequestObserver( TInt aRequestId );
   397 
   406 
   398     // MESSAGE SENDING
   407     // MESSAGE SENDING
   399 
   408 
       
   409     virtual void SendL(TFSMailMsgId aMessageId );
       
   410 
   400     virtual void SendMessageL( CFSMailMessage& aMessage );
   411     virtual void SendMessageL( CFSMailMessage& aMessage );
   401 
   412 
   402     virtual void SendMessageL(
   413     virtual void SendMessageL(
   403         CFSMailMessage& aMessage,
   414         CFSMailMessage& aMessage,
   404         MFSMailRequestObserver& aOperationObserver,
   415         MFSMailRequestObserver& aOperationObserver,
   405         const TInt aRequestId );
   416         const TInt aRequestId );
   406 
   417 
   407     // OPERATION HANDLING
   418     // OPERATION HANDLING
   408     
   419 
   409     virtual void GoOnlineL( const TFSMailMsgId& aMailBoxId );
   420     virtual void GoOnlineL( const TFSMailMsgId& aMailBoxId );
   410     
   421 
   411     virtual void GoOfflineL( const TFSMailMsgId& aMailBoxId );
   422     virtual void GoOfflineL( const TFSMailMsgId& aMailBoxId );
   412     						
   423 
   413     virtual TFSProgress StatusL(const TInt aRequestId);
   424     virtual TFSProgress StatusL(const TInt aRequestId);
   414 
   425 
   415     virtual void CancelL(const TInt aRequestId);
   426     virtual void CancelL(const TInt aRequestId);
   416 
   427 
   417     // Search API 
   428     // Search API
   418 
   429 
   419     virtual void SearchL( 
   430     virtual void SearchL(
   420         const TFSMailMsgId& aMailBoxId,
   431         const TFSMailMsgId& aMailBoxId,
   421         const RArray<TFSMailMsgId>& aFolderIds,
   432         const RArray<TFSMailMsgId>& aFolderIds,
   422         const RPointerArray<TDesC>& aSearchStrings,
   433         const RPointerArray<TDesC>& aSearchStrings,
   423         const TFSMailSortCriteria& aSortCriteria,
   434         const TFSMailSortCriteria& aSortCriteria,
   424         MFSMailBoxSearchObserver& aSearchObserver );
   435         MFSMailBoxSearchObserver& aSearchObserver );
   440 
   451 
   441     virtual TSSMailSyncState CurrentSyncState(
   452     virtual TSSMailSyncState CurrentSyncState(
   442         const TFSMailMsgId& aMailBoxId);
   453         const TFSMailMsgId& aMailBoxId);
   443 
   454 
   444     virtual TInt WizardDataAvailableL( );
   455     virtual TInt WizardDataAvailableL( );
   445     
   456 
   446     /**
   457     /**
   447      * reads connection id from plugin
   458      * reads connection id from plugin
   448      *
   459      *
   449      * @param  aConnectionId reference to connection id
   460      * @param  aConnectionId reference to connection id
   450      * @return KErrNone or error code
   461      * @return KErrNone or error code
   452      virtual TInt GetConnectionId( TFSMailMsgId aMailBoxId, TUint32& aConnectionId );
   463      virtual TInt GetConnectionId( TFSMailMsgId aMailBoxId, TUint32& aConnectionId );
   453 
   464 
   454     /**
   465     /**
   455      * checks from plugin if connection is allowed when roaming
   466      * checks from plugin if connection is allowed when roaming
   456      *
   467      *
   457      * @param  aConnectionAllowed 
   468      * @param  aConnectionAllowed
   458      * @return KErrNone or error code
   469      * @return KErrNone or error code
   459      */
   470      */
   460      virtual TInt IsConnectionAllowedWhenRoaming( 
   471      virtual TInt IsConnectionAllowedWhenRoaming(
   461              TFSMailMsgId aMailBoxId, 
   472              TFSMailMsgId aMailBoxId,
   462              TBool& aConnectionAllowed );
   473              TBool& aConnectionAllowed );
   463 
   474 
   464     virtual void AuthenticateL(
   475     virtual void AuthenticateL(
   465         MFSMailRequestObserver& aOperationObserver,
   476         MFSMailRequestObserver& aOperationObserver,
   466         TInt aRequestId );
   477         TInt aRequestId );
   467 
   478 
   468     virtual void SetCredentialsL( 
   479     virtual void SetCredentialsL(
   469        const TFSMailMsgId& aMailBoxId, 
   480        const TFSMailMsgId& aMailBoxId,
   470        const TDesC& aUsername,
   481        const TDesC& aUsername,
   471        const TDesC& aPassword );
   482        const TDesC& aPassword );
   472     
   483 
   473 public:
   484 public:
   474     
   485 
   475     /**
   486     /**
   476     * Function to identify which protocol plugin we are working with
   487     * Function to identify which protocol plugin we are working with
   477     * @return MTM id
   488     * @return MTM id
   478     * @since FSEmail 2.0
   489     * @since FSEmail 2.0
   479     */
   490     */
   484      *
   495      *
   485      * @return Implementation ID of the plugin
   496      * @return Implementation ID of the plugin
   486      * @since FSEmail 2.0
   497      * @since FSEmail 2.0
   487      */
   498      */
   488    TUint PluginId() const;
   499    TUint PluginId() const;
   489     
   500 
   490     /**
   501     /**
   491      * Disconnects mailbox
   502      * Disconnects mailbox
   492      *
   503      *
   493      * @param aMailbox unique mailbox id
   504      * @param aMailbox unique mailbox id
   494      * @param FSObserver can be pointed at this class (dummy observer)
   505      * @param FSObserver can be pointed at this class (dummy observer)
   495      * @param aRequestId FS async operation request id, can be zero (dummy)
   506      * @param aRequestId FS async operation request id, can be zero (dummy)
   496      * @param aRemoveAccountAlso boolean to indicate should accound be
   507      * @param aRemoveAccountAlso boolean to indicate should accound be
   497      *                           removed afted disconnect, default is EFalse
   508      *                           removed afted disconnect, default is EFalse
   498      * @since FSEmail 2.0
   509      * @since FSEmail 2.0
   499      */
   510      */
   500     virtual void DisconnectL( 
   511     virtual void DisconnectL(
   501         const TFSMailMsgId& aMailBoxId, 
   512         const TFSMailMsgId& aMailBoxId,
   502         MFSMailRequestObserver& aObserver,
   513         MFSMailRequestObserver& aObserver,
   503         const TInt aRequestId,
   514         const TInt aRequestId,
   504         TBool aRemoveAccountAlso = EFalse );
   515         TBool aRemoveAccountAlso = EFalse );
   505     
   516 
   506     /**
   517     /**
   507      * Fetch content of new mail, used in event handler
   518      * Fetch content of new mail, used in event handler
   508      * needed because imap idle
   519      * needed because imap idle
   509      *
   520      *
   510      * @param aMailbox unique mailbox id
   521      * @param aMailbox unique mailbox id
   511      * @param aNewId msv id of new mail
   522      * @param aNewId msv id of new mail
   512      * @param aParentId new mail's parent entry id
   523      * @param aParentId new mail's parent entry id
   513      * @since FSEmail 2.0
   524      * @since FSEmail 2.0
   514      */
   525      */
   515     virtual void PopulateNewMailL( 
   526     virtual void PopulateNewMailL(
   516         const TFSMailMsgId& aMailboxId, 
   527         const TFSMailMsgId& aMailboxId,
   517         TMsvId aNewId, 
   528         TMsvId aNewId,
   518         TMsvId aParentId ) = 0;
   529         TMsvId aParentId ) = 0;
   519     
   530 
   520     /**
   531     /**
   521      * Gets reference to activity timer object, used when clearing
   532      * Gets reference to activity timer object, used when clearing
   522      * activity timer in operation complete function (online operation)
   533      * activity timer in operation complete function (online operation)
   523      * activity timer disconnects mailbox if no operations are running in
   534      * activity timer disconnects mailbox if no operations are running in
   524      * certain period of time
   535      * certain period of time
   526      * @param aMailbox unique mailbox id
   537      * @param aMailbox unique mailbox id
   527      * @return reference to mailbox's activity timer object
   538      * @return reference to mailbox's activity timer object
   528      * @since FSEmail 2.0
   539      * @since FSEmail 2.0
   529      */
   540      */
   530     CIpsPlgTimerOperation& ActivityTimerL( const TFSMailMsgId& aMailBoxId );
   541     CIpsPlgTimerOperation& ActivityTimerL( const TFSMailMsgId& aMailBoxId );
   531     
   542 
   532     /*
   543     /*
   533      * Gets reference to sync state handler class
   544      * Gets reference to sync state handler class
   534      * @return reference to sync state handler 
   545      * @return reference to sync state handler
   535      * @since FSEmail 2.0
   546      * @since FSEmail 2.0
   536      */
   547      */
   537     CIpsPlgSyncStateHandler& GetSyncStateHandler();
   548     CIpsPlgSyncStateHandler& GetSyncStateHandler();
   538     
   549 
   539     /**
   550     /**
   540      * This is called after msv session ready event comes from msv server
   551      * This is called after msv session ready event comes from msv server
   541      * @since FSEmail 2.0
   552      * @since FSEmail 2.0
   542      */
   553      */
   543     void CompleteConstructL();
   554     void CompleteConstructL();
   544     
   555 
   545     
   556 
   546     /**
   557     /**
   547      * called if session terminated event is sent by msv server
   558      * called if session terminated event is sent by msv server
   548      * @since FSEmail 2.0
   559      * @since FSEmail 2.0
   549      */
   560      */
   550     void SessionTerminated();
   561     void SessionTerminated();
   551     
   562 
   552     /**
   563     /**
   553     * Does checks to see is connection attempt possible and allowed
   564     * Does checks to see is connection attempt possible and allowed
   554     * @param aMailboxId mailbox to do the checks to
   565     * @param aMailboxId mailbox to do the checks to
   555     * @param aReason (possible) reason code if EFalse is returned
   566     * @param aReason (possible) reason code if EFalse is returned
   556     * @return EFalse if can't proceed with connect
   567     * @return EFalse if can't proceed with connect
   557     * @since FSEmail 2.0
   568     * @since FSEmail 2.0
   558     */
   569     */
   559     TBool CanConnectL( const TFSMailMsgId& aMailboxId,
   570     TBool CanConnectL( const TFSMailMsgId& aMailboxId,
   560         TInt& aReason );
   571         TInt& aReason );
   561     
   572 
   562     /*
   573     /*
   563      * Gludge type check is plugin instance running under ui process
   574      * Gludge type check is plugin instance running under ui process
   564      * needed in event handler
   575      * needed in event handler
   565      * @since FSEmail 2.0
   576      * @since FSEmail 2.0
   566      */
   577      */
   567     TBool IsUnderUiProcess();
   578     TBool IsUnderUiProcess();
   568     
   579 
   569 protected:        
   580     // <qmail> new function
       
   581     /*
       
   582      * Checks whether given mailbox has ongoing operations or not
       
   583      * @param aMailboxId
       
   584      * @return true/false
       
   585      */
       
   586     TBool HasOperations( const TFSMailMsgId& aMailboxId );
       
   587     // </qmail>
       
   588 protected:
   570 
   589 
   571     /*
   590     /*
   572      * Constructor
   591      * Constructor
   573      * @param aFSPluginId uint of fs plugin implementation, imap or pop
   592      * @param aFSPluginId uint of fs plugin implementation, imap or pop
   574      */
   593      */
   579      */
   598      */
   580     void BaseConstructL();
   599     void BaseConstructL();
   581 
   600 
   582     /**
   601     /**
   583      * passes completion event to protocol plugin
   602      * passes completion event to protocol plugin
   584      * If certain operation completion requires special handling, 
   603      * If certain operation completion requires special handling,
   585      * protocol plugin should keep the id of the operation
   604      * protocol plugin should keep the id of the operation
   586      * so it can know, that this certain operation has completed.
   605      * so it can know, that this certain operation has completed.
   587      */
   606      */
   588     virtual void HandleOpCompletedL( 
   607     virtual void HandleOpCompletedL(
   589         CIpsPlgSingleOpWatcher& aOpWatcher, 
   608         CIpsPlgSingleOpWatcher& aOpWatcher,
   590         TInt aCompletionCode ) = 0;
   609         TInt aCompletionCode ) = 0;
   591     
   610 
   592     /**
   611     /**
   593     * Sends pending messages from outbox, if user manually start
   612     * Sends pending messages from outbox, if user manually start
   594     * send-receive operation.
   613     * send-receive operation.
   595     */
   614     */
   596     void EmptyOutboxL( const TFSMailMsgId& aMailBoxId );
   615     void EmptyOutboxL( const TFSMailMsgId& aMailBoxId );
   597     
   616 
   598     /**
   617     /**
   599     * Checks if offline mode is activated
   618     * Checks if offline mode is activated
   600     */
   619     */
   601     TBool OfflineModeSetL();
   620     TBool OfflineModeSetL();
   602     
   621 
   603     /**
   622     /**
   604     * Checks if given local feature is turned on
   623     * Checks if given local feature is turned on
   605     */
   624     */
   606     TBool CIpsPlgSosBasePlugin::LocalFeatureL(
   625     TBool CIpsPlgSosBasePlugin::LocalFeatureL(
   607         const TUid& aCenRepUid,
   626         const TUid& aCenRepUid,
   608         const TUint32 aKeyId,
   627         const TUint32 aKeyId,
   609         const TUint32 aFlag );
   628         const TUint32 aFlag );
   610     
   629 
   611     /**
   630     /**
   612     * Checks if we are roaming and are we allowed to
   631     * Checks if we are roaming and are we allowed to
   613     * connect if we are.
   632     * connect if we are.
   614     */
   633     */
   615     TBool RoamingCheckL();
   634     TBool RoamingCheckL();
   616     
   635 
   617     /**
   636     /**
   618     * Check network registration status i.e. are we in gsm or wlan network
   637     * Check network registration status i.e. are we in gsm or wlan network
   619     */
   638     */
   620     TInt RegistrationStatusL();
   639     TInt RegistrationStatusL();
   621     
   640 
   622     /**
   641     /**
   623     * Called from Imap Plugin's MoveMessagesL if destination folder
   642     * Called from Imap Plugin's MoveMessagesL if destination folder
   624     * is draft folder.
   643     * is draft folder.
   625     */
   644     */
   626     void MoveMessagesToDraftL(
   645     void MoveMessagesToDraftL(
   627         const TFSMailMsgId& aMailBoxId, 
   646         const TFSMailMsgId& aMailBoxId,
   628         const RArray<TFSMailMsgId>& aMessageIds, 
   647         const RArray<TFSMailMsgId>& aMessageIds,
   629         const TFSMailMsgId& aSourceFolderId, 
   648         const TFSMailMsgId& aSourceFolderId,
   630         const TFSMailMsgId& aDestinationFolderId );
   649         const TFSMailMsgId& aDestinationFolderId );
   631     
   650 
   632 private:
   651 private:
   633     
   652 
   634     /**
   653     /**
   635      * Returns a cached entry objects or creates new objects and keeps them
   654      * Returns a cached entry objects or creates new objects and keeps them
   636      * in the cache.
   655      * in the cache.
   637      * Returned objects should not be deleted in the calling method.
   656      * Returned objects should not be deleted in the calling method.
   638      * Pointers are set NULL in the case of error.
   657      * Pointers are set NULL in the case of error.
   639      * Pointers are valid until the method is called next time
   658      * Pointers are valid until the method is called next time
   640      * Method should be used only for entries representing messages (not 
   659      * Method should be used only for entries representing messages (not
   641      * folders or attachements).
   660      * folders or attachements).
   642      */
   661      */
   643     void GetMessageEntryL( 
   662     void GetMessageEntryL(
   644         TMsvId aId, 
   663         TMsvId aId,
       
   664         CMsvEntry*& aMessageEntry,
       
   665         CImEmailMessage*& aImEmailMessage );
       
   666 
       
   667     /**
       
   668 	 * Takes ownership of the cached objects or creates new ones
       
   669 	 */     	 
       
   670 	void TakeMessageEntryLC(
       
   671 		TMsvId aId,
   645         CMsvEntry*& aMessageEntry,
   672         CMsvEntry*& aMessageEntry,
   646         CImEmailMessage*& aImEmailMessage );
   673         CImEmailMessage*& aImEmailMessage );
   647     
   674     
       
   675     /**
       
   676      * Return objects to cache, deleting old ones in the cache if necessary
       
   677      */         
       
   678     void ReturnMessageEntry(
       
   679         CMsvEntry* aMessageEntry,
       
   680         CImEmailMessage* aImEmailMessage );
       
   681         
   648     /*
   682     /*
   649      * Cleans up the cached messages entries that have accessed with
   683      * Cleans up the cached messages entries that have accessed with
   650      * GetMessageEntryL()
   684      * GetMessageEntryL()
   651      */
   685      */
   652     void CleanCachedMessageEntries();
   686     void CleanCachedMessageEntries();
   653     
   687 
   654     /**
   688     /**
   655     * Cancel all online operations, use before disconnect
   689     * Cancel all online operations, use before disconnect
   656     */
   690     */
   657     void CancelAllOnlineOperations( const TFSMailMsgId& aMailboxId );
   691     void CancelAllOnlineOperations( const TFSMailMsgId& aMailboxId );
   658     
   692 
   659     /**
   693     /**
   660     * Checks is there any connect operations running, meaning
   694     * Checks is there any connect operations running, meaning
   661     * that we are "connected" state
   695     * that we are "connected" state
   662     */
   696     */
   663     TBool ConnOpRunning( const TFSMailMsgId& aMailBoxId  );
   697     TBool ConnOpRunning( const TFSMailMsgId& aMailBoxId  );
   664     
   698 
   665     /**
   699     /**
   666     * Cancel, delete and remove operation from iOperations array.
   700     * Cancel, delete and remove operation from iOperations array.
   667     * Send Sync Completed event to plugin if operation is sync op
   701     * Send Sync Completed event to plugin if operation is sync op
   668     */
   702     */
   669     void DeleteAndRemoveOperation( 
   703     void DeleteAndRemoveOperation(
   670             const TInt aOpArrayIndex, TInt aCompleteCode );
   704             const TInt aOpArrayIndex, TInt aCompleteCode );
       
   705 
       
   706     /**
       
   707      * Fixes the forward (or reply) message header parts (that are copied
       
   708      * to msg content) in case that caller has provided an own header 
       
   709      * descriptor for these parts.
       
   710      */
       
   711     void FixReplyForwardHeaderL(
       
   712             CFSMailMessage* aMessage,
       
   713             const TFSMailMsgId& aMailBoxId,
       
   714             const TFSMailMsgId& aOriginalMessageId,
       
   715             const TDesC& aHeaderDescriptor );
   671     
   716     
   672 private:        
   717 private:
   673 
   718 
   674     /**
   719     /**
   675     * Maps symbian msv api's folder type to fs folder type
   720     * Maps symbian msv api's folder type to fs folder type
   676     */
   721     */
   677     TFSFolderType GetFolderType( 
   722     TFSFolderType GetFolderType(
   678             CMsvEntry* aEntry, 
   723             CMsvEntry* aEntry,
   679             TFSMailMsgId aFolderId );
   724             TFSMailMsgId aFolderId );
   680     
   725 
   681     /**
   726     /**
   682     * Set folders to blocklist in online, offline or in both cases.
   727     * Set folders to blocklist in online, offline or in both cases.
   683     * Operations (move/copy) allowed only between remote folders 
   728     * Operations (move/copy) allowed only between remote folders
   684     * (+IMAP inbox) in online mode and Outbox->Drafts
   729     * (+IMAP inbox) in online mode and Outbox->Drafts
   685     */
   730     */
   686     void BlockCopyMoveFromFoldersL( 
   731     void BlockCopyMoveFromFoldersL(
   687         CMsvEntry* aFolderEntry, 
   732         CMsvEntry* aFolderEntry,
   688         TFSMailMsgId aFolderId, 
   733         TFSMailMsgId aFolderId,
   689         CFSMailFolder& aFSMailFolder );
   734         CFSMailFolder& aFSMailFolder );
   690     
   735 
   691     /**
   736     /**
   692      * Set IMEI code to service's TEntry.iDescription 
   737      * Set IMEI code to service's TEntry.iDescription
   693      */
   738      */
   694     void StoreIMEIToMailboxL( const TMsvId aMailboxId );
   739     void StoreIMEIToMailboxL( const TMsvId aMailboxId );
   695 
   740 
   696     /**
   741     /**
   697      * Deletes the activity timer related to the specified mailbox, if it exists.
   742      * Deletes the activity timer related to the specified mailbox, if it exists.
   699      * @param aMailBoxId specifies the mailbox
   744      * @param aMailBoxId specifies the mailbox
   700      */
   745      */
   701     void DeleteActivityTimer( const TFSMailMsgId& aMailBoxId  );
   746     void DeleteActivityTimer( const TFSMailMsgId& aMailBoxId  );
   702 
   747 
   703 protected: // internal enumerations and data structures
   748 protected: // internal enumerations and data structures
   704     
   749 
   705     enum TSyncStatesInCenRep
   750     enum TSyncStatesInCenRep
   706         {
   751         {
   707         ESyncFinishedSuccessfully = 103,
   752         ESyncFinishedSuccessfully = 103,
   708         ESyncError,
   753         ESyncError,
   709         ESyncCancelled
   754         ESyncCancelled
   710         };
   755         };
   711     
   756 
   712 private:
   757 private:
   713 
   758 
   714     CIpsPlgSosBasePlugin();
   759     CIpsPlgSosBasePlugin();
   715     
   760 
   716 protected:
   761 protected:
   717 
   762 
   718     // uint of fs plugin implementation, pop of imap
   763     // uint of fs plugin implementation, pop of imap
   719     const TUint iFSPluginId;
   764     const TUint iFSPluginId;
   720 
   765 
   721     // Symbian message server session
   766     // Symbian message server session
   722     CMsvSession* iSession;
   767     CMsvSession* iSession;
   723     
   768 
   724     // Message mapper instance
   769     // Message mapper instance
   725     CIpsPlgMsgMapper* iMsgMapper;
   770     CIpsPlgMsgMapper* iMsgMapper;
   726     
   771 
   727     //array of operation watchers
   772     //array of operation watchers
   728     RPointerArray<CIpsPlgSingleOpWatcher>   iOperations;
   773     RPointerArray<CIpsPlgSingleOpWatcher>   iOperations;
   729     
   774 
   730     //array of activity timers
   775     //array of activity timers
   731     RPointerArray<CIpsPlgTimerOperation>   iActivitytimers;
   776     RPointerArray<CIpsPlgTimerOperation>   iActivitytimers;
   732 
   777 
   733     // contains smtp protocol related functions
   778     // contains smtp protocol related functions
   734 	CIpsPlgSmtpService* iSmtpService;
   779 	CIpsPlgSmtpService* iSmtpService;
   735 
   780 
   736     // Cached Symbian message data structures
   781     // Cached Symbian message data structures
   737     CMsvEntry* iCachedEntry;
   782     CMsvEntry* iCachedEntry;
   738     CImEmailMessage* iCachedEmailMessage;
   783     CImEmailMessage* iCachedEmailMessage;
   739     
   784 
   740     // read and write most recent used address list
   785     // read and write most recent used address list
   741     CIpsPlgMruList* iMruList;
   786     CIpsPlgMruList* iMruList;
   742     
   787 
   743     // Search Engine
   788     // Search Engine
   744     CIpsPlgSearch*  iSearch;
   789     CIpsPlgSearch*  iSearch;
   745     
   790 
       
   791     // <qmail> iSettingsApi removed
       
   792 
   746     // maps symbian events to fs events
   793     // maps symbian events to fs events
   747     CIpsPlgEventHandler*    iEventHandler;
   794     CIpsPlgEventHandler*    iEventHandler;
   748     
   795 
   749     // keeps track is sync started in some plugin instance 
   796     // keeps track is sync started in some plugin instance
   750     // or in always online needed when mailbox status is asked
   797     // or in always online needed when mailbox status is asked
   751     CIpsPlgSyncStateHandler* iSyncStateHandler;
   798     CIpsPlgSyncStateHandler* iSyncStateHandler;
   752     
   799 
   753     RConnectionMonitor              iConMon;    
   800     RConnectionMonitor              iConMon;
   754     
   801 
   755     // flag indicates is msv session ready
   802     // flag indicates is msv session ready
   756     TBool iSessionOk;
   803     TBool iSessionOk;
   757     
   804 
   758     TBuf<KIpsPlgMaxPhoneIdLength>  iIMEI;
   805     TBuf<KIpsPlgMaxPhoneIdLength>  iIMEI;
   759 
   806 
   760     // branding id i.e. "yahoo.com" or "google"
   807     // branding id i.e. "yahoo.com" or "google"
   761     HBufC*  iBrandingId;
   808     HBufC*  iBrandingId;
   762     
   809 
   763     // flag indicates is instance under FSEmail.exe
   810     // flag indicates is instance under FSEmail.exe
   764     TBool iIsUnderUiProcess;
   811     TBool iIsUnderUiProcess;
   765 	};
   812 	};
   766 
   813 
   767 #endif /* IPSPLGSOSBASEPLUGIN_H */
   814 #endif /* IPSPLGSOSBASEPLUGIN_H */