|
1 /* |
|
2 * Copyright (c) 2006, 2007 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: Implementation of MPresenceWatching |
|
15 * |
|
16 */ |
|
17 |
|
18 #include "presencewatchingimp.h" |
|
19 #include "presenceinfofilterimp.h" |
|
20 #include "ximpobjecthelpers.h" |
|
21 #include "presenceoperationdefs.h" |
|
22 #include "ximpidentityimp.h" |
|
23 #include "ximpcontextinternal.h" |
|
24 |
|
25 |
|
26 // ============================ MEMBER FUNCTIONS ============================= |
|
27 |
|
28 // --------------------------------------------------------------------------- |
|
29 // CPresenceWatchingImp::NewL() |
|
30 // --------------------------------------------------------------------------- |
|
31 // |
|
32 CPresenceWatchingImp* CPresenceWatchingImp::NewL( |
|
33 MXIMPContextInternal& aContext ) |
|
34 { |
|
35 CPresenceWatchingImp* self = |
|
36 new( ELeave ) CPresenceWatchingImp( aContext ); |
|
37 |
|
38 return self; |
|
39 } |
|
40 |
|
41 // --------------------------------------------------------------------------- |
|
42 // Implement supported interface access. |
|
43 // --------------------------------------------------------------------------- |
|
44 // |
|
45 XIMPIMP_IF_BASE_GET_INTERFACE_BEGIN( CPresenceWatchingImp, |
|
46 MPresenceWatching ) |
|
47 XIMPIMP_IF_BASE_GET_INTERFACE_END() |
|
48 |
|
49 |
|
50 XIMPIMP_IF_BASE_GET_CONST_INTERFACE_BEGIN( CPresenceWatchingImp, |
|
51 MPresenceWatching ) |
|
52 XIMPIMP_IF_BASE_GET_INTERFACE_END() |
|
53 |
|
54 |
|
55 // --------------------------------------------------------------------------- |
|
56 // CPresenceWatchingImp::~CPresenceWatchingImp() |
|
57 // --------------------------------------------------------------------------- |
|
58 // |
|
59 CPresenceWatchingImp::~CPresenceWatchingImp() |
|
60 { |
|
61 //iContext not own |
|
62 } |
|
63 |
|
64 |
|
65 // --------------------------------------------------------------------------- |
|
66 // CPresenceWatchingImp::CPresenceWatchingImp() |
|
67 // --------------------------------------------------------------------------- |
|
68 // |
|
69 CPresenceWatchingImp::CPresenceWatchingImp( |
|
70 MXIMPContextInternal& aContext ) |
|
71 : iContext( aContext ) |
|
72 { |
|
73 } |
|
74 |
|
75 |
|
76 // --------------------------------------------------------------------------- |
|
77 // CPresenceWatchingImp::SubscribePresentityPresenceL() |
|
78 // --------------------------------------------------------------------------- |
|
79 // |
|
80 TXIMPRequestId CPresenceWatchingImp::SubscribePresentityPresenceL( |
|
81 const MXIMPIdentity& aPresentityId, |
|
82 const MPresenceInfoFilter& aPif ) |
|
83 { |
|
84 RXIMPObjOwningPtrArray< HBufC8 > packArray; |
|
85 CleanupClosePushL( packArray ); |
|
86 |
|
87 // Pack the identity |
|
88 HBufC8* idPack = PackPresentityLC( aPresentityId ); |
|
89 packArray.Append( idPack ); |
|
90 CleanupStack::Pop( idPack ); |
|
91 |
|
92 // pack the filter |
|
93 HBufC8* filterPack = PackFilterLC( aPif ); |
|
94 packArray.Append( filterPack ); |
|
95 CleanupStack::Pop( filterPack ); |
|
96 |
|
97 // pack the array to a string |
|
98 HBufC8* packedBuf = TXIMPHBuf8Packer::PackArrayL( packArray ); |
|
99 CleanupStack::PushL( packedBuf ); |
|
100 |
|
101 // Queue the operation |
|
102 TXIMPRequestId reqId = |
|
103 iContext.QueueOperationL( NPresenceOps::EPrSubscribePresentityPresence, |
|
104 *packedBuf ); |
|
105 |
|
106 CleanupStack::PopAndDestroy( packedBuf ); |
|
107 CleanupStack::PopAndDestroy(); // packArray |
|
108 |
|
109 return reqId; |
|
110 } |
|
111 |
|
112 |
|
113 // --------------------------------------------------------------------------- |
|
114 // CPresenceWatchingImp::UnsubscribePresentityPresenceL() |
|
115 // --------------------------------------------------------------------------- |
|
116 // |
|
117 TXIMPRequestId CPresenceWatchingImp::UnsubscribePresentityPresenceL( |
|
118 const MXIMPIdentity& aPresentityId ) |
|
119 { |
|
120 // Pack the identity |
|
121 HBufC8* idPack = PackPresentityLC( aPresentityId ); |
|
122 // Queue the operation |
|
123 TXIMPRequestId reqId = |
|
124 iContext.QueueOperationL( NPresenceOps::EPrUnsubscribePresentityPresence, |
|
125 *idPack ); |
|
126 CleanupStack::PopAndDestroy( idPack ); |
|
127 return reqId; |
|
128 } |
|
129 |
|
130 |
|
131 // --------------------------------------------------------------------------- |
|
132 // CPresenceWatchingImp::SubscribePresentityGroupMembersPresenceL() |
|
133 // --------------------------------------------------------------------------- |
|
134 // |
|
135 TXIMPRequestId CPresenceWatchingImp::SubscribePresentityGroupMembersPresenceL( |
|
136 const MXIMPIdentity& aGroupId, |
|
137 const MPresenceInfoFilter& aPif ) |
|
138 { |
|
139 RXIMPObjOwningPtrArray< HBufC8 > packArray; |
|
140 CleanupClosePushL( packArray ); |
|
141 |
|
142 // Pack the identity |
|
143 HBufC8* idPack = PackPresentityLC( aGroupId ); |
|
144 packArray.Append( idPack ); |
|
145 CleanupStack::Pop( idPack ); |
|
146 |
|
147 // pack the filter |
|
148 HBufC8* filterPack = PackFilterLC( aPif ); |
|
149 packArray.Append( filterPack ); |
|
150 CleanupStack::Pop( filterPack ); |
|
151 |
|
152 // pack the array to a string |
|
153 HBufC8* packedBuf = TXIMPHBuf8Packer::PackArrayL( packArray ); |
|
154 CleanupStack::PushL( packedBuf ); |
|
155 |
|
156 // Queue the operation |
|
157 TXIMPRequestId reqId = |
|
158 iContext.QueueOperationL( NPresenceOps::EPrSubscribePresentityGroupMembersPresence, |
|
159 *packedBuf ); |
|
160 |
|
161 CleanupStack::PopAndDestroy( packedBuf ); |
|
162 CleanupStack::PopAndDestroy(); // packArray |
|
163 |
|
164 return reqId; |
|
165 } |
|
166 |
|
167 |
|
168 // --------------------------------------------------------------------------- |
|
169 // CPresenceWatchingImp::UnsubscribePresentityGroupMembersPresenceL() |
|
170 // --------------------------------------------------------------------------- |
|
171 // |
|
172 TXIMPRequestId CPresenceWatchingImp::UnsubscribePresentityGroupMembersPresenceL( |
|
173 const MXIMPIdentity& aGroupId ) |
|
174 { |
|
175 // Pack the identity |
|
176 HBufC8* idPack = PackPresentityLC( aGroupId ); |
|
177 // Queue the operation |
|
178 TXIMPRequestId reqId = |
|
179 iContext.QueueOperationL( |
|
180 NPresenceOps::EPrUnsubscribePresentityGroupMembersPresence, |
|
181 *idPack ); |
|
182 CleanupStack::PopAndDestroy( idPack ); |
|
183 return reqId; |
|
184 } |
|
185 |
|
186 |
|
187 // --------------------------------------------------------------------------- |
|
188 // CPresenceWatchingImp::PackPresentityLC() |
|
189 // --------------------------------------------------------------------------- |
|
190 // |
|
191 HBufC8* CPresenceWatchingImp::PackPresentityLC( |
|
192 const MXIMPIdentity& aIdentity ) |
|
193 { |
|
194 const CXIMPIdentityImp* identityImp = |
|
195 TXIMPGetImpClassOrPanic< const CXIMPIdentityImp >::From( aIdentity ); |
|
196 |
|
197 HBufC8* pack = TXIMPObjectPacker< const CXIMPIdentityImp >::PackL( *identityImp ); |
|
198 CleanupStack::PushL( pack ); |
|
199 |
|
200 return pack; |
|
201 } |
|
202 |
|
203 // --------------------------------------------------------------------------- |
|
204 // CPresenceWatchingImp::PackFilterLC() |
|
205 // --------------------------------------------------------------------------- |
|
206 // |
|
207 HBufC8* CPresenceWatchingImp::PackFilterLC( |
|
208 const MPresenceInfoFilter& aFilter ) |
|
209 { |
|
210 const CPresenceInfoFilterImp* filterImp = |
|
211 TXIMPGetImpClassOrPanic< const CPresenceInfoFilterImp >::From( aFilter ); |
|
212 |
|
213 HBufC8* pack = TXIMPObjectPacker< const CPresenceInfoFilterImp >::PackL( *filterImp ); |
|
214 CleanupStack::PushL( pack ); |
|
215 |
|
216 return pack; |
|
217 } |
|
218 |
|
219 |
|
220 // End of file |
|
221 |