|
1 /* |
|
2 * Copyright (c) 2006 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: Create Presentity Group Request to the Network Server. |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #include <ximpprotocolconnectionhost.h> |
|
20 #include "CWithdrawPresenceGrantFromPresentityGroupMembersRequest.h" |
|
21 #include "impsconnectionmanagercontrolif.h" |
|
22 #include "impsdebugprint.h" |
|
23 #include "CImpsPluginAccessHandler.h" |
|
24 #include "CImpsPluginPureDataHandler.h" |
|
25 #include <protocolpresenceauthorizationdatahost.h> |
|
26 |
|
27 #include "CPEngXMLParser.h" |
|
28 #include "MPEngXMLParser.h" |
|
29 #include "CPEngXmlSerializer.h" |
|
30 #include "MPEngXmlSerializer.h" |
|
31 #include "CImpsPluginConnectionManager.h" |
|
32 #include "PEngXMLTags.h" |
|
33 #include <ximpprotocolconnectionhost.h> |
|
34 #include <ximpobjectfactory.h> |
|
35 #include <ximpobjectcollection.h> |
|
36 #include <protocolpresentitygroupsdatahost.h> |
|
37 #include <presentitygroupinfo.h> |
|
38 #include <presentitygroupmemberinfo.h> |
|
39 #include <ximpidentity.h> |
|
40 #include "PImpsAdapXMLTools.h" |
|
41 |
|
42 |
|
43 // ======== MEMBER FUNCTIONS ======== |
|
44 |
|
45 // --------------------------------------------------------------------------- |
|
46 // CWithdrawPresenceGrantFromPresentityGroupMembersRequest::CWithdrawPresenceGrantFromPresentityGroupMembersRequest |
|
47 // --------------------------------------------------------------------------- |
|
48 // |
|
49 CWithdrawPresenceGrantFromPresentityGroupMembersRequest::CWithdrawPresenceGrantFromPresentityGroupMembersRequest( |
|
50 MImpsPrtPluginConnectionManager& aConnMan, |
|
51 TXIMPRequestId aRequestId ) : |
|
52 CActive( EPriorityNormal ), |
|
53 iRequestId( aRequestId ), |
|
54 iConnMan( aConnMan ) |
|
55 { |
|
56 IMPS_DP( D_IMPS_LIT( "::CWithdrawPresenceGrantFromPresentityGroupMembersRequest Start" ) ); |
|
57 CActiveScheduler::Add( this ); |
|
58 IMPS_DP( D_IMPS_LIT( "::CWithdrawPresenceGrantFromPresentityGroupMembersRequest End" ) ); |
|
59 } |
|
60 |
|
61 |
|
62 // --------------------------------------------------------------------------- |
|
63 // CWithdrawPresenceGrantFromPresentityGroupMembersRequest::ConstructL |
|
64 // --------------------------------------------------------------------------- |
|
65 // |
|
66 void CWithdrawPresenceGrantFromPresentityGroupMembersRequest::ConstructL() |
|
67 { |
|
68 IMPS_DP( D_IMPS_LIT( "::ConstructL Start" ) ); |
|
69 |
|
70 iParser = CreateXMLParserL(); |
|
71 |
|
72 IMPS_DP( D_IMPS_LIT( "::ConstructL End" ) ); |
|
73 } |
|
74 |
|
75 |
|
76 // --------------------------------------------------------------------------- |
|
77 // CWithdrawPresenceGrantFromPresentityGroupMembersRequest::NewL |
|
78 // --------------------------------------------------------------------------- |
|
79 // |
|
80 CWithdrawPresenceGrantFromPresentityGroupMembersRequest* CWithdrawPresenceGrantFromPresentityGroupMembersRequest::NewL( |
|
81 MImpsPrtPluginConnectionManager& aConnMan, |
|
82 TXIMPRequestId aRequestId ) |
|
83 { |
|
84 IMPS_DP( D_IMPS_LIT( "CWithdrawPresenceGrantFromPresentityGroupMembersRequest::NewL Start" ) ); |
|
85 |
|
86 CWithdrawPresenceGrantFromPresentityGroupMembersRequest* self = new( ELeave ) CWithdrawPresenceGrantFromPresentityGroupMembersRequest( aConnMan, aRequestId ); |
|
87 CleanupStack::PushL( self ); |
|
88 self->ConstructL(); |
|
89 CleanupStack::Pop( self ); |
|
90 |
|
91 IMPS_DP( D_IMPS_LIT( "CWithdrawPresenceGrantFromPresentityGroupMembersRequest::NewL End" ) ); |
|
92 return self; |
|
93 } |
|
94 |
|
95 |
|
96 // --------------------------------------------------------------------------- |
|
97 // CWithdrawPresenceGrantFromPresentityGroupMembersRequest::NewLC |
|
98 // --------------------------------------------------------------------------- |
|
99 // |
|
100 CWithdrawPresenceGrantFromPresentityGroupMembersRequest* CWithdrawPresenceGrantFromPresentityGroupMembersRequest::NewLC( |
|
101 MImpsPrtPluginConnectionManager& aConnMan, |
|
102 TXIMPRequestId aRequestId ) |
|
103 { |
|
104 IMPS_DP( D_IMPS_LIT( "CWithdrawPresenceGrantFromPresentityGroupMembersRequest::NewLC Start" ) ); |
|
105 |
|
106 CWithdrawPresenceGrantFromPresentityGroupMembersRequest* self = |
|
107 CWithdrawPresenceGrantFromPresentityGroupMembersRequest::NewL( aConnMan, aRequestId ); |
|
108 CleanupStack::PushL( self ); |
|
109 |
|
110 IMPS_DP( D_IMPS_LIT( "CWithdrawPresenceGrantFromPresentityGroupMembersRequest::NewLC End" ) ); |
|
111 return self; |
|
112 } |
|
113 |
|
114 // --------------------------------------------------------------------------- |
|
115 // CWithdrawPresenceGrantFromPresentityGroupMembersRequest::~CWithdrawPresenceGrantFromPresentityGroupMembersRequest |
|
116 // --------------------------------------------------------------------------- |
|
117 // |
|
118 CWithdrawPresenceGrantFromPresentityGroupMembersRequest::~CWithdrawPresenceGrantFromPresentityGroupMembersRequest() |
|
119 { |
|
120 IMPS_DP( D_IMPS_LIT( "::~CWithdrawPresenceGrantFromPresentityGroupMembers Start-End" ) ); |
|
121 delete iResponse; |
|
122 CActive::Cancel(); |
|
123 iConnMan.Remove( this ); |
|
124 delete iParser; |
|
125 delete iGroupName; |
|
126 delete iContactName; |
|
127 delete iUserId; |
|
128 } |
|
129 |
|
130 |
|
131 // --------------------------------------------------------------------------- |
|
132 // CWithdrawPresenceGrantFromPresentityGroupMembersRequest::DoCancel() |
|
133 // --------------------------------------------------------------------------- |
|
134 // |
|
135 void CWithdrawPresenceGrantFromPresentityGroupMembersRequest::DoCancel() |
|
136 { |
|
137 IMPS_DP( D_IMPS_LIT( "CWithdrawPresenceGrantFromPresentityGroupMembersRequest::DoCancel Start" ) ); |
|
138 |
|
139 iConnMan.DataHandler().CancelSending( iSendId ); |
|
140 |
|
141 IMPS_DP( D_IMPS_LIT( "CWithdrawPresenceGrantFromPresentityGroupMembersRequest::DoCancel End" ) ); |
|
142 } |
|
143 |
|
144 |
|
145 // --------------------------------------------------------------------------- |
|
146 // CWithdrawPresenceGrantFromPresentityGroupMembersRequest::RunL() |
|
147 // --------------------------------------------------------------------------- |
|
148 // |
|
149 void CWithdrawPresenceGrantFromPresentityGroupMembersRequest::RunL() |
|
150 { |
|
151 IMPS_DP( D_IMPS_LIT( "CWithdrawPresenceGrantFromPresentityGroupMembersRequest::RunL Start" ) ); |
|
152 |
|
153 User::LeaveIfError( iStatus.Int() ); |
|
154 |
|
155 iResponse = iConnMan.DataHandler().ResponseL( iSendId ); |
|
156 |
|
157 TPtrC8 resultBlock( NULL, 0 ); |
|
158 TInt wvErrorCode = KErrNone; |
|
159 |
|
160 // Check if we got 200 |
|
161 if ( iParser->DecodeL( *iResponse, KResultXMLTag, ETrue ) ) |
|
162 { |
|
163 resultBlock.Set( iParser->ResultL() ); |
|
164 if ( iParser->DecodeL( resultBlock, KCodeXMLTag, EFalse ) ) |
|
165 { |
|
166 TPtrC8 cspStatusCodeBlock( iParser->ResultL() ); |
|
167 TInt cspStatusInt; |
|
168 TLex8 lexer( cspStatusCodeBlock ); |
|
169 lexer.SkipSpace(); |
|
170 TInt lexErr = lexer.Val( cspStatusInt ); |
|
171 if ( lexErr == KErrNone ) |
|
172 { |
|
173 wvErrorCode = cspStatusInt; |
|
174 } |
|
175 } |
|
176 } |
|
177 |
|
178 IMPS_DP( D_IMPS_LIT( "WithdrawPresenceGrantFromPresentityGroupMembersL %d" ), wvErrorCode ); |
|
179 iConnMan.HandleToHost().HandleRequestCompleted( iRequestId, wvErrorCode ); |
|
180 |
|
181 delete this; |
|
182 IMPS_DP( D_IMPS_LIT( "CWithdrawPresenceGrantFromPresentityGroupMembersRequest::RunL End" ) ); |
|
183 } |
|
184 |
|
185 |
|
186 // --------------------------------------------------------------------------- |
|
187 // CWithdrawPresenceGrantFromPresentityGroupMembersRequest::RunError |
|
188 // --------------------------------------------------------------------------- |
|
189 // |
|
190 TInt CWithdrawPresenceGrantFromPresentityGroupMembersRequest::RunError( TInt aError ) |
|
191 { |
|
192 IMPS_DP( D_IMPS_LIT( "CWithdrawPresenceGrantFromPresentityGroupMembersRequest::RunError Start" ) ); |
|
193 |
|
194 iConnMan.HandleToHost().HandleRequestCompleted( iRequestId, aError ); |
|
195 |
|
196 delete this; |
|
197 IMPS_DP( D_IMPS_LIT( "CWithdrawPresenceGrantFromPresentityGroupMembersRequest::RunError End" ) ); |
|
198 return KErrNone; |
|
199 } |
|
200 |
|
201 // --------------------------------------------------------------------------- |
|
202 // CWithdrawPresenceGrantFromPresentityGroupMembersRequest::WithdrawPresenceGrantFromPresentityGroupMembersL |
|
203 // --------------------------------------------------------------------------- |
|
204 // |
|
205 void CWithdrawPresenceGrantFromPresentityGroupMembersRequest::WithdrawPresenceGrantFromPresentityGroupMembersL( |
|
206 const MXIMPIdentity& aIdentity ) |
|
207 { |
|
208 IMPS_DP( D_IMPS_LIT( "::WithdrawPresenceGrantFromPresentityGroupMembersL Start" ) ); |
|
209 |
|
210 IMPS_DP( D_IMPS_LIT( "------------------------------------------------------------------" ) ); |
|
211 |
|
212 IMPS_DP( D_IMPS_LIT( "---------------------Data from framework to presadap1.2-----------" ) ); |
|
213 |
|
214 IMPS_DP( D_IMPS_LIT( "CWithdrawPresenceGrantFromPresentityGroupMembersRequest::WithdrawPresenceGrantFromPresentityGroupMembersL:MemberId:%S " ), &aIdentity.Identity() ); |
|
215 |
|
216 TPtr8 ptrbuffer( iConnMan.DataHandler().TransferBufferL() ); |
|
217 MPEngXMLSerializer* serializer = CreateXmlSerializerLC( ptrbuffer ); |
|
218 |
|
219 iGroupName = aIdentity.Identity().AllocL(); |
|
220 |
|
221 NImpsAdapXMLTools::AppendTransactionContentTagXmlL( *serializer, iConnMan.GetVersion() ); |
|
222 |
|
223 serializer->StartTagL( KCreateAttributeList ); |
|
224 serializer->StartTagL( KPresenceSubList ); |
|
225 serializer->AttributeL( KXmlXmlns, KPresenceSubListAttributesNS_CSP12 ); |
|
226 |
|
227 serializer->EndTagL( KPresenceSubList ); |
|
228 if ( KErrNone == iGroupName->Left( KPEngAttrWVIdPrefixLength ).CompareF( KPengWVIDPrefix ) ) |
|
229 { |
|
230 serializer->StartTagL( KContactList |
|
231 ).WvAddressL( aIdentity.Identity() |
|
232 ).EndTagL( KContactList ); |
|
233 } |
|
234 |
|
235 |
|
236 else |
|
237 { |
|
238 serializer->StartTagL( KContactList |
|
239 ).NarrowTextL( KWVXMLTag |
|
240 ).WvAddressL( aIdentity.Identity() |
|
241 ).EndTagL( KContactList ); |
|
242 } |
|
243 |
|
244 serializer->StartTagL( KDefaultList ).NarrowTextL( KXMLValueTrue ).EndTagL( KDefaultList ); |
|
245 |
|
246 serializer->EndTagL( KCreateAttributeList ); |
|
247 |
|
248 serializer->EndTagL( KTransactionContent ); |
|
249 |
|
250 |
|
251 IMPS_DP( D_IMPS_LIT( "WithdrawPresenceGrantFromPresentityGroupMembersL" ) ); |
|
252 |
|
253 CleanupStack::PopAndDestroy(); //serializer |
|
254 |
|
255 iSendId = iConnMan.DataHandler().SendDataL( iStatus ); |
|
256 |
|
257 // signal the scheduler |
|
258 SetActive(); |
|
259 |
|
260 IMPS_DP( D_IMPS_LIT( "::WithdrawPresenceGrantFromPresentityGroupMembersL End" ) ); |
|
261 } |
|
262 |
|
263 // End of file |