|
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 "CImpsPluginGroupUnSubscribePresentityGroupContentRequest.h" |
|
21 #include "impsconnectionmanagercontrolif.h" |
|
22 #include "impsdebugprint.h" |
|
23 #include "CImpsPluginAccessHandler.h" |
|
24 #include "CImpsPluginPureDataHandler.h" |
|
25 |
|
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 |
|
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 |
|
41 |
|
42 |
|
43 |
|
44 // ======== MEMBER FUNCTIONS ======== |
|
45 |
|
46 // --------------------------------------------------------------------------- |
|
47 // CImpsPluginGroupUnSubscribePresentityGroupContentRequest::CImpsPluginGroupUnSubscribePresentityGroupContentRequest |
|
48 // --------------------------------------------------------------------------- |
|
49 // |
|
50 CImpsPluginGroupUnSubscribePresentityGroupContentRequest::CImpsPluginGroupUnSubscribePresentityGroupContentRequest( MImpsPrtPluginConnectionManager& aConnMan, |
|
51 TXIMPRequestId aRequestId ) : |
|
52 CActive( EPriorityNormal ), |
|
53 iRequestId( aRequestId ), |
|
54 iConnMan( aConnMan ) |
|
55 { |
|
56 IMPS_DP( D_IMPS_LIT( "CImpsPluginGroupUnSubscribePresentityGroupContentRequest::CImpsPluginGroupUnSubscribePresentityGroupContentRequest Start" ) ); |
|
57 CActiveScheduler::Add( this ); |
|
58 IMPS_DP( D_IMPS_LIT( "CImpsPluginGroupUnSubscribePresentityGroupContentRequest::CImpsPluginGroupUnSubscribePresentityGroupContentRequest End" ) ); |
|
59 } |
|
60 |
|
61 |
|
62 // --------------------------------------------------------------------------- |
|
63 // CImpsPluginGroupUnSubscribePresentityGroupContentRequest::ConstructL |
|
64 // --------------------------------------------------------------------------- |
|
65 // |
|
66 void CImpsPluginGroupUnSubscribePresentityGroupContentRequest::ConstructL() |
|
67 { |
|
68 IMPS_DP( D_IMPS_LIT( "CImpsPluginGroupUnSubscribePresentityGroupContentRequest::ConstructL Start-End" ) ); |
|
69 |
|
70 iParser = CreateXMLParserL(); |
|
71 |
|
72 } |
|
73 |
|
74 |
|
75 // --------------------------------------------------------------------------- |
|
76 // CImpsPluginGroupUnSubscribePresentityGroupContentRequest::NewL |
|
77 // --------------------------------------------------------------------------- |
|
78 // |
|
79 CImpsPluginGroupUnSubscribePresentityGroupContentRequest* CImpsPluginGroupUnSubscribePresentityGroupContentRequest::NewL( |
|
80 MImpsPrtPluginConnectionManager& aConnMan, |
|
81 TXIMPRequestId aRequestId ) |
|
82 { |
|
83 IMPS_DP( D_IMPS_LIT( "CImpsPluginGroupUnSubscribePresentityGroupContentRequest::NewL Start" ) ); |
|
84 |
|
85 CImpsPluginGroupUnSubscribePresentityGroupContentRequest* self = new( ELeave ) CImpsPluginGroupUnSubscribePresentityGroupContentRequest( aConnMan, aRequestId ); |
|
86 CleanupStack::PushL( self ); |
|
87 self->ConstructL(); |
|
88 CleanupStack::Pop( self ); |
|
89 |
|
90 IMPS_DP( D_IMPS_LIT( "CImpsPluginGroupUnSubscribePresentityGroupContentRequest::NewL End" ) ); |
|
91 return self; |
|
92 } |
|
93 |
|
94 |
|
95 // --------------------------------------------------------------------------- |
|
96 // CImpsPluginGroupUnSubscribePresentityGroupContentRequest::NewLC |
|
97 // --------------------------------------------------------------------------- |
|
98 // |
|
99 CImpsPluginGroupUnSubscribePresentityGroupContentRequest* CImpsPluginGroupUnSubscribePresentityGroupContentRequest::NewLC( |
|
100 MImpsPrtPluginConnectionManager& aConnMan, |
|
101 TXIMPRequestId aRequestId ) |
|
102 { |
|
103 IMPS_DP( D_IMPS_LIT( "CImpsPluginGroupUnSubscribePresentityGroupContentRequest::NewLC Start" ) ); |
|
104 |
|
105 CImpsPluginGroupUnSubscribePresentityGroupContentRequest* self = new( ELeave ) CImpsPluginGroupUnSubscribePresentityGroupContentRequest( aConnMan, aRequestId ); |
|
106 CleanupStack::PushL( self ); |
|
107 self->ConstructL(); |
|
108 |
|
109 IMPS_DP( D_IMPS_LIT( "CImpsPluginGroupUnSubscribePresentityGroupContentRequest::NewLC End" ) ); |
|
110 return self; |
|
111 } |
|
112 |
|
113 // --------------------------------------------------------------------------- |
|
114 // CImpsPluginGroupUnSubscribePresentityGroupContentRequest::~CImpsPluginGroupUnSubscribePresentityGroupContentRequest |
|
115 // --------------------------------------------------------------------------- |
|
116 // |
|
117 CImpsPluginGroupUnSubscribePresentityGroupContentRequest::~CImpsPluginGroupUnSubscribePresentityGroupContentRequest() |
|
118 { |
|
119 IMPS_DP( D_IMPS_LIT( "CImpsPluginGroupUnSubscribePresentityGroupContentRequest::~CImpsPluginGroupUnSubscribePresentityGroupContentRequest Start-End" ) ); |
|
120 delete iResponse; |
|
121 CActive::Cancel(); |
|
122 iConnMan.Remove( this ); |
|
123 delete iParser; |
|
124 } |
|
125 |
|
126 |
|
127 // --------------------------------------------------------------------------- |
|
128 // CImpsPluginGroupUnSubscribePresentityGroupContentRequest::DoCancel() |
|
129 // --------------------------------------------------------------------------- |
|
130 // |
|
131 void CImpsPluginGroupUnSubscribePresentityGroupContentRequest::DoCancel() |
|
132 { |
|
133 IMPS_DP( D_IMPS_LIT( "CImpsPluginGroupUnSubscribePresentityGroupContentRequest::DoCancel Start" ) ); |
|
134 |
|
135 iConnMan.DataHandler().CancelSending( iSendId ); |
|
136 |
|
137 IMPS_DP( D_IMPS_LIT( "CImpsPluginGroupUnSubscribePresentityGroupContentRequest::DoCancel End" ) ); |
|
138 } |
|
139 |
|
140 |
|
141 // --------------------------------------------------------------------------- |
|
142 // CImpsPluginGroupUnSubscribePresentityGroupContentRequest::RunL() |
|
143 // --------------------------------------------------------------------------- |
|
144 // |
|
145 void CImpsPluginGroupUnSubscribePresentityGroupContentRequest::RunL() |
|
146 { |
|
147 IMPS_DP( D_IMPS_LIT( "CImpsPluginGroupUnSubscribePresentityGroupContentRequest::RunL Start" ) ); |
|
148 |
|
149 User::LeaveIfError( iStatus.Int() ); |
|
150 |
|
151 iResponse = iConnMan.DataHandler().ResponseL( iSendId ); |
|
152 |
|
153 TPtrC8 resultBlock( NULL, 0 ); |
|
154 TInt wvErrorCode = KErrNone; |
|
155 |
|
156 //Look for mandatory parts |
|
157 if ( iParser->DecodeL( *iResponse, KResultXMLTag, ETrue ) ) |
|
158 { |
|
159 resultBlock.Set( iParser->ResultL() ); |
|
160 if ( iParser->DecodeL( resultBlock, KCodeXMLTag, EFalse ) ) |
|
161 { |
|
162 TPtrC8 cspStatusCodeBlock( iParser->ResultL() ); |
|
163 TInt cspStatusInt; |
|
164 TLex8 lexer( cspStatusCodeBlock ); |
|
165 lexer.SkipSpace(); |
|
166 TInt lexErr = lexer.Val( cspStatusInt ); |
|
167 if ( lexErr == KErrNone ) |
|
168 { |
|
169 wvErrorCode = cspStatusInt; |
|
170 } |
|
171 } |
|
172 } |
|
173 |
|
174 IMPS_DP( D_IMPS_LIT( "CreatePresentityGroupRequest Return Code %d" ), wvErrorCode ); |
|
175 iConnMan.HandleToHost().HandleRequestCompleted( iRequestId, wvErrorCode ); |
|
176 |
|
177 delete this; |
|
178 IMPS_DP( D_IMPS_LIT( "CImpsPluginGroupUnSubscribePresentityGroupContentRequest::RunL Start" ) ); |
|
179 } |
|
180 |
|
181 |
|
182 // --------------------------------------------------------------------------- |
|
183 // CImpsPluginGroupUnSubscribePresentityGroupContentRequest::RunError |
|
184 // --------------------------------------------------------------------------- |
|
185 // |
|
186 TInt CImpsPluginGroupUnSubscribePresentityGroupContentRequest::RunError( TInt aError ) |
|
187 { |
|
188 IMPS_DP( D_IMPS_LIT( "CImpsPluginGroupUnSubscribePresentityGroupContentRequest::RunError Start" ) ); |
|
189 |
|
190 iConnMan.HandleToHost().HandleRequestCompleted( iRequestId, aError ); |
|
191 |
|
192 delete this; |
|
193 IMPS_DP( D_IMPS_LIT( "CImpsPluginGroupUnSubscribePresentityGroupContentRequest::RunError End" ) ); |
|
194 return KErrNone; |
|
195 } |
|
196 |
|
197 // --------------------------------------------------------------------------- |
|
198 // CImpsPluginGroupUnSubscribePresentityGroupContentRequest::UnSubscribePresentityGroupContentL |
|
199 // --------------------------------------------------------------------------- |
|
200 // |
|
201 void CImpsPluginGroupUnSubscribePresentityGroupContentRequest::UnSubscribePresentityGroupContentL( |
|
202 const MXIMPIdentity& aIdentity ) |
|
203 { |
|
204 IMPS_DP( D_IMPS_LIT( "CImpsPluginGroupUnSubscribePresentityGroupContentRequest::UnSubscribePresentityGroupContentL Start" ) ); |
|
205 |
|
206 TPtr8 ptrbuffer( iConnMan.DataHandler().TransferBufferL() ); |
|
207 MPEngXMLSerializer* serializer = CreateXmlSerializerLC( ptrbuffer ); |
|
208 |
|
209 serializer->StartTagL( KTransactionContent ); |
|
210 serializer->AttributeL( KXmlXmlns, KTransactionContentNS_CSP12 ); |
|
211 |
|
212 |
|
213 |
|
214 serializer->EndTagL( KTransactionContent ); |
|
215 |
|
216 IMPS_DP( D_IMPS_LIT( "UnSubscribePresentityGroupContentL" ) ); |
|
217 |
|
218 CleanupStack::PopAndDestroy(); //serializer |
|
219 |
|
220 iSendId = iConnMan.DataHandler().SendDataL( iStatus ); |
|
221 |
|
222 // signal the scheduler |
|
223 SetActive(); |
|
224 |
|
225 IMPS_DP( D_IMPS_LIT( "CImpsPluginGroupUnSubscribePresentityGroupContentRequest::UnSubscribePresentityGroupContentL End" ) ); |
|
226 } |
|
227 |
|
228 // End of file |