|
1 /* |
|
2 * Copyright (c) 2003-2005 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: Handles incoming invitations |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef CCAINVITEMANAGER_H |
|
20 #define CCAINVITEMANAGER_H |
|
21 |
|
22 // INCLUDES |
|
23 #include "MCAInvite.h" |
|
24 #include "MCAImpsFundClient.h" |
|
25 #include "MCAInviteTrackerCallback.h" |
|
26 |
|
27 // FORWARD DECLARATIONS |
|
28 class MCAInviteObserver; |
|
29 class CCAInvitationRequest; |
|
30 class MCASettings; |
|
31 class CCARequestMapper; |
|
32 class CCAInviteTracker; |
|
33 class MCAStoredGroup; |
|
34 class MCAGroupManagerInterface; |
|
35 class MCAImpsFactory; |
|
36 |
|
37 // CLASS DECLARATION |
|
38 |
|
39 /** |
|
40 * For invite-handling. |
|
41 * |
|
42 * |
|
43 * @lib CAEngine.lib |
|
44 * @since 1.2 |
|
45 */ |
|
46 class CCAInviteManager : public CBase, |
|
47 public MImpsInviteHandler2, |
|
48 public MCAInvite, |
|
49 public MCAInviteTrackerCallback, |
|
50 public MCAInviteReadObserver |
|
51 { |
|
52 public: // Constructors and destructor |
|
53 |
|
54 /** |
|
55 * Two-phased constructor. |
|
56 * @param aImpsFundAPI is the API to the invite services. |
|
57 * @param aSettingsAPI is the AI to the settings side. |
|
58 * @param aRequestMapper is the API to the request mapper. |
|
59 * Used to provide synchronous waiting. |
|
60 * @param aGroupManager is the API to the group manager. |
|
61 */ |
|
62 static CCAInviteManager* NewL( |
|
63 MCAImpsFactory* aIMPSFactory, |
|
64 MCASettings& aSettingsAPI, |
|
65 CCARequestMapper& aRequestMapper, |
|
66 MCAGroupManagerInterface& aGroupManager ); |
|
67 |
|
68 /** |
|
69 * Destructor. |
|
70 */ |
|
71 virtual ~CCAInviteManager(); |
|
72 |
|
73 public: // From MCAInviteTrackerCallback |
|
74 |
|
75 /** |
|
76 * From MCAInviteTrackerCallBack |
|
77 * @see MCAInviteTrackerCallBack::InviteExpired |
|
78 */ |
|
79 void InviteExpiredL( const MCAInvitation* aInvitation ); |
|
80 |
|
81 public: // From MCAInvite |
|
82 |
|
83 /** |
|
84 * From MCAInvite. |
|
85 * @see MCAInvite::AddInviteObserver. |
|
86 */ |
|
87 TInt AddInviteObserver( MCAInviteObserver* aObserver ); |
|
88 |
|
89 /** |
|
90 * From MCAInvite. |
|
91 * @see MCAInvite::RemoveInviteObserver. |
|
92 */ |
|
93 void RemoveInviteObserver( MCAInviteObserver* aObserver ); |
|
94 |
|
95 /** |
|
96 * From MCAInvite. |
|
97 * @see MCAInvite::SendInvitationL. |
|
98 */ |
|
99 void SendInvitationL( const CCAInvitationRequest& aInvitation ); |
|
100 |
|
101 /** |
|
102 * From MCAInvite |
|
103 * @see MCAInvite::PopulateInviteList. |
|
104 */ |
|
105 void PopulateInviteList( RPointerArray<MCAInvitation>& aList ); |
|
106 |
|
107 /** |
|
108 * From MCAInvite |
|
109 * @see MCAInvite::ActiveInvitations. |
|
110 */ |
|
111 TInt ActiveInvitations(); |
|
112 |
|
113 /** |
|
114 * From MCAInvite |
|
115 * @see MCAInvite::RemoveInvitation |
|
116 */ |
|
117 void RemoveInvitationL( MCAInvitation* aInvitation ); |
|
118 |
|
119 /** |
|
120 * From MCAInvite |
|
121 * @see MCAInvite::RejectReasonPtr |
|
122 */ |
|
123 HBufC* RejectReasonPtr(); |
|
124 |
|
125 /** |
|
126 * @see MCAInvite |
|
127 */ |
|
128 TInt UnreadInvitesCount() const; |
|
129 |
|
130 /** |
|
131 * @see MCAInvite |
|
132 */ |
|
133 void ReplyInvitationL( const MCAInvitation* aInvitation, |
|
134 const TBool aInviteAccepted, |
|
135 const TDesC& aResponse, |
|
136 const TDesC& aScreenName ); |
|
137 |
|
138 |
|
139 private: // From MImpsInviteHandler |
|
140 |
|
141 /** |
|
142 * @see MImpsInviteHandler::GroupInviteUserRequest. |
|
143 */ |
|
144 void HandleGroupInviteL( const TDesC& aInviteID, |
|
145 const TDesC& aUserID, |
|
146 const TDesC& aScreenName, |
|
147 const TDesC& aGroupName, |
|
148 const TDesC& aInviteReason, |
|
149 const TInt aValidityPeriod, |
|
150 TImpsCspIdentifier& aCspId ); |
|
151 |
|
152 /** |
|
153 * @see MImpsInviteHandler::GroupInviteUserRequest. |
|
154 */ |
|
155 void HandleImInviteL( const TDesC& aInviteID, |
|
156 const TDesC& aUserID, |
|
157 const TDesC& aInviteReason, |
|
158 const TInt aValidityPeriod, |
|
159 TImpsCspIdentifier& aCspId ); |
|
160 |
|
161 /** |
|
162 * @see MImpsInviteHandler::GroupInviteUserRequest. |
|
163 */ |
|
164 void HandleContentInviteL( const TDesC& aInviteID, |
|
165 const TDesC& aUserID, |
|
166 MDesCArray* aUrlList, |
|
167 const TDesC& aInviteReason, |
|
168 const TInt aValidityPeriod, |
|
169 TImpsCspIdentifier& aCspId ); |
|
170 |
|
171 /** |
|
172 * @see MImpsInviteHandler::GroupInviteUserRequest. |
|
173 */ |
|
174 void HandleInviteResponseL( const TDesC& aInviteID, |
|
175 const TBool aAcceptance, |
|
176 const TDesC& aUserID, |
|
177 const TDesC& aScreenName, |
|
178 const TDesC& aGroupName, |
|
179 const TDesC& aResponse, |
|
180 TImpsCspIdentifier& aCspId ); |
|
181 |
|
182 /** |
|
183 * @see MImpsInviteHandler::GroupInviteUserRequest. |
|
184 */ |
|
185 void HandleInviteCancelL( const TDesC& aInviteID, |
|
186 const TDesC& aUserID, |
|
187 const TDesC& aScreenName, |
|
188 const TDesC& aGroupName, |
|
189 const TDesC& aResponse, |
|
190 TImpsCspIdentifier& aCspId ); |
|
191 |
|
192 /** |
|
193 * @see MImpsInviteHandler::GroupInviteUserRequest. |
|
194 */ |
|
195 void HandleCompleteL( TInt aOperationId, |
|
196 TImpsCspIdentifier& aCspId ); |
|
197 |
|
198 private: |
|
199 |
|
200 /** |
|
201 * @see MCAInviteReadObserver |
|
202 */ |
|
203 void HandleInviteReadL() const; |
|
204 |
|
205 private: |
|
206 |
|
207 /** |
|
208 * By default Symbian OS constructor is private. |
|
209 */ |
|
210 void ConstructL(); |
|
211 |
|
212 /** |
|
213 * C++ default constructor. |
|
214 * @see CCAInviteManager::NewL. |
|
215 */ |
|
216 CCAInviteManager( |
|
217 MCAImpsFactory* aIMPSFactory, |
|
218 MCASettings& aSettingsAPI, |
|
219 CCARequestMapper& aRequestMapper, |
|
220 MCAGroupManagerInterface& aGroupManager ); |
|
221 |
|
222 /** |
|
223 * Prepares target group for wanted invitee. |
|
224 * @since 1.2 |
|
225 * @param aInvitation Invitation |
|
226 */ |
|
227 void PrepareGroupForInviteeL( const CCAInvitationRequest& aInvitation ); |
|
228 |
|
229 /** |
|
230 * Removes invite from invite queue. |
|
231 * @param aInviteId Invite to be removed |
|
232 * @return ETrue if invite was found from queue |
|
233 */ |
|
234 TBool RemoveInviteL( const MCAInvitation* aInvitation ); |
|
235 |
|
236 /** |
|
237 * Finds the invite from invite queue |
|
238 * @param aInviteId Invite to be searched |
|
239 * @return CCAInvitation if found, NULL otherwise |
|
240 */ |
|
241 MCAInvitation* FindInvite( const TDesC& aInviteId ); |
|
242 |
|
243 /** |
|
244 * Creates a CCAInvitation. |
|
245 * @param aInviteID invitation id |
|
246 * @param aUserId WV ID |
|
247 * @param aScreenName screen name |
|
248 * @param aGroupId group id |
|
249 * @param aInviteReason invite reason |
|
250 * @param aValidityPeriod validity period |
|
251 * @return created CCAInvitation. |
|
252 * The ownership is transferred to caller. |
|
253 */ |
|
254 MCAInvitation* CreateInviteRequestL( const TDesC& aInviteID, |
|
255 const TDesC& aUserID, |
|
256 const TDesC& aScreenName, |
|
257 const TDesC& aGroupID, |
|
258 const TDesC& aInviteReason, |
|
259 const TInt aValidityPeriod ); |
|
260 |
|
261 private: // Data |
|
262 |
|
263 // Number that is used to generate unique ids |
|
264 TInt iInviteIDOrdinal; |
|
265 |
|
266 // Doesn't own. Pointers to observers |
|
267 RPointerArray<MCAInviteObserver> iInviteObservers; |
|
268 |
|
269 // Doesn't own. Pointer to engine's request mapper |
|
270 CCARequestMapper* iRequestMapper; |
|
271 |
|
272 // Reference to settings API |
|
273 MCASettings& iSettingsAPI; |
|
274 |
|
275 // not owned |
|
276 MCAImpsFactory* iImpsFactory; |
|
277 |
|
278 // Doesn't own. Pointer to wvengine's fundamental API |
|
279 MCAImpsFundClient* iImpsFundAPI; |
|
280 |
|
281 // The operation id of current operation |
|
282 TInt iCurrentOpId; |
|
283 |
|
284 // Doesn't own. |
|
285 const CCAInvitationRequest* iCurrentInviteRequest; |
|
286 |
|
287 // Owns. Last generated invite ID |
|
288 HBufC* iLastInviteId; |
|
289 |
|
290 // Owns. |
|
291 RPointerArray<CCAInviteTracker> iInviteTrackerQueue; |
|
292 |
|
293 // Owns |
|
294 HBufC* iRejectReason; |
|
295 |
|
296 // group manager inerface, not owned |
|
297 MCAGroupManagerInterface* iGroupManager; |
|
298 }; |
|
299 |
|
300 #endif // CCAINVITEMANAGER_H |
|
301 |
|
302 // End of File |