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