author | Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com> |
Wed, 13 Oct 2010 14:20:32 +0300 | |
branch | RCL_3 |
changeset 33 | 2989b291cac7 |
parent 28 | d38647835c2e |
permissions | -rw-r--r-- |
28 | 1 |
/* |
2 |
* Copyright (c) 2002-2010 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 |
#include <crcseprofileregistry.h> |
|
20 |
#include <spsettings.h> |
|
21 |
#include <spentry.h> |
|
22 |
#include <spproperty.h> |
|
23 |
#include <spsettingsvoiputils.h> |
|
24 |
#include <pressettingsapi.h> |
|
33
2989b291cac7
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
28
diff
changeset
|
25 |
#include <xdmsettingsapi.h> |
2989b291cac7
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
28
diff
changeset
|
26 |
#include <xdmsettingscollection.h> |
28 | 27 |
|
28 |
#include "scpsettinghandler.h" |
|
29 |
#include "scpservice.h" |
|
30 |
#include "scpsubservice.h" |
|
31 |
#include "scplogger.h" |
|
32 |
#include "scputility.h" |
|
33 |
#include "scpservicehandlerbase.h" |
|
34 |
#include "sipconnectionprovideruids.hrh" |
|
35 |
#include "scpprofilehandler.h" |
|
36 |
||
37 |
// ----------------------------------------------------------------------------- |
|
38 |
// CScpSettingHandler::CScpSettingHandler |
|
39 |
// ----------------------------------------------------------------------------- |
|
40 |
// |
|
41 |
CScpSettingHandler::CScpSettingHandler( CScpProfileHandler& aProfileHandler ) : |
|
42 |
iProfileHandler( aProfileHandler ) |
|
43 |
{ |
|
44 |
SCPLOGSTRING( "CScpSettingHandler::CScpSettingHandler" ); |
|
45 |
} |
|
46 |
||
47 |
// ----------------------------------------------------------------------------- |
|
48 |
// CScpSettingHandler::NewL |
|
49 |
// ----------------------------------------------------------------------------- |
|
50 |
// |
|
51 |
CScpSettingHandler* CScpSettingHandler::NewL( CScpProfileHandler& aProfileHandler ) |
|
52 |
{ |
|
53 |
SCPLOGSTRING( "CScpSettingHandler::NewL()" ); |
|
54 |
||
55 |
CScpSettingHandler* self = new( ELeave ) CScpSettingHandler( aProfileHandler ); |
|
56 |
CleanupStack::PushL( self ); |
|
57 |
self->ConstructL(); |
|
58 |
CleanupStack::Pop( self ); |
|
59 |
return self; |
|
60 |
} |
|
61 |
||
62 |
// ----------------------------------------------------------------------------- |
|
63 |
// CScpSettingHandler::~CScpSettingHandler |
|
64 |
// ----------------------------------------------------------------------------- |
|
65 |
// |
|
66 |
CScpSettingHandler::~CScpSettingHandler() |
|
67 |
{ |
|
68 |
SCPLOGSTRING( "CScpSettingHandler::~CScpSettingHandler" ); |
|
69 |
||
70 |
delete iSpsVoIPUtils; |
|
71 |
delete iSpSettings; |
|
72 |
delete iRcseProfileEntry; |
|
73 |
delete iRcseProfileRegistry; |
|
74 |
} |
|
75 |
||
76 |
// ----------------------------------------------------------------------------- |
|
77 |
// CScpSettingHandler::ConstructL |
|
78 |
// ----------------------------------------------------------------------------- |
|
79 |
// |
|
80 |
void CScpSettingHandler::ConstructL() |
|
81 |
{ |
|
82 |
SCPLOGSTRING("CScpSettingHandler::ConstructL" ); |
|
83 |
||
84 |
iRcseProfileRegistry = CRCSEProfileRegistry::NewL(); |
|
85 |
iRcseProfileEntry = CRCSEProfileEntry::NewL(); |
|
86 |
||
87 |
iSpSettings = CSPSettings::NewL(); |
|
88 |
iSpsVoIPUtils = CSPSettingsVoIPUtils::NewL(); |
|
89 |
} |
|
90 |
||
91 |
// ----------------------------------------------------------------------------- |
|
92 |
// CScpSettingHandler::GetSipProfileIdByTypeL |
|
93 |
// ----------------------------------------------------------------------------- |
|
94 |
// |
|
95 |
void CScpSettingHandler::GetSipProfileIdByTypeL( TUint32 aServiceId, |
|
96 |
TCCHSubserviceType aSubServiceType, |
|
97 |
TUint32& aSipId ) const |
|
98 |
{ |
|
99 |
SCPLOGSTRING3( "CScpSettingHandler::GetSipProfileIdByTypeL service id :%i type %d", |
|
100 |
aServiceId, aSubServiceType ); |
|
101 |
||
102 |
switch ( aSubServiceType ) |
|
103 |
{ |
|
104 |
case ECCHVoIPSub: |
|
105 |
case ECCHIMSub: |
|
106 |
{ |
|
107 |
GetVoipSipProfileIdL( aServiceId, aSipId ); |
|
108 |
} |
|
109 |
break; |
|
110 |
||
111 |
case ECCHVMBxSub: |
|
112 |
{ |
|
113 |
GetVmbxSipProfileIdL( aServiceId, aSipId ); |
|
114 |
} |
|
115 |
break; |
|
116 |
||
117 |
case ECCHPresenceSub: |
|
118 |
{ |
|
119 |
GetPresenceSipProfileIdL( aServiceId, aSipId ); |
|
120 |
} |
|
121 |
break; |
|
122 |
||
123 |
case ECCHUnknown: |
|
124 |
{ |
|
125 |
GetUnknownSipProfileIdL( aServiceId, aSipId ); |
|
126 |
} |
|
127 |
break; |
|
128 |
||
129 |
default: |
|
130 |
__ASSERT_DEBUG( EFalse, User::Panic( KNullDesC, KErrGeneral ) ); |
|
131 |
break; |
|
132 |
} |
|
133 |
} |
|
134 |
||
135 |
// ----------------------------------------------------------------------------- |
|
136 |
// CScpSettingHandler::GetSPSettingsIntPropertyL |
|
137 |
// ----------------------------------------------------------------------------- |
|
138 |
// |
|
139 |
void CScpSettingHandler::GetSPSettingsIntPropertyL( TUint32 aServiceId, |
|
140 |
TServicePropertyName aPropertyName, |
|
141 |
TInt& aProperty ) const |
|
142 |
{ |
|
143 |
SCPLOGSTRING( "CScpSettingHandler::GetSPSettingsIntPropertyL" ); |
|
144 |
||
145 |
CSPEntry* entry = CSPEntry::NewLC(); |
|
146 |
TInt result = iSpSettings->FindEntryL( aServiceId, *entry ); |
|
147 |
||
148 |
if ( result == KErrNone ) |
|
149 |
{ |
|
150 |
// Get asked property |
|
151 |
const CSPProperty* property = NULL; |
|
152 |
result = entry->GetProperty( property, aPropertyName ); |
|
153 |
||
154 |
if ( result == KErrNone && property ) |
|
155 |
{ |
|
156 |
TInt value( 0 ); |
|
157 |
property->GetValue( value ); |
|
158 |
aProperty = value; |
|
159 |
} |
|
160 |
else |
|
161 |
{ |
|
162 |
User::Leave( KErrNotFound ); |
|
163 |
} |
|
164 |
} |
|
165 |
else |
|
166 |
{ |
|
167 |
User::Leave( KErrNotFound ); |
|
168 |
} |
|
169 |
||
170 |
CleanupStack::PopAndDestroy( entry ); |
|
171 |
} |
|
172 |
||
173 |
// ----------------------------------------------------------------------------- |
|
174 |
// CScpSettingHandler::GetVoipSipProfileIdL |
|
175 |
// ----------------------------------------------------------------------------- |
|
176 |
// |
|
177 |
void CScpSettingHandler::GetVoipSipProfileIdL( TUint32 aServiceId, |
|
178 |
TUint32& aSipId ) const |
|
179 |
{ |
|
180 |
SCPLOGSTRING( "CScpSettingHandler::GetVoipSipProfileIdL" ); |
|
181 |
||
182 |
RPointerArray<CRCSEProfileEntry> entries; |
|
183 |
||
184 |
// Push entries to cleanup stack |
|
185 |
CleanupStack::PushL( TCleanupItem( TScpUtility::ResetAndDestroyEntries, |
|
186 |
&entries ) ); |
|
187 |
||
188 |
iRcseProfileRegistry->FindByServiceIdL( aServiceId, entries ); |
|
189 |
||
190 |
if ( entries.Count() ) |
|
191 |
{ |
|
192 |
CRCSEProfileEntry* entry = entries[0]; |
|
193 |
if ( entry->iIds.Count() > 0 ) |
|
194 |
{ |
|
195 |
aSipId = entry->iIds[0].iProfileId; |
|
196 |
} |
|
197 |
else |
|
198 |
{ |
|
199 |
User::Leave( KErrNotFound ); |
|
200 |
} |
|
201 |
} |
|
202 |
else |
|
203 |
{ |
|
204 |
User::Leave( KErrNotFound ); |
|
205 |
} |
|
206 |
||
207 |
CleanupStack::PopAndDestroy( &entries ); |
|
208 |
} |
|
209 |
||
210 |
// ----------------------------------------------------------------------------- |
|
211 |
// CScpSettingHandler::GetVmbxSipProfileIdL |
|
212 |
// ----------------------------------------------------------------------------- |
|
213 |
// |
|
214 |
void CScpSettingHandler::GetVmbxSipProfileIdL( TUint32 aServiceId, |
|
215 |
TUint32& aSipId ) const |
|
216 |
{ |
|
217 |
SCPLOGSTRING( "CScpSettingHandler::GetVmbxSipProfileIdL" ); |
|
218 |
||
219 |
TInt sipId; |
|
220 |
GetSPSettingsIntPropertyL( aServiceId, ESubPropertyVMBXSettingsId, sipId ); |
|
221 |
aSipId = sipId; |
|
222 |
} |
|
223 |
||
224 |
// ----------------------------------------------------------------------------- |
|
225 |
// CScpSettingHandler::GetPresenceSipProfileIdL |
|
226 |
// ----------------------------------------------------------------------------- |
|
227 |
// |
|
228 |
void CScpSettingHandler::GetPresenceSipProfileIdL( TUint32 aServiceId, |
|
229 |
TUint32& aSipId ) const |
|
230 |
{ |
|
231 |
SCPLOGSTRING( "CScpSettingHandler::GetPresenceSipProfileIdL" ); |
|
232 |
||
233 |
CSPEntry* entry = CSPEntry::NewLC(); |
|
234 |
TInt result = iSpSettings->FindEntryL( aServiceId, *entry ); |
|
235 |
if ( result == KErrNone ) |
|
236 |
{ |
|
237 |
// Get presence setting id for presence service |
|
238 |
const CSPProperty* property = NULL; |
|
239 |
result = entry->GetProperty( property, ESubPropertyPresenceSettingsId ); |
|
240 |
||
241 |
if ( result == KErrNone && property ) |
|
242 |
{ |
|
243 |
TInt presId; |
|
244 |
property->GetValue( presId ); |
|
245 |
||
246 |
//Found out what is sip id in presencesettings |
|
247 |
TPresSettingsSet mySet; |
|
248 |
User::LeaveIfError( PresSettingsApi::SettingsSetL( presId, mySet )); |
|
249 |
||
250 |
TInt sipId( 0 ); |
|
251 |
sipId = mySet.iSipProfile; |
|
252 |
aSipId = (TUint32)(sipId); |
|
253 |
} |
|
254 |
else |
|
255 |
{ |
|
256 |
User::Leave( KErrNotFound ); |
|
257 |
} |
|
258 |
} |
|
259 |
else |
|
260 |
{ |
|
261 |
User::Leave( KErrNotFound ); |
|
262 |
} |
|
263 |
||
264 |
CleanupStack::PopAndDestroy( entry ); |
|
265 |
} |
|
266 |
||
267 |
// ----------------------------------------------------------------------------- |
|
268 |
// CScpSettingHandler::GetUnknownSipProfileIdL |
|
269 |
// ----------------------------------------------------------------------------- |
|
270 |
// |
|
271 |
void CScpSettingHandler::GetUnknownSipProfileIdL( TUint32 aServiceId, |
|
272 |
TUint32& aSipId ) const |
|
273 |
{ |
|
274 |
SCPLOGSTRING( "CScpSettingHandler::GetVoipSipProfileIdL" ); |
|
275 |
||
276 |
TInt result( KErrNone ); |
|
277 |
TUint32 genericSipId( KErrNone ); |
|
278 |
RArray< TInt > sipIds; |
|
279 |
CleanupClosePushL( sipIds ); |
|
280 |
||
281 |
TRAP( result, GetSipProfileIdByTypeL( aServiceId, ECCHVoIPSub, genericSipId ) ); |
|
282 |
||
283 |
if ( result == KErrNone ) |
|
284 |
{ |
|
285 |
sipIds.AppendL( genericSipId ); |
|
286 |
} |
|
287 |
else if ( KErrNoMemory == result ) |
|
288 |
{ |
|
289 |
User::Leave( KErrNoMemory ); |
|
290 |
} |
|
291 |
||
292 |
TRAP( result, GetSipProfileIdByTypeL( aServiceId, ECCHVMBxSub, genericSipId ) ); |
|
293 |
||
294 |
if ( result == KErrNone ) |
|
295 |
{ |
|
296 |
sipIds.AppendL( genericSipId ); |
|
297 |
} |
|
298 |
else if ( KErrNoMemory == result ) |
|
299 |
{ |
|
300 |
User::Leave( KErrNoMemory ); |
|
301 |
} |
|
302 |
||
303 |
TRAP( result, GetSipProfileIdByTypeL( aServiceId, ECCHPresenceSub, genericSipId ) ); |
|
304 |
||
305 |
if ( result == KErrNone ) |
|
306 |
{ |
|
307 |
sipIds.AppendL( genericSipId ); |
|
308 |
} |
|
309 |
else if ( KErrNoMemory == result ) |
|
310 |
{ |
|
311 |
User::Leave( KErrNoMemory ); |
|
312 |
} |
|
313 |
||
314 |
// Check if all the sip profiles ids for different subservice types |
|
315 |
// are the same |
|
316 |
if ( sipIds.Count() > 0 ) |
|
317 |
{ |
|
318 |
result = KErrNone; |
|
319 |
aSipId = sipIds[0]; |
|
320 |
||
321 |
for( TInt i=0; i<sipIds.Count(); i++ ) |
|
322 |
{ |
|
323 |
if( sipIds[i] != aSipId ) |
|
324 |
{ |
|
325 |
result = KErrArgument; |
|
326 |
break; |
|
327 |
} |
|
328 |
} |
|
329 |
} |
|
330 |
else |
|
331 |
{ |
|
332 |
// There wasn't any sip profile ids |
|
333 |
result = KErrNotFound; |
|
334 |
} |
|
335 |
||
336 |
CleanupStack::PopAndDestroy( &sipIds ); |
|
337 |
||
338 |
User::LeaveIfError( result ); |
|
339 |
} |
|
340 |
||
341 |
// ----------------------------------------------------------------------------- |
|
342 |
// CScpSettingHandler::UpdateSettingsL |
|
343 |
// ----------------------------------------------------------------------------- |
|
344 |
// |
|
345 |
void CScpSettingHandler::UpdateSettingsL( CScpService& aService, |
|
346 |
TCCHSubserviceType aSubServiceType ) const |
|
347 |
{ |
|
348 |
SCPLOGSTRING4( "CScpSettingHandler::UpdateSettingsL: 0x%x id: %i type: %d", |
|
349 |
&aService, aService.ServiceId(), aSubServiceType ); |
|
350 |
__ASSERT_DEBUG( aService.ServiceId() > KErrNotFound, |
|
351 |
User::Panic( KNullDesC, KErrNotFound ) ); |
|
352 |
||
353 |
if ( !aService.ContainsSubServiceType( ECCHVoIPSub ) && |
|
354 |
( aSubServiceType == ECCHVoIPSub || aSubServiceType == ECCHUnknown ) ) |
|
355 |
{ |
|
356 |
SCPLOGSTRING( "CScpSettingHandler::UpdateSettingsL voip " ); |
|
357 |
UpdateVoIPSettingsL( aService ); |
|
358 |
} |
|
359 |
||
360 |
if ( !aService.ContainsSubServiceType( ECCHIMSub ) && |
|
361 |
( ECCHIMSub == aSubServiceType || ECCHUnknown == aSubServiceType ) ) |
|
362 |
{ |
|
363 |
SCPLOGSTRING( "CScpSettingHandler::UpdateSettingsL IM" ); |
|
364 |
UpdateImSettingsL( aService ); |
|
365 |
} |
|
366 |
||
367 |
if ( !aService.ContainsSubServiceType( ECCHVMBxSub ) && |
|
368 |
( aSubServiceType == ECCHVMBxSub || aSubServiceType == ECCHUnknown ) ) |
|
369 |
{ |
|
370 |
SCPLOGSTRING( "CScpSettingHandler::UpdateSettingsL vmbx " ); |
|
371 |
UpdateVmbxSettingsL( aService ); |
|
372 |
} |
|
373 |
||
374 |
if ( !aService.ContainsSubServiceType( ECCHPresenceSub ) && |
|
375 |
(aSubServiceType == ECCHPresenceSub || aSubServiceType == ECCHUnknown ) ) |
|
376 |
{ |
|
377 |
SCPLOGSTRING( "CScpSettingHandler::UpdateSettingsL presence x " ); |
|
378 |
UpdatePresenceSettingsL( aService ); |
|
379 |
} |
|
380 |
||
381 |
if ( aService.SubServiceCount() == 0 ) |
|
382 |
{ |
|
383 |
User::Leave( KErrNotFound ); |
|
384 |
} |
|
385 |
} |
|
386 |
||
387 |
// ----------------------------------------------------------------------------- |
|
388 |
// CScpSettingHandler::UpdateXdmUsernameL |
|
389 |
// ----------------------------------------------------------------------------- |
|
390 |
// |
|
391 |
void CScpSettingHandler::UpdateXdmUsernameL( CScpService& aService, |
|
392 |
TCCHSubserviceType aSubServiceType, const TDesC8& aUsername ) |
|
393 |
{ |
|
394 |
SCPLOGSTRING2( "CScpSettingHandler::UpdateXdmUsernameL, service id: %d", |
|
395 |
aService.ServiceId() ); |
|
396 |
||
397 |
if ( aService.ContainsSubServiceType( ECCHPresenceSub ) && |
|
398 |
( aSubServiceType == ECCHPresenceSub || |
|
399 |
aSubServiceType == ECCHUnknown ) ) |
|
400 |
{ |
|
401 |
CSPEntry* entry = CSPEntry::NewLC(); |
|
402 |
User::LeaveIfError( iSpSettings->FindEntryL( |
|
403 |
aService.ServiceId(), *entry ) ); |
|
404 |
||
405 |
if ( ArePresenceSettingsValid( *entry ) ) |
|
406 |
{ |
|
407 |
TInt presenceSettingsId = GetPresenceSettingsId( *entry ); |
|
408 |
||
409 |
if ( presenceSettingsId != KErrNotFound ) |
|
410 |
{ |
|
411 |
// Find out the sip profile that the presence is using |
|
412 |
TPresSettingsSet mySet; |
|
413 |
TRAPD( result, |
|
414 |
PresSettingsApi::SettingsSetL( |
|
415 |
presenceSettingsId, mySet ) ); |
|
416 |
||
417 |
if ( KErrNone == result && mySet.iSipProfile > 0 ) |
|
418 |
{ |
|
419 |
// check XDM settings are valid |
|
420 |
CXdmSettingsCollection* xdmCollection = NULL; |
|
421 |
TRAPD( xdmResult, xdmCollection = |
|
422 |
TXdmSettingsApi::SettingsCollectionL( |
|
423 |
mySet.iXDMSetting ) ); |
|
424 |
||
425 |
if ( KErrNone == xdmResult && xdmCollection ) |
|
426 |
{ |
|
427 |
CleanupStack::PushL( xdmCollection ); |
|
428 |
||
429 |
if ( iProfileHandler.ProfileExists( |
|
430 |
mySet.iSipProfile ) ) |
|
431 |
{ |
|
432 |
RBuf8 formattedUsername; |
|
433 |
CleanupClosePushL( formattedUsername ); |
|
434 |
||
435 |
if( !TScpUtility::CheckSipUsername( aUsername ) ) |
|
436 |
{ |
|
437 |
// Since username is returned with prefix and |
|
438 |
// domain, it needs to be possible to also set |
|
439 |
// it with prefix and domain. Strip prefix |
|
440 |
// and domain from user aor if found. Prefix |
|
441 |
// might be sip or sips so search by colon. |
|
442 |
User::LeaveIfError( |
|
443 |
TScpUtility::RemovePrefixAndDomain( |
|
444 |
aUsername, formattedUsername ) ); |
|
445 |
} |
|
446 |
else |
|
447 |
{ |
|
448 |
formattedUsername.CreateL( |
|
449 |
aUsername.Length() ); |
|
450 |
formattedUsername.Copy( aUsername ); |
|
451 |
} |
|
452 |
||
453 |
RBuf userName; |
|
454 |
CleanupClosePushL( userName ); |
|
455 |
userName.CreateL( formattedUsername.Length() ); |
|
456 |
userName.Copy( formattedUsername ); |
|
457 |
||
458 |
// Update username to XDM-setting. |
|
459 |
TXdmSettingsApi::UpdatePropertyL( |
|
460 |
mySet.iXDMSetting, |
|
461 |
userName, |
|
462 |
EXdmPropAuthName ); |
|
463 |
||
464 |
CleanupStack::PopAndDestroy( &userName ); |
|
465 |
CleanupStack::PopAndDestroy( &formattedUsername ); |
|
466 |
||
467 |
SCPLOGSTRING( |
|
468 |
"CScpSettingHandler::UpdateXdmUsernameL - DONE" ); |
|
469 |
} |
|
470 |
else |
|
471 |
{ |
|
472 |
User::Leave( KErrNotFound ); |
|
473 |
} |
|
474 |
||
475 |
CleanupStack::PopAndDestroy( xdmCollection ); |
|
476 |
} |
|
477 |
} |
|
478 |
} |
|
479 |
} |
|
480 |
CleanupStack::PopAndDestroy( entry ); |
|
481 |
} |
|
482 |
||
483 |
if ( aService.SubServiceCount() == 0 ) |
|
484 |
{ |
|
485 |
User::Leave( KErrNotFound ); |
|
486 |
} |
|
487 |
} |
|
488 |
||
489 |
// ----------------------------------------------------------------------------- |
|
490 |
// CScpSettingHandler::UpdateXdmPasswordL |
|
491 |
// ----------------------------------------------------------------------------- |
|
492 |
// |
|
493 |
void CScpSettingHandler::UpdateXdmPasswordL( CScpService& aService, |
|
494 |
TCCHSubserviceType aSubServiceType, const TDesC8& aPassword ) |
|
495 |
{ |
|
496 |
SCPLOGSTRING2( "CScpSettingHandler::UpdateXdmPasswordL, service id: %d", |
|
497 |
aService.ServiceId() ); |
|
498 |
||
499 |
if ( aService.ContainsSubServiceType( ECCHPresenceSub ) && |
|
500 |
( aSubServiceType == ECCHPresenceSub || |
|
501 |
aSubServiceType == ECCHUnknown ) ) |
|
502 |
{ |
|
503 |
SCPLOGSTRING( "CScpSettingHandler::UpdateXdmPasswordL, presence" ); |
|
504 |
||
505 |
CSPEntry* entry = CSPEntry::NewLC(); |
|
506 |
User::LeaveIfError( iSpSettings->FindEntryL( |
|
507 |
aService.ServiceId(), *entry ) ); |
|
508 |
||
509 |
if ( ArePresenceSettingsValid( *entry ) ) |
|
510 |
{ |
|
511 |
TInt presenceSettingsId = GetPresenceSettingsId( *entry ); |
|
512 |
||
513 |
if ( presenceSettingsId != KErrNotFound ) |
|
514 |
{ |
|
515 |
// Find out the sip profile that the presence is using |
|
516 |
TPresSettingsSet mySet; |
|
517 |
||
518 |
TRAPD( result, |
|
519 |
PresSettingsApi::SettingsSetL( |
|
520 |
presenceSettingsId, mySet ) ); |
|
521 |
||
522 |
if ( KErrNone == result && mySet.iSipProfile > 0 ) |
|
523 |
{ |
|
524 |
// check XDM settings are valid |
|
525 |
CXdmSettingsCollection* xdmCollection = NULL; |
|
526 |
TRAPD( xdmResult, xdmCollection = |
|
527 |
TXdmSettingsApi::SettingsCollectionL( |
|
528 |
mySet.iXDMSetting ) ); |
|
529 |
||
530 |
if ( KErrNone == xdmResult && xdmCollection ) |
|
531 |
{ |
|
532 |
CleanupStack::PushL( xdmCollection ); |
|
533 |
||
534 |
if ( iProfileHandler.ProfileExists( |
|
535 |
mySet.iSipProfile ) ) |
|
536 |
{ |
|
537 |
RBuf passwordBuf; |
|
538 |
CleanupClosePushL( passwordBuf ); |
|
539 |
passwordBuf.CreateL( aPassword.Length() ); |
|
540 |
passwordBuf.Copy( aPassword ); |
|
541 |
||
542 |
// Update password to XDM-setting |
|
543 |
TXdmSettingsApi::UpdatePropertyL( |
|
544 |
mySet.iXDMSetting, |
|
545 |
passwordBuf, |
|
546 |
EXdmPropAuthSecret ); |
|
547 |
||
548 |
CleanupStack::PopAndDestroy( &passwordBuf ); |
|
549 |
||
550 |
SCPLOGSTRING( |
|
551 |
"CScpSettingHandler::UpdateXdmPasswordL - DONE" ); |
|
552 |
} |
|
553 |
else |
|
554 |
{ |
|
555 |
User::Leave( KErrNotFound ); |
|
556 |
} |
|
557 |
||
558 |
CleanupStack::PopAndDestroy( xdmCollection ); |
|
559 |
} |
|
560 |
} |
|
561 |
} |
|
562 |
} |
|
563 |
CleanupStack::PopAndDestroy( entry ); |
|
564 |
} |
|
565 |
||
566 |
if ( aService.SubServiceCount() == 0 ) |
|
567 |
{ |
|
568 |
User::Leave( KErrNotFound ); |
|
569 |
} |
|
570 |
} |
|
571 |
||
572 |
// ----------------------------------------------------------------------------- |
|
573 |
// CScpSettingHandler::UpdatePresenceSettingsL |
|
574 |
// ----------------------------------------------------------------------------- |
|
575 |
// |
|
576 |
void CScpSettingHandler::UpdatePresenceSettingsL( CScpService& aService ) const |
|
577 |
{ |
|
578 |
SCPLOGSTRING( "CScpSettingHandler::UpdatePresenceSettingsL" ); |
|
579 |
||
580 |
CSPEntry* entry = CSPEntry::NewLC(); |
|
581 |
||
582 |
if ( iSpSettings->FindEntryL( aService.ServiceId(), *entry ) == KErrNone ) |
|
583 |
{ |
|
584 |
if ( ArePresenceSettingsValid( *entry ) ) |
|
585 |
{ |
|
586 |
TInt presenceSettingsId = GetPresenceSettingsId( *entry ); |
|
587 |
||
588 |
if ( presenceSettingsId != KErrNotFound ) |
|
589 |
{ |
|
590 |
// Find out the sip profile that the presence is using |
|
591 |
TPresSettingsSet mySet; |
|
592 |
||
593 |
TRAPD( result, |
|
594 |
PresSettingsApi::SettingsSetL( presenceSettingsId, mySet ) ); |
|
595 |
||
596 |
if ( KErrNone == result && mySet.iSipProfile > 0 ) |
|
597 |
{ |
|
598 |
// check XDM settings are valid |
|
599 |
CXdmSettingsCollection* xdmCollection = NULL; |
|
600 |
TRAPD( xdmResult, xdmCollection = |
|
601 |
TXdmSettingsApi::SettingsCollectionL( mySet.iXDMSetting ) ); |
|
602 |
||
603 |
if ( KErrNone == xdmResult && xdmCollection ) |
|
604 |
{ |
|
605 |
CleanupStack::PushL( xdmCollection ); |
|
606 |
||
607 |
if ( iProfileHandler.ProfileExists( mySet.iSipProfile ) ) |
|
608 |
{ |
|
609 |
CScpSubService& presenceService = aService.AddSubServiceL( ECCHPresenceSub ); |
|
610 |
||
611 |
presenceService.SetSipProfileId( mySet.iSipProfile ); |
|
612 |
} |
|
613 |
else |
|
614 |
{ |
|
615 |
User::Leave( KErrNotFound ); |
|
616 |
} |
|
617 |
||
618 |
CleanupStack::PopAndDestroy( xdmCollection ); |
|
619 |
} |
|
620 |
} |
|
621 |
} |
|
622 |
} |
|
623 |
} |
|
624 |
CleanupStack::PopAndDestroy( entry ); |
|
625 |
} |
|
626 |
||
627 |
// ----------------------------------------------------------------------------- |
|
628 |
// CScpSettingHandler::ArePresenceSettingsValid |
|
629 |
// ----------------------------------------------------------------------------- |
|
630 |
// |
|
631 |
TBool CScpSettingHandler::ArePresenceSettingsValid( const CSPEntry& aEntry ) const |
|
632 |
{ |
|
633 |
SCPLOGSTRING( "CScpSettingHandler::ArePresenceSettingsValid" ); |
|
634 |
||
635 |
const CSPProperty* property = NULL; |
|
636 |
||
637 |
// Make sure that the this is the correct plugin |
|
638 |
TInt result = aEntry.GetProperty( property, EPropertyPresenceSubServicePluginId ); |
|
639 |
||
640 |
if ( result == KErrNone && property ) |
|
641 |
{ |
|
642 |
TInt pluginId = 0; |
|
643 |
property->GetValue( pluginId ); |
|
644 |
||
645 |
SCPLOGSTRING2( "Presence sub service plugin UID: 0x%x", pluginId ); |
|
646 |
||
647 |
if ( pluginId == KSIPConnectivityPluginImplUid ) |
|
648 |
{ |
|
649 |
return ETrue; |
|
650 |
} |
|
651 |
} |
|
652 |
||
653 |
return EFalse; |
|
654 |
} |
|
655 |
||
656 |
// ----------------------------------------------------------------------------- |
|
657 |
// CScpSettingHandler::GetPresenceSettingsId |
|
658 |
// ----------------------------------------------------------------------------- |
|
659 |
// |
|
660 |
TInt CScpSettingHandler::GetPresenceSettingsId( const CSPEntry& aEntry ) const |
|
661 |
{ |
|
662 |
SCPLOGSTRING( "CScpSettingHandler::GetPresenceSettingsId" ); |
|
663 |
||
664 |
const CSPProperty* property = NULL; |
|
665 |
TInt result = aEntry.GetProperty( property, ESubPropertyPresenceSettingsId ); |
|
666 |
||
667 |
if ( property && result == KErrNone ) |
|
668 |
{ |
|
669 |
TInt presenceSettingsId = 0; |
|
670 |
result = property->GetValue( presenceSettingsId ); |
|
671 |
||
672 |
if ( result == KErrNone ) |
|
673 |
{ |
|
674 |
return presenceSettingsId; |
|
675 |
} |
|
676 |
} |
|
677 |
||
678 |
return KErrNotFound; |
|
679 |
} |
|
680 |
||
681 |
// ----------------------------------------------------------------------------- |
|
682 |
// CScpSettingHandler::UpdateVoIPSettingsL |
|
683 |
// ----------------------------------------------------------------------------- |
|
684 |
// |
|
685 |
void CScpSettingHandler::UpdateVoIPSettingsL( CScpService& aService ) const |
|
686 |
{ |
|
687 |
SCPLOGSTRING( "CScpSettingHandler::UpdateVoIPSettingsL" ); |
|
688 |
||
689 |
CSPEntry* entry = CSPEntry::NewLC(); |
|
690 |
||
691 |
if ( iSpSettings->FindEntryL( aService.ServiceId(), *entry ) == KErrNone ) |
|
692 |
{ |
|
693 |
if ( AreVoipSettingsValid( *entry ) ) |
|
694 |
{ |
|
695 |
RPointerArray<CRCSEProfileEntry> entries; |
|
696 |
// Push entries to cleanup stack |
|
697 |
CleanupStack::PushL( TCleanupItem( TScpUtility::ResetAndDestroyEntries, |
|
698 |
&entries ) ); |
|
699 |
||
700 |
iRcseProfileRegistry->FindByServiceIdL( aService.ServiceId(), entries ); |
|
701 |
||
702 |
TInt idsCount = entries.Count(); |
|
703 |
||
704 |
if ( idsCount > 0 ) |
|
705 |
{ |
|
706 |
CRCSEProfileEntry* profileEntry = entries[ 0 ]; |
|
707 |
||
708 |
if ( profileEntry && profileEntry->iIds.Count() ) |
|
709 |
{ |
|
710 |
TSettingIds& settingId = profileEntry->iIds[ 0 ]; |
|
711 |
||
712 |
__ASSERT_DEBUG( settingId.iProfileId > 0, |
|
713 |
User::Panic( KNullDesC, KErrGeneral ) ); |
|
714 |
||
715 |
if ( iProfileHandler.ProfileExists( settingId.iProfileId ) ) |
|
716 |
{ |
|
717 |
CScpSubService& voipService = aService.AddSubServiceL( ECCHVoIPSub ); |
|
718 |
||
719 |
voipService.SetSipProfileId( settingId.iProfileId ); |
|
720 |
} |
|
721 |
else |
|
722 |
{ |
|
723 |
User::Leave( KErrNotFound ); |
|
724 |
} |
|
725 |
} |
|
726 |
} |
|
727 |
||
728 |
CleanupStack::PopAndDestroy( &entries ); |
|
729 |
} |
|
730 |
} |
|
731 |
||
732 |
CleanupStack::PopAndDestroy( entry ); |
|
733 |
} |
|
734 |
||
735 |
// ----------------------------------------------------------------------------- |
|
736 |
// CScpSettingHandler::AreVoipSettingsValid |
|
737 |
// ----------------------------------------------------------------------------- |
|
738 |
// |
|
739 |
TBool CScpSettingHandler::AreVoipSettingsValid( const CSPEntry& aEntry ) const |
|
740 |
{ |
|
741 |
SCPLOGSTRING( "CScpSettingHandler::AreVoipSettingsValid" ); |
|
742 |
||
743 |
const CSPProperty* property = NULL; |
|
744 |
||
745 |
// Make sure that the this is the correct plugin |
|
746 |
TInt result = aEntry.GetProperty( property, EPropertyVoIPSubServicePluginId ); |
|
747 |
||
748 |
if ( result == KErrNone && property ) |
|
749 |
{ |
|
750 |
TInt pluginId = 0; |
|
751 |
property->GetValue( pluginId ); |
|
752 |
||
753 |
SCPLOGSTRING3( "VoIP sub service plugin UID: 0x%x this 0x%x", pluginId, KSIPConnectivityPluginImplUid ); |
|
754 |
||
755 |
if ( pluginId == KSIPConnectivityPluginImplUid ) |
|
756 |
{ |
|
757 |
return ETrue; |
|
758 |
} |
|
759 |
} |
|
760 |
||
761 |
return EFalse; |
|
762 |
} |
|
763 |
||
764 |
// ----------------------------------------------------------------------------- |
|
765 |
// CScpSettingHandler::UpdateVmbxSettingsL |
|
766 |
// ----------------------------------------------------------------------------- |
|
767 |
// |
|
768 |
void CScpSettingHandler::UpdateVmbxSettingsL( CScpService& aService ) const |
|
769 |
{ |
|
770 |
SCPLOGSTRING( "CScpSettingHandler::UpdateVmbxSettingsL" ); |
|
771 |
||
772 |
CSPEntry* entry = CSPEntry::NewLC(); |
|
773 |
||
774 |
if ( iSpSettings->FindEntryL( aService.ServiceId(), *entry ) == KErrNone ) |
|
775 |
{ |
|
776 |
if( AreVmbxSettingsValid( *entry ) ) |
|
777 |
{ |
|
778 |
const CSPProperty* property = NULL; |
|
779 |
||
780 |
// Get sip profile id for the vmbx service |
|
781 |
TInt result = entry->GetProperty( property, ESubPropertyVMBXSettingsId ); |
|
782 |
||
783 |
if ( result == KErrNone && property ) |
|
784 |
{ |
|
785 |
TInt sipProfileId( 0 ); |
|
786 |
property->GetValue( sipProfileId ); |
|
787 |
||
788 |
__ASSERT_DEBUG( sipProfileId > 0, User::Panic( KNullDesC, KErrGeneral ) ); |
|
789 |
||
790 |
if ( iProfileHandler.ProfileExists( sipProfileId ) ) |
|
791 |
{ |
|
792 |
CScpSubService& vmbxService = aService.AddSubServiceL( ECCHVMBxSub ); |
|
793 |
||
794 |
vmbxService.SetSipProfileId( sipProfileId ); |
|
795 |
} |
|
796 |
else |
|
797 |
{ |
|
798 |
User::Leave( KErrNotFound ); |
|
799 |
} |
|
800 |
} |
|
801 |
} |
|
802 |
} |
|
803 |
||
804 |
CleanupStack::PopAndDestroy( entry ); |
|
805 |
} |
|
806 |
||
807 |
// ----------------------------------------------------------------------------- |
|
808 |
// CScpSettingHandler::AreVmbxSettingsValid |
|
809 |
// ----------------------------------------------------------------------------- |
|
810 |
// |
|
811 |
TBool CScpSettingHandler::AreVmbxSettingsValid( const CSPEntry& aEntry ) const |
|
812 |
{ |
|
813 |
SCPLOGSTRING( "CScpSettingHandler::AreVmbxSettingsValid" ); |
|
814 |
||
815 |
const CSPProperty* property = NULL; |
|
816 |
||
817 |
// Make sure that the this is the correct plugin |
|
818 |
TInt result = aEntry.GetProperty( property, EPropertyVMBXSubServicePluginId ); |
|
819 |
||
820 |
if ( result == KErrNone && property ) |
|
821 |
{ |
|
822 |
TInt pluginId = 0; |
|
823 |
property->GetValue( pluginId ); |
|
824 |
||
825 |
SCPLOGSTRING2( "VMBx sub service plugin UID: 0x%x", pluginId ); |
|
826 |
||
827 |
if ( pluginId == KSIPConnectivityPluginImplUid ) |
|
828 |
{ |
|
829 |
// Make sure that the MWI address is found |
|
830 |
result = aEntry.GetProperty( property, ESubPropertyVMBXMWIAddress ); |
|
831 |
||
832 |
if ( result == KErrNone && property ) |
|
833 |
{ |
|
834 |
return ETrue; |
|
835 |
} |
|
836 |
} |
|
837 |
} |
|
838 |
||
839 |
return EFalse; |
|
840 |
} |
|
841 |
||
842 |
// ----------------------------------------------------------------------------- |
|
843 |
// CScpSettingHandler::ServiceExistsL |
|
844 |
// ----------------------------------------------------------------------------- |
|
845 |
// |
|
846 |
TBool CScpSettingHandler::ServiceExistsL( TUint32 aServiceId ) const |
|
847 |
{ |
|
848 |
SCPLOGSTRING2( "CScpSettingHandler::ServiceExistsL id: %d", aServiceId ); |
|
849 |
||
850 |
TBool serviceExists( EFalse ); |
|
851 |
||
852 |
RIdArray serviceIds; |
|
853 |
iSpSettings->FindServiceIdsL( serviceIds ); |
|
854 |
||
855 |
for ( TInt i=0; i<serviceIds.Count(); i++ ) |
|
856 |
{ |
|
857 |
if ( aServiceId == serviceIds[ i ] ) |
|
858 |
{ |
|
859 |
serviceExists = ETrue; |
|
860 |
break; |
|
861 |
} |
|
862 |
} |
|
863 |
||
864 |
serviceIds.Close(); |
|
865 |
return serviceExists; |
|
866 |
} |
|
867 |
||
868 |
// ----------------------------------------------------------------------------- |
|
869 |
// CScpSettingHandler::GetServiceId |
|
870 |
// ----------------------------------------------------------------------------- |
|
871 |
// |
|
872 |
TInt CScpSettingHandler::GetServiceIds( TUint32 aSipId, |
|
873 |
RArray< TUint32 >& aServiceIds ) const |
|
874 |
{ |
|
875 |
SCPLOGSTRING2( "CScpSettingHandler::GetServiceIds sip id: %d", aSipId ); |
|
876 |
||
877 |
TRAPD( result, GetServiceIdsL( aSipId, aServiceIds ) ); |
|
878 |
||
879 |
return result; |
|
880 |
} |
|
881 |
||
882 |
// ----------------------------------------------------------------------------- |
|
883 |
// CScpSettingHandler::GetServiceIdsL |
|
884 |
// ----------------------------------------------------------------------------- |
|
885 |
// |
|
886 |
void CScpSettingHandler::GetServiceIdsL( TUint32 aSipId, |
|
887 |
RArray< TUint32 >& aServiceIds ) const |
|
888 |
{ |
|
889 |
SCPLOGSTRING2( "CScpSettingHandler::GetServiceIdsL sip id: %d", aSipId ); |
|
890 |
||
891 |
CleanupClosePushL( aServiceIds ); |
|
892 |
||
893 |
RArray<TUint32> profileIdArray; |
|
894 |
CleanupClosePushL( profileIdArray ); |
|
895 |
||
896 |
iRcseProfileRegistry->GetAllIdsL( profileIdArray ); |
|
897 |
||
898 |
TBool found( EFalse ); |
|
899 |
||
900 |
//VoIP profile count |
|
901 |
for ( TInt i=0; i < profileIdArray.Count() && !found; i++ ) |
|
902 |
{ |
|
903 |
// profileEntry is reseted by rcse before the search |
|
904 |
iRcseProfileRegistry->FindL( profileIdArray[i], |
|
905 |
*iRcseProfileEntry ); |
|
906 |
||
907 |
for ( TInt j=0; j < iRcseProfileEntry->iIds.Count(); j++ ) |
|
908 |
{ |
|
909 |
if ( aSipId == iRcseProfileEntry->iIds[j].iProfileId ) |
|
910 |
{ |
|
911 |
aServiceIds.Append( profileIdArray[i] ); |
|
912 |
} |
|
913 |
} |
|
914 |
} |
|
915 |
||
916 |
if ( !aServiceIds.Count() ) |
|
917 |
{ |
|
918 |
User::Leave( KErrNotFound ); |
|
919 |
} |
|
920 |
||
921 |
CleanupStack::PopAndDestroy( &profileIdArray ); |
|
922 |
CleanupStack::Pop( &aServiceIds ); |
|
923 |
} |
|
924 |
||
925 |
// ----------------------------------------------------------------------------- |
|
926 |
// CScpSettingHandler::IsVoIPSupported |
|
927 |
// ----------------------------------------------------------------------------- |
|
928 |
// |
|
929 |
TBool CScpSettingHandler::IsVoIPSupported() const |
|
930 |
{ |
|
931 |
return iSpsVoIPUtils->IsVoIPSupported(); |
|
932 |
} |
|
933 |
||
934 |
// ----------------------------------------------------------------------------- |
|
935 |
// CScpSettingHandler::IsUahTerminalTypeDefinedL |
|
936 |
// ----------------------------------------------------------------------------- |
|
937 |
// |
|
938 |
TBool CScpSettingHandler::IsUahTerminalTypeDefinedL( |
|
939 |
TUint32 aServiceId ) const |
|
940 |
{ |
|
941 |
TBool defined( EFalse ); |
|
942 |
RPointerArray<CRCSEProfileEntry> entries; |
|
943 |
||
944 |
// Push entries to cleanup stack |
|
945 |
CleanupStack::PushL( TCleanupItem( TScpUtility::ResetAndDestroyEntries, |
|
946 |
&entries ) ); |
|
947 |
||
948 |
iRcseProfileRegistry->FindByServiceIdL( aServiceId, entries ); |
|
949 |
||
950 |
if ( entries.Count() ) |
|
951 |
{ |
|
952 |
// SIP VoIP User Agent header: terminal type display |
|
953 |
defined = entries[0]->iSIPVoIPUAHTerminalType; |
|
954 |
} |
|
955 |
||
956 |
CleanupStack::PopAndDestroy( &entries ); |
|
957 |
return defined; |
|
958 |
} |
|
959 |
||
960 |
// ----------------------------------------------------------------------------- |
|
961 |
// CScpSettingHandler::IsUahWLANMacDefinedL |
|
962 |
// ----------------------------------------------------------------------------- |
|
963 |
// |
|
964 |
TBool CScpSettingHandler::IsUahWLANMacDefinedL( |
|
965 |
TUint32 aServiceId ) const |
|
966 |
{ |
|
967 |
TBool defined( EFalse ); |
|
968 |
RPointerArray<CRCSEProfileEntry> entries; |
|
969 |
||
970 |
// Push entries to cleanup stack |
|
971 |
CleanupStack::PushL( TCleanupItem( TScpUtility::ResetAndDestroyEntries, |
|
972 |
&entries ) ); |
|
973 |
||
974 |
iRcseProfileRegistry->FindByServiceIdL( aServiceId, entries ); |
|
975 |
||
976 |
if ( entries.Count() ) |
|
977 |
{ |
|
978 |
// SIP VoIP User Agent header WLAN MAC address display |
|
979 |
defined = entries[0]->iSIPVoIPUAHeaderWLANMAC; |
|
980 |
} |
|
981 |
||
982 |
CleanupStack::PopAndDestroy( &entries ); |
|
983 |
return defined; |
|
984 |
} |
|
985 |
||
986 |
// ----------------------------------------------------------------------------- |
|
987 |
// CScpSettingHandler::UahStringLengthL |
|
988 |
// ----------------------------------------------------------------------------- |
|
989 |
// |
|
990 |
TInt CScpSettingHandler::UahStringLengthL( |
|
991 |
TUint32 aServiceId ) const |
|
992 |
{ |
|
993 |
TBool length( KErrNone ); |
|
994 |
RPointerArray<CRCSEProfileEntry> entries; |
|
995 |
||
996 |
// Push entries to cleanup stack |
|
997 |
CleanupStack::PushL( TCleanupItem( TScpUtility::ResetAndDestroyEntries, |
|
998 |
&entries ) ); |
|
999 |
||
1000 |
iRcseProfileRegistry->FindByServiceIdL( aServiceId, entries ); |
|
1001 |
||
1002 |
if ( entries.Count() ) |
|
1003 |
{ |
|
1004 |
// SIP VoIP User Agent header string |
|
1005 |
length = entries[0]->iSIPVoIPUAHeaderString.Length(); |
|
1006 |
} |
|
1007 |
||
1008 |
CleanupStack::PopAndDestroy( &entries ); |
|
1009 |
return length; |
|
1010 |
} |
|
1011 |
||
1012 |
// ----------------------------------------------------------------------------- |
|
33
2989b291cac7
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
28
diff
changeset
|
1013 |
// CScpSettingHandler::IsVoIPOverWcdmaAllowedL |
2989b291cac7
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
28
diff
changeset
|
1014 |
// ----------------------------------------------------------------------------- |
2989b291cac7
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
28
diff
changeset
|
1015 |
// |
2989b291cac7
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
28
diff
changeset
|
1016 |
TBool CScpSettingHandler::IsVoIPOverWcdmaAllowedL( |
2989b291cac7
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
28
diff
changeset
|
1017 |
TUint32 aServiceId ) const |
2989b291cac7
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
28
diff
changeset
|
1018 |
{ |
2989b291cac7
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
28
diff
changeset
|
1019 |
SCPLOGSTRING( "CScpSettingHandler::IsVoIPOverWcdmaAllowedL IN" ); |
2989b291cac7
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
28
diff
changeset
|
1020 |
|
2989b291cac7
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
28
diff
changeset
|
1021 |
TBool response( EFalse ); |
2989b291cac7
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
28
diff
changeset
|
1022 |
RPointerArray<CRCSEProfileEntry> entries; |
2989b291cac7
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
28
diff
changeset
|
1023 |
|
2989b291cac7
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
28
diff
changeset
|
1024 |
// Push entries to cleanup stack |
2989b291cac7
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
28
diff
changeset
|
1025 |
CleanupStack::PushL( TCleanupItem( TScpUtility::ResetAndDestroyEntries, |
2989b291cac7
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
28
diff
changeset
|
1026 |
&entries ) ); |
2989b291cac7
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
28
diff
changeset
|
1027 |
|
2989b291cac7
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
28
diff
changeset
|
1028 |
iRcseProfileRegistry->FindByServiceIdL( aServiceId, entries ); |
2989b291cac7
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
28
diff
changeset
|
1029 |
|
2989b291cac7
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
28
diff
changeset
|
1030 |
if ( entries.Count() ) |
2989b291cac7
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
28
diff
changeset
|
1031 |
{ |
2989b291cac7
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
28
diff
changeset
|
1032 |
response = CRCSEProfileEntry::EOn == entries[ 0 ]->iAllowVoIPoverWCDMA; |
2989b291cac7
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
28
diff
changeset
|
1033 |
} |
2989b291cac7
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
28
diff
changeset
|
1034 |
else |
2989b291cac7
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
28
diff
changeset
|
1035 |
{ |
2989b291cac7
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
28
diff
changeset
|
1036 |
User::Leave( KErrNotFound ); |
2989b291cac7
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
28
diff
changeset
|
1037 |
} |
2989b291cac7
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
28
diff
changeset
|
1038 |
|
2989b291cac7
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
28
diff
changeset
|
1039 |
CleanupStack::PopAndDestroy( &entries ); |
2989b291cac7
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
28
diff
changeset
|
1040 |
|
2989b291cac7
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
28
diff
changeset
|
1041 |
SCPLOGSTRING2( |
2989b291cac7
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
28
diff
changeset
|
1042 |
"CScpSettingHandler::IsVoIPOverWcdmaAllowedL : allowed : %d OUT", |
2989b291cac7
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
28
diff
changeset
|
1043 |
response ); |
2989b291cac7
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
28
diff
changeset
|
1044 |
return response; |
2989b291cac7
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
28
diff
changeset
|
1045 |
} |
2989b291cac7
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
28
diff
changeset
|
1046 |
|
2989b291cac7
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
28
diff
changeset
|
1047 |
// ----------------------------------------------------------------------------- |
28 | 1048 |
// CScpSettingHandler::UpdateImSettingsL |
1049 |
// ----------------------------------------------------------------------------- |
|
1050 |
// |
|
1051 |
void CScpSettingHandler::UpdateImSettingsL( CScpService& aService ) const |
|
1052 |
{ |
|
1053 |
SCPLOGSTRING( "CScpSettingHandler::UpdateImSettingsL" ); |
|
1054 |
||
1055 |
CSPEntry* entry = CSPEntry::NewLC(); |
|
1056 |
||
1057 |
if ( KErrNone == iSpSettings->FindEntryL( aService.ServiceId(), *entry ) ) |
|
1058 |
{ |
|
1059 |
if ( AreImSettingsValid( *entry ) ) |
|
1060 |
{ |
|
1061 |
RPointerArray<CRCSEProfileEntry> entries; |
|
1062 |
// Push entries to cleanup stack |
|
1063 |
CleanupStack::PushL( TCleanupItem( |
|
1064 |
TScpUtility::ResetAndDestroyEntries, &entries ) ); |
|
1065 |
||
1066 |
iRcseProfileRegistry->FindByServiceIdL( aService.ServiceId(), |
|
1067 |
entries ); |
|
1068 |
TInt idsCount = entries.Count(); |
|
1069 |
||
1070 |
if ( idsCount > 0 ) |
|
1071 |
{ |
|
1072 |
CRCSEProfileEntry* profileEntry = entries[ 0 ]; |
|
1073 |
||
1074 |
if ( profileEntry && profileEntry->iIds.Count() ) |
|
1075 |
{ |
|
1076 |
TSettingIds& settingId = profileEntry->iIds[ 0 ]; |
|
1077 |
||
1078 |
__ASSERT_DEBUG( settingId.iProfileId > 0, |
|
1079 |
User::Panic( KNullDesC, KErrGeneral ) ); |
|
1080 |
||
1081 |
if ( iProfileHandler.ProfileExists( settingId.iProfileId ) ) |
|
1082 |
{ |
|
1083 |
CScpSubService& imSubService = aService.AddSubServiceL( |
|
1084 |
ECCHIMSub ); |
|
1085 |
imSubService.SetSipProfileId( settingId.iProfileId ); |
|
1086 |
} |
|
1087 |
else |
|
1088 |
{ |
|
1089 |
User::Leave( KErrNotFound ); |
|
1090 |
} |
|
1091 |
} |
|
1092 |
} |
|
1093 |
||
1094 |
CleanupStack::PopAndDestroy( &entries ); |
|
1095 |
} |
|
1096 |
} |
|
1097 |
||
1098 |
CleanupStack::PopAndDestroy( entry ); |
|
1099 |
} |
|
1100 |
||
1101 |
// ----------------------------------------------------------------------------- |
|
1102 |
// CScpSettingHandler::AreImSettingsValid |
|
1103 |
// ----------------------------------------------------------------------------- |
|
1104 |
// |
|
1105 |
TBool CScpSettingHandler::AreImSettingsValid( const CSPEntry& aEntry ) const |
|
1106 |
{ |
|
1107 |
SCPLOGSTRING( "CScpSettingHandler::AreImSettingsValid" ); |
|
1108 |
||
1109 |
const CSPProperty* property( NULL ); |
|
1110 |
TBool imFeatureEnabled = ( KErrNone == aEntry.GetProperty( |
|
1111 |
property, ESubPropertyIMLaunchUid ) ) && property; |
|
1112 |
if ( !imFeatureEnabled ) |
|
1113 |
{ |
|
1114 |
return EFalse; |
|
1115 |
} |
|
1116 |
||
1117 |
// Make sure that this is the correct plugin |
|
1118 |
TInt result = aEntry.GetProperty( property, |
|
1119 |
EPropertyIMSubServicePluginId ); |
|
1120 |
||
1121 |
if ( KErrNone == result && property ) |
|
1122 |
{ |
|
1123 |
TInt pluginId = 0; |
|
1124 |
property->GetValue( pluginId ); |
|
1125 |
||
1126 |
SCPLOGSTRING3( "IM Subservice plugin UID: 0x%x this 0x%x", |
|
1127 |
pluginId, KSIPConnectivityPluginImplUid ); |
|
1128 |
||
1129 |
if ( KSIPConnectivityPluginImplUid == pluginId ) |
|
1130 |
{ |
|
1131 |
return ETrue; |
|
1132 |
} |
|
1133 |
} |
|
1134 |
||
1135 |
return EFalse; |
|
1136 |
} |
|
1137 |
||
1138 |
// End of File |