1 /* |
|
2 * s_presencebuddyinfo2.cpp : Copyright (c) 2009 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: s_presencebuddyinfo2.cpp |
|
15 * |
|
16 */ |
|
17 #include "s_presencebuddyinfo2.h" |
|
18 #include <avabilitytext.h> |
|
19 |
|
20 #define KAvailability _L("online"); |
|
21 #define KMsg _L("hello"); |
|
22 #define KBuddyId _L("gizmo:Sharath"); |
|
23 #define KAvatar _L8("gshhshshhshshhsjskssiisisisisiisks"); |
|
24 |
|
25 //------------------------------------------------------------ |
|
26 // MPresenceBuddyInfo2Stub::NewStubL |
|
27 //------------------------------------------------------------ |
|
28 MPresenceBuddyInfo2Stub* MPresenceBuddyInfo2Stub:: NewStubL() |
|
29 { |
|
30 |
|
31 return new(ELeave) MPresenceBuddyInfo2Stub; |
|
32 } |
|
33 |
|
34 //------------------------------------------------------------ |
|
35 // MPresenceBuddyInfo2Stub::BuddyId |
|
36 //------------------------------------------------------------ |
|
37 TPtrC MPresenceBuddyInfo2Stub::BuddyId( ) const |
|
38 { |
|
39 return KBuddyId; |
|
40 } |
|
41 //------------------------------------------------------------ |
|
42 // MPresenceBuddyInfo2Stub::Availability |
|
43 //------------------------------------------------------------ |
|
44 MPresenceBuddyInfo2::TAvailabilityValues MPresenceBuddyInfo2Stub::Availability( ) |
|
45 { |
|
46 return EUnknownAvailability; |
|
47 } |
|
48 //------------------------------------------------------------ |
|
49 // MPresenceBuddyInfo2Stub::AvailabilityText |
|
50 //------------------------------------------------------------ |
|
51 TPtrC MPresenceBuddyInfo2Stub::AvailabilityText( ) |
|
52 { |
|
53 return KAvailability; |
|
54 } |
|
55 //------------------------------------------------------------ |
|
56 // MPresenceBuddyInfo2Stub::Avatar |
|
57 //------------------------------------------------------------ |
|
58 TPtrC8 MPresenceBuddyInfo2Stub::Avatar( ) |
|
59 { |
|
60 return KAvatar; |
|
61 } |
|
62 //------------------------------------------------------------ |
|
63 // MPresenceBuddyInfo2Stub::NewStubL |
|
64 //------------------------------------------------------------ |
|
65 TPtrC MPresenceBuddyInfo2Stub::StatusMessage( ) |
|
66 { |
|
67 return KMsg; |
|
68 } |
|
69 //------------------------------------------------------------ |
|
70 // MPresenceBuddyInfo2Stub::SetIdentityL |
|
71 //------------------------------------------------------------ |
|
72 void MPresenceBuddyInfo2Stub::SetIdentityL( const TDesC& /*aBuddyId*/ ) |
|
73 { |
|
74 |
|
75 } |
|
76 //------------------------------------------------------------ |
|
77 // MPresenceBuddyInfo2Stub::SetAvailabilityL |
|
78 //------------------------------------------------------------ |
|
79 void MPresenceBuddyInfo2Stub::SetAvailabilityL( |
|
80 MPresenceBuddyInfo2::TAvailabilityValues /*aAvailability*/, |
|
81 const TDesC& /*aAvailabilityText*/ ) |
|
82 { |
|
83 |
|
84 } |
|
85 |
|
86 |
|
87 //------------------------------------------------------------ |
|
88 // MPresenceBuddyInfo2Stub::SetAvatarL |
|
89 //------------------------------------------------------------ |
|
90 void MPresenceBuddyInfo2Stub::SetAvatarL( const TDesC8& /*aAvatar*/ ) |
|
91 { |
|
92 |
|
93 } |
|
94 |
|
95 //------------------------------------------------------------ |
|
96 // MPresenceBuddyInfo2Stub::NewStubL |
|
97 //------------------------------------------------------------ |
|
98 void MPresenceBuddyInfo2Stub::SetStatusMessageL( |
|
99 const TDesC& /*aStatusMessage*/ ) |
|
100 { |
|
101 |
|
102 } |
|
103 |
|
104 //------------------------------------------------------------ |
|
105 // MPresenceBuddyInfo2Stub::SetAnyFieldL |
|
106 //------------------------------------------------------------ |
|
107 void MPresenceBuddyInfo2Stub::SetAnyFieldL( |
|
108 const TDesC16& aKey, |
|
109 const TDesC8& aValue ) |
|
110 { |
|
111 HBufC8* valueBuffer = aValue.AllocLC(); |
|
112 HBufC* keyBuffer = aKey.AllocLC(); |
|
113 |
|
114 TInt insertPos = iIds.Find(0); |
|
115 if ( insertPos < 0 ) |
|
116 { |
|
117 insertPos = iIds.Count(); |
|
118 iIds.Append( keyBuffer ); |
|
119 iValues.Append( valueBuffer ); |
|
120 } |
|
121 else |
|
122 { |
|
123 iIds[insertPos] = keyBuffer; |
|
124 iValues[insertPos] = valueBuffer; |
|
125 } |
|
126 CleanupStack::Pop( keyBuffer ); |
|
127 CleanupStack::Pop( valueBuffer ); |
|
128 } |
|
129 //------------------------------------------------------------ |
|
130 // MPresenceBuddyInfo2Stub::NewStubL |
|
131 //------------------------------------------------------------ |
|
132 TPtrC8 MPresenceBuddyInfo2Stub::GetAnyField( |
|
133 const TDesC16& aKey ) |
|
134 { |
|
135 HBufC* key = aKey.AllocLC(); |
|
136 HBufC8* val = NULL; |
|
137 TInt count = iIds.Count(); |
|
138 for(TInt i = 0; i < count; i++) |
|
139 { |
|
140 if(iIds[i]->Des().Compare(KExtensionKey) == 0) |
|
141 { |
|
142 val = iValues[i]; |
|
143 break; |
|
144 } |
|
145 } |
|
146 CleanupStack::PopAndDestroy(key); |
|
147 // since there is no destructor for this test class, the member variable are destroyed here. |
|
148 // as they are not needed any further, if these member variables are required further then appropriate destructor |
|
149 // should be added. |
|
150 // iIds.ResetAndDestroy(); |
|
151 // iIds.Close(); |
|
152 // iValues.ResetAndDestroy(); |
|
153 // iValues.Close(); |
|
154 return val ? val->Des() : TPtrC8(); |
|
155 |
|
156 } |
|
157 //------------------------------------------------------------ |
|
158 // MPresenceBuddyInfo2Stub::NewStubL |
|
159 //------------------------------------------------------------ |
|
160 void MPresenceBuddyInfo2Stub::GetFieldKeysL( |
|
161 CDesCArrayFlat& aKeys ) |
|
162 { |
|
163 aKeys.Reset(); |
|
164 aKeys.AppendL(KExtensionKey ); |
|
165 |
|
166 } |
|
167 //------------------------------------------------------------ |
|
168 // MPresenceBuddyInfo2Stub::NewStubL |
|
169 //------------------------------------------------------------ |
|
170 void MPresenceBuddyInfo2Stub::RemoveField(const TDesC& /*aKey*/ ) |
|
171 { |
|
172 |
|
173 } |
|
174 //------------------------------------------------------------ |
|
175 // MPresenceBuddyInfo2Stub::NewStubL |
|
176 //------------------------------------------------------------ |
|
177 TBool MPresenceBuddyInfo2Stub::EqualsIdentity( |
|
178 const MPresenceBuddyInfo2& /*aOtherInstance*/ ) const |
|
179 { |
|
180 return ETrue; |
|
181 } |
|
182 //------------------------------------------------------------ |
|
183 // MPresenceBuddyInfo2Stub::NewStubL |
|
184 //------------------------------------------------------------ |
|
185 void MPresenceBuddyInfo2Stub::ExternalizeL( RWriteStream& /*aStream*/ ) const |
|
186 { |
|
187 |
|
188 } |
|
189 //------------------------------------------------------------ |
|
190 // MPresenceBuddyInfo2Stub::NewStubL |
|
191 //------------------------------------------------------------ |
|
192 void MPresenceBuddyInfo2Stub::InternalizeL( RReadStream& /*aStream*/ ) |
|
193 { |
|
194 |
|
195 } |
|
196 |
|
197 |
|
198 |
|
199 |
|