|
1 /* |
|
2 * Copyright (c) 2009 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: |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 // INCLUDE FILES |
|
20 |
|
21 // SYSTEM INCLUDES |
|
22 #include <ccsconversationentry.h> |
|
23 #include <ccsclientconversation.h> |
|
24 #include <mcsresultsobserver.h> |
|
25 #include <mcsconversationlistchangeobserver.h> |
|
26 #include <mcsconversationchangeobserver.h> |
|
27 #include <mcscachingstatusobserver.h> |
|
28 #include <ccsrequesthandler.h> |
|
29 #include <rcssession.h> |
|
30 |
|
31 |
|
32 //USER INCLUDES |
|
33 |
|
34 #include "ccsconversationchangeobserver.h" |
|
35 #include "testconversationenginestub.h" |
|
36 |
|
37 // ========================= MEMBER FUNCTIONS ================================== |
|
38 |
|
39 // ----------------------------------------------------------------------------- |
|
40 // CCSRequestHandler::NewL() |
|
41 // Two-phased constructor. |
|
42 // ----------------------------------------------------------------------------- |
|
43 EXPORT_C CCSRequestHandler* CCSRequestHandler::NewL() |
|
44 { |
|
45 |
|
46 CCSRequestHandler* self = NewLC( ); |
|
47 CleanupStack::Pop( self ); |
|
48 |
|
49 return( self ) ; |
|
50 } |
|
51 |
|
52 // ----------------------------------------------------------------------------- |
|
53 // CCSRequestHandler::NewLC() |
|
54 // Two-phased constructor. |
|
55 // ----------------------------------------------------------------------------- |
|
56 EXPORT_C CCSRequestHandler* CCSRequestHandler::NewLC() |
|
57 { |
|
58 |
|
59 CCSRequestHandler* self = new ( ELeave ) CCSRequestHandler(); |
|
60 CleanupStack::PushL( self ); |
|
61 self->ConstructL(); |
|
62 |
|
63 return self; |
|
64 } |
|
65 |
|
66 // ----------------------------------------------------------------------------- |
|
67 // CCSRequestHandler::CCSAsyncRequestHandler() |
|
68 // C++ default constructor can NOT contain any code, that might leave. |
|
69 // ----------------------------------------------------------------------------- |
|
70 CCSRequestHandler::CCSRequestHandler() |
|
71 : CActive( EPriorityStandard ) |
|
72 { |
|
73 |
|
74 } |
|
75 |
|
76 // ----------------------------------------------------------------------------- |
|
77 // CCSRequestHandler::ConstructL() |
|
78 // Symbian 2nd phase constructor can leave. |
|
79 // ----------------------------------------------------------------------------- |
|
80 void CCSRequestHandler::ConstructL() |
|
81 { |
|
82 TestConversationEngineStub::Instance(); |
|
83 |
|
84 // Observers |
|
85 iResultsObserver = NULL; |
|
86 iCachingStatusObserver = NULL; |
|
87 iConversationListChangeObserver = NULL; |
|
88 iConversationChangeObserver = NULL; |
|
89 |
|
90 } |
|
91 |
|
92 |
|
93 // ----------------------------------------------------------------------------- |
|
94 // CCSRequestHandler::~CCSRequestHandler() |
|
95 // Destructor. |
|
96 // ----------------------------------------------------------------------------- |
|
97 CCSRequestHandler::~CCSRequestHandler() |
|
98 { |
|
99 |
|
100 Cancel(); |
|
101 |
|
102 // Cleanup |
|
103 if ( iBuffer ) |
|
104 { |
|
105 delete iBuffer; |
|
106 iBuffer = NULL; |
|
107 } |
|
108 |
|
109 if ( iResultsBuffer ) |
|
110 { |
|
111 delete iResultsBuffer; |
|
112 iResultsBuffer = NULL; |
|
113 } |
|
114 |
|
115 if ( iNotificationHandler ) |
|
116 { |
|
117 //delete iNotificationHandler; |
|
118 iNotificationHandler = NULL; |
|
119 } |
|
120 |
|
121 if( iListResultsBuffer ) |
|
122 { |
|
123 delete iListResultsBuffer; |
|
124 iListResultsBuffer=NULL; |
|
125 } |
|
126 if( iConvResultsBuffer ) |
|
127 { |
|
128 delete iConvResultsBuffer; |
|
129 iConvResultsBuffer=NULL; |
|
130 } |
|
131 |
|
132 } |
|
133 |
|
134 // ----------------------------------------------------------------------------- |
|
135 // CCSRequestHandler::HandleGetConversationListResults() |
|
136 // This shall handle all entry list result from server |
|
137 // |
|
138 // ----------------------------------------------------------------------------- |
|
139 void CCSRequestHandler::HandleGetConversationListResults() |
|
140 { |
|
141 } |
|
142 |
|
143 // ----------------------------------------------------------------------------- |
|
144 // CCSRequestHandler::HandleGetConversationResults() |
|
145 // This shall handle GetCoversation results async from server |
|
146 // |
|
147 // ----------------------------------------------------------------------------- |
|
148 void CCSRequestHandler::HandleGetConversationResults() |
|
149 { |
|
150 } |
|
151 |
|
152 // ----------------------------------------------------------------------------- |
|
153 // CCSRequestHandler::HandleGetEntryListOverflow() |
|
154 // Handle the buffer overflow error for get entry list results |
|
155 // ----------------------------------------------------------------------------- |
|
156 void CCSRequestHandler::HandleGetConversationListOverflow() |
|
157 { |
|
158 } |
|
159 |
|
160 // ----------------------------------------------------------------------------- |
|
161 // CCSRequestHandler::HandleGetConversationOverflow() |
|
162 // Handle the buffer overflow error for get conversation results |
|
163 // ----------------------------------------------------------------------------- |
|
164 void CCSRequestHandler::HandleGetConversationOverflow() |
|
165 { |
|
166 } |
|
167 |
|
168 // ----------------------------------------------------------------------------- |
|
169 // CCSRequestHandler::RequestResultsEventL() |
|
170 // Add conversation result Observer |
|
171 // ----------------------------------------------------------------------------- |
|
172 EXPORT_C void CCSRequestHandler::RequestResultsEventL( |
|
173 MCsResultsObserver* aObserver) |
|
174 { |
|
175 iResultsObserver = aObserver; |
|
176 TestConversationEngineStub::Instance()->SetResultObserver(aObserver); |
|
177 } |
|
178 |
|
179 // ----------------------------------------------------------------------------- |
|
180 // CCSRequestHandler::RemoveResultsEventL() |
|
181 // Remove conversation result observer |
|
182 // ----------------------------------------------------------------------------- |
|
183 EXPORT_C void CCSRequestHandler::RemoveResultsEventL |
|
184 (MCsResultsObserver* /*aObserver*/) |
|
185 { |
|
186 iResultsObserver = NULL; |
|
187 TestConversationEngineStub::Instance()->RemoveResultObserver(); |
|
188 } |
|
189 |
|
190 // ----------------------------------------------------------------------------- |
|
191 // CCSRequestHandler::RequestConversationListChangeEventL() |
|
192 // Add conversation list change event Observer |
|
193 // ----------------------------------------------------------------------------- |
|
194 EXPORT_C void CCSRequestHandler::RequestConversationListChangeEventL( |
|
195 MCsConversationListChangeObserver* aObserver) |
|
196 { |
|
197 iConversationListChangeObserver = aObserver; |
|
198 TestConversationEngineStub::Instance()->SetConversationListChangeObserver(aObserver); |
|
199 } |
|
200 |
|
201 // ----------------------------------------------------------------------------- |
|
202 // CCSRequestHandler::RemoveConversationListChangeEventL() |
|
203 // Remove conversation list change event Observer |
|
204 // ----------------------------------------------------------------------------- |
|
205 EXPORT_C void CCSRequestHandler::RemoveConversationListChangeEventL( |
|
206 MCsConversationListChangeObserver* /*aObserver*/) |
|
207 { |
|
208 iConversationListChangeObserver = NULL; |
|
209 TestConversationEngineStub::Instance()->RemoveConversationListChangeObserver(); |
|
210 } |
|
211 |
|
212 // ----------------------------------------------------------------------------- |
|
213 // CCSRequestHandler::RequestConversationChangeEventL() |
|
214 // Add conversation change event Observer |
|
215 // ----------------------------------------------------------------------------- |
|
216 EXPORT_C void CCSRequestHandler::RequestConversationChangeEventL( |
|
217 MCsConversationChangeObserver* aObserver, |
|
218 CCsClientConversation* aClientConversation) |
|
219 { |
|
220 TestConversationEngineStub::Instance()->SetConversationChangeObserver(aObserver, aClientConversation); |
|
221 } |
|
222 |
|
223 // ----------------------------------------------------------------------------- |
|
224 // CCSRequestHandler::RemoveConversationChangeEventL() |
|
225 // Remove conversation change event observer |
|
226 // ----------------------------------------------------------------------------- |
|
227 EXPORT_C void CCSRequestHandler::RemoveConversationChangeEventL( |
|
228 MCsConversationChangeObserver* /*aObserver*/, |
|
229 CCsClientConversation* /*aClientConversation*/) |
|
230 { |
|
231 |
|
232 if ( iConversationChangeObserver ) |
|
233 { |
|
234 TestConversationEngineStub::Instance()->RemoveConversationChangeObserver(); |
|
235 delete iConversationChangeObserver; |
|
236 iConversationChangeObserver = NULL; |
|
237 } |
|
238 } |
|
239 |
|
240 // ----------------------------------------------------------------------------- |
|
241 // CCSRequestHandler::RequestCachingStatusEventL() |
|
242 // Add caching status Observer |
|
243 // ----------------------------------------------------------------------------- |
|
244 EXPORT_C void CCSRequestHandler::RequestCachingStatusEventL( |
|
245 MCsCachingStatusObserver* /*aObserver*/) |
|
246 { |
|
247 User::Leave(KErrNotSupported); |
|
248 } |
|
249 |
|
250 // ----------------------------------------------------------------------------- |
|
251 // CCSRequestHandler::RemoveCachingStatusEventL() |
|
252 // Remove caching status Observer |
|
253 // ----------------------------------------------------------------------------- |
|
254 EXPORT_C void CCSRequestHandler::RemoveCachingStatusEventL( |
|
255 MCsCachingStatusObserver* /*aObserver*/) |
|
256 { |
|
257 User::Leave(KErrNotSupported); |
|
258 } |
|
259 |
|
260 // ----------------------------------------------------------------------------- |
|
261 // CCSRequestHandler::RunL() |
|
262 // Invoked to handle responses from the server. |
|
263 // ----------------------------------------------------------------------------- |
|
264 void CCSRequestHandler::RunL() |
|
265 { |
|
266 } |
|
267 |
|
268 // ----------------------------------------------------------------------------- |
|
269 // CCSRequestHandler::HandleErrorL() |
|
270 // Send the error code to the client. |
|
271 // ----------------------------------------------------------------------------- |
|
272 void CCSRequestHandler::HandleErrorL(TInt /*aErrorCode*/) |
|
273 { |
|
274 // Not supported |
|
275 } |
|
276 |
|
277 // ----------------------------------------------------------------------------- |
|
278 // CCSRequestHandler::DoCancel() |
|
279 // Cancels any outstanding operation. |
|
280 // ----------------------------------------------------------------------------- |
|
281 void CCSRequestHandler::DoCancel() |
|
282 { |
|
283 // Do nothing |
|
284 } |
|
285 |
|
286 // ----------------------------------------------------------------------------- |
|
287 // CCSRequestHandler::Version() |
|
288 // Recovers the conversation server version. |
|
289 // ----------------------------------------------------------------------------- |
|
290 EXPORT_C TVersion CCSRequestHandler::Version() const |
|
291 { |
|
292 TVersion ver(1, 2, 3); |
|
293 return (ver); |
|
294 } |
|
295 |
|
296 // ----------------------------------------------------------------------------- |
|
297 // CCSRequestHandler::ShutdownServerL() |
|
298 // Shuts down the conversation server. |
|
299 // ----------------------------------------------------------------------------- |
|
300 EXPORT_C void CCSRequestHandler::ShutdownServerL() |
|
301 { |
|
302 //Do nothing |
|
303 return; |
|
304 } |
|
305 |
|
306 // ----------------------------------------------------------------------------- |
|
307 // CCSRequestHandler::GetConversationListL() |
|
308 // Get Recent Conversation Entry list with display name |
|
309 // for all stored conversation entry IDs. |
|
310 // This API can be used to prepare conversation list view. |
|
311 // ----------------------------------------------------------------------------- |
|
312 EXPORT_C void CCSRequestHandler::GetConversationListL() |
|
313 { |
|
314 } |
|
315 |
|
316 // ----------------------------------------------------------------------------- |
|
317 // CCSRequestHandler::GetConversationUnreadListL() |
|
318 // Get Recent unread Conversation Entry list with display name |
|
319 // for all stored conversation entry IDs. |
|
320 // This API can be used to prepare conversation list view. |
|
321 // ----------------------------------------------------------------------------- |
|
322 EXPORT_C void CCSRequestHandler::GetConversationUnreadListL(RPointerArray< |
|
323 CCsClientConversation>* /*aClientConversationList*/) |
|
324 { |
|
325 } |
|
326 |
|
327 // ----------------------------------------------------------------------------- |
|
328 // CCSRequestHandler::GetConversationsL() |
|
329 // Get Conversation Entry list for given Conversation Entry ID to prepare |
|
330 // convresation view. |
|
331 // ----------------------------------------------------------------------------- |
|
332 EXPORT_C void CCSRequestHandler::GetConversationsL( |
|
333 CCsClientConversation* aClientConversation, |
|
334 TInt /*aKnownIndex*/, |
|
335 TInt /*aPageSize*/) |
|
336 { |
|
337 // check if the aclientconversation is null then return |
|
338 if ( !aClientConversation) |
|
339 { |
|
340 User::Leave(KErrArgument); |
|
341 } |
|
342 if (TestConversationEngineStub::Instance()->GetConversationID() |
|
343 != aClientConversation->GetConversationEntryId()) |
|
344 { |
|
345 User::Leave(KErrNotFound); |
|
346 } |
|
347 } |
|
348 |
|
349 // ----------------------------------------------------------------------------- |
|
350 // CCSRequestHandler::GetCachingStatusL() |
|
351 // Get caching status |
|
352 // Synchronous |
|
353 // ----------------------------------------------------------------------------- |
|
354 EXPORT_C TUint8 CCSRequestHandler::GetCachingStatusL() |
|
355 { |
|
356 return 0; |
|
357 } |
|
358 |
|
359 // ----------------------------------------------------------------------------- |
|
360 // CCSRequestHandler::GetTotalUnreadCountL() |
|
361 // Get total unread count |
|
362 // Synchronous |
|
363 // ----------------------------------------------------------------------------- |
|
364 EXPORT_C TUint32 CCSRequestHandler::GetTotalUnreadCountL() |
|
365 { |
|
366 TUint32 unreadCount = 10; |
|
367 return unreadCount; |
|
368 } |
|
369 |
|
370 // ----------------------------------------------------------------------------- |
|
371 // CCSRequestHandler::HandleAddConversationList() |
|
372 // Process add conversation list event received from server |
|
373 // ----------------------------------------------------------------------------- |
|
374 void CCSRequestHandler::HandleAddConversationList(HBufC8* /*aResultsBuffer*/) |
|
375 { |
|
376 } |
|
377 |
|
378 // ----------------------------------------------------------------------------- |
|
379 // CCSRequestHandler::HandleDeleteConversationList() |
|
380 // Process delete conversation lsit event received from server |
|
381 // ----------------------------------------------------------------------------- |
|
382 void CCSRequestHandler::HandleDeleteConversationList(HBufC8* /*aResultsBuffer*/) |
|
383 { |
|
384 } |
|
385 |
|
386 // ----------------------------------------------------------------------------- |
|
387 // CCSRequestHandler::HandleModifyConversationList |
|
388 // Process modify conversation lsit event received from server |
|
389 // ----------------------------------------------------------------------------- |
|
390 void CCSRequestHandler::HandleModifyConversationList(HBufC8* /*aResultsBuffer*/) |
|
391 { |
|
392 } |
|
393 |
|
394 // ----------------------------------------------------------------------------- |
|
395 // CCSRequestHandler::HandleAddConversation |
|
396 // Process add conversation event received from server |
|
397 // ----------------------------------------------------------------------------- |
|
398 void CCSRequestHandler::HandleAddConversation(HBufC8* /*aResultsBuffer*/) |
|
399 { |
|
400 } |
|
401 |
|
402 // ----------------------------------------------------------------------------- |
|
403 // CCSRequestHandler::HandleDeleteConversation |
|
404 // Process delete conversation event received from server |
|
405 // ----------------------------------------------------------------------------- |
|
406 void CCSRequestHandler::HandleDeleteConversation(HBufC8* /*aResultsBuffer*/) |
|
407 { |
|
408 } |
|
409 |
|
410 // ----------------------------------------------------------------------------- |
|
411 // CCSRequestHandler::HandleModifyConversation |
|
412 // Process Modify conversation event received from server |
|
413 // ----------------------------------------------------------------------------- |
|
414 void CCSRequestHandler::HandleModifyConversation(HBufC8* /*aResultsBuffer*/) |
|
415 { |
|
416 } |
|
417 |
|
418 // ----------------------------------------------------------------------------- |
|
419 // CCSRequestHandler::HandleCachingStarted |
|
420 // Process caching started event received from server |
|
421 // ----------------------------------------------------------------------------- |
|
422 void CCSRequestHandler::HandleCachingStarted(HBufC8* /*aResultsBuffer*/) |
|
423 { |
|
424 User::Leave(KErrNotSupported); |
|
425 } |
|
426 |
|
427 // ----------------------------------------------------------------------------- |
|
428 // CCSRequestHandler::HandleCachingCompleted |
|
429 // Process caching completed event received from server |
|
430 // ----------------------------------------------------------------------------- |
|
431 void CCSRequestHandler::HandleCachingCompleted(HBufC8* /*aResultsBuffer*/) |
|
432 { |
|
433 User::Leave(KErrNotSupported); |
|
434 } |
|
435 |
|
436 // ----------------------------------------------------------------------------- |
|
437 // CCSRequestHandler::HandleCachingError |
|
438 // Process caching error event received from server |
|
439 // ----------------------------------------------------------------------------- |
|
440 void CCSRequestHandler::HandleCachingError(HBufC8* /*aResultsBuffer*/) |
|
441 { |
|
442 User::Leave(KErrNotSupported); |
|
443 } |
|
444 |
|
445 // ----------------------------------------------------------------------------- |
|
446 // CCSRequestHandler::DeleteConversationL() |
|
447 // ----------------------------------------------------------------------------- |
|
448 EXPORT_C void CCSRequestHandler::DeleteConversationL(TInt aConversationId) |
|
449 { |
|
450 TestConversationEngineStub::Instance()->DeleteConversation(aConversationId); |
|
451 } |
|
452 |
|
453 // ----------------------------------------------------------------------------- |
|
454 // CCSRequestHandler::HandleRefreshConversationList |
|
455 // Process refresh from server |
|
456 // ----------------------------------------------------------------------------- |
|
457 void CCSRequestHandler::HandleRefreshConversationList(HBufC8* /*aResultsBuffer*/) |
|
458 { |
|
459 } |
|
460 |
|
461 // ----------------------------------------------------------------------------- |
|
462 // Ccsrequesthandler::HandleRefreshConversationList |
|
463 // Process refresh from server |
|
464 // ----------------------------------------------------------------------------- |
|
465 void CCSRequestHandler::HandleRefreshConversation(HBufC8* /*aResultsBuffer*/) |
|
466 { |
|
467 } |
|
468 |
|
469 // ----------------------------------------------------------------------------- |
|
470 // CCSRequestHandler::GetConversationIdL() |
|
471 // ----------------------------------------------------------------------------- |
|
472 EXPORT_C TInt CCSRequestHandler::GetConversationIdL(TInt aContactId) |
|
473 { |
|
474 TInt conversationId = -1; |
|
475 |
|
476 //Get the associated conversation id from the contact id |
|
477 conversationId = TestConversationEngineStub::Instance()->GetClientConversationID(aContactId); |
|
478 |
|
479 return conversationId; |
|
480 } |
|
481 |
|
482 // ----------------------------------------------------------------------------- |
|
483 // CCSRequestHandler::GetConversationIdFromAddressL() |
|
484 // ----------------------------------------------------------------------------- |
|
485 EXPORT_C TInt CCSRequestHandler::GetConversationIdFromAddressL(TDesC& aContactAddress) |
|
486 { |
|
487 TInt conversationId = -1; |
|
488 |
|
489 //Read the conversation id from file with associated contact. |
|
490 conversationId = TestConversationEngineStub::Instance()->GetClientConversationID(aContactAddress); |
|
491 |
|
492 return conversationId; |
|
493 } |
|
494 // ----------------------------------------------------------------------------- |
|
495 // CCSRequestHandler::GetMessagingHistoryL() |
|
496 // ----------------------------------------------------------------------------- |
|
497 EXPORT_C void CCSRequestHandler::GetMessagingHistoryL(TInt /*aContactId*/, |
|
498 TInt /*aKnownIndex*/, |
|
499 TInt /*aPageSize*/) |
|
500 { |
|
501 } |
|
502 |
|
503 // ----------------------------------------------------------------------------- |
|
504 // CCSRequestHandler::GetConversationIdL() |
|
505 // ----------------------------------------------------------------------------- |
|
506 EXPORT_C void CCSRequestHandler::ClearMessagingHistoryL(TInt /*aContactId*/) |
|
507 { |
|
508 } |
|
509 |
|
510 // ----------------------------------------------------------------------------- |
|
511 // CCSRequestHandler::MarkConversationReadL() |
|
512 // ----------------------------------------------------------------------------- |
|
513 EXPORT_C void CCSRequestHandler::MarkConversationReadL(TInt aConversationId) |
|
514 { |
|
515 TestConversationEngineStub::Instance()->MarkConversationRead(aConversationId); |
|
516 } |
|
517 |
|
518 // ----------------------------------------------------------------------------- |
|
519 // CCSRequestHandler::MarkMessagingHistoryReadL() |
|
520 // ----------------------------------------------------------------------------- |
|
521 EXPORT_C void CCSRequestHandler::MarkMessagingHistoryReadL(TInt /*aContactId*/) |
|
522 { |
|
523 } |
|
524 |
|
525 // End of File |