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