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: Implementation for CVIMPSTEngineSessionCntxtObserver |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #include "cvimpstenginesessioncntxtobserver.h" |
|
20 |
|
21 |
|
22 |
|
23 #include "tvimpstenums.h" |
|
24 #include "cvimpstenginerequestmapper.h" |
|
25 #include "cvimpstenginerequest.h" |
|
26 #include "mvimpstenginesearchextentioneventobserver.h" |
|
27 #include "mvimpstenginesessioncntxtobserver.h" |
|
28 //ximpfw |
|
29 #include <presencegrantrequestinfo.h> |
|
30 #include <presentitygroupcontentevent.h> |
|
31 #include <ximpcontext.h> |
|
32 #include <presenceinfofilter.h> |
|
33 #include <presencefeatures.h> |
|
34 #include <presenceobjectfactory.h> |
|
35 #include <presenceinfo.h> |
|
36 #include <presenceauthorization.h> |
|
37 #include <ximpidentity.h> |
|
38 #include <ximpobjectfactory.h> |
|
39 #include <searchinfo.h> |
|
40 #include <searchevent.h> |
|
41 #include <ximpclient.h> |
|
42 #include <ximpidentity.h> |
|
43 #include <ximpstatus.h> |
|
44 #include <ximpcontextstateevent.h> |
|
45 #include <ximprequestcompleteevent.h> |
|
46 #include <presentitypresenceevent.h> |
|
47 #include <presenceblocklistevent.h> |
|
48 #include <presencegrantrequestlistevent.h> |
|
49 #include <ximpcontextstate.h> |
|
50 #include <searchelement.h> |
|
51 #include <searchkeysevent.h> |
|
52 #include <searchkeyinfo.h> |
|
53 #include <ximpfeatureinfo.h> |
|
54 |
|
55 #include "uiservicetabtracer.h" |
|
56 |
|
57 //xmppsettings |
|
58 #include "xmppparams.h" |
|
59 #include "xmppservicesettingsapi.h" |
|
60 |
|
61 |
|
62 // ============================ MEMBER FUNCTIONS ============================== |
|
63 |
|
64 // --------------------------------------------------------- |
|
65 // CVIMPSTEngineSessionCntxtObserver::NewL |
|
66 // two phase construction |
|
67 // --------------------------------------------------------- |
|
68 CVIMPSTEngineSessionCntxtObserver* CVIMPSTEngineSessionCntxtObserver::NewL( TUint32 aServiceId ) |
|
69 { |
|
70 TRACER_AUTO; |
|
71 CVIMPSTEngineSessionCntxtObserver* self = |
|
72 CVIMPSTEngineSessionCntxtObserver::NewLC( aServiceId); |
|
73 CleanupStack::Pop( self ); |
|
74 return self; |
|
75 } |
|
76 |
|
77 // --------------------------------------------------------- |
|
78 // CVIMPSTEngineSessionCntxtObserver::NewLC |
|
79 // two phase construction |
|
80 // --------------------------------------------------------- |
|
81 CVIMPSTEngineSessionCntxtObserver* CVIMPSTEngineSessionCntxtObserver::NewLC(TUint32 aServiceId) |
|
82 { |
|
83 TRACER_AUTO; |
|
84 CVIMPSTEngineSessionCntxtObserver* self = new |
|
85 (ELeave) CVIMPSTEngineSessionCntxtObserver( aServiceId); |
|
86 CleanupStack::PushL( self ); |
|
87 self->ConstructL(); |
|
88 return self; |
|
89 } |
|
90 |
|
91 // --------------------------------------------------------- |
|
92 // CVIMPSTEngineSessionCntxtObserver::ConstructL |
|
93 // two phase construction |
|
94 // --------------------------------------------------------- |
|
95 void CVIMPSTEngineSessionCntxtObserver::ConstructL() |
|
96 { |
|
97 TRACER_AUTO; |
|
98 iRequestMapper = CVIMPSTEngineRequestMapper::NewL(); |
|
99 iReqResult = KErrNone; |
|
100 iClient = MXIMPClient::NewClientL(); |
|
101 //Create new sink to receive ximp context events |
|
102 iPresenceCtx = iClient->NewPresenceContextLC(); |
|
103 // ignore code scanner warning, it gives panic |
|
104 CleanupStack::Pop();// because of LC method |
|
105 |
|
106 iFeatures = MPresenceFeatures::NewL(iPresenceCtx); |
|
107 |
|
108 //Stores the XIMPFw EventTypes Subscribed for |
|
109 iAcceptedEventTypes.Reset(); |
|
110 iAcceptedEventTypes.AppendL( MXIMPRequestCompleteEvent::KInterfaceId ); |
|
111 iAcceptedEventTypes.AppendL( MXIMPContextStateEvent::KInterfaceId ); |
|
112 iAcceptedEventTypes.AppendL( MPresentityGroupContentEvent::KInterfaceId ); |
|
113 iAcceptedEventTypes.AppendL( MPresenceGrantRequestListEvent::KInterfaceId ); |
|
114 iAcceptedEventTypes.AppendL( MSearchEvent::KInterfaceId ); |
|
115 iAcceptedEventTypes.AppendL( MSearchKeysEvent::KInterfaceId ); |
|
116 iAcceptedEventTypes.AppendL( MPresenceBlockListEvent::KInterfaceId ); |
|
117 |
|
118 TArray< TInt32 > eventFilterArray = iAcceptedEventTypes.Array(); |
|
119 |
|
120 // register this to prsence context |
|
121 iPresenceCtx->RegisterObserverL( *this, &eventFilterArray ); |
|
122 |
|
123 } |
|
124 |
|
125 // --------------------------------------------------------- |
|
126 // CVIMPSTEngineSessionCntxtObserver::~CVIMPSTEngineSessionCntxtObserver |
|
127 // destructor |
|
128 // --------------------------------------------------------- |
|
129 CVIMPSTEngineSessionCntxtObserver::~CVIMPSTEngineSessionCntxtObserver() |
|
130 { |
|
131 TRACER_AUTO; |
|
132 iObserverArray.Reset(); |
|
133 iObserverArray.Close(); |
|
134 |
|
135 iAcceptedEventTypes.Reset(); |
|
136 iAcceptedEventTypes.Close(); |
|
137 delete iFeatures; |
|
138 |
|
139 if(iPresenceCtx) |
|
140 { |
|
141 iPresenceCtx->UnregisterObserver( *this ); |
|
142 delete iPresenceCtx; |
|
143 } |
|
144 |
|
145 delete iClient; |
|
146 delete iRequestMapper; |
|
147 } |
|
148 |
|
149 // --------------------------------------------------------- |
|
150 // CVIMPSTEngineSessionCntxtObserver::CVIMPSTEngineSessionCntxtObserver |
|
151 // --------------------------------------------------------- |
|
152 CVIMPSTEngineSessionCntxtObserver::CVIMPSTEngineSessionCntxtObserver(TUint32 aServiceId) |
|
153 :iServiceId(aServiceId), |
|
154 iBindStatus( TVIMPSTEnums::EVIMPSTBindNotDone ) |
|
155 { |
|
156 } |
|
157 |
|
158 // =========================================================================== |
|
159 // FROM MPRFWximpCONTEXTOBSERVER |
|
160 // =========================================================================== |
|
161 // |
|
162 // --------------------------------------------------------- |
|
163 // CVIMPSTEngineSessionCntxtObserver::HandlePresenceContextEvent |
|
164 // --------------------------------------------------------- |
|
165 void CVIMPSTEngineSessionCntxtObserver::HandlePresenceContextEvent( |
|
166 const MXIMPContext& aContext, |
|
167 const MXIMPBase& aEvent ) |
|
168 { |
|
169 TRACER_AUTO; |
|
170 TRAP_IGNORE(DoHandlePresenceContextEventL( aContext, aEvent )); |
|
171 } |
|
172 |
|
173 |
|
174 // --------------------------------------------------------- |
|
175 // CVIMPSTEngineSessionCntxtObserver::GetCompletedReqResult |
|
176 // |
|
177 // --------------------------------------------------------- |
|
178 TInt CVIMPSTEngineSessionCntxtObserver::GetCompletedReqResult() const |
|
179 { |
|
180 return iReqResult; |
|
181 } |
|
182 |
|
183 // --------------------------------------------------------- |
|
184 // CVIMPSTEngineSessionCntxtObserver::CVIMPSTEngineSessionCntxtObserver |
|
185 // |
|
186 // --------------------------------------------------------- |
|
187 CVIMPSTEngineRequestMapper* CVIMPSTEngineSessionCntxtObserver:: |
|
188 GetRequestMapper() const |
|
189 { |
|
190 return iRequestMapper; |
|
191 } |
|
192 |
|
193 |
|
194 // --------------------------------------------------------- |
|
195 // CVIMPSTEngineSessionCntxtObserver::ContextBindStatus |
|
196 // |
|
197 // --------------------------------------------------------- |
|
198 TVIMPSTEnums::TVIMPSTBindStatus CVIMPSTEngineSessionCntxtObserver::ContextBindStatus() |
|
199 { |
|
200 return iBindStatus; |
|
201 } |
|
202 // --------------------------------------------------------------------------- |
|
203 // CVIMPSTEngineSessionCntxtObserver::ServerBindL |
|
204 // --------------------------------------------------------------------------- |
|
205 // |
|
206 TInt CVIMPSTEngineSessionCntxtObserver::ServerBindL(TUid aProtocolUid) |
|
207 { |
|
208 TRACER_AUTO; |
|
209 TInt err = KErrNotFound; |
|
210 //Bind context to desired presence service |
|
211 if ( TVIMPSTEnums::EVIMPSTBindDone != iBindStatus ) |
|
212 { |
|
213 TXIMPRequestId operationId = TXIMPRequestId::Null(); |
|
214 TRAP( err, operationId = iPresenceCtx->BindToL( |
|
215 aProtocolUid, iServiceId ) ); |
|
216 if ( err ) |
|
217 { |
|
218 // XIMP queues all operations except bind operation. If there is |
|
219 // unbind operation pending in ximp side, bind call will leave |
|
220 // with KErrAlreadyExists. Client side is not ideal place to |
|
221 // handle this type of logic so to work around this problem, this |
|
222 // case is flagged here. When unbind completes, rebind is done. |
|
223 // If unbind is called between these operations, flag is set |
|
224 // ESVCEPresenceBindNotDone to avoid bind if service was disabled |
|
225 TRACE( "err: %d", err); |
|
226 iBindStatus = TVIMPSTEnums::EVIMPSTBindFailureMode; |
|
227 } |
|
228 else |
|
229 { |
|
230 //create the requestmapper for the corresponidng reuqest id. |
|
231 iRequestMapper->CreateRequestL(operationId,ETrue,EVIMPSTXimpOperationBind); |
|
232 iBindStatus = TVIMPSTEnums::EVIMPSTBindDone; |
|
233 iFeatureSupported = EVIMPSTFeatureUnknown; |
|
234 TRAP(err,IdentifySupportedFeaturesL()); |
|
235 } |
|
236 } |
|
237 else |
|
238 { |
|
239 err = KErrNone; |
|
240 } |
|
241 return err; |
|
242 } |
|
243 // --------------------------------------------------------------------------- |
|
244 // CVIMPSTEngineVoIPPrecenseHandler::ServerUnBindL |
|
245 // --------------------------------------------------------------------------- |
|
246 // |
|
247 TInt CVIMPSTEngineSessionCntxtObserver::ServerUnBindL( |
|
248 TBool aDoUnsubscribe ) |
|
249 { |
|
250 TRACER_AUTO; |
|
251 TInt err = KErrNotFound; |
|
252 if ( TVIMPSTEnums::EVIMPSTBindDone == iBindStatus ) |
|
253 { |
|
254 if ( aDoUnsubscribe ) |
|
255 { |
|
256 iBindStatus = TVIMPSTEnums::EVIMPSTUnBinding; |
|
257 } |
|
258 |
|
259 TRACE( " do unbind"); |
|
260 TXIMPRequestId operationId = TXIMPRequestId::Null(); |
|
261 TRAP( err, operationId = iPresenceCtx->UnbindL()); |
|
262 iBindStatus = TVIMPSTEnums::EVIMPSTUnBindWaiting; |
|
263 iRequestMapper->CreateRequestL(operationId,EFalse,EVIMPSTXimpOperationUnBind) ; |
|
264 iBindStatus = TVIMPSTEnums::EVIMPSTBindNotDone; |
|
265 iFeatureSupported = EVIMPSTFeatureUnknown; |
|
266 } |
|
267 else if ( TVIMPSTEnums::EVIMPSTBindFailureMode == iBindStatus ) |
|
268 { |
|
269 // Disable flag here. If service is really disabled, we must not |
|
270 // rebind when unbind completes. |
|
271 iBindStatus = TVIMPSTEnums::EVIMPSTBindNotDone; |
|
272 } |
|
273 return err; |
|
274 } |
|
275 |
|
276 |
|
277 // --------------------------------------------------------------------------- |
|
278 // CVIMPSTEngineSessionCntxtObserver::UriFromXimpOperationLC |
|
279 // --------------------------------------------------------------------------- |
|
280 // |
|
281 HBufC* CVIMPSTEngineSessionCntxtObserver::UriFromXimpOperationLC(const MXIMPBase& aEvent ) |
|
282 { |
|
283 TRACER_AUTO; |
|
284 const MPresentityPresenceEvent& event = |
|
285 *TXIMPGetInterface< const MPresentityPresenceEvent >::From( |
|
286 aEvent, MXIMPBase::EPanicIfUnknown ); |
|
287 HBufC* retValue = NULL; |
|
288 retValue = event.PresentityId().Identity().AllocLC(); |
|
289 if(!retValue) |
|
290 { |
|
291 retValue = KNullDesC().AllocLC(); |
|
292 } |
|
293 return retValue; |
|
294 } |
|
295 |
|
296 // --------------------------------------------------------------------------- |
|
297 // CVIMPSTEngineSessionCntxtObserver::DoHandlePresenceContextEventL |
|
298 // --------------------------------------------------------------------------- |
|
299 // |
|
300 void CVIMPSTEngineSessionCntxtObserver::DoHandlePresenceContextEventL( |
|
301 const MXIMPContext& aContext, |
|
302 const MXIMPBase& aEvent ) |
|
303 { |
|
304 TRACER_AUTO; |
|
305 const TInt32 eventId = aEvent.GetInterfaceId(); |
|
306 |
|
307 switch( aEvent.GetInterfaceId() ) |
|
308 { |
|
309 case MXIMPRequestCompleteEvent::KInterfaceId: |
|
310 { |
|
311 |
|
312 TRACE( "InsideCallbackswitch::MXIMPRequestCompleteEvent start"); |
|
313 const MXIMPRequestCompleteEvent* event = |
|
314 TXIMPGetInterface< const MXIMPRequestCompleteEvent >::From( |
|
315 aEvent, MXIMPBase::EPanicIfUnknown ); |
|
316 |
|
317 iReqResult = event->CompletionResult().ResultCode(); |
|
318 const TXIMPRequestId& reqId = event->RequestId(); |
|
319 // Note:FindRequestId does not pass the ownership. hanece req |
|
320 // should not be deleted. |
|
321 CVIMPSTEngineRequest *req = iRequestMapper->FindRequestId( reqId ); |
|
322 |
|
323 if ( req ) |
|
324 { |
|
325 TXimpOperation operation = req->RequestType(); |
|
326 |
|
327 //contact mgmt & search will remove their own requests |
|
328 //presence subservice should also do the same |
|
329 //untill then use the below if check |
|
330 //TBD |
|
331 if ( (operation>EVIMPSTXimpOperationNoOperation)&& |
|
332 (operation<=EVIMPSTXimpOperationUnsubscribe) ) |
|
333 { |
|
334 req->StopWait() ; |
|
335 iRequestMapper->RemoveRequestId(reqId); |
|
336 } |
|
337 |
|
338 TInt count = iObserverArray.Count(); |
|
339 |
|
340 for(TInt i = 0; i < count; i++) |
|
341 { |
|
342 iObserverArray[i]->HandleSessionContextEventL(aContext, |
|
343 aEvent, |
|
344 operation); |
|
345 } |
|
346 } |
|
347 TRACE("InsideCallbackswitch::MXIMPRequestCompleteEvent end"); |
|
348 break; |
|
349 } |
|
350 |
|
351 case MXIMPContextStateEvent::KInterfaceId: |
|
352 { |
|
353 TRACE( "InsideCallbackswitch::MXIMPContextStateEvent"); |
|
354 break; |
|
355 } |
|
356 case MPresentityPresenceEvent::KInterfaceId: |
|
357 { |
|
358 TRACE( "InsideCallbackswitch::::MPresentityPresenceEvent start"); |
|
359 TInt count = iObserverArray.Count(); |
|
360 for(TInt i = 0; i < count; i++) |
|
361 { |
|
362 iObserverArray[i]->HandleSessionContextEventL(aContext,aEvent); |
|
363 } |
|
364 TRACE( "InsideCallbackswitch::::MPresentityPresenceEvent end"); |
|
365 break; |
|
366 } |
|
367 case MPresentityGroupContentEvent::KInterfaceId: |
|
368 { |
|
369 TRACE( "InsideCallbackswitch::::MPresentityGroupContentEvent start"); |
|
370 TInt count = iObserverArray.Count(); |
|
371 for(TInt i = 0; i < count; i++) |
|
372 { |
|
373 iObserverArray[i]->HandleSessionContextEventL(aContext,aEvent); |
|
374 } |
|
375 TRACE( "InsideCallbackswitch::::MPresentityGroupContentEvent end"); |
|
376 break; |
|
377 } |
|
378 case MPresenceGrantRequestListEvent::KInterfaceId: |
|
379 { |
|
380 TRACE("InsideCallbackswitch::::MPresenceGrantRequestListEvent start"); |
|
381 TInt count = iObserverArray.Count(); |
|
382 for(TInt i = 0; i < count; i++) |
|
383 { |
|
384 iObserverArray[i]->HandleSessionContextEventL(aContext,aEvent); |
|
385 } |
|
386 TRACE( "InsideCallbackswitch::::MPresenceGrantRequestListEvent end"); |
|
387 break; |
|
388 } |
|
389 |
|
390 case MSearchEvent::KInterfaceId: |
|
391 { |
|
392 TRACE( "InsideCallbackswitch::::MSearchEvent start"); |
|
393 |
|
394 TInt count = iObserverArray.Count(); |
|
395 for(TInt i = 0; i < count; i++) |
|
396 { |
|
397 iObserverArray[i]->HandleSessionContextEventL(aContext,aEvent); |
|
398 } |
|
399 TRACE( "InsideCallbackswitch::::MSearchEvent end"); |
|
400 |
|
401 break; |
|
402 } |
|
403 case MSearchKeysEvent::KInterfaceId: |
|
404 { |
|
405 TRACE( "InsideCallbackswitch::::MSearchKeysEvent start"); |
|
406 TInt count = iObserverArray.Count(); |
|
407 for(TInt i = 0; i < count; i++) |
|
408 { |
|
409 iObserverArray[i]->HandleSessionContextEventL(aContext,aEvent); |
|
410 } |
|
411 TRACE( "InsideCallbackswitch::::MSearchKeysEvent end"); |
|
412 |
|
413 break; |
|
414 } |
|
415 case MPresenceBlockListEvent::KInterfaceId: |
|
416 { |
|
417 TRACE( "InsideCallbackswitch::::MPresenceBlockListEvent start"); |
|
418 TInt count = iObserverArray.Count(); |
|
419 for(TInt i = 0; i < count; i++) |
|
420 { |
|
421 iObserverArray[i]->HandleSessionContextEventL(aContext,aEvent); |
|
422 } |
|
423 TRACE( "InsideCallbackswitch::::MPresenceBlockListEvent end"); |
|
424 break; |
|
425 } |
|
426 |
|
427 default: |
|
428 { |
|
429 break; |
|
430 } |
|
431 } |
|
432 } |
|
433 // --------------------------------------------------------------------------- |
|
434 // CVIMPSTEngineSessionCntxtObserver::XimpAuthorizationL |
|
435 // --------------------------------------------------------------------------- |
|
436 // |
|
437 MPresenceAuthorization& |
|
438 CVIMPSTEngineSessionCntxtObserver::XimpAuthorizationL() |
|
439 { |
|
440 TRACER_AUTO; |
|
441 __ASSERT_ALWAYS( iFeatures, User::Leave( KErrNotSupported )); |
|
442 __ASSERT_ALWAYS( &iFeatures->PresenceAuthorization(), |
|
443 User::Leave( KErrNotSupported )); |
|
444 return iFeatures->PresenceAuthorization(); |
|
445 } |
|
446 |
|
447 // --------------------------------------------------------------------------- |
|
448 // CVIMPSTEngineSessionCntxtObserver::XimpPresenceWatchingL |
|
449 // --------------------------------------------------------------------------- |
|
450 // |
|
451 MPresenceWatching& |
|
452 CVIMPSTEngineSessionCntxtObserver::XimpPresenceWatchingL() |
|
453 { |
|
454 __ASSERT_ALWAYS( iFeatures, User::Leave( KErrNotSupported )); |
|
455 __ASSERT_ALWAYS( &iFeatures->PresenceWatching(), |
|
456 User::Leave( KErrNotSupported )); |
|
457 return iFeatures->PresenceWatching(); |
|
458 } |
|
459 |
|
460 // --------------------------------------------------------------------------- |
|
461 // CVIMPSTEngineSessionCntxtObserver::XimpPresentityGroupsL |
|
462 // --------------------------------------------------------------------------- |
|
463 // |
|
464 MPresentityGroups& |
|
465 CVIMPSTEngineSessionCntxtObserver::XimpPresentityGroupsL() |
|
466 { |
|
467 __ASSERT_ALWAYS( iFeatures, User::Leave( KErrNotSupported )); |
|
468 __ASSERT_ALWAYS( &iFeatures->PresentityGroups(), |
|
469 User::Leave( KErrNotSupported )); |
|
470 return iFeatures->PresentityGroups(); |
|
471 } |
|
472 |
|
473 // --------------------------------------------------------------------------- |
|
474 // CVIMPSTEngineSessionCntxtObserver::XimpPresencePublishingL |
|
475 // --------------------------------------------------------------------------- |
|
476 // |
|
477 MPresencePublishing& |
|
478 CVIMPSTEngineSessionCntxtObserver::XimpPresencePublishingL() |
|
479 { |
|
480 __ASSERT_ALWAYS( iFeatures, User::Leave( KErrNotSupported )); |
|
481 __ASSERT_ALWAYS( &iFeatures->PresencePublishing(), |
|
482 User::Leave( KErrNotSupported )); |
|
483 return iFeatures->PresencePublishing(); |
|
484 } |
|
485 |
|
486 |
|
487 // --------------------------------------------------------------------------- |
|
488 // CVIMPSTEngineSessionCntxtObserver::XimpPresenceContext |
|
489 // --------------------------------------------------------------------------- |
|
490 // |
|
491 MXIMPContext& |
|
492 CVIMPSTEngineSessionCntxtObserver::XimpPresenceContextL() |
|
493 { |
|
494 __ASSERT_ALWAYS( iPresenceCtx, User::Leave( KErrNotFound )); |
|
495 return *iPresenceCtx; |
|
496 } |
|
497 |
|
498 // --------------------------------------------------------------------------- |
|
499 // CVIMPSTEngineSessionCntxtObserver::PresenceObjectFactory |
|
500 // --------------------------------------------------------------------------- |
|
501 // |
|
502 MPresenceObjectFactory& CVIMPSTEngineSessionCntxtObserver::PresenceObjectFactoryL() const |
|
503 { |
|
504 __ASSERT_ALWAYS( iFeatures, User::Leave( KErrNotFound )); |
|
505 return iFeatures->PresenceObjectFactory(); |
|
506 } |
|
507 |
|
508 // --------------------------------------------------------------------------- |
|
509 // CVIMPSTEngineSessionCntxtObserver::PresenceFeaturesL |
|
510 // --------------------------------------------------------------------------- |
|
511 // |
|
512 MPresenceFeatures& CVIMPSTEngineSessionCntxtObserver::PresenceFeaturesL() const |
|
513 { |
|
514 __ASSERT_ALWAYS( iFeatures, User::Leave( KErrNotFound )); |
|
515 return *iFeatures; |
|
516 } |
|
517 |
|
518 // --------------------------------------------------------------------------- |
|
519 // CVIMPSTEngineSessionCntxtObserver::RegisterObserver |
|
520 // --------------------------------------------------------------------------- |
|
521 // |
|
522 void CVIMPSTEngineSessionCntxtObserver::RegisterObserver(MVIMPSTEngineSessionCntxtObserver* aObserver) |
|
523 { |
|
524 TRACER_AUTO; |
|
525 if (aObserver) |
|
526 { |
|
527 |
|
528 TInt index = iObserverArray.Find(aObserver); |
|
529 if( index == KErrNotFound ) |
|
530 { |
|
531 iObserverArray.Append( aObserver ); |
|
532 } |
|
533 } |
|
534 } |
|
535 |
|
536 // --------------------------------------------------------------------------- |
|
537 // CVIMPSTEngineSessionCntxtObserver::UnRegisterObserver |
|
538 // --------------------------------------------------------------------------- |
|
539 // |
|
540 void CVIMPSTEngineSessionCntxtObserver::UnRegisterObserver(MVIMPSTEngineSessionCntxtObserver* aObserver) |
|
541 { |
|
542 TRACER_AUTO; |
|
543 if (aObserver) |
|
544 { |
|
545 TInt index = iObserverArray.Find(aObserver); |
|
546 |
|
547 if( index >=0 ) |
|
548 { |
|
549 iObserverArray.Remove( index ); |
|
550 iObserverArray.Compress(); |
|
551 } |
|
552 } |
|
553 } |
|
554 |
|
555 // --------------------------------------------------------------------------- |
|
556 // CVIMPSTEngineSessionCntxtObserver::IdentifySupportedFeaturesL |
|
557 // --------------------------------------------------------------------------- |
|
558 // |
|
559 void CVIMPSTEngineSessionCntxtObserver::IdentifySupportedFeaturesL() |
|
560 { |
|
561 TRACER_AUTO; |
|
562 using namespace NXIMPFeature::Presence; |
|
563 using namespace NXIMPFeature::InstantMessage; |
|
564 using namespace NXIMPFeature::Search; |
|
565 using namespace NXIMPFeature::PresentityGroups; |
|
566 |
|
567 MXIMPFeatureInfo* ximpCtxFeats = iPresenceCtx->GetContextFeaturesLC(); |
|
568 //get the supproted features from ximpfw adaptation. |
|
569 if( ximpCtxFeats ) |
|
570 { |
|
571 CleanupStack::Pop() ; //iXimpctxFeat |
|
572 |
|
573 const MDesC8Array& supportedFeatures = ximpCtxFeats->FeatureIds(); |
|
574 |
|
575 TInt count = supportedFeatures.MdcaCount(); |
|
576 |
|
577 for(TInt index = 0; index < count; index++) |
|
578 { |
|
579 TPtrC8 feature = supportedFeatures.MdcaPoint(index); |
|
580 |
|
581 if ( !(iFeatureSupported & EVIMPSTFeaturePublish) && !(KPublish().Compare(feature)) ) |
|
582 { |
|
583 iFeatureSupported = iFeatureSupported | EVIMPSTFeaturePublish; |
|
584 |
|
585 } |
|
586 else if ( !(iFeatureSupported & EVIMPSTFeatureFetch) && !(KFetch().Compare(feature)) ) |
|
587 { |
|
588 iFeatureSupported = iFeatureSupported | EVIMPSTFeatureFetch; |
|
589 |
|
590 } |
|
591 else if ( !(iFeatureSupported & EVIMPSTFeatureSubscribe) && !(KSubscribe().Compare(feature)) ) |
|
592 { |
|
593 iFeatureSupported = iFeatureSupported | EVIMPSTFeatureSubscribe; |
|
594 |
|
595 } |
|
596 else if ( !(iFeatureSupported & EVIMPSTFeatureUnsubscribe) && !(KUnsubscribe().Compare(feature)) ) |
|
597 { |
|
598 iFeatureSupported = iFeatureSupported | EVIMPSTFeatureUnsubscribe; |
|
599 |
|
600 } |
|
601 else if ( !(iFeatureSupported & EVIMPSTFeatureAddContact) && !(KAddContact().Compare(feature)) ) |
|
602 { |
|
603 iFeatureSupported = iFeatureSupported | EVIMPSTFeatureAddContact; |
|
604 |
|
605 } |
|
606 else if ( !(iFeatureSupported & EVIMPSTFeatureDeleteContact) && !(KDeleteContact().Compare(feature)) ) |
|
607 { |
|
608 iFeatureSupported = iFeatureSupported | EVIMPSTFeatureDeleteContact; |
|
609 |
|
610 } |
|
611 else if ( !(iFeatureSupported & EVIMPSTFeatureBlock) && !(KBlock().Compare(feature)) ) |
|
612 { |
|
613 iFeatureSupported = iFeatureSupported | EVIMPSTFeatureBlock; |
|
614 |
|
615 } |
|
616 else if ( !(iFeatureSupported & EVIMPSTFeatureUnBlock) && !(KUnBlock().Compare(feature)) ) |
|
617 { |
|
618 iFeatureSupported = iFeatureSupported | EVIMPSTFeatureUnBlock; |
|
619 |
|
620 } |
|
621 else if ( !(iFeatureSupported & EVIMPSTFeatureAvatar) && !(KAvatar().Compare(feature)) ) |
|
622 { |
|
623 iFeatureSupported = iFeatureSupported | EVIMPSTFeatureAvatar; |
|
624 |
|
625 } |
|
626 else if ( !(iFeatureSupported & EVIMPSTFeatureCreateGroup) && !(KCreate().Compare(feature)) ) |
|
627 { |
|
628 iFeatureSupported = iFeatureSupported | EVIMPSTFeatureCreateGroup; |
|
629 |
|
630 } |
|
631 else if ( !(iFeatureSupported & EVIMPSTFeatureDeleteGroup) && !(KDelete().Compare(feature)) ) |
|
632 { |
|
633 iFeatureSupported = iFeatureSupported | EVIMPSTFeatureDeleteGroup; |
|
634 |
|
635 } |
|
636 else if ( !(iFeatureSupported & EVIMPSTFeatureInstantMessage) && !(KInstantMessage().Compare(feature)) ) |
|
637 { |
|
638 iFeatureSupported = iFeatureSupported | EVIMPSTFeatureInstantMessage; |
|
639 |
|
640 } |
|
641 else if ( !(iFeatureSupported & EVIMPSTFeatureSearch) && !(KSearch().Compare(feature)) ) |
|
642 { |
|
643 iFeatureSupported = iFeatureSupported | EVIMPSTFeatureSearch; |
|
644 |
|
645 } |
|
646 |
|
647 } |
|
648 |
|
649 delete ximpCtxFeats; |
|
650 } |
|
651 } |
|
652 |
|
653 |
|
654 // --------------------------------------------------------------------------- |
|
655 // CVIMPSTEngineSessionCntxtObserver::GetSupportedFeatures |
|
656 // --------------------------------------------------------------------------- |
|
657 // |
|
658 TInt CVIMPSTEngineSessionCntxtObserver::GetSupportedFeatures() |
|
659 { |
|
660 return iFeatureSupported; |
|
661 } |
|
662 |
|
663 // end of file |
|
664 |
|
665 |
|