imservices/instantmessagingcache/imcacheclient/inc/cimcacheupdater.h
changeset 0 e6b17d312c8b
equal deleted inserted replaced
-1:000000000000 0:e6b17d312c8b
       
     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:  class declaration for updating the cache
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 #ifndef __CIMCACHEUPDATER_H__
       
    21 #define __CIMCACHEUPDATER_H__
       
    22 
       
    23 #include <e32base.h>
       
    24 #include "mimcacheupdater.h"
       
    25 #include "cimcacheclient.h"
       
    26 
       
    27 class MIMCacheEventHandler;
       
    28 
       
    29 /**
       
    30  * write right class declaration
       
    31  */
       
    32  
       
    33 NONSHARABLE_CLASS( CIMCacheUpdater ): public CBase,
       
    34 								 public MIMCacheUpdater
       
    35     {
       
    36 	public:
       
    37 		/**
       
    38 		* Two-phased constructor.
       
    39 		* @param aServiceId, service id to used
       
    40 		* @param aUserId, user id who is conversing
       
    41 		*/
       
    42 		static CIMCacheUpdater* NewL(TInt aServiceId,
       
    43 									const TDesC& aUserId,
       
    44 									TBool aRegistrationNeeded );
       
    45 		/**
       
    46 		* virtual destructor.
       
    47 		*/
       
    48     	virtual ~CIMCacheUpdater();
       
    49 
       
    50 		
       
    51 	private:
       
    52 	
       
    53 		/**
       
    54 		* ConstructL.
       
    55 		* @param aUserId, user id who is conversing
       
    56 		*/
       
    57 		
       
    58     	void ConstructL( const TDesC& aUserId, TBool aRegistrationNeeded );
       
    59     	
       
    60     	/**
       
    61 		* default constructor.
       
    62 		* @param aServiceId, service id to used
       
    63 		*/
       
    64 		CIMCacheUpdater(TInt aServiceId);
       
    65 		
       
    66 		/**
       
    67 		* default constructor.
       
    68 		* @param aServiceId, service id to used
       
    69 		*/
       
    70 		void InternalizeChatListL( RArray<SIMCacheChatItem>& aChatArray, TPtr8 aChatListBuffer, TBool& aMore );
       
    71 
       
    72 	private: // from MIMCacheUpdater
       
    73 
       
    74 		/**
       
    75     	* Register to observer instantmessagingcache data updates
       
    76     	* @param aObserver the observer interface
       
    77     	*/
       
    78         void RegisterObserverL( MIMCacheEventHandler& aObserver );
       
    79 
       
    80     	/**
       
    81     	* Unregister a instantmessagingcache data update observer
       
    82     	* @param aObserver the observer interface
       
    83     	*/
       
    84         void UnRegisterObserver( MIMCacheEventHandler& aObserver);
       
    85         
       
    86 				
       
    87 		/**
       
    88         * start a new conversation 
       
    89         * @param aBuddyId a recipient user id
       
    90         */
       
    91 		void StartNewConversationL(const TDesC& aBuddyId ) ;
       
    92 		
       
    93 		/**
       
    94         * append the new recieve message
       
    95         * @param aSender a sender user id
       
    96         * @param aRecipient a recipient user id
       
    97         * @param aText a text to append
       
    98         */
       
    99 		void AppendReceiveMessageL( const TDesC& aBuddyId, 
       
   100 								   const TDesC& aText ) ;
       
   101 		
       
   102 		/**
       
   103         * append the new send message
       
   104         * @param aText a text to append
       
   105         */
       
   106 		void AppendSendMessageL(const TDesC& aText ) ;
       
   107 		
       
   108 		/**
       
   109         * append the normal information message
       
   110         * @param aBuddyId buddy id.
       
   111         * @param aText a text to append
       
   112         */
       
   113 		void AppendMessageL(const TDesC& aBuddyId, const TDesC& aText) ;
       
   114 		
       
   115 		
       
   116 		/**
       
   117 		* closes conversation and commit operation
       
   118 		* @param aServiceId service id.
       
   119 		* @param aBuddyId buddy id.
       
   120 		* @param aRecipientId recipient's user id.
       
   121 		*/
       
   122 		void CloseConversationL( const TDesC& aBuddyId ) ;
       
   123 		
       
   124 		/*
       
   125 		 * close all conversation in service Id
       
   126 		 */
       
   127 		void CloseAllConversationL();
       
   128 		
       
   129 		/**
       
   130         * Deactivate all open conversations and commit operation
       
   131         */
       
   132 		TInt DeactivateConversationL() ;
       
   133 		
       
   134       	
       
   135 		/**
       
   136         * get the chat list corresponding to service
       
   137         * @param aServiceId service id
       
   138         * @return Array of chats
       
   139         */
       
   140 		RArray<SIMCacheChatItem> GetChatListL( const TInt aServiceId  ); 
       
   141 		
       
   142 		
       
   143     public : // new api
       
   144     	
       
   145        /**
       
   146 		* return the serviceid
       
   147 		*/
       
   148     	TInt ServiceId() const ;	        
       
   149 		
       
   150 	private: // data
       
   151 
       
   152 		// owned , user id
       
   153 		HBufC* iUserId;
       
   154 		
       
   155 		// not owned , client
       
   156 		CIMCacheClient iClient;
       
   157 		
       
   158 		// owned, service id
       
   159 		TInt iServiceId;
       
   160 	
       
   161     };
       
   162 
       
   163 #endif      //  __CIMCACHEUPDATER_H__
       
   164 
       
   165 
       
   166 //  END OF FILE
       
   167