IMPSengine/client/inc/impscdatautils.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: 
       
    15 * const definition class for imps inner data structure.
       
    16 *
       
    17 */
       
    18 
       
    19 
       
    20 #ifndef TImpsCDataUtils_H
       
    21 #define TImpsCDataUtils_H
       
    22 
       
    23 //  INCLUDES
       
    24 #include <e32base.h>
       
    25 #include <badesca.h>
       
    26 #include "impsdatautils.h"
       
    27 #include "impsdataaccessorapi.h"
       
    28 #include "impsdataaccessor.h"
       
    29 #include "impsservercommon.h"
       
    30 #include "impsdetailed.h"
       
    31 #include "ImpsCommonEnums.h"
       
    32 
       
    33 // CONSTANTS
       
    34 
       
    35 const TImpsContent KJoinGroupUserListElements[] = 
       
    36     { EImpsKeySession,
       
    37       EImpsKeyTransaction,
       
    38       EImpsKeyTransactionContent,
       
    39       EImpsKeyJoinGroup_Response,
       
    40       EImpsKeyUserList };
       
    41                                                           
       
    42 const TImpsContent KLeaveGroupGroupIdElements[]  = 
       
    43     { EImpsKeySession,
       
    44       EImpsKeyTransaction,
       
    45       EImpsKeyTransactionContent,
       
    46       EImpsKeyLeaveGroup_Response };
       
    47 
       
    48 const TImpsContent KGroupMembersUserListElements[] = 
       
    49     { EImpsKeySession,
       
    50       EImpsKeyTransaction,
       
    51       EImpsKeyTransactionContent,
       
    52       EImpsKeyGetGroupMembers_Response,
       
    53       EImpsKeyUsers };
       
    54 
       
    55 const TImpsContent KGroupPropElements[]  = 
       
    56     { EImpsKeySession,
       
    57       EImpsKeyTransaction,
       
    58       EImpsKeyTransactionContent,
       
    59       EImpsKeyGetGroupProps_Response };
       
    60 
       
    61 const TImpsContent KGroupRejectUserListElements[] = 
       
    62     { EImpsKeySession,
       
    63       EImpsKeyTransaction,
       
    64       EImpsKeyTransactionContent,
       
    65       EImpsKeyRejectList_Response,
       
    66       EImpsKeyUserList };
       
    67 
       
    68 const TImpsContent KGroupChangeNoticeElements[]  = 
       
    69     { EImpsKeySession,
       
    70       EImpsKeyTransaction,
       
    71       EImpsKeyTransactionContent,
       
    72       EImpsKeyGroupChangeNotice };
       
    73 
       
    74 const TImpsContent KGroupChangeNoticeJoinedElements[] = 
       
    75     { EImpsKeySession,
       
    76       EImpsKeyTransaction,
       
    77       EImpsKeyTransactionContent,
       
    78       EImpsKeyGroupChangeNotice,
       
    79       EImpsKeyJoined };
       
    80 
       
    81 const TImpsContent KGroupChangeNoticeLeftElements[] = 
       
    82     { EImpsKeySession,
       
    83       EImpsKeyTransaction,
       
    84       EImpsKeyTransactionContent,
       
    85       EImpsKeyGroupChangeNotice,
       
    86       EImpsKeyLeft,
       
    87       EImpsKeyUserList };
       
    88 
       
    89 const TImpsContent KGetPresenceReponseElements[] = 
       
    90     { EImpsKeySession,
       
    91       EImpsKeyTransaction,
       
    92       EImpsKeyTransactionContent,
       
    93       EImpsKeyGetPresence_Response };
       
    94 
       
    95 const TImpsContent KPresenceNotificationReqElements[]  = 
       
    96     { EImpsKeySession,
       
    97       EImpsKeyTransaction,
       
    98       EImpsKeyTransactionContent,
       
    99       EImpsKeyPresenceNotification_Request };
       
   100 
       
   101 //<< ------------------ FUNDAMENTAL --------------- >>
       
   102 
       
   103 //Invite-Request elements
       
   104 const TImpsContent KInviteRequestElements[] = 
       
   105     { EImpsKeySession,
       
   106       EImpsKeyTransaction,
       
   107       EImpsKeyTransactionContent,
       
   108       EImpsKeyInvite_Request };
       
   109 
       
   110 //Invite-Request elements
       
   111 const TImpsContent KInviteCancelRequestElements[] = 
       
   112     { EImpsKeySession,
       
   113       EImpsKeyTransaction,
       
   114       EImpsKeyTransactionContent,
       
   115       EImpsKeyCancelInvite_Request };
       
   116 
       
   117 //InviteUserResponse
       
   118 const TImpsContent KInviteCancelUserRequestElements[]  = 
       
   119     { EImpsKeySession,
       
   120       EImpsKeyTransaction,
       
   121       EImpsKeyTransactionContent,
       
   122       EImpsKeyCancelInviteUser_Request };
       
   123 
       
   124 //InviteUserResponse
       
   125 const TImpsContent KInviteUserResponseElements[] = 
       
   126     { EImpsKeySession,
       
   127       EImpsKeyTransaction,
       
   128       EImpsKeyTransactionContent,
       
   129       EImpsKeyInviteUser_Response };
       
   130 
       
   131 //InviteUserResponse
       
   132 const TImpsContent KInviteUserRequestElements[] = 
       
   133     { EImpsKeySession,
       
   134       EImpsKeyTransaction,
       
   135       EImpsKeyTransactionContent,
       
   136       EImpsKeyInviteUser_Request };
       
   137 
       
   138 //Invite-Response elements
       
   139 const TImpsContent KInviteResponseElements[] = 
       
   140     { EImpsKeySession,
       
   141       EImpsKeyTransaction,
       
   142       EImpsKeyTransactionContent,
       
   143       EImpsKeyInvite_Response };
       
   144 
       
   145 //SearchRequest
       
   146 const TImpsContent KSearchRequestElements[] = 
       
   147     { EImpsKeySession,
       
   148       EImpsKeyTransaction,
       
   149       EImpsKeyTransactionContent,
       
   150       EImpsKeySearch_Request };
       
   151 
       
   152 //SearchResponse
       
   153 const TImpsContent KSearchResponseElements[] = 
       
   154     { EImpsKeySession,
       
   155       EImpsKeyTransaction,
       
   156       EImpsKeyTransactionContent,
       
   157       EImpsKeySearch_Response };
       
   158 
       
   159 //StopSearchRequest
       
   160 const TImpsContent KSearchStopRequestElements[] = 
       
   161     { EImpsKeySession,
       
   162       EImpsKeyTransaction,
       
   163       EImpsKeyTransactionContent,
       
   164       EImpsKeyStopSearch_Request };
       
   165 
       
   166 //JoinGroupResponse
       
   167 const TImpsContent KJoinGroupResponseElements[] = 
       
   168     { EImpsKeySession,
       
   169       EImpsKeyTransaction,
       
   170       EImpsKeyTransactionContent,
       
   171       EImpsKeyJoinGroup_Response };
       
   172 
       
   173 // FORWARD DECLARATIONS
       
   174 class MImpsKey;
       
   175 class CImpsCommonGroupPropsInt;
       
   176 class CImpsPrivateGroupPropsInt;
       
   177 class TImpsServices;
       
   178 class TImpsDataUtils;
       
   179 
       
   180 // DATA TYPES
       
   181 // This is the way to make class name changes in stages
       
   182 
       
   183 // TODO check if this can be removed
       
   184 typedef TImpsDataUtils CImpsDataUtils;
       
   185 
       
   186 // CLASS DECLARATION
       
   187 
       
   188 /**
       
   189 *  A set of static methods that get certain data elements from data accessor. 
       
   190 */
       
   191 class TImpsCDataUtils : public TImpsDataUtils
       
   192     {
       
   193     public:  // Constructors and destructor
       
   194         
       
   195         /**
       
   196         * C++ default constructor.
       
   197         */
       
   198         TImpsCDataUtils();
       
   199         
       
   200 
       
   201     public: // New functions
       
   202 
       
   203    
       
   204         /**
       
   205         * Get recipients from internal data
       
   206         * @param aPredecessor, element array, 
       
   207         *        parent node of particular Recipient element 
       
   208         * @param aAc data accessor
       
   209         * @param aGroups Recipient(Group*(GroupID)) output,
       
   210         * @param aUsers  Recipient(User*(UserID)) output
       
   211         * @param aSnGroups Recipient(Group*(ScreenName(GroupId))) output
       
   212         * @param aScreenNs Recipient(Group*(ScreenName(SName))) output
       
   213         */
       
   214         static void GetRecipientsL(
       
   215             MImpsKey* aPredecessor, 
       
   216             MImpsDataAccessor* aAc,
       
   217             CPtrC16Array* aGroups,        
       
   218             CPtrC16Array* aUsers,         
       
   219             CPtrC16Array* aSnGroups,       
       
   220             CPtrC16Array* aScreenNs );    
       
   221     
       
   222         /**
       
   223         * Set recipients data
       
   224         * @param aPredecessor, element array, 
       
   225         *        parent node of particular Recipient element
       
   226         * @param aAc data accessor  
       
   227         * @param aGroups groupID list
       
   228         * @param aUserIds userID list
       
   229         * @param aSnGroup ScreenName( GroupId )
       
   230         * @param aScreenNames ScreenName( SName )
       
   231         */
       
   232         static void SetRecipientsL(
       
   233             MImpsKey* aPredecessor,
       
   234             MImpsDataAccessor* aAc,
       
   235             const MDesC16Array* aGroups,
       
   236             const MDesC16Array* aUserIds,  
       
   237             const MDesC16Array* aSnGroups,         
       
   238             const MDesC16Array* aScreenNames );    
       
   239 
       
   240         /**
       
   241         * Set recipients data
       
   242         * @param aPredecessor key element path so far 
       
   243         * @param aAc message data
       
   244         * @param @aSender UserID or SName
       
   245         * @param aGroupId ScreenName( GroupdID)
       
   246         */
       
   247         static void SetSenderL(
       
   248             MImpsKey* aPredecessor,
       
   249             MImpsDataAccessor* aAc,
       
   250             const TDesC* aSender,
       
   251             const TDesC* aGroupId );  
       
   252 
       
   253         /**
       
   254         * Get user list from internal data
       
   255         * @param aPredecessor, parent node of particular Recipient element 
       
   256         * @param aAc data accessor
       
   257         * @param aUsers users output
       
   258         * @param aScreenNames screenname output
       
   259         */
       
   260         static void GetUserListL(
       
   261             MImpsKey* aPredecessor,
       
   262             MImpsDataAccessor* aAc,
       
   263             CDesCArray* aUsers,
       
   264             CDesCArray* aScreenNames );
       
   265 
       
   266         /**
       
   267         * Get Moderators and admins from internal data
       
   268         * @param aPredecessor, parent node of particular Recipient element 
       
   269         * @param aAc data accessor
       
   270         * @param aModerators, moderators output
       
   271         * @param aAdmins, Admins output
       
   272         */
       
   273         static void GetModAndAdmL(
       
   274             MImpsKey* aPredecessor,
       
   275             MImpsDataAccessor* aAc,
       
   276             CDesCArray* aModerators,
       
   277             CDesCArray* aAdmins
       
   278             );
       
   279  
       
   280         /**
       
   281         * Get users from internal data
       
   282         * @param aPredecessor, parent node of particular Recipient element 
       
   283         * @param aAc data accessor
       
   284         * @param aUsers, users output
       
   285         */
       
   286         static void GetUsersL(
       
   287             MImpsKey* aPredecessor,
       
   288             MImpsDataAccessor* aAc,
       
   289             CDesCArray* aUsers
       
   290             );
       
   291 
       
   292         /**
       
   293         * Get group properties from internal data
       
   294         * @param aPredecessor, parent node of particular Recipient element 
       
   295         * @param aAc data accessor
       
   296         * @param aCommonP, common properties output
       
   297         * @param aPrivateP, private properties output
       
   298         */
       
   299         static void GetGroupPropertiesL(
       
   300             MImpsKey* aPredecessor,
       
   301             MImpsDataAccessor* aAc,
       
   302             CImpsCommonGroupPropsInt* aCommonP,
       
   303             CImpsPrivateGroupPropsInt* aPrivateP
       
   304             );
       
   305 
       
   306 
       
   307         /**
       
   308         * Get only UserIDs from reponse. 
       
   309         * @param aKey, key that will be initialized!  
       
   310         * @param aAc data accessor
       
   311         * @param aBlockEntity list of blocked UserIDs
       
   312         * @param aBlockedlistInUse ETrue if block list in use
       
   313         * @param aGrantedEntityList list of granted UserIDs
       
   314         * @param aGrantedlistInUse ETrue if grant list in use
       
   315         */
       
   316         static void GetBlockedListResponseL( 
       
   317             MImpsKey* aKey,
       
   318             MImpsDataAccessor* aAc,
       
   319             CPtrC16Array*                 aBlockEntity,
       
   320             TBool&                        aBlockedlistInUse,
       
   321             CPtrC16Array*                 aGrantedEntityLis,
       
   322             TBool&                        aGrantedlistInUse
       
   323             );
       
   324 
       
   325         /**
       
   326         * Get only UserIDs from reponse. Notice!!!!!
       
   327         * @param aKey, key that will be initialized!  
       
   328         * @param aAc data accessor
       
   329         * @param aBlockEntity list of blocked UserIDs
       
   330         * @param aUnBlockEntity list of unblocked UserIDs
       
   331         * @param aBlockedlistInUse ETrue if block list in use
       
   332         * @param aGrantedEntityList list of granted UserIDs
       
   333         * @param aUnGrantEntity list of ungranted UserIDs
       
   334         * @param aGrantedlistInUse ETrue if grant list in use
       
   335         */
       
   336         static void SetBlockedListRequestL( 
       
   337             MImpsKey* aKey,
       
   338             MImpsDataAccessor* aAc,
       
   339             const MDesCArray* aBlockEntity,
       
   340             const MDesCArray* aUnBlockEntity,
       
   341             TBool aBlockedListInUse,
       
   342             const MDesCArray* aGrantedEntityList,
       
   343             const MDesCArray* aUnGrantEntity,
       
   344             TBool aGrantedListInUse
       
   345             );
       
   346 
       
   347         /**
       
   348         * Get Detailed result
       
   349         * @param aKey, key that will be initialized!  
       
   350         * @param aAc data accessor
       
   351         * @param ADescription
       
   352         * @param ADetailed error descrition
       
   353         * @return ETrue if found, else EFalse
       
   354         */
       
   355         static TBool GetDetailedResultL( 
       
   356             MImpsKey* aKey,
       
   357             MImpsDataAccessor* aAc,
       
   358             TPtrC& aDescription,
       
   359             CImpsDetailed*& aDetailed );
       
   360 
       
   361         /**
       
   362         * Set ContentType for NewMessage(C-S)
       
   363         * @param aAc data accessor
       
   364         * @param ContentType 
       
   365         */   
       
   366         static void SetContentTypeL( 
       
   367             MImpsDataAccessor* aAc,
       
   368             TPtrC& aContentType );
       
   369         
       
   370         /**
       
   371         * Get ContentEncoding from NewMessage(C-S)
       
   372         * @param aAc data accessor
       
   373         * @param aContentEncoding 
       
   374         */       
       
   375         static void GetContentEncodingL( 
       
   376             MImpsDataAccessor* aAc,
       
   377             TInt& aEncoding );
       
   378         
       
   379         /**
       
   380         * Get UrlList from InviteUserRequest
       
   381         * @param aAc data accessor
       
   382         * @param aUrlList 
       
   383         */       
       
   384         static void GetUrlListL(
       
   385             MImpsDataAccessor* aAc,
       
   386             CDesCArray* aUrlList );
       
   387             
       
   388         /**
       
   389         * Get user list from internal data
       
   390         * @param aPredecessor, parent node of particular Recipient element 
       
   391         * @param aAc data accessor
       
   392         * @param aUsers users output
       
   393         * @param aScreenNames screenname output
       
   394         */
       
   395         static void GetUserMapListL(
       
   396             MImpsKey* aPredecessor,
       
   397             MImpsDataAccessor* aAc,
       
   398             CDesCArray* aUsers,
       
   399             CDesCArray* aScreenNames );
       
   400             
       
   401     private:
       
   402 
       
   403 
       
   404     };
       
   405 
       
   406 #endif        
       
   407             
       
   408 // End of File