|
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: IMPS Protocol implementation for Presence Framework |
|
15 * |
|
16 */ |
|
17 |
|
18 #include <ximpbase.h> |
|
19 #include <ximpidentity.h> |
|
20 #include <ximpprotocolconnectionhost.h> |
|
21 #include "cimpsprotocolpresentitygroups.h" |
|
22 #include "impsdebugprint.h" |
|
23 #include "cimpsPluginConnectionManager.h" |
|
24 #include "CSubscribePresentityGroupListRequest.h" |
|
25 |
|
26 #include "ccreatepresentitygrouprequest.h" |
|
27 #include "cdeletepresentitygrouprequest.h" |
|
28 #include "caddPresentityGroupMemberRequest.h" |
|
29 #include "cremovePresentityGroupMemberRequest.h" |
|
30 #include "cupdatepresentitygroupmemberdisplaynamerequest.h" |
|
31 #include "cupdatePresentityGroupDisplayNameRequest.h" |
|
32 #include "csubscribepresentitygroupcontentrequest.h" |
|
33 #include "cunsubscribepresentitygroupcontentrequest.h" |
|
34 |
|
35 #include "impsconnectionmanagercontrolif.h" |
|
36 #include "impspluginpanics.h" |
|
37 |
|
38 |
|
39 // ======== MEMBER FUNCTIONS ======== |
|
40 |
|
41 // --------------------------------------------------------------------------- |
|
42 // CImpsProtocolPresentityGroups::GetInterface() |
|
43 // --------------------------------------------------------------------------- |
|
44 // |
|
45 TAny* CImpsProtocolPresentityGroups::GetInterface( TInt32 aInterfaceId, |
|
46 TIfGetOps aOptions ) |
|
47 { |
|
48 IMPS_DP( D_IMPS_LIT( "CImpsProtocolPresentityGroups::GetInterface() Start" ) ); |
|
49 if ( aInterfaceId == MProtocolPresentityGroups::KInterfaceId ) |
|
50 { |
|
51 MProtocolPresentityGroups* self = this; |
|
52 return self; |
|
53 } |
|
54 |
|
55 if ( aOptions == MXIMPBase::EPanicIfUnknown ) |
|
56 |
|
57 { |
|
58 User::Panic( KImpsProtocolPresentityGroups, KErrExtensionNotSupported ); |
|
59 } |
|
60 |
|
61 IMPS_DP( D_IMPS_LIT( "CImpsProtocolPresentityGroups::GetInterface() End" ) ); |
|
62 return NULL; |
|
63 } |
|
64 |
|
65 |
|
66 // --------------------------------------------------------------------------- |
|
67 // CImpsProtocolPresentityGroups::GetInterface() |
|
68 // --------------------------------------------------------------------------- |
|
69 // |
|
70 const TAny* CImpsProtocolPresentityGroups::GetInterface( TInt32 aInterfaceId, |
|
71 TIfGetOps aOptions ) const |
|
72 { |
|
73 IMPS_DP( D_IMPS_LIT( "CImpsProtocolPresentityGroups::GetInterface() Start" ) ); |
|
74 if ( aInterfaceId == MProtocolPresentityGroups::KInterfaceId ) |
|
75 { |
|
76 const MProtocolPresentityGroups* self = this; |
|
77 return self; |
|
78 } |
|
79 |
|
80 if ( aOptions == MXIMPBase::EPanicIfUnknown ) |
|
81 |
|
82 { |
|
83 User::Panic( KImpsProtocolPresentityGroups, KErrExtensionNotSupported ); |
|
84 } |
|
85 |
|
86 IMPS_DP( D_IMPS_LIT( "CImpsProtocolPresentityGroups::GetInterface() End" ) ); |
|
87 return NULL; |
|
88 } |
|
89 |
|
90 |
|
91 // --------------------------------------------------------------------------- |
|
92 // CImpsProtocolPresentityGroups::GetInterfaceId() |
|
93 // --------------------------------------------------------------------------- |
|
94 // |
|
95 TInt32 CImpsProtocolPresentityGroups::GetInterfaceId() const |
|
96 { |
|
97 IMPS_DP( D_IMPS_LIT( "CImpsProtocolPresentityGroups::GetInterfaceId() Start-End" ) ); |
|
98 return MProtocolPresentityGroups::KInterfaceId; |
|
99 } |
|
100 |
|
101 |
|
102 // --------------------------------------------------------------------------- |
|
103 // CImpsProtocolPresentityGroups::CImpsProtocolPresentityGroups() |
|
104 // --------------------------------------------------------------------------- |
|
105 // |
|
106 CImpsProtocolPresentityGroups::CImpsProtocolPresentityGroups( |
|
107 MImpsPrtPluginConnectionManager& aConnMan ) |
|
108 : iConnMan( aConnMan ) |
|
109 { |
|
110 IMPS_DP( D_IMPS_LIT( "Groups::CImpsProtocolPresentityGroups() Start-End" ) ); |
|
111 } |
|
112 |
|
113 |
|
114 // --------------------------------------------------------------------------- |
|
115 // CImpsProtocolPresentityGroups::ConstructL() |
|
116 // --------------------------------------------------------------------------- |
|
117 // |
|
118 void CImpsProtocolPresentityGroups::ConstructL() |
|
119 { |
|
120 IMPS_DP( D_IMPS_LIT( "CImpsProtocolPresentityGroups::ConstructL() Start" ) ); |
|
121 IMPS_DP( D_IMPS_LIT( "CImpsProtocolPresentityGroups::ConstructL() End" ) ); |
|
122 } |
|
123 |
|
124 |
|
125 // --------------------------------------------------------------------------- |
|
126 // CImpsProtocolPresentityGroups::NewL() |
|
127 // --------------------------------------------------------------------------- |
|
128 // |
|
129 CImpsProtocolPresentityGroups* CImpsProtocolPresentityGroups::NewL( |
|
130 MImpsPrtPluginConnectionManager& aConnMan ) |
|
131 { |
|
132 IMPS_DP( D_IMPS_LIT( "CImpsProtocolPresentityGroups::NewL() Start" ) ); |
|
133 |
|
134 CImpsProtocolPresentityGroups* self = |
|
135 new( ELeave ) CImpsProtocolPresentityGroups( aConnMan ); |
|
136 CleanupStack::PushL( self ); |
|
137 self->ConstructL( ); |
|
138 CleanupStack::Pop( self ); |
|
139 |
|
140 IMPS_DP( D_IMPS_LIT( "CImpsProtocolPresentityGroups::NewL() End" ) ); |
|
141 return self; |
|
142 } |
|
143 |
|
144 |
|
145 // --------------------------------------------------------------------------- |
|
146 // CImpsProtocolPresentityGroups::~CImpsProtocolPresentityGroups() |
|
147 // --------------------------------------------------------------------------- |
|
148 // |
|
149 CImpsProtocolPresentityGroups::~CImpsProtocolPresentityGroups() |
|
150 { |
|
151 IMPS_DP( D_IMPS_LIT( "Groups::~CImpsProtocolPresentityGroups() Start" ) ); |
|
152 |
|
153 |
|
154 IMPS_DP( D_IMPS_LIT( "Groups::~CImpsProtocolPresentityGroups() End" ) ); |
|
155 } |
|
156 |
|
157 |
|
158 |
|
159 // --------------------------------------------------------------------------- |
|
160 // CImpsProtocolPresentityGroups::DoSubscribePresentityGroupListL() |
|
161 // --------------------------------------------------------------------------- |
|
162 // |
|
163 void CImpsProtocolPresentityGroups::DoSubscribePresentityGroupListL( |
|
164 TXIMPRequestId aReqId ) |
|
165 { |
|
166 IMPS_DP( D_IMPS_LIT( "Groups::DoSubscribePresentityGroupListL() Start" ) ); |
|
167 |
|
168 CreateDataHandlerL(); |
|
169 |
|
170 iConnMan.ReserveSpaceForOneMoreRequestL(); |
|
171 |
|
172 CSubscribePresentityGroupListRequest* req = |
|
173 CSubscribePresentityGroupListRequest::NewLC( iConnMan, aReqId ); |
|
174 |
|
175 CleanupStack::Check( req ); |
|
176 |
|
177 req->SubscribePresentityGroupListRequestL(); |
|
178 |
|
179 iConnMan.AddRequest( req ); |
|
180 CleanupStack::Pop( req ); |
|
181 |
|
182 IMPS_DP( D_IMPS_LIT( "Groups::DoSubscribePresentityGroupListL() End" ) ); |
|
183 } |
|
184 |
|
185 |
|
186 // --------------------------------------------------------------------------- |
|
187 // CImpsProtocolPresentityGroups::DoUnsubscribePresentityGroupListL() |
|
188 // --------------------------------------------------------------------------- |
|
189 // |
|
190 void CImpsProtocolPresentityGroups::DoUnsubscribePresentityGroupListL( |
|
191 TXIMPRequestId aReqId ) |
|
192 { |
|
193 IMPS_DP_TXT( "Groups::DoUnsubscribePresentityGroupListL() Start" ); |
|
194 |
|
195 // Just complete the request for the presence framework. |
|
196 iConnMan.HandleToHost().HandleRequestCompleted( aReqId, KErrNone ); |
|
197 |
|
198 IMPS_DP_TXT( "Groups::DoUnsubscribePresentityGroupListL() End" ); |
|
199 } |
|
200 |
|
201 |
|
202 // --------------------------------------------------------------------------- |
|
203 // CImpsProtocolPresentityGroups::DoCreatePresentityGroupL() |
|
204 // --------------------------------------------------------------------------- |
|
205 // |
|
206 void CImpsProtocolPresentityGroups::DoCreatePresentityGroupL( |
|
207 const MXIMPIdentity& aIdentity, |
|
208 const TDesC16& aDisplayName, |
|
209 TXIMPRequestId aReqId ) |
|
210 { |
|
211 IMPS_DP_TXT( "Groups::DoCreatePresentityGroupL() Start" ); |
|
212 |
|
213 CreateDataHandlerL(); |
|
214 |
|
215 iConnMan.ReserveSpaceForOneMoreRequestL(); |
|
216 |
|
217 CCreatePresentityGroupRequest* req = |
|
218 CCreatePresentityGroupRequest::NewLC( iConnMan, aReqId ); |
|
219 |
|
220 CleanupStack::Check( req ); |
|
221 req->CreatePresentityGroupRequestL( aIdentity, aDisplayName ); |
|
222 |
|
223 iConnMan.AddRequest( req ); |
|
224 CleanupStack::Pop( req ); |
|
225 |
|
226 IMPS_DP_TXT( "Groups::DoCreatePresentityGroupL() End" ); |
|
227 } |
|
228 |
|
229 // --------------------------------------------------------------------------- |
|
230 // CImpsProtocolPresentityGroups::DoDeletePresentityGroupL() |
|
231 // --------------------------------------------------------------------------- |
|
232 // |
|
233 void CImpsProtocolPresentityGroups::DoDeletePresentityGroupL( |
|
234 const MXIMPIdentity& aIdentity, |
|
235 TXIMPRequestId aReqId ) |
|
236 { |
|
237 IMPS_DP_TXT( "Groups::DoDeletePresentityGroupL() Start" ); |
|
238 |
|
239 CreateDataHandlerL(); |
|
240 |
|
241 iConnMan.ReserveSpaceForOneMoreRequestL(); |
|
242 |
|
243 CDeletePresentityGroupRequest* req = |
|
244 CDeletePresentityGroupRequest::NewLC( iConnMan, aReqId ); |
|
245 |
|
246 req->DeletePresentityGroupRequestL( aIdentity ); |
|
247 |
|
248 iConnMan.AddRequest( req ); |
|
249 CleanupStack::Pop( req ); |
|
250 |
|
251 IMPS_DP_TXT( "Groups::DoDeletePresentityGroupL() End" ); |
|
252 } |
|
253 |
|
254 // --------------------------------------------------------------------------- |
|
255 // CImpsProtocolPresentityGroups::DoUpdatePresentityGroupDisplayNameL() |
|
256 // --------------------------------------------------------------------------- |
|
257 // |
|
258 void CImpsProtocolPresentityGroups::DoUpdatePresentityGroupDisplayNameL( |
|
259 const MXIMPIdentity& aIdentity, |
|
260 const TDesC16& aDisplayName, |
|
261 TXIMPRequestId aReqId ) |
|
262 { |
|
263 IMPS_DP_TXT( "Groups::DoUpdatePresentityGroupDisplayNameL() Start" ); |
|
264 |
|
265 CreateDataHandlerL(); |
|
266 |
|
267 iConnMan.ReserveSpaceForOneMoreRequestL(); |
|
268 |
|
269 CUpdatePresentityGroupDisplayNameRequest* req = |
|
270 CUpdatePresentityGroupDisplayNameRequest::NewLC( iConnMan, aReqId ); |
|
271 |
|
272 CleanupStack::Check( req ); |
|
273 |
|
274 req->UpdatePresentityGroupDisplayNameL( aIdentity, aDisplayName ); |
|
275 |
|
276 iConnMan.AddRequest( req ); |
|
277 CleanupStack::Pop( req ); |
|
278 |
|
279 IMPS_DP_TXT( "Groups::DoUpdatePresentityGroupDisplayNameL() End" ); |
|
280 } |
|
281 |
|
282 // --------------------------------------------------------------------------- |
|
283 // CImpsProtocolPresentityGroups::DoSubscribePresentityGroupContentL() |
|
284 // --------------------------------------------------------------------------- |
|
285 // |
|
286 void CImpsProtocolPresentityGroups::DoSubscribePresentityGroupContentL( |
|
287 const MXIMPIdentity& aGroupId, |
|
288 TXIMPRequestId aReqId ) |
|
289 { |
|
290 IMPS_DP_TXT( "Groups::DoSubscribePresentityGroupContentL() Start" ); |
|
291 |
|
292 CreateDataHandlerL(); |
|
293 |
|
294 iConnMan.ReserveSpaceForOneMoreRequestL(); |
|
295 |
|
296 CSubscribePresentityGroupContentRequest* req = |
|
297 CSubscribePresentityGroupContentRequest::NewLC( iConnMan, aReqId ); |
|
298 |
|
299 CleanupStack::Check( req ); |
|
300 |
|
301 req->SubscribePresentityGroupContentL( aGroupId ); |
|
302 |
|
303 iConnMan.AddRequest( req ); |
|
304 CleanupStack::Pop( req ); |
|
305 |
|
306 IMPS_DP_TXT( "Groups::DoSubscribePresentityGroupContentL() End" ); |
|
307 } |
|
308 |
|
309 // --------------------------------------------------------------------------- |
|
310 // CImpsProtocolPresentityGroups::DoUnsubscribePresentityGroupContentL() |
|
311 // --------------------------------------------------------------------------- |
|
312 // |
|
313 void CImpsProtocolPresentityGroups::DoUnsubscribePresentityGroupContentL( |
|
314 const MXIMPIdentity& aGroupId, |
|
315 TXIMPRequestId aReqId ) |
|
316 { |
|
317 IMPS_DP_TXT( "Groups::DoUnsubscribePresentityGroupContentL() Start" ); |
|
318 |
|
319 IMPSPRTPLUGIN_UNUSED_PARAM( aGroupId ); |
|
320 // just complete the request to PrFw Successfully |
|
321 |
|
322 iConnMan.HandleToHost().HandleRequestCompleted( aReqId, KErrNone ); |
|
323 |
|
324 IMPS_DP_TXT( "Groups::DoUnsubscribePresentityGroupContentL() End" ); |
|
325 } |
|
326 |
|
327 // --------------------------------------------------------------------------- |
|
328 // CImpsProtocolPresentityGroups::DoAddPresentityGroupMemberL() |
|
329 // --------------------------------------------------------------------------- |
|
330 // |
|
331 void CImpsProtocolPresentityGroups::DoAddPresentityGroupMemberL( |
|
332 const MXIMPIdentity& aGroupId, |
|
333 const MXIMPIdentity& aMemberId, |
|
334 const TDesC16& aMemberDisplayName, |
|
335 TXIMPRequestId aReqId ) |
|
336 { |
|
337 IMPS_DP_TXT( "Groups::DoAddPresentityGroupMemberL() Start" ); |
|
338 |
|
339 CreateDataHandlerL(); |
|
340 |
|
341 iConnMan.ReserveSpaceForOneMoreRequestL(); |
|
342 |
|
343 CAddPresentityGroupMemberRequest* req = |
|
344 CAddPresentityGroupMemberRequest::NewLC( iConnMan, aReqId ); |
|
345 |
|
346 CleanupStack::Check( req ); |
|
347 |
|
348 req->AddPresentityGroupMemberL( aGroupId, aMemberId, aMemberDisplayName ); |
|
349 |
|
350 iConnMan.AddRequest( req ); |
|
351 CleanupStack::Pop( req ); |
|
352 |
|
353 IMPS_DP_TXT( "Groups::DoAddPresentityGroupMemberL() End" ); |
|
354 } |
|
355 |
|
356 // --------------------------------------------------------------------------- |
|
357 // CImpsProtocolPresentityGroups::DoRemovePresentityGroupMemberL() |
|
358 // --------------------------------------------------------------------------- |
|
359 // |
|
360 void CImpsProtocolPresentityGroups::DoRemovePresentityGroupMemberL( |
|
361 const MXIMPIdentity& aGroupId, |
|
362 const MXIMPIdentity& aMemberId, |
|
363 TXIMPRequestId aReqId ) |
|
364 { |
|
365 IMPS_DP_TXT( "Groups::DoRemovePresentityGroupMemberL() Start" ); |
|
366 |
|
367 CreateDataHandlerL(); |
|
368 |
|
369 iConnMan.ReserveSpaceForOneMoreRequestL(); |
|
370 |
|
371 CRemovePresentityGroupMemberRequest* req = |
|
372 CRemovePresentityGroupMemberRequest::NewLC( iConnMan, aReqId ); |
|
373 |
|
374 CleanupStack::Check( req ); |
|
375 |
|
376 req->RemovePresentityGroupMemberL( aGroupId, aMemberId ); |
|
377 |
|
378 iConnMan.AddRequest( req ); |
|
379 CleanupStack::Pop( req ); |
|
380 |
|
381 IMPS_DP_TXT( "Groups::DoRemovePresentityGroupMemberL() End" ); |
|
382 } |
|
383 |
|
384 // --------------------------------------------------------------------------- |
|
385 // CImpsProtocolPresentityGroups::DoUpdatePresentityGroupMemberDisplayNameL() |
|
386 // --------------------------------------------------------------------------- |
|
387 // |
|
388 void CImpsProtocolPresentityGroups::DoUpdatePresentityGroupMemberDisplayNameL( |
|
389 const MXIMPIdentity& aGroupId, |
|
390 const MXIMPIdentity& aMemberId, |
|
391 const TDesC16& aMemberDisplayName, |
|
392 TXIMPRequestId aReqId ) |
|
393 { |
|
394 IMPS_DP_TXT( "Groups::DoUpdatePresentityGroupMemberDisplayNameL() Start" ); |
|
395 |
|
396 CreateDataHandlerL(); |
|
397 |
|
398 iConnMan.ReserveSpaceForOneMoreRequestL(); |
|
399 |
|
400 CUpdatePresentityGroupMemberDisplayNameRequest* req = |
|
401 CUpdatePresentityGroupMemberDisplayNameRequest::NewLC( iConnMan, aReqId ); |
|
402 |
|
403 CleanupStack::Check( req ); |
|
404 |
|
405 req->UpdatePresentityGroupMemberDisplayNameL( aGroupId, aMemberId, aMemberDisplayName ); |
|
406 |
|
407 iConnMan.AddRequest( req ); |
|
408 CleanupStack::Pop( req ); |
|
409 |
|
410 IMPS_DP_TXT( "Groups::DoUpdatePresentityGroupMemberDisplayNameL() End" ); |
|
411 } |
|
412 |
|
413 // --------------------------------------------------------------------------- |
|
414 // CImpsProtocolPresentityGroups::CreateDataHandler() |
|
415 // --------------------------------------------------------------------------- |
|
416 // |
|
417 void CImpsProtocolPresentityGroups::CreateDataHandlerL() |
|
418 { |
|
419 IMPS_DP_TXT( "CImpsProtocolPresentityGroups::CreateDataHandler() Start" ); |
|
420 if ( !( iConnMan.IsDataHandlerCreatedL() ) ) |
|
421 { |
|
422 iConnMan.ManufactureDataHandlerL(); |
|
423 } |
|
424 IMPS_DP_TXT( "CImpsProtocolPresentityGroups::CreateDataHandler() End" ); |
|
425 } |
|
426 |
|
427 // End of file |
|
428 |