wvuing/wvuiada/Src/CCAImpsGroupClient.h
changeset 0 094583676ce7
equal deleted inserted replaced
-1:000000000000 0:094583676ce7
       
     1 /*
       
     2 * Copyright (c) 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:  Implements group services interface.
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 #ifndef CCAIMPSGROUPCLIENT_H
       
    21 #define CCAIMPSGROUPCLIENT_H
       
    22 
       
    23 //  INCLUDES
       
    24 #include "MCAImpsGroupClient.h"
       
    25 
       
    26 // FORWARD DECLARATIONS
       
    27 class RImpsEng;
       
    28 
       
    29 // CLASS DECLARATION
       
    30 
       
    31 /**
       
    32 *  Implements MCAImpsGroupClient.
       
    33 *  Forwards requests to RImpsGroupClient
       
    34 *
       
    35 *  @lib CAAdapter.dll
       
    36 *  @since 1.2
       
    37 */
       
    38 class CCAImpsGroupClient : public CBase, public MCAImpsGroupClient
       
    39     {
       
    40     public:  // Constructors and destructor
       
    41 
       
    42         /**
       
    43          * Two-phased constructor.
       
    44          * @param aImpsEng Reference to RImpsEng
       
    45          */
       
    46         static CCAImpsGroupClient* NewL( RImpsEng& aImpsEng );
       
    47 
       
    48         /**
       
    49         * Destructor.
       
    50         */
       
    51         virtual ~CCAImpsGroupClient();
       
    52 
       
    53     private:
       
    54 
       
    55         /**
       
    56         * C++ default constructor.
       
    57         * @param Reference to RImpsEng.
       
    58         */
       
    59         CCAImpsGroupClient( RImpsEng& aImpsEng );
       
    60 
       
    61     public: // Functions from base classes
       
    62 
       
    63         // INITILIZATION AND CONNECT
       
    64 
       
    65         /**
       
    66         * From MCAImpsGroupClient Registers the listener object for
       
    67         * Group events.
       
    68         * @since 1.2
       
    69         * @param aObserver The observer instance.
       
    70         * @param aApplicationId application UID or
       
    71         *                another unique id for your application.
       
    72         * @param aPriority observer priority. Refer to CActive priority.
       
    73         */
       
    74         virtual void RegisterL(
       
    75             MImpsGroupHandler2* aObserver,
       
    76             TUid aApplicationId,
       
    77             TInt aPriority );
       
    78 
       
    79         /**
       
    80         * Unregisters the listener object and disconnects from the server.
       
    81         * @since 1.2
       
    82         */
       
    83         virtual void Unregister();
       
    84 
       
    85 
       
    86         // WV PROTOCOL REQUESTS
       
    87 
       
    88         /**
       
    89         * From MCAImpsGroupClient Creates a group.
       
    90         * MImpsGroupHandler::HandleCompleteL handles the server response.
       
    91         * Leaves if out of memory before sending a message to the
       
    92         * Symbian OS server.
       
    93         * @since 1.2
       
    94         * @param aGroupId group id
       
    95         * @param aProperties initial group properties
       
    96         * @param aScreenName ScreenName of the user
       
    97         * @param aJoinGroup indicates that the newly created group is joined
       
    98         * (or not) at creation time.
       
    99         * @param aSubscribeNotification indicates if we sucscribe notification.
       
   100         * @return oparation-id (positive)
       
   101         */
       
   102         virtual TInt CreateGroupL( const TDesC& aGroupId,
       
   103                                    const CImpsCommonGroupProps* aProperties,
       
   104                                    const TDesC& aScreenName, TBool aJoinGroup,
       
   105                                    TBool aSubscribeNotification = EFalse );
       
   106 
       
   107         /**
       
   108         * From MCAImpsGroupClient Deletes a group.
       
   109         * MImpsGroupHandler::HandleCompleteL handles the server response.
       
   110         * Leaves if out of memory before sending a message to the Symbian OS server.
       
   111         * @since 1.2
       
   112         * @param aGroupId group id
       
   113         * @return oparation-id (positive)
       
   114         */
       
   115         virtual TInt DeleteGroupL( const TDesC& aGroupId );
       
   116 
       
   117         /**
       
   118         * From MCAImpsGroupClient Join a group.
       
   119         * MImpsGroupHandler::HandleJoinL handles the server response.
       
   120         * Leaves if out of memory before sending a message to the
       
   121         * Symbian OS server.
       
   122         * @since 1.2
       
   123         * @param aGroupId group id
       
   124         * @param aScreenName screen name for the user, optional (may be zero
       
   125         *        length)
       
   126         * @param aUsers ETrue if a user wants to get list of joined users in a
       
   127         *        reponse,
       
   128         * @param aSubscribeNotification indicates if we sucscribe notification.
       
   129         * @return oparation-id (positive)
       
   130         */
       
   131         virtual TInt JoinGroupL( const TDesC& aGroupId,
       
   132                                  const TDesC& aScreenName, TBool aUsers,
       
   133                                  TBool aSubscribeNotification = EFalse );
       
   134 
       
   135         /**
       
   136         * From MCAImpsGroupClient Leave a group.
       
   137         * MImpsGroupHandler::HandleLeaveL handles the server response.
       
   138         * Leaves if out of memory before sending a message to the
       
   139         * Symbian OS server.
       
   140         * @since 1.2
       
   141         * @param aGroupId group id
       
   142         * @return oparation-id (positive)
       
   143         */
       
   144         virtual TInt LeaveGroupL( const TDesC& aGroupId );
       
   145 
       
   146         /**
       
   147         * From MCAImpsGroupClient Get group members.
       
   148         * MImpsGroupHandler::HandleGroupMembersL handles the server response.
       
   149         * Leaves if out of memory before sending a message to the
       
   150         * Symbian OS server.
       
   151         * @since 1.2
       
   152         * @param aGroupId group id
       
   153         * @return oparation-id (positive)
       
   154         */
       
   155         virtual TInt GroupMembersL( const TDesC& aGroupId );
       
   156 
       
   157         /**
       
   158         * From MCAImpsGroupClient Add group members.
       
   159         * The new users' type is ordinary initially.
       
   160         * MImpsGroupHandler::HandleCompleteL handles the server response.
       
   161         * Leaves if out of memory before sending a message to the
       
   162         * Symbian OS server.
       
   163         * @since 1.2
       
   164         * @param aGroupId target group id
       
   165         * @param aUserList list of users to be added (user-ids)
       
   166         * @param aScreenNameList Screennames of the users
       
   167         * @return oparation-id (positive)
       
   168         */
       
   169         virtual TInt AddMembersL( const TDesC& aGroupId,
       
   170                                   const MDesCArray& aUserList, const MDesCArray& aScreenNameList );
       
   171 
       
   172         /**
       
   173         * From MCAImpsGroupClient Remove group members.
       
   174         * MImpsGroupHandler::HandleCompleteL handles the server response.
       
   175         * Leaves if out of memory before sending a message to the
       
   176         * Symbian OS server.
       
   177         * @since 1.2
       
   178         * @param aGroupId target group id
       
   179         * @param aUserList list of users to be removed
       
   180         * @return oparation-id (positive)
       
   181         */
       
   182         virtual TInt RemoveMembersL( const TDesC& aGroupId,
       
   183                                      const MDesCArray& aUserList );
       
   184 
       
   185         /**
       
   186         * From MCAImpsGroupClient Modify members' access rights.
       
   187         * MImpsGroupHandler::HandleCompleteL handles the server response.
       
   188         * Leaves if out of memory before sending a message to the
       
   189         * Symbian OS server.
       
   190         * @since 1.2
       
   191         * @param aGroupId target group id
       
   192         * @param aAdminList list of new administrators user-ids
       
   193         * @param aModerList list of new moderators user-ids
       
   194         * @param aOrdinaryList list of new ordinary users user-ids
       
   195         * @return oparation-id (positive)
       
   196         */
       
   197         virtual TInt ModifyMembersAccessL( const TDesC& aGroupId,
       
   198                                            const MDesCArray* aAdminList, const MDesCArray* aModerList,
       
   199                                            const MDesCArray* aOrdinaryList );
       
   200 
       
   201         /**
       
   202         * From MCAImpsGroupClient Get group properties.
       
   203         * MImpsGroupHandler::HandleGroupPropertiesL handles the server response.
       
   204         * Leaves if out of memory before sending a message to the
       
   205         * Symbian OS server.
       
   206         * @since 1.2
       
   207         * @param aGroupId target group id
       
   208         * @return oparation-id (positive)
       
   209         */
       
   210         virtual TInt GroupPropertiesL( const TDesC& aGroupId );
       
   211 
       
   212         /**
       
   213         * From MCAImpsGroupClient Set group properties.
       
   214         * MImpsGroupHandler::HandlecompleteL handles the server response.
       
   215         * Leaves if out of memory before sending a message to the
       
   216         * Symbian OS server.
       
   217         * @since 1.2
       
   218         * @param aGroupId target group id
       
   219         * @param aGroupProps common properties
       
   220         * @param aOwnProps user's own properties
       
   221         * @return oparation-id (positive)
       
   222         */
       
   223         virtual TInt SetGroupPropertiesL( const TDesC& aGroupId,
       
   224                                           const CImpsCommonGroupProps* aGroupProps,
       
   225                                           const CImpsPrivateGroupProps* aOwnProps );
       
   226 
       
   227         /**
       
   228         * From MCAImpsGroupClient Update or get list of rejected users.
       
   229         * MImpsGroupHandler::HandleRejectListL handles the server response.
       
   230         * If you want to get the current reject list only, then
       
   231         * give aGroupId parameter only.
       
   232         * Leaves if out of memory before sending a message to the
       
   233         * Symbian OS server.
       
   234         * @since 1.2
       
   235         * @param aGroupId target group id
       
   236         * @param aRejectedList users to be added to the reject list
       
   237         *        (user-ids) May be NULL.
       
   238         * @param aEnabledList users to be removed from the reject list
       
   239         *        (user-ids) May be NULL.
       
   240         * @return oparation-id (positive)
       
   241         */
       
   242         virtual TInt SetRejectListL( const TDesC& aGroupId,
       
   243                                      const MDesCArray* aRejectedList, const MDesCArray* aEnabledList );
       
   244 
       
   245         /**
       
   246         * From MCAImpsGroupClient Subscribe group change notice.
       
   247         * MImpsGroupHandler::HandleCompleteL handles the server response.
       
   248         * After successfull subscription HandleGroupPropertiesL,
       
   249         * HandleNewUsersL and HandleLeftUsersL methods are called
       
   250         * whenever remote service sends notifications.
       
   251         * Leaves if out of memory before sending a message to the
       
   252         * Symbian OS server.
       
   253         * @since 1.2
       
   254         * @param aGroupId group id
       
   255         * @return oparation-id (positive)
       
   256         */
       
   257         virtual TInt SubscribeL( const TDesC& aGroupId );
       
   258 
       
   259         /**
       
   260         * From MCAImpsGroupClient Unsubscribe group change notice.
       
   261         * MImpsGroupHandler::HandleCompleteL handles the server response.
       
   262         * Leaves if out of memory before sending a message to the
       
   263         * Symbian OS server.
       
   264         * @since 1.2
       
   265         * @param aGroupId group id
       
   266         * @return oparation-id (positive)
       
   267         */
       
   268         virtual TInt UnsubscribeL( const TDesC& aGroupId );
       
   269 
       
   270         /**
       
   271         * From MCAImpsGroupClient Check the group change subscription status.
       
   272         * MImpsGroupHandler::HandleSubscriptionL handles the server response.
       
   273         * Leaves if out of memory before sending a message to the
       
   274         * Symbian OS server.
       
   275         * @since 1.2
       
   276         * @param aGroupId group id
       
   277         * @return oparation-id (positive)
       
   278         */
       
   279         virtual TInt CheckSubscriptionL( const TDesC& aGroupId );
       
   280 
       
   281         /**
       
   282         * Register an error event observer.
       
   283         * If this is not registered then a client does not
       
   284         * receive error events from WV engine.
       
   285         * An application may implement only one HandleErrorL method
       
   286         * and give pointer to it in each WV client instance.
       
   287         * @since 1.2
       
   288         * @param aObs error event observer
       
   289         */
       
   290         virtual void RegisterErrorObserverL( MImpsErrorHandler2 &aObs );
       
   291 
       
   292         /**
       
   293         * Registers the service status change observer.
       
   294         * This can be called any time
       
   295         * @since 1.2
       
   296         * @param aObs status observer implementation. Ownership NOT transferred.
       
   297         */
       
   298         virtual void RegisterStatusObserverL( MImpsStatusHandler2 *aObs );
       
   299 
       
   300         /**
       
   301         * Unregisters an error observer.
       
   302         * Forwards the call to WV Engine always
       
   303         * This method is not necessary if unregister of the particular
       
   304         * client has been executed (Unregister).
       
   305         * @since 1.2
       
   306         */
       
   307         virtual void UnregisterErrorObserverL();
       
   308 
       
   309         /**
       
   310         * Unregisters the service status change observer.
       
   311         * Forwards the call to WV Engine always
       
   312         * This method is not necessary if unregister of the particular
       
   313         * client type has been executed (Unregister).
       
   314         * @since 1.2
       
   315         */
       
   316         virtual void UnregisterStatusObserverL();
       
   317 
       
   318         /**
       
   319         * Internal use only.
       
   320         * Error observer accessor
       
   321         * @since 1.2
       
   322         * @return error observer pointer. Ownership NOT transferred.
       
   323         */
       
   324         virtual MImpsErrorHandler2* ErrorHandler() const;
       
   325 
       
   326         /**
       
   327         * Internal use only.
       
   328         * Status observer accessor. This is missing from WV Engine.
       
   329         * Introduced for consistency.
       
   330         * @since 1.2
       
   331         * @return Status observer pointer. Ownership NOT transferred.
       
   332         */
       
   333         virtual MImpsStatusHandler2* StatusHandler() const;
       
   334 
       
   335         /**
       
   336         * Returns actual WV Engine interface class pointer which is registered.
       
   337         * @since 1.2
       
   338         * @return RImpsGroupClient pointer which is registered and can be used.
       
   339         *  Ownership NOT transferred.
       
   340         */
       
   341         RImpsGroupClient2* InterfaceL();
       
   342 
       
   343         /**
       
   344         * Available services accessor
       
   345         * Notice that there are no services in NOT_LOGGED state, i.e.
       
   346         * before login has been executed successfully from any client.
       
   347         * @param aServices Service tree having all supported features
       
   348         *        and functions.
       
   349         * @since 1.2
       
   350         */
       
   351         virtual void GetServicesL( TImpsServices& aServices );
       
   352 
       
   353     private:    // Data
       
   354 
       
   355         // WV Engine group interface.
       
   356         RImpsGroupClient2 iClient;
       
   357 
       
   358         // Indicator if we are doing lazy initialization with WV Engine.
       
   359         TBool	iLazyInitialization;
       
   360 
       
   361         // Indicator if we have registered WV Engine interface.
       
   362         TBool   iRegistered;
       
   363 
       
   364         // Store priority if we are doing lazy initialization.
       
   365         TInt	iPriority;
       
   366 
       
   367         // Store application id if we are doing lazy initialization.
       
   368         TUid	iApplicationId;
       
   369 
       
   370         // Group observer, stored in lazy initialization. Doens't own.
       
   371         MImpsGroupHandler2*	iGroupHandler;
       
   372 
       
   373         // Status observer, stored in lazy initialization. Doens't own.
       
   374         MImpsStatusHandler2* iStatusHandler;
       
   375 
       
   376         // Error observer, stored in lazy initialization. Doens't own.
       
   377         MImpsErrorHandler2* iErrorHandler;
       
   378 
       
   379         // Reference to IMPS engine server session instance.
       
   380         RImpsEng& iImpsEng;
       
   381     };
       
   382 
       
   383 #endif      // MCAIMPSGROUPCLIENT_H
       
   384 
       
   385 // End of File