1 /* |
|
2 * Copyright (c) 2002 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 the License "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 * Handles white list settings in provisioning. |
|
16 * |
|
17 */ |
|
18 |
|
19 |
|
20 // INCLUDE FILES |
|
21 // User includes |
|
22 #include "WhiteListAdapterItem.h" |
|
23 |
|
24 // CONSTANTS |
|
25 |
|
26 _LIT( KIPv4AddressType, "IPV4" ); |
|
27 _LIT( KIPv6AddressType, "IPV6" ); |
|
28 _LIT( KE164AddressType, "E164" ); |
|
29 _LIT( KAlphanumericAddressType, "ALPHA" ); |
|
30 |
|
31 // ================= MEMBER FUNCTIONS ====================== |
|
32 |
|
33 // --------------------------------------------------------- |
|
34 // TWhiteListAdapterItem::TWhiteListAdapterItem |
|
35 // --------------------------------------------------------- |
|
36 // |
|
37 TWhiteListAdapterItem::TWhiteListAdapterItem() |
|
38 : iAddress( KNullDesC ), |
|
39 iAddressType( CPushInitiator::ETypeE164 ), |
|
40 iId( 0 ), |
|
41 iIdBufPtr( iId ), |
|
42 iProxyId( KNullDesC ), |
|
43 iPushSupport( EPushDontCare ) |
|
44 { |
|
45 iAddressType = CPushInitiator::ETypeIpv4; |
|
46 iPushSupport = EPushDontCare; |
|
47 } |
|
48 |
|
49 // --------------------------------------------------------- |
|
50 // TWhiteListAdapterItem::Address |
|
51 // --------------------------------------------------------- |
|
52 // |
|
53 const TDesC& TWhiteListAdapterItem::Address() const |
|
54 { |
|
55 return iAddress; |
|
56 } |
|
57 |
|
58 // --------------------------------------------------------- |
|
59 // TWhiteListAdapterItem::AddressType |
|
60 // --------------------------------------------------------- |
|
61 // |
|
62 CPushInitiator::TAddrType TWhiteListAdapterItem::AddressType() const |
|
63 { |
|
64 return iAddressType; |
|
65 } |
|
66 |
|
67 // --------------------------------------------------------- |
|
68 // TWhiteListAdapterItem::Id |
|
69 // --------------------------------------------------------- |
|
70 // |
|
71 TUint32 TWhiteListAdapterItem::Id() const |
|
72 { |
|
73 return iId; |
|
74 } |
|
75 |
|
76 // --------------------------------------------------------- |
|
77 // TWhiteListAdapterItem::IdBuf |
|
78 // --------------------------------------------------------- |
|
79 // |
|
80 const TDesC8& TWhiteListAdapterItem::IdBuf() const |
|
81 { |
|
82 return iIdBufPtr; |
|
83 } |
|
84 |
|
85 // --------------------------------------------------------- |
|
86 // TWhiteListAdapterItem::PushSupport |
|
87 // --------------------------------------------------------- |
|
88 // |
|
89 TPushSupport TWhiteListAdapterItem::PushSupport() const |
|
90 { |
|
91 return iPushSupport; |
|
92 } |
|
93 |
|
94 // --------------------------------------------------------- |
|
95 // TWhiteListAdapterItem::SetAddress |
|
96 // --------------------------------------------------------- |
|
97 // |
|
98 void TWhiteListAdapterItem::SetAddress( const TDesC& aAddress ) |
|
99 { |
|
100 iAddress.Set( aAddress ); |
|
101 } |
|
102 |
|
103 // --------------------------------------------------------- |
|
104 // TWhiteListAdapterItem::SetAddressType |
|
105 // --------------------------------------------------------- |
|
106 // |
|
107 void TWhiteListAdapterItem::SetAddressType( const TDesC& aAddressType ) |
|
108 { |
|
109 if ( !aAddressType.Compare( KIPv4AddressType ) ) |
|
110 { |
|
111 iAddressType = CPushInitiator::ETypeIpv4; |
|
112 } |
|
113 else if ( !aAddressType.Compare( KIPv6AddressType ) ) |
|
114 { |
|
115 iAddressType = CPushInitiator::ETypeIpv6; |
|
116 } |
|
117 else if ( !aAddressType.Compare( KE164AddressType ) ) |
|
118 { |
|
119 iAddressType = CPushInitiator::ETypeE164; |
|
120 } |
|
121 else if ( !aAddressType.Compare( KAlphanumericAddressType ) ) |
|
122 { |
|
123 iAddressType = CPushInitiator::ETypeAlpha; |
|
124 } |
|
125 } |
|
126 |
|
127 // --------------------------------------------------------- |
|
128 // TWhiteListAdapterItem::SetId |
|
129 // --------------------------------------------------------- |
|
130 // |
|
131 void TWhiteListAdapterItem::SetId( TUint32 aId ) |
|
132 { |
|
133 iId = aId; |
|
134 } |
|
135 |
|
136 // --------------------------------------------------------- |
|
137 // TWhiteListAdapterItem::SetProxyId |
|
138 // --------------------------------------------------------- |
|
139 // |
|
140 void TWhiteListAdapterItem::SetProxyId( const TDesC& aProxyId ) |
|
141 { |
|
142 iProxyId.Set( aProxyId ); |
|
143 } |
|
144 |
|
145 // --------------------------------------------------------- |
|
146 // TWhiteListAdapterItem::SetPushSupport |
|
147 // --------------------------------------------------------- |
|
148 // |
|
149 void TWhiteListAdapterItem::SetPushSupport( TPushSupport aPushSupport ) |
|
150 { |
|
151 iPushSupport = aPushSupport; |
|
152 } |
|
153 |
|
154 // --------------------------------------------------------- |
|
155 // TWhiteListAdapterItem::Valid |
|
156 // --------------------------------------------------------- |
|
157 // |
|
158 TBool TWhiteListAdapterItem::Valid() const |
|
159 { |
|
160 TBool valid = EFalse; |
|
161 |
|
162 // TODO : checking IP address/phone number validity (MsgBioUtils?) |
|
163 |
|
164 if ( ( iPushSupport == EPushEnabled || iPushSupport == EPushDontCare ) && |
|
165 ( iAddressType == CPushInitiator::ETypeE164 ) && |
|
166 ( 0 < iAddress.Length() ) ) |
|
167 { |
|
168 valid = ETrue; |
|
169 } |
|
170 |
|
171 return valid; |
|
172 } |
|