|
1 /* |
|
2 * Copyright (c) 2007 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: This is the client side interface for the conversation |
|
15 * server. |
|
16 * |
|
17 */ |
|
18 |
|
19 |
|
20 // INCLUDE FILES |
|
21 |
|
22 // SYSTEM INCLUDES |
|
23 #include <ccsconversationentry.h> |
|
24 #include <ccsclientconversation.h> |
|
25 #include <mcsresultsobserver.h> |
|
26 #include <mcsconversationlistchangeobserver.h> |
|
27 #include <mcsconversationchangeobserver.h> |
|
28 #include <mcscachingstatusobserver.h> |
|
29 #include <ccsrequesthandler.h> |
|
30 #include <rcssession.h> |
|
31 #include <ccsnotificationhandler.h> |
|
32 |
|
33 //USER INCLUDES |
|
34 #include "ccsdebug.h" |
|
35 #include "ccsconversationchangeobserver.h" |
|
36 |
|
37 const TInt KSmallIpcBuffer = 256; //256 bytes |
|
38 |
|
39 // ========================= MEMBER FUNCTIONS ================================== |
|
40 |
|
41 // ----------------------------------------------------------------------------- |
|
42 // CCSRequestHandler::NewL() |
|
43 // Two-phased constructor. |
|
44 // ----------------------------------------------------------------------------- |
|
45 EXPORT_C CCSRequestHandler* CCSRequestHandler::NewL() |
|
46 { |
|
47 PRINT ( _L("Enter CCSRequestHandler::NewL") ); |
|
48 |
|
49 CCSRequestHandler* self = NewLC( ); |
|
50 CleanupStack::Pop( self ); |
|
51 |
|
52 PRINT ( _L("End CCSRequestHandler::NewL") ); |
|
53 |
|
54 return( self ) ; |
|
55 } |
|
56 |
|
57 // ----------------------------------------------------------------------------- |
|
58 // CCSRequestHandler::NewLC() |
|
59 // Two-phased constructor. |
|
60 // ----------------------------------------------------------------------------- |
|
61 EXPORT_C CCSRequestHandler* CCSRequestHandler::NewLC(/*CVPbkContactManager* aVPbkContactManager*/) |
|
62 { |
|
63 PRINT ( _L("Enter CCSRequestHandler::NewLC") ); |
|
64 |
|
65 CCSRequestHandler* self = new ( ELeave ) CCSRequestHandler(); |
|
66 CleanupStack::PushL( self ); |
|
67 self->ConstructL(/*aVPbkContactManager*/); |
|
68 |
|
69 PRINT ( _L("End CCSRequestHandler::NewLC") ); |
|
70 |
|
71 return self; |
|
72 } |
|
73 |
|
74 // ----------------------------------------------------------------------------- |
|
75 // CCSRequestHandler::CCSAsyncRequestHandler() |
|
76 // C++ default constructor can NOT contain any code, that might leave. |
|
77 // ----------------------------------------------------------------------------- |
|
78 CCSRequestHandler::CCSRequestHandler() |
|
79 : CActive( EPriorityStandard ) |
|
80 { |
|
81 CActiveScheduler::Add( this ); |
|
82 } |
|
83 |
|
84 // ----------------------------------------------------------------------------- |
|
85 // CCSRequestHandler::ConstructL() |
|
86 // Symbian 2nd phase constructor can leave. |
|
87 // ----------------------------------------------------------------------------- |
|
88 void CCSRequestHandler::ConstructL() |
|
89 { |
|
90 PRINT ( _L("Enter CCSRequestHandler::ConstructL") ); |
|
91 |
|
92 User::LeaveIfError( iSession.Connect() ); |
|
93 |
|
94 // Notification handler |
|
95 iNotificationHandler = CCsNotificationHandler::NewL(this); |
|
96 |
|
97 // Observers |
|
98 iResultsObserver = NULL; |
|
99 iCachingStatusObserver = NULL; |
|
100 iConversationListChangeObserver = NULL; |
|
101 iConversationChangeObserver = NULL; |
|
102 |
|
103 PRINT ( _L("End CCSRequestHandler::ConstructL") ); |
|
104 } |
|
105 |
|
106 |
|
107 // ----------------------------------------------------------------------------- |
|
108 // CCSRequestHandler::~CCSRequestHandler() |
|
109 // Destructor. |
|
110 // ----------------------------------------------------------------------------- |
|
111 CCSRequestHandler::~CCSRequestHandler() |
|
112 { |
|
113 PRINT ( _L("Enter CCSRequestHandler::~CCSRequestHandler") ); |
|
114 |
|
115 Cancel(); |
|
116 |
|
117 // Cleanup |
|
118 if ( iBuffer ) |
|
119 { |
|
120 delete iBuffer; |
|
121 iBuffer = NULL; |
|
122 } |
|
123 |
|
124 if ( iResultsBuffer ) |
|
125 { |
|
126 delete iResultsBuffer; |
|
127 iResultsBuffer = NULL; |
|
128 } |
|
129 |
|
130 if ( iNotificationHandler ) |
|
131 { |
|
132 delete iNotificationHandler; |
|
133 iNotificationHandler = NULL; |
|
134 } |
|
135 |
|
136 if( iListResultsBuffer ) |
|
137 { |
|
138 delete iListResultsBuffer; |
|
139 iListResultsBuffer=NULL; |
|
140 } |
|
141 if( iConvResultsBuffer ) |
|
142 { |
|
143 delete iConvResultsBuffer; |
|
144 iConvResultsBuffer=NULL; |
|
145 } |
|
146 |
|
147 // Close the session |
|
148 iSession.Close(); |
|
149 |
|
150 PRINT ( _L("End CCSRequestHandler::~CCSRequestHandler") ); |
|
151 } |
|
152 |
|
153 // ----------------------------------------------------------------------------- |
|
154 // CCSRequestHandler::HandleGetConversationListResults() |
|
155 // This shall handle all entry list result from server |
|
156 // |
|
157 // ----------------------------------------------------------------------------- |
|
158 void CCSRequestHandler::HandleGetConversationListResults() |
|
159 { |
|
160 PRINT( _L("Enter CCSRequestHandler::HandleGetConversationListResults") ); |
|
161 |
|
162 TInt error = KErrNone; |
|
163 RPointerArray<CCsClientConversation> clientConversationList; |
|
164 |
|
165 // Parse the results |
|
166 RDesReadStream resultStream(iListResultsBuffer->Des()); |
|
167 TInt listCount = 0; |
|
168 |
|
169 TRAP(error, |
|
170 resultStream.PushL(); |
|
171 listCount = resultStream.ReadUint16L(); |
|
172 resultStream.Pop() |
|
173 ); |
|
174 |
|
175 if(error != KErrNone) |
|
176 { |
|
177 //call panic |
|
178 } |
|
179 |
|
180 for (TInt iloop = 0 ; iloop < listCount; iloop++) |
|
181 { |
|
182 TRAP(error, |
|
183 resultStream.PushL(); |
|
184 CCsClientConversation* clientConversation = CCsClientConversation::NewL(); |
|
185 CleanupStack::PushL(clientConversation); |
|
186 clientConversation->InternalizeL(resultStream); |
|
187 clientConversationList.AppendL(clientConversation); |
|
188 CleanupStack::Pop(clientConversation); |
|
189 resultStream.Pop() |
|
190 ); |
|
191 |
|
192 if(error != KErrNone) |
|
193 { |
|
194 //call panic |
|
195 } |
|
196 } |
|
197 |
|
198 // Clear all the internal buffers |
|
199 // Cleanup |
|
200 delete iListResultsBuffer; |
|
201 iListResultsBuffer = NULL; |
|
202 |
|
203 resultStream.Close(); |
|
204 |
|
205 // Pass the results to the observer |
|
206 if ( iResultsObserver ) |
|
207 { |
|
208 iResultsObserver->ConversationList(clientConversationList); |
|
209 } |
|
210 |
|
211 clientConversationList.ResetAndDestroy(); |
|
212 |
|
213 PRINT( _L("End CCSRequestHandler::HandleGetConversationListResults") ); |
|
214 } |
|
215 |
|
216 // ----------------------------------------------------------------------------- |
|
217 // CCSRequestHandler::HandleGetConversationResults() |
|
218 // This shall handle GetCoversation results async from server |
|
219 // |
|
220 // ----------------------------------------------------------------------------- |
|
221 void CCSRequestHandler::HandleGetConversationResults() |
|
222 { |
|
223 PRINT( _L("Enter CCSRequestHandler::HandleGetConversationResults") ); |
|
224 |
|
225 TInt error = KErrNone; |
|
226 |
|
227 RPointerArray<CCsConversationEntry> ConversationEntryList; |
|
228 // Parse the results |
|
229 RDesReadStream resultStream(iConvResultsBuffer->Des()); |
|
230 TInt conversationEntryCount = 0; |
|
231 |
|
232 TRAP(error, resultStream.PushL(); |
|
233 |
|
234 conversationEntryCount = resultStream.ReadInt32L(); |
|
235 |
|
236 resultStream.Pop()); |
|
237 |
|
238 if(error != KErrNone) |
|
239 { |
|
240 //call panic |
|
241 } |
|
242 |
|
243 PRINT1 ( _L("Number of conversation entries = %d"), conversationEntryCount ); |
|
244 |
|
245 // conversation entries |
|
246 for ( TInt iloop = 0; iloop < conversationEntryCount; iloop++ ) |
|
247 { |
|
248 TRAP(error, |
|
249 resultStream.PushL(); |
|
250 |
|
251 CCsConversationEntry* conversationEntry = CCsConversationEntry::NewL(); |
|
252 CleanupStack::PushL(conversationEntry); |
|
253 |
|
254 conversationEntry->InternalizeL(resultStream); |
|
255 ConversationEntryList.AppendL(conversationEntry); |
|
256 |
|
257 CleanupStack::Pop(conversationEntry); |
|
258 resultStream.Pop()); |
|
259 |
|
260 if(error != KErrNone) |
|
261 { |
|
262 //call panic |
|
263 } |
|
264 } |
|
265 |
|
266 // Cleanup |
|
267 if ( iBuffer ) |
|
268 { |
|
269 delete iBuffer; |
|
270 iBuffer = NULL; |
|
271 } |
|
272 delete iConvResultsBuffer; |
|
273 iConvResultsBuffer = NULL; |
|
274 |
|
275 resultStream.Close(); |
|
276 |
|
277 // Pass the results to the observer |
|
278 if ( iResultsObserver ) |
|
279 { |
|
280 iResultsObserver->Conversations(ConversationEntryList); |
|
281 } |
|
282 |
|
283 // cleanup heap data |
|
284 ConversationEntryList.ResetAndDestroy(); |
|
285 |
|
286 PRINT_TIMESTAMP ("End CCSRequestHandler::HandleGetConversationResults"); |
|
287 } |
|
288 |
|
289 // ----------------------------------------------------------------------------- |
|
290 // CCSRequestHandler::HandleGetEntryListOverflow() |
|
291 // Handle the buffer overflow error for get entry list results |
|
292 // ----------------------------------------------------------------------------- |
|
293 void CCSRequestHandler::HandleGetConversationListOverflow() |
|
294 { |
|
295 PRINT ( _L("Enter CCSRequestHandler::HandleGetConversationListOverflow") ); |
|
296 |
|
297 TInt error = KErrNone; |
|
298 |
|
299 // New buffer size is now stored in results buffer |
|
300 RDesReadStream stream(iListResultsBuffer->Des()); |
|
301 TInt bufferSize = 0; |
|
302 |
|
303 TRAP(error, |
|
304 stream.PushL(); |
|
305 bufferSize = stream.ReadInt32L(); |
|
306 stream.Pop() |
|
307 ); |
|
308 |
|
309 if(error != KErrNone) |
|
310 { |
|
311 //call panic |
|
312 } |
|
313 |
|
314 stream.Close(); |
|
315 |
|
316 // Delete and recreate the results buffer |
|
317 if ( iListResultsBuffer ) |
|
318 { |
|
319 delete iListResultsBuffer; |
|
320 iListResultsBuffer = NULL; |
|
321 } |
|
322 |
|
323 // Buffer created for the new size |
|
324 TRAP(error, |
|
325 iListResultsBuffer = HBufC8::NewL(bufferSize); |
|
326 iSession.GetConversationListL(iListResultsBuffer->Des(),iStatus) |
|
327 ); |
|
328 |
|
329 if(error != KErrNone) |
|
330 { |
|
331 //call panic |
|
332 } |
|
333 SetActive(); |
|
334 |
|
335 PRINT ( _L("End CCSRequestHandler::HandleGetEntryListOverflow") ); |
|
336 } |
|
337 |
|
338 // ----------------------------------------------------------------------------- |
|
339 // CCSRequestHandler::HandleGetConversationOverflow() |
|
340 // Handle the buffer overflow error for get conversation results |
|
341 // ----------------------------------------------------------------------------- |
|
342 void CCSRequestHandler::HandleGetConversationOverflow() |
|
343 { |
|
344 PRINT ( _L("Enter CCSRequestHandler::HandleGetConversationOverflow") ); |
|
345 |
|
346 TInt error = KErrNone; |
|
347 |
|
348 // New buffer size is now stored in results buffer |
|
349 RDesReadStream stream(iConvResultsBuffer->Des()); |
|
350 TInt bufferSize = 0; |
|
351 |
|
352 // Read the buffer size and create a new buffer |
|
353 TRAP(error, |
|
354 stream.PushL(); |
|
355 bufferSize = stream.ReadInt32L(); |
|
356 stream.Pop() |
|
357 ); |
|
358 |
|
359 if(error != KErrNone) |
|
360 { |
|
361 //call panic |
|
362 } |
|
363 |
|
364 stream.Close(); |
|
365 |
|
366 // Delete and recreate the results buffer |
|
367 if ( iConvResultsBuffer ) |
|
368 { |
|
369 delete iConvResultsBuffer; |
|
370 iConvResultsBuffer = NULL; |
|
371 } |
|
372 |
|
373 // Buffer created for the new size |
|
374 TRAP(error, |
|
375 iConvResultsBuffer = HBufC8::NewL(bufferSize); |
|
376 iSession.SendNewBufferGetConversationL(iConvResultsBuffer->Des(),iStatus) |
|
377 ); |
|
378 |
|
379 if(error != KErrNone) |
|
380 { |
|
381 //call panic |
|
382 } |
|
383 |
|
384 SetActive(); |
|
385 |
|
386 PRINT ( _L("End CCSRequestHandler::HandleGetConversationListOverflow") ); |
|
387 } |
|
388 |
|
389 // ----------------------------------------------------------------------------- |
|
390 // CCSRequestHandler::RequestResultsEventL() |
|
391 // Add conversation result Observer |
|
392 // ----------------------------------------------------------------------------- |
|
393 EXPORT_C void CCSRequestHandler::RequestResultsEventL( |
|
394 MCsResultsObserver* aObserver) |
|
395 { |
|
396 iResultsObserver = aObserver; |
|
397 } |
|
398 |
|
399 // ----------------------------------------------------------------------------- |
|
400 // CCSRequestHandler::RemoveResultsEventL() |
|
401 // Remove conversation result observer |
|
402 // ----------------------------------------------------------------------------- |
|
403 EXPORT_C void CCSRequestHandler::RemoveResultsEventL |
|
404 (MCsResultsObserver* /*aObserver*/) |
|
405 { |
|
406 iResultsObserver = NULL; |
|
407 } |
|
408 |
|
409 // ----------------------------------------------------------------------------- |
|
410 // CCSRequestHandler::RequestConversationListChangeEventL() |
|
411 // Add conversation list change event Observer |
|
412 // ----------------------------------------------------------------------------- |
|
413 EXPORT_C void CCSRequestHandler::RequestConversationListChangeEventL( |
|
414 MCsConversationListChangeObserver* aObserver) |
|
415 { |
|
416 iConversationListChangeObserver = aObserver; |
|
417 |
|
418 // Register to server. |
|
419 iNotificationHandler->RequestConversationListChangeEventL(); |
|
420 } |
|
421 |
|
422 // ----------------------------------------------------------------------------- |
|
423 // CCSRequestHandler::RemoveConversationListChangeEventL() |
|
424 // Remove conversation list change event Observer |
|
425 // ----------------------------------------------------------------------------- |
|
426 EXPORT_C void CCSRequestHandler::RemoveConversationListChangeEventL( |
|
427 MCsConversationListChangeObserver* /*aObserver*/) |
|
428 { |
|
429 iConversationListChangeObserver = NULL; |
|
430 |
|
431 // De-register from the server |
|
432 iNotificationHandler->RemoveConversationListChangeEventL(); |
|
433 } |
|
434 |
|
435 // ----------------------------------------------------------------------------- |
|
436 // CCSRequestHandler::RequestConversationChangeEventL() |
|
437 // Add conversation change event Observer |
|
438 // ----------------------------------------------------------------------------- |
|
439 EXPORT_C void CCSRequestHandler::RequestConversationChangeEventL( |
|
440 MCsConversationChangeObserver* aObserver, |
|
441 CCsClientConversation* aClientConversation) |
|
442 { |
|
443 CCsConversationChangeObserver* conChgObserver = |
|
444 CCsConversationChangeObserver::NewL(); |
|
445 CleanupStack::PushL(conChgObserver); |
|
446 conChgObserver->SetClientConversationL(*aClientConversation); |
|
447 conChgObserver->SetConversationChangeObserverL(aObserver); |
|
448 iConversationChangeObserver = conChgObserver; |
|
449 CleanupStack::Pop(conChgObserver); |
|
450 |
|
451 iNotificationHandler->RequestConversationChangeEventL(aClientConversation); |
|
452 } |
|
453 |
|
454 // ----------------------------------------------------------------------------- |
|
455 // CCSRequestHandler::RemoveConversationChangeEventL() |
|
456 // Remove conversation change event observer |
|
457 // ----------------------------------------------------------------------------- |
|
458 EXPORT_C void CCSRequestHandler::RemoveConversationChangeEventL( |
|
459 MCsConversationChangeObserver* /*aObserver*/, |
|
460 CCsClientConversation* aClientConversation) |
|
461 { |
|
462 if ( iConversationChangeObserver ) |
|
463 { |
|
464 delete iConversationChangeObserver; |
|
465 iConversationChangeObserver = NULL; |
|
466 } |
|
467 |
|
468 iNotificationHandler->RemoveConversationChangeEventL(aClientConversation); |
|
469 } |
|
470 |
|
471 // ----------------------------------------------------------------------------- |
|
472 // CCSRequestHandler::RequestCachingStatusEventL() |
|
473 // Add caching status Observer |
|
474 // ----------------------------------------------------------------------------- |
|
475 EXPORT_C void CCSRequestHandler::RequestCachingStatusEventL( |
|
476 MCsCachingStatusObserver* /*aObserver*/) |
|
477 { |
|
478 User::Leave(KErrNotSupported); |
|
479 } |
|
480 |
|
481 // ----------------------------------------------------------------------------- |
|
482 // CCSRequestHandler::RemoveCachingStatusEventL() |
|
483 // Remove caching status Observer |
|
484 // ----------------------------------------------------------------------------- |
|
485 EXPORT_C void CCSRequestHandler::RemoveCachingStatusEventL( |
|
486 MCsCachingStatusObserver* /*aObserver*/) |
|
487 { |
|
488 User::Leave(KErrNotSupported); |
|
489 } |
|
490 |
|
491 // ----------------------------------------------------------------------------- |
|
492 // CCSRequestHandler::RunL() |
|
493 // Invoked to handle responses from the server. |
|
494 // ----------------------------------------------------------------------------- |
|
495 void CCSRequestHandler::RunL() |
|
496 { |
|
497 switch ( iStatus.Int() ) |
|
498 { |
|
499 case EGetConversationListOperationComplete: |
|
500 HandleGetConversationListResults(); |
|
501 break; |
|
502 |
|
503 case EGetConversationListBufferOverflow: |
|
504 HandleGetConversationListOverflow(); |
|
505 break; |
|
506 |
|
507 case EGetConversationOperationComplete: |
|
508 HandleGetConversationResults(); |
|
509 break; |
|
510 |
|
511 case EGetConversationBufferOverflow: |
|
512 HandleGetConversationOverflow(); |
|
513 break; |
|
514 |
|
515 default: |
|
516 HandleErrorL(iStatus.Int()); |
|
517 break; |
|
518 } |
|
519 } |
|
520 |
|
521 // ----------------------------------------------------------------------------- |
|
522 // CCSRequestHandler::HandleErrorL() |
|
523 // Send the error code to the client. |
|
524 // ----------------------------------------------------------------------------- |
|
525 void CCSRequestHandler::HandleErrorL(TInt /*aErrorCode*/) |
|
526 { |
|
527 // Not supported |
|
528 } |
|
529 |
|
530 // ----------------------------------------------------------------------------- |
|
531 // CCSRequestHandler::DoCancel() |
|
532 // Cancels any outstanding operation. |
|
533 // ----------------------------------------------------------------------------- |
|
534 void CCSRequestHandler::DoCancel() |
|
535 { |
|
536 // Do nothing |
|
537 } |
|
538 |
|
539 // ----------------------------------------------------------------------------- |
|
540 // CCSRequestHandler::Version() |
|
541 // Recovers the conversation server version. |
|
542 // ----------------------------------------------------------------------------- |
|
543 EXPORT_C TVersion CCSRequestHandler::Version() const |
|
544 { |
|
545 return (iSession.Version()); |
|
546 } |
|
547 |
|
548 // ----------------------------------------------------------------------------- |
|
549 // CCSRequestHandler::ShutdownServerL() |
|
550 // Shuts down the conversation server. |
|
551 // ----------------------------------------------------------------------------- |
|
552 EXPORT_C void CCSRequestHandler::ShutdownServerL() |
|
553 { |
|
554 return (iSession.ShutdownServerL()); |
|
555 } |
|
556 |
|
557 // ----------------------------------------------------------------------------- |
|
558 // CCSRequestHandler::GetConversationListL() |
|
559 // Get Recent Conversation Entry list with display name |
|
560 // for all stored conversation entry IDs. |
|
561 // This API can be used to prepare conversation list view. |
|
562 // ----------------------------------------------------------------------------- |
|
563 EXPORT_C void CCSRequestHandler::GetConversationListL() |
|
564 { |
|
565 PRINT( _L("Enter CCSRequestHandler::GetConversationListL") ); |
|
566 |
|
567 // ------------------------- Results Buffer --------------------- |
|
568 |
|
569 // Create a buffer to store the search results. |
|
570 if(iListResultsBuffer) |
|
571 { |
|
572 delete iListResultsBuffer; |
|
573 iListResultsBuffer = NULL; |
|
574 } |
|
575 iListResultsBuffer = HBufC8::NewL(KBufferMaxLen); |
|
576 |
|
577 // Send the ASYNC request |
|
578 iSession.GetConversationListL(iListResultsBuffer->Des(), |
|
579 iStatus); |
|
580 SetActive(); |
|
581 |
|
582 PRINT( _L("End CCSRequestHandler::GetConversationListL") ); |
|
583 } |
|
584 |
|
585 // ----------------------------------------------------------------------------- |
|
586 // CCSRequestHandler::GetConversationUnreadListL() |
|
587 // Get Recent unread Conversation Entry list with display name |
|
588 // for all stored conversation entry IDs. |
|
589 // This API can be used to prepare conversation list view. |
|
590 // ----------------------------------------------------------------------------- |
|
591 EXPORT_C void CCSRequestHandler::GetConversationUnreadListL(RPointerArray< |
|
592 CCsClientConversation>* aClientConversationList) |
|
593 { |
|
594 PRINT( _L("Enter CCSRequestHandler::GetConversationUnreadListL") ); |
|
595 |
|
596 TInt resultBufferSize = KBufferMaxLen; |
|
597 TInt isOverflow = EFalse; |
|
598 TInt error = KErrNone; |
|
599 |
|
600 HBufC8* overflow = HBufC8::NewL(sizeof(TInt)); |
|
601 CleanupStack::PushL(overflow); |
|
602 |
|
603 do |
|
604 { |
|
605 |
|
606 // 1. Create fresh Result buffer. |
|
607 if (iResultsBuffer) |
|
608 { |
|
609 delete iResultsBuffer; |
|
610 iResultsBuffer = NULL; |
|
611 } |
|
612 iResultsBuffer = HBufC8::NewL(resultBufferSize); |
|
613 |
|
614 // 2. Send the SYNC request. |
|
615 iSession.GetConversationUnreadListL(overflow->Des(), |
|
616 iResultsBuffer->Des()); |
|
617 |
|
618 // 3. Read Overflow status. |
|
619 RDesReadStream overflowStream(overflow->Des()); |
|
620 |
|
621 TRAP(error, |
|
622 overflowStream.PushL(); |
|
623 isOverflow = overflowStream.ReadUint16L(); |
|
624 overflowStream.Pop()); |
|
625 |
|
626 overflowStream.Close(); |
|
627 |
|
628 // 4. If Overflow, reset the result buffer size. |
|
629 if (isOverflow) |
|
630 { |
|
631 // New buffer size is now stored in results buffer |
|
632 RDesReadStream stream(iResultsBuffer->Des()); |
|
633 |
|
634 TRAP(error, |
|
635 stream.PushL(); |
|
636 resultBufferSize = stream.ReadInt32L(); |
|
637 stream.Pop()); |
|
638 |
|
639 stream.Close(); |
|
640 } |
|
641 } |
|
642 while (isOverflow); |
|
643 |
|
644 CleanupStack::PopAndDestroy(overflow); |
|
645 |
|
646 // 5. No Overflow, Parse the results |
|
647 RDesReadStream resultStream(iResultsBuffer->Des()); |
|
648 TInt listCount = 0; |
|
649 |
|
650 TRAP(error, |
|
651 resultStream.PushL(); |
|
652 listCount = resultStream.ReadUint16L(); |
|
653 resultStream.Pop() |
|
654 ); |
|
655 |
|
656 for (TInt iloop = 0; iloop < listCount; iloop++) |
|
657 { |
|
658 TRAP(error, |
|
659 resultStream.PushL(); |
|
660 CCsClientConversation* clientConversation = CCsClientConversation::NewL(); |
|
661 CleanupStack::PushL(clientConversation); |
|
662 clientConversation->InternalizeL(resultStream); |
|
663 aClientConversationList->AppendL(clientConversation); |
|
664 CleanupStack::Pop(clientConversation); |
|
665 resultStream.Pop()); |
|
666 } |
|
667 |
|
668 // Clear all the internal buffers |
|
669 // Cleanup |
|
670 delete iResultsBuffer; |
|
671 iResultsBuffer = NULL; |
|
672 resultStream.Close(); |
|
673 |
|
674 PRINT( _L("End CCSRequestHandler::GetConversationUnreadListL") ); |
|
675 } |
|
676 |
|
677 // ----------------------------------------------------------------------------- |
|
678 // CCSRequestHandler::GetConversationsL() |
|
679 // Get Conversation Entry list for given Conversation Entry ID to prepare |
|
680 // convresation view. |
|
681 // ----------------------------------------------------------------------------- |
|
682 EXPORT_C void CCSRequestHandler::GetConversationsL( |
|
683 CCsClientConversation* aClientConversation) |
|
684 { |
|
685 PRINT( _L("Enter CCSRequestHandler::GetConversationsL") ); |
|
686 |
|
687 // check if the aclientconversation is null then return |
|
688 if ( aClientConversation == NULL) |
|
689 { |
|
690 return; |
|
691 } |
|
692 |
|
693 //-------------------Contact----------------------------- |
|
694 |
|
695 // Tmp buffer |
|
696 CBufFlat* dataBuf = CBufFlat::NewL(KBufferMaxLen); |
|
697 CleanupStack::PushL(dataBuf); |
|
698 |
|
699 // Stream over the temp buffer |
|
700 RBufWriteStream dataStream(*dataBuf); |
|
701 dataStream.PushL(); |
|
702 |
|
703 // Write the Client Conversation in the stream |
|
704 aClientConversation->ExternalizeL(dataStream); |
|
705 dataStream.CommitL(); |
|
706 |
|
707 //------------------Input Buffer-------------------------- |
|
708 // Create a HBufC8 for IPC |
|
709 iBuffer = HBufC8::NewL(dataBuf->Size()); |
|
710 TPtr8 dataPtr(iBuffer->Des()); |
|
711 dataBuf->Read(0, dataPtr, dataBuf->Size()); |
|
712 |
|
713 CleanupStack::PopAndDestroy(2, dataBuf); |
|
714 |
|
715 // ------------------------- Results Buffer --------------------- |
|
716 |
|
717 // Create a buffer to store the search results. |
|
718 if(iConvResultsBuffer) |
|
719 { |
|
720 delete iConvResultsBuffer; |
|
721 iConvResultsBuffer = NULL; |
|
722 } |
|
723 iConvResultsBuffer = HBufC8::NewL(KBufferMaxLen); |
|
724 |
|
725 // Send the ASYNC request |
|
726 iSession.GetConversationsL(iBuffer->Des(), |
|
727 iConvResultsBuffer->Des(), |
|
728 iStatus); |
|
729 SetActive(); |
|
730 } |
|
731 |
|
732 // ----------------------------------------------------------------------------- |
|
733 // CCSRequestHandler::GetCachingStatusL() |
|
734 // Get caching status |
|
735 // Synchronous |
|
736 // ----------------------------------------------------------------------------- |
|
737 EXPORT_C TUint8 CCSRequestHandler::GetCachingStatusL() |
|
738 { |
|
739 PRINT ( _L("Enter CCSRequestHandler::GetCachingStatusL") ); |
|
740 |
|
741 // ------------------------- Results Buffer --------------------- |
|
742 // Create a buffer to store the results. |
|
743 if(iResultsBuffer) |
|
744 { |
|
745 delete iResultsBuffer; |
|
746 iResultsBuffer = NULL; |
|
747 } |
|
748 iResultsBuffer = HBufC8::NewL(KBufferMaxLen); |
|
749 |
|
750 // -------------------------------------------------------------- |
|
751 |
|
752 // Send the request |
|
753 iSession.GetCachingStatusL(iResultsBuffer->Des()); |
|
754 |
|
755 // Parse the results |
|
756 RDesReadStream resultStream(iResultsBuffer->Des()); |
|
757 resultStream.PushL(); |
|
758 |
|
759 TUint8 cachestatus = resultStream.ReadUint8L(); |
|
760 |
|
761 // Cleanup |
|
762 delete iResultsBuffer; |
|
763 iResultsBuffer = NULL; |
|
764 resultStream.Pop(); |
|
765 resultStream.Close(); |
|
766 |
|
767 PRINT( _L("End CCSRequestHandler::GetCachingStatusL") ); |
|
768 return cachestatus; |
|
769 } |
|
770 |
|
771 // ----------------------------------------------------------------------------- |
|
772 // CCSRequestHandler::GetTotalUnreadCountL() |
|
773 // Get total unread count |
|
774 // Synchronous |
|
775 // ----------------------------------------------------------------------------- |
|
776 EXPORT_C TUint32 CCSRequestHandler::GetTotalUnreadCountL() |
|
777 { |
|
778 PRINT ( _L("Enter CCSRequestHandler::GetTotalUnreadCountL") ); |
|
779 |
|
780 // ------------------------- Results Buffer --------------------- |
|
781 // Create a buffer to store the results. |
|
782 if(iResultsBuffer) |
|
783 { |
|
784 delete iResultsBuffer; |
|
785 iResultsBuffer = NULL; |
|
786 } |
|
787 iResultsBuffer = HBufC8::NewL(KBufferMaxLen); |
|
788 |
|
789 // -------------------------------------------------------------- |
|
790 |
|
791 // Send the request |
|
792 iSession.GetTotalUnreadCountL(iResultsBuffer->Des()); |
|
793 |
|
794 // Parse the results |
|
795 RDesReadStream resultStream(iResultsBuffer->Des()); |
|
796 resultStream.PushL(); |
|
797 |
|
798 TUint32 unreadCount = resultStream.ReadUint32L(); |
|
799 |
|
800 // Cleanup |
|
801 delete iResultsBuffer; |
|
802 iResultsBuffer = NULL; |
|
803 resultStream.Pop(); |
|
804 resultStream.Close(); |
|
805 |
|
806 PRINT( _L("End CCSRequestHandler::GetTotalUnreadCountL") ); |
|
807 return unreadCount; |
|
808 } |
|
809 |
|
810 // ----------------------------------------------------------------------------- |
|
811 // CCSRequestHandler::HandleAddConversationList() |
|
812 // Process add conversation list event received from server |
|
813 // ----------------------------------------------------------------------------- |
|
814 void CCSRequestHandler::HandleAddConversationList(HBufC8* aResultsBuffer) |
|
815 { |
|
816 PRINT( _L("Enter CCSRequestHandler::HandleAddConversationList") ); |
|
817 |
|
818 TInt error = KErrNone; |
|
819 |
|
820 // perpare client conversation |
|
821 CCsClientConversation* clientConversation = NULL; |
|
822 RDesReadStream resultStream(aResultsBuffer->Des()); |
|
823 |
|
824 TRAP(error, |
|
825 resultStream.PushL(); |
|
826 clientConversation = CCsClientConversation::NewL(); |
|
827 CleanupStack::PushL(clientConversation); |
|
828 clientConversation->InternalizeL(resultStream); |
|
829 CleanupStack::Pop(clientConversation); |
|
830 resultStream.Pop()); |
|
831 |
|
832 if ( error != KErrNone ) |
|
833 { |
|
834 // Ignore this conversation |
|
835 } |
|
836 |
|
837 // Cleanup |
|
838 resultStream.Close(); |
|
839 |
|
840 // Pass the results to the observer |
|
841 if ( iConversationListChangeObserver ) |
|
842 { |
|
843 iConversationListChangeObserver-> |
|
844 AddConversationList(*clientConversation); |
|
845 } |
|
846 |
|
847 delete clientConversation; |
|
848 |
|
849 PRINT( _L("End CCSRequestHandler::HandleAddConversationList") ); |
|
850 } |
|
851 |
|
852 // ----------------------------------------------------------------------------- |
|
853 // CCSRequestHandler::HandleDeleteConversationList() |
|
854 // Process delete conversation lsit event received from server |
|
855 // ----------------------------------------------------------------------------- |
|
856 void CCSRequestHandler::HandleDeleteConversationList(HBufC8* aResultsBuffer) |
|
857 { |
|
858 PRINT( _L("Enter CCSRequestHandler::HandleDeleteConversationList") ); |
|
859 |
|
860 TInt error = KErrNone; |
|
861 |
|
862 // perpare client conversation |
|
863 CCsClientConversation* clientConversation = NULL; |
|
864 RDesReadStream resultStream(aResultsBuffer->Des()); |
|
865 |
|
866 TRAP(error, |
|
867 resultStream.PushL(); |
|
868 clientConversation = CCsClientConversation::NewL(); |
|
869 CleanupStack::PushL(clientConversation); |
|
870 clientConversation->InternalizeL(resultStream); |
|
871 CleanupStack::Pop(clientConversation); |
|
872 resultStream.Pop()); |
|
873 |
|
874 if ( error != KErrNone ) |
|
875 { |
|
876 // Ignore this conversation |
|
877 } |
|
878 |
|
879 // Cleanup |
|
880 resultStream.Close(); |
|
881 |
|
882 // Pass the results to the observer |
|
883 if ( iConversationListChangeObserver ) |
|
884 { |
|
885 iConversationListChangeObserver-> |
|
886 DeleteConversationList(*clientConversation); |
|
887 } |
|
888 |
|
889 delete clientConversation; |
|
890 |
|
891 PRINT( _L("End CCSRequestHandler::HandleDeleteConversationList") ); |
|
892 } |
|
893 |
|
894 // ----------------------------------------------------------------------------- |
|
895 // CCSRequestHandler::HandleModifyConversationList |
|
896 // Process modify conversation lsit event received from server |
|
897 // ----------------------------------------------------------------------------- |
|
898 void CCSRequestHandler::HandleModifyConversationList(HBufC8* aResultsBuffer) |
|
899 { |
|
900 PRINT( _L("Enter CCSRequestHandler::HandleModifyConversationList") ); |
|
901 |
|
902 TInt error = KErrNone; |
|
903 |
|
904 // perpare client conversation |
|
905 CCsClientConversation* clientConversation = NULL; |
|
906 RDesReadStream resultStream(aResultsBuffer->Des()); |
|
907 |
|
908 TRAP(error, |
|
909 resultStream.PushL(); |
|
910 clientConversation = CCsClientConversation::NewL(); |
|
911 CleanupStack::PushL(clientConversation); |
|
912 clientConversation->InternalizeL(resultStream); |
|
913 CleanupStack::Pop(clientConversation); |
|
914 resultStream.Pop()); |
|
915 |
|
916 if ( error != KErrNone ) |
|
917 { |
|
918 // Ignore this conversation |
|
919 } |
|
920 |
|
921 // Cleanup |
|
922 resultStream.Close(); |
|
923 |
|
924 // Pass the results to the observer |
|
925 if ( iConversationListChangeObserver ) |
|
926 { |
|
927 iConversationListChangeObserver-> |
|
928 ModifyConversationList(*clientConversation); |
|
929 } |
|
930 |
|
931 delete clientConversation; |
|
932 |
|
933 PRINT( _L("End CCSRequestHandler::HandleModifyConversationList") ); |
|
934 } |
|
935 |
|
936 // ----------------------------------------------------------------------------- |
|
937 // CCSRequestHandler::HandleAddConversation |
|
938 // Process add conversation event received from server |
|
939 // ----------------------------------------------------------------------------- |
|
940 void CCSRequestHandler::HandleAddConversation(HBufC8* aResultsBuffer) |
|
941 { |
|
942 PRINT( _L("Start CCSRequestHandler::HandleAddConversation") ); |
|
943 |
|
944 TInt error = KErrNone; |
|
945 |
|
946 // perpare client conversation |
|
947 CCsClientConversation* clientConversation = NULL; |
|
948 RDesReadStream resultStream(aResultsBuffer->Des()); |
|
949 |
|
950 TRAP(error, |
|
951 resultStream.PushL(); |
|
952 clientConversation = CCsClientConversation::NewL(); |
|
953 CleanupStack::PushL(clientConversation); |
|
954 clientConversation->InternalizeL(resultStream); |
|
955 CleanupStack::Pop(clientConversation); |
|
956 resultStream.Pop()); |
|
957 |
|
958 if ( error != KErrNone ) |
|
959 { |
|
960 // Ignore this conversation |
|
961 } |
|
962 |
|
963 // Cleanup |
|
964 resultStream.Close(); |
|
965 |
|
966 // Pass the results to the observer |
|
967 if ( iConversationChangeObserver ) |
|
968 { |
|
969 MCsConversationChangeObserver* observer = |
|
970 iConversationChangeObserver->ConversationChangeObserver(); |
|
971 observer->AddConversation(*(clientConversation-> |
|
972 GetConversationEntry())); |
|
973 } |
|
974 |
|
975 delete clientConversation; |
|
976 |
|
977 PRINT( _L("End CCSRequestHandler::HandleAddConversation") ); |
|
978 } |
|
979 |
|
980 // ----------------------------------------------------------------------------- |
|
981 // CCSRequestHandler::HandleDeleteConversation |
|
982 // Process delete conversation event received from server |
|
983 // ----------------------------------------------------------------------------- |
|
984 void CCSRequestHandler::HandleDeleteConversation(HBufC8* aResultsBuffer) |
|
985 { |
|
986 PRINT( _L("Start CCSRequestHandler::HandleDeleteConversation") ); |
|
987 |
|
988 TInt error = KErrNone; |
|
989 |
|
990 // perpare client conversation |
|
991 CCsClientConversation* clientConversation = NULL; |
|
992 RDesReadStream resultStream(aResultsBuffer->Des()); |
|
993 |
|
994 TRAP(error, |
|
995 resultStream.PushL(); |
|
996 clientConversation = CCsClientConversation::NewL(); |
|
997 CleanupStack::PushL(clientConversation); |
|
998 clientConversation->InternalizeL(resultStream); |
|
999 CleanupStack::Pop(clientConversation); |
|
1000 resultStream.Pop()); |
|
1001 |
|
1002 if ( error != KErrNone ) |
|
1003 { |
|
1004 // Ignore this conversation |
|
1005 } |
|
1006 |
|
1007 // Cleanup |
|
1008 resultStream.Close(); |
|
1009 |
|
1010 // Pass the results to the observer |
|
1011 if ( iConversationChangeObserver ) |
|
1012 { |
|
1013 MCsConversationChangeObserver* observer = |
|
1014 iConversationChangeObserver->ConversationChangeObserver(); |
|
1015 observer->DeleteConversation(*(clientConversation-> |
|
1016 GetConversationEntry())); |
|
1017 } |
|
1018 |
|
1019 delete clientConversation; |
|
1020 |
|
1021 PRINT( _L("End CCSRequestHandler::HandleDeleteConversation") ); |
|
1022 } |
|
1023 |
|
1024 // ----------------------------------------------------------------------------- |
|
1025 // CCSRequestHandler::HandleModifyConversation |
|
1026 // Process Modify conversation event received from server |
|
1027 // ----------------------------------------------------------------------------- |
|
1028 void CCSRequestHandler::HandleModifyConversation(HBufC8* aResultsBuffer) |
|
1029 { |
|
1030 PRINT( _L("Start CCSRequestHandler::HandleModifyConversation") ); |
|
1031 TInt error = KErrNone; |
|
1032 |
|
1033 // perpare client conversation |
|
1034 CCsClientConversation* clientConversation = NULL; |
|
1035 RDesReadStream resultStream(aResultsBuffer->Des()); |
|
1036 |
|
1037 TRAP(error, |
|
1038 resultStream.PushL(); |
|
1039 clientConversation = CCsClientConversation::NewL(); |
|
1040 CleanupStack::PushL(clientConversation); |
|
1041 // Parse the results |
|
1042 clientConversation->InternalizeL(resultStream); |
|
1043 CleanupStack::Pop(clientConversation); |
|
1044 resultStream.Pop()); |
|
1045 |
|
1046 if ( error != KErrNone ) |
|
1047 { |
|
1048 // Ignore this conversation |
|
1049 } |
|
1050 |
|
1051 // Cleanup |
|
1052 resultStream.Close(); |
|
1053 |
|
1054 // Pass the results to the observer |
|
1055 if ( iConversationChangeObserver ) |
|
1056 { |
|
1057 MCsConversationChangeObserver* observer = |
|
1058 iConversationChangeObserver->ConversationChangeObserver(); |
|
1059 observer->ModifyConversation(*(clientConversation-> |
|
1060 GetConversationEntry())); |
|
1061 } |
|
1062 |
|
1063 delete clientConversation; |
|
1064 |
|
1065 PRINT( _L("End CCSRequestHandler::HandleModifyConversation") ); |
|
1066 } |
|
1067 |
|
1068 // ----------------------------------------------------------------------------- |
|
1069 // CCSRequestHandler::HandleCachingStarted |
|
1070 // Process caching started event received from server |
|
1071 // ----------------------------------------------------------------------------- |
|
1072 void CCSRequestHandler::HandleCachingStarted(HBufC8* /*aResultsBuffer*/) |
|
1073 { |
|
1074 User::Leave(KErrNotSupported); |
|
1075 } |
|
1076 |
|
1077 // ----------------------------------------------------------------------------- |
|
1078 // CCSRequestHandler::HandleCachingCompleted |
|
1079 // Process caching completed event received from server |
|
1080 // ----------------------------------------------------------------------------- |
|
1081 void CCSRequestHandler::HandleCachingCompleted(HBufC8* /*aResultsBuffer*/) |
|
1082 { |
|
1083 User::Leave(KErrNotSupported); |
|
1084 } |
|
1085 |
|
1086 // ----------------------------------------------------------------------------- |
|
1087 // CCSRequestHandler::HandleCachingError |
|
1088 // Process caching error event received from server |
|
1089 // ----------------------------------------------------------------------------- |
|
1090 void CCSRequestHandler::HandleCachingError(HBufC8* /*aResultsBuffer*/) |
|
1091 { |
|
1092 User::Leave(KErrNotSupported); |
|
1093 } |
|
1094 |
|
1095 // ----------------------------------------------------------------------------- |
|
1096 // CCSRequestHandler::DeleteConversationL() |
|
1097 // ----------------------------------------------------------------------------- |
|
1098 EXPORT_C void CCSRequestHandler::DeleteConversationL(TInt aConversationId) |
|
1099 { |
|
1100 PRINT( _L("Enter CCSRequestHandler::DeleteConversationL") ); |
|
1101 iSession.DeleteConversationL(aConversationId); |
|
1102 PRINT( _L("End CCSRequestHandler::DeleteConversationL") ); |
|
1103 } |
|
1104 |
|
1105 // ----------------------------------------------------------------------------- |
|
1106 // CCSRequestHandler::HandleRefreshConversationList |
|
1107 // Process refresh from server |
|
1108 // ----------------------------------------------------------------------------- |
|
1109 void CCSRequestHandler::HandleRefreshConversationList(HBufC8* /*aResultsBuffer*/) |
|
1110 { |
|
1111 // Pass the results to the observer |
|
1112 if ( iConversationListChangeObserver ) |
|
1113 { |
|
1114 iConversationListChangeObserver->RefreshConversationList(); |
|
1115 } |
|
1116 } |
|
1117 |
|
1118 // ----------------------------------------------------------------------------- |
|
1119 // Ccsrequesthandler::HandleRefreshConversationList |
|
1120 // Process refresh from server |
|
1121 // ----------------------------------------------------------------------------- |
|
1122 void CCSRequestHandler::HandleRefreshConversation(HBufC8* /*aResultsBuffer*/) |
|
1123 { |
|
1124 // Pass the results to the observer |
|
1125 if ( iConversationChangeObserver ) |
|
1126 { |
|
1127 MCsConversationChangeObserver* observer = |
|
1128 iConversationChangeObserver->ConversationChangeObserver(); |
|
1129 observer->RefreshConversation(); |
|
1130 } |
|
1131 } |
|
1132 |
|
1133 // ----------------------------------------------------------------------------- |
|
1134 // CCSRequestHandler::GetConversationIdL() |
|
1135 // ----------------------------------------------------------------------------- |
|
1136 EXPORT_C TInt CCSRequestHandler::GetConversationIdL(TInt aContactId) |
|
1137 { |
|
1138 TInt conversationId = -1; |
|
1139 |
|
1140 // Create a buffer to store the results. |
|
1141 if(iResultsBuffer) |
|
1142 { |
|
1143 delete iResultsBuffer; |
|
1144 iResultsBuffer = NULL; |
|
1145 } |
|
1146 iResultsBuffer = HBufC8::NewL(KSmallIpcBuffer); |
|
1147 |
|
1148 // Send the request |
|
1149 iSession.GetConversationIdL(aContactId, iResultsBuffer->Des()); |
|
1150 |
|
1151 // Parse the results |
|
1152 RDesReadStream resultStream(iResultsBuffer->Des()); |
|
1153 resultStream.PushL(); |
|
1154 conversationId = resultStream.ReadInt32L(); |
|
1155 |
|
1156 // Cleanup |
|
1157 delete iResultsBuffer; |
|
1158 iResultsBuffer = NULL; |
|
1159 resultStream.Pop(); |
|
1160 resultStream.Close(); |
|
1161 |
|
1162 return conversationId; |
|
1163 } |
|
1164 |
|
1165 // ----------------------------------------------------------------------------- |
|
1166 // CCSRequestHandler::GetConversationIdFromAddressL() |
|
1167 // ----------------------------------------------------------------------------- |
|
1168 EXPORT_C TInt CCSRequestHandler::GetConversationIdFromAddressL(TDesC& aContactAddress) |
|
1169 { |
|
1170 TInt conversationId = -1; |
|
1171 |
|
1172 // Create a buffer to store the results. |
|
1173 if(iResultsBuffer) |
|
1174 { |
|
1175 delete iResultsBuffer; |
|
1176 iResultsBuffer = NULL; |
|
1177 } |
|
1178 iResultsBuffer = HBufC8::NewL(KSmallIpcBuffer); |
|
1179 |
|
1180 // Send the request |
|
1181 iSession.GetConversationIdFromAddressL(aContactAddress,iResultsBuffer->Des()); |
|
1182 |
|
1183 // Parse the results |
|
1184 RDesReadStream resultStream(iResultsBuffer->Des()); |
|
1185 resultStream.PushL(); |
|
1186 conversationId = resultStream.ReadInt32L(); |
|
1187 |
|
1188 // Cleanup |
|
1189 delete iResultsBuffer; |
|
1190 iResultsBuffer = NULL; |
|
1191 resultStream.Pop(); |
|
1192 resultStream.Close(); |
|
1193 |
|
1194 return conversationId; |
|
1195 } |
|
1196 // ----------------------------------------------------------------------------- |
|
1197 // CCSRequestHandler::GetMessagingHistoryL() |
|
1198 // ----------------------------------------------------------------------------- |
|
1199 EXPORT_C void CCSRequestHandler::GetMessagingHistoryL(TInt aContactId) |
|
1200 { |
|
1201 TInt conversationId = GetConversationIdL(aContactId); |
|
1202 if ( conversationId == -1 ) |
|
1203 User::Leave(KErrNotFound); |
|
1204 |
|
1205 CCsClientConversation* clientConversation = CCsClientConversation::NewL(); |
|
1206 clientConversation->SetConversationEntryId(conversationId); |
|
1207 //set dummy entry |
|
1208 CCsConversationEntry *entry = CCsConversationEntry::NewL(); |
|
1209 clientConversation->SetConversationEntryL(entry); |
|
1210 GetConversationsL(clientConversation); |
|
1211 |
|
1212 //delete |
|
1213 if ( clientConversation ) |
|
1214 delete clientConversation; |
|
1215 if( entry ) |
|
1216 delete entry; |
|
1217 |
|
1218 return; |
|
1219 } |
|
1220 |
|
1221 // ----------------------------------------------------------------------------- |
|
1222 // CCSRequestHandler::GetConversationIdL() |
|
1223 // ----------------------------------------------------------------------------- |
|
1224 EXPORT_C void CCSRequestHandler::ClearMessagingHistoryL(TInt aContactId) |
|
1225 { |
|
1226 TInt conversationId = GetConversationIdL(aContactId); |
|
1227 if ( conversationId == -1 ) |
|
1228 User::Leave(KErrNotFound); |
|
1229 |
|
1230 // Done in background |
|
1231 DeleteConversationL(conversationId); |
|
1232 return; |
|
1233 } |
|
1234 |
|
1235 // ----------------------------------------------------------------------------- |
|
1236 // CCSRequestHandler::MarkConversationReadL() |
|
1237 // ----------------------------------------------------------------------------- |
|
1238 EXPORT_C void CCSRequestHandler::MarkConversationReadL(TInt aConversationId) |
|
1239 { |
|
1240 iSession.MarkConversationReadL(aConversationId); |
|
1241 } |
|
1242 |
|
1243 // ----------------------------------------------------------------------------- |
|
1244 // CCSRequestHandler::MarkMessagingHistoryReadL() |
|
1245 // ----------------------------------------------------------------------------- |
|
1246 EXPORT_C void CCSRequestHandler::MarkMessagingHistoryReadL(TInt aContactId) |
|
1247 { |
|
1248 TInt conversationId = GetConversationIdL(aContactId); |
|
1249 if ( conversationId == -1 ) |
|
1250 User::Leave(KErrNotFound); |
|
1251 |
|
1252 MarkConversationReadL(conversationId); |
|
1253 return; |
|
1254 } |
|
1255 |
|
1256 // End of File |