|
1 /* |
|
2 * Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of "Eclipse Public License v1.0" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: |
|
15 * |
|
16 * |
|
17 */ |
|
18 |
|
19 |
|
20 // INCLUDE FILES |
|
21 #include <featmgr.h> |
|
22 #include <spsettings.h> |
|
23 #include <spproperty.h> |
|
24 #include <CVPbkContactManager.h> |
|
25 #include <CVPbkFieldTypeSelector.h> |
|
26 #include <MVPbkStoreContact.h> |
|
27 #include <MVPbkFieldType.h> |
|
28 #include "cmsserver.h" |
|
29 #include "cmsserverutils.h" |
|
30 #include "cmsservercontact.h" |
|
31 #include "cmsserversession.h" |
|
32 #include "cmsphonebookproxy.h" |
|
33 #include "cmsserverasynccontact.h" |
|
34 #include "cmscontactfield.h" |
|
35 #include "cmscontactfielditem.h" |
|
36 #include "cmsdebug.h" |
|
37 |
|
38 #include <MVPbkContactFieldTextData.h> |
|
39 #include <MVPbkContactFieldUriData.h> |
|
40 #include <MVPbkContactFieldData.h> |
|
41 #include <e32base.h> |
|
42 |
|
43 namespace { |
|
44 |
|
45 TBool IsFieldTypeVoipCapable( TInt aFieldTypeResId, TInt aVoipFlag ) |
|
46 { |
|
47 TBool ret( EFalse ); |
|
48 CCmsContactFieldItem::TCmsContactField cmsFieldType; |
|
49 |
|
50 cmsFieldType = CmsServerUtils::MatchFieldType( aFieldTypeResId ); |
|
51 |
|
52 if ( ECmsVoIPSupportBasic & aVoipFlag && |
|
53 ( CCmsContactFieldItem::ECmsVoipNumberGeneric == cmsFieldType |
|
54 || CCmsContactFieldItem::ECmsVoipNumberHome == cmsFieldType |
|
55 || CCmsContactFieldItem::ECmsVoipNumberWork == cmsFieldType |
|
56 || CCmsContactFieldItem::ECmsPushToTalk == cmsFieldType |
|
57 || CCmsContactFieldItem::ECmsShareView == cmsFieldType ) |
|
58 ) |
|
59 { |
|
60 ret = ETrue; |
|
61 } |
|
62 if ( ECmsVoIPSupportSip & aVoipFlag && |
|
63 ( CCmsContactFieldItem::ECmsSipAddress == cmsFieldType ) |
|
64 ) |
|
65 { |
|
66 ret = ETrue; |
|
67 } |
|
68 if ( ECmsVoIPSupportXspId & aVoipFlag && |
|
69 ( CCmsContactFieldItem::ECmsImpp == cmsFieldType ) |
|
70 ) |
|
71 { |
|
72 ret = ETrue; |
|
73 } |
|
74 if ( ECmsVoIPSupportCallout & aVoipFlag && |
|
75 ( CCmsContactFieldItem::ECmsMobilePhoneGeneric == cmsFieldType |
|
76 || CCmsContactFieldItem::ECmsMobilePhoneHome == cmsFieldType |
|
77 || CCmsContactFieldItem::ECmsMobilePhoneWork == cmsFieldType |
|
78 || CCmsContactFieldItem::ECmsLandPhoneGeneric == cmsFieldType |
|
79 || CCmsContactFieldItem::ECmsLandPhoneHome == cmsFieldType |
|
80 || CCmsContactFieldItem::ECmsLandPhoneWork == cmsFieldType |
|
81 || CCmsContactFieldItem::ECmsAssistantNumber == cmsFieldType |
|
82 || CCmsContactFieldItem::ECmsCarPhone == cmsFieldType ) |
|
83 ) |
|
84 { |
|
85 ret = ETrue; |
|
86 } |
|
87 |
|
88 return ret; |
|
89 } |
|
90 |
|
91 TPtrC GetFieldData( const MVPbkContactFieldData& aFieldData ) |
|
92 { |
|
93 TPtrC text ( KNullDesC() ); |
|
94 |
|
95 switch ( aFieldData.DataType() ) |
|
96 { |
|
97 // Text storage type handled here |
|
98 case EVPbkFieldStorageTypeText: |
|
99 { |
|
100 const MVPbkContactFieldTextData& textData = MVPbkContactFieldTextData::Cast( aFieldData ); |
|
101 text.Set( textData.Text() ); |
|
102 break; |
|
103 } |
|
104 // URI storage type handled here |
|
105 case EVPbkFieldStorageTypeUri: |
|
106 { |
|
107 const MVPbkContactFieldUriData& textData = MVPbkContactFieldUriData::Cast( aFieldData ); |
|
108 text.Set( textData.Text() ); |
|
109 break; |
|
110 } |
|
111 } |
|
112 |
|
113 return text; |
|
114 } |
|
115 |
|
116 |
|
117 TBool ExistDuplicates( const MVPbkStoreContact& aContact, RArray<TInt>& aFieldIndexArray, TInt aFieldIndex ) |
|
118 { |
|
119 TBool ret = EFalse; |
|
120 |
|
121 const MVPbkStoreContactFieldCollection& fields = aContact.Fields(); |
|
122 const MVPbkStoreContactField& field = fields.FieldAt( aFieldIndex ); |
|
123 const MVPbkContactFieldData& fieldData1 = field.FieldData(); |
|
124 TPtrC fieldContent1 = GetFieldData( fieldData1 ); |
|
125 |
|
126 TInt count = aFieldIndexArray.Count(); |
|
127 for ( TInt i=0; i<count; i++ ) |
|
128 { |
|
129 TInt index = aFieldIndexArray[i]; |
|
130 const MVPbkStoreContactField& field = fields.FieldAt( index ); |
|
131 const MVPbkContactFieldData& fieldData2 = field.FieldData(); |
|
132 TPtrC fieldContent2 = GetFieldData( fieldData2 ); |
|
133 if ( fieldContent1.CompareF( fieldContent2 ) == 0 ) |
|
134 { |
|
135 // Find the duplicated field |
|
136 ret = ETrue; |
|
137 break; |
|
138 } |
|
139 } |
|
140 return ret; |
|
141 } |
|
142 |
|
143 TInt GetContacActionFieldCountL( |
|
144 CCmsServerContact& aContact, |
|
145 VPbkFieldTypeSelectorFactory::TVPbkContactActionTypeSelector aContactAction, |
|
146 CCmsServer* aServer ) |
|
147 { |
|
148 TInt voipFlag( 0 ); |
|
149 CVPbkContactManager* contactManager = aServer->PhonebookProxyHandle(). |
|
150 ContactManager(); |
|
151 CVPbkFieldTypeSelector* selector = VPbkFieldTypeSelectorFactory |
|
152 ::BuildContactActionTypeSelectorL( |
|
153 aContactAction, contactManager->FieldTypes()); |
|
154 |
|
155 const MVPbkStoreContact& storeContact = static_cast<MCmsContactInterface&>( |
|
156 aContact).Contact(); |
|
157 |
|
158 const MVPbkStoreContactFieldCollection& fields = storeContact.Fields(); |
|
159 TInt result = 0; |
|
160 RArray<TInt> fieldIndexArray; |
|
161 if ( aContactAction == VPbkFieldTypeSelectorFactory::EFindOnMapSelector |
|
162 || aContactAction == VPbkFieldTypeSelectorFactory |
|
163 ::EAssignFromMapSelector ) |
|
164 { |
|
165 result = selector->AddressFieldsIncluded( fields ); |
|
166 } |
|
167 else if (aContactAction == VPbkFieldTypeSelectorFactory::EVOIPCallSelector) |
|
168 { |
|
169 voipFlag = aContact.ParseVoIPAvailabilityL(); |
|
170 TInt count = fields.FieldCount(); |
|
171 |
|
172 for (TInt i = 0; i < count; ++i) |
|
173 { |
|
174 const MVPbkStoreContactField& field = fields.FieldAt(i); |
|
175 if (selector->IsFieldIncluded(field)) |
|
176 { |
|
177 const MVPbkFieldType* type = field.BestMatchingFieldType() ; |
|
178 if (IsFieldTypeVoipCapable(type->FieldTypeResId(), voipFlag)) |
|
179 { |
|
180 // Check if duplicate exists, and |
|
181 // append the field index of non duplicated field to fieldIndexArray |
|
182 if ( !ExistDuplicates( storeContact, fieldIndexArray, i ) ) |
|
183 { |
|
184 fieldIndexArray.AppendL(i); |
|
185 } |
|
186 } |
|
187 } |
|
188 } |
|
189 |
|
190 result = fieldIndexArray.Count(); |
|
191 } |
|
192 else |
|
193 { |
|
194 TInt count = fields.FieldCount(); |
|
195 |
|
196 for (TInt i = 0; i < count; ++i) |
|
197 { |
|
198 const MVPbkStoreContactField& field = fields.FieldAt(i); |
|
199 if (selector->IsFieldIncluded(field)) |
|
200 { |
|
201 if ( !ExistDuplicates( storeContact, fieldIndexArray, i ) ) |
|
202 { |
|
203 fieldIndexArray.AppendL(i); |
|
204 } |
|
205 } |
|
206 } |
|
207 |
|
208 result = fieldIndexArray.Count(); |
|
209 } |
|
210 |
|
211 fieldIndexArray.Close(); |
|
212 delete selector; |
|
213 return result; |
|
214 } |
|
215 |
|
216 } |
|
217 |
|
218 // ---------------------------------------------------------- |
|
219 // CCmsServerSession::CCmsServerSession |
|
220 // |
|
221 // ---------------------------------------------------------- |
|
222 // |
|
223 CCmsServerSession::CCmsServerSession( CCmsServer* aServer ) : iCmsServer( aServer ), |
|
224 iFeatureManagerInitialized( EFalse ) |
|
225 { |
|
226 } |
|
227 |
|
228 // ---------------------------------------------------------- |
|
229 // CCmsServerSession::NewL |
|
230 // |
|
231 // ---------------------------------------------------------- |
|
232 // |
|
233 CCmsServerSession* CCmsServerSession::NewL( CCmsServer* aServer ) |
|
234 { |
|
235 |
|
236 PRINT( _L( "Start CCmsServerSession::NewL()" ) ); |
|
237 CCmsServerSession* self = new( ELeave ) CCmsServerSession( aServer ); |
|
238 CleanupStack::PushL( self ); |
|
239 self->ConstructL(); |
|
240 CleanupStack::Pop(); |
|
241 return self; |
|
242 } |
|
243 |
|
244 // ---------------------------------------------------------- |
|
245 // CCmsServerSession::~CCmsServerSession |
|
246 // |
|
247 // ---------------------------------------------------------- |
|
248 // |
|
249 CCmsServerSession::~CCmsServerSession() |
|
250 { |
|
251 PRINT( _L( "Start CCmsServerSession::~CCmsServerSession()" ) ); |
|
252 |
|
253 if ( iFeatureManagerInitialized ) |
|
254 { |
|
255 FeatureManager::UnInitializeLib(); |
|
256 } |
|
257 |
|
258 delete iServerContact; |
|
259 |
|
260 PRINT( _L( "End CCmsServerSession::~CCmsServerSession()" ) ); |
|
261 } |
|
262 |
|
263 // ---------------------------------------------------------- |
|
264 // CCmsServerSession::StoreOpenComplete |
|
265 // |
|
266 // ---------------------------------------------------------- |
|
267 // |
|
268 void CCmsServerSession::StoreOpenComplete() |
|
269 { |
|
270 if ( iServiceMessage ) |
|
271 { |
|
272 // Some request waits when stores are opened. Handle it now. |
|
273 DoServiceL( *iServiceMessage ); |
|
274 iServiceMessage = NULL; |
|
275 } |
|
276 } |
|
277 |
|
278 // ---------------------------------------------------------- |
|
279 // CCmsServerSession::CmsSingleContactOperationComplete |
|
280 // |
|
281 // ---------------------------------------------------------- |
|
282 // |
|
283 void CCmsServerSession::CmsSingleContactOperationComplete( TInt aError ) |
|
284 { |
|
285 if ( !iCmsContactRetrieveMessage.IsNull() ) |
|
286 { |
|
287 iCmsContactRetrieveMessage.Complete( aError ); |
|
288 } |
|
289 } |
|
290 |
|
291 // ---------------------------------------------------------- |
|
292 // CCmsServerSession::ConstructL |
|
293 // |
|
294 // ---------------------------------------------------------- |
|
295 // |
|
296 void CCmsServerSession::ConstructL() |
|
297 { |
|
298 PRINT( _L( "Start CCmsServerSession::ConstructL()" ) ); |
|
299 FeatureManager::InitializeLibL(); |
|
300 iFeatureManagerInitialized = ETrue; |
|
301 iCmsServer->PhonebookProxyHandle().UpdateXSPStoresListL(); |
|
302 PRINT( _L( "End CCmsServerSession::ConstructL()" ) ); |
|
303 } |
|
304 |
|
305 // ---------------------------------------------------------- |
|
306 // CCmsServerSession::ServiceL |
|
307 // |
|
308 // ---------------------------------------------------------- |
|
309 // |
|
310 void CCmsServerSession::ServiceL( const RMessage2& aMessage ) |
|
311 { |
|
312 PRINT( _L( "Start CCmsServerSession::ServiceL()" ) ); |
|
313 |
|
314 if ( iServiceMessage && !iCmsServer->PhonebookProxyHandle().StoreOpenStatus() ) |
|
315 { |
|
316 // some message already waits for store opening completion |
|
317 aMessage.Complete( KErrNotReady ); |
|
318 return; |
|
319 } |
|
320 |
|
321 if( !iCmsServer->PhonebookProxyHandle().StoreOpenStatus() ) |
|
322 { |
|
323 // Stores are not ready yet, save message for later processing |
|
324 iServiceMessage = &aMessage; |
|
325 return; |
|
326 } |
|
327 |
|
328 DoServiceL( aMessage ); |
|
329 |
|
330 PRINT( _L( "End CCmsServerSession::ServiceL()" ) ); |
|
331 } |
|
332 |
|
333 // ---------------------------------------------------------- |
|
334 // CCmsServerSession::FindXSPContactL |
|
335 // |
|
336 // ---------------------------------------------------------- |
|
337 // |
|
338 void CCmsServerSession::CancelXSPContactFindL( const RMessage2& /*aMessage*/ ) |
|
339 { |
|
340 PRINT( _L( "Start CCmsServerSession::CancelXSPContactFindL()" ) ); |
|
341 |
|
342 if( !iServerContact->IsDeleted() ) |
|
343 { |
|
344 iServerContact->CancelXspContactFind(); |
|
345 } |
|
346 PRINT( _L( "End CCmsServerSession::CancelXSPContactFindL()" ) ); |
|
347 } |
|
348 |
|
349 // ---------------------------------------------------------- |
|
350 // CCmsServerSession::FindXSPContactL |
|
351 // |
|
352 // ---------------------------------------------------------- |
|
353 // |
|
354 void CCmsServerSession::FindXSPContactL( const RMessage2& aMessage ) |
|
355 { |
|
356 PRINT( _L( "Start CCmsServerSession::FindXSPContactL()" ) ); |
|
357 if( !iServerContact->IsDeleted() ) |
|
358 { |
|
359 TRAPD( link, iServerContact->FindXSPContactL( aMessage ) ); |
|
360 if( KErrNone != link ) |
|
361 { |
|
362 aMessage.Complete( link ); |
|
363 } |
|
364 } |
|
365 else |
|
366 { |
|
367 aMessage.Complete( KErrNotReady ); |
|
368 } |
|
369 PRINT( _L( "End CCmsServerSession::FindXSPContactL()" ) ); |
|
370 } |
|
371 |
|
372 // ---------------------------------------------------------- |
|
373 // CCmsServerSession::CreateContactL |
|
374 // |
|
375 // ---------------------------------------------------------- |
|
376 // |
|
377 void CCmsServerSession::CreateContactL( const RMessage2& aMessage ) |
|
378 { |
|
379 PRINT( _L( "Start CCmsServerSession::CreateContactL()" ) ); |
|
380 iServerContact = CCmsServerContact::NewL( *this, *iCmsServer ); |
|
381 FetchContactL( aMessage, iServerContact ); |
|
382 PRINT( _L( "End CCmsServerSession::CreateContactL()" ) ); |
|
383 } |
|
384 |
|
385 // ---------------------------------------------------------- |
|
386 // CCmsServerSession::FindParentStoreL |
|
387 // |
|
388 // ---------------------------------------------------------- |
|
389 // |
|
390 TInt CCmsServerSession::FindParentStoreL( const RMessage2& /*aMessage*/ ) |
|
391 { |
|
392 TInt store( KErrNotReady ); |
|
393 if( !iServerContact->IsDeleted() ) |
|
394 { |
|
395 store = iServerContact->ContactStore(); |
|
396 } |
|
397 return store; |
|
398 } |
|
399 |
|
400 // ---------------------------------------------------------- |
|
401 // CCmsServerSession::FetchContactL |
|
402 // |
|
403 // ---------------------------------------------------------- |
|
404 // |
|
405 void CCmsServerSession::FetchContactL( const RMessage2& aMessage, |
|
406 MCmsContactInterface* aContactInterface ) |
|
407 { |
|
408 PRINT( _L( "Start CCmsServerSession::FetchContactL()" ) ); |
|
409 TInt error( KErrNotSupported ); |
|
410 |
|
411 switch( aMessage.Function() ) |
|
412 { |
|
413 case ECmsOpenID: |
|
414 { |
|
415 iCmsContactRetrieveMessage = aMessage; |
|
416 TInt contactId( aMessage.Int0() ); |
|
417 error = iCmsServer->PhonebookProxyHandle().FetchContactL( |
|
418 contactId, aContactInterface ); |
|
419 break; |
|
420 } |
|
421 case ECmsOpenLink: |
|
422 { |
|
423 iCmsContactRetrieveMessage = aMessage; |
|
424 TPtrC8 link( CmsServerUtils::ReadMsgParam8LC( 0, aMessage )->Des() ); |
|
425 error = iCmsServer->PhonebookProxyHandle().FetchContactL( |
|
426 link, aContactInterface ); |
|
427 CleanupStack::PopAndDestroy(); //link |
|
428 break; |
|
429 } |
|
430 case ECmsOpenPhoneNbr: |
|
431 { |
|
432 iCmsContactRetrieveMessage = aMessage; |
|
433 TPtrC phoneNbr( CmsServerUtils::ReadMsgParam16LC( 0, aMessage )->Des() ); |
|
434 error = iCmsServer->PhonebookProxyHandle().FetchContactL( |
|
435 phoneNbr, aContactInterface ); |
|
436 CleanupStack::PopAndDestroy(); //phoneNbr |
|
437 break; |
|
438 } |
|
439 default: |
|
440 { |
|
441 break; |
|
442 } |
|
443 } |
|
444 |
|
445 if( error != KErrNone ) |
|
446 { |
|
447 aMessage.Complete( error ); |
|
448 } |
|
449 PRINT( _L( "End CCmsServerSession::FetchContactL()" ) ); |
|
450 } |
|
451 |
|
452 // ---------------------------------------------------------- |
|
453 // CCmsServerSession::FindServiceAvailabilityL |
|
454 // |
|
455 // ---------------------------------------------------------- |
|
456 // |
|
457 TInt CCmsServerSession::FindServiceAvailabilityL( const RMessage2& aMessage ) |
|
458 { |
|
459 PRINT( _L( "Start CCmsServerSession::FindServiceAvailabilityL()" ) ); |
|
460 TInt availability( 1 ); |
|
461 if( !iServerContact->IsDeleted() ) |
|
462 { |
|
463 VPbkFieldTypeSelectorFactory::TVPbkContactActionTypeSelector service( |
|
464 ( VPbkFieldTypeSelectorFactory::TVPbkContactActionTypeSelector )aMessage.Int0() ); |
|
465 switch( service ) |
|
466 { |
|
467 case VPbkFieldTypeSelectorFactory::EInstantMessagingSelector: |
|
468 { |
|
469 availability = iServerContact->AsyncContact().FindImAvailabilityL(); |
|
470 PRINT1( _L( "CCmsServerSession::FindServiceAvailabilityL():IM availability: %d" ), availability ); |
|
471 break; |
|
472 } |
|
473 case VPbkFieldTypeSelectorFactory::EVideoCallSelector: |
|
474 { |
|
475 availability = FeatureManager::FeatureSupported( KFeatureIdCsVideoTelephony ); |
|
476 PRINT1( _L( "CCmsServerSession::FindServiceAvailabilityL():Video call availability: %d [FeatureManager]" ), availability ); |
|
477 break; |
|
478 } |
|
479 case VPbkFieldTypeSelectorFactory::EVOIPCallSelector: |
|
480 { |
|
481 availability = iServerContact->ParseVoIPAvailabilityL(); |
|
482 break; |
|
483 } |
|
484 default: |
|
485 { |
|
486 //In case the type is unknown, just break here and return true |
|
487 break; |
|
488 } |
|
489 } |
|
490 } |
|
491 PRINT( _L( "End CCmsServerSession::FindServiceAvailabilityL()" ) ); |
|
492 return availability; |
|
493 } |
|
494 |
|
495 // ---------------------------------------------------------- |
|
496 // CCmsServerSession::FetchDataL |
|
497 // |
|
498 // ---------------------------------------------------------- |
|
499 // |
|
500 void CCmsServerSession::FetchDataL( const RMessage2& aMessage ) |
|
501 { |
|
502 PRINT( _L(" Start CCmsServerSession::FetchDataL()" ) ); |
|
503 |
|
504 if( !iServerContact->IsDeleted() ) |
|
505 { |
|
506 iServerContact->FetchContactData( aMessage ); |
|
507 } |
|
508 else |
|
509 { |
|
510 PRINT( _L( "CCmsServerSession::FetchDataL():Contact has been deleted => complete with KErrNotFound" ) ); |
|
511 aMessage.Complete( KErrNotFound ); |
|
512 } |
|
513 PRINT( _L(" End CCmsServerSession::FetchDataL()" ) ); |
|
514 } |
|
515 |
|
516 // ---------------------------------------------------------- |
|
517 // CCmsServerSession::OrderNotifyL |
|
518 // |
|
519 // ---------------------------------------------------------- |
|
520 // |
|
521 void CCmsServerSession::OrderNotifyL( const RMessage2& aMessage, TBool aAskMore ) |
|
522 { |
|
523 PRINT( _L( "Start CCmsServerSession::OrderNotifyL()" ) ); |
|
524 |
|
525 if( !iServerContact->IsDeleted() ) |
|
526 { |
|
527 iServerContact->OrderNotifyL( aMessage, aAskMore ); |
|
528 } |
|
529 else |
|
530 { |
|
531 PRINT( _L( "CCmsServerSession::OrderNotifyL(): Contact has been deleted => complete with KErrNotFound" ) ); |
|
532 |
|
533 |
|
534 iServerContact->OrderNotifyL( aMessage, ETrue ); |
|
535 |
|
536 if ( !aMessage.IsNull() ) |
|
537 { |
|
538 aMessage.Complete( KErrNotFound ); |
|
539 } |
|
540 } |
|
541 PRINT( _L( "End CCmsServerSession::OrderNotifyL()" ) ); |
|
542 } |
|
543 |
|
544 // ---------------------------------------------------------- |
|
545 // CCmsServerSession::CompleteNotify |
|
546 // |
|
547 // ---------------------------------------------------------- |
|
548 // |
|
549 void CCmsServerSession::CompleteNotify( const RMessage2& aMessage ) |
|
550 { |
|
551 PRINT( _L( "Start CCmsServerSession::CompleteNotify()" ) ); |
|
552 |
|
553 iServerContact->CompleteNotify( aMessage, KErrCancel ); |
|
554 PRINT( _L( "End CCmsServerSession::CompleteNotify()" ) ); |
|
555 } |
|
556 |
|
557 // ---------------------------------------------------------- |
|
558 // CCmsServerSession::EnabledFieldsL |
|
559 // |
|
560 // ---------------------------------------------------------- |
|
561 // |
|
562 void CCmsServerSession::EnabledFieldsL( const RMessage2& aMessage ) |
|
563 { |
|
564 PRINT( _L( "Start CCmsServerSession::EnabledFieldsL()" ) ); |
|
565 |
|
566 if( !iServerContact->IsDeleted() ) |
|
567 { |
|
568 iServerContact->FetchEnabledFields( aMessage ); |
|
569 } |
|
570 else |
|
571 { |
|
572 |
|
573 PRINT( _L( "CCmsServerSession::EnabledFieldsL(): Contact has been deleted => complete with KErrNotFound" ) ); |
|
574 |
|
575 aMessage.Complete( KErrNotFound ); |
|
576 } |
|
577 PRINT( _L( "End CCmsServerSession::EnabledFieldsL()" ) ); |
|
578 } |
|
579 |
|
580 // ---------------------------------------------------------- |
|
581 // CCmsServerSession::FetchContactIdentifierL |
|
582 // |
|
583 // ---------------------------------------------------------- |
|
584 // |
|
585 void CCmsServerSession::FetchContactIdentifierL( const RMessage2& aMessage ) |
|
586 { |
|
587 PRINT( _L( "Start CCmsServerSession::FetchContactLinkArrayL()" ) ); |
|
588 |
|
589 if( !iServerContact->IsDeleted() ) |
|
590 { |
|
591 //Currently only contactlink array is supported. |
|
592 iServerContact->FetchContactLinkArrayL( aMessage ); |
|
593 } |
|
594 else |
|
595 { |
|
596 PRINT( _L( "CCmsServerSession::FetchContactIdentifierL(): Contact has been deleted => complete with KErrNotFound" ) ); |
|
597 |
|
598 aMessage.Complete( KErrNotFound ); |
|
599 } |
|
600 PRINT( _L( "Start CCmsServerSession::FetchContactLinkArrayL()" ) ); |
|
601 } |
|
602 |
|
603 // ---------------------------------------------------------- |
|
604 // CCmsServerSession::CancelOperation |
|
605 // |
|
606 // ---------------------------------------------------------- |
|
607 // |
|
608 void CCmsServerSession::CancelOperation( const RMessage2& aMessage ) |
|
609 { |
|
610 PRINT( _L( "Start CCmsServerSession::CancelOperation()" ) ); |
|
611 |
|
612 if( !iServerContact->IsDeleted() ) |
|
613 { |
|
614 iServerContact->CancelOperation(); |
|
615 aMessage.Complete( KErrNone ); |
|
616 } |
|
617 else |
|
618 { |
|
619 PRINT( _L( "CCmsServerSession::CancelOperation(): Contact has been deleted => complete with KErrNotFound" ) ); |
|
620 |
|
621 aMessage.Complete( KErrNotFound ); |
|
622 |
|
623 } |
|
624 PRINT( _L( "End CCmsServerSession::CancelOperation()" ) ); |
|
625 |
|
626 } |
|
627 |
|
628 |
|
629 // ---------------------------------------------------------- |
|
630 // CCmsServerSession::PanicClient |
|
631 // |
|
632 // ---------------------------------------------------------- |
|
633 // |
|
634 void CCmsServerSession::PanicClient( TInt aPanic ) |
|
635 { |
|
636 _LIT( KTxtSessionPanic,"CMS Server Session panic"); |
|
637 User::Panic( KTxtSessionPanic, aPanic ); |
|
638 } |
|
639 |
|
640 // ---------------------------------------------------------- |
|
641 // CCmsServerSession::GetContacActionFieldCountL |
|
642 // |
|
643 // ---------------------------------------------------------- |
|
644 // |
|
645 TInt CCmsServerSession::GetContacActionFieldCountL( const RMessage2& aMessage ) |
|
646 { |
|
647 PRINT( _L( "Start CCmsServerSession::GetContacActionFieldCountL()" ) ); |
|
648 |
|
649 TInt result = 0; |
|
650 if( !iServerContact->IsDeleted() ) |
|
651 { |
|
652 VPbkFieldTypeSelectorFactory::TVPbkContactActionTypeSelector action( |
|
653 ( VPbkFieldTypeSelectorFactory::TVPbkContactActionTypeSelector )aMessage.Int0() ); |
|
654 result = ::GetContacActionFieldCountL(*iServerContact, action, iCmsServer ); |
|
655 } |
|
656 PRINT( _L( "End CCmsServerSession::GetContacActionFieldCountL()" ) ); |
|
657 return result; |
|
658 } |
|
659 |
|
660 // ---------------------------------------------------------- |
|
661 // CCmsServerSession::DoServiceL |
|
662 // |
|
663 // ---------------------------------------------------------- |
|
664 // |
|
665 void CCmsServerSession::DoServiceL( const RMessage2& aMessage ) |
|
666 { |
|
667 PRINT( _L( "Start CCmsServerSession::DoServiceL()" ) ); |
|
668 |
|
669 const TInt function = aMessage.Function(); |
|
670 switch( function ) |
|
671 { |
|
672 case ECmsFetchEnabledFields: |
|
673 { |
|
674 PRINT( _L( " CCmsServerSession::DoServiceL(): Fetch fields that have content" ) ); |
|
675 |
|
676 EnabledFieldsL( aMessage ); |
|
677 break; |
|
678 } |
|
679 case ECmsFetchContactField: |
|
680 { |
|
681 PRINT( _L( " CCmsServerSession::DoServiceL():Fetch contact data (single)" ) ); |
|
682 |
|
683 FetchDataL( aMessage ); |
|
684 break; |
|
685 } |
|
686 case ECmsCancelOperation: |
|
687 { |
|
688 PRINT( _L( " CCmsServerSession::DoServiceL():CCmsServerSession::ServiceL():Cancel an operation" ) ); |
|
689 |
|
690 CancelOperation( aMessage ); |
|
691 break; |
|
692 } |
|
693 case ECmsCloseSubsession: |
|
694 { |
|
695 TUint handle( aMessage.Int3() ); |
|
696 |
|
697 PRINT1( _L( " CCmsServerSession::DoServiceL():Close subsession - Handle: %d" ), handle ); |
|
698 |
|
699 aMessage.Complete( KErrNone ); |
|
700 break; |
|
701 } |
|
702 case ECmsFetchContactIdentifier: |
|
703 { |
|
704 PRINT( _L( " CCmsServerSession::DoServiceL():Fetch contactlink array" ) ); |
|
705 |
|
706 FetchContactIdentifierL( aMessage ); |
|
707 break; |
|
708 } |
|
709 case ECmsOrderNotification: |
|
710 { |
|
711 PRINT( _L( " CCmsServerSession::DoServiceL():Order notification" ) ); |
|
712 |
|
713 OrderNotifyL( aMessage, EFalse ); |
|
714 break; |
|
715 } |
|
716 case ECmsOrderNextNotification: |
|
717 { |
|
718 PRINT( _L( " CCmsServerSession::DoServiceL():Next notification" ) ); |
|
719 |
|
720 OrderNotifyL( aMessage, ETrue ); |
|
721 break; |
|
722 } |
|
723 case ECmsFetchServiceAvailability: |
|
724 { |
|
725 PRINT( _L( " CCmsServerSession::DoServiceL():Fetch service availability" ) ); |
|
726 |
|
727 TInt result( FindServiceAvailabilityL( aMessage ) ); |
|
728 aMessage.Complete( result ); |
|
729 break; |
|
730 } |
|
731 case ECmsFindParentStore: |
|
732 { |
|
733 PRINT( _L( " CCmsServerSession::DoServiceL():Find parent store" ) ); |
|
734 |
|
735 TInt result( FindParentStoreL( aMessage ) ); |
|
736 aMessage.Complete( result ); |
|
737 break; |
|
738 } |
|
739 case ECmsFindExternalContact: |
|
740 { |
|
741 PRINT( _L( " CCmsServerSession::DoServiceL():Find external contact" ) ); |
|
742 |
|
743 if( iCmsServer->PhonebookProxyHandle().ExternalStoresIntalled() ) |
|
744 { |
|
745 PRINT( _L( " CCmsServerSession::ServiceL(): xSP stores installed => search" ) ); |
|
746 FindXSPContactL( aMessage ); |
|
747 } |
|
748 else |
|
749 { |
|
750 PRINT( _L( " CCmsServerSession::DoServiceL():No xSP stores installed => complete with KErrNotFound" ) ); |
|
751 aMessage.Complete( KErrNotFound ); |
|
752 } |
|
753 break; |
|
754 } |
|
755 case ECmsCancelExternalContactFind: |
|
756 { |
|
757 CancelXSPContactFindL( aMessage ); |
|
758 aMessage.Complete( KErrNone ); |
|
759 break; |
|
760 } |
|
761 case ECmsCancelNotification: |
|
762 { |
|
763 PRINT( _L( " CCmsServerSession::DoServiceL():Cancel Notification" ) ); |
|
764 |
|
765 CompleteNotify( aMessage ); |
|
766 aMessage.Complete( KErrNone ); |
|
767 break; |
|
768 } |
|
769 case ECmsGetContactActionFieldCount: |
|
770 { |
|
771 TInt result( GetContacActionFieldCountL( aMessage ) ); |
|
772 aMessage.Complete( result ); |
|
773 break; |
|
774 } |
|
775 case ECmsOpenID: |
|
776 case ECmsOpenLink: |
|
777 case ECmsOpenPhoneNbr: |
|
778 { |
|
779 PRINT( _L( " CCmsServerSession::ServiceL():Create a new contact object" ) ); |
|
780 CreateContactL( aMessage ); |
|
781 break; |
|
782 } |
|
783 case ECmsIsTopContact: |
|
784 { |
|
785 PRINT( _L( " CCmsServerSession::ServiceL():Is Top Contact" ) ); |
|
786 IsTopContactL( aMessage ); |
|
787 break; |
|
788 } |
|
789 case ECmsSetVoiceCallDefault: |
|
790 { |
|
791 iServerContact->SetVoiceCallDefaultL(); |
|
792 aMessage.Complete( KErrNone ); |
|
793 break; |
|
794 } |
|
795 default: |
|
796 { |
|
797 PRINT( _L( " CCmsServerSession::ServiceL(): not supported request" ) ); |
|
798 aMessage.Complete( KErrNotSupported ); |
|
799 break; |
|
800 } |
|
801 } |
|
802 PRINT( _L( "End CCmsServerSession::DoServiceL()" ) ); |
|
803 } |
|
804 |
|
805 |
|
806 // ---------------------------------------------------------- |
|
807 // CCmsServerSession::IsTopContactL |
|
808 // |
|
809 // ---------------------------------------------------------- |
|
810 // |
|
811 void CCmsServerSession::IsTopContactL( const RMessage2& aMessage ) |
|
812 { |
|
813 PRINT( _L( "Start CCmsServerSession::IsTopContactL()" ) ); |
|
814 if( iServerContact && !iServerContact->IsDeleted() ) |
|
815 { |
|
816 //Currently only contactlink array is supported. |
|
817 iServerContact->IsTopContactL( aMessage ); |
|
818 } |
|
819 else |
|
820 { |
|
821 PRINT( _L( "CCmsServerSession::IsTopContactL'(): Contact has been deleted => complete with KErrNotFound" ) ); |
|
822 aMessage.Complete( KErrNotFound ); |
|
823 } |
|
824 |
|
825 PRINT( _L( "End CCmsServerSession::IsTopContactL()" ) ); |
|
826 } |
|
827 |
|
828 |
|
829 // End of file |