ipsservices/ipssosaoplugin/inc/IpsSosAOImapPopLogic.h
changeset 0 8466d47a6819
child 24 d189ee25cf9d
equal deleted inserted replaced
-1:000000000000 0:8466d47a6819
       
     1 /*
       
     2 * Copyright (c) 2008 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: 
       
    15 *     Logic for scheduled IMAP / POP sync
       
    16 *
       
    17 */
       
    18 
       
    19 
       
    20 #ifndef IPSSOSAOIMAPPOPLOGIC_H_
       
    21 #define IPSSOSAOIMAPPOPLOGIC_H_
       
    22 
       
    23 #include <e32base.h> 
       
    24 #include <msvapi.h>
       
    25 
       
    26 class CIpsSosAOMBoxLogic;
       
    27 class CIpsSosAOEMNResolver;
       
    28 class CIpsSetDataApi;
       
    29 
       
    30 _LIT( KIpsSosAOPanicLit, "AO");
       
    31 
       
    32 
       
    33 /**
       
    34 * class CIpsSosAOImapPopLogic;
       
    35 *
       
    36 * Creates and destroys mailbox spesific MBoxLogic instances according to mailbox
       
    37 * Always online settings. Handles Always online server commands and sends
       
    38 * TMboxLogicCommands to mailboxes.
       
    39 * 
       
    40 * lib ipssosaoplugin.lib
       
    41 */
       
    42 class CIpsSosAOImapPopLogic : public CBase
       
    43     {
       
    44 
       
    45 public:
       
    46     
       
    47     /**
       
    48     * Two phased constructor
       
    49     * @return self pointer
       
    50     */
       
    51     static CIpsSosAOImapPopLogic* NewL( CMsvSession& aSession );
       
    52 
       
    53     /**
       
    54     * Destructor
       
    55     */
       
    56     virtual ~CIpsSosAOImapPopLogic();
       
    57     
       
    58 public:
       
    59     
       
    60     /**
       
    61      * Handles Always Online server commands
       
    62     * @param TInt, command Id
       
    63     * @param TDesC8*, parameter pack
       
    64     * @return TInt, return value
       
    65     */
       
    66     TInt HandleAOServerCommandL( 
       
    67         TInt    aCommand, 
       
    68         TDesC8* aParameters );
       
    69     
       
    70     /**
       
    71      * Handles msv session events
       
    72      * NOTE: this is called by CIpsSosAOEComInterface class, not directly
       
    73      * by msv session
       
    74      */
       
    75     void HandleMsvSessionEventL(
       
    76          MMsvSessionObserver::TMsvSessionEvent aEvent, 
       
    77          TAny* aArg1, TAny* aArg2, TAny* aArg3 );
       
    78     
       
    79 private:
       
    80     
       
    81     /**
       
    82     * Constructor
       
    83     */
       
    84     CIpsSosAOImapPopLogic( CMsvSession& aSession );
       
    85 
       
    86     /**
       
    87     * Second phase constructor
       
    88     */
       
    89     void ConstructL();
       
    90     
       
    91     /*
       
    92      * sends TMboxLogicCommand to all mailboxes
       
    93      */
       
    94     void SendCommandToMailboxesL(TInt aCommand );
       
    95     
       
    96     /*
       
    97      * Sends Stop command to CIpsSosAOMBoxLogic object and removes it 
       
    98      */
       
    99     void StopAndRemoveMailboxL( TMsvId aMailboxId );
       
   100     
       
   101     /*
       
   102      * Sends TMboxLogicCommand to spesific mailbox
       
   103      */
       
   104     void SendCommandToSpecificMailboxL( 
       
   105             TMsvId aMailboxId, 
       
   106             TInt aCommand );
       
   107     
       
   108     /*
       
   109      * Handles emn message whitch is sent by always online server
       
   110      */
       
   111     void HandleEMNMessageL( const TDesC8& aParameters );
       
   112     
       
   113     /*
       
   114      * Checks all fs mailboxes, if timed sync is set on in settings, function
       
   115      * creates and starts mailbox logic object
       
   116      */
       
   117     void RefreshMailboxListL( );
       
   118     
       
   119     /*
       
   120      * Used by RefreshMailboxListL function.
       
   121      */
       
   122     void UpdateLogicArrayL( const CMsvEntrySelection& aChilds );
       
   123     
       
   124     /*
       
   125      * Checks is sync ongoing in mailbox and set value to descriptor, this is called by
       
   126      * always online server. Descriptor is send as a response of client - server async call 
       
   127      */
       
   128     TInt QueryMailboxStatus( TDesC8& aParameter );
       
   129     
       
   130     /*
       
   131      * get index of mailbox logic array according to mailbox id
       
   132      */
       
   133     inline TInt GetMailboxLogicIndex( TMsvId aMailboxId );
       
   134 
       
   135 private:
       
   136     
       
   137     CMsvSession&                        iSession;
       
   138     
       
   139     // container of mailbox logic objects, each mailbox has own logic if always online is
       
   140     // set on in mailbox settings
       
   141     RPointerArray<CIpsSosAOMBoxLogic>   iMailboxLogics;
       
   142     
       
   143     CIpsSosAOEMNResolver*               iEmnResolver;
       
   144     CIpsSetDataApi*                     iDataApi;
       
   145     // flag is set true when NoNWOpsAllowed (NW = network)
       
   146     // event is received, false when NWOpsAllowed is received
       
   147     TBool                               iNoNWOpsAllowed;
       
   148     
       
   149     };
       
   150 
       
   151 #endif /* IPSSOSAOIMAPPOPLOGIC_H_*/