email/imum/Utils/Inc/ImumInHealthServicesImpl.h
changeset 0 72b543305e3a
equal deleted inserted replaced
-1:000000000000 0:72b543305e3a
       
     1 /*
       
     2 * Copyright (c) 2006 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:  ImumInHealthServicesImpl.h
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef CIMUMINHEALTHSERVICESIMPL_H
       
    20 #define CIMUMINHEALTHSERVICESIMPL_H
       
    21 
       
    22 // INCLUDES
       
    23 #include <e32base.h>
       
    24 #include "ImumInHealthServices.h"
       
    25 
       
    26 
       
    27 // CONSTANTS
       
    28 enum TIMDErrors
       
    29     {
       
    30     EIMDNoError = 0,                        // 0
       
    31     EIMDUnknownMailbox,
       
    32     EIMDNoMemory,
       
    33     EIMDNotMailMtmId,
       
    34     EIMDGetEntryFailure,
       
    35     EIMDImap4AccountFailure,
       
    36     EIMDImap4AccountIdNotMatching,
       
    37     EIMDImap4RelatedEntryIdNotMatching,
       
    38     EIMDPop3AccountFailure,
       
    39     EIMDPop3AccountIdNotMatching,
       
    40     EIMDPop3RelatedEntryIdNotMatching,      // 10
       
    41     EIMDSmtpAccountFailure,
       
    42     EIMDSmtpAccountIdNotMatching,
       
    43     EIMDSmtpRelatedEntryIdNotMatching,
       
    44     EIMDSyncMlSettingsLoadFailure,          // Deprecated
       
    45     EIMDSyncMlMailboxIdNotMatching,         // Deprecated
       
    46     EIMDSyncMlMtmIdNotMatching,             // Deprecated
       
    47     EIMDStoringFailureWithIMEI,
       
    48     EIMDMismatchingIMEI,
       
    49     EIMDMissingIMEI,
       
    50     EIMDMailboxArrayCreationFailure,        // 20
       
    51     EIMDFlagCombinationNotSupported
       
    52     };
       
    53 
       
    54 // Maximum length of IMEI code
       
    55 const TInt KIMAMaxPhoneIdLength = 50;
       
    56 
       
    57 // Mail for Exchange MTM Uid
       
    58 const TInt KImumMtmMailForExchangeUidValue  = 0x1020695b;
       
    59 const TUid KImumMtmMailForExchangeUid       = { KImumMtmMailForExchangeUidValue };
       
    60 
       
    61 // MACROS
       
    62 // FORWARD DECLARATIONS
       
    63 class CImumInternalApiImpl;
       
    64 class MImumInMailboxUtilities;
       
    65 class CImumMboxManager;
       
    66 class CImumMboxSettingsCtrl;
       
    67 class CEmailAccounts;
       
    68 class CImumMboxDataExtension;
       
    69 
       
    70 // DATA TYPES
       
    71 
       
    72 /**
       
    73 *
       
    74 *  @lib
       
    75 *  @since S60 3.0
       
    76 */
       
    77 class CImumInHealthServicesImpl : public CBase, public MImumInHealthServices
       
    78     {
       
    79     public:  // Constructors and destructor
       
    80 
       
    81         /**
       
    82         * Creates object from CImumInHealthServicesImpl and leaves it to cleanup stack
       
    83         * @since S60 3.0
       
    84         * @return, Constructed object
       
    85         */
       
    86         static CImumInHealthServicesImpl* NewLC(
       
    87             CImumInternalApiImpl& aMailboxApi );
       
    88 
       
    89         /**
       
    90         * Create object from CImumInHealthServicesImpl
       
    91         * @since S60 3.0
       
    92         * @return, Constructed object
       
    93         */
       
    94         static CImumInHealthServicesImpl* NewL(
       
    95             CImumInternalApiImpl& aMailboxApi );
       
    96 
       
    97         /**
       
    98         * Destructor
       
    99         * @since S60 3.0
       
   100         */
       
   101         virtual ~CImumInHealthServicesImpl();
       
   102 
       
   103     public: // New functions
       
   104 
       
   105         /**
       
   106         *
       
   107         * @since S60 3.0
       
   108         */
       
   109         TIMDErrors StoreIMEIToMailbox( const TMsvId aMailboxId ) const;
       
   110 
       
   111     public: // Functions from base classes
       
   112 
       
   113         /*
       
   114         * From MImumInHealthServices. Returns array of fully operating mailboxes
       
   115         * @since S60 3.0
       
   116         * @param aMailboxArray Return parameter for array of mailboxes
       
   117         * @param aFlags Flags indicates the protocols to be included in array
       
   118         * @param aClearArray By default, the array is cleared before use
       
   119         * @return KErrNone, when array has been constructed successfully
       
   120         */
       
   121         TInt GetMailboxList(
       
   122             RMailboxIdArray& aHealthyMailboxArray,
       
   123             const TInt64 aFlags = EFlagSetHealthyReceiving,
       
   124             const TBool aClearArray = ETrue ) const;
       
   125 
       
   126         TInt GetHealthyMailboxList(
       
   127             RMailboxIdArray& aHealthyMailboxArray,
       
   128             const TInt64 aFlags = EFlagSetHealthyReceiving,
       
   129             const TBool aClearArray = ETrue ) const;
       
   130 
       
   131         /**
       
   132         * From MImumInHealthServices. Veriefies the mailbox condition
       
   133         * @since S60 3.0
       
   134         * @param aMailboxId The Id of the mailbox for the check
       
   135         * @return ETrue/EFalse according to condition
       
   136         */
       
   137         TBool IsMailboxHealthy(
       
   138             const TMsvId aMailboxId ) const;
       
   139 
       
   140         /**
       
   141         * Searches and destroys unhealthy mailboxes
       
   142         * @since S60 3.0
       
   143         */
       
   144         void CleanupUnhealthyMailboxes() const;
       
   145 
       
   146     protected:  // Constructors
       
   147 
       
   148         /**
       
   149         *
       
   150         * @since S60 3.0
       
   151         */
       
   152         CImumInHealthServicesImpl(
       
   153             CImumInternalApiImpl& aMailboxApi );
       
   154 
       
   155         /**
       
   156         *
       
   157         * @since S60 3.0
       
   158         */
       
   159         void ConstructL();
       
   160 
       
   161     protected:  // New virtual functions
       
   162     protected:  // New functions
       
   163     protected:  // Functions from base classes
       
   164 
       
   165     private:  // New virtual functions
       
   166     private:  // New functions
       
   167 
       
   168         /**
       
   169         *
       
   170         * @since S60 3.0
       
   171         */
       
   172         TIMDErrors StoreIMEIToEntry( const TMsvId aMailboxId ) const;
       
   173 
       
   174         /**
       
   175         *
       
   176         * @since S60 3.0
       
   177         */
       
   178         void StoreIMEIToEntryL( const TMsvId aMailboxId ) const;
       
   179 
       
   180         /**
       
   181         *
       
   182         * @since S60 3.0
       
   183         */
       
   184         TIMDErrors GetIMEIFromTheEntry(
       
   185             const TMsvId aEntryId,
       
   186             TDes& aIMEI ) const;
       
   187 
       
   188         /**
       
   189         *
       
   190         * @since S60 3.0
       
   191         */
       
   192         TIMDErrors GetIMEIFromTheEntry(
       
   193             const TMsvEntry& aEntry,
       
   194             TDes& aIMEI ) const;
       
   195 
       
   196         /**
       
   197         *
       
   198         * @since S60 3.0
       
   199         */
       
   200         void GetIMEIFromThePhoneL();
       
   201 
       
   202         /**
       
   203         *
       
   204         * @since S60 3.0
       
   205         */
       
   206         TIMDErrors VerifyMailboxHealth( const TMsvId aMailboxId ) const;
       
   207 
       
   208         /**
       
   209         *
       
   210         * @since S60 3.0
       
   211         */
       
   212         TIMDErrors VerifyMailboxHealth(
       
   213             const TMsvEntry& aPrimaryEntry,
       
   214             const TMsvEntry* aSecondaryEntry ) const;
       
   215 
       
   216         /**
       
   217         *
       
   218         * @since S60 3.0
       
   219         */
       
   220         TIMDErrors MatchEntryWithSettings(
       
   221             const TMsvEntry& aMailbox ) const;
       
   222 
       
   223         /**
       
   224         *
       
   225         * @since S60 3.0
       
   226         */
       
   227         TIMDErrors VerifyImap4EntryWithSettings(
       
   228             const TMsvEntry& aMailbox ) const;
       
   229 
       
   230         /**
       
   231         *
       
   232         * @since S60 3.0
       
   233         */
       
   234         TIMDErrors VerifyPop3EntryWithSettings(
       
   235             const TMsvEntry& aMailbox ) const;
       
   236 
       
   237         /**
       
   238         *
       
   239         * @since S60 3.0
       
   240         */
       
   241         TIMDErrors VerifySmtpEntryWithSettings(
       
   242             const TMsvEntry& aMailbox ) const;
       
   243 
       
   244         /**
       
   245         *
       
   246         * @since S60 3.0
       
   247         */
       
   248         TIMDErrors VerifyEntryIMEI( const TMsvEntry& aMailbox ) const;
       
   249 
       
   250         /**
       
   251         *
       
   252         * @since S60 3.0
       
   253         */
       
   254         void AppendToArray(
       
   255             const CMsvEntrySelection& aSelection,
       
   256             RMailboxIdArray& aMailboxArray,
       
   257             const TBool aAppendHealthy ) const;
       
   258 
       
   259         /**
       
   260         *
       
   261         * @since S60 3.0
       
   262         */
       
   263         void DoGetMailboxList(
       
   264             RMailboxIdArray& aMailboxArray,
       
   265             const TMuiuFlags& aFlags ) const;
       
   266 
       
   267         /**
       
   268         *
       
   269         * @since S60 3.0
       
   270         */
       
   271         void CreateMailboxListL(
       
   272             CMsvEntrySelection*& aPopSel,
       
   273             CMsvEntrySelection*& aImapSel ) const;
       
   274 
       
   275         /**
       
   276         *
       
   277         * @since S60 3.0
       
   278         */
       
   279         void DoCleanup( const RMailboxIdArray& aMailboxArray ) const;
       
   280 
       
   281 
       
   282         /**
       
   283         * Check if the mailbox type matches required mailbox
       
   284         * @since S60 3.1
       
   285         * @param aEntry, suspected mailbox entry
       
   286         * @param aFlags, controller flags (see TIMDFlags)
       
   287         * @return ETrue, when correct mailbox is in question
       
   288         * @return EFalse, when incorrect mailbox is in question
       
   289         */
       
   290         TBool IsRequiredMailbox(
       
   291             const TMsvEntry& aEntry,
       
   292             const TMuiuFlags& aFlags ) const;
       
   293 
       
   294         /**
       
   295         * Takes the provided flags to use, or uses default
       
   296         * @since S60 3.0
       
   297         * @param aFlags Flags to be used
       
   298         * @return Flags to be used for controlling
       
   299         */
       
   300         TMuiuFlags PrepareFlags( const TInt64 aFlags ) const;
       
   301 
       
   302         /**
       
   303         *
       
   304         * @since S60 3.0
       
   305         */
       
   306         TIMDErrors GetMailboxEntry(
       
   307             const TMsvId aMailboxId,
       
   308             TMsvEntry& aMailboxEntry ) const;
       
   309 
       
   310     private:  // Functions from base classes
       
   311 
       
   312     public:     // Data
       
   313     protected:  // Data
       
   314     private:    // Data
       
   315 
       
   316         enum TFlags
       
   317             {
       
   318             EFlagImap4 = 0,
       
   319             EFlagPop3,
       
   320             EFlagSmtp,
       
   321             EFlagSyncMl,    // Deprecated
       
   322             EFlagHealthy,
       
   323             EFlagOtherService,
       
   324             };
       
   325 
       
   326         // Message server session
       
   327         CImumInternalApiImpl&       iInternalApi;
       
   328         // Pointer to extended mail settings
       
   329         CImumMboxDataExtension*  iExtendedSettings;
       
   330         // IMEI code of the phone
       
   331         TBuf<KIMAMaxPhoneIdLength>  iIMEI;
       
   332         // RootEntry
       
   333         CMsvEntry*                  iRoot;
       
   334         // Shortcut to utilities
       
   335         MImumInMailboxUtilities*    iUtils;
       
   336     };
       
   337 
       
   338 #endif //  CIMUMINHEALTHSERVICESIMPL_H
       
   339 
       
   340