|
1 // Copyright (c) 2003-2009 Nokia Corporation and/or its subsidiary(-ies). |
|
2 // All rights reserved. |
|
3 // This component and the accompanying materials are made available |
|
4 // under the terms of "Eclipse Public License v1.0" |
|
5 // which accompanies this distribution, and is available |
|
6 // at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
7 // |
|
8 // Initial Contributors: |
|
9 // Nokia Corporation - initial contribution. |
|
10 // |
|
11 // Contributors: |
|
12 // |
|
13 // Description: |
|
14 // Name : sipprofileregistrybase |
|
15 // Part of : SIP Profile Client |
|
16 // implementation |
|
17 // Version : 1.0 |
|
18 // INCLUDE FILES |
|
19 // |
|
20 |
|
21 |
|
22 |
|
23 #include "sip.h" |
|
24 #include "sipprofileregistrybase.h" |
|
25 #include "sipprofileregistryobserver.h" |
|
26 #include "sipprofileregistry.h" |
|
27 #include "sipprofileregistryobserver.h" |
|
28 #include "sipmanagedprofile.h" |
|
29 #include "SipProfileItem.h" |
|
30 #include "sipprofileplugins.h" |
|
31 #include "sipconcreteprofileholder.h" |
|
32 #include "SipProfileCleanupItem.h" |
|
33 #include "SIPProfileITC.h" |
|
34 #include "SIPProfileITCReceiver.h" |
|
35 #include "sipconnectionobserver.h" |
|
36 #include "SIPRemoteProfile.h" |
|
37 #include "sipprofilecs.h" |
|
38 |
|
39 // ============================ MEMBER FUNCTIONS =============================== |
|
40 |
|
41 // ----------------------------------------------------------------------------- |
|
42 // CSIPProfileRegistryBase::~CSIPProfileRegistryBase |
|
43 // ----------------------------------------------------------------------------- |
|
44 // |
|
45 EXPORT_C CSIPProfileRegistryBase::~CSIPProfileRegistryBase() |
|
46 { |
|
47 delete iProfilePlugins; |
|
48 iProfilePlugins = 0; |
|
49 |
|
50 delete iFindEntry; |
|
51 iFindEntry = 0; |
|
52 |
|
53 delete iITCReceiver; |
|
54 iITCReceiver = 0; |
|
55 |
|
56 delete iITC; |
|
57 iITC = 0; |
|
58 |
|
59 for (TInt i = 0; i < iProfiles.Count(); i++) |
|
60 { |
|
61 CSIPProfileItem* item = static_cast<CSIPProfileItem*>(iProfiles[i]); |
|
62 if (item->Profile()) |
|
63 { |
|
64 item->Profile()->ClearRegistry(); |
|
65 item->SetConcreteProfile(0); |
|
66 } |
|
67 } |
|
68 |
|
69 iProfiles.ResetAndDestroy(); |
|
70 iProfiles.Close(); |
|
71 |
|
72 if (iSipClient) |
|
73 { |
|
74 iSipClient->Close(); |
|
75 delete iSipClient; |
|
76 iSipClient = 0; |
|
77 } |
|
78 } |
|
79 |
|
80 // ----------------------------------------------------------------------------- |
|
81 // CSIPProfileRegistryBase::ProfilesL |
|
82 // ----------------------------------------------------------------------------- |
|
83 // |
|
84 EXPORT_C void CSIPProfileRegistryBase::ProfilesL( |
|
85 RPointerArray<CSIPProfile>& aProfiles) |
|
86 { |
|
87 CSIPConcreteProfileHolder* holder = iITC->SIPProfilesL(); |
|
88 |
|
89 ProfilesCommonL(aProfiles, holder); |
|
90 } |
|
91 |
|
92 // ----------------------------------------------------------------------------- |
|
93 // CSIPProfileRegistryBase::ProfilesL |
|
94 // ----------------------------------------------------------------------------- |
|
95 // |
|
96 EXPORT_C void CSIPProfileRegistryBase::ProfilesL( |
|
97 const TSIPProfileTypeInfo& aType, |
|
98 RPointerArray<CSIPProfile>& aProfiles) |
|
99 { |
|
100 CSIPConcreteProfileHolder* holder = iITC->SIPProfilesByTypeL(aType); |
|
101 |
|
102 ProfilesCommonL(aProfiles, holder); |
|
103 } |
|
104 |
|
105 // ----------------------------------------------------------------------------- |
|
106 // CSIPProfileRegistryBase::ProfilesL |
|
107 // ----------------------------------------------------------------------------- |
|
108 // |
|
109 EXPORT_C void CSIPProfileRegistryBase::ProfilesL( |
|
110 const TDesC8& aAOR, |
|
111 RPointerArray<CSIPProfile>& aProfiles) |
|
112 { |
|
113 CSIPConcreteProfileHolder* holder = iITC->SIPProfilesByAORL(aAOR); |
|
114 |
|
115 ProfilesCommonL(aProfiles, holder); |
|
116 } |
|
117 |
|
118 // ----------------------------------------------------------------------------- |
|
119 // CSIPProfileRegistryBase::ProfilesCommonL |
|
120 // ----------------------------------------------------------------------------- |
|
121 // |
|
122 void CSIPProfileRegistryBase::ProfilesCommonL( |
|
123 RPointerArray<CSIPProfile>& aProfiles, |
|
124 CSIPConcreteProfileHolder* aHolder) |
|
125 { |
|
126 RPointerArray<CSIPConcreteProfile>& profiles = aHolder->SIPProfiles(); |
|
127 |
|
128 CleanupStack::PushL(aHolder); |
|
129 |
|
130 StoreArrayL(profiles, aProfiles); |
|
131 |
|
132 CleanupStack::Pop(aHolder); |
|
133 delete aHolder; |
|
134 } |
|
135 |
|
136 // ----------------------------------------------------------------------------- |
|
137 // CSIPProfileRegistryBase::ProfileL |
|
138 // ----------------------------------------------------------------------------- |
|
139 // |
|
140 EXPORT_C CSIPProfile* CSIPProfileRegistryBase::ProfileL(TUint32 aId) |
|
141 { |
|
142 return SIPProfileL(aId); |
|
143 } |
|
144 |
|
145 // ----------------------------------------------------------------------------- |
|
146 // CSIPProfileRegistryBase::DefaultProfileL |
|
147 // ----------------------------------------------------------------------------- |
|
148 // |
|
149 EXPORT_C CSIPProfile* CSIPProfileRegistryBase::DefaultProfileL() |
|
150 { |
|
151 TUint32 profileId(0); |
|
152 TUint size(0); |
|
153 iITC->SIPProfileDefaultL(size, profileId); |
|
154 |
|
155 if (size == 0) |
|
156 { |
|
157 User::Leave(KErrNotFound); |
|
158 } |
|
159 |
|
160 return SIPProfileL(profileId, size); |
|
161 } |
|
162 |
|
163 // ----------------------------------------------------------------------------- |
|
164 // CSIPProfileRegistryBase::SupportedProfileTypesL |
|
165 // ----------------------------------------------------------------------------- |
|
166 // |
|
167 EXPORT_C void CSIPProfileRegistryBase::SupportedProfileTypesL( |
|
168 RArray<TSIPProfileTypeInfo>& aSupportedProfileTypes) |
|
169 { |
|
170 delete iProfilePlugins; |
|
171 iProfilePlugins = NULL; |
|
172 iProfilePlugins = iITC->SIPProfilePluginsL(); |
|
173 |
|
174 const RArray<TSIPProfileTypeInfo>& array = iProfilePlugins->Plugins(); |
|
175 for (TInt i = 0; i < array.Count(); i++) |
|
176 { |
|
177 User::LeaveIfError(aSupportedProfileTypes.Append(array[i])); |
|
178 } |
|
179 } |
|
180 |
|
181 // ----------------------------------------------------------------------------- |
|
182 // CSIPProfileRegistryBase::LastRegistrationError |
|
183 // ----------------------------------------------------------------------------- |
|
184 // |
|
185 EXPORT_C TInt CSIPProfileRegistryBase::LastRegistrationError( |
|
186 const CSIPProfile& aProfile) const |
|
187 { |
|
188 return aProfile.LastRegistrationError(); |
|
189 } |
|
190 |
|
191 // ----------------------------------------------------------------------------- |
|
192 // CSIPProfileRegistryBase::CSIPProfileRegistryBase |
|
193 // ----------------------------------------------------------------------------- |
|
194 // |
|
195 CSIPProfileRegistryBase::CSIPProfileRegistryBase( |
|
196 MSIPProfileRegistryObserver& aObserver): |
|
197 iObserver(aObserver) |
|
198 { |
|
199 |
|
200 } |
|
201 |
|
202 // ----------------------------------------------------------------------------- |
|
203 // CSIPProfileRegistryBase::ProfileDeleted |
|
204 // ----------------------------------------------------------------------------- |
|
205 // |
|
206 void CSIPProfileRegistryBase::ProfileDeleted(CSIPProfile& aProfile) |
|
207 { |
|
208 TUint32 profileId = 0; |
|
209 aProfile.GetParameter(KSIPProfileId, profileId); |
|
210 TInt index = ProfileIndex(profileId); |
|
211 if(index != KErrNotFound) |
|
212 { |
|
213 CSIPProfileItem* item = ProfileItemByIndex(index); |
|
214 item->DecrementReferenceCount((CSIPProfile&) aProfile); |
|
215 if (item->ReferenceCount() == 0) |
|
216 { |
|
217 iProfiles.Remove(index); |
|
218 delete item; |
|
219 // ignore any error |
|
220 TRAPD(err, iITC->DeleteSIPProfileL(aProfile.ConcreteProfile().Id())); |
|
221 //for get rid of armv5 warning |
|
222 err++; |
|
223 } |
|
224 else |
|
225 { |
|
226 aProfile.ClearConcreteProfile(); |
|
227 } |
|
228 } |
|
229 } |
|
230 |
|
231 // ----------------------------------------------------------------------------- |
|
232 // CSIPProfileRegistryBase::EnableProfileL |
|
233 // ----------------------------------------------------------------------------- |
|
234 // |
|
235 void CSIPProfileRegistryBase::EnableProfileL( |
|
236 CSIPProfile& aProfile) |
|
237 { |
|
238 CSIPProfileItem* item = ProfileItemL(aProfile.ConcreteProfile().Id()); |
|
239 TInt status = 0; |
|
240 TRAPD(err, status = iITC->EnableSIPProfileL(aProfile.ConcreteProfile().Id())); |
|
241 aProfile.ConcreteProfile().SetLastRegistrationError(err); |
|
242 User::LeaveIfError(err); |
|
243 item->SetEnabled(ETrue); |
|
244 aProfile.ConcreteProfile().SetStatus((enum CSIPConcreteProfile::TStatus) status); |
|
245 } |
|
246 |
|
247 // ----------------------------------------------------------------------------- |
|
248 // CSIPProfileRegistryBase::DisableProfileL |
|
249 // ----------------------------------------------------------------------------- |
|
250 // |
|
251 void CSIPProfileRegistryBase::DisableProfileL(CSIPProfile& aProfile) |
|
252 { |
|
253 CSIPProfileItem* item = ProfileItemL(aProfile.ConcreteProfile().Id()); |
|
254 item->SetEnabled(EFalse); |
|
255 TInt status = iITC->DisableSIPProfileL(aProfile.ConcreteProfile().Id()); |
|
256 aProfile.ConcreteProfile().SetStatus((enum CSIPConcreteProfile::TStatus) status); |
|
257 } |
|
258 |
|
259 // ----------------------------------------------------------------------------- |
|
260 // CSIPProfileRegistryBase::ForceDisableProfileL |
|
261 // ----------------------------------------------------------------------------- |
|
262 // |
|
263 void CSIPProfileRegistryBase::ForceDisableProfileL( |
|
264 CSIPProfile& aProfile) |
|
265 { |
|
266 CSIPProfileItem* item = ProfileItemL(aProfile.ConcreteProfile().Id()); |
|
267 item->SetEnabled(EFalse); |
|
268 TInt status = iITC->ForceDisableSIPProfileL(aProfile.ConcreteProfile().Id()); |
|
269 aProfile.ConcreteProfile().SetStatus((enum CSIPConcreteProfile::TStatus) status); |
|
270 } |
|
271 |
|
272 // ----------------------------------------------------------------------------- |
|
273 // CSIPProfileRegistryBase::UsageL |
|
274 // ----------------------------------------------------------------------------- |
|
275 // |
|
276 TInt CSIPProfileRegistryBase::UsageL(const CSIPProfile& aProfile) const |
|
277 { |
|
278 return iITC->SIPProfileUsageL(aProfile.ConcreteProfile().Id()); |
|
279 } |
|
280 |
|
281 // ----------------------------------------------------------------------------- |
|
282 // CSIPProfileRegistryBase::AddProfileL |
|
283 // ----------------------------------------------------------------------------- |
|
284 // |
|
285 void CSIPProfileRegistryBase::AddProfileL(CSIPProfile& aProfile) |
|
286 { |
|
287 CSIPProfileItem* item = CSIPProfileItem::NewL(); |
|
288 CleanupStack::PushL(item); |
|
289 item->IncrementReferenceCountL(aProfile); |
|
290 User::LeaveIfError(iProfiles.Append(item)); |
|
291 CleanupStack::Pop(item); |
|
292 |
|
293 TRAPD(err, iITC->AddSIPProfileL(aProfile.ConcreteProfile())); |
|
294 if (aProfile.ConcreteProfile().Id() != 0) |
|
295 { |
|
296 item->SetProfile(aProfile); |
|
297 } |
|
298 else |
|
299 { |
|
300 TBool found = EFalse; |
|
301 for (TInt i = 0; i < iProfiles.Count() && !found; i++) |
|
302 { |
|
303 if (iProfiles[i] == item) |
|
304 { |
|
305 iProfiles.Remove(i); |
|
306 delete item; |
|
307 found = ETrue; |
|
308 } |
|
309 } |
|
310 } |
|
311 User::LeaveIfError(err); |
|
312 } |
|
313 |
|
314 // ----------------------------------------------------------------------------- |
|
315 // CSIPProfileRegistryBase::UpdateProfileL |
|
316 // ----------------------------------------------------------------------------- |
|
317 // |
|
318 void CSIPProfileRegistryBase::UpdateProfileL(CSIPProfile& aProfile) |
|
319 { |
|
320 iITC->UpdateSIPProfileL(aProfile.ConcreteProfile()); |
|
321 } |
|
322 |
|
323 // ----------------------------------------------------------------------------- |
|
324 // CSIPProfileRegistryBase::RemoveProfileL |
|
325 // ----------------------------------------------------------------------------- |
|
326 // |
|
327 void CSIPProfileRegistryBase::RemoveProfileL(CSIPProfile& aProfile) |
|
328 { |
|
329 iITC->RemoveSIPProfileL(aProfile.ConcreteProfile().Id()); |
|
330 } |
|
331 |
|
332 // ----------------------------------------------------------------------------- |
|
333 // CSIPProfileRegistryBase::IsDefaultProfileL |
|
334 // ----------------------------------------------------------------------------- |
|
335 // |
|
336 TBool CSIPProfileRegistryBase::IsDefaultProfileL(const CSIPProfile& aProfile) |
|
337 { |
|
338 TUint32 profileId = iITC->SIPProfileDefaultIdL(); |
|
339 return (aProfile.ConcreteProfile().Id() == profileId); |
|
340 } |
|
341 |
|
342 // ----------------------------------------------------------------------------- |
|
343 // CSIPProfileRegistryBase::RegistrationStatusChangedL |
|
344 // ----------------------------------------------------------------------------- |
|
345 // |
|
346 void CSIPProfileRegistryBase::NegotiatedSecurityMechanismL( |
|
347 CSIPConcreteProfile& aProfile) |
|
348 { |
|
349 iITC->NegotiatedSecurityMechanismL(aProfile); |
|
350 } |
|
351 |
|
352 // ----------------------------------------------------------------------------- |
|
353 // CSIPProfileRegistryBase::RegisteredAORsL |
|
354 // ----------------------------------------------------------------------------- |
|
355 // |
|
356 void CSIPProfileRegistryBase::RegisteredAORsL(CSIPConcreteProfile& aProfile) |
|
357 { |
|
358 iITC->RegisteredAORsL(aProfile); |
|
359 } |
|
360 |
|
361 // ----------------------------------------------------------------------------- |
|
362 // CSIPProfileRegistryBase::SIPProfileL |
|
363 // ----------------------------------------------------------------------------- |
|
364 // |
|
365 CSIPProfile* CSIPProfileRegistryBase::SIPProfileL(TUint32 aId, TInt aSize) |
|
366 { |
|
367 __ASSERT_ALWAYS (aId > 0, User::Leave (KErrArgument)); |
|
368 TInt index = ProfileIndex(aId); |
|
369 if(index == KErrNotFound) |
|
370 { |
|
371 CSIPProfileCleanupItem* cleanupItem = new (ELeave) CSIPProfileCleanupItem(iITC); |
|
372 CleanupStack::PushL(cleanupItem); |
|
373 CleanupStack::PushL(TCleanupItem(CrashRevert, cleanupItem)); |
|
374 |
|
375 cleanupItem->iProfileId = aId; |
|
376 cleanupItem->iConcreteProfile = iITC->SIPProfileL(aId, aSize); |
|
377 |
|
378 CSIPProfile* managed = 0; |
|
379 if (cleanupItem->iConcreteProfile != 0) |
|
380 { |
|
381 StoreProfileL(cleanupItem); |
|
382 managed = cleanupItem->iManagedProfile; |
|
383 } |
|
384 |
|
385 CleanupStack::Pop(); |
|
386 CleanupStack::PopAndDestroy(cleanupItem); |
|
387 return managed; |
|
388 } |
|
389 else |
|
390 { |
|
391 CSIPProfileItem* item = ProfileItemL(aId); |
|
392 CSIPProfile* managed = NewInstanceL(); |
|
393 CleanupStack::PushL(managed); |
|
394 managed->SetConcreteProfile(&(item->ConcreteProfile())); |
|
395 managed->SetEnabled(item->IsEnabled()); |
|
396 item->IncrementReferenceCountL(*managed); |
|
397 CleanupStack::Pop(managed); |
|
398 return managed; |
|
399 } |
|
400 } |
|
401 |
|
402 // ----------------------------------------------------------------------------- |
|
403 // CSIPProfileRegistryBase::StoreProfileL |
|
404 // ----------------------------------------------------------------------------- |
|
405 // |
|
406 void CSIPProfileRegistryBase::StoreProfileL(CSIPProfileCleanupItem* aCleanupItem) |
|
407 { |
|
408 CSIPProfile* managed = NewInstanceL(); |
|
409 aCleanupItem->iManagedProfile = managed; |
|
410 managed->SetConcreteProfile(aCleanupItem->iConcreteProfile); |
|
411 |
|
412 CSIPProfileItem* item = CSIPProfileItem::NewL(); |
|
413 item->SetProfile(*managed); |
|
414 |
|
415 CleanupStack::PushL(item); |
|
416 User::LeaveIfError(iProfiles.Append(item)); |
|
417 CleanupStack::Pop(item); |
|
418 |
|
419 item->IncrementReferenceCountL(*managed); |
|
420 aCleanupItem->iStored = ETrue; |
|
421 } |
|
422 |
|
423 // ----------------------------------------------------------------------------- |
|
424 // CSIPProfileRegistryBase::StoreProfileL |
|
425 // ----------------------------------------------------------------------------- |
|
426 // |
|
427 void CSIPProfileRegistryBase::StoreArrayL( |
|
428 RPointerArray<CSIPConcreteProfile>& aProfiles, |
|
429 RPointerArray<CSIPProfile>& aRetProfiles) |
|
430 { |
|
431 int count = aProfiles.Count(); |
|
432 |
|
433 for (TInt i = 0; i < count; i++) |
|
434 { |
|
435 TUint profileId = (aProfiles[0])->Id(); |
|
436 TInt index = ProfileIndex(profileId); |
|
437 |
|
438 CSIPProfileCleanupItem* cleanupItem = new (ELeave) CSIPProfileCleanupItem(iITC); |
|
439 CleanupStack::PushL(cleanupItem); |
|
440 |
|
441 if(index == KErrNotFound) |
|
442 { |
|
443 CleanupStack::PushL(TCleanupItem(CrashRevert, cleanupItem)); |
|
444 |
|
445 cleanupItem->iProfileId = (aProfiles[0])->Id(); |
|
446 cleanupItem->iConcreteProfile = aProfiles[0]; |
|
447 aProfiles.Remove(0); |
|
448 |
|
449 StoreProfileL(cleanupItem); |
|
450 User::LeaveIfError(aRetProfiles.Append(cleanupItem->iManagedProfile)); |
|
451 } |
|
452 else |
|
453 { |
|
454 CleanupStack::PushL(TCleanupItem(LocalCrashRevert, cleanupItem)); |
|
455 |
|
456 CSIPProfileItem* item = ProfileItemL(profileId); |
|
457 CSIPProfile* managed = NewInstanceL(); |
|
458 cleanupItem->iManagedProfile = managed; |
|
459 managed->SetConcreteProfile(&(item->ConcreteProfile())); |
|
460 managed->SetEnabled(item->IsEnabled()); |
|
461 item->IncrementReferenceCountL(*managed); |
|
462 User::LeaveIfError(aRetProfiles.Append(managed)); |
|
463 CSIPConcreteProfile* profileNotUsed = aProfiles[0]; |
|
464 aProfiles.Remove(0); |
|
465 delete profileNotUsed; |
|
466 } |
|
467 } |
|
468 aProfiles.Reset(); |
|
469 |
|
470 for (TInt j = 0; j < count; j++) |
|
471 { |
|
472 CleanupStack::Pop(); //TCleanupItem |
|
473 CleanupStack::PopAndDestroy(); //cleanupItem |
|
474 } |
|
475 } |
|
476 |
|
477 // ----------------------------------------------------------------------------- |
|
478 // CSIPProfileRegistryBase::ProfileItemL |
|
479 // ----------------------------------------------------------------------------- |
|
480 // |
|
481 CSIPProfileItem* CSIPProfileRegistryBase::ProfileItemL(TUint aProfileId) |
|
482 { |
|
483 TInt index = ProfileIndex (aProfileId); |
|
484 __ASSERT_ALWAYS (index != KErrNotFound, User::Leave (KErrNotFound)); |
|
485 return ProfileItemByIndex(index); |
|
486 } |
|
487 |
|
488 // ----------------------------------------------------------------------------- |
|
489 // CSIPProfileRegistryBase::ProfileIndex |
|
490 // ----------------------------------------------------------------------------- |
|
491 // |
|
492 TInt CSIPProfileRegistryBase::ProfileIndex (TUint aProfileId) |
|
493 { |
|
494 TIdentityRelation<CSIPProfileItem> compareId(CSIPProfileItem::Compare); |
|
495 iFindEntry->SetProfileId(aProfileId); |
|
496 TInt index = iProfiles.Find(iFindEntry, compareId); |
|
497 return index; |
|
498 } |
|
499 |
|
500 // ----------------------------------------------------------------------------- |
|
501 // CSIPProfileRegistryBase::ProfileItemByIndex |
|
502 // ----------------------------------------------------------------------------- |
|
503 // |
|
504 CSIPProfileItem* CSIPProfileRegistryBase::ProfileItemByIndex(TUint aIndex) |
|
505 { |
|
506 return static_cast<CSIPProfileItem*>(iProfiles[aIndex]); |
|
507 } |
|
508 |
|
509 // ----------------------------------------------------------------------------- |
|
510 // CSIPProfileRegistryBase::RegistrationStatusChangedL |
|
511 // ----------------------------------------------------------------------------- |
|
512 // |
|
513 void CSIPProfileRegistryBase::RegistrationStatusChangedL(TUint32 aProfileId, |
|
514 TInt aStatus, |
|
515 TUint32 aStatusId) |
|
516 { |
|
517 TInt index = ProfileIndex(aProfileId); |
|
518 if(index != KErrNotFound) |
|
519 { |
|
520 CSIPProfileItem* item = ProfileItemByIndex(index); |
|
521 // The concrete profile has to be fetched to get the registered Contact |
|
522 CSIPConcreteProfile* updatedProfile = |
|
523 iITC->SIPProfileRefreshL(aProfileId); |
|
524 updatedProfile->SetStatus((CSIPConcreteProfile::TStatus) aStatus); |
|
525 updatedProfile->SetContextId(aStatusId); |
|
526 item->SetConcreteProfile(updatedProfile); |
|
527 if (aStatus == CSIPConcreteProfile::ERegistered) |
|
528 { |
|
529 iObserver.ProfileRegistryEventOccurred(aProfileId, |
|
530 MSIPProfileRegistryObserver::EProfileRegistered); |
|
531 } |
|
532 else |
|
533 { |
|
534 if (aStatusId == ESipProfileItcOpProfileForciblyDisabled) |
|
535 iObserver.ProfileRegistryEventOccurred(aProfileId, |
|
536 MSIPProfileRegistryObserver::EProfileForciblyDisabled); |
|
537 else |
|
538 iObserver.ProfileRegistryEventOccurred(aProfileId, |
|
539 MSIPProfileRegistryObserver::EProfileDeregistered); |
|
540 } |
|
541 } |
|
542 } |
|
543 |
|
544 // ----------------------------------------------------------------------------- |
|
545 // CSIPProfileRegistryBase::UpdatedL |
|
546 // ----------------------------------------------------------------------------- |
|
547 // |
|
548 void CSIPProfileRegistryBase::UpdatedL(TUint32 aProfileId, TUint aSize) |
|
549 { |
|
550 TInt index = ProfileIndex(aProfileId); |
|
551 if(index != KErrNotFound) |
|
552 { |
|
553 CSIPConcreteProfile* concrete = 0; |
|
554 CSIPProfileItem* item = ProfileItemByIndex(index); |
|
555 TRAPD(err, concrete = iITC->SIPProfileRefreshL(aProfileId, aSize)); |
|
556 if (err == KErrNone) |
|
557 { |
|
558 item->SetConcreteProfile(concrete); |
|
559 iObserver.ProfileRegistryEventOccurred(aProfileId, |
|
560 MSIPProfileRegistryObserver::EProfileUpdated); |
|
561 } |
|
562 #ifdef CPPUNIT_TEST |
|
563 if (err == KErrNoMemory) User::Leave(KErrNoMemory); |
|
564 #endif |
|
565 } |
|
566 } |
|
567 |
|
568 // ----------------------------------------------------------------------------- |
|
569 // CSIPProfileRegistryBase::AddedL |
|
570 // ----------------------------------------------------------------------------- |
|
571 // |
|
572 void CSIPProfileRegistryBase::AddedL(TUint32 aProfileId) |
|
573 { |
|
574 iObserver.ProfileRegistryEventOccurred(aProfileId, |
|
575 MSIPProfileRegistryObserver::EProfileCreated); |
|
576 } |
|
577 |
|
578 // ----------------------------------------------------------------------------- |
|
579 // CSIPProfileRegistryBase::RemovedL |
|
580 // ----------------------------------------------------------------------------- |
|
581 // |
|
582 void CSIPProfileRegistryBase::RemovedL(TUint32 aProfileId) |
|
583 { |
|
584 TInt index = ProfileIndex(aProfileId); |
|
585 if(index != KErrNotFound) |
|
586 { |
|
587 iObserver.ProfileRegistryEventOccurred(aProfileId, |
|
588 MSIPProfileRegistryObserver::EProfileDestroyed); |
|
589 } |
|
590 } |
|
591 |
|
592 // ----------------------------------------------------------------------------- |
|
593 // CSIPProfileRegistryBase::ErrorOccurredL |
|
594 // ----------------------------------------------------------------------------- |
|
595 // |
|
596 void CSIPProfileRegistryBase::ErrorOccurredL(TUint32 aProfileId, |
|
597 TInt aStatus, |
|
598 TInt aError) |
|
599 { |
|
600 TInt index = ProfileIndex(aProfileId); |
|
601 if(index != KErrNotFound) |
|
602 { |
|
603 CSIPProfileItem* item = ProfileItemByIndex(index); |
|
604 item->ErrorOccurred((CSIPConcreteProfile::TStatus) aStatus, aError); |
|
605 iObserver.ProfileRegistryErrorOccurred(aProfileId, aError); |
|
606 } |
|
607 } |
|
608 |
|
609 // ----------------------------------------------------------------------------- |
|
610 // CSIPProfileRegistryBase::BaseConstructL |
|
611 // ----------------------------------------------------------------------------- |
|
612 // |
|
613 void CSIPProfileRegistryBase::BaseConstructL() |
|
614 { |
|
615 iFindEntry = CSIPProfileItem::NewL(); |
|
616 |
|
617 iSipClient = new (ELeave) RSIPProfile; |
|
618 User::LeaveIfError(iSipClient->Connect()); |
|
619 |
|
620 iITCReceiver = CSIPProfileITCReceiver::NewL (*iSipClient, *this); |
|
621 iITC = CSIPProfileITC::NewL (*iSipClient); |
|
622 |
|
623 } |
|
624 |
|
625 // ----------------------------------------------------------------------------- |
|
626 // CSIPProfileRegistryBase::CrashRevert |
|
627 // ----------------------------------------------------------------------------- |
|
628 // |
|
629 void CSIPProfileRegistryBase::CrashRevert (TAny* aItem) |
|
630 { |
|
631 CSIPProfileCleanupItem* cleanupItem = static_cast<CSIPProfileCleanupItem*>(aItem); |
|
632 TRAPD(err, cleanupItem->CrashRevertL()); |
|
633 //for get rid of armv5 warning |
|
634 err++; |
|
635 } |
|
636 |
|
637 // ----------------------------------------------------------------------------- |
|
638 // CSIPProfileRegistryBase::LocalCrashRevert |
|
639 // ----------------------------------------------------------------------------- |
|
640 // |
|
641 void CSIPProfileRegistryBase::LocalCrashRevert (TAny* aItem) |
|
642 { |
|
643 CSIPProfileCleanupItem* cleanupItem = static_cast<CSIPProfileCleanupItem*>(aItem); |
|
644 |
|
645 delete cleanupItem->iManagedProfile; |
|
646 cleanupItem->iManagedProfile = 0; |
|
647 } |
|
648 |
|
649 // ----------------------------------------------------------------------------- |
|
650 // CSIPProfileRegistryBase::Itc |
|
651 // ----------------------------------------------------------------------------- |
|
652 // |
|
653 CSIPProfileITC& CSIPProfileRegistryBase::Itc() |
|
654 { |
|
655 return *iITC; |
|
656 } |
|
657 |
|
658 // ----------------------------------------------------------------------------- |
|
659 // CSIPProfileRegistryBase::ItcReceiver |
|
660 // ----------------------------------------------------------------------------- |
|
661 // |
|
662 CSIPProfileITCReceiver& CSIPProfileRegistryBase::ItcReceiver() |
|
663 { |
|
664 return *iITCReceiver; |
|
665 } |
|
666 |