wvuing/wvuipresence/inc/MCAContactLists.h
changeset 0 094583676ce7
equal deleted inserted replaced
-1:000000000000 0:094583676ce7
       
     1 /*
       
     2 * Copyright (c) 2002 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:  Presence-list handling interface for clients
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef MCACONTACTLISTS_H
       
    20 #define MCACONTACTLISTS_H
       
    21 
       
    22 // INCLUDES
       
    23 #include "MCAPresence.h"
       
    24 #include <e32std.h>
       
    25 #include <badesca.h>
       
    26 #include "TCAWrappers.h"
       
    27 #include "impsbuilddefinitions.h"
       
    28 
       
    29 // FORWARD DECLARATIONS
       
    30 class MCAPresenceObserver;
       
    31 class MCAWatcherObserver;
       
    32 class MCAPresenceErrors;
       
    33 class MCAStoredContact;
       
    34 class MCAListInitObserver;
       
    35 // CLASS DECLARATION
       
    36 
       
    37 /**
       
    38 *  Presence list handling interface for clients
       
    39 *
       
    40 *  @lib CAPresence.lib
       
    41 *  @since 1.2
       
    42 */
       
    43 class MCAContactLists
       
    44     {
       
    45     public:
       
    46 
       
    47         enum TListOperation
       
    48             {
       
    49             EAdd,		// Add to list
       
    50             ERemove,	// Remove from list
       
    51             EClearAdd,  // Clear whole list and add
       
    52             ERemoveAll	// Removes everything from list
       
    53             };
       
    54 
       
    55 
       
    56         enum TContactFetchOperation
       
    57             {
       
    58             EBaseSynchronise = 0,
       
    59             EPublishAttributeLists,
       
    60             EInitializeLists,
       
    61             ERestartSynchronize,
       
    62             ESynchronizeList,
       
    63             EFetchContacts,
       
    64             ESubscribeList,
       
    65             EFinalizeList,
       
    66             EPublishListsDone,
       
    67             ESynchronizeDone
       
    68             };
       
    69 
       
    70     public:
       
    71         /**
       
    72          * Fetches all contacts from network server
       
    73          * @param aBaseSyncDone, Is base sync already done
       
    74          *          ETrue BS is done and there's no need to do it again
       
    75          *          EFalse BS is not done, and it has to be done first
       
    76          * @return Error code from server
       
    77          */
       
    78         virtual TInt FetchContactsL( TBool aBaseSyncDone = EFalse ) = 0;
       
    79 
       
    80         /**
       
    81         * Fetches given contact list contents from network server.
       
    82         * NOTE:  Given arrays must have same number of items (they are matched)
       
    83         * NOTE2: Engine will reset given arrays before operating with them
       
    84         * @param aContactListId Id of list to be fetched
       
    85         * @param aWVIds wvids of server-side contacts
       
    86         */
       
    87         virtual void FetchServerContactsL(	const TDesC& aContactListId,
       
    88                                            CPtrCArray& aWVIds ) = 0;
       
    89 
       
    90         /**
       
    91         * Updates network server's contact list with given list.
       
    92         * If given list does not contain some wvid, that is currently on server,
       
    93         * system will delete the id from server...
       
    94         * NOTE: Given arrays must have same number of items (they are matched)
       
    95         * @param aContactListId Id of list to be updated
       
    96         * @param aWVIds wvids of server-side contacts
       
    97         * @param aNicknames nicknames of server-side contacts
       
    98         */
       
    99         virtual void UpdateServerContactsL( const TDesC& aContactListId,
       
   100                                             const MDesCArray& aWVIds,
       
   101                                             const MDesCArray& aNicknames ) = 0;
       
   102 
       
   103         /**
       
   104          * Deletes one contact from server side contact list
       
   105          * @param aContactListId Id of list to be updated
       
   106          * @param aWVId wvid of server-side contact
       
   107          * @param aUpdateToServer
       
   108          *          ETrue update to server directly
       
   109          *          EFalse put change into queue (CommitDeleteServerContactL)
       
   110          */
       
   111         virtual void DeleteServerContactL( const TDesC& aContactListId,
       
   112                                            const TDesC& aWVId,
       
   113                                            const TBool aUpdateToServer = ETrue ) = 0;
       
   114 
       
   115         /**
       
   116          * Deletes several contacts from server side contact list
       
   117          * @param aContactListId Id of list to be updated
       
   118          * @param aWVId wvid of server-side contact
       
   119          * @param aUpdateToServer
       
   120          *          ETrue update to server directly
       
   121          *          EFalse put change into queue (CommitDeleteServerContactL)
       
   122          */
       
   123         virtual void DeleteServerContactL( const TDesC& aContactListId,
       
   124                                            const MDesCArray& aWVIds,
       
   125                                            const TBool aUpdateToServer = ETrue ) = 0;
       
   126 
       
   127         /**
       
   128          * Updates deleted contacts to server. This have to be called after
       
   129          * DeleteServerContactL is called without updating changes to server
       
   130          * (aUpdateToServer). Otherwise the changed data might not be update to
       
   131          * server. Use this method to make multiple updates to network with single
       
   132          * operation.
       
   133          */
       
   134         virtual void CommitDeleteServerContactL() = 0;
       
   135 
       
   136         /**
       
   137          * Adds one contact to server side contact list
       
   138          * @param aContactListId Id of list to be updated
       
   139          * @param aWVId wvid of server-side contact
       
   140          * @param aNickname nickname of server-side contact
       
   141          * @param aDoNotRemove, This is used for editing old one.
       
   142          *                      EFalse if editing, ETrue if adding.
       
   143          * @param aOldWVId, when editing, remove old userid if different than new one.
       
   144          */
       
   145         virtual MCAStoredContact* AddServerContactL(
       
   146             const TDesC& aContactListId,
       
   147             const TDesC& aWVId,
       
   148             const TDesC& aNickname,
       
   149             TBool aCanREmove = ETrue,
       
   150             const TDesC* aOldWVId = NULL  ) = 0;
       
   151 
       
   152         /**
       
   153          * Adds several contacts to server side contact list
       
   154          * @param aContactListId Id of list to be updated
       
   155          * @param aWVId wvid of server-side contact
       
   156          * @param aNickname nickname of server-side contact
       
   157          */
       
   158         virtual void AddServerContactL(    const TDesC& aContactListId,
       
   159                                            const MDesCArray& aWVIds,
       
   160                                            const MDesCArray& aNicknames ) = 0;
       
   161 
       
   162         /**
       
   163          * Alters the nickname
       
   164          * @param aContactListId Id of list to be updated
       
   165          * @param aWVId wvid of server-side contact
       
   166          * @param aNickname nickname of server-side contact
       
   167          */
       
   168         virtual void UpdateContactNicknameL( const TDesC& aContactListId,
       
   169                                              const TDesC& aWVId,
       
   170                                              const TDesC& aNickname ) = 0;
       
   171 
       
   172         /**
       
   173         * Fetches the list of lists from server.
       
   174         * @param aContactListIds List names
       
   175         */
       
   176         virtual TContactListsWrapper FetchServerContactListsL() = 0;
       
   177 
       
   178         /**
       
   179         * Releases resources related to all other contact list, except given one
       
   180         * @param aExcludedContactList Name of list to be kept
       
   181         */
       
   182         virtual void ReleaseContactListsL( const TDesC& aExcludedContactList ) = 0;
       
   183 
       
   184         /**
       
   185          * Set new display name for the contact list
       
   186          * @param aContactListID    ID of the list
       
   187          * @param aDisplayName      New display name for list
       
   188          * @return Error code
       
   189          *
       
   190          * @since 3.0
       
   191          */
       
   192         virtual TInt SetDisplayNameL( const TDesC& aContactListID, const TDesC& aDisplayName ) = 0;
       
   193 
       
   194         /**
       
   195          * Delete the contact list
       
   196          * @param aContactListID    ID of the list
       
   197          * @return Error code
       
   198          *
       
   199          * @since 3.0
       
   200          */
       
   201         virtual TInt DeleteContactListL( const TDesC& aContactListID
       
   202 #ifdef IMPS_CONTACT_FETCH_BACKGROUND
       
   203                                          , TBool aFailedList = EFalse
       
   204 #endif // IMPS_CONTACT_FETCH_BACKGROUND
       
   205                                        ) = 0;
       
   206 
       
   207         /**
       
   208          * Create contact list to server with given display name
       
   209          * List id will be generated from display name
       
   210          * @param aDisplayName Display name for new contact list
       
   211          * @return Error code
       
   212          *
       
   213          * @since 3.0
       
   214          */
       
   215         virtual TInt CreateContactListL( const TDesC& aDisplayName ) = 0;
       
   216 
       
   217         /**
       
   218         * Returns a reference to error container, that was filled by the last
       
   219         * operation response.
       
   220         * @return Reference to error container
       
   221         */
       
   222         virtual const MCAPresenceErrors& LastOperationResult() const = 0;
       
   223 
       
   224         /**
       
   225          * Cancel pending requests to network
       
   226          * @since 2.5
       
   227          */
       
   228         virtual void CancelPendingRequests() = 0;
       
   229 
       
   230         /**
       
   231          * Get temporary identification of contact which does not belong to contact list.
       
   232          * @since 2.6
       
   233          * @param aUserId, Contact id.
       
   234          * @return Contact identication. Nick or ripped userid.
       
   235          */
       
   236         virtual TPtrC IdentificationL( const TDesC& aUserId ) = 0;
       
   237 
       
   238         /**
       
   239          * Check if synchronization of contact lists is done
       
   240          * @since 3.2
       
   241          * @return ETrue if done
       
   242          */
       
   243         virtual TBool IsSyncDone() = 0;
       
   244 
       
   245         /**
       
   246             * AddObserver method for registering the other class
       
   247          */
       
   248         virtual void AddObserver( MCAListInitObserver* aObserver ) = 0 ;
       
   249 
       
   250         /**
       
   251             * RemoveObserver method for unregistering the other class
       
   252          */
       
   253         virtual void RemoveObserver() = 0;
       
   254 
       
   255         /**
       
   256          * IsListInitialization return the init bool value
       
   257          * @since 3.2
       
   258          * @return EFalse if done
       
   259          */
       
   260         virtual TBool IsListInitializationCompleted() = 0;
       
   261 
       
   262         virtual TBool IsContactFetchingCompleted() = 0;
       
   263 
       
   264         virtual void AddMainViewProcessObserver( MCAListInitObserver* aObserver ) = 0;
       
   265 
       
   266         virtual void RemoveMainViewProcessObserver() = 0;
       
   267 
       
   268     protected:
       
   269 
       
   270         /**
       
   271         * Destructor.
       
   272         */
       
   273         virtual ~MCAContactLists() {};
       
   274     };
       
   275 
       
   276 #endif      // MCACONTACTLISTS_H
       
   277 
       
   278 // End of File
       
   279