29
|
1 |
/*
|
|
2 |
* Copyright (c) 2008 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: Class that capsulates single service data members
|
|
15 |
*
|
|
16 |
*/
|
|
17 |
|
|
18 |
|
|
19 |
// INCLUDES
|
|
20 |
#include "cvimpstengineimsubservice.h"
|
|
21 |
|
|
22 |
#include "cvimpstenginecchhandler.h"
|
|
23 |
#include "cvimpstengineservicetablefetcher.h"
|
|
24 |
#include "mvimpstengineimsubserviceeventobserver.h"
|
|
25 |
#include "mvimpstengineserviceconnectioneventobserver.h"
|
|
26 |
|
|
27 |
#include <e32std.h>
|
|
28 |
#include <barsc.h>
|
|
29 |
#include <gulutil.h>
|
|
30 |
#include <coemain.h>
|
|
31 |
#include <e32base.h>
|
|
32 |
|
|
33 |
#include "tvimpstconsts.h"
|
|
34 |
|
|
35 |
// imcache related headers
|
|
36 |
#include "cimcachefactory.h"
|
|
37 |
#include "mimcacheaccessor.h"
|
|
38 |
|
|
39 |
#include "uiservicetabtracer.h"
|
|
40 |
|
|
41 |
//system includes
|
|
42 |
#include <e32property.h>
|
|
43 |
|
|
44 |
// ================= MEMBER FUNCTIONS =======================
|
|
45 |
// ---------------------------------------------------------
|
|
46 |
// CVIMPSTEngineIMSubService::NewL
|
|
47 |
//
|
|
48 |
// ---------------------------------------------------------
|
|
49 |
CVIMPSTEngineIMSubService* CVIMPSTEngineIMSubService::NewL(
|
|
50 |
TUint aServiceId,
|
|
51 |
CVIMPSTEngineCchHandler& aCchHandler,
|
|
52 |
CVIMPSTEngineServiceTableFetcher& aTableFetcher,
|
|
53 |
MVIMPSTEngineServiceConnectionEventObserver& aObserver
|
|
54 |
)
|
|
55 |
{
|
|
56 |
TRACER_AUTO;
|
|
57 |
TRACE( "ServiceId: %d", aServiceId );
|
|
58 |
|
|
59 |
CVIMPSTEngineIMSubService* self = CVIMPSTEngineIMSubService::NewLC(
|
|
60 |
aServiceId,
|
|
61 |
aCchHandler,
|
|
62 |
aTableFetcher,
|
|
63 |
aObserver );
|
|
64 |
CleanupStack::Pop( self );
|
|
65 |
|
|
66 |
return self;
|
|
67 |
}
|
|
68 |
|
|
69 |
|
|
70 |
// ---------------------------------------------------------
|
|
71 |
// CVIMPSTEngineIMSubService::NewLC
|
|
72 |
//
|
|
73 |
// ---------------------------------------------------------
|
|
74 |
|
|
75 |
CVIMPSTEngineIMSubService* CVIMPSTEngineIMSubService::NewLC(
|
|
76 |
TUint aServiceId,
|
|
77 |
CVIMPSTEngineCchHandler& aCchHandler,
|
|
78 |
CVIMPSTEngineServiceTableFetcher& aTableFetcher,
|
|
79 |
MVIMPSTEngineServiceConnectionEventObserver& aObserver
|
|
80 |
)
|
|
81 |
{
|
|
82 |
TRACER_AUTO;
|
|
83 |
TRACE( "ServiceId: %d", aServiceId );
|
|
84 |
|
|
85 |
CVIMPSTEngineIMSubService* self = new (ELeave) CVIMPSTEngineIMSubService(aServiceId,
|
|
86 |
aCchHandler, aTableFetcher,
|
|
87 |
aObserver );
|
|
88 |
CleanupStack::PushL( self );
|
|
89 |
self->ConstructL();
|
|
90 |
|
|
91 |
return self;
|
|
92 |
}
|
|
93 |
|
|
94 |
// ---------------------------------------------------------
|
|
95 |
// CVIMPSTEngineIMSubService::~CVIMPSTEngineIMSubService
|
|
96 |
//
|
|
97 |
// ---------------------------------------------------------
|
|
98 |
|
|
99 |
CVIMPSTEngineIMSubService::~CVIMPSTEngineIMSubService()
|
|
100 |
{
|
|
101 |
TRACER_AUTO;
|
|
102 |
|
|
103 |
iChatObserver.Reset();
|
|
104 |
iChatObserver.Close();
|
|
105 |
|
|
106 |
iCchHandler.UnRegisterCchObserver(ECCHIMSub);
|
|
107 |
|
|
108 |
ReleaseIMCacheAccessor();
|
|
109 |
|
|
110 |
}
|
|
111 |
|
|
112 |
|
|
113 |
// ---------------------------------------------------------
|
|
114 |
// CVIMPSTEngineIMSubService::ConstructL
|
|
115 |
//
|
|
116 |
// ---------------------------------------------------------
|
|
117 |
|
|
118 |
void CVIMPSTEngineIMSubService::ConstructL()
|
|
119 |
{
|
|
120 |
|
|
121 |
TRACER_AUTO;
|
|
122 |
TCCHSubserviceState serviceState = ECCHUninitialized;
|
|
123 |
TInt error = iCchHandler.GetServiceState(
|
|
124 |
iServiceId, ECCHIMSub, serviceState );
|
|
125 |
|
|
126 |
iServiceState = ResolveServiceStateL(serviceState, error);
|
|
127 |
|
|
128 |
iCchHandler.RegisterCchObserverL(this,ECCHIMSub);
|
|
129 |
|
|
130 |
TRACE( "ResolveServiceStateL returned ServiceState: %d", iServiceState );
|
|
131 |
|
|
132 |
|
|
133 |
}
|
|
134 |
|
|
135 |
|
|
136 |
// ---------------------------------------------------------
|
|
137 |
// CVIMPSTEngineIMSubService::CVIMPSTEngine
|
|
138 |
//
|
|
139 |
// ---------------------------------------------------------
|
|
140 |
|
|
141 |
CVIMPSTEngineIMSubService::CVIMPSTEngineIMSubService( TUint aServiceId,
|
|
142 |
CVIMPSTEngineCchHandler& aCchHandler,
|
|
143 |
CVIMPSTEngineServiceTableFetcher& aTableFetcher,
|
|
144 |
MVIMPSTEngineServiceConnectionEventObserver& aObserver) :
|
|
145 |
iServiceId(aServiceId),
|
|
146 |
iCchHandler(aCchHandler),
|
|
147 |
iTableFetcher(aTableFetcher),
|
|
148 |
iObserver(aObserver),
|
|
149 |
iType (TVIMPSTEnums::EIM)
|
|
150 |
{
|
|
151 |
}
|
|
152 |
|
|
153 |
|
|
154 |
|
|
155 |
|
|
156 |
|
|
157 |
// ---------------------------------------------------------
|
|
158 |
// CVIMPSTEngineIMSubService::RegisterChatObserver
|
|
159 |
//
|
|
160 |
// ---------------------------------------------------------
|
|
161 |
|
|
162 |
void CVIMPSTEngineIMSubService::RegisterChatObserver(MVIMPSTEngineIMSubServiceEventObserver* aObserver)
|
|
163 |
{
|
|
164 |
TRACER_AUTO;
|
|
165 |
if (aObserver)
|
|
166 |
{
|
|
167 |
TInt index = iChatObserver.Find(aObserver);
|
|
168 |
if( index == KErrNotFound )
|
|
169 |
{
|
|
170 |
iChatObserver.Append( aObserver );
|
|
171 |
}
|
|
172 |
}
|
|
173 |
|
|
174 |
}
|
|
175 |
|
|
176 |
// ---------------------------------------------------------
|
|
177 |
// CVIMPSTEngineIMSubService::UnRegisterChatObserver
|
|
178 |
//
|
|
179 |
// ---------------------------------------------------------
|
|
180 |
|
|
181 |
void CVIMPSTEngineIMSubService::UnRegisterChatObserver(MVIMPSTEngineIMSubServiceEventObserver* aObserver)
|
|
182 |
{
|
|
183 |
TRACER_AUTO;
|
|
184 |
|
|
185 |
if (aObserver)
|
|
186 |
{
|
|
187 |
|
|
188 |
TInt index = iChatObserver.Find(aObserver);
|
|
189 |
|
|
190 |
if( index >=0 )
|
|
191 |
{
|
|
192 |
iChatObserver.Remove( index );
|
|
193 |
iChatObserver.Compress();
|
|
194 |
}
|
|
195 |
|
|
196 |
|
|
197 |
}
|
|
198 |
|
|
199 |
}
|
|
200 |
//-----------------------------------------------------------------------------
|
|
201 |
//-----------------------------------------------------------------------------
|
|
202 |
// CVIMPSTEngineIMSubService::HandleIMCacheEventL
|
|
203 |
// ( Other items commented in header )
|
|
204 |
//-----------------------------------------------------------------------------
|
|
205 |
|
|
206 |
void CVIMPSTEngineIMSubService::HandleIMCacheEventL(TIMCacheEventType aEventType, TAny* aChatMessage )
|
|
207 |
{
|
|
208 |
TRACER_AUTO;
|
|
209 |
TRACE( "TIMCacheEventType: %d", aEventType );
|
|
210 |
|
|
211 |
switch( aEventType )
|
|
212 |
{
|
|
213 |
case EIMCacheUnreadMessage :
|
|
214 |
{
|
|
215 |
if (!aChatMessage)
|
|
216 |
{
|
|
217 |
return;
|
|
218 |
}
|
|
219 |
SIMCacheMessageData* chatData = static_cast<SIMCacheMessageData*>( aChatMessage ) ;
|
|
220 |
// check that buddy id exists
|
|
221 |
if ( chatData->iBuddyId )
|
|
222 |
{
|
|
223 |
TPtrC buddyId = chatData->iBuddyId->Des();
|
|
224 |
TRACE( "EIMCacheUnreadMessage for %S", &buddyId );
|
|
225 |
NotifyObserversL(TVIMPSTEnums::EIMUnreadMessage,buddyId);
|
|
226 |
}
|
|
227 |
break;
|
|
228 |
}
|
|
229 |
case EIMCacheUnreadChange :
|
|
230 |
{
|
|
231 |
TRACE( "EIMCacheUnreadChange");
|
|
232 |
if (!aChatMessage)
|
|
233 |
{
|
|
234 |
return;
|
|
235 |
}
|
|
236 |
SIMCacheChatItem* chatItem = static_cast<SIMCacheChatItem*>( aChatMessage ) ;
|
|
237 |
if( iServiceId != chatItem->iServiceId )
|
|
238 |
{
|
|
239 |
return;
|
|
240 |
}
|
|
241 |
TPtrC buddyId = chatItem->iBuddyId->Des();
|
|
242 |
TRACE( "EIMCacheChatClosed for %S", &buddyId );
|
|
243 |
NotifyObserversL(TVIMPSTEnums::EIMUnreadChange, buddyId ); // ETrue for Closed conversation
|
|
244 |
break;
|
|
245 |
}
|
|
246 |
case EIMCacheChatStarted :
|
|
247 |
{
|
|
248 |
if (!aChatMessage)
|
|
249 |
{
|
|
250 |
return;
|
|
251 |
}
|
|
252 |
SIMCacheChatItem* chatItem = static_cast<SIMCacheChatItem*>( aChatMessage ) ;
|
|
253 |
if( iServiceId != chatItem->iServiceId )
|
|
254 |
{
|
|
255 |
return;
|
|
256 |
}
|
|
257 |
TPtrC buddyId = chatItem->iBuddyId->Des();
|
|
258 |
TRACE("EIMCacheChatClosed for %S", &buddyId );
|
|
259 |
NotifyObserversL(TVIMPSTEnums::EIMChatStarted, buddyId ); // ETrue for Closed conversation
|
|
260 |
break;
|
|
261 |
}
|
|
262 |
case EIMCacheChatClosed:
|
|
263 |
{
|
|
264 |
if (!aChatMessage)
|
|
265 |
{
|
|
266 |
return;
|
|
267 |
}
|
|
268 |
SIMCacheChatItem* chatItem = static_cast<SIMCacheChatItem*>( aChatMessage ) ;
|
|
269 |
if( iServiceId != chatItem->iServiceId )
|
|
270 |
{
|
|
271 |
return;
|
|
272 |
}
|
|
273 |
TPtrC buddyId = chatItem->iBuddyId->Des();
|
|
274 |
TRACE( "EIMCacheChatClosed for %S", &buddyId );
|
|
275 |
NotifyObserversL(TVIMPSTEnums::EIMChatClosed, buddyId );
|
|
276 |
break;
|
|
277 |
}
|
|
278 |
case EIMCacheAllChatClosed:
|
|
279 |
{
|
|
280 |
NotifyObserversL(TVIMPSTEnums::EIMAllChatClosed, KNullDesC );
|
|
281 |
break;
|
|
282 |
}
|
|
283 |
case EIMCacheRequestCompleted:
|
|
284 |
{
|
|
285 |
NotifyObserversL(TVIMPSTEnums::EIMRequestCompleted, KNullDesC );
|
|
286 |
break;
|
|
287 |
}
|
|
288 |
default:
|
|
289 |
{
|
|
290 |
break;
|
|
291 |
}
|
|
292 |
}
|
|
293 |
|
|
294 |
|
|
295 |
}
|
|
296 |
|
|
297 |
//-----------------------------------------------------------------------------
|
|
298 |
// CVIMPSTEngineIMSubService::GetUnreadCountL
|
|
299 |
// ( Other items commented in header )
|
|
300 |
//-----------------------------------------------------------------------------
|
|
301 |
TInt CVIMPSTEngineIMSubService::GetUnreadCountL(const TDesC& aBuddyId )
|
|
302 |
{
|
|
303 |
TRACER_AUTO;
|
|
304 |
TRACE( " ServiceId: %d BuddyId: %S", iServiceId, &aBuddyId );
|
|
305 |
|
|
306 |
TInt count = 0;
|
|
307 |
if( iIMCacheAccessor )
|
|
308 |
{
|
|
309 |
count = iIMCacheAccessor->GetUnreadMessageCountL(aBuddyId);
|
|
310 |
TRACE( "iIMCacheAccessor returns with %d", count );
|
|
311 |
}
|
|
312 |
|
|
313 |
return count;
|
|
314 |
}
|
|
315 |
|
|
316 |
|
|
317 |
// ---------------------------------------------------------
|
|
318 |
// CVIMPSTEngineIMSubService::SubServiceState
|
|
319 |
// ---------------------------------------------------------------------------
|
|
320 |
//
|
|
321 |
TVIMPSTEnums::TVIMPSTRegistrationState CVIMPSTEngineIMSubService::SubServiceState() const
|
|
322 |
{
|
|
323 |
TRACER_AUTO;
|
|
324 |
TRACE( "ServiceId: %d ServiceState: %d",iServiceId, iServiceState );
|
|
325 |
return iServiceState;
|
|
326 |
}
|
|
327 |
|
|
328 |
|
|
329 |
|
|
330 |
//-----------------------------------------------------------------------------
|
|
331 |
// CVIMPSTEngineIMSubService::IsConversationExistL
|
|
332 |
// ( Other items commented in header )
|
|
333 |
//-----------------------------------------------------------------------------
|
|
334 |
TBool CVIMPSTEngineIMSubService::IsConversationExistL(const TDesC& aBuddyId) const
|
|
335 |
{
|
|
336 |
TRACER_AUTO;
|
|
337 |
TRACE( "Buddy Id : %S", &aBuddyId );
|
|
338 |
|
|
339 |
TInt exist = EFalse;
|
|
340 |
|
|
341 |
if( iIMCacheAccessor )
|
|
342 |
{
|
|
343 |
exist = iIMCacheAccessor->IsConversationExistL( aBuddyId );
|
|
344 |
TRACE( "iIMCacheAccessor returns with %d", exist );
|
|
345 |
}
|
|
346 |
|
|
347 |
TRACE( "Exist: %d", exist );
|
|
348 |
return exist;
|
|
349 |
}
|
|
350 |
|
|
351 |
//-----------------------------------------------------------------------------
|
|
352 |
// CVIMPSTEngineIMSubService::CloseConversationL
|
|
353 |
// ( Other items commented in header )
|
|
354 |
//-----------------------------------------------------------------------------
|
|
355 |
void CVIMPSTEngineIMSubService::CloseConversationL( const TDesC& aContactId )
|
|
356 |
{
|
|
357 |
TRACER_AUTO;
|
|
358 |
TRACE( "Buddy Id : %S", &aContactId );
|
|
359 |
|
|
360 |
if( IsConversationExistL(aContactId) )
|
|
361 |
{
|
|
362 |
TRACE( "iIMCacheAccessor CloseConversationL to be called" );
|
|
363 |
iIMCacheAccessor->CloseConversationL( aContactId );
|
|
364 |
TRACE( "iIMCacheAccessor CloseConversationL Done" );
|
|
365 |
}
|
|
366 |
|
|
367 |
}
|
|
368 |
//-----------------------------------------------------------------------------
|
|
369 |
// CVIMPSTEngineIMSubService::GetOpenChatListL
|
|
370 |
// ( Other items commented in header )
|
|
371 |
//-----------------------------------------------------------------------------
|
|
372 |
RArray<SIMCacheChatItem> CVIMPSTEngineIMSubService::GetOpenChatListL()
|
|
373 |
{
|
|
374 |
TRACER_AUTO;
|
|
375 |
RArray<SIMCacheChatItem> item;
|
|
376 |
if(iIMCacheAccessor)
|
|
377 |
{
|
|
378 |
item = iIMCacheAccessor->GetChatListL( iServiceId );
|
|
379 |
}
|
|
380 |
return item;
|
|
381 |
}
|
|
382 |
|
|
383 |
// ---------------------------------------------------------------------------
|
|
384 |
// CVIMPSTEngineIMSubService::ResolveServiceStateL
|
|
385 |
// ---------------------------------------------------------------------------
|
|
386 |
//
|
|
387 |
TVIMPSTEnums::TVIMPSTRegistrationState CVIMPSTEngineIMSubService::ResolveServiceStateL(
|
|
388 |
TCCHSubserviceState aState,
|
|
389 |
TInt aServiceError )
|
|
390 |
{
|
|
391 |
TRACER_AUTO;
|
|
392 |
|
|
393 |
TVIMPSTEnums::TVIMPSTRegistrationState state = TVIMPSTEnums::ESVCENotRegistered;
|
|
394 |
|
|
395 |
|
|
396 |
TRACE( "iServiceId: %d, ServiceState: %d", iServiceId, aState );
|
|
397 |
|
|
398 |
TBool handleServiceStates = ETrue;
|
|
399 |
if ( aServiceError && ECCHDisabled != aState )
|
|
400 |
{
|
|
401 |
//Only if the Service supports ALR, the state can goto WaitingForNetwork
|
|
402 |
//Still API from CCH is required to know whether ALR is supported or not
|
|
403 |
if ( (KCCHErrorInvalidSettings != aServiceError) && (ECCHConnecting == aState) )
|
|
404 |
{
|
|
405 |
TRACE("ESVCEWaitingForNetwork" );
|
|
406 |
handleServiceStates = EFalse;
|
|
407 |
state = TVIMPSTEnums::ESVCEWaitingForNetwork;
|
|
408 |
}
|
|
409 |
}
|
|
410 |
|
|
411 |
if ( handleServiceStates )
|
|
412 |
{
|
|
413 |
switch ( aState )
|
|
414 |
{
|
|
415 |
case ECCHEnabled:
|
|
416 |
{
|
|
417 |
TRACE( "ESVCERegistered" );
|
|
418 |
CreateIMCacheAccessorL();
|
|
419 |
state = TVIMPSTEnums::ESVCERegistered;
|
|
420 |
}
|
|
421 |
break;
|
|
422 |
|
|
423 |
case ECCHDisconnecting:
|
|
424 |
{
|
|
425 |
TRACE( "ESVCENetworkDisConnecting" );
|
|
426 |
state = TVIMPSTEnums::ESVCENetworkDisConnecting;
|
|
427 |
}
|
|
428 |
break;
|
|
429 |
|
|
430 |
case ECCHUninitialized:
|
|
431 |
case ECCHDisabled:
|
|
432 |
{
|
|
433 |
TRACE( "ESVCENotRegistered" );
|
|
434 |
ReleaseIMCacheAccessor();
|
|
435 |
state = TVIMPSTEnums::ESVCENotRegistered;
|
|
436 |
}
|
|
437 |
break;
|
|
438 |
|
|
439 |
case ECCHConnecting:
|
|
440 |
{
|
|
441 |
TRACE( "ESVCENetworkConnecting" );
|
|
442 |
state = TVIMPSTEnums::ESVCENetworkConnecting;
|
|
443 |
}
|
|
444 |
break;
|
|
445 |
|
|
446 |
default:
|
|
447 |
break;
|
|
448 |
}
|
|
449 |
}
|
|
450 |
|
|
451 |
|
|
452 |
return state;
|
|
453 |
|
|
454 |
}
|
|
455 |
|
|
456 |
|
|
457 |
// ---------------------------------------------------------------------------
|
|
458 |
// CVIMPSTEngineIMSubService::Type
|
|
459 |
// ---------------------------------------------------------------------------
|
|
460 |
//
|
|
461 |
TVIMPSTEnums::SubServiceType CVIMPSTEngineIMSubService::Type() const
|
|
462 |
{
|
|
463 |
TRACER_AUTO;
|
|
464 |
TRACE("SubServiceType() Type : %d", iType );
|
|
465 |
TRACE("CVIMPSTEngineIMSubService: [0x%x]", this );
|
|
466 |
return iType;
|
|
467 |
}
|
|
468 |
|
|
469 |
|
|
470 |
|
|
471 |
// ---------------------------------------------------------------------------
|
|
472 |
// CVIMPSTEngineIMSubService::CchEventOccuredL
|
|
473 |
// ---------------------------------------------------------------------------
|
|
474 |
//
|
|
475 |
void CVIMPSTEngineIMSubService::CchEventOccuredL(
|
|
476 |
TUint /*aServiceId*/,
|
|
477 |
TCCHSubserviceState aState,
|
|
478 |
TInt aServiceError )
|
|
479 |
{
|
|
480 |
TRACER_AUTO;
|
|
481 |
TRACE( "TCCHSubserviceState : %d, ServiceErr: %d", aState, aServiceError );
|
|
482 |
|
|
483 |
if ( aServiceError && ECCHDisabled != aState )
|
|
484 |
{
|
|
485 |
//we might even end up in waiting for connection state for all
|
|
486 |
//those service which are ALR enabled
|
|
487 |
//So better check here if you get any CCH errors
|
|
488 |
iServiceState = ResolveServiceStateL( aState, aServiceError );
|
|
489 |
iObserver.HandleServceConnectionEventL();
|
|
490 |
DoHandleCchErrorL( aServiceError );
|
|
491 |
}
|
|
492 |
else
|
|
493 |
{
|
|
494 |
iServiceState = ResolveServiceStateL( aState, aServiceError );
|
|
495 |
iObserver.HandleServceConnectionEventL();
|
|
496 |
}
|
|
497 |
|
|
498 |
|
|
499 |
}
|
|
500 |
|
|
501 |
|
|
502 |
// ---------------------------------------------------------------------------
|
|
503 |
// CVIMPSTEngineIMSubService::DoHandleCchErrorL()
|
|
504 |
// ---------------------------------------------------------------------------
|
|
505 |
//
|
|
506 |
void CVIMPSTEngineIMSubService::DoHandleCchErrorL(
|
|
507 |
TInt aServiceError )
|
|
508 |
{
|
|
509 |
TRACER_AUTO;
|
|
510 |
TRACE( "ServiceErr: %d", aServiceError );
|
|
511 |
|
|
512 |
switch ( aServiceError )
|
|
513 |
{
|
|
514 |
case KCCHErrorNetworkLost:
|
|
515 |
case KCCHErrorBandwidthInsufficient:
|
|
516 |
case KCCHErrorInvalidIap:
|
|
517 |
{
|
|
518 |
//Should be fwded to CCHUI to show the appropriate Notes
|
|
519 |
//TBD
|
|
520 |
}
|
|
521 |
break;
|
|
522 |
|
|
523 |
case KCCHErrorAuthenticationFailed:
|
|
524 |
{
|
|
525 |
//Should be fwded to CCHUI to show the appropriate Notes
|
|
526 |
//TBD
|
|
527 |
}
|
|
528 |
break;
|
|
529 |
|
|
530 |
case KCCHErrorLoginFailed:
|
|
531 |
case KCCHErrorServiceNotResponding:
|
|
532 |
{
|
|
533 |
//Should be fwded to CCHUI to show the appropriate Notes
|
|
534 |
//TBD
|
|
535 |
}
|
|
536 |
break;
|
|
537 |
|
|
538 |
case KCCHErrorInvalidSettings:
|
|
539 |
{
|
|
540 |
//Should be fwded to CCHUI to show the appropriate Notes
|
|
541 |
//TBD
|
|
542 |
}
|
|
543 |
break;
|
|
544 |
|
|
545 |
case KCCHErrorAccessPointNotDefined:
|
|
546 |
{
|
|
547 |
//Should be fwded to CCHUI to show the appropriate Notes
|
|
548 |
//TBD
|
|
549 |
}
|
|
550 |
break;
|
|
551 |
|
|
552 |
default:
|
|
553 |
{
|
|
554 |
//Should be fwded to CCHUI to show the appropriate Notes
|
|
555 |
//TBD
|
|
556 |
}
|
|
557 |
break;
|
|
558 |
}
|
|
559 |
|
|
560 |
|
|
561 |
}
|
|
562 |
|
|
563 |
|
|
564 |
// ---------------------------------------------------------------------------
|
|
565 |
// CVIMPSTEngineIMSubService::CreateIMCacheAccessorL()
|
|
566 |
// ---------------------------------------------------------------------------
|
|
567 |
//
|
|
568 |
void CVIMPSTEngineIMSubService::CreateIMCacheAccessorL()
|
|
569 |
{
|
|
570 |
TRACER_AUTO;
|
|
571 |
if (!iIMCacheFactory)
|
|
572 |
{
|
|
573 |
HBufC* ownData = iCchHandler.GetConParametersL(ECchUsername);//
|
|
574 |
CleanupStack::PushL(ownData);
|
|
575 |
TPtr ownDataPtr = ownData->Des();
|
|
576 |
TRACE( "ServiceErr: %S",&ownDataPtr );
|
|
577 |
// im cache factory
|
|
578 |
iIMCacheFactory = CIMCacheFactory::InstanceL();
|
|
579 |
|
|
580 |
// im cache update interface
|
|
581 |
if (!iIMCacheAccessor)
|
|
582 |
{
|
|
583 |
iIMCacheAccessor = iIMCacheFactory->CreateAccessorL(iServiceId, *ownData );
|
|
584 |
|
|
585 |
iIMCacheAccessor->RegisterObserverL(*this);
|
|
586 |
}
|
|
587 |
|
|
588 |
CleanupStack::PopAndDestroy(ownData);
|
|
589 |
}
|
|
590 |
}
|
|
591 |
|
|
592 |
// ---------------------------------------------------------------------------
|
|
593 |
// CVIMPSTEngineIMSubService::ReleaseIMCacheAccessor()
|
|
594 |
// ---------------------------------------------------------------------------
|
|
595 |
//
|
|
596 |
void CVIMPSTEngineIMSubService::ReleaseIMCacheAccessor()
|
|
597 |
{
|
|
598 |
TRACER_AUTO;
|
|
599 |
|
|
600 |
if( iIMCacheAccessor )
|
|
601 |
{
|
|
602 |
iIMCacheAccessor->UnRegisterObserver(*this);
|
|
603 |
}
|
|
604 |
|
|
605 |
if( iIMCacheFactory )
|
|
606 |
{
|
|
607 |
CIMCacheFactory::Release();
|
|
608 |
iIMCacheAccessor = NULL;
|
|
609 |
iIMCacheFactory = NULL;
|
|
610 |
}
|
|
611 |
|
|
612 |
}
|
|
613 |
|
|
614 |
|
|
615 |
// ---------------------------------------------------------------------------
|
|
616 |
// CVIMPSTEngineIMSubService::NotifyObserversL()
|
|
617 |
// ---------------------------------------------------------------------------
|
|
618 |
//
|
|
619 |
void CVIMPSTEngineIMSubService::NotifyObserversL( TVIMPSTEnums::TIMEventType aEventType ,const TDesC& aBuddyId )
|
|
620 |
{
|
|
621 |
TRACER_AUTO;
|
|
622 |
TInt count = iChatObserver.Count();
|
|
623 |
for (TInt index=0; index<count; index++)
|
|
624 |
{
|
|
625 |
iChatObserver[index]->HandleChatMessageEventL(aEventType ,aBuddyId );
|
|
626 |
}
|
|
627 |
}
|
|
628 |
|
|
629 |
// End of File
|
|
630 |
|