177 CVIMPSTEngineCchHandler& aCchHandler, |
174 CVIMPSTEngineCchHandler& aCchHandler, |
178 CVIMPSTEngineServiceTableFetcher& aTableFetcher, |
175 CVIMPSTEngineServiceTableFetcher& aTableFetcher, |
179 CVIMPSTEngineSessionCntxtObserver& aXimpEventObserver, |
176 CVIMPSTEngineSessionCntxtObserver& aXimpEventObserver, |
180 MVIMPSTEngineServiceConnectionEventObserver& aObserver ) |
177 MVIMPSTEngineServiceConnectionEventObserver& aObserver ) |
181 { |
178 { |
182 TRACE( T_LIT("CVIMPSTEnginePresenceSubService::NewLC start")); |
179 TRACER_AUTO; |
183 CVIMPSTEnginePresenceSubService* self = |
180 CVIMPSTEnginePresenceSubService* self = |
184 new (ELeave) CVIMPSTEnginePresenceSubService( aServiceId,aCchHandler, aTableFetcher, aXimpEventObserver,aObserver); |
181 new (ELeave) CVIMPSTEnginePresenceSubService( aServiceId,aCchHandler, aTableFetcher, aXimpEventObserver,aObserver); |
185 CleanupStack::PushL(self); |
182 CleanupStack::PushL(self); |
186 self->ConstructL(); |
183 self->ConstructL(); |
187 TRACE( T_LIT("CVIMPSTEnginePresenceSubService::NewLC end")); |
|
188 return self; |
184 return self; |
189 } |
185 } |
190 |
186 |
191 // --------------------------------------------------------------------------- |
187 // --------------------------------------------------------------------------- |
192 // CVIMPSTEnginePresenceSubService:: |
188 // CVIMPSTEnginePresenceSubService:: |
193 // ~CVIMPSTEnginePresenceSubService() |
189 // ~CVIMPSTEnginePresenceSubService() |
194 // --------------------------------------------------------------------------- |
190 // --------------------------------------------------------------------------- |
195 // |
191 // |
196 CVIMPSTEnginePresenceSubService::~CVIMPSTEnginePresenceSubService() |
192 CVIMPSTEnginePresenceSubService::~CVIMPSTEnginePresenceSubService() |
197 { |
193 { |
198 TRACE( T_LIT("CVIMPSTEnginePresenceSubService::NewLC start")); |
194 TRACER_AUTO; |
199 |
195 |
200 iCchHandler.UnRegisterCchObserver(ECCHPresenceSub); |
196 iCchHandler.UnRegisterCchObserver(ECCHPresenceSub); |
201 |
197 |
202 delete iServiceName; |
198 delete iServiceName; |
203 delete iPresenceCacheReader ; |
199 delete iPresenceCacheReader ; |
204 |
200 |
205 delete iBlockedListMgr; |
201 delete iBlockedListMgr; |
206 iBlockedListMgr = NULL; |
202 iBlockedListMgr = NULL; |
207 |
203 |
208 TRACE( T_LIT("CVIMPSTEnginePresenceSubService::NewLC end")); |
|
209 } |
204 } |
210 |
205 |
211 // --------------------------------------------------------------------------- |
206 // --------------------------------------------------------------------------- |
212 // CVIMPSTEnginePresenceSubService:: |
207 // CVIMPSTEnginePresenceSubService:: |
213 // ServiceState() |
208 // ServiceState() |
214 // --------------------------------------------------------------------------- |
209 // --------------------------------------------------------------------------- |
215 // |
210 // |
216 |
211 |
217 TVIMPSTEnums::TVIMPSTRegistrationState CVIMPSTEnginePresenceSubService::SubServiceState() const |
212 TVIMPSTEnums::TVIMPSTRegistrationState CVIMPSTEnginePresenceSubService::SubServiceState() const |
218 { |
213 { |
219 TRACE( T_LIT("CVIMPSTEnginePresenceSubService::ServiceState start")); |
214 TRACER_AUTO; |
220 return iServiceState; |
215 return iServiceState; |
221 } |
216 } |
222 |
217 |
223 // --------------------------------------------------------------------------- |
218 // --------------------------------------------------------------------------- |
224 // CVIMPSTEnginePresenceSubService:: |
219 // CVIMPSTEnginePresenceSubService:: |
225 // Type() |
220 // Type() |
226 // --------------------------------------------------------------------------- |
221 // --------------------------------------------------------------------------- |
227 // |
222 // |
228 TVIMPSTEnums::SubServiceType CVIMPSTEnginePresenceSubService::Type() const |
223 TVIMPSTEnums::SubServiceType CVIMPSTEnginePresenceSubService::Type() const |
229 { |
224 { |
230 TRACE( T_LIT("CVIMPSTEnginePresenceSubService::Type") ); |
225 TRACER_AUTO; |
231 TRACE( T_LIT("CVIMPSTEnginePresenceSubService: [0x%x]"), this ); |
226 TRACE( "CVIMPSTEnginePresenceSubService: [0x%x]", this ); |
232 return TVIMPSTEnums::EPresence; |
227 return TVIMPSTEnums::EPresence; |
233 } |
228 } |
234 |
229 |
235 // --------------------------------------------------------------------------- |
230 // --------------------------------------------------------------------------- |
236 // CVIMPSTEnginePresenceSubService:: |
231 // CVIMPSTEnginePresenceSubService:: |
271 *groupList ); |
265 *groupList ); |
272 CVIMPSTEngineRequestMapper* requestMapper =iXimpEventObserver.GetRequestMapper(); |
266 CVIMPSTEngineRequestMapper* requestMapper =iXimpEventObserver.GetRequestMapper(); |
273 requestMapper->CreateRequestL(operationId,EFalse,EVIMPSTXimpOperationGetSubscribedList); |
267 requestMapper->CreateRequestL(operationId,EFalse,EVIMPSTXimpOperationGetSubscribedList); |
274 CleanupStack::PopAndDestroy(); // groupList |
268 CleanupStack::PopAndDestroy(); // groupList |
275 // list retrieving ok. Waiting for list.; |
269 // list retrieving ok. Waiting for list.; |
276 TRACE( T_LIT("CVIMPSTEnginePresenceSubService::RetrieveSubscribedListL end")); |
|
277 } |
270 } |
278 |
271 |
279 // --------------------------------------------------------------------------- |
272 // --------------------------------------------------------------------------- |
280 // CVIMPSTEnginePresenceSubService::SubscribePresenceOfSingleContactL |
273 // CVIMPSTEnginePresenceSubService::SubscribePresenceOfSingleContactL |
281 // --------------------------------------------------------------------------- |
274 // --------------------------------------------------------------------------- |
282 // |
275 // |
283 void CVIMPSTEnginePresenceSubService::SubscribePresenceOfSingleContactL( const TDesC& aUriOfTheContact) |
276 void CVIMPSTEnginePresenceSubService::SubscribePresenceOfSingleContactL( const TDesC& aUriOfTheContact) |
284 { |
277 { |
285 TRACE( T_LIT("CVIMPSTEnginePresenceSubService::SubscribePrecenseOfSingleContactL start")); |
278 TRACER_AUTO; |
286 __ASSERT_ALWAYS( aUriOfTheContact.Length(), User::Leave( KErrArgument ) ); |
279 __ASSERT_ALWAYS( aUriOfTheContact.Length(), User::Leave( KErrArgument ) ); |
287 //if anything is there with colon eg sip:user@presence1. strip the part before : |
280 //if anything is there with colon eg sip:user@presence1. strip the part before : |
288 TInt len = aUriOfTheContact.Find(_L(":")); |
281 TInt len = aUriOfTheContact.Find(_L(":")); |
289 TPtrC buddyId = aUriOfTheContact.Right( aUriOfTheContact.Length() - len - KColon().Length()); |
282 TPtrC buddyId = aUriOfTheContact.Right( aUriOfTheContact.Length() - len - KColon().Length()); |
290 HBufC* name = HBufC::NewLC( KPropertyMaxLength ); |
283 HBufC* name = HBufC::NewLC( KPropertyMaxLength ); |
294 // append the service name followed by user id ,seperated by colon |
287 // append the service name followed by user id ,seperated by colon |
295 namePtr.Append(*iServiceName); |
288 namePtr.Append(*iServiceName); |
296 namePtr.Append(KColon); |
289 namePtr.Append(KColon); |
297 namePtr.Append(buddyId); |
290 namePtr.Append(buddyId); |
298 |
291 |
299 TRACE( T_LIT("CVIMPSTEnginePresenceSubService::SubscribeToPresenceCacheL: %S"), &namePtr ); |
292 TRACE("SubscribeToPresenceCacheL: %S", &namePtr ); |
300 iPresenceCacheReader->SubscribePresenceBuddyChangeL(*name); |
293 iPresenceCacheReader->SubscribePresenceBuddyChangeL(*name); |
301 CleanupStack::PopAndDestroy(name); // name |
294 CleanupStack::PopAndDestroy(name); // name |
302 TRACE( T_LIT("CVIMPSTEnginePresenceSubService::SubscribePrecenseOfSingleContactL end")); |
|
303 } |
295 } |
304 |
296 |
305 // --------------------------------------------------------------------------- |
297 // --------------------------------------------------------------------------- |
306 // CVIMPSTEnginePresenceSubService:: |
298 // CVIMPSTEnginePresenceSubService:: |
307 // UnsubscribePrecenseOfSingleContactL |
299 // UnsubscribePrecenseOfSingleContactL |
308 // --------------------------------------------------------------------------- |
300 // --------------------------------------------------------------------------- |
309 // |
301 // |
310 void CVIMPSTEnginePresenceSubService::UnSubscribePresenceOfSingleContactL( |
302 void CVIMPSTEnginePresenceSubService::UnSubscribePresenceOfSingleContactL( |
311 const TDesC& aUriOfTheContact ) |
303 const TDesC& aUriOfTheContact ) |
312 { |
304 { |
313 TRACE( T_LIT("CVIMPSTEnginePresenceSubService::UnsubscribePrecenseOfSingleContactL start")); |
305 TRACER_AUTO; |
314 HBufC* name = HBufC::NewLC( KPropertyMaxLength ); |
306 HBufC* name = HBufC::NewLC( KPropertyMaxLength ); |
315 TPtr namePtr( name->Des() ); |
307 TPtr namePtr( name->Des() ); |
316 namePtr.Zero(); |
308 namePtr.Zero(); |
317 // append the service name followed by user id ,seperated by colon |
309 // append the service name followed by user id ,seperated by colon |
318 namePtr.Append(*iServiceName); |
310 namePtr.Append(*iServiceName); |
319 namePtr.Append(KColon); |
311 namePtr.Append(KColon); |
320 namePtr.Append(aUriOfTheContact); |
312 namePtr.Append(aUriOfTheContact); |
321 |
313 |
322 TRACE( T_LIT("CVIMPSTEnginePresenceSubService::UnSubscribeToPresenceCacheL: %S"), &namePtr); |
314 TRACE( "UnSubscribeToPresenceCacheL: %S", &namePtr); |
323 iPresenceCacheReader->UnSubscribePresenceBuddyChangeL(*name); |
315 iPresenceCacheReader->UnSubscribePresenceBuddyChangeL(*name); |
324 CleanupStack::PopAndDestroy(name); // name |
316 CleanupStack::PopAndDestroy(name); // name |
325 TRACE( T_LIT("CVIMPSTEnginePresenceSubService::UnsubscribePrecenseOfSingleContactL end")) ; |
|
326 } |
317 } |
327 |
318 |
328 // --------------------------------------------------------------------------- |
319 // --------------------------------------------------------------------------- |
329 // CVIMPSTEnginePresenceSubService:: |
320 // CVIMPSTEnginePresenceSubService:: |
330 // DoHandlePresentityGroupContentEventL |
321 // DoHandlePresentityGroupContentEventL |
333 void CVIMPSTEnginePresenceSubService:: |
324 void CVIMPSTEnginePresenceSubService:: |
334 DoHandlePresentityGroupContentEventL( |
325 DoHandlePresentityGroupContentEventL( |
335 const MXIMPContext& /*aContext*/, |
326 const MXIMPContext& /*aContext*/, |
336 const MXIMPBase& aEvent ) |
327 const MXIMPBase& aEvent ) |
337 { |
328 { |
338 TRACE( T_LIT("CVIMPSTEnginePresenceSubService::DoHandlePresentityGroupContentEventL start")); |
329 TRACER_AUTO; |
339 |
330 |
340 const MPresentityGroupContentEvent& event = |
331 const MPresentityGroupContentEvent& event = |
341 *TXIMPGetInterface< const MPresentityGroupContentEvent >::From( |
332 *TXIMPGetInterface< const MPresentityGroupContentEvent >::From( |
342 aEvent, |
333 aEvent, |
343 MXIMPBase::EPanicIfUnknown ); |
334 MXIMPBase::EPanicIfUnknown ); |
344 //this needs to be checked if server contacts is supported only then update to |
335 //this needs to be checked if server contacts is supported only then update to |
345 //store else don't. |
336 //store else don't. |
346 TInt supportedFeatures = iXimpEventObserver.GetSupportedFeatures(); |
337 TInt supportedFeatures = iXimpEventObserver.GetSupportedFeatures(); |
347 if(EVIMPSTFeatureFetch & supportedFeatures) |
338 if(EVIMPSTFeatureFetch & supportedFeatures) |
348 { |
339 { |
349 TRACE( T_LIT(" -> storing into respective service store" )); |
340 TRACE(" -> storing into respective service store" ); |
350 StoreToVirtualStoreL( event ); |
341 StoreToVirtualStoreL( event ); |
351 } |
342 } |
352 //this is to ensure the presence for the local sotre contacts is not lost. |
343 //this is to ensure the presence for the local sotre contacts is not lost. |
353 TRACE( T_LIT(" -> new member count: %d" ), event.NewMembersCount() ); |
344 TRACE( "new member count: %d" , event.NewMembersCount() ); |
354 TRACE( T_LIT(" -> current member count: %d" ), event.CurrentMembersCount() ); |
345 TRACE( " current member count: %d" , event.CurrentMembersCount() ); |
355 TRACE( T_LIT(" -> disappeared member count: %d" ), event.DisappearedMembersCount() ); |
346 TRACE( "disappeared member count: %d" , event.DisappearedMembersCount() ); |
356 TRACE( T_LIT("CVIMPSTEnginePresenceSubService::DoHandlePresentityGroupContentEventL end")); |
|
357 } |
347 } |
358 |
348 |
359 // --------------------------------------------------------------------------- |
349 // --------------------------------------------------------------------------- |
360 // CVIMPSTEnginePresenceSubService:: |
350 // CVIMPSTEnginePresenceSubService:: |
361 // DoHandlePresenceGrantRequestListEventL |
351 // DoHandlePresenceGrantRequestListEventL |
379 |
369 |
380 const MPresenceGrantRequestListEvent& event = |
370 const MPresenceGrantRequestListEvent& event = |
381 *TXIMPGetInterface<const MPresenceGrantRequestListEvent >::From( |
371 *TXIMPGetInterface<const MPresenceGrantRequestListEvent >::From( |
382 aEvent, MXIMPBase::EPanicIfUnknown ); |
372 aEvent, MXIMPBase::EPanicIfUnknown ); |
383 |
373 |
384 TRACE( T_LIT(" -> new watcher count: %d" ), event.NewRequestsCount() ); |
374 TRACE("new watcher count: %d" , event.NewRequestsCount() ); |
385 TRACE( T_LIT(" -> current watcher count: %d" ), event.CurrentRequestsCount() ); |
375 TRACE("current watcher count: %d" , event.CurrentRequestsCount() ); |
386 HBufC* identbuf(NULL); |
376 HBufC* identbuf(NULL); |
387 HBufC* displayName(NULL); |
377 HBufC* displayName(NULL); |
388 TInt newcount = event.NewRequestsCount(); |
378 TInt newcount = event.NewRequestsCount(); |
389 TInt currentcount = event.CurrentRequestsCount(); |
379 TInt currentcount = event.CurrentRequestsCount(); |
390 if(newcount) |
380 if(newcount) |
391 { |
381 { |
392 TRACE( T_LIT("CVIMPSTEnginePresenceSubService::DoHandlePresenceGrantRequestListEventL newcount =%d" ), newcount ); |
382 TRACE( " newcount =%d" , newcount ); |
393 TRACE( T_LIT("CVIMPSTEnginePresenceSubService::DoHandlePresenceGrantRequestListEventL iServiceState =%d" ), iServiceState ); |
383 TRACE( "iServiceState =%d" , iServiceState ); |
394 |
384 |
395 for(TInt i=0; i<newcount; i++) |
385 for(TInt i=0; i<newcount; i++) |
396 { |
386 { |
397 const MPresenceGrantRequestInfo& reqInfo = event.NewRequest ( i );// its always a new request |
387 const MPresenceGrantRequestInfo& reqInfo = event.NewRequest ( i );// its always a new request |
398 identbuf = reqInfo.RequestorId().Identity().AllocLC(); |
388 identbuf = reqInfo.RequestorId().Identity().AllocLC(); |
399 displayName = reqInfo.RequestorDisplayName().AllocLC(); |
389 displayName = reqInfo.RequestorDisplayName().AllocLC(); |
400 TPtr identbufPtr = identbuf->Des(); |
390 TPtr identbufPtr = identbuf->Des(); |
401 TRACE( T_LIT(" -> identity: %S" ), &identbufPtr ); |
391 TRACE( "identity: %S" , &identbufPtr ); |
402 if(identbuf->Length()) |
392 if(identbuf->Length()) |
403 { |
393 { |
404 TRACE( T_LIT(" -> pass to command process" )); |
394 TRACE( " pass to command process" ); |
405 if( iAutoAccept && |
395 if( iAutoAccept && |
406 TVIMPSTEnums::ESVCERegistered == iServiceState) |
396 TVIMPSTEnums::ESVCERegistered == iServiceState) |
407 { |
397 { |
408 TInt error = SendPresenceGrantPresentityL( identbufPtr, ETrue ); |
398 TInt error = SendPresenceGrantPresentityL( identbufPtr, ETrue ); |
409 } |
399 } |
410 else if( iSubServiceObserver ) |
400 else if( iSubServiceObserver ) |
411 { |
401 { |
412 TRACE( T_LIT(" -> informed observer." )); |
402 TRACE( " informed observer." ); |
413 iSubServiceObserver->HandleAddRequestEventL( TVIMPSTEnums::EAddItem , *identbuf, *displayName); |
403 iSubServiceObserver->HandleAddRequestEventL( TVIMPSTEnums::EAddItem , *identbuf, *displayName); |
414 } |
404 } |
415 TRACE( T_LIT(" -> pass to command process" )); |
405 TRACE( " pass to command process" ); |
416 } |
406 } |
417 CleanupStack::PopAndDestroy( displayName ); |
407 CleanupStack::PopAndDestroy( displayName ); |
418 CleanupStack::PopAndDestroy( identbuf ); |
408 CleanupStack::PopAndDestroy( identbuf ); |
419 } |
409 } |
420 } |
410 } |
422 { |
412 { |
423 const MPresenceGrantRequestInfo& reqInfo = event.CurrentRequest(0 );// its always a new request |
413 const MPresenceGrantRequestInfo& reqInfo = event.CurrentRequest(0 );// its always a new request |
424 identbuf = reqInfo.RequestorId().Identity().AllocLC(); |
414 identbuf = reqInfo.RequestorId().Identity().AllocLC(); |
425 displayName = reqInfo.RequestorDisplayName().AllocLC(); |
415 displayName = reqInfo.RequestorDisplayName().AllocLC(); |
426 TPtr identbufPtr = identbuf->Des(); |
416 TPtr identbufPtr = identbuf->Des(); |
427 TRACE( T_LIT(" -> identity: %S" ), &identbufPtr ); |
417 TRACE( "identity: %S" , &identbufPtr ); |
428 if(identbuf->Length()) |
418 if(identbuf->Length()) |
429 { |
419 { |
430 TRACE( T_LIT(" -> pass to command process" )); |
420 TRACE( " pass to command process" ); |
431 if( iAutoAccept) |
421 if( iAutoAccept) |
432 { |
422 { |
433 TInt error = SendPresenceGrantPresentityL( identbufPtr, ETrue ); |
423 TInt error = SendPresenceGrantPresentityL( identbufPtr, ETrue ); |
434 } |
424 } |
435 else if( iSubServiceObserver ) |
425 else if( iSubServiceObserver ) |
436 { |
426 { |
437 TRACE( T_LIT(" -> informed observer." )); |
427 TRACE( " informed observer."); |
438 iSubServiceObserver->HandleAddRequestEventL(TVIMPSTEnums::EAddItem ,*identbuf, *displayName); |
428 iSubServiceObserver->HandleAddRequestEventL(TVIMPSTEnums::EAddItem ,*identbuf, *displayName); |
439 } |
429 } |
440 TRACE( T_LIT(" -> pass to command process" )); |
430 TRACE( "pass to command process" ); |
441 } |
431 } |
442 CleanupStack::PopAndDestroy( displayName ); |
432 CleanupStack::PopAndDestroy( displayName ); |
443 CleanupStack::PopAndDestroy ( identbuf ); |
433 CleanupStack::PopAndDestroy ( identbuf ); |
444 } |
434 } |
445 TRACE( T_LIT("CVIMPSTEnginePresenceSubService::DoHandlePresenceGrantRequestListEventL end")); |
|
446 |
435 |
447 } |
436 } |
448 |
437 |
449 // --------------------------------------------------------------------------- |
438 // --------------------------------------------------------------------------- |
450 // CVIMPSTEnginePresenceSubService::ResolveServiceStateL |
439 // CVIMPSTEnginePresenceSubService::ResolveServiceStateL |
453 TVIMPSTEnums::TVIMPSTRegistrationState CVIMPSTEnginePresenceSubService::ResolveServiceStateL( |
442 TVIMPSTEnums::TVIMPSTRegistrationState CVIMPSTEnginePresenceSubService::ResolveServiceStateL( |
454 TCCHSubserviceState aState, |
443 TCCHSubserviceState aState, |
455 TInt aServiceError ) |
444 TInt aServiceError ) |
456 { |
445 { |
457 |
446 |
458 TRACE( T_LIT("CVIMPSTEnginePresenceSubService::ResolveServiceStateL start")); |
447 TRACER_AUTO; |
459 |
448 |
460 TVIMPSTEnums::TVIMPSTRegistrationState state = TVIMPSTEnums::ESVCENotRegistered; |
449 TVIMPSTEnums::TVIMPSTRegistrationState state = TVIMPSTEnums::ESVCENotRegistered; |
461 |
450 |
462 TRACE( T_LIT("ResolveServiceStateL() iServiceId: %d, ServiceState: %d"), |
451 |
463 iServiceId, aState ); |
452 TRACE( " iServiceId: %d, ServiceState: %d", iServiceId, aState ); |
464 |
453 |
465 TBool handleServiceStates = ETrue; |
454 TBool handleServiceStates = ETrue; |
466 if ( aServiceError && ECCHDisabled != aState ) |
455 if ( aServiceError && ECCHDisabled != aState ) |
467 { |
456 { |
468 //Only if the Service supports ALR, the state can goto WaitingForNetwork |
457 //Only if the Service supports ALR, the state can goto WaitingForNetwork |
469 //Still API from CCH is required to know whether ALR is supported or not |
458 //Still API from CCH is required to know whether ALR is supported or not |
470 //Not sure whether the below is right - have mailed to Markus for MoreInfo on this state |
459 //Not sure whether the below is right - have mailed to Markus for MoreInfo on this state |
471 if ( (KCCHErrorInvalidSettings != aServiceError) && (ECCHConnecting == aState) ) |
460 if ( (KCCHErrorInvalidSettings != aServiceError) && (ECCHConnecting == aState) ) |
472 { |
461 { |
473 TRACE( T_LIT("ResolveServiceStateL() ESVCEWaitingForNetwork") ); |
462 TRACE( " ESVCEWaitingForNetwork"); |
474 handleServiceStates = EFalse; |
463 handleServiceStates = EFalse; |
475 //state = TVIMPSTEnums::ESVCEWaitingForNetwork; |
464 //state = TVIMPSTEnums::ESVCEWaitingForNetwork; |
476 state = TVIMPSTEnums::ESVCENotRegistered; |
465 state = TVIMPSTEnums::ESVCENotRegistered; |
477 } |
466 } |
478 } |
467 } |
604 const TDesC& aValue, |
591 const TDesC& aValue, |
605 const TDesC& aFilename /*= KNullDesC*/, |
592 const TDesC& aFilename /*= KNullDesC*/, |
606 const TDesC8& aMimetype /*= KNullDesC8*/, |
593 const TDesC8& aMimetype /*= KNullDesC8*/, |
607 TBool aIsAvatar /*= EFalse*/ ) |
594 TBool aIsAvatar /*= EFalse*/ ) |
608 { |
595 { |
609 TRACE( T_LIT("CVIMPSTEnginePresenceSubService::PublishOwnPresenceL start")); |
596 TRACER_AUTO; |
610 // Take handles to object factory and publish interface |
597 // Take handles to object factory and publish interface |
611 MPresencePublishing& publisher = iXimpEventObserver.XimpPresencePublishingL(); |
598 MPresencePublishing& publisher = iXimpEventObserver.XimpPresencePublishingL(); |
612 |
599 |
613 //Fill presence doc with presence components and attributes |
600 //Fill presence doc with presence components and attributes |
614 MPresenceInfo* myPresence = iXimpEventObserver.PresenceObjectFactoryL().NewPresenceInfoLC();//1 |
601 MPresenceInfo* myPresence = iXimpEventObserver.PresenceObjectFactoryL().NewPresenceInfoLC();//1 |
615 MPersonPresenceInfo *personPresence = iXimpEventObserver.PresenceObjectFactoryL().NewPersonPresenceInfoLC();//2 |
602 MPersonPresenceInfo *personPresence = iXimpEventObserver.PresenceObjectFactoryL().NewPersonPresenceInfoLC();//2 |
616 MPresenceInfoFieldCollection& attributeFields = personPresence->Fields(); |
603 MPresenceInfoFieldCollection& attributeFields = personPresence->Fields(); |
617 |
604 |
618 MPresenceInfoField* infoField = NULL; |
605 MPresenceInfoField* infoField = NULL; |
619 TRACE( T_LIT("PublishOwnPresenceL aIsAvatar: %d"), aIsAvatar ); |
606 TRACE( "aIsAvatar: %d", aIsAvatar ); |
620 // avatar field set || clear |
607 // avatar field set || clear |
621 if ( aIsAvatar ) |
608 if ( aIsAvatar ) |
622 { |
609 { |
623 TRACE( T_LIT(" PublishOwnPresenceL adding avatar field")); |
610 TRACE( " PublishOwnPresenceL adding avatar field"); |
624 |
611 |
625 infoField = iXimpEventObserver.PresenceObjectFactoryL().NewInfoFieldLC(); |
612 infoField = iXimpEventObserver.PresenceObjectFactoryL().NewInfoFieldLC(); |
626 MPresenceInfoFieldValueBinary* avatarField = iXimpEventObserver.PresenceObjectFactoryL().NewBinaryInfoFieldLC(); |
613 MPresenceInfoFieldValueBinary* avatarField = iXimpEventObserver.PresenceObjectFactoryL().NewBinaryInfoFieldLC(); |
627 TRACE( T_LIT(" PublishOwnPresenceL processing image data")); |
614 TRACE( " PublishOwnPresenceL processing image data"); |
628 CVIMPSTEngineImageHandler* imageHandler = CVIMPSTEngineImageHandler::NewL(); |
615 CVIMPSTEngineImageHandler* imageHandler = CVIMPSTEngineImageHandler::NewL(); |
629 CleanupStack::PushL(imageHandler); |
616 CleanupStack::PushL(imageHandler); |
630 // get the avatar content from the image processor |
617 // get the avatar content from the image processor |
631 // returns image content if the processing succesful |
618 // returns image content if the processing succesful |
632 |
619 |
633 HBufC8* avatarContent = imageHandler->ProcessImageFromFileL( aFilename , aMimetype); |
620 HBufC8* avatarContent = imageHandler->ProcessImageFromFileL( aFilename , aMimetype); |
634 TRACE( T_LIT(" PublishOwnPresenceL processing image data completed ")); |
621 TRACE( " PublishOwnPresenceL processing image data completed "); |
635 if ( avatarContent ) |
622 if ( avatarContent ) |
636 { |
623 { |
637 TRACE( T_LIT("PublishOwnPresenceL valid image data found ")); |
624 TRACE( "PublishOwnPresenceL valid image data found "); |
638 CleanupStack::PushL(avatarContent); |
625 CleanupStack::PushL(avatarContent); |
639 // set a new avatar |
626 // set a new avatar |
640 avatarField->SetBinaryValueL(*avatarContent); |
627 avatarField->SetBinaryValueL(*avatarContent); |
641 avatarField->SetMimeTypeL(aMimetype); |
628 avatarField->SetMimeTypeL(aMimetype); |
642 CleanupStack::PopAndDestroy(); // avatarContent |
629 CleanupStack::PopAndDestroy(); // avatarContent |
643 } |
630 } |
644 else |
631 else |
645 { |
632 { |
646 TRACE( T_LIT("PublishOwnPresenceL NULL image data found ")); |
633 TRACE("PublishOwnPresenceL NULL image data found "); |
647 // clear the avatar |
634 // clear the avatar |
648 avatarField->SetBinaryValueL(KNullDesC8); |
635 avatarField->SetBinaryValueL(KNullDesC8); |
649 iIsClearingAvatar = ETrue; //set iIsClearingAvatar to ETrue |
636 iIsClearingAvatar = ETrue; //set iIsClearingAvatar to ETrue |
650 } |
637 } |
651 CleanupStack::PopAndDestroy(imageHandler); // imageHandler |
638 CleanupStack::PopAndDestroy(imageHandler); // imageHandler |
763 TInt CVIMPSTEnginePresenceSubService::FetchPresenceFromCache() |
751 TInt CVIMPSTEnginePresenceSubService::FetchPresenceFromCache() |
764 { |
752 { |
765 //TODO::Figure out how to get the service name. |
753 //TODO::Figure out how to get the service name. |
766 // passed the service id to see the member count |
754 // passed the service id to see the member count |
767 TInt error( KErrArgument ); |
755 TInt error( KErrArgument ); |
768 TRACE( T_LIT("CVIMPSTEnginePresenceSubService::FetchPresenceFormCache() start") ); |
756 TRACER_AUTO; |
769 if( iServiceName ) |
757 if( iServiceName ) |
770 { |
758 { |
771 TPtr serviceNamePtr = iServiceName->Des(); |
759 TPtr serviceNamePtr = iServiceName->Des(); |
772 TRACE( T_LIT("CVIMPSTEnginePresenceSubService::FetchPresenceFormCache() - %S"), |
760 TRACE( "CVIMPSTEnginePresenceSubService::FetchPresenceFormCache() - %S", &serviceNamePtr ); |
773 &serviceNamePtr ); |
|
774 // passed the service to register for notification |
761 // passed the service to register for notification |
775 error = iPresenceCacheReader->AllBuddiesPresenceInService(*iServiceName, this ); |
762 error = iPresenceCacheReader->AllBuddiesPresenceInService(*iServiceName, this ); |
776 } |
763 } |
777 TRACE( T_LIT("CVIMPSTEnginePresenceSubService::FetchPresenceFormCache() end") ); |
|
778 return error; |
764 return error; |
779 } |
765 } |
780 |
766 |
781 // --------------------------------------------------------------------------- |
767 // --------------------------------------------------------------------------- |
782 // CVIMPSTEnginePresenceSubService::HandlePresenceReadL |
768 // CVIMPSTEnginePresenceSubService::HandlePresenceReadL |
783 // --------------------------------------------------------------------------- |
769 // --------------------------------------------------------------------------- |
784 // |
770 // |
785 void CVIMPSTEnginePresenceSubService::HandlePresenceReadL(TInt /*aErrorCode*/, |
771 void CVIMPSTEnginePresenceSubService::HandlePresenceReadL(TInt /*aErrorCode*/, |
786 RPointerArray<MPresenceBuddyInfo2>& aPresenceBuddyInfoList) |
772 RPointerArray<MPresenceBuddyInfo2>& aPresenceBuddyInfoList) |
787 { |
773 { |
788 TRACE( T_LIT("CVIMPSTEnginePresenceSubService::HandlePresenceReadL start")); |
774 TRACER_AUTO; |
789 // we have the ownership of aPresenceBuddyInfoList : Push it to customize cleanupstack |
775 // we have the ownership of aPresenceBuddyInfoList : Push it to customize cleanupstack |
790 // aPresenceBuddyInfoList is collection of owned object and each object need to be deleted |
776 // aPresenceBuddyInfoList is collection of owned object and each object need to be deleted |
791 CustomCleanupResetAndDestroyPushL(aPresenceBuddyInfoList); |
777 CustomCleanupResetAndDestroyPushL(aPresenceBuddyInfoList); |
792 MVIMPSTStorageServiceView* storage = |
778 MVIMPSTStorageServiceView* storage = |
793 CVIMPSTStorageManagerFactory::ContactListInterfaceL(iServiceId); |
779 CVIMPSTStorageManagerFactory::ContactListInterfaceL(iServiceId); |
794 TInt buddyCount = aPresenceBuddyInfoList.Count(); |
780 TInt buddyCount = aPresenceBuddyInfoList.Count(); |
795 TRACE( T_LIT("CVIMPSTEnginePresenceSubService::HandlePresenceReadL - count: %d" ), buddyCount ); |
781 TRACE( "count: %d" , buddyCount ); |
796 for ( TInt i =0 ; i < buddyCount ; ++i) |
782 for ( TInt i =0 ; i < buddyCount ; ++i) |
797 { |
783 { |
798 TRACE( T_LIT("CVIMPSTEnginePresenceSubService::HandlePresenceReadL - buddy index: %d" ), i ); |
784 TRACE( " buddy index: %d" , i ); |
799 MPresenceBuddyInfo2* buddyinfo = aPresenceBuddyInfoList[i]; |
785 MPresenceBuddyInfo2* buddyinfo = aPresenceBuddyInfoList[i]; |
800 // read the buddyID : returns in XSP format |
786 // read the buddyID : returns in XSP format |
801 TPtrC buddyXSPId = buddyinfo->BuddyId(); |
787 TPtrC buddyXSPId = buddyinfo->BuddyId(); |
802 TRACE( T_LIT("CVIMPSTEnginePresenceSubService::HandlePresenceReadL - Status Message: %s" ), &buddyXSPId ); |
788 TRACE( "Status Message: %s" , &buddyXSPId ); |
803 TPtrC buddyId = buddyXSPId.Right( buddyXSPId.Length() - iServiceName->Length() - KColon().Length()); |
789 TPtrC buddyId = buddyXSPId.Right( buddyXSPId.Length() - iServiceName->Length() - KColon().Length()); |
804 // read the availability /presence state enum value |
790 // read the availability /presence state enum value |
805 MPresenceBuddyInfo2::TAvailabilityValues availabilityEnum = buddyinfo->Availability(); |
791 MPresenceBuddyInfo2::TAvailabilityValues availabilityEnum = buddyinfo->Availability(); |
806 TRACE( T_LIT("CVIMPSTEnginePresenceSubService::HandlePresenceReadL - Availability ENUM value: %d" ), availabilityEnum ); |
792 TRACE( "Availability ENUM value: %d" , availabilityEnum ); |
807 TPtrC avablityText = buddyinfo->AvailabilityText(); |
793 TPtrC avablityText = buddyinfo->AvailabilityText(); |
808 // convert the presence cache enum value to service tab enum |
794 // convert the presence cache enum value to service tab enum |
809 TVIMPSTEnums::TOnlineStatus status = ConvertPresenceCacheEnums( availabilityEnum , avablityText); |
795 TVIMPSTEnums::TOnlineStatus status = ConvertPresenceCacheEnums( availabilityEnum , avablityText); |
810 // get the GetAnyFiled(which has only pending and blocked states.) |
796 // get the GetAnyFiled(which has only pending and blocked states.) |
811 if(TVIMPSTEnums::EUnKnown == status) |
797 if(TVIMPSTEnums::EUnKnown == status) |
812 { |
798 { |
813 GetKeyFieldsAndValuesL(*buddyinfo,status); |
799 GetKeyFieldsAndValuesL(*buddyinfo,status); |
814 } |
800 } |
815 // read the status message |
801 // read the status message |
816 TPtrC statusMsg = buddyinfo->StatusMessage(); |
802 TPtrC statusMsg = buddyinfo->StatusMessage(); |
817 TRACE( T_LIT("CVIMPSTEnginePresenceSubService::HandlePresenceReadL - Status Message: %s" ), &statusMsg ); |
803 TRACE("Status Message: %s" , &statusMsg ); |
818 TPtrC8 avatarContent = buddyinfo->Avatar(); |
804 TPtrC8 avatarContent = buddyinfo->Avatar(); |
819 HBufC8* avatarScaledData = NULL; |
805 HBufC8* avatarScaledData = NULL; |
820 if ( avatarContent.Length() ) |
806 if ( avatarContent.Length() ) |
821 { |
807 { |
822 TRACE( T_LIT("CVIMPSTEnginePresenceSubService::HandlePresenceReadL - avatarContent Content available" ) ); |
808 TRACE( "avatarContent Content available" ); |
823 CVIMPSTEngineImageHandler* imageHandler = CVIMPSTEngineImageHandler::NewL(); |
809 CVIMPSTEngineImageHandler* imageHandler = CVIMPSTEngineImageHandler::NewL(); |
824 CleanupStack::PushL(imageHandler); |
810 CleanupStack::PushL(imageHandler); |
825 TRACE( T_LIT("CVIMPSTEnginePresenceSubService::HandlePresenceReadL - imageHandler created " ) ); |
811 TRACE( "imageHandler created " ); |
826 avatarScaledData = imageHandler->ProcessImageFromDataL( avatarContent , KNullDesC8() ); |
812 avatarScaledData = imageHandler->ProcessImageFromDataL( avatarContent , KNullDesC8() ); |
827 TRACE( T_LIT("CVIMPSTEnginePresenceSubService::HandlePresenceReadL - ProcessImageFromDataL returned " ) ); |
813 TRACE( "ProcessImageFromDataL returned " ); |
828 CleanupStack::PopAndDestroy();//imageHandler |
814 CleanupStack::PopAndDestroy();//imageHandler |
829 } |
815 } |
830 if( avatarScaledData && avatarScaledData->Length() ) |
816 if( avatarScaledData && avatarScaledData->Length() ) |
831 { |
817 { |
832 CleanupStack::PushL(avatarScaledData); |
818 CleanupStack::PushL(avatarScaledData); |
839 } |
825 } |
840 } |
826 } |
841 aPresenceBuddyInfoList.ResetAndDestroy(); |
827 aPresenceBuddyInfoList.ResetAndDestroy(); |
842 |
828 |
843 CleanupStack::PopAndDestroy(); // aPresenceBuddyInfoList |
829 CleanupStack::PopAndDestroy(); // aPresenceBuddyInfoList |
844 TRACE( T_LIT("CVIMPSTEnginePresenceSubService::HandlePresenceReadL end")); |
|
845 } |
830 } |
846 |
831 |
847 // --------------------------------------------------------------------------- |
832 // --------------------------------------------------------------------------- |
848 // CVIMPSTEnginePresenceSubService::HandlePresenceNotificationL |
833 // CVIMPSTEnginePresenceSubService::HandlePresenceNotificationL |
849 // --------------------------------------------------------------------------- |
834 // --------------------------------------------------------------------------- |
850 // |
835 // |
851 void CVIMPSTEnginePresenceSubService::HandlePresenceNotificationL(TInt /*aErrorCode*/, |
836 void CVIMPSTEnginePresenceSubService::HandlePresenceNotificationL(TInt /*aErrorCode*/, |
852 MPresenceBuddyInfo2* aPresenceBuddyInfo) |
837 MPresenceBuddyInfo2* aPresenceBuddyInfo) |
853 { |
838 { |
854 TRACE( T_LIT("CVIMPSTEnginePresenceSubService::HandlePresenceNotificationL start")); |
839 TRACER_AUTO; |
855 |
840 |
856 if ( aPresenceBuddyInfo ) |
841 if ( aPresenceBuddyInfo ) |
857 { |
842 { |
858 CleanupDeletePushL( aPresenceBuddyInfo ); |
843 CleanupDeletePushL( aPresenceBuddyInfo ); |
859 DoHandlePresenceNotificationL(*aPresenceBuddyInfo); |
844 DoHandlePresenceNotificationL(*aPresenceBuddyInfo); |
860 CleanupStack::PopAndDestroy(1); // aPresenceBuddyInfo |
845 CleanupStack::PopAndDestroy(1); // aPresenceBuddyInfo |
861 |
846 |
862 } |
847 } |
863 TRACE( T_LIT("CVIMPSTEnginePresenceSubService::HandlePresenceNotificationL end")); |
|
864 } |
848 } |
865 |
849 |
866 |
850 |
867 // --------------------------------------------------------- |
851 // --------------------------------------------------------- |
868 // CVIMPSTEnginePresenceSubService::SubscribeForAuthorizationL |
852 // CVIMPSTEnginePresenceSubService::SubscribeForAuthorizationL |
869 // |
853 // |
870 // --------------------------------------------------------- |
854 // --------------------------------------------------------- |
871 void CVIMPSTEnginePresenceSubService::SubscribeForAuthorizationL() |
855 void CVIMPSTEnginePresenceSubService::SubscribeForAuthorizationL() |
872 { |
856 { |
|
857 TRACER_AUTO; |
873 TXIMPRequestId req; |
858 TXIMPRequestId req; |
874 MPresenceAuthorization& authorization = iXimpEventObserver.XimpAuthorizationL(); |
859 MPresenceAuthorization& authorization = iXimpEventObserver.XimpAuthorizationL(); |
875 req = authorization.SubscribePresenceGrantRequestListL(); |
860 req = authorization.SubscribePresenceGrantRequestListL(); |
876 // mapper is not own |
861 // mapper is not own |
877 CVIMPSTEngineRequestMapper* mapper = iXimpEventObserver.GetRequestMapper(); |
862 CVIMPSTEngineRequestMapper* mapper = iXimpEventObserver.GetRequestMapper(); |
922 if( ( ( error == KPREQUESTERRSUCCESSFUL) || ( error == KErrNone ) || iAutoAccept) ) |
907 if( ( ( error == KPREQUESTERRSUCCESSFUL) || ( error == KErrNone ) || iAutoAccept) ) |
923 { |
908 { |
924 MVIMPSTStorageServiceView* storage = CVIMPSTStorageManagerFactory::ContactListInterfaceL(iServiceId) ; |
909 MVIMPSTStorageServiceView* storage = CVIMPSTStorageManagerFactory::ContactListInterfaceL(iServiceId) ; |
925 if(storage && ( !storage->IsLocalStore() || iAutoAccept ) && aResponse ) |
910 if(storage && ( !storage->IsLocalStore() || iAutoAccept ) && aResponse ) |
926 { |
911 { |
927 TRACE( T_LIT("CVIMPSTEnginePresenceSubService::SendPresenceGrantPresentityL server store") ); |
912 TRACE( " server store" ); |
928 storage->CreateNewContactL( aContactId,KNullDesC, ETrue, iAutoAccept ); // ETrue is for invitation item |
913 storage->CreateNewContactL( aContactId,KNullDesC, ETrue, iAutoAccept ); // ETrue is for invitation item |
929 } |
914 } |
930 } |
915 } |
931 CleanupStack::PopAndDestroy(); //contactIdentity |
916 CleanupStack::PopAndDestroy(); //contactIdentity |
932 TRACE( T_LIT("CVIMPSTEnginePresenceSubService::SendPresenceGrantPresentityL end")); |
|
933 return error; |
917 return error; |
934 } |
918 } |
935 // --------------------------------------------------------- |
919 // --------------------------------------------------------- |
936 // CVIMPSTEnginePresenceSubService::HandleSessionContextEventL |
920 // CVIMPSTEnginePresenceSubService::HandleSessionContextEventL |
937 // --------------------------------------------------------- |
921 // --------------------------------------------------------- |
938 void CVIMPSTEnginePresenceSubService::HandleSessionContextEventL(const MXIMPContext& aContext, |
922 void CVIMPSTEnginePresenceSubService::HandleSessionContextEventL(const MXIMPContext& aContext, |
939 const MXIMPBase& aEvent, |
923 const MXIMPBase& aEvent, |
940 TXimpOperation aXimpOperation /*= EVIMPSTXimpOperationNoOperation*/ ) |
924 TXimpOperation aXimpOperation /*= EVIMPSTXimpOperationNoOperation*/ ) |
941 { |
925 { |
942 TRACE( T_LIT("CVIMPSTEnginePresenceSubService::HandleSessionContextEventL start")); |
926 TRACER_AUTO; |
943 TInt32 eventId = aEvent.GetInterfaceId(); |
927 TInt32 eventId = aEvent.GetInterfaceId(); |
944 |
928 |
945 switch( aEvent.GetInterfaceId() ) |
929 switch( aEvent.GetInterfaceId() ) |
946 { |
930 { |
947 case MXIMPRequestCompleteEvent::KInterfaceId: |
931 case MXIMPRequestCompleteEvent::KInterfaceId: |
948 { |
932 { |
949 TRACE( T_LIT("InsideCallbackswitch::MXIMPRequestCompleteEvent")); |
933 TRACE( "MXIMPRequestCompleteEvent"); |
950 //temp fix TBD |
934 //temp fix TBD |
951 //Only use the operations that u r intertest in |
935 //Only use the operations that u r intertest in |
952 if ( aXimpOperation <= EVIMPSTXimpOperationUnsubscribe ) |
936 if ( aXimpOperation <= EVIMPSTXimpOperationUnsubscribe ) |
953 { |
937 { |
954 |
938 |
958 TRAP_IGNORE( HandleXimpRequestCompleteL( |
942 TRAP_IGNORE( HandleXimpRequestCompleteL( |
959 aXimpOperation, |
943 aXimpOperation, |
960 event->CompletionResult().ResultCode(), |
944 event->CompletionResult().ResultCode(), |
961 aEvent ) ); |
945 aEvent ) ); |
962 } |
946 } |
963 TRACE( T_LIT("InsideCallback::HandlePresenceContextEvent")); |
947 TRACE( "HandlePresenceContextEvent"); |
964 |
948 |
965 break; |
949 break; |
966 } |
950 } |
967 case MXIMPContextStateEvent::KInterfaceId: |
951 case MXIMPContextStateEvent::KInterfaceId: |
968 { |
952 { |
969 TRACE( T_LIT("InsideCallbackswitch::MXIMPContextStateEvent")); |
953 TRACE( "InsideCallbackswitch::MXIMPContextStateEvent"); |
970 TRACE( T_LIT("InsideCallback::MXIMPContextStateEvent")); |
954 TRACE("InsideCallback::MXIMPContextStateEvent"); |
971 break; |
955 break; |
972 } |
956 } |
973 case MPresentityGroupContentEvent::KInterfaceId: |
957 case MPresentityGroupContentEvent::KInterfaceId: |
974 { |
958 { |
975 TRACE( T_LIT("CVIMPSTEnginePresenceSubService::MPresentityGroupContentEvent")); |
959 TRACE( "MPresentityGroupContentEvent"); |
976 DoHandlePresentityGroupContentEventL( aContext, aEvent ); |
960 DoHandlePresentityGroupContentEventL( aContext, aEvent ); |
977 TRACE( T_LIT("CVIMPSTEnginePresenceSubService::MPresentityGroupContentEvent")); |
961 TRACE( "MPresentityGroupContentEvent"); |
978 break; |
962 break; |
979 } |
963 } |
980 case MPresenceGrantRequestListEvent::KInterfaceId: |
964 case MPresenceGrantRequestListEvent::KInterfaceId: |
981 { |
965 { |
982 TRACE( T_LIT("CVIMPSTEnginePresenceSubService::MPresenceGrantRequestListEvent")); |
966 TRACE( "MPresenceGrantRequestListEvent"); |
983 DoHandlePresenceGrantRequestListEventL( aContext, aEvent ); |
967 DoHandlePresenceGrantRequestListEventL( aContext, aEvent ); |
984 TRACE( T_LIT("CVIMPSTEnginePresenceSubService::MPresenceGrantRequestListEvent")); |
968 TRACE( "MPresenceGrantRequestListEvent"); |
985 break; |
969 break; |
986 } |
970 } |
987 case MPresenceBlockListEvent::KInterfaceId: |
971 case MPresenceBlockListEvent::KInterfaceId: |
988 { |
972 { |
989 TRACE( T_LIT("CVIMPSTEnginePresenceSubService::MPresenceBlockListEvent")); |
973 TRACE( "MPresenceBlockListEvent"); |
990 DoHandlePresenceBlockListEventL( aContext, aEvent ); |
974 DoHandlePresenceBlockListEventL( aContext, aEvent ); |
991 TRACE( T_LIT("CVIMPSTEnginePresenceSubService::MPresenceBlockListEvent")); |
975 TRACE( "MPresenceBlockListEvent"); |
992 |
976 |
993 break; |
977 break; |
994 } |
978 } |
995 |
979 |
996 default: |
980 default: |
997 { |
981 { |
998 break; |
982 break; |
999 } |
983 } |
1000 } |
984 } |
1001 TRACE( T_LIT("CVIMPSTEnginePresenceSubService::HandleSessionContextEventL end")); |
|
1002 } |
985 } |
1003 |
986 |
1004 // --------------------------------------------------------------------------- |
987 // --------------------------------------------------------------------------- |
1005 // CVIMPSTEnginePresenceSubService::HandleListEventCompleteL |
988 // CVIMPSTEnginePresenceSubService::HandleListEventCompleteL |
1006 // --------------------------------------------------------------------------- |
989 // --------------------------------------------------------------------------- |
1007 // |
990 // |
1008 void CVIMPSTEnginePresenceSubService::HandleListEventCompleteL(TXimpOperation aType, |
991 void CVIMPSTEnginePresenceSubService::HandleListEventCompleteL(TXimpOperation aType, |
1009 TInt aCompleteCode, |
992 TInt aCompleteCode, |
1010 const MXIMPBase& /*aEvent*/) |
993 const MXIMPBase& /*aEvent*/) |
1011 { |
994 { |
1012 TRACE( T_LIT("CVIMPSTEnginePresenceSubService::HandleListEventCompleteL start")); |
995 TRACER_AUTO; |
1013 |
996 |
1014 switch ( aType ) |
997 switch ( aType ) |
1015 { |
998 { |
1016 case EVIMPSTXimpOperationBind: |
999 case EVIMPSTXimpOperationBind: |
1017 { |
1000 { |
1189 const MPresentityGroupMemberInfo& memberInfo = |
1170 const MPresentityGroupMemberInfo& memberInfo = |
1190 aListEvent.NewMember( i ) ; |
1171 aListEvent.NewMember( i ) ; |
1191 const MXIMPIdentity& memberIdentity = memberInfo.GroupMemberId() ; |
1172 const MXIMPIdentity& memberIdentity = memberInfo.GroupMemberId() ; |
1192 TPtrC userId = memberIdentity.Identity(); |
1173 TPtrC userId = memberIdentity.Identity(); |
1193 TPtrC displayeName = memberInfo.GroupMemberDisplayName(); |
1174 TPtrC displayeName = memberInfo.GroupMemberDisplayName(); |
1194 TRACE( T_LIT("CVIMPSTEnginePresenceSubService: newMember %S"), &userId ); |
1175 TRACE( " newMember %S", &userId ); |
1195 storage->CreateNewContactL(userId,displayeName,ETrue,ETrue); |
1176 storage->CreateNewContactL(userId,displayeName,ETrue,ETrue); |
1196 } |
1177 } |
1197 TInt removedMembrcount = aListEvent.DisappearedMembersCount() ; |
1178 TInt removedMembrcount = aListEvent.DisappearedMembersCount() ; |
1198 for(TInt i = 0; i < removedMembrcount ;i++ ) |
1179 for(TInt i = 0; i < removedMembrcount ;i++ ) |
1199 { |
1180 { |
1200 const MPresentityGroupMemberInfo& memberInfo = |
1181 const MPresentityGroupMemberInfo& memberInfo = |
1201 aListEvent.DisappearedMember( i ) ; |
1182 aListEvent.DisappearedMember( i ) ; |
1202 const MXIMPIdentity& memberIdentity = memberInfo.GroupMemberId() ; |
1183 const MXIMPIdentity& memberIdentity = memberInfo.GroupMemberId() ; |
1203 TPtrC userId = memberIdentity.Identity(); |
1184 TPtrC userId = memberIdentity.Identity(); |
1204 TRACE( T_LIT("CVIMPSTEnginePresenceSubService: deleteMember %S"), &userId ); |
1185 TRACE( "deleteMember %S", &userId ); |
1205 MVIMPSTStorageContact* contactExist = storage->FindContactByUserId(userId); |
1186 MVIMPSTStorageContact* contactExist = storage->FindContactByUserId(userId); |
1206 if(contactExist) |
1187 if(contactExist) |
1207 { |
1188 { |
1208 storage->RemoveContactL(contactExist); |
1189 storage->RemoveContactL(contactExist); |
1209 } |
1190 } |
1210 } |
1191 } |
1211 } |
1192 } |
1212 |
1193 |
1213 } |
1194 } |
1214 TRACE( T_LIT("CVIMPSTEnginePresenceSubService::StoreToVirtualStoreL end")); |
|
1215 } |
1195 } |
1216 |
1196 |
1217 // --------------------------------------------------------- |
1197 // --------------------------------------------------------- |
1218 // CVIMPSTEnginePresenceSubService::IsChangeOwnStatusSupported |
1198 // CVIMPSTEnginePresenceSubService::IsChangeOwnStatusSupported |
1219 // |
1199 // |
1316 // --------------------------------------------------------- |
1297 // --------------------------------------------------------- |
1317 //TODO::Should be named as RegisterPresenceEventObserverL |
1298 //TODO::Should be named as RegisterPresenceEventObserverL |
1318 void CVIMPSTEnginePresenceSubService::RegisterPresenceEventObserverL( |
1299 void CVIMPSTEnginePresenceSubService::RegisterPresenceEventObserverL( |
1319 MVIMPSTEnginePresenceSubServiceEventObserver* aObserver) |
1300 MVIMPSTEnginePresenceSubServiceEventObserver* aObserver) |
1320 { |
1301 { |
1321 TRACE( T_LIT("CVIMPSTEnginePresenceSubService::RegisterPresenceEventObserver start")); |
1302 TRACER_AUTO; |
1322 __ASSERT_ALWAYS( aObserver, User::Leave( KErrArgument )); |
1303 __ASSERT_ALWAYS( aObserver, User::Leave( KErrArgument )); |
1323 iSubServiceObserver = aObserver; |
1304 iSubServiceObserver = aObserver; |
1324 TRACE( T_LIT("CVIMPSTEnginePresenceSubService::RegisterPresenceEventObserver end")); |
|
1325 } |
1305 } |
1326 |
1306 |
1327 // --------------------------------------------------------- |
1307 // --------------------------------------------------------- |
1328 // CVIMPSTEnginePresenceSubService::UnRegisterPresenceEventObserver |
1308 // CVIMPSTEnginePresenceSubService::UnRegisterPresenceEventObserver |
1329 // |
1309 // |
1330 // --------------------------------------------------------- |
1310 // --------------------------------------------------------- |
1331 |
1311 |
1332 void CVIMPSTEnginePresenceSubService::UnRegisterPresenceEventObserver( |
1312 void CVIMPSTEnginePresenceSubService::UnRegisterPresenceEventObserver( |
1333 MVIMPSTEnginePresenceSubServiceEventObserver* /*aObserver*/) |
1313 MVIMPSTEnginePresenceSubServiceEventObserver* /*aObserver*/) |
1334 { |
1314 { |
1335 TRACE( T_LIT("CVIMPSTEnginePresenceSubService::UnRegisterPresenceEventObserver start")); |
1315 TRACER_AUTO; |
1336 iSubServiceObserver = NULL; |
1316 iSubServiceObserver = NULL; |
1337 TRACE( T_LIT("CVIMPSTEnginePresenceSubService::UnRegisterPresenceEventObserver end")); |
|
1338 } |
1317 } |
1339 // --------------------------------------------------------------------------- |
1318 // --------------------------------------------------------------------------- |
1340 // CVIMPSTEnginePresenceSubService::RetrieveBlockListL |
1319 // CVIMPSTEnginePresenceSubService::RetrieveBlockListL |
1341 // --------------------------------------------------------------------------- |
1320 // --------------------------------------------------------------------------- |
1342 // |
1321 // |
1343 void CVIMPSTEnginePresenceSubService::RetrieveBlockListL() |
1322 void CVIMPSTEnginePresenceSubService::RetrieveBlockListL() |
1344 { |
1323 { |
1345 TRACE( T_LIT("CVIMPSTEnginePresenceSubService::RetrieveBlockListL start")); |
1324 TRACER_AUTO; |
1346 |
1325 |
1347 //Subscribe block list |
1326 //Subscribe block list |
1348 // do get block list")); |
1327 // do get block list")); |
1349 TXIMPRequestId operationId = TXIMPRequestId::Null(); |
1328 TXIMPRequestId operationId = TXIMPRequestId::Null(); |
1350 operationId = iXimpEventObserver.XimpAuthorizationL().SubscribePresenceBlockListL(); |
1329 operationId = iXimpEventObserver.XimpAuthorizationL().SubscribePresenceBlockListL(); |
1351 CVIMPSTEngineRequestMapper* requestMapper =iXimpEventObserver.GetRequestMapper(); |
1330 CVIMPSTEngineRequestMapper* requestMapper =iXimpEventObserver.GetRequestMapper(); |
1352 requestMapper->CreateRequestL(operationId,EFalse,EVIMPSTXimpOperationGetBlockList); |
1331 requestMapper->CreateRequestL(operationId,EFalse,EVIMPSTXimpOperationGetBlockList); |
1353 // list retrieving ok. Waiting for list.; |
1332 // list retrieving ok. Waiting for list.; |
1354 TRACE( T_LIT("CVIMPSTEnginePresenceSubService::RetrieveBlockListL end")); |
|
1355 } |
1333 } |
1356 // --------------------------------------------------------------------------- |
1334 // --------------------------------------------------------------------------- |
1357 // CVIMPSTEnginePresenceSubService::DoHandlePresenceNotificationL |
1335 // CVIMPSTEnginePresenceSubService::DoHandlePresenceNotificationL |
1358 // --------------------------------------------------------------------------- |
1336 // --------------------------------------------------------------------------- |
1359 // |
1337 // |
1360 void CVIMPSTEnginePresenceSubService::DoHandlePresenceNotificationL(MPresenceBuddyInfo2& aPresenceBuddyInfo) |
1338 void CVIMPSTEnginePresenceSubService::DoHandlePresenceNotificationL(MPresenceBuddyInfo2& aPresenceBuddyInfo) |
1361 { |
1339 { |
1362 TRACE( T_LIT("CVIMPSTEnginePresenceSubService::DoHandlePresenceNotificationL start" ) ); |
1340 TRACER_AUTO; |
1363 MVIMPSTStorageServiceView* storage = |
1341 MVIMPSTStorageServiceView* storage = |
1364 CVIMPSTStorageManagerFactory::ContactListInterfaceL(iServiceId); |
1342 CVIMPSTStorageManagerFactory::ContactListInterfaceL(iServiceId); |
1365 TPtrC ownUserId = storage->OwnContactL().UserId(); |
1343 TPtrC ownUserId = storage->OwnContactL().UserId(); |
1366 // read the buddyID : returns in XSP format |
1344 // read the buddyID : returns in XSP format |
1367 TPtrC buddyXSPId = aPresenceBuddyInfo.BuddyId(); |
1345 TPtrC buddyXSPId = aPresenceBuddyInfo.BuddyId(); |
1368 TPtrC buddyId = buddyXSPId.Right( buddyXSPId.Length() - iServiceName->Length() - KColon().Length()); |
1346 TPtrC buddyId = buddyXSPId.Right( buddyXSPId.Length() - iServiceName->Length() - KColon().Length()); |
1369 TRACE( T_LIT("CVIMPSTEnginePresenceSubService::DoHandlePresenceNotificationL buddyId : %s" ), &buddyId ); |
1347 TRACE( " buddyId : %s" , &buddyId ); |
1370 // read the availability /presence state enum value |
1348 // read the availability /presence state enum value |
1371 MPresenceBuddyInfo2::TAvailabilityValues availabilityEnum = aPresenceBuddyInfo.Availability(); |
1349 MPresenceBuddyInfo2::TAvailabilityValues availabilityEnum = aPresenceBuddyInfo.Availability(); |
1372 TRACE( T_LIT("CVIMPSTEnginePresenceSubService::DoHandlePresenceNotificationL - Availability ENUM value: %d" ), availabilityEnum ); |
1350 TRACE( "Availability ENUM value: %d" , availabilityEnum ); |
1373 TPtrC avablityText = aPresenceBuddyInfo.AvailabilityText(); |
1351 TPtrC avablityText = aPresenceBuddyInfo.AvailabilityText(); |
1374 // convert the presence cache enum value to service tab enum |
1352 // convert the presence cache enum value to service tab enum |
1375 TVIMPSTEnums::TOnlineStatus status = ConvertPresenceCacheEnums( availabilityEnum, avablityText); |
1353 TVIMPSTEnums::TOnlineStatus status = ConvertPresenceCacheEnums( availabilityEnum, avablityText); |
1376 //TRACE( T_LIT("CVIMPSTEnginePresenceSubService::DoHandlePresenceNotificationL - status: %d" ), status ); |
1354 //TRACE( T_LIT("CVIMPSTEnginePresenceSubService::DoHandlePresenceNotificationL - status: %d" ), status ); |
1377 //check if its pending or blocked contact. |
1355 //check if its pending or blocked contact. |
1378 if(TVIMPSTEnums::EUnKnown == status) |
1356 if(TVIMPSTEnums::EUnKnown == status) |
1379 { |
1357 { |
1380 GetKeyFieldsAndValuesL(aPresenceBuddyInfo,status); |
1358 GetKeyFieldsAndValuesL(aPresenceBuddyInfo,status); |
1381 //TRACE( T_LIT("DoHandlePresenceNotificationL after GetKeyFieldsAndValuesL- status: %d" ), status ); |
1359 //TRACE( T_LIT("DoHandlePresenceNotificationL after GetKeyFieldsAndValuesL- status: %d" ), status ); |
1382 } |
1360 } |
1383 TRACE( T_LIT("DoHandlePresenceNotificationL - status: %d" ), status ); |
1361 TRACE( " status: %d" , status ); |
1384 // Read the status message |
1362 // Read the status message |
1385 TPtrC statusMsg = aPresenceBuddyInfo.StatusMessage(); |
1363 TPtrC statusMsg = aPresenceBuddyInfo.StatusMessage(); |
1386 TRACE( T_LIT("CVIMPSTEnginePresenceSubService::DoHandlePresenceNotificationL - Status Message: %s" ), &statusMsg ); |
1364 TRACE("Status Message: %s" , &statusMsg ); |
1387 TPtrC8 avatarContent = aPresenceBuddyInfo.Avatar(); |
1365 TPtrC8 avatarContent = aPresenceBuddyInfo.Avatar(); |
1388 |
1366 |
1389 //////////////////////////////////////////////////////////////// |
1367 //////////////////////////////////////////////////////////////// |
1390 HBufC8* avatarScaledData = NULL; |
1368 HBufC8* avatarScaledData = NULL; |
1391 if ( avatarContent.Length() ) |
1369 if ( avatarContent.Length() ) |
1392 { |
1370 { |
1393 TRACE( T_LIT("CVIMPSTEnginePresenceSubService::DoHandlePresenceNotificationL - avatarContent Content available" ) ); |
1371 TRACE( "avatarContent Content available" ); |
1394 CVIMPSTEngineImageHandler* imageHandler = CVIMPSTEngineImageHandler::NewL(); |
1372 CVIMPSTEngineImageHandler* imageHandler = CVIMPSTEngineImageHandler::NewL(); |
1395 CleanupStack::PushL(imageHandler); |
1373 CleanupStack::PushL(imageHandler); |
1396 TRACE( T_LIT("CVIMPSTEnginePresenceSubService::DoHandlePresenceNotificationL - imageHandler created " ) ); |
1374 TRACE( "imageHandler created " ); |
1397 avatarScaledData = imageHandler->ProcessImageFromDataL( avatarContent , KNullDesC8() ); |
1375 avatarScaledData = imageHandler->ProcessImageFromDataL( avatarContent , KNullDesC8() ); |
1398 TRACE( T_LIT("CVIMPSTEnginePresenceSubService::DoHandlePresenceNotificationL - ProcessImageFromDataL returned " ) ); |
1376 TRACE( " ProcessImageFromDataL returned " ); |
1399 CleanupStack::PopAndDestroy();//imageHandler |
1377 CleanupStack::PopAndDestroy();//imageHandler |
1400 } |
1378 } |
1401 if( avatarScaledData && avatarScaledData->Length()) |
1379 if( avatarScaledData && avatarScaledData->Length()) |
1402 { |
1380 { |
1403 CleanupStack::PushL(avatarScaledData); |
1381 CleanupStack::PushL(avatarScaledData); |
1411 } |
1389 } |
1412 else |
1390 else |
1413 { |
1391 { |
1414 storage->UpdatePresenceL(buddyId, status, statusMsg, KNullDesC8 ); |
1392 storage->UpdatePresenceL(buddyId, status, statusMsg, KNullDesC8 ); |
1415 } |
1393 } |
1416 TRACE( T_LIT("CVIMPSTEnginePresenceSubService::DoHandlePresenceNotificationL end" ) ); |
|
1417 } |
1394 } |
1418 // --------------- ------------------------------------------------------------ |
1395 // --------------- ------------------------------------------------------------ |
1419 // CVIMPSTEnginePresenceSubService:: |
1396 // CVIMPSTEnginePresenceSubService:: |
1420 // DoHandlePresentityGroupContentEventL |
1397 // DoHandlePresentityGroupContentEventL |
1421 // --------------------------------------------------------------------------- |
1398 // --------------------------------------------------------------------------- |
1422 // |
1399 // |
1423 void CVIMPSTEnginePresenceSubService::DoHandlePresenceBlockListEventL( |
1400 void CVIMPSTEnginePresenceSubService::DoHandlePresenceBlockListEventL( |
1424 const MXIMPContext& /*aContext*/, |
1401 const MXIMPContext& /*aContext*/, |
1425 const MXIMPBase& aEvent ) |
1402 const MXIMPBase& aEvent ) |
1426 { |
1403 { |
1427 TRACE( T_LIT("CVIMPSTEnginePresenceSubService::DoHandlePresenceBlockListEventL start")); |
1404 TRACER_AUTO; |
1428 const MPresenceBlockListEvent& event = |
1405 const MPresenceBlockListEvent& event = |
1429 *TXIMPGetInterface< const MPresenceBlockListEvent >::From( |
1406 *TXIMPGetInterface< const MPresenceBlockListEvent >::From( |
1430 aEvent, |
1407 aEvent, |
1431 MXIMPBase::EPanicIfUnknown ); |
1408 MXIMPBase::EPanicIfUnknown ); |
1432 // if the feature is supported then we need to add this contact into virtual store. |
1409 // if the feature is supported then we need to add this contact into virtual store. |
1433 // that logic needs to be implemented. |
1410 // that logic needs to be implemented. |
1434 // inform ui about the state change from updatingcontacts to registered. |
1411 // inform ui about the state change from updatingcontacts to registered. |
1435 if(TVIMPSTEnums::ESVCEUpdatingContacts == iServiceState ) |
1412 if(TVIMPSTEnums::ESVCEUpdatingContacts == iServiceState ) |
1436 { |
1413 { |
1437 TRACE( T_LIT(" -> CVIMPSTEnginePresenceSubService:state is ESVCEUpdatingContacts" )); |
1414 TRACE( " -> DoHandlePresentityGroupContentEventL:state is ESVCEUpdatingContacts" ); |
1438 } |
1415 } |
1439 |
1416 |
1440 TRACE( T_LIT(" -> new member count: %d" ), event.NewBlocksCount()); |
1417 TRACE( " new member count: %d" , event.NewBlocksCount()); |
1441 |
1418 |
1442 TInt subscriptionCount = event.NewBlocksCount(); |
1419 TInt subscriptionCount = event.NewBlocksCount(); |
1443 |
1420 |
1444 TRACE( T_LIT(" -> subscriptionCount: %d"), subscriptionCount ); |
1421 TRACE(" subscriptionCount: %d", subscriptionCount ); |
1445 |
1422 |
1446 TRACE( T_LIT(" -> handling buddy list" ) ); |
1423 TRACE( " handling buddy list" ); |
1447 HBufC* subsbuf(NULL); |
1424 HBufC* subsbuf(NULL); |
1448 for( TInt i =0; i < subscriptionCount; i++ ) |
1425 for( TInt i =0; i < subscriptionCount; i++ ) |
1449 { |
1426 { |
1450 const MPresenceBlockInfo& blockedEntitys = event.NewBlock(i); |
1427 const MPresenceBlockInfo& blockedEntitys = event.NewBlock(i); |
1451 const MXIMPIdentity& ident = blockedEntitys.BlockedEntityId(); |
1428 const MXIMPIdentity& ident = blockedEntitys.BlockedEntityId(); |
1452 subsbuf = ident.Identity().AllocLC(); |
1429 subsbuf = ident.Identity().AllocLC(); |
1453 TPtr subsbufPtr = subsbuf->Des(); |
1430 TPtr subsbufPtr = subsbuf->Des(); |
1454 TRACE( T_LIT(" -> identity: %S"), &subsbufPtr ); |
1431 TRACE( " -> identity: %S", &subsbufPtr ); |
1455 |
1432 |
1456 TRACE( T_LIT(" -> subscribe to cache" ) ); |
1433 TRACE(" -> subscribe to cache" ); |
1457 SubscribePresenceOfSingleContactL(*subsbuf); |
1434 SubscribePresenceOfSingleContactL(*subsbuf); |
1458 iBlockedListMgr->AddToBlockedListL(*subsbuf); |
1435 iBlockedListMgr->AddToBlockedListL(*subsbuf); |
1459 CleanupStack::PopAndDestroy( subsbuf ); |
1436 CleanupStack::PopAndDestroy( subsbuf ); |
1460 } |
1437 } |
1461 TInt disappearedCount = event.DisappearedBlocksCount(); |
1438 TInt disappearedCount = event.DisappearedBlocksCount(); |
1476 if(iBlockedListObserver) |
1453 if(iBlockedListObserver) |
1477 { |
1454 { |
1478 iBlockedListObserver->HandleBlockedListFetchCompleteL(); |
1455 iBlockedListObserver->HandleBlockedListFetchCompleteL(); |
1479 iBlockListFetchReqPending = EFalse; |
1456 iBlockListFetchReqPending = EFalse; |
1480 } |
1457 } |
1481 TRACE( T_LIT("CVIMPSTEnginePresenceSubService::DoHandlePresenceBlockListEventL end")); |
|
1482 |
1458 |
1483 } |
1459 } |
1484 |
1460 |
1485 // --------------------------------------------------------------------------- |
1461 // --------------------------------------------------------------------------- |
1486 // CVIMPSTEnginePresenceSubService::AddToBlockListL |
1462 // CVIMPSTEnginePresenceSubService::AddToBlockListL |
1487 // --------------------------------------------------------------------------- |
1463 // --------------------------------------------------------------------------- |
1488 // |
1464 // |
1489 TInt CVIMPSTEnginePresenceSubService::AddToBlockListL( const TDesC& aContactId ) |
1465 TInt CVIMPSTEnginePresenceSubService::AddToBlockListL( const TDesC& aContactId ) |
1490 { |
1466 { |
1491 TRACE( T_LIT("CVIMPSTEnginePresenceSubService::AddToBlockListL start")); |
1467 TRACER_AUTO; |
1492 if(TVIMPSTEnums::ESVCERegistered != iServiceState) |
1468 if(TVIMPSTEnums::ESVCERegistered != iServiceState) |
1493 return KErrNotSupported; |
1469 return KErrNotSupported; |
1494 //if aContactId is zero. |
1470 //if aContactId is zero. |
1495 if( 0 == aContactId.Length()) |
1471 if( 0 == aContactId.Length()) |
1496 return KErrArgument; |
1472 return KErrArgument; |
1497 |
1473 |
1498 TRACE( T_LIT(" -> aContactId: %s" ), &aContactId); |
1474 TRACE( " aContactId: %s" , &aContactId); |
1499 TRACE( T_LIT(" -> perform block operation" ) ); |
1475 TRACE( " perform block operation" ); |
1500 |
1476 |
1501 MXIMPIdentity* identity = iXimpEventObserver.XimpPresenceContextL().ObjectFactory().NewIdentityLC(); |
1477 MXIMPIdentity* identity = iXimpEventObserver.XimpPresenceContextL().ObjectFactory().NewIdentityLC(); |
1502 |
1478 |
1503 identity->SetIdentityL( aContactId ); |
1479 identity->SetIdentityL( aContactId ); |
1504 |
1480 |
1514 CVIMPSTStorageManagerFactory::ContactListInterfaceL(iServiceId); |
1490 CVIMPSTStorageManagerFactory::ContactListInterfaceL(iServiceId); |
1515 storage->UpdateAvatarL(aContactId,KNullDesC8); |
1491 storage->UpdateAvatarL(aContactId,KNullDesC8); |
1516 } |
1492 } |
1517 //when pres. cache call will come. |
1493 //when pres. cache call will come. |
1518 CleanupStack::PopAndDestroy(); // identity |
1494 CleanupStack::PopAndDestroy(); // identity |
1519 TRACE( T_LIT("CVIMPSTEnginePresenceSubService::AddToBlockListL end")); |
|
1520 return error; |
1495 return error; |
1521 } |
1496 } |
1522 |
1497 |
1523 // --------------------------------------------------------------------------- |
1498 // --------------------------------------------------------------------------- |
1524 // CVIMPSTEnginePresenceSubService::RemoveFromBlockListL |
1499 // CVIMPSTEnginePresenceSubService::RemoveFromBlockListL |
1525 // --------------------------------------------------------------------------- |
1500 // --------------------------------------------------------------------------- |
1526 // |
1501 // |
1527 TInt CVIMPSTEnginePresenceSubService::RemoveFromBlockListL( const TDesC& aUriOfTheContact ) |
1502 TInt CVIMPSTEnginePresenceSubService::RemoveFromBlockListL( const TDesC& aUriOfTheContact ) |
1528 { |
1503 { |
1529 TRACE( T_LIT("CVIMPSTEnginePresenceSubService::RemoveFromBlockListL start")); |
1504 TRACER_AUTO; |
1530 if(TVIMPSTEnums::ESVCERegistered != iServiceState) |
1505 if(TVIMPSTEnums::ESVCERegistered != iServiceState) |
1531 return KErrNotSupported; |
1506 return KErrNotSupported; |
1532 //if aUriOfTheCOntact is zero. |
1507 //if aUriOfTheCOntact is zero. |
1533 if( 0 == aUriOfTheContact.Length()) |
1508 if( 0 == aUriOfTheContact.Length()) |
1534 return KErrNotFound; |
1509 return KErrNotFound; |
1535 |
1510 |
1536 TRACE( T_LIT(" -> aUriOfTheContact: %s" ), &aUriOfTheContact); |
1511 TRACE(" -> aUriOfTheContact: %s" , &aUriOfTheContact); |
1537 TRACE( T_LIT(" -> perform unblock operation" ) ); |
1512 TRACE( " -> perform unblock operation" ); |
1538 |
1513 |
1539 MXIMPIdentity* identity = iXimpEventObserver.XimpPresenceContextL().ObjectFactory().NewIdentityLC(); |
1514 MXIMPIdentity* identity = iXimpEventObserver.XimpPresenceContextL().ObjectFactory().NewIdentityLC(); |
1540 identity->SetIdentityL( aUriOfTheContact ); |
1515 identity->SetIdentityL( aUriOfTheContact ); |
1541 |
1516 |
1542 TXIMPRequestId reqId = iXimpEventObserver.XimpAuthorizationL().CancelPresenceBlockFromPresentityL(*identity ); |
1517 TXIMPRequestId reqId = iXimpEventObserver.XimpAuthorizationL().CancelPresenceBlockFromPresentityL(*identity ); |
1636 // CVIMPSTEnginePresenceSubService::UpdatePresenceStateL |
1612 // CVIMPSTEnginePresenceSubService::UpdatePresenceStateL |
1637 // --------------------------------------------------------------------------- |
1613 // --------------------------------------------------------------------------- |
1638 // |
1614 // |
1639 void CVIMPSTEnginePresenceSubService::UpdatePresenceStateL() |
1615 void CVIMPSTEnginePresenceSubService::UpdatePresenceStateL() |
1640 { |
1616 { |
1641 TRACE( T_LIT("CVIMPSTEnginePresenceSubService::UpdatePresenceStateL start") ); |
1617 TRACER_AUTO; |
1642 //inform ui about the state change from updatingcontacts to registered. |
1618 //inform ui about the state change from updatingcontacts to registered. |
1643 iServiceState = TVIMPSTEnums::ESVCERegistered; |
1619 iServiceState = TVIMPSTEnums::ESVCERegistered; |
1644 iObserver.HandleServceConnectionEventL(); |
1620 iObserver.HandleServceConnectionEventL(); |
1645 |
1621 |
1646 TRACE( T_LIT(" -> HandleContactFetchedL:state is ESVCERegistered" )); |
1622 TRACE( " -> HandleContactFetchedL:state is ESVCERegistered" ); |
1647 TRACE( T_LIT("CVIMPSTEnginePresenceSubService::UpdatePresenceStateL end")); |
|
1648 } |
1623 } |
1649 |
1624 |
1650 // --------------------------------------------------------------------------- |
1625 // --------------------------------------------------------------------------- |
1651 // CVIMPSTEnginePresenceSubService::FetchPresenceOfSingleContactL |
1626 // CVIMPSTEnginePresenceSubService::FetchPresenceOfSingleContactL |
1652 // --------------------------------------------------------------------------- |
1627 // --------------------------------------------------------------------------- |
1653 // |
1628 // |
1654 void CVIMPSTEnginePresenceSubService::FetchPresenceOfSingleContactL(const TDesC& aContact) |
1629 void CVIMPSTEnginePresenceSubService::FetchPresenceOfSingleContactL(const TDesC& aContact) |
1655 { |
1630 { |
1656 TRACE( T_LIT("CVIMPSTEnginePresenceSubService::FetchPresenceOfSingleContactL Start")); |
1631 TRACER_AUTO; |
1657 if(aContact.Length() && iServiceName->Length()) |
1632 if(aContact.Length() && iServiceName->Length()) |
1658 { |
1633 { |
1659 HBufC* name = HBufC::NewLC( iServiceName->Length() + KColon().Length() + aContact.Length() ); // 1. on to cleanup stack |
1634 HBufC* name = HBufC::NewLC( iServiceName->Length() + KColon().Length() + aContact.Length() ); // 1. on to cleanup stack |
1660 TPtr namePtr( name->Des() ); |
1635 TPtr namePtr( name->Des() ); |
1661 namePtr.Zero(); |
1636 namePtr.Zero(); |
1662 // append the service name followed by user id ,seperated by colon |
1637 // append the service name followed by user id ,seperated by colon |
1663 namePtr.Append(*iServiceName); |
1638 namePtr.Append(*iServiceName); |
1664 namePtr.Append(KColon); |
1639 namePtr.Append(KColon); |
1665 namePtr.Append(aContact); |
1640 namePtr.Append(aContact); |
1666 TRACE( T_LIT("CVIMPSTEnginePresenceSubService::FetchPresenceOfSingleContactL namePtr = %S"), &namePtr); |
1641 TRACE( " namePtr = %S", &namePtr); |
1667 MPresenceBuddyInfo2* presenceBuddyInfo = iPresenceCacheReader->PresenceInfoLC(namePtr); // 2. on to cleanupstack |
1642 MPresenceBuddyInfo2* presenceBuddyInfo = iPresenceCacheReader->PresenceInfoLC(namePtr); // 2. on to cleanupstack |
1668 if ( presenceBuddyInfo ) |
1643 if ( presenceBuddyInfo ) |
1669 { |
1644 { |
1670 TRACE( T_LIT("CVIMPSTEnginePresenceSubService::FetchPresenceOfSingleContactL presenceBuddyInfo")); |
1645 TRACE("presenceBuddyInfo"); |
1671 DoHandlePresenceNotificationL(*presenceBuddyInfo); |
1646 DoHandlePresenceNotificationL(*presenceBuddyInfo); |
1672 CleanupStack::PopAndDestroy(); // presenceBuddyInfo |
1647 CleanupStack::PopAndDestroy(); // presenceBuddyInfo |
1673 TRACE( T_LIT("CVIMPSTEnginePresenceSubService::FetchPresenceOfSingleContactL presenceBuddyInfo end")); |
1648 TRACE("presenceBuddyInfo end"); |
1674 } |
1649 } |
1675 CleanupStack::PopAndDestroy(name); // name |
1650 CleanupStack::PopAndDestroy(name); // name |
1676 } |
1651 } |
1677 TRACE( T_LIT("CVIMPSTEnginePresenceSubService::FetchPresenceOfSingleContactL End")); |
|
1678 } |
1652 } |
1679 |
1653 |
1680 // --------------------------------------------------------------------------- |
1654 // --------------------------------------------------------------------------- |
1681 // CVIMPSTEnginePresenceSubService::UnsubscribeListsL |
1655 // CVIMPSTEnginePresenceSubService::UnsubscribeListsL |
1682 // --------------------------------------------------------------------------- |
1656 // --------------------------------------------------------------------------- |
1683 // |
1657 // |
1684 void CVIMPSTEnginePresenceSubService::UnsubscribeListsL() |
1658 void CVIMPSTEnginePresenceSubService::UnsubscribeListsL() |
1685 { |
1659 { |
1686 TRACE( T_LIT("CVIMPSTEnginePresenceSubService::UnsubscribeListsL IN")); |
1660 TRACER_AUTO; |
1687 TRACE( T_LIT("CVIMPSTEnginePresenceSubService::UnsubscribeListsL - unsubscribe buddy list")); |
|
1688 |
1661 |
1689 // It is assumed here that buddy list and authorization list has been always |
1662 // It is assumed here that buddy list and authorization list has been always |
1690 // subscribed if bind has been done. Caller of this function must check |
1663 // subscribed if bind has been done. Caller of this function must check |
1691 // that session has been bound before calling this. |
1664 // that session has been bound before calling this. |
1692 TBuf<KUriMaxLength> buddyGroupBuffer( KFriendList ); |
1665 TBuf<KUriMaxLength> buddyGroupBuffer( KFriendList ); |