|
51
|
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: Implementation of MPresenceManagement
|
|
|
15 |
*
|
|
|
16 |
*/
|
|
|
17 |
|
|
|
18 |
#include "presentitygroupsimp.h"
|
|
|
19 |
#include "presenceinfoimp.h"
|
|
|
20 |
#include "presenceinfofilterimp.h"
|
|
|
21 |
#include "ximpobjecthelpers.h"
|
|
|
22 |
#include "presentitygroupinfoimp.h"
|
|
|
23 |
#include "presentitygroupmemberinfoimp.h"
|
|
|
24 |
#include "ximpidentityimp.h"
|
|
|
25 |
#include "ximpcontextinternal.h"
|
|
|
26 |
|
|
|
27 |
|
|
|
28 |
// ============================ MEMBER FUNCTIONS =============================
|
|
|
29 |
|
|
|
30 |
// ---------------------------------------------------------------------------
|
|
|
31 |
// CPresentityGroupsImp::NewL()
|
|
|
32 |
// ---------------------------------------------------------------------------
|
|
|
33 |
//
|
|
|
34 |
CPresentityGroupsImp* CPresentityGroupsImp::NewL(
|
|
|
35 |
MXIMPContextInternal& aContext )
|
|
|
36 |
{
|
|
|
37 |
CPresentityGroupsImp* self =
|
|
|
38 |
new( ELeave ) CPresentityGroupsImp( aContext );
|
|
|
39 |
|
|
|
40 |
return self;
|
|
|
41 |
}
|
|
|
42 |
|
|
|
43 |
// ---------------------------------------------------------------------------
|
|
|
44 |
// Implement supported interface access.
|
|
|
45 |
// ---------------------------------------------------------------------------
|
|
|
46 |
//
|
|
|
47 |
XIMPIMP_IF_BASE_GET_INTERFACE_BEGIN( CPresentityGroupsImp,
|
|
|
48 |
MPresentityGroups )
|
|
|
49 |
XIMPIMP_IF_BASE_GET_INTERFACE_END()
|
|
|
50 |
|
|
|
51 |
XIMPIMP_IF_BASE_GET_CONST_INTERFACE_BEGIN( CPresentityGroupsImp,
|
|
|
52 |
MPresentityGroups )
|
|
|
53 |
XIMPIMP_IF_BASE_GET_INTERFACE_END()
|
|
|
54 |
|
|
|
55 |
// ---------------------------------------------------------------------------
|
|
|
56 |
// CPresentityGroupsImp::~CPresentityGroupsImp()
|
|
|
57 |
// ---------------------------------------------------------------------------
|
|
|
58 |
//
|
|
|
59 |
CPresentityGroupsImp::~CPresentityGroupsImp()
|
|
|
60 |
{
|
|
|
61 |
//iContext not own
|
|
|
62 |
}
|
|
|
63 |
|
|
|
64 |
|
|
|
65 |
// ---------------------------------------------------------------------------
|
|
|
66 |
// CPresentityGroupsImp::CPresentityGroupsImp()
|
|
|
67 |
// ---------------------------------------------------------------------------
|
|
|
68 |
//
|
|
|
69 |
CPresentityGroupsImp::CPresentityGroupsImp(
|
|
|
70 |
MXIMPContextInternal& aContext )
|
|
|
71 |
: iContext( aContext )
|
|
|
72 |
{
|
|
|
73 |
}
|
|
|
74 |
|
|
|
75 |
// ---------------------------------------------------------------------------
|
|
|
76 |
// CPresentityGroupsImp::SubscribeOwnPresenceL()
|
|
|
77 |
// ---------------------------------------------------------------------------
|
|
|
78 |
//
|
|
|
79 |
TXIMPRequestId CPresentityGroupsImp::SubscribePresentityGroupListL()
|
|
|
80 |
{
|
|
|
81 |
return iContext.QueueOperationL( NPresenceOps::EPrSubscribeGroupList,
|
|
|
82 |
KNullDesC8 );
|
|
|
83 |
}
|
|
|
84 |
|
|
|
85 |
// ---------------------------------------------------------------------------
|
|
|
86 |
// CPresentityGroupsImp::SubscribeOwnPresenceL()
|
|
|
87 |
// ---------------------------------------------------------------------------
|
|
|
88 |
//
|
|
|
89 |
TXIMPRequestId CPresentityGroupsImp::UnsubscribePresentityGroupListL()
|
|
|
90 |
{
|
|
|
91 |
return iContext.QueueOperationL( NPresenceOps::EPrUnsubscribeGroupList,
|
|
|
92 |
KNullDesC8 );
|
|
|
93 |
}
|
|
|
94 |
|
|
|
95 |
// ---------------------------------------------------------------------------
|
|
|
96 |
// CPresentityGroupsImp::SubscribeOwnPresenceL()
|
|
|
97 |
// ---------------------------------------------------------------------------
|
|
|
98 |
//
|
|
|
99 |
TXIMPRequestId CPresentityGroupsImp::CreatePresentityGroupL( const MXIMPIdentity& aGroupId,
|
|
|
100 |
const TDesC16& aGroupDisplayName )
|
|
|
101 |
{
|
|
|
102 |
return QueueOperationL( NPresenceOps::EPrCreatePresentityGroup, aGroupId, aGroupDisplayName );
|
|
|
103 |
}
|
|
|
104 |
|
|
|
105 |
// ---------------------------------------------------------------------------
|
|
|
106 |
// CPresentityGroupsImp::DeletePresentityGroupL()
|
|
|
107 |
// ---------------------------------------------------------------------------
|
|
|
108 |
//
|
|
|
109 |
TXIMPRequestId CPresentityGroupsImp::DeletePresentityGroupL( const MXIMPIdentity& aGroupId )
|
|
|
110 |
{
|
|
|
111 |
return QueueOperationL( NPresenceOps::EPrDeletePresentityGroup, aGroupId, KNullDesC );
|
|
|
112 |
}
|
|
|
113 |
|
|
|
114 |
// ---------------------------------------------------------------------------
|
|
|
115 |
// CPresentityGroupsImp::UpdatePresentityGroupDisplayNameL()
|
|
|
116 |
// ---------------------------------------------------------------------------
|
|
|
117 |
//
|
|
|
118 |
TXIMPRequestId CPresentityGroupsImp::UpdatePresentityGroupDisplayNameL( const MXIMPIdentity& aGroupId,
|
|
|
119 |
const TDesC16& aGroupDisplayName )
|
|
|
120 |
{
|
|
|
121 |
return QueueOperationL( NPresenceOps::EPrUpdatePresentityGroupDisplayName, aGroupId, aGroupDisplayName );
|
|
|
122 |
}
|
|
|
123 |
|
|
|
124 |
|
|
|
125 |
// ---------------------------------------------------------------------------
|
|
|
126 |
// From MPresentityGroups class.
|
|
|
127 |
// CPresentityGroupsImp::SubscribePresentityGroupContentL
|
|
|
128 |
// ---------------------------------------------------------------------------
|
|
|
129 |
//
|
|
|
130 |
TXIMPRequestId CPresentityGroupsImp::SubscribePresentityGroupContentL(
|
|
|
131 |
const MXIMPIdentity& aGroupId )
|
|
|
132 |
{
|
|
|
133 |
HBufC8* idPack = PackIdentityLC( aGroupId );
|
|
|
134 |
|
|
|
135 |
TXIMPRequestId reqId =
|
|
|
136 |
iContext.QueueOperationL( NPresenceOps::EPrSubscribePresentityGroupContent,
|
|
|
137 |
*idPack );
|
|
|
138 |
CleanupStack::PopAndDestroy( idPack );
|
|
|
139 |
return reqId;
|
|
|
140 |
}
|
|
|
141 |
// ---------------------------------------------------------------------------
|
|
|
142 |
// From MPresentityGroups class.
|
|
|
143 |
// CPresentityGroupsImp::UnsubscribePresentityGroupContentL
|
|
|
144 |
// ---------------------------------------------------------------------------
|
|
|
145 |
//
|
|
|
146 |
TXIMPRequestId CPresentityGroupsImp::UnsubscribePresentityGroupContentL(
|
|
|
147 |
const MXIMPIdentity& aGroupId )
|
|
|
148 |
{
|
|
|
149 |
HBufC8* idPack = PackIdentityLC( aGroupId );
|
|
|
150 |
|
|
|
151 |
TXIMPRequestId reqId =
|
|
|
152 |
iContext.QueueOperationL( NPresenceOps::EPrUnsubscribePresentityGroupContent,
|
|
|
153 |
*idPack );
|
|
|
154 |
CleanupStack::PopAndDestroy( idPack );
|
|
|
155 |
return reqId;
|
|
|
156 |
}
|
|
|
157 |
|
|
|
158 |
// ---------------------------------------------------------------------------
|
|
|
159 |
// From MPresentityGroups class.
|
|
|
160 |
// CPresentityGroupsImp::AddPresentityGroupMemberL
|
|
|
161 |
// ---------------------------------------------------------------------------
|
|
|
162 |
//
|
|
|
163 |
TXIMPRequestId CPresentityGroupsImp::AddPresentityGroupMemberL(
|
|
|
164 |
const MXIMPIdentity& aGroupId,
|
|
|
165 |
const MXIMPIdentity& aMemberId,
|
|
|
166 |
const TDesC16& aMemberDisplayName )
|
|
|
167 |
{
|
|
|
168 |
return QueueOperationL( NPresenceOps::EPrAddPresentityGroupMember,
|
|
|
169 |
aGroupId,
|
|
|
170 |
aMemberId,
|
|
|
171 |
aMemberDisplayName );
|
|
|
172 |
}
|
|
|
173 |
|
|
|
174 |
// ---------------------------------------------------------------------------
|
|
|
175 |
// From MPresentityGroups class.
|
|
|
176 |
// CPresentityGroupsImp::RemovePresentityGroupMemberL
|
|
|
177 |
// ---------------------------------------------------------------------------
|
|
|
178 |
//
|
|
|
179 |
TXIMPRequestId CPresentityGroupsImp::RemovePresentityGroupMemberL(
|
|
|
180 |
const MXIMPIdentity& aGroupId,
|
|
|
181 |
const MXIMPIdentity& aMemberId )
|
|
|
182 |
{
|
|
|
183 |
return QueueOperationL( NPresenceOps::EPrRemovePresentityGroupMember,
|
|
|
184 |
aGroupId,
|
|
|
185 |
aMemberId );
|
|
|
186 |
}
|
|
|
187 |
|
|
|
188 |
// ---------------------------------------------------------------------------
|
|
|
189 |
// From MPresentityGroups class.
|
|
|
190 |
// CPresentityGroupsImp::UpdatePresentityGroupMemberDisplayNameL
|
|
|
191 |
// ---------------------------------------------------------------------------
|
|
|
192 |
//
|
|
|
193 |
TXIMPRequestId CPresentityGroupsImp::UpdatePresentityGroupMemberDisplayNameL(
|
|
|
194 |
const MXIMPIdentity& aGroupId,
|
|
|
195 |
const MXIMPIdentity& aMemberId,
|
|
|
196 |
const TDesC16& aMemberDisplayName )
|
|
|
197 |
{
|
|
|
198 |
return QueueOperationL( NPresenceOps::EPrUpdatePresentityGroupMemberDisplayName,
|
|
|
199 |
aGroupId,
|
|
|
200 |
aMemberId,
|
|
|
201 |
aMemberDisplayName );
|
|
|
202 |
}
|
|
|
203 |
|
|
|
204 |
// ---------------------------------------------------------------------------
|
|
|
205 |
// CPresentityGroupsImp::QueueOperationL()
|
|
|
206 |
// ---------------------------------------------------------------------------
|
|
|
207 |
//
|
|
|
208 |
TXIMPRequestId CPresentityGroupsImp::QueueOperationL( NPresenceOps::TPresenceOpTypes aOperation,
|
|
|
209 |
const MXIMPIdentity& aGroupId,
|
|
|
210 |
const TDesC16& aGroupDisplayName )
|
|
|
211 |
{
|
|
|
212 |
CPresentityGroupInfoImp* groupInfo =
|
|
|
213 |
CPresentityGroupInfoImp::NewLC( aGroupId, aGroupDisplayName );
|
|
|
214 |
HBufC8* infoPack = PackGroupInfoLC( *groupInfo );
|
|
|
215 |
|
|
|
216 |
TXIMPRequestId reqId =
|
|
|
217 |
iContext.QueueOperationL( aOperation, *infoPack );
|
|
|
218 |
CleanupStack::PopAndDestroy( 2, groupInfo );
|
|
|
219 |
|
|
|
220 |
return reqId;
|
|
|
221 |
}
|
|
|
222 |
|
|
|
223 |
// ---------------------------------------------------------------------------
|
|
|
224 |
// CPresentityGroupsImp::QueueOperationL()
|
|
|
225 |
// ---------------------------------------------------------------------------
|
|
|
226 |
//
|
|
|
227 |
TXIMPRequestId CPresentityGroupsImp::QueueOperationL( NPresenceOps::TPresenceOpTypes aOperation,
|
|
|
228 |
const MXIMPIdentity& aGroupId,
|
|
|
229 |
const MXIMPIdentity& aMemberId,
|
|
|
230 |
const TDesC16& aMemberDisplayName )
|
|
|
231 |
{
|
|
|
232 |
CBufFlat* buffer = CBufFlat::NewL( 10 ); // set granularity to 10
|
|
|
233 |
CleanupStack::PushL( buffer );
|
|
|
234 |
|
|
|
235 |
RBufWriteStream ws;
|
|
|
236 |
CleanupClosePushL( ws );
|
|
|
237 |
ws.Open( *buffer ); // CSI: 65 # Does not return a value
|
|
|
238 |
|
|
|
239 |
// group id
|
|
|
240 |
const CXIMPIdentityImp* identityImp =
|
|
|
241 |
TXIMPGetImpClassOrPanic< const CXIMPIdentityImp >::From( aGroupId );
|
|
|
242 |
identityImp->ExternalizeL( ws );
|
|
|
243 |
|
|
|
244 |
|
|
|
245 |
// member id
|
|
|
246 |
identityImp =
|
|
|
247 |
TXIMPGetImpClassOrPanic< const CXIMPIdentityImp >::From( aMemberId );
|
|
|
248 |
identityImp->ExternalizeL( ws );
|
|
|
249 |
|
|
|
250 |
|
|
|
251 |
// member display name
|
|
|
252 |
ws.WriteInt32L( aMemberDisplayName.Length() );
|
|
|
253 |
ws.WriteL( aMemberDisplayName );
|
|
|
254 |
|
|
|
255 |
ws.CommitL();
|
|
|
256 |
CleanupStack::PopAndDestroy(); //ws
|
|
|
257 |
|
|
|
258 |
HBufC8* packedBuf = buffer->Ptr( 0 ).AllocL();
|
|
|
259 |
CleanupStack::PopAndDestroy( buffer );
|
|
|
260 |
CleanupStack::PushL( packedBuf );
|
|
|
261 |
|
|
|
262 |
// Queue the operation
|
|
|
263 |
TXIMPRequestId reqId =
|
|
|
264 |
iContext.QueueOperationL( aOperation, *packedBuf );
|
|
|
265 |
CleanupStack::PopAndDestroy( packedBuf );
|
|
|
266 |
|
|
|
267 |
return reqId;
|
|
|
268 |
}
|
|
|
269 |
|
|
|
270 |
// ---------------------------------------------------------------------------
|
|
|
271 |
// CPresentityGroupsImp::QueueOperationL()
|
|
|
272 |
// ---------------------------------------------------------------------------
|
|
|
273 |
//
|
|
|
274 |
TXIMPRequestId CPresentityGroupsImp::QueueOperationL( NPresenceOps::TPresenceOpTypes aOperation,
|
|
|
275 |
const MXIMPIdentity& aGroupId,
|
|
|
276 |
const MXIMPIdentity& aMemberId )
|
|
|
277 |
{
|
|
|
278 |
CBufFlat* buffer = CBufFlat::NewL( 10 ); // set granularity to 10
|
|
|
279 |
CleanupStack::PushL( buffer );
|
|
|
280 |
|
|
|
281 |
RBufWriteStream ws;
|
|
|
282 |
CleanupClosePushL( ws );
|
|
|
283 |
ws.Open( *buffer ); // CSI: 65 # Does not return a value
|
|
|
284 |
|
|
|
285 |
// group id
|
|
|
286 |
const CXIMPIdentityImp* identityImp =
|
|
|
287 |
TXIMPGetImpClassOrPanic< const CXIMPIdentityImp >::From( aGroupId );
|
|
|
288 |
identityImp->ExternalizeL( ws );
|
|
|
289 |
|
|
|
290 |
|
|
|
291 |
// member id
|
|
|
292 |
identityImp =
|
|
|
293 |
TXIMPGetImpClassOrPanic< const CXIMPIdentityImp >::From( aMemberId );
|
|
|
294 |
identityImp->ExternalizeL( ws );
|
|
|
295 |
|
|
|
296 |
ws.CommitL();
|
|
|
297 |
CleanupStack::PopAndDestroy(); //ws
|
|
|
298 |
|
|
|
299 |
HBufC8* packedBuf = buffer->Ptr( 0 ).AllocL();
|
|
|
300 |
CleanupStack::PopAndDestroy( buffer );
|
|
|
301 |
CleanupStack::PushL( packedBuf );
|
|
|
302 |
|
|
|
303 |
// Queue the operation
|
|
|
304 |
TXIMPRequestId reqId =
|
|
|
305 |
iContext.QueueOperationL( aOperation, *packedBuf );
|
|
|
306 |
CleanupStack::PopAndDestroy( packedBuf );
|
|
|
307 |
|
|
|
308 |
return reqId;
|
|
|
309 |
}
|
|
|
310 |
|
|
|
311 |
|
|
|
312 |
// ---------------------------------------------------------------------------
|
|
|
313 |
// CPresentityGroupsImp::PackGroupInfoLC()
|
|
|
314 |
// ---------------------------------------------------------------------------
|
|
|
315 |
//
|
|
|
316 |
HBufC8* CPresentityGroupsImp::PackGroupInfoLC( const CPresentityGroupInfoImp& infoImp )
|
|
|
317 |
{
|
|
|
318 |
HBufC8* pack = TXIMPObjectPacker< const CPresentityGroupInfoImp >::PackL( infoImp );
|
|
|
319 |
CleanupStack::PushL( pack );
|
|
|
320 |
return pack;
|
|
|
321 |
}
|
|
|
322 |
|
|
|
323 |
// ---------------------------------------------------------------------------
|
|
|
324 |
// CPresentityGroupsImp::PackIdentityLC()
|
|
|
325 |
// ---------------------------------------------------------------------------
|
|
|
326 |
//
|
|
|
327 |
HBufC8* CPresentityGroupsImp::PackIdentityLC( const MXIMPIdentity& aIdentity )
|
|
|
328 |
{
|
|
|
329 |
const CXIMPIdentityImp* identityImp =
|
|
|
330 |
TXIMPGetImpClassOrPanic< const CXIMPIdentityImp >::From( aIdentity );
|
|
|
331 |
|
|
|
332 |
HBufC8* pack = TXIMPObjectPacker< const CXIMPIdentityImp >::PackL( *identityImp );
|
|
|
333 |
CleanupStack::PushL( pack );
|
|
|
334 |
|
|
|
335 |
return pack;
|
|
|
336 |
}
|
|
|
337 |
|
|
|
338 |
// End of file
|
|
|
339 |
|