uiservicetab/vimpstcmdprocess/tsrc/vimpstcmdprocess_utest/inc/s_vimpstenginepresencesubservice.h
branchRCL_3
changeset 28 3104fc151679
parent 27 2b7283837edb
child 29 9a48e301e94b
equal deleted inserted replaced
27:2b7283837edb 28:3104fc151679
     1 /*
       
     2 * Copyright (c) 2006, 2007 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:  s_enginecontmgtextfeatures.cpp
       
    15 *
       
    16 */
       
    17 
       
    18 #ifndef     S_VIMPSTENGINEPRESENCESUBSERVICE_H
       
    19 #define     S_VIMPSTENGINEPRESENCESUBSERVICE_H
       
    20 
       
    21 // INCLUDES
       
    22 #include <e32base.h>
       
    23 #include "mvimpstenginepresencesubservice.h"
       
    24 #include "mvimpstenginesubservice.h"
       
    25 
       
    26 //FORWARD DECLARATIONS
       
    27 
       
    28 class MVIMPSTEnginePresenceSubServiceEventObserver;
       
    29 // CLASS DECLARATION
       
    30 /**
       
    31  *  Presence sub service
       
    32  *  This class implements the presence subservice
       
    33  *  The problem in VOIP case would be that this "sip" must be hardcoded. Can this be avoided
       
    34  *
       
    35  *
       
    36  *  The Presence Information can be fetched either thro PresenceCache or
       
    37  *  thro XIMP's MPresentityPresenceEvent. So somehow we should be able to differentiate 
       
    38  *  which service uses PresenceCache or XIMP's MPresentityPresenceEvent during the creation of this object
       
    39  *  One of the proposal could be is to use the CCH, if it could provide us this information or SP Settings
       
    40  *  
       
    41  *  All the Block/Friend Request/Presence information of a contact should be passed 
       
    42  *  to the VIMPSTStorage which will update the list on the UI.
       
    43  *  
       
    44  */
       
    45 
       
    46 
       
    47 NONSHARABLE_CLASS( CVIMPSTEnginePresenceSubService_Stub ): public CBase, 
       
    48 						  public MVIMPSTEnginePresenceSubService
       
    49                          
       
    50     {
       
    51     public:
       
    52 
       
    53         /**
       
    54          * Two-phased constructor.
       
    55          *
       
    56          * @since s60 5.0
       
    57          * @param aServiceId, service id
       
    58          * @param aCchHandler, reference to cchhandler.
       
    59          * @param aTableFetcher, reference to settingstable.
       
    60          * @param aXimpEventObserver, reference to ximpevent observer.
       
    61          * @param aServiceStateListener, reference to servicestatelistener.
       
    62          */
       
    63         static CVIMPSTEnginePresenceSubService_Stub* NewL( );
       
    64 
       
    65         /**
       
    66          * Two-phased constructor.
       
    67          *
       
    68          * @since s60 5.0
       
    69          * @param aServiceId, service id
       
    70          * @param aCchHandler, reference to cchhandler.
       
    71          * @param aTableFetcher, reference to settingstable.
       
    72          * @param aXimpEventObserver, reference to ximpevent observer.
       
    73          * @param aServiceStateListener, reference to servicestatelistener.
       
    74          */
       
    75         static CVIMPSTEnginePresenceSubService_Stub* NewLC();
       
    76 
       
    77         /**
       
    78          * Standard C++ destructor
       
    79          */    
       
    80         ~CVIMPSTEnginePresenceSubService_Stub();        
       
    81     
       
    82     public: //From MVIMPSTSubService     
       
    83     	
       
    84         /**
       
    85          * @return TVIMPSTRegistrationState Service State of this service
       
    86          */
       
    87         TVIMPSTEnums::TVIMPSTRegistrationState SubServiceState() const;     
       
    88         
       
    89         
       
    90         TVIMPSTEnums::SubServiceType Type() const;                         
       
    91 
       
    92 		
       
    93 		/**
       
    94          * @see MVIMPSTSubService
       
    95          */
       
    96 		TBool Enabled();
       
    97 		
       
    98     
       
    99     public: //From MVIMPSTEnginePresenceSubService
       
   100         void FetchPresenceOfSingleContactL(const TDesC& aContact);
       
   101         
       
   102          void FetchPresenceOfSinleContactL(const TDesC& aUserId);
       
   103         /**
       
   104 		* @see MVIMPSTEnginePresenceSubService
       
   105 		*/
       
   106 		void RegisterPresenceEventObserverL(
       
   107 							MVIMPSTEnginePresenceSubServiceEventObserver* aObserver);
       
   108 
       
   109 		/**
       
   110 		* @see MVIMPSTEnginePresenceSubService
       
   111 		*/
       
   112 		void UnRegisterPresenceEventObserver(
       
   113 							MVIMPSTEnginePresenceSubServiceEventObserver* aObserver);
       
   114 		
       
   115         /**
       
   116          * Subsribes presence of a single contact
       
   117          * Can be done for the contacts who are already subscribed(Required atleast in XMPP Case)
       
   118          * This function can be used on FriendRequests also wherein it performs 2 operation
       
   119          * 1. Accepts the invitation if Friend Request is Pending(GrantPresenceForPresentityL)
       
   120          * 2. Subscribes for the presence either to PresenceCache 
       
   121          * or XIMP (MPresentityPresenceEvent)
       
   122          * 
       
   123          *
       
   124          * @since S60 5.0
       
   125          * @param aUriOfTheContact, Presence URI to be subscribed         
       
   126          */
       
   127         void SubscribePresenceOfSingleContactL( const TDesC& aUriOfTheContact );            
       
   128             
       
   129         
       
   130         /**
       
   131          * Unsubsribes presence of a single contact
       
   132          * Used for those contact whose presence has been subscribed
       
   133          * Can be used for Friend Requests also
       
   134          * 1. Denies the invitation for the contact (WithdrawPresenceGrantFromPresentityL)
       
   135          * 2. Sends a unsubscribe to PresenceCache 
       
   136          * or XIMP (UnsubscribePresentityPresenceL)
       
   137          *
       
   138          * @since S60 5.0
       
   139          * @param aUriOfTheContact, Presence URI to be subscribed         
       
   140          */
       
   141         void UnSubscribePresenceOfSingleContactL( const TDesC& aUriOfTheContact );				
       
   142 		
       
   143         /**
       
   144          * Fetches presence from presencecache.
       
   145          * 
       
   146          * @since 5.0
       
   147          **/
       
   148         TInt FetchPresenceFromCache();
       
   149         
       
   150         
       
   151         /**
       
   152          * Subscribe each contact.
       
   153          * 
       
   154          * @since 5.0 
       
   155          * @param aWVID id of the contact to be subscribed for.
       
   156          */
       
   157         void SubscribeToPresenceCacheL(const TDesC& aWVID);
       
   158       
       
   159         /**
       
   160          * UnSubscribe each contact.
       
   161          * 
       
   162          * @since 5.0 
       
   163          * @param aWVID id of the contact to be unsubscribed for.
       
   164          */
       
   165         void UnSubscribeToPresenceCacheL(const TDesC& aWVID);
       
   166         
       
   167         /**
       
   168          * Requests the XIMPFw to terminate presence
       
   169          * grant request list subscription.
       
   170          */
       
   171         void  UnSubscribeForAuthorizationL();
       
   172       
       
   173        /**
       
   174         * Requests the XIMPFw to subscribe for presence
       
   175         * grant request list subscription.
       
   176         */  
       
   177        void  SubscribeForAuthorizationL();
       
   178        
       
   179        /**
       
   180         * sends PresenceGrantForPresentity  response to server        
       
   181         * @param aContactId, id of the requesting party..
       
   182         * @param aResponse , Etrue if accpeted else rejected. 
       
   183         * @return TInt error if any       
       
   184         */ 
       
   185         TInt SendPresenceGrantPresentityL( const TDesC& aContactId , TBool aResponse );
       
   186         
       
   187         /**
       
   188          * IsChangeOwnStatusSupported by the protocol
       
   189          * 
       
   190          * @since S60 5.0   
       
   191          * @return TBool ETrue if supported else EFalse.
       
   192          */ 
       
   193          TBool IsChangeOwnStatusSupported() ;
       
   194          
       
   195         /**
       
   196          * IsStatusMsgSupported by the protocol
       
   197          * 
       
   198          * @since S60 5.0   
       
   199          * @return TBool ETrue if supported else EFalse.
       
   200          */ 
       
   201          TBool IsStatusMsgSupported();
       
   202          
       
   203           /**
       
   204          * IsAvatarSupported by the protocol
       
   205          * 
       
   206          * @since S60 5.0   
       
   207          * @return TBool ETrue if supported else EFalse.
       
   208          */ 
       
   209         TBool IsAvatarSupported() ;
       
   210         
       
   211         /**
       
   212          * SetAvatarSupported by the protocol
       
   213          * 
       
   214          * @since S60 5.0   
       
   215          * @param aSupported, TBool ETrue if supported else EFalse.
       
   216          */ 
       
   217         void SetAvatarSupported(TBool aSupported ) ;
       
   218       
       
   219 
       
   220          /**
       
   221           * PublishOwnPresenceL
       
   222           * to update the  ownstatus to server.
       
   223           * and publishes the own status.
       
   224           * 
       
   225           * @param aStatus ,status to be updated to the server.
       
   226           * @param aValue , text for the status message
       
   227  		  * @param aFilename , avatar file name
       
   228   		  * @param aMimetype , a mime type
       
   229   		  * @param aIsAvatar , a avatar field included
       
   230           * @return TInt error if any
       
   231           */                                
       
   232          TInt PublishOwnPresenceL(TVIMPSTEnums::TOnlineStatus aStatus,
       
   233          						  const TDesC& aValue,
       
   234          						  const TDesC& aFilename = KNullDesC, 
       
   235          						  const TDesC8& aMimetype = KNullDesC8,
       
   236          						  TBool aIsAvatar = EFalse  );
       
   237 
       
   238       
       
   239          /**
       
   240           * Removes URI from block list
       
   241           *
       
   242           * @since S60 5.0
       
   243           * @param aUriOfTheContact, URI to be removed
       
   244           * @return error.
       
   245           */
       
   246          TInt  RemoveFromBlockListL( const TDesC& aUriOfTheContact );
       
   247 
       
   248          /**
       
   249           * Adds URI to block list
       
   250           *
       
   251           * @since S60 5.0
       
   252           * @param aUriOfTheContact, URI to be added
       
   253           * @return error.
       
   254           */
       
   255          TInt  AddToBlockListL( const TDesC& aUriOfTheContact );
       
   256          /**
       
   257           * Returns the blocked list.
       
   258           * it returns the blocked list that it maintains locally in engine.
       
   259           * @since S60 5.0
       
   260           * @return blocked list.
       
   261           */
       
   262          RPointerArray<HBufC>* GetBlockedList();
       
   263          void FetchBlockedListFromServerL(MVIMPSTEngineBlockedListFetchEventObserver* aOb);
       
   264          void UpdatePresenceStateL();
       
   265          void UnsubscribeListsL();
       
   266              
       
   267     private: // Implementation
       
   268 
       
   269         /**
       
   270          * Standard C++ constructor
       
   271          * 
       
   272          * @since s60 5.0
       
   273          * @param aServiceId, service id
       
   274          * @param aCchHandler, reference to cchhandler.
       
   275          * @param aTableFetcher, reference to settingstable.
       
   276          * @param aXimpEventObserver, reference to ximpevent observer.
       
   277          * @param aServiceStateListener, reference to servicestatelistener.
       
   278          */   
       
   279         CVIMPSTEnginePresenceSubService_Stub(  );
       
   280         
       
   281         /**
       
   282          * Performs the 2nd phase of construction.
       
   283          */        
       
   284         void ConstructL();
       
   285 
       
   286     
       
   287     private: // Data
       
   288                                 
       
   289         // Service identifier
       
   290         TUint32 iServiceId; 
       
   291         
       
   292        
       
   293     }; 
       
   294 
       
   295 #endif //S_VIMPSTENGINEPRESENCESUBSERVICE_H
       
   296