|
1 // Copyright (c) 2007-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 : sipclientresolverconfig.cpp |
|
15 // Part of : SIP / SIP Client Resolver |
|
16 // Version : SIP/6.0 |
|
17 // |
|
18 |
|
19 |
|
20 |
|
21 #include "sipclientresolverconfig.h" |
|
22 #include "sipclientresolverconfigcrkeys.h" |
|
23 |
|
24 |
|
25 // ----------------------------------------------------------------------------- |
|
26 // CSipClientResolverConfig::NewL |
|
27 // ----------------------------------------------------------------------------- |
|
28 // |
|
29 CSipClientResolverConfig* CSipClientResolverConfig::NewL() |
|
30 { |
|
31 CSipClientResolverConfig* self = CSipClientResolverConfig::NewLC(); |
|
32 CleanupStack::Pop(self); |
|
33 return self; |
|
34 } |
|
35 |
|
36 // ----------------------------------------------------------------------------- |
|
37 // CSipClientResolverConfig::NewLC |
|
38 // ----------------------------------------------------------------------------- |
|
39 // |
|
40 CSipClientResolverConfig* CSipClientResolverConfig::NewLC() |
|
41 { |
|
42 CSipClientResolverConfig* self = new(ELeave)CSipClientResolverConfig(); |
|
43 CleanupStack::PushL(self); |
|
44 self->ConstructL(); |
|
45 return self; |
|
46 } |
|
47 |
|
48 // ----------------------------------------------------------------------------- |
|
49 // CSipClientResolverConfig::CSipClientResolverConfig |
|
50 // ----------------------------------------------------------------------------- |
|
51 // |
|
52 CSipClientResolverConfig::CSipClientResolverConfig() |
|
53 { |
|
54 } |
|
55 |
|
56 // ----------------------------------------------------------------------------- |
|
57 // CSipClientResolverConfig::ConstructL |
|
58 // ----------------------------------------------------------------------------- |
|
59 // |
|
60 void CSipClientResolverConfig::ConstructL() |
|
61 { |
|
62 iCenRep = CRepository::NewL(KCRUidSIPClientResolverConfig); |
|
63 } |
|
64 |
|
65 // ----------------------------------------------------------------------------- |
|
66 // CSipClientResolverConfig::~CSipClientResolverConfig |
|
67 // ----------------------------------------------------------------------------- |
|
68 // |
|
69 CSipClientResolverConfig::~CSipClientResolverConfig() |
|
70 { |
|
71 delete iCenRep; |
|
72 } |
|
73 |
|
74 // ----------------------------------------------------------------------------- |
|
75 // CSipClientResolverConfig::GetUIDsForUserNameL |
|
76 // ----------------------------------------------------------------------------- |
|
77 // |
|
78 void CSipClientResolverConfig::GetUIDsForUserNameL( |
|
79 const TDesC8& aUserName, |
|
80 RArray<TUid>& aUids) |
|
81 { |
|
82 RArray<TUint32> keys; |
|
83 CleanupClosePushL(keys); |
|
84 TInt err = iCenRep->FindEqL(KSIPClientResolverUserNameMask, |
|
85 KSIPClientResolverFieldTypeMask, |
|
86 aUserName, |
|
87 keys); |
|
88 |
|
89 for (TInt i=0; !err && i < keys.Count(); i++) |
|
90 { |
|
91 TUint32 key = (KSIPClientResolverUserNameMask^(keys[i])); |
|
92 // Read the related plug-in UID |
|
93 TUint32 uidKey = KSIPClientResolverPluginUIDMask|key; |
|
94 TInt uidValue(0); |
|
95 User::LeaveIfError(iCenRep->Get(uidKey,uidValue)); |
|
96 TUid uid; |
|
97 uid.iUid = uidValue; |
|
98 // Duplicate plug-in UIDs not added, but are allowed |
|
99 err = aUids.InsertInUnsignedKeyOrder(uid); |
|
100 if (err != KErrNone && err != KErrAlreadyExists) |
|
101 { |
|
102 User::Leave(err); |
|
103 } |
|
104 err = KErrNone; |
|
105 } |
|
106 |
|
107 CleanupStack::PopAndDestroy(&keys); |
|
108 } |