wvuing/wvuieng/EngSrc/CCAGroupWrapper.h
changeset 0 094583676ce7
equal deleted inserted replaced
-1:000000000000 0:094583676ce7
       
     1 /*
       
     2 * Copyright (c) 2003-2005 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:  Network operations for one chat group handling.
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef CCAGGROUPWRAPPER_H
       
    20 #define CCAGGROUPWRAPPER_H
       
    21 
       
    22 // INCLUDES
       
    23 #include "MCAGroupOperations.h"
       
    24 #include "PublicEngineDefinitions.h"
       
    25 #include "PrivateEngineDefinitions.h"
       
    26 #include "ImpsGroupCli.h"
       
    27 
       
    28 #include <e32base.h>
       
    29 
       
    30 // FORWARD DECLARATIONS
       
    31 
       
    32 class MCAExtendedStoredGroup;
       
    33 class MCAImpsGroupClient;
       
    34 class MCASettings;
       
    35 class MCAGroupEventObserver;
       
    36 class MDesCArray;
       
    37 
       
    38 class CCARequest;
       
    39 class CCARequestMapper;
       
    40 class CCoeEnv;
       
    41 
       
    42 // CLASS DECLARATION
       
    43 
       
    44 /**
       
    45  *  Network operations for one chat group handling.
       
    46  *
       
    47  *  @lib CAEngine.lib
       
    48  *  @since 2.1
       
    49  */
       
    50 class CCAGroupWrapper : public CBase,
       
    51             public MCAGroupOperations,
       
    52             public MImpsGroupHandler2
       
    53     {
       
    54 
       
    55     public:  // Constructors and destructor
       
    56 
       
    57         /**
       
    58          * Two-phased constructor.
       
    59          * @param aSettingsAPI is the API to the settings side.
       
    60          * @param aGroup is group that network operations wrapper handles
       
    61          * @param aRequestMapper is the API to the request mapper.
       
    62          *        Used to provide synchronous waiting.
       
    63          * @param aClient is IMPS engine interface for network operations
       
    64          */
       
    65         static CCAGroupWrapper* NewL(
       
    66             MCASettings& aSettingsAPI,
       
    67             MCAExtendedStoredGroup& aGroup,
       
    68             CCARequestMapper& aRequestMapper,
       
    69             MCAImpsGroupClient* aClient );
       
    70 
       
    71         /**
       
    72         * Destructor.
       
    73         */
       
    74         virtual ~CCAGroupWrapper();
       
    75 
       
    76     public:	// New Methods
       
    77 
       
    78         /**
       
    79          * Returns handled group
       
    80          * @return Handled group
       
    81          */
       
    82         MCAStoredGroup& Group();
       
    83 
       
    84         /**
       
    85          * Adds event observer for group events
       
    86          * @param aObserver is group events observer
       
    87          */
       
    88         void RegisterEventObserver( MCAGroupEventObserver* aObserver );
       
    89 
       
    90         /**
       
    91          * Gets group properties
       
    92          * @param aCommonProps is group common properties
       
    93          * @param aPrivateProps is group private properties
       
    94          */
       
    95         void LocalProperties( CImpsCommonGroupProps*& aCommonProps,
       
    96                               CImpsPrivateGroupProps*& aPrivateProps );
       
    97 
       
    98         /**
       
    99          * Sets group properties
       
   100          * @param aCommonProps is group common properties
       
   101          * @param aPrivateProps is group private properties
       
   102          */
       
   103         void SetLocalProperties( CImpsCommonGroupProps* aCommonProps,
       
   104                                  CImpsPrivateGroupProps* aPrivateProps );
       
   105 
       
   106         /**
       
   107          * Gets network operations as request
       
   108          * @return current request
       
   109          * @see CCARequest
       
   110          */
       
   111         CCARequest* Request();
       
   112 
       
   113         /**
       
   114          * Propagates IMPS error code.
       
   115          * @param aError last IMPS error.
       
   116          */
       
   117         void LastImpsError( TInt aError );
       
   118 
       
   119         /**
       
   120          * Set is new topic shown or not.
       
   121          * @since S60 v3.1
       
   122          * @param aIsShown Is topic shown or not.
       
   123          */
       
   124         void SetTopicShown( TBool aIsShown );
       
   125 
       
   126         /**
       
   127          * Is new topic shown or not.
       
   128          * @since S60 v3.1
       
   129          * @return ETrue if topic already shown, EFalse if not.
       
   130          */
       
   131         TBool IsTopicShown() const;
       
   132 
       
   133     public: // From MCAGroupOperations
       
   134 
       
   135         /**
       
   136          * From MCAGroupOperations
       
   137          * @see MCAGroupOperations::OperationId
       
   138          */
       
   139         TInt	OperationId();
       
   140 
       
   141         /**
       
   142          * From MCAGroupOperations
       
   143          * @see MCAGroupOperations::JoinL
       
   144          */
       
   145         TInt JoinL( const TDesC& aScreenName, TBool aUsers,
       
   146                     TBool aIsFavourite );
       
   147 
       
   148         /**
       
   149          * From MCAGroupOperations
       
   150          * @see MCAGroupOperations::CreateGroupL
       
   151          */
       
   152         TInt CreateGroupL( const TDesC& aScreenName, TBool aJoinGroup );
       
   153 
       
   154         /**
       
   155          * From MCAGroupOperations
       
   156          * @see MCAGroupOperations::LeaveL
       
   157          */
       
   158         TInt LeaveL();
       
   159 
       
   160         /**
       
   161          * From MCAGroupOperations
       
   162          * @see MCAGroupOperations::DeleteFromNetworkL
       
   163          */
       
   164         TInt DeleteFromNetworkL();
       
   165 
       
   166         /**
       
   167          * From MCAGroupOperations
       
   168          * @see MCAGroupOperations::UpdatePropertiesL
       
   169          */
       
   170         TInt UpdatePropertiesL( CImpsCommonGroupProps* aCommonProps,
       
   171                                 CImpsPrivateGroupProps* aPrivateProps );
       
   172 
       
   173         /**
       
   174          * From MCAGroupOperations
       
   175          * @see MCAGroupOperations::AddMembersL
       
   176          */
       
   177         TInt AddMembersL( const CDesCArray& aUserList,
       
   178                           const CDesCArray& aScreenNameList );
       
   179 
       
   180         /**
       
   181          * From MCAGroupOperations
       
   182          * @see MCAGroupOperations::RemoveMembersL
       
   183          */
       
   184         TInt RemoveMembersL( const CDesCArray& aUserList );
       
   185 
       
   186         /**
       
   187          * From MCAGroupOperations
       
   188          * @see MCAGroupOperations::ModifyMembersL
       
   189          */
       
   190         TInt ModifyMembersL( const CDesCArray* aAdminList,
       
   191                              const CDesCArray* aModerList,
       
   192                              const CDesCArray* aOrdinaryList );
       
   193 
       
   194         /**
       
   195          * From MCAGroupOperations
       
   196          * @see MCAGroupOperations::GetPropertiesL
       
   197          */
       
   198         TInt GetPropertiesL( CImpsCommonGroupProps*& aCommonProps,
       
   199                              CImpsPrivateGroupProps*& aPrivateProps );
       
   200 
       
   201         /**
       
   202          * From MCAGroupOperations
       
   203          * @see MCAGroupOperations::GetMembersL
       
   204          */
       
   205         TInt GetMembersL( CDesCArray& aUserList,
       
   206                           CDesCArray& aScreenNames,
       
   207                           CDesCArray& aModers,
       
   208                           CDesCArray& aAdmins );
       
   209 
       
   210         /**
       
   211          * From MCAGroupOperations
       
   212          * @see MCAGroupOperations::GetRejectListL
       
   213          */
       
   214         TInt GetRejectListL( CDesCArray& aRejectList );
       
   215 
       
   216         /**
       
   217          * From MCAGroupOperations
       
   218          * @see MCAGroupOperations::SetRejectListL
       
   219          */
       
   220         TInt SetRejectListL( const CDesCArray& aRejectedList,
       
   221                              const CDesCArray& aEnabledList );
       
   222 
       
   223     public:	// From MImpsGroupHandler
       
   224 
       
   225         /**
       
   226          * From MImpsGroupHandler
       
   227          */
       
   228         void HandleCompleteL( TInt aOpId,
       
   229                               TImpsCspIdentifier& aCspId );
       
   230 
       
   231         /**
       
   232          * From MImpsGroupHandler
       
   233          */
       
   234         void HandleJoinL( TInt aOpId,
       
   235                           const MDesCArray& aUserList,
       
   236                           const MDesCArray& aScreenNames,
       
   237                           const TDesC& aWelcomeText,
       
   238                           TImpsCspIdentifier& aCspId );
       
   239 
       
   240         /**
       
   241          * From MImpsGroupHandler
       
   242          */
       
   243         void HandleGroupMembersL( TInt aOpId,
       
   244                                   const MDesCArray& aUserList,
       
   245                                   const MDesCArray& aScreenNames,
       
   246                                   const MDesCArray& aModers,
       
   247                                   const MDesCArray& aAdmins,
       
   248                                   TImpsCspIdentifier& aCspId );
       
   249 
       
   250         /**
       
   251          * From MImpsGroupHandler
       
   252          */
       
   253         void HandleGroupPropertiesL( TInt aOpId,
       
   254                                      const TDesC& aGroupId,
       
   255                                      const CImpsCommonGroupProps& aGroupProps,
       
   256                                      const CImpsPrivateGroupProps& aOwnProps,
       
   257                                      TImpsCspIdentifier& aCspId );
       
   258 
       
   259         /**
       
   260          * From MImpsGroupHandler
       
   261          */
       
   262         void HandleRejectListL( TInt aOpId,
       
   263                                 const MDesCArray& aUserList,
       
   264                                 TImpsCspIdentifier& aCspId );
       
   265 
       
   266         /**
       
   267          * From MImpsGroupHandler
       
   268          */
       
   269         void HandleSubscriptionL( TInt aOpId,
       
   270                                   TBool aIsSubscribed,
       
   271                                   TImpsCspIdentifier& aCspId );
       
   272 
       
   273         /**
       
   274          * From MImpsGroupHandler
       
   275          */
       
   276         void HandleNewUsersL(
       
   277             const TDesC& aGroupId,
       
   278             const MDesCArray& aUserList,
       
   279             const MDesCArray& aScreenNames,
       
   280             TImpsCspIdentifier& aCspId );
       
   281 
       
   282         /**
       
   283          * From MImpsGroupHandler
       
   284          */
       
   285         void HandleLeftUsersL(
       
   286             const TDesC& aGroupId,
       
   287             const MDesCArray& aUserList,
       
   288             const MDesCArray& aScreenNames,
       
   289             TImpsCspIdentifier& aCspId );
       
   290 
       
   291         /**
       
   292          * From MImpsGroupHandler
       
   293          */
       
   294         void HandleLeaveL(
       
   295             TInt aOpId,
       
   296             const TDesC& aGroupId,
       
   297             const TDesC& aDescription,
       
   298             TImpsCspIdentifier& aCspId );
       
   299 
       
   300     private:
       
   301 
       
   302         /**
       
   303          * Copies array to another array
       
   304          * @param aSource is source array
       
   305          * @param aDest is destination array
       
   306          */
       
   307         void CopyArrayL( const MDesCArray& aSource, CDesCArray* aDest );
       
   308 
       
   309         /**
       
   310         * C++ default constructor.
       
   311         * @see CCAGroupWrapper::NewL.
       
   312         */
       
   313         CCAGroupWrapper( MCASettings& aSettingsAPI,
       
   314                          MCAExtendedStoredGroup& aGroup,
       
   315                          CCARequestMapper& aRequestMapper,
       
   316                          MCAImpsGroupClient* aClient );
       
   317 
       
   318         /**
       
   319          * Helper method that fills CCARequest and executes request to server
       
   320          * and after waits network operation return.
       
   321          * Error code of network operation returned.
       
   322          * @param aOperationId operation which ImpsGroupClient has given
       
   323          *        for operation
       
   324          * @param aRequestType executed operation type
       
   325          * @param aAdditionalData that is added to CCARequest
       
   326          * @return Error code of server response
       
   327          */
       
   328         TInt ExecuteRequestL( TInt aOperationId,
       
   329                               TOperationRequests aRequestType,
       
   330                               MDesCArray* aAdditionalData = NULL );
       
   331 
       
   332         /**
       
   333          * Copy the properties from one set of CImps*GroupProps
       
   334          * to another.
       
   335          * @param aFromCommonProps Source common properties
       
   336          * @param aToCommonProps Target common properties
       
   337          * @param aFromPrivateProps Source private properties
       
   338          * @param aToPrivateProps Target private properties
       
   339          */
       
   340         void CopyPropertiesL(
       
   341             const CImpsCommonGroupProps* aFromCommonProps,
       
   342             CImpsCommonGroupProps* aToCommonProps,
       
   343             const CImpsPrivateGroupProps* aFromPrivateProps,
       
   344             CImpsPrivateGroupProps* aToPrivateProps );
       
   345 
       
   346     private: // Data
       
   347 
       
   348         // Pointer to observer of this group
       
   349         MCAGroupEventObserver* iObserver;
       
   350 
       
   351         // group common properties
       
   352         CImpsCommonGroupProps* iCommonProperties; // owned
       
   353 
       
   354         // group private properties
       
   355         CImpsPrivateGroupProps* iPrivateProperties; // owned
       
   356 
       
   357         // API to the settings side
       
   358         MCASettings& iSettingsAPI;
       
   359 
       
   360         // handled group
       
   361         MCAExtendedStoredGroup&	iGroup; // not owned
       
   362 
       
   363         CCoeEnv* iConeEnv;  // not owned
       
   364 
       
   365         // is the API to the request mapper
       
   366         CCARequestMapper& iRequestMapper;   // not owned
       
   367 
       
   368         // IMPS engine interface for network operations
       
   369         MCAImpsGroupClient* iImpsGroupClient;   // not owned
       
   370 
       
   371         // group id
       
   372         TInt iGroupIdOrdinal;
       
   373 
       
   374         // operation error
       
   375         TInt iOperationError;
       
   376 
       
   377         // current operation id
       
   378         TInt iOperationId;
       
   379 
       
   380         // doesn't own. filled upon request completion
       
   381         CCARequest* iRequest;
       
   382         CDesCArray* iMembers;
       
   383         CDesCArray* iScreenNames;
       
   384         CDesCArray* iModers;
       
   385         CDesCArray* iAdmins;
       
   386         CDesCArray* iRejectedList;
       
   387 
       
   388         // last IMPS error from CCAEngine
       
   389         TInt iLastImpsError;
       
   390 
       
   391         // Is new topic shown or not
       
   392         TBool iTopicShown;
       
   393 
       
   394         // last topic
       
   395         HBufC* iOldTopic;
       
   396     };
       
   397 
       
   398 #endif      // CCAGGROUPWRAPPER_H
       
   399 
       
   400 // End of File