|
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: Presence Service Connection presentity presence subscription implementation. |
|
15 * |
|
16 */ |
|
17 |
|
18 #ifndef CPSCPRESENTITYGROUPMEMBERSPRESENCESUBSCRIPTIONITEM_H |
|
19 #define CPSCPRESENTITYGROUPMEMBERSPRESENCESUBSCRIPTIONITEM_H |
|
20 |
|
21 #include <e32base.h> |
|
22 #include "presenceinfoimp.h" |
|
23 #include "ximpsubscriptionitembase.h" |
|
24 #include "groupcontenteventobserver.h" |
|
25 |
|
26 class MXIMPItemParent; |
|
27 class MXIMPPscContext; |
|
28 class CPresenceInfoFilterImp; |
|
29 class MXIMPIdentity; |
|
30 class CXIMPIdentityImp; |
|
31 class CGroupContentSubscriptionItem; |
|
32 |
|
33 |
|
34 /** |
|
35 * PSC group list subscription implementation |
|
36 * |
|
37 * @since S60 v3.2 |
|
38 */ |
|
39 class CPresentityGroupMembersPresenceSubscriptionItem : public CXIMPSubscriptionItemBase, |
|
40 public MGroupContentEventObserver |
|
41 { |
|
42 public: // Construction and destruction |
|
43 |
|
44 /** |
|
45 * Construction |
|
46 * @param aParent. Parent has to be informed when this object is deleted by RemoveMe method. |
|
47 */ |
|
48 static CPresentityGroupMembersPresenceSubscriptionItem* NewLC( MXIMPItemParentBase& aParent, |
|
49 CGroupContentSubscriptionItem& aContentItem ); |
|
50 |
|
51 /** |
|
52 * Destruction |
|
53 * - Remember to inform parent about delete. |
|
54 */ |
|
55 ~CPresentityGroupMembersPresenceSubscriptionItem(); |
|
56 |
|
57 private: // Construction and destruction |
|
58 |
|
59 /** |
|
60 * Construction |
|
61 * @param aParent. Parent has to be informed when this object is deleted by RemoveMe method. |
|
62 */ |
|
63 CPresentityGroupMembersPresenceSubscriptionItem( MXIMPItemParentBase& aParent, |
|
64 CGroupContentSubscriptionItem& aContentItem ); |
|
65 |
|
66 /** |
|
67 * Construction |
|
68 */ |
|
69 void ConstructL(); |
|
70 |
|
71 public: // New methods |
|
72 |
|
73 |
|
74 /** |
|
75 * Current presence information filter. |
|
76 * @return Current presence information filter. |
|
77 */ |
|
78 IMPORT_C CPresenceInfoFilterImp& SubscriptionPif(); |
|
79 |
|
80 /** |
|
81 * Set current presence information filter. Overwrites existing one. |
|
82 * Ownership is transferred to callee. |
|
83 * @param aPif Current presence information filter. |
|
84 */ |
|
85 IMPORT_C void SetSubscriptionPif( CPresenceInfoFilterImp* aPif ); |
|
86 |
|
87 /** |
|
88 * Collect aggregated presence information filter without given context. |
|
89 * @param aContext. Exluded context from aggregated pif. |
|
90 * @return Aggregated pif without exluded context. |
|
91 */ |
|
92 IMPORT_C CPresenceInfoFilterImp* CollectSubscriptionPifWithoutCtxL( |
|
93 MXIMPPscContext* aContext ); |
|
94 |
|
95 /** |
|
96 * Set presence information. Overwrites existing one. |
|
97 * @param aPresenceInfo. New presence information. |
|
98 */ |
|
99 IMPORT_C void SetPresenceInfoL( CPresenceInfoImp* aPresenceInfo ); |
|
100 |
|
101 |
|
102 /** |
|
103 * For ordering items. |
|
104 * @param aA Key item for ordering. |
|
105 * @param aB Item to compare |
|
106 * @return -1 if aB is greater than aA |
|
107 * 0 if they are same |
|
108 * 1 if aA if greater than aB. |
|
109 */ |
|
110 IMPORT_C static TInt Order( const CPresentityGroupMembersPresenceSubscriptionItem& aA, |
|
111 const CPresentityGroupMembersPresenceSubscriptionItem& aB ); |
|
112 |
|
113 /** |
|
114 * For ordering items using identity as key. |
|
115 * @param aA Key identity for ordering. |
|
116 * @param aB Item to compare |
|
117 * @return -1 if aB is greater than aA |
|
118 * 0 if they are same |
|
119 * 1 if aA if greater than aB. |
|
120 */ |
|
121 IMPORT_C static TInt IdentityOrder( const CXIMPIdentityImp* aA, |
|
122 const CPresentityGroupMembersPresenceSubscriptionItem& aB ); |
|
123 |
|
124 /** |
|
125 * Identity of item. |
|
126 * @return Identity of item. |
|
127 */ |
|
128 IMPORT_C const MXIMPIdentity& Identity() const; |
|
129 |
|
130 /** |
|
131 * Set identity for item |
|
132 * @param aIdentity. New identity for item. Ownership is transferred. |
|
133 */ |
|
134 IMPORT_C void SetIdentity( CXIMPIdentityImp* aIdentity ); |
|
135 |
|
136 public: // From MXIMPSubscriptionItem |
|
137 |
|
138 /** |
|
139 * @see MXIMPSubscriptionItem |
|
140 */ |
|
141 void SynthesiseSubscriptionEventToL( MXIMPPscContext* aContext, TBool aForceEvent ); |
|
142 |
|
143 /** |
|
144 * @see MXIMPSubscriptionItem |
|
145 */ |
|
146 void ActivateSubscriberL( MXIMPPscContext* aContext ); |
|
147 |
|
148 private: // From CXIMPSubscriptionItemBase |
|
149 |
|
150 /** |
|
151 * @see CXIMPSubscriptionItemBase |
|
152 */ |
|
153 void CleanExpired(); |
|
154 |
|
155 public: // From CXIMPSubscriptionItemBase |
|
156 |
|
157 /** |
|
158 * @see CXIMPSubscriptionItemBase |
|
159 */ |
|
160 IMPORT_C void AddSubscriberL( MXIMPPscContext* aContext ); |
|
161 |
|
162 /** |
|
163 * @see CXIMPSubscriptionItemBase |
|
164 */ |
|
165 IMPORT_C void RemoveSubscriber( MXIMPPscContext* aContext ); |
|
166 |
|
167 private: // From MGroupContentSubscriptionEventObserver |
|
168 |
|
169 /** |
|
170 * @see MGroupContentSubscriptionEventObserver |
|
171 */ |
|
172 void HandleChangeL( RPrGrpMemInfoImpArray& aAdded, RPrGrpMemInfoImpArray& aRemoved ); |
|
173 |
|
174 /** |
|
175 * @see MGroupContentSubscriptionEventObserver |
|
176 */ |
|
177 void HandleSynthesiseL( RPrGrpMemInfoImpArray& aAdded ); |
|
178 |
|
179 private: // Data |
|
180 |
|
181 /** |
|
182 * Current presence information filter. |
|
183 */ |
|
184 CPresenceInfoFilterImp* iPif; |
|
185 |
|
186 /** |
|
187 * Current presence info for item |
|
188 * Own |
|
189 */ |
|
190 CPresenceInfoImp* iPresenceInfo; |
|
191 |
|
192 /** |
|
193 * Identity of item. |
|
194 * Own |
|
195 */ |
|
196 CXIMPIdentityImp* iIdentity; |
|
197 |
|
198 /** |
|
199 * Owns reference to content item. Use close for delete. |
|
200 */ |
|
201 CGroupContentSubscriptionItem& iContentItem; |
|
202 }; |
|
203 |
|
204 |
|
205 /* ======================================================================== */ |
|
206 |
|
207 |
|
208 |
|
209 #endif // CPSCPRESENTITYGROUPMEMBERSPRESENCESUBSCRIPTIONITEM_H |