1 |
diff -uNr libmsn-4.1/msn/soap.cpp msn/soap.cpp |
2 |
--- libmsn-4.1/msn/soap.cpp 2010-01-19 13:05:10.000000000 -0500 |
3 |
+++ msn/soap.cpp 2011-11-08 19:21:50.000000000 -0500 |
4 |
@@ -314,25 +314,17 @@ |
5 |
|
6 |
void Soap::parseGetTicketsResponse(std::string response) |
7 |
{ |
8 |
- XMLNode domTree = XMLNode::parseString( response.c_str() ); |
9 |
- if(http_response_code == "301" ) |
10 |
+ XMLNode response1 = XMLNode::parseString( response.c_str() ); |
11 |
+ if(http_response_code == "301") |
12 |
{ |
13 |
- const char *preferredHostName = domTree.getChildNode("soap:Envelope").getChildNode("soap:Header").getChildNode("ServiceHeader").getChildNode("PreferredHostName").getText(); |
14 |
- if(preferredHostName) |
15 |
- { |
16 |
- Soap *soapConnection = new Soap(notificationServer, sitesToAuthList); |
17 |
- |
18 |
- std::string newdomain(preferredHostName); |
19 |
- soapConnection->actionDomains[AUTH] = newdomain; |
20 |
- soapConnection->setMBI(mbi); |
21 |
- soapConnection->getTickets(this->passport, this->password, this->policy); |
22 |
- } |
23 |
+ Soap *soapConnection = manageSoapRedirect(response1, AUTH); |
24 |
+ soapConnection->getTickets(this->passport, this->password, this->policy); |
25 |
return; |
26 |
} |
27 |
|
28 |
// get the header information from the DOM |
29 |
- XMLNode tokens = domTree.getChildNode("S:Envelope").getChildNode("S:Body").getChildNode("wst:RequestSecurityTokenResponseCollection"); |
30 |
- const char *reason = domTree.getChildNode("S:Envelope").getChildNode("S:Fault").getChildNode("faultcode").getText(); |
31 |
+ XMLNode tokens = response1.getChildNode("S:Envelope").getChildNode("S:Body").getChildNode("wst:RequestSecurityTokenResponseCollection"); |
32 |
+ const char *reason = response1.getChildNode("S:Envelope").getChildNode("S:Fault").getChildNode("faultcode").getText(); |
33 |
if(reason) |
34 |
{ |
35 |
std::string reason1(reason); |
36 |
@@ -345,7 +337,7 @@ |
37 |
} |
38 |
if(reason1 == "psf:Redirect") |
39 |
{ |
40 |
- const char *newurl = domTree.getChildNode("S:Envelope").getChildNode("S:Fault").getChildNode("psf:redirectUrl").getText(); |
41 |
+ const char *newurl = response1.getChildNode("S:Envelope").getChildNode("S:Fault").getChildNode("psf:redirectUrl").getText(); |
42 |
Soap *soapConnection = new Soap(notificationServer); |
43 |
|
44 |
std::string newurl1(newurl); |
45 |
@@ -480,22 +472,14 @@ |
46 |
void Soap::parseEnableContactOnAddressBookResponse(std::string response) |
47 |
{ |
48 |
XMLNode response1 = XMLNode::parseString(response.c_str()); |
49 |
+ |
50 |
if(http_response_code == "301" ) |
51 |
{ |
52 |
- const char *preferredHostName = response1.getChildNode("soap:Envelope").getChildNode("soap:Header").getChildNode("ServiceHeader").getChildNode("PreferredHostName").getText(); |
53 |
- if(preferredHostName) |
54 |
- { |
55 |
- Soap *soapConnection = new Soap(notificationServer, sitesToAuthList); |
56 |
- |
57 |
- std::string newdomain(preferredHostName); |
58 |
- soapConnection->actionDomains[ENABLE_CONTACT_ON_ADDRESSBOOK] = newdomain; |
59 |
- soapConnection->setMBI(mbi); |
60 |
- soapConnection->enableContactOnAddressBook(this->contactId, this->tempPassport, this->myDisplayName); |
61 |
- } |
62 |
+ Soap *soapConnection = manageSoapRedirect(response1, ENABLE_CONTACT_ON_ADDRESSBOOK); |
63 |
+ soapConnection->enableContactOnAddressBook(this->contactId, this->tempPassport, this->myDisplayName); |
64 |
return; |
65 |
} |
66 |
|
67 |
- |
68 |
XMLNode version = response1.getChildNode("soap:Envelope").getChildNode("soap:Header").getChildNode("ServiceHeader").getChildNode("Version"); |
69 |
const char *ver = version.getText(); |
70 |
if(ver) |
71 |
@@ -576,22 +560,14 @@ |
72 |
void Soap::parseDelContactFromAddressBookResponse(std::string response) |
73 |
{ |
74 |
XMLNode response1 = XMLNode::parseString(response.c_str()); |
75 |
+ |
76 |
if(http_response_code == "301" ) |
77 |
{ |
78 |
- const char *preferredHostName = response1.getChildNode("soap:Envelope").getChildNode("soap:Header").getChildNode("ServiceHeader").getChildNode("PreferredHostName").getText(); |
79 |
- if(preferredHostName) |
80 |
- { |
81 |
- Soap *soapConnection = new Soap(notificationServer, sitesToAuthList); |
82 |
- |
83 |
- std::string newdomain(preferredHostName); |
84 |
- soapConnection->actionDomains[DEL_CONTACT_FROM_ADDRESSBOOK] = newdomain; |
85 |
- soapConnection->setMBI(mbi); |
86 |
- soapConnection->delContactFromAddressBook(this->contactId, this->tempPassport); |
87 |
- } |
88 |
+ Soap *soapConnection = manageSoapRedirect(response1, DEL_CONTACT_FROM_ADDRESSBOOK); |
89 |
+ soapConnection->delContactFromAddressBook(this->contactId, this->tempPassport); |
90 |
return; |
91 |
} |
92 |
|
93 |
- |
94 |
XMLNode version = response1.getChildNode("soap:Envelope").getChildNode("soap:Header").getChildNode("ServiceHeader").getChildNode("Version"); |
95 |
const char *ver = version.getText(); |
96 |
if(ver) |
97 |
@@ -683,22 +659,14 @@ |
98 |
void Soap::parseDisableContactFromAddressBookResponse(std::string response) |
99 |
{ |
100 |
XMLNode response1 = XMLNode::parseString(response.c_str()); |
101 |
+ |
102 |
if(http_response_code == "301" ) |
103 |
{ |
104 |
- const char *preferredHostName = response1.getChildNode("soap:Envelope").getChildNode("soap:Header").getChildNode("ServiceHeader").getChildNode("PreferredHostName").getText(); |
105 |
- if(preferredHostName) |
106 |
- { |
107 |
- Soap *soapConnection = new Soap(notificationServer, sitesToAuthList); |
108 |
- |
109 |
- std::string newdomain(preferredHostName); |
110 |
- soapConnection->actionDomains[DISABLE_CONTACT_ON_ADDRESSBOOK] = newdomain; |
111 |
- soapConnection->setMBI(mbi); |
112 |
- soapConnection->disableContactFromAddressBook(this->contactId, this->tempPassport); |
113 |
- } |
114 |
+ Soap *soapConnection = manageSoapRedirect(response1, DISABLE_CONTACT_ON_ADDRESSBOOK); |
115 |
+ soapConnection->disableContactFromAddressBook(this->contactId, this->tempPassport); |
116 |
return; |
117 |
} |
118 |
|
119 |
- |
120 |
XMLNode version = response1.getChildNode("soap:Envelope").getChildNode("soap:Header").getChildNode("ServiceHeader").getChildNode("Version"); |
121 |
const char *ver = version.getText(); |
122 |
if(ver) |
123 |
@@ -797,18 +765,11 @@ |
124 |
void Soap::parseAddContactToAddressBookResponse(std::string response) |
125 |
{ |
126 |
XMLNode response1 = XMLNode::parseString(response.c_str()); |
127 |
+ |
128 |
if(http_response_code == "301" ) |
129 |
{ |
130 |
- const char *preferredHostName = response1.getChildNode("soap:Envelope").getChildNode("soap:Header").getChildNode("ServiceHeader").getChildNode("PreferredHostName").getText(); |
131 |
- if(preferredHostName) |
132 |
- { |
133 |
- Soap *soapConnection = new Soap(notificationServer, sitesToAuthList); |
134 |
- |
135 |
- std::string newdomain(preferredHostName); |
136 |
- soapConnection->actionDomains[ADD_CONTACT_TO_ADDRESSBOOK] = newdomain; |
137 |
- soapConnection->setMBI(mbi); |
138 |
- soapConnection->addContactToAddressBook(this->tempPassport, this->tempDisplayName); |
139 |
- } |
140 |
+ Soap *soapConnection = manageSoapRedirect(response1, ADD_CONTACT_TO_ADDRESSBOOK); |
141 |
+ soapConnection->addContactToAddressBook(this->tempPassport, this->tempDisplayName); |
142 |
return; |
143 |
} |
144 |
|
145 |
@@ -902,22 +863,14 @@ |
146 |
void Soap::parseAddContactToGroupResponse(std::string response) |
147 |
{ |
148 |
XMLNode response1 = XMLNode::parseString(response.c_str()); |
149 |
+ |
150 |
if(http_response_code == "301" ) |
151 |
{ |
152 |
- const char *preferredHostName = response1.getChildNode("soap:Envelope").getChildNode("soap:Header").getChildNode("ServiceHeader").getChildNode("PreferredHostName").getText(); |
153 |
- if(preferredHostName) |
154 |
- { |
155 |
- Soap *soapConnection = new Soap(notificationServer, sitesToAuthList); |
156 |
- |
157 |
- std::string newdomain(preferredHostName); |
158 |
- soapConnection->actionDomains[ADD_CONTACT_TO_GROUP] = newdomain; |
159 |
- soapConnection->setMBI(mbi); |
160 |
- soapConnection->addContactToGroup(this->groupId, this->contactId); |
161 |
- } |
162 |
+ Soap *soapConnection = manageSoapRedirect(response1, ADD_CONTACT_TO_GROUP); |
163 |
+ soapConnection->addContactToGroup(this->groupId, this->contactId); |
164 |
return; |
165 |
} |
166 |
|
167 |
- |
168 |
XMLNode version = response1.getChildNode("soap:Envelope").getChildNode("soap:Header").getChildNode("ServiceHeader").getChildNode("Version"); |
169 |
const char *ver = version.getText(); |
170 |
if(ver) |
171 |
@@ -1017,22 +970,14 @@ |
172 |
void Soap::parseAddGroupResponse(std::string response) |
173 |
{ |
174 |
XMLNode response1 = XMLNode::parseString(response.c_str()); |
175 |
+ |
176 |
if(http_response_code == "301" ) |
177 |
{ |
178 |
- const char *preferredHostName = response1.getChildNode("soap:Envelope").getChildNode("soap:Header").getChildNode("ServiceHeader").getChildNode("PreferredHostName").getText(); |
179 |
- if(preferredHostName) |
180 |
- { |
181 |
- Soap *soapConnection = new Soap(notificationServer, sitesToAuthList); |
182 |
- |
183 |
- std::string newdomain(preferredHostName); |
184 |
- soapConnection->actionDomains[ADD_GROUP] = newdomain; |
185 |
- soapConnection->setMBI(mbi); |
186 |
- soapConnection->addGroup(this->groupName); |
187 |
- } |
188 |
+ Soap *soapConnection = manageSoapRedirect(response1, ADD_GROUP); |
189 |
+ soapConnection->addGroup(this->groupName); |
190 |
return; |
191 |
} |
192 |
|
193 |
- |
194 |
XMLNode version = response1.getChildNode("soap:Envelope").getChildNode("soap:Header").getChildNode("ServiceHeader").getChildNode("Version"); |
195 |
const char *ver = version.getText(); |
196 |
if(ver) |
197 |
@@ -1116,22 +1061,14 @@ |
198 |
void Soap::parseDelGroupResponse(std::string response) |
199 |
{ |
200 |
XMLNode response1 = XMLNode::parseString(response.c_str()); |
201 |
+ |
202 |
if(http_response_code == "301" ) |
203 |
{ |
204 |
- const char *preferredHostName = response1.getChildNode("soap:Envelope").getChildNode("soap:Header").getChildNode("ServiceHeader").getChildNode("PreferredHostName").getText(); |
205 |
- if(preferredHostName) |
206 |
- { |
207 |
- Soap *soapConnection = new Soap(notificationServer, sitesToAuthList); |
208 |
- |
209 |
- std::string newdomain(preferredHostName); |
210 |
- soapConnection->actionDomains[DEL_GROUP] = newdomain; |
211 |
- soapConnection->setMBI(mbi); |
212 |
- soapConnection->delGroup(this->groupId); |
213 |
- } |
214 |
+ Soap *soapConnection = manageSoapRedirect(response1, DEL_GROUP); |
215 |
+ soapConnection->delGroup(this->groupId); |
216 |
return; |
217 |
} |
218 |
|
219 |
- |
220 |
XMLNode version = response1.getChildNode("soap:Envelope").getChildNode("soap:Header").getChildNode("ServiceHeader").getChildNode("Version"); |
221 |
const char *ver = version.getText(); |
222 |
if(ver) |
223 |
@@ -1220,22 +1157,14 @@ |
224 |
void Soap::parseRenameGroupResponse(std::string response) |
225 |
{ |
226 |
XMLNode response1 = XMLNode::parseString(response.c_str()); |
227 |
+ |
228 |
if(http_response_code == "301" ) |
229 |
{ |
230 |
- const char *preferredHostName = response1.getChildNode("soap:Envelope").getChildNode("soap:Header").getChildNode("ServiceHeader").getChildNode("PreferredHostName").getText(); |
231 |
- if(preferredHostName) |
232 |
- { |
233 |
- Soap *soapConnection = new Soap(notificationServer, sitesToAuthList); |
234 |
- |
235 |
- std::string newdomain(preferredHostName); |
236 |
- soapConnection->actionDomains[RENAME_GROUP] = newdomain; |
237 |
- soapConnection->setMBI(mbi); |
238 |
- soapConnection->renameGroup(this->groupId, this->groupName); |
239 |
- } |
240 |
+ Soap *soapConnection = manageSoapRedirect(response1, RENAME_GROUP); |
241 |
+ soapConnection->renameGroup(this->groupId, this->groupName); |
242 |
return; |
243 |
} |
244 |
|
245 |
- |
246 |
XMLNode version = response1.getChildNode("soap:Envelope").getChildNode("soap:Header").getChildNode("ServiceHeader").getChildNode("Version"); |
247 |
const char *ver = version.getText(); |
248 |
if(ver) |
249 |
@@ -1323,22 +1252,14 @@ |
250 |
void Soap::parseDelContactFromGroupResponse(std::string response) |
251 |
{ |
252 |
XMLNode response1 = XMLNode::parseString(response.c_str()); |
253 |
+ |
254 |
if(http_response_code == "301" ) |
255 |
{ |
256 |
- const char *preferredHostName = response1.getChildNode("soap:Envelope").getChildNode("soap:Header").getChildNode("ServiceHeader").getChildNode("PreferredHostName").getText(); |
257 |
- if(preferredHostName) |
258 |
- { |
259 |
- Soap *soapConnection = new Soap(notificationServer, sitesToAuthList); |
260 |
- |
261 |
- std::string newdomain(preferredHostName); |
262 |
- soapConnection->actionDomains[DEL_CONTACT_FROM_GROUP] = newdomain; |
263 |
- soapConnection->setMBI(mbi); |
264 |
- soapConnection->delContactFromGroup(this->groupId, this->contactId); |
265 |
- } |
266 |
+ Soap *soapConnection = manageSoapRedirect(response1, DEL_CONTACT_FROM_GROUP); |
267 |
+ soapConnection->delContactFromGroup(this->groupId, this->contactId); |
268 |
return; |
269 |
} |
270 |
|
271 |
- |
272 |
XMLNode version = response1.getChildNode("soap:Envelope").getChildNode("soap:Header").getChildNode("ServiceHeader").getChildNode("Version"); |
273 |
const char *ver = version.getText(); |
274 |
if(ver) |
275 |
@@ -1454,18 +1375,11 @@ |
276 |
void Soap::parseAddContactToListResponse(std::string response) |
277 |
{ |
278 |
XMLNode response1 = XMLNode::parseString(response.c_str()); |
279 |
- if(http_response_code == "301" ) |
280 |
- { |
281 |
- const char *preferredHostName = response1.getChildNode("soap:Envelope").getChildNode("soap:Header").getChildNode("ServiceHeader").getChildNode("PreferredHostName").getText(); |
282 |
- if(preferredHostName) |
283 |
- { |
284 |
- Soap *soapConnection = new Soap(notificationServer, sitesToAuthList); |
285 |
|
286 |
- std::string newdomain(preferredHostName); |
287 |
- soapConnection->actionDomains[ADD_CONTACT_TO_LIST] = newdomain; |
288 |
- soapConnection->setMBI(mbi); |
289 |
- soapConnection->addContactToList(this->tempPassport, this->tempList); |
290 |
- } |
291 |
+ if(http_response_code == "301") |
292 |
+ { |
293 |
+ Soap *soapConnection = manageSoapRedirect(response1, ADD_CONTACT_TO_LIST); |
294 |
+ soapConnection->addContactToList(this->tempPassport, this->tempList); |
295 |
return; |
296 |
} |
297 |
|
298 |
@@ -1585,22 +1499,14 @@ |
299 |
void Soap::parseRemoveContactFromListResponse(std::string response) |
300 |
{ |
301 |
XMLNode response1 = XMLNode::parseString(response.c_str()); |
302 |
- if(http_response_code == "301" ) |
303 |
- { |
304 |
- const char *preferredHostName = response1.getChildNode("soap:Envelope").getChildNode("soap:Header").getChildNode("ServiceHeader").getChildNode("PreferredHostName").getText(); |
305 |
- if(preferredHostName) |
306 |
- { |
307 |
- Soap *soapConnection = new Soap(notificationServer, sitesToAuthList); |
308 |
|
309 |
- std::string newdomain(preferredHostName); |
310 |
- soapConnection->actionDomains[DEL_CONTACT_FROM_LIST] = newdomain; |
311 |
- soapConnection->setMBI(mbi); |
312 |
- soapConnection->removeContactFromList(this->tempPassport, this->tempList); |
313 |
- } |
314 |
+ if(http_response_code == "301") |
315 |
+ { |
316 |
+ Soap *soapConnection = manageSoapRedirect(response1, DEL_CONTACT_FROM_LIST); |
317 |
+ soapConnection->removeContactFromList(this->tempPassport, this->tempList); |
318 |
return; |
319 |
} |
320 |
|
321 |
- |
322 |
XMLNode version = response1.getChildNode("soap:Envelope").getChildNode("soap:Header").getChildNode("ServiceHeader").getChildNode("Version"); |
323 |
const char *ver = version.getText(); |
324 |
if(ver) |
325 |
@@ -1709,20 +1615,11 @@ |
326 |
XMLNode response1 = XMLNode::parseString(response.c_str()); |
327 |
if(http_response_code == "301" ) |
328 |
{ |
329 |
- const char *preferredHostName = response1.getChildNode("soap:Envelope").getChildNode("soap:Header").getChildNode("ServiceHeader").getChildNode("PreferredHostName").getText(); |
330 |
- if(preferredHostName) |
331 |
- { |
332 |
- Soap *soapConnection = new Soap(notificationServer, sitesToAuthList); |
333 |
- |
334 |
- std::string newdomain(preferredHostName); |
335 |
- soapConnection->actionDomains[GET_LISTS] = newdomain; |
336 |
- soapConnection->setMBI(mbi); |
337 |
- soapConnection->getLists(this->listInfo); |
338 |
- } |
339 |
+ Soap *soapConnection = manageSoapRedirect(response1, GET_LISTS); |
340 |
+ soapConnection->getLists(this->listInfo); |
341 |
return; |
342 |
} |
343 |
|
344 |
- |
345 |
XMLNode Services = response1.getChildNode("soap:Envelope").getChildNode("soap:Body").getChildNode("FindMembershipResponse").getChildNode("FindMembershipResult").getChildNode("Services"); |
346 |
|
347 |
int nServices = Services.nChildNode("Service"); |
348 |
@@ -1869,16 +1766,8 @@ |
349 |
XMLNode response1 = XMLNode::parseString(response.c_str()); |
350 |
if(http_response_code == "301" ) |
351 |
{ |
352 |
- const char *preferredHostName = response1.getChildNode("soap:Envelope").getChildNode("soap:Header").getChildNode("ServiceHeader").getChildNode("PreferredHostName").getText(); |
353 |
- if(preferredHostName) |
354 |
- { |
355 |
- Soap *soapConnection = new Soap(notificationServer, sitesToAuthList); |
356 |
- |
357 |
- std::string newdomain(preferredHostName); |
358 |
- soapConnection->actionDomains[GET_ADDRESS_BOOK] = newdomain; |
359 |
- soapConnection->setMBI(mbi); |
360 |
- soapConnection->getAddressBook(this->listInfo); |
361 |
- } |
362 |
+ Soap *soapConnection = manageSoapRedirect(response1, GET_ADDRESS_BOOK); |
363 |
+ soapConnection->getAddressBook(this->listInfo); |
364 |
return; |
365 |
} |
366 |
|
367 |
@@ -2075,20 +1964,11 @@ |
368 |
XMLNode response1 = XMLNode::parseString(response.c_str()); |
369 |
if(http_response_code == "301" ) |
370 |
{ |
371 |
- const char *preferredHostName = response1.getChildNode("soap:Envelope").getChildNode("soap:Header").getChildNode("ServiceHeader").getChildNode("PreferredHostName").getText(); |
372 |
- if(preferredHostName) |
373 |
- { |
374 |
- Soap *soapConnection = new Soap(notificationServer, sitesToAuthList); |
375 |
- |
376 |
- std::string newdomain(preferredHostName); |
377 |
- soapConnection->actionDomains[RETRIEVE_OIM] = newdomain; |
378 |
- soapConnection->setMBI(mbi); |
379 |
- soapConnection->getOIM(this->oim_id, this->markAsRead); |
380 |
- } |
381 |
+ Soap *soapConnection = manageSoapRedirect(response1, RETRIEVE_OIM); |
382 |
+ soapConnection->getOIM(this->oim_id, this->markAsRead); |
383 |
return; |
384 |
} |
385 |
|
386 |
- |
387 |
const char* msg = response1.getChildNode("soap:Envelope").getChildNode("soap:Body").getChildNode("GetMessageResponse").getChildNode("GetMessageResult").getText(); |
388 |
if(msg) |
389 |
{ |
390 |
@@ -2160,18 +2040,11 @@ |
391 |
void Soap::parseDeleteOIMResponse(std::string response) |
392 |
{ |
393 |
XMLNode response1 = XMLNode::parseString(response.c_str()); |
394 |
+ |
395 |
if(http_response_code == "301" ) |
396 |
{ |
397 |
- const char *preferredHostName = response1.getChildNode("soap:Envelope").getChildNode("soap:Header").getChildNode("ServiceHeader").getChildNode("PreferredHostName").getText(); |
398 |
- if(preferredHostName) |
399 |
- { |
400 |
- Soap *soapConnection = new Soap(notificationServer, sitesToAuthList); |
401 |
- |
402 |
- std::string newdomain(preferredHostName); |
403 |
- soapConnection->actionDomains[DELETE_OIM] = newdomain; |
404 |
- soapConnection->setMBI(mbi); |
405 |
- soapConnection->deleteOIM(this->oim_id); |
406 |
- } |
407 |
+ Soap *soapConnection = manageSoapRedirect(response1, DELETE_OIM); |
408 |
+ soapConnection->deleteOIM(this->oim_id); |
409 |
return; |
410 |
} |
411 |
|
412 |
@@ -2225,23 +2098,15 @@ |
413 |
void Soap::parseGetMailDataResponse(std::string response) |
414 |
{ |
415 |
XMLNode response1 = XMLNode::parseString(response.c_str()); |
416 |
- if(http_response_code == "301" ) |
417 |
- { |
418 |
- const char *preferredHostName = response1.getChildNode("soap:Envelope").getChildNode("soap:Header").getChildNode("ServiceHeader").getChildNode("PreferredHostName").getText(); |
419 |
- if(preferredHostName) |
420 |
- { |
421 |
- Soap *soapConnection = new Soap(notificationServer, sitesToAuthList); |
422 |
|
423 |
- std::string newdomain(preferredHostName); |
424 |
- soapConnection->actionDomains[RETRIEVE_OIM_MAIL_DATA] = newdomain; |
425 |
- soapConnection->setMBI(mbi); |
426 |
- soapConnection->getMailData(); |
427 |
- } |
428 |
+ if(http_response_code == "301") |
429 |
+ { |
430 |
+ Soap *soapConnection = manageSoapRedirect(response1, RETRIEVE_OIM_MAIL_DATA); |
431 |
+ soapConnection->getMailData(); |
432 |
return; |
433 |
} |
434 |
|
435 |
- |
436 |
- // oh my god! xml text as a field of a xml node! I cant believe it! |
437 |
+ // oh my god! xml text as a field of a xml node! I cant believe it! |
438 |
std::string maildata = response1.getChildNode("soap:Envelope").getChildNode("soap:Body").getChildNode("GetMetadataResponse").getChildNode("MD").createXMLString(false); |
439 |
if(maildata.empty()) |
440 |
return; // TODO - raise an error |
441 |
@@ -2349,18 +2214,11 @@ |
442 |
OIM oim = this->oim; |
443 |
// probably we need to generate a new lockkey |
444 |
XMLNode response1 = XMLNode::parseString(response.c_str()); |
445 |
- if(http_response_code == "301" ) |
446 |
- { |
447 |
- const char *preferredHostName = response1.getChildNode("soap:Envelope").getChildNode("soap:Header").getChildNode("ServiceHeader").getChildNode("PreferredHostName").getText(); |
448 |
- if(preferredHostName) |
449 |
- { |
450 |
- Soap *soapConnection = new Soap(notificationServer, sitesToAuthList); |
451 |
|
452 |
- std::string newdomain(preferredHostName); |
453 |
- soapConnection->actionDomains[GENERATE_LOCKKEY] = newdomain; |
454 |
- soapConnection->setMBI(mbi); |
455 |
- soapConnection->generateLockkey(this->oim); |
456 |
- } |
457 |
+ if(http_response_code == "301") |
458 |
+ { |
459 |
+ Soap *soapConnection = manageSoapRedirect(response1, GENERATE_LOCKKEY); |
460 |
+ soapConnection->generateLockkey(this->oim); |
461 |
return; |
462 |
} |
463 |
|
464 |
@@ -2478,18 +2336,11 @@ |
465 |
{ |
466 |
OIM oim = this->oim; |
467 |
XMLNode response1 = XMLNode::parseString(response.c_str()); |
468 |
- if(http_response_code == "301" ) |
469 |
- { |
470 |
- const char *preferredHostName = response1.getChildNode("soap:Envelope").getChildNode("soap:Header").getChildNode("ServiceHeader").getChildNode("PreferredHostName").getText(); |
471 |
- if(preferredHostName) |
472 |
- { |
473 |
- Soap *soapConnection = new Soap(notificationServer, sitesToAuthList); |
474 |
|
475 |
- std::string newdomain(preferredHostName); |
476 |
- soapConnection->actionDomains[SEND_OIM] = newdomain; |
477 |
- soapConnection->setMBI(mbi); |
478 |
- soapConnection->sendOIM(this->oim, this->lockkey); |
479 |
- } |
480 |
+ if(http_response_code == "301") |
481 |
+ { |
482 |
+ Soap *soapConnection = manageSoapRedirect(response1, SEND_OIM); |
483 |
+ soapConnection->sendOIM(this->oim, this->lockkey); |
484 |
return; |
485 |
} |
486 |
|
487 |
@@ -2576,16 +2427,8 @@ |
488 |
XMLNode response1 = XMLNode::parseString(response.c_str()); |
489 |
if(http_response_code == "301" ) |
490 |
{ |
491 |
- const char *preferredHostName = response1.getChildNode("soap:Envelope").getChildNode("soap:Header").getChildNode("ServiceHeader").getChildNode("PreferredHostName").getText(); |
492 |
- if(preferredHostName) |
493 |
- { |
494 |
- Soap *soapConnection = new Soap(notificationServer, sitesToAuthList); |
495 |
- |
496 |
- std::string newdomain(preferredHostName); |
497 |
- soapConnection->actionDomains[CHANGE_DISPLAYNAME] = newdomain; |
498 |
- soapConnection->setMBI(mbi); |
499 |
- soapConnection->changeDisplayName(this->tempDisplayName); |
500 |
- } |
501 |
+ Soap *soapConnection = manageSoapRedirect(response1, CHANGE_DISPLAYNAME); |
502 |
+ soapConnection->changeDisplayName(this->tempDisplayName); |
503 |
return; |
504 |
} |
505 |
|
506 |
@@ -2613,7 +2456,7 @@ |
507 |
return; |
508 |
|
509 |
http_header_response = this->readBuffer.substr(0,this->readBuffer.find("\r\n\r\n") + 4); |
510 |
- Message::Headers headers = Message::Headers(http_header_response); |
511 |
+ Message::Headers headers = Message::Headers(http_header_response); |
512 |
this->response_length = decimalFromString(headers["Content-Length"]); |
513 |
|
514 |
this->http_response_code = splitString(http_header_response.substr(0,http_header_response.find("\r\n"))," ")[1]; |
515 |
@@ -2698,6 +2541,34 @@ |
516 |
delete this; |
517 |
} |
518 |
|
519 |
+ Soap* Soap::manageSoapRedirect(XMLNode response1, soapAction action) |
520 |
+ { |
521 |
+ Soap *soapConnection = new Soap(notificationServer, sitesToAuthList); |
522 |
+ Message::Headers headers = Message::Headers(http_header_response); |
523 |
+ std::string newdomain; |
524 |
+ std::string location = headers["Location"]; |
525 |
+ |
526 |
+ const char *preferredHostName = response1.getChildNode("soap:Envelope").getChildNode("soap:Header").getChildNode("ServiceHeader").getChildNode("PreferredHostName").getText(); |
527 |
+ if(preferredHostName) |
528 |
+ { |
529 |
+ std::string newdomain(preferredHostName); |
530 |
+ soapConnection->actionDomains[action] = newdomain; |
531 |
+ } |
532 |
+ |
533 |
+ if (location.size()) |
534 |
+ { |
535 |
+ std::string newurl1(location); |
536 |
+ std::vector<std::string> a = splitString(newurl1, "/"); |
537 |
+ std::string newdomain = splitString(a[1], "/")[0]; |
538 |
+ soapConnection->actionDomains[action] = newdomain; |
539 |
+ std::vector<std::string> postpath = splitString(newurl1, newdomain); |
540 |
+ soapConnection->actionPOSTURLs[action] = postpath[1]; |
541 |
+ } |
542 |
+ soapConnection->setMBI(mbi); |
543 |
+ |
544 |
+ return soapConnection; |
545 |
+ } |
546 |
+ |
547 |
void Soap::disconnect() |
548 |
{ |
549 |
} |
550 |
diff -uNr libmsn-4.1/msn/soap.h msn/soap.h |
551 |
--- libmsn-4.1/msn/soap.h 2009-01-16 20:38:43.000000000 -0500 |
552 |
+++ msn/soap.h 2011-11-08 19:21:50.000000000 -0500 |
553 |
@@ -35,6 +35,8 @@ |
554 |
#include <vector> |
555 |
#include <map> |
556 |
|
557 |
+#include "xmlParser.h" |
558 |
+ |
559 |
#include "libmsn_export.h" |
560 |
|
561 |
namespace MSN |
562 |
@@ -205,6 +207,8 @@ |
563 |
|
564 |
void changeDisplayName(std::string newDisplayName); |
565 |
void parseChangeDisplayNameResponse(std::string); |
566 |
+ |
567 |
+ Soap* manageSoapRedirect(XMLNode response1, soapAction action); |
568 |
|
569 |
virtual void dispatchCommand(std::vector<std::string> &) {}; |
570 |
virtual void connect(const std::string &, unsigned int) {}; |