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: IETF SIMPLE Protocol implementation for XIMP Framework |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef CPRESENCEPLUGINGROUP_H |
|
20 #define CPRESENCEPLUGINGROUP_H |
|
21 |
|
22 #include <e32base.h> |
|
23 #include <ximpbase.h> |
|
24 #include <protocolpresentitygroups.h> |
|
25 |
|
26 #include "presenceplugincommon.h" |
|
27 #include "mpresencepluginconnectionobs.h" |
|
28 #include "presencelogger.h" |
|
29 |
|
30 class TXIMPRequestId; |
|
31 class MXIMPIdentity; |
|
32 class MXIMPProtocolPresentityGroupsDataHost; |
|
33 class MXIMPObjectCollection; |
|
34 class CPresencePluginVirtualGroup; |
|
35 class CPresencePluginData; |
|
36 |
|
37 /** |
|
38 * CPresencePluginGroups |
|
39 * |
|
40 * Simple Engine Connection |
|
41 * |
|
42 * @lib presenceplugin.dll |
|
43 * @since S60 v3.2 |
|
44 */ |
|
45 NONSHARABLE_CLASS( CPresencePluginGroups ) : public CActive, |
|
46 public MProtocolPresentityGroups |
|
47 { |
|
48 public: |
|
49 |
|
50 /** |
|
51 * Current operation |
|
52 */ |
|
53 enum TPluginGroupsOperation |
|
54 { |
|
55 ENoOperation, |
|
56 ECreatePresentityGroup, |
|
57 EDeletePresentityGroup, |
|
58 EAddPresentityGroupMember, |
|
59 EGrantPresentityGroupMember, |
|
60 ERemovePresentityGroupMember, |
|
61 EWithdrawGrantFromMember, |
|
62 EGetListOfLists, |
|
63 EGetListContent, |
|
64 EBlockPresentityGroupMember, |
|
65 EUnblockPresentityGroupMember |
|
66 }; |
|
67 |
|
68 /** |
|
69 * Current actibe object state |
|
70 */ |
|
71 enum TPluginGroupsState |
|
72 { |
|
73 EPluginIdle, |
|
74 EPluginInitXdm, |
|
75 EPluginFetchRls, |
|
76 EPluginAddGroupMember, |
|
77 EPluginRemoveGroupMember, |
|
78 EPluginCommitRls, |
|
79 EPluginCommitXdm |
|
80 }; |
|
81 |
|
82 /** |
|
83 * Constructor. |
|
84 * @param aObs callback for complete requests |
|
85 * @param aConn Simple Engine connection |
|
86 */ |
|
87 static CPresencePluginGroups* NewL( |
|
88 MPresencePluginConnectionObs& aObs, |
|
89 CPresencePluginVirtualGroup* aSubscribedBuddies, |
|
90 CPresencePluginData* aPresenceData ); |
|
91 |
|
92 /** |
|
93 * Constructor. |
|
94 * @param aObs callback for complete requests |
|
95 * @param aConn Simple Engine connection |
|
96 */ |
|
97 static CPresencePluginGroups* NewLC( |
|
98 MPresencePluginConnectionObs& aObs, |
|
99 CPresencePluginVirtualGroup* aSubscribedBuddies, |
|
100 CPresencePluginData* aPresenceData ); |
|
101 |
|
102 /** |
|
103 * Standard C++ destructor |
|
104 */ |
|
105 virtual ~CPresencePluginGroups(); |
|
106 |
|
107 private: |
|
108 |
|
109 /** |
|
110 * Standard C++ constructor |
|
111 */ |
|
112 CPresencePluginGroups( |
|
113 MPresencePluginConnectionObs& aObs, |
|
114 CPresencePluginVirtualGroup* aSubscribedBuddies, |
|
115 CPresencePluginData* aPresenceData ); |
|
116 |
|
117 public: // from base class MXIMPBase |
|
118 |
|
119 /** |
|
120 * Defined in a base class |
|
121 */ |
|
122 TAny* GetInterface( |
|
123 TInt32 aInterfaceId, |
|
124 TIfGetOps aOps ); |
|
125 |
|
126 /** |
|
127 * Defined in a base class |
|
128 */ |
|
129 const TAny* GetInterface( |
|
130 TInt32 aInterfaceId, |
|
131 TIfGetOps aOps ) const; |
|
132 |
|
133 /** |
|
134 * Defined in a base class |
|
135 */ |
|
136 TInt32 GetInterfaceId() const; |
|
137 |
|
138 |
|
139 public: // from base class MXIMPProtocolPresentityGroups |
|
140 |
|
141 /** |
|
142 * Defined in a base class |
|
143 */ |
|
144 void DoSubscribePresentityGroupListL( |
|
145 TXIMPRequestId aReqId ); |
|
146 |
|
147 /** |
|
148 * Defined in a base class |
|
149 */ |
|
150 void DoUnsubscribePresentityGroupListL( |
|
151 TXIMPRequestId aReqId ); |
|
152 |
|
153 /** |
|
154 * Defined in a base class |
|
155 */ |
|
156 void DoCreatePresentityGroupL( |
|
157 const MXIMPIdentity& aGroupId, |
|
158 const TDesC16& aDisplayName, |
|
159 TXIMPRequestId aReqId ); |
|
160 |
|
161 /** |
|
162 * Defined in a base class |
|
163 */ |
|
164 void DoDeletePresentityGroupL( |
|
165 const MXIMPIdentity& aGroupId, |
|
166 TXIMPRequestId aReqId ); |
|
167 |
|
168 /** |
|
169 * Defined in a base class |
|
170 */ |
|
171 void DoUpdatePresentityGroupDisplayNameL( |
|
172 const MXIMPIdentity& aGroupId, |
|
173 const TDesC16& aDisplayName, |
|
174 TXIMPRequestId aReqId ); |
|
175 |
|
176 /** |
|
177 * Defined in a base class |
|
178 */ |
|
179 void DoSubscribePresentityGroupContentL( |
|
180 const MXIMPIdentity& aGroupId, |
|
181 TXIMPRequestId aReqId ); |
|
182 |
|
183 /** |
|
184 * Defined in a base class |
|
185 */ |
|
186 void DoUnsubscribePresentityGroupContentL( |
|
187 const MXIMPIdentity& aGroupId, |
|
188 TXIMPRequestId aReqId ); |
|
189 |
|
190 /** |
|
191 * Defined in a base class |
|
192 */ |
|
193 void DoAddPresentityGroupMemberL( |
|
194 const MXIMPIdentity& aGroupId, |
|
195 const MXIMPIdentity& aMemberId, |
|
196 const TDesC16& aMemberDisplayName, |
|
197 TXIMPRequestId aReqId ); |
|
198 |
|
199 /** |
|
200 * Defined in a base class |
|
201 */ |
|
202 void DoRemovePresentityGroupMemberL( |
|
203 const MXIMPIdentity& aGroupId, |
|
204 const MXIMPIdentity& aMemberId, |
|
205 TXIMPRequestId aReqId ); |
|
206 |
|
207 /** |
|
208 * Defined in a base class |
|
209 */ |
|
210 void DoUpdatePresentityGroupMemberDisplayNameL( |
|
211 const MXIMPIdentity& aGroupId, |
|
212 const MXIMPIdentity& aMemberId, |
|
213 const TDesC16& aMemberDisplayName, |
|
214 TXIMPRequestId aReqId ); |
|
215 |
|
216 protected: // from base class CActive |
|
217 |
|
218 /** |
|
219 * Defined in a base class |
|
220 */ |
|
221 void RunL(); |
|
222 |
|
223 /** |
|
224 * Defined in a base class |
|
225 */ |
|
226 TInt RunError( TInt aError ); |
|
227 |
|
228 /** |
|
229 * Defined in a base class |
|
230 */ |
|
231 void DoCancel(); |
|
232 |
|
233 private: |
|
234 |
|
235 /** |
|
236 * Save presentity id |
|
237 * |
|
238 * @since S60 3.2 |
|
239 * @param aPresentityId presentity id |
|
240 * @param aFormatUri, attempt to format uri |
|
241 * @return none |
|
242 */ |
|
243 void SetPresIdentityL( |
|
244 const MXIMPIdentity& aPresentityId, |
|
245 TBool aFormatUri ); |
|
246 |
|
247 /** |
|
248 * Calls MXIMPProtocolConnectionHost callback |
|
249 * |
|
250 * @since S60 3.2 |
|
251 * @param aStatus error status |
|
252 * @return none |
|
253 */ |
|
254 void CompleteXIMPReq( TInt aStatus ); |
|
255 |
|
256 /** |
|
257 * Start XDM operation |
|
258 * |
|
259 * @since S60 3.2 |
|
260 * @param aReqId, request id |
|
261 * @param aOperation, groups operation |
|
262 * @return none |
|
263 */ |
|
264 void StartXdmOperationL( |
|
265 TXIMPRequestId aReqId, |
|
266 TPluginGroupsOperation aOperation ); |
|
267 |
|
268 /** |
|
269 * Start XDM operation |
|
270 * |
|
271 * @since S60 3.2 |
|
272 * @param aReqId, request id |
|
273 * @param aOperation, groups operation |
|
274 * @return none |
|
275 */ |
|
276 void StartXdmOperationL( |
|
277 const MXIMPIdentity& aId, |
|
278 TXIMPRequestId aReqId, |
|
279 TPluginGroupsOperation aOperation ); |
|
280 |
|
281 /** |
|
282 * Start XDM operation |
|
283 * |
|
284 * @since S60 3.2 |
|
285 * @param none |
|
286 * @return none |
|
287 */ |
|
288 void StartXdmOperationL(); |
|
289 |
|
290 /** |
|
291 * Call actual XDM operation |
|
292 * |
|
293 * @since S60 3.2 |
|
294 * @param aCompleteStatus, success or not |
|
295 * @return none |
|
296 */ |
|
297 void CallActualXdmOperationL( TInt aCompleteStatus ); |
|
298 |
|
299 /** |
|
300 * Get List of lists |
|
301 * |
|
302 * @since S60 3.2 |
|
303 * @param none |
|
304 * @return none |
|
305 */ |
|
306 void GetListOfListsL(); |
|
307 |
|
308 /** |
|
309 * Get List content |
|
310 * |
|
311 * @since S60 3.2 |
|
312 * @param none |
|
313 * @return none |
|
314 */ |
|
315 void GetListContentL(); |
|
316 |
|
317 /** |
|
318 * Do Get BuddyList form XDM list |
|
319 * |
|
320 * @since S60 3.2 |
|
321 * @param none |
|
322 * @return none |
|
323 */ |
|
324 void DoGetBuddyListL(); |
|
325 |
|
326 /** |
|
327 * Do Get subscribed BuddyList form virtual list |
|
328 * |
|
329 * @since S60 3.2 |
|
330 * @param none |
|
331 * @return none |
|
332 */ |
|
333 void DoGetSubscribedBuddyListL(); |
|
334 |
|
335 /** |
|
336 * Removes cache entries for certain person. |
|
337 * |
|
338 * @since S60 5.0 |
|
339 * @param none |
|
340 * @return none |
|
341 */ |
|
342 void DeletePersonCacheL(); |
|
343 |
|
344 private: // Data |
|
345 |
|
346 /** |
|
347 * XIMP Plugin connection observer |
|
348 * Own. |
|
349 */ |
|
350 MPresencePluginConnectionObs& iConnObs; |
|
351 |
|
352 /** |
|
353 * XDM Settings id |
|
354 * Own. |
|
355 */ |
|
356 TInt iSettingsId; |
|
357 |
|
358 /** |
|
359 * PrFW request id |
|
360 * Own. |
|
361 */ |
|
362 TXIMPRequestId iXIMPId; |
|
363 |
|
364 /** |
|
365 * PrFW request id for own requests |
|
366 * Own. |
|
367 */ |
|
368 TXIMPRequestId iXIMPIdOwn; |
|
369 |
|
370 /** |
|
371 * Simple Engine request id |
|
372 * Own. |
|
373 */ |
|
374 TInt iSimpleId; |
|
375 |
|
376 /** |
|
377 * Current operation |
|
378 * Own. |
|
379 */ |
|
380 TPluginGroupsOperation iOperation; |
|
381 |
|
382 /** |
|
383 * Current presentity in progress |
|
384 * Own. |
|
385 */ |
|
386 HBufC16* iPresIdentity; |
|
387 |
|
388 /** |
|
389 * XDM Utils |
|
390 * Not own. |
|
391 */ |
|
392 CPresencePluginXdmUtils* iXdmUtils; |
|
393 |
|
394 /** |
|
395 * Display name |
|
396 * Own |
|
397 */ |
|
398 HBufC* iDisplayName; |
|
399 |
|
400 /** |
|
401 * Active object state |
|
402 * Own. |
|
403 */ |
|
404 TPluginGroupsState iState; |
|
405 |
|
406 /** |
|
407 * Group request complete |
|
408 * Own. |
|
409 */ |
|
410 TBool iCompleted; |
|
411 |
|
412 /** |
|
413 * Virtual groups |
|
414 * Not Own |
|
415 */ |
|
416 CPresencePluginVirtualGroup* iSubscribedBuddies; |
|
417 |
|
418 /** |
|
419 * Plugin data. |
|
420 * Not Own |
|
421 */ |
|
422 CPresencePluginData* iPresenceData; |
|
423 |
|
424 SIMPLE_UNIT_TEST( T_CPresencePluginGroups ) |
|
425 }; |
|
426 |
|
427 #endif // CPRESENCEPLUGINGROUP_H |
|