IMPSengine/imapi/Inc/imstatusimpl.h
changeset 0 094583676ce7
equal deleted inserted replaced
-1:000000000000 0:094583676ce7
       
     1 /*
       
     2 * Copyright (c) 2004 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: Implements the CIMStatusFetcher and the MImStatusList interface.
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 #ifndef IMAPI_IMSTATUSIMPL_H
       
    21 #define IMAPI_IMSTATUSIMPL_H
       
    22 
       
    23 //  INCLUDES
       
    24 #include "imstatus.h"
       
    25 #include "impspresencecli.h"
       
    26 #include "impspresence.h"
       
    27 #include "loginmngr.h"
       
    28 
       
    29 
       
    30 // FORWARD DECLARATIONS
       
    31 class CImConnectionImpl;
       
    32 
       
    33 // CLASS DECLARATION
       
    34 
       
    35 /**
       
    36 *  Implements the CIMStatusFetcher interface
       
    37 *
       
    38 *  @lib
       
    39 *  @since S60 2.6
       
    40 */
       
    41 class CIMStatusFetcherImpl : public CBase,
       
    42             public MImStatusFetcher,
       
    43             public MImpsPresenceHandler,
       
    44             public MImpsErrorHandler
       
    45     {
       
    46     public:  // Constructors and destructor
       
    47 
       
    48         /**
       
    49         * Two-phased constructor.
       
    50         */
       
    51         static CIMStatusFetcherImpl* NewL(
       
    52             CImConnectionImpl* aImConnection );
       
    53         /**
       
    54         * Destructor.
       
    55         */
       
    56         virtual ~CIMStatusFetcherImpl();
       
    57 
       
    58     public: // New functions
       
    59 
       
    60         MImpsPresenceHandler* ImpsPresenceHandler();
       
    61 
       
    62         MImpsErrorHandler& ImpsErrorHandler();
       
    63 
       
    64         RImpsEng& ImpsEngine();
       
    65 
       
    66         RImpsPresenceClient& ImpsPresenceClient();
       
    67 
       
    68         TDesC& ClientId();
       
    69 
       
    70         MImStatusObserver* ClientObserver();
       
    71 
       
    72     public: // Functions from base classes
       
    73 
       
    74         /**
       
    75         * From  CIMStatusFetcher
       
    76         * @see CIMStatusFetcher::RegisterObserverL
       
    77         */
       
    78         virtual TInt RegisterObserverL(
       
    79             MImStatusObserver* aObserver );
       
    80 
       
    81         /**
       
    82         * From  CIMStatusFetcher
       
    83         * @see CIMStatusFetcher::UnregisterObserverL
       
    84         */
       
    85         virtual TInt UnregisterObserverL( );
       
    86 
       
    87         /**
       
    88         * From  CIMStatusFetcher
       
    89         * @see CIMStatusFetcher::GetOnlineStatusL
       
    90         */
       
    91         virtual TInt GetOnlineStatusL(
       
    92             const CContactIdArray& aContactIds );
       
    93 
       
    94         /**
       
    95         * From  CIMStatusFetcher
       
    96         * @see CIMStatusFetcher::GetOnlineStatusL
       
    97         */
       
    98         virtual TInt GetOnlineStatusL(
       
    99             const CDesCArray& aUserIds );
       
   100 
       
   101         /**
       
   102         * From MImpsErrorHandler
       
   103         * @see MImpsErrorHandler::HandleErrorL
       
   104         */
       
   105         virtual void HandleErrorL(
       
   106             TInt                 aStatus,
       
   107             TInt                 aOpId,
       
   108             const TDesC*         aDescription,
       
   109             const CImpsDetailed* aDetailedRes );
       
   110 
       
   111         /**
       
   112         * From MImpsPresenceHandler
       
   113         * @see MImpsPresenceHandler::HandleNewPresenceL
       
   114         */
       
   115         virtual void HandleNewPresenceL(
       
   116             TInt                        aStatus,
       
   117             TInt                        aOpId,
       
   118             CImpsPresenceList&          aPresList );
       
   119 
       
   120 
       
   121         /**
       
   122         * From MImpsPresenceHandler
       
   123         * @see MImpsPresenceHandler::HandleCompleteL
       
   124         */
       
   125         virtual void HandleCompleteL(
       
   126             TInt aStatus,
       
   127             TInt aOpId );
       
   128 
       
   129     private:
       
   130 
       
   131         /**
       
   132         * C++ default constructor.
       
   133         */
       
   134         CIMStatusFetcherImpl(
       
   135             CImConnectionImpl* aImConnection );
       
   136 
       
   137         /**
       
   138         * By default Symbian 2nd phase constructor is private.
       
   139         */
       
   140         void ConstructL();
       
   141 
       
   142         // Internal state enum of the class
       
   143         enum TRegState
       
   144             {
       
   145             ENotRegistered = 0,
       
   146             ERegistering,
       
   147             ERegistered
       
   148             };
       
   149 
       
   150         void ChangeRegState( TRegState aNewRegState );
       
   151 
       
   152         // Prohibit copy constructor if not deriving from CBase.
       
   153         // ?classname( const ?classname& );
       
   154         // Prohibit assigment operator if not deriving from CBase.
       
   155         // ?classname& operator=( const ?classname& );
       
   156 
       
   157     private:    // Data
       
   158         RImpsPresenceClient   iPresenceClient; // Imps Presence client
       
   159         MImStatusObserver*    iClientObserver; // The 3rd party IM observer (not owned)
       
   160         CImConnectionImpl*    iImConnection;// The API manager (not owned)
       
   161         HBufC*                iClientId;// Client ID of the 3rd party app (owned)
       
   162 
       
   163 
       
   164     };
       
   165 
       
   166 
       
   167 // CLASS DECLARATION
       
   168 
       
   169 /**
       
   170 *  Implements the MImStatusList interface
       
   171 *
       
   172 *  @lib
       
   173 *  @since S60 2.6
       
   174 */
       
   175 class CIMStatusListImpl : public CBase,
       
   176             public MImStatusList
       
   177     {
       
   178     public:  // Constructors and destructor
       
   179         /**
       
   180         * Two-phased constructor.
       
   181         */
       
   182         static CIMStatusListImpl* NewL(
       
   183             CImpsPresenceList& aPresList );
       
   184 
       
   185         /**
       
   186         * Destructor.
       
   187         */
       
   188         virtual ~CIMStatusListImpl();
       
   189 
       
   190     public: // Functions from base classes
       
   191         TInt Count();
       
   192 
       
   193 //        TContactItemId& OwnerContactIdL( TInt aIndex );
       
   194 
       
   195         TPtrC OwnerUserIdL( TInt aIndex );
       
   196 
       
   197         TIMAttribute IMStatusL( TInt aIndex );
       
   198 
       
   199 
       
   200     private:
       
   201         /**
       
   202         * C++ default constructor.
       
   203         */
       
   204         CIMStatusListImpl( CImpsPresenceList& aPresList );
       
   205 
       
   206         /**
       
   207         * By default Symbian 2nd phase constructor is private.
       
   208         */
       
   209         void ConstructL();
       
   210 
       
   211     private: //DATA
       
   212         CImpsPresenceList&      iPresList;
       
   213         CImpsPresence*          iCurrentPresence;
       
   214         TInt                    iCurrentIndex;
       
   215 
       
   216     };
       
   217 
       
   218 
       
   219 #endif      // IMAPI_IMSTATUSIMPL_H   
       
   220 
       
   221 // End of File