Mercurial > pidgin.yaz
annotate libpurple/protocols/msn/soap.c @ 23328:f06adc198c1d
Patch from tomgr and Maiku that workarounds some OS X issue,
References #5212
author | Ka-Hing Cheung <khc@hxbc.us> |
---|---|
date | Sun, 08 Jun 2008 22:52:01 +0000 |
parents | 5cdd93dac7a2 |
children | 1ac5faa72c8d |
rev | line source |
---|---|
20394
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
1 /** |
23300
5cdd93dac7a2
Delete trailing whitespace
Mark Doliner <mark@kingant.net>
parents:
22798
diff
changeset
|
2 * @file soap.c |
20394
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
3 * SOAP connection related process |
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
4 * Author |
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
5 * MaYuan<mayuan2006@gmail.com> |
20401
4ddc27c18781
Fix up some gaim -> purple issues.
Richard Laager <rlaager@wiktel.com>
parents:
20394
diff
changeset
|
6 * purple |
20394
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
7 * |
20401
4ddc27c18781
Fix up some gaim -> purple issues.
Richard Laager <rlaager@wiktel.com>
parents:
20394
diff
changeset
|
8 * Purple is the legal property of its developers, whose names are too numerous |
20394
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
9 * to list here. Please refer to the COPYRIGHT file distributed with this |
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
10 * source distribution. |
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
11 * |
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
12 * This program is free software; you can redistribute it and/or modify |
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
13 * it under the terms of the GNU General Public License as published by |
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
14 * the Free Software Foundation; either version 2 of the License, or |
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
15 * (at your option) any later version. |
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
16 * |
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
17 * This program is distributed in the hope that it will be useful, |
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
18 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
20 * GNU General Public License for more details. |
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
21 * |
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
22 * You should have received a copy of the GNU General Public License |
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
23 * along with this program; if not, write to the Free Software |
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
24 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
25 */ |
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
26 #include "msn.h" |
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
27 #include "soap.h" |
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
28 |
20759
989f5906ca17
Hylke made a new win32 installer pixmap
Sean Egan <seanegan@gmail.com>
parents:
20539
diff
changeset
|
29 #define MSN_SOAP_DEBUG |
20394
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
30 /*local function prototype*/ |
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
31 void msn_soap_set_process_step(MsnSoapConn *soapconn, MsnSoapStep step); |
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
32 |
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
33 /*setup the soap process step*/ |
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
34 void |
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
35 msn_soap_set_process_step(MsnSoapConn *soapconn, MsnSoapStep step) |
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
36 { |
20539
2c8c6d77f12c
Make use of the GQueue in MsnSoapConn to manage the SOAP requests, allowing them to work perfectly even when dispatching multiple requests at once.
Carlos Silva <typ0@pidgin.im>
parents:
20501
diff
changeset
|
37 #ifdef MSN_SOAP_DEBUG |
2c8c6d77f12c
Make use of the GQueue in MsnSoapConn to manage the SOAP requests, allowing them to work perfectly even when dispatching multiple requests at once.
Carlos Silva <typ0@pidgin.im>
parents:
20501
diff
changeset
|
38 const char *MsnSoapStepText[] = |
2c8c6d77f12c
Make use of the GQueue in MsnSoapConn to manage the SOAP requests, allowing them to work perfectly even when dispatching multiple requests at once.
Carlos Silva <typ0@pidgin.im>
parents:
20501
diff
changeset
|
39 { |
2c8c6d77f12c
Make use of the GQueue in MsnSoapConn to manage the SOAP requests, allowing them to work perfectly even when dispatching multiple requests at once.
Carlos Silva <typ0@pidgin.im>
parents:
20501
diff
changeset
|
40 "Unconnected", |
2c8c6d77f12c
Make use of the GQueue in MsnSoapConn to manage the SOAP requests, allowing them to work perfectly even when dispatching multiple requests at once.
Carlos Silva <typ0@pidgin.im>
parents:
20501
diff
changeset
|
41 "Connecting", |
2c8c6d77f12c
Make use of the GQueue in MsnSoapConn to manage the SOAP requests, allowing them to work perfectly even when dispatching multiple requests at once.
Carlos Silva <typ0@pidgin.im>
parents:
20501
diff
changeset
|
42 "Connected", |
2c8c6d77f12c
Make use of the GQueue in MsnSoapConn to manage the SOAP requests, allowing them to work perfectly even when dispatching multiple requests at once.
Carlos Silva <typ0@pidgin.im>
parents:
20501
diff
changeset
|
43 "Processing", |
2c8c6d77f12c
Make use of the GQueue in MsnSoapConn to manage the SOAP requests, allowing them to work perfectly even when dispatching multiple requests at once.
Carlos Silva <typ0@pidgin.im>
parents:
20501
diff
changeset
|
44 "Connected Idle" |
2c8c6d77f12c
Make use of the GQueue in MsnSoapConn to manage the SOAP requests, allowing them to work perfectly even when dispatching multiple requests at once.
Carlos Silva <typ0@pidgin.im>
parents:
20501
diff
changeset
|
45 }; |
2c8c6d77f12c
Make use of the GQueue in MsnSoapConn to manage the SOAP requests, allowing them to work perfectly even when dispatching multiple requests at once.
Carlos Silva <typ0@pidgin.im>
parents:
20501
diff
changeset
|
46 |
2c8c6d77f12c
Make use of the GQueue in MsnSoapConn to manage the SOAP requests, allowing them to work perfectly even when dispatching multiple requests at once.
Carlos Silva <typ0@pidgin.im>
parents:
20501
diff
changeset
|
47 purple_debug_info("MSN SOAP", "Setting SOAP process step to %s\n", MsnSoapStepText[step]); |
2c8c6d77f12c
Make use of the GQueue in MsnSoapConn to manage the SOAP requests, allowing them to work perfectly even when dispatching multiple requests at once.
Carlos Silva <typ0@pidgin.im>
parents:
20501
diff
changeset
|
48 #endif |
20394
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
49 soapconn->step = step; |
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
50 } |
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
51 |
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
52 /*new a soap connection*/ |
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
53 MsnSoapConn * |
20768
48ee7ec3426d
Cleanup the SOAP SSL flag to be a gboolean for clarity. Various sanity checks, sanity checking and I think a couple leak fixes too for the offline IM code.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
20759
diff
changeset
|
54 msn_soap_new(MsnSession *session,gpointer data, gboolean ssl) |
20394
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
55 { |
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
56 MsnSoapConn *soapconn; |
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
57 |
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
58 soapconn = g_new0(MsnSoapConn, 1); |
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
59 soapconn->session = session; |
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
60 soapconn->parent = data; |
20768
48ee7ec3426d
Cleanup the SOAP SSL flag to be a gboolean for clarity. Various sanity checks, sanity checking and I think a couple leak fixes too for the offline IM code.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
20759
diff
changeset
|
61 soapconn->ssl_conn = ssl; |
20394
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
62 |
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
63 soapconn->gsc = NULL; |
20492
f062793410b5
Reset unsigned ints to 0 instead of to -1.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
20490
diff
changeset
|
64 soapconn->input_handler = 0; |
f062793410b5
Reset unsigned ints to 0 instead of to -1.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
20490
diff
changeset
|
65 soapconn->output_handler = 0; |
20394
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
66 |
20539
2c8c6d77f12c
Make use of the GQueue in MsnSoapConn to manage the SOAP requests, allowing them to work perfectly even when dispatching multiple requests at once.
Carlos Silva <typ0@pidgin.im>
parents:
20501
diff
changeset
|
67 msn_soap_set_process_step(soapconn, MSN_SOAP_UNCONNECTED); |
20394
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
68 soapconn->soap_queue = g_queue_new(); |
20539
2c8c6d77f12c
Make use of the GQueue in MsnSoapConn to manage the SOAP requests, allowing them to work perfectly even when dispatching multiple requests at once.
Carlos Silva <typ0@pidgin.im>
parents:
20501
diff
changeset
|
69 |
20394
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
70 return soapconn; |
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
71 } |
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
72 |
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
73 /*ssl soap connect callback*/ |
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
74 void |
20401
4ddc27c18781
Fix up some gaim -> purple issues.
Richard Laager <rlaager@wiktel.com>
parents:
20394
diff
changeset
|
75 msn_soap_connect_cb(gpointer data, PurpleSslConnection *gsc, |
4ddc27c18781
Fix up some gaim -> purple issues.
Richard Laager <rlaager@wiktel.com>
parents:
20394
diff
changeset
|
76 PurpleInputCondition cond) |
20394
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
77 { |
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
78 MsnSoapConn * soapconn; |
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
79 MsnSession *session; |
20539
2c8c6d77f12c
Make use of the GQueue in MsnSoapConn to manage the SOAP requests, allowing them to work perfectly even when dispatching multiple requests at once.
Carlos Silva <typ0@pidgin.im>
parents:
20501
diff
changeset
|
80 gboolean soapconn_is_valid = FALSE; |
20394
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
81 |
20479
6a8463be5b23
Improve MSN_SOAP_DEBUG and workaround a Win32 bug which would case Pidgin to consume insane amounts of memory when printing a large string to the Debug Window.
Carlos Silva <typ0@pidgin.im>
parents:
20478
diff
changeset
|
82 purple_debug_misc("MSN SOAP","SOAP server connection established!\n"); |
20477
9a2a4a0c0003
Add the possibility to create an Address Book, useful for newly registered MSN users.
Carlos Silva <typ0@pidgin.im>
parents:
20471
diff
changeset
|
83 |
20394
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
84 soapconn = data; |
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
85 g_return_if_fail(soapconn != NULL); |
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
86 |
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
87 session = soapconn->session; |
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
88 g_return_if_fail(session != NULL); |
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
89 |
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
90 soapconn->gsc = gsc; |
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
91 |
20539
2c8c6d77f12c
Make use of the GQueue in MsnSoapConn to manage the SOAP requests, allowing them to work perfectly even when dispatching multiple requests at once.
Carlos Silva <typ0@pidgin.im>
parents:
20501
diff
changeset
|
92 msn_soap_set_process_step(soapconn, MSN_SOAP_CONNECTED); |
2c8c6d77f12c
Make use of the GQueue in MsnSoapConn to manage the SOAP requests, allowing them to work perfectly even when dispatching multiple requests at once.
Carlos Silva <typ0@pidgin.im>
parents:
20501
diff
changeset
|
93 |
20394
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
94 /*connection callback*/ |
20539
2c8c6d77f12c
Make use of the GQueue in MsnSoapConn to manage the SOAP requests, allowing them to work perfectly even when dispatching multiple requests at once.
Carlos Silva <typ0@pidgin.im>
parents:
20501
diff
changeset
|
95 if (soapconn->connect_cb != NULL) { |
2c8c6d77f12c
Make use of the GQueue in MsnSoapConn to manage the SOAP requests, allowing them to work perfectly even when dispatching multiple requests at once.
Carlos Silva <typ0@pidgin.im>
parents:
20501
diff
changeset
|
96 soapconn_is_valid = soapconn->connect_cb(soapconn, gsc); |
20394
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
97 } |
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
98 |
20539
2c8c6d77f12c
Make use of the GQueue in MsnSoapConn to manage the SOAP requests, allowing them to work perfectly even when dispatching multiple requests at once.
Carlos Silva <typ0@pidgin.im>
parents:
20501
diff
changeset
|
99 if (!soapconn_is_valid) { |
2c8c6d77f12c
Make use of the GQueue in MsnSoapConn to manage the SOAP requests, allowing them to work perfectly even when dispatching multiple requests at once.
Carlos Silva <typ0@pidgin.im>
parents:
20501
diff
changeset
|
100 return; |
2c8c6d77f12c
Make use of the GQueue in MsnSoapConn to manage the SOAP requests, allowing them to work perfectly even when dispatching multiple requests at once.
Carlos Silva <typ0@pidgin.im>
parents:
20501
diff
changeset
|
101 } |
2c8c6d77f12c
Make use of the GQueue in MsnSoapConn to manage the SOAP requests, allowing them to work perfectly even when dispatching multiple requests at once.
Carlos Silva <typ0@pidgin.im>
parents:
20501
diff
changeset
|
102 |
20394
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
103 /*we do the SOAP request here*/ |
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
104 msn_soap_post_head_request(soapconn); |
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
105 } |
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
106 |
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
107 /*ssl soap error callback*/ |
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
108 static void |
20401
4ddc27c18781
Fix up some gaim -> purple issues.
Richard Laager <rlaager@wiktel.com>
parents:
20394
diff
changeset
|
109 msn_soap_error_cb(PurpleSslConnection *gsc, PurpleSslErrorType error, void *data) |
23300
5cdd93dac7a2
Delete trailing whitespace
Mark Doliner <mark@kingant.net>
parents:
22798
diff
changeset
|
110 { |
20394
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
111 MsnSoapConn * soapconn = data; |
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
112 |
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
113 g_return_if_fail(data != NULL); |
20539
2c8c6d77f12c
Make use of the GQueue in MsnSoapConn to manage the SOAP requests, allowing them to work perfectly even when dispatching multiple requests at once.
Carlos Silva <typ0@pidgin.im>
parents:
20501
diff
changeset
|
114 |
20479
6a8463be5b23
Improve MSN_SOAP_DEBUG and workaround a Win32 bug which would case Pidgin to consume insane amounts of memory when printing a large string to the Debug Window.
Carlos Silva <typ0@pidgin.im>
parents:
20478
diff
changeset
|
115 purple_debug_warning("MSN SOAP","Soap connection error!\n"); |
20539
2c8c6d77f12c
Make use of the GQueue in MsnSoapConn to manage the SOAP requests, allowing them to work perfectly even when dispatching multiple requests at once.
Carlos Silva <typ0@pidgin.im>
parents:
20501
diff
changeset
|
116 |
20394
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
117 msn_soap_set_process_step(soapconn, MSN_SOAP_UNCONNECTED); |
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
118 |
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
119 /*error callback*/ |
20539
2c8c6d77f12c
Make use of the GQueue in MsnSoapConn to manage the SOAP requests, allowing them to work perfectly even when dispatching multiple requests at once.
Carlos Silva <typ0@pidgin.im>
parents:
20501
diff
changeset
|
120 if (soapconn->error_cb != NULL) { |
2c8c6d77f12c
Make use of the GQueue in MsnSoapConn to manage the SOAP requests, allowing them to work perfectly even when dispatching multiple requests at once.
Carlos Silva <typ0@pidgin.im>
parents:
20501
diff
changeset
|
121 soapconn->error_cb(soapconn, gsc, error); |
2c8c6d77f12c
Make use of the GQueue in MsnSoapConn to manage the SOAP requests, allowing them to work perfectly even when dispatching multiple requests at once.
Carlos Silva <typ0@pidgin.im>
parents:
20501
diff
changeset
|
122 } else { |
2c8c6d77f12c
Make use of the GQueue in MsnSoapConn to manage the SOAP requests, allowing them to work perfectly even when dispatching multiple requests at once.
Carlos Silva <typ0@pidgin.im>
parents:
20501
diff
changeset
|
123 msn_soap_post(soapconn, NULL); |
20394
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
124 } |
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
125 } |
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
126 |
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
127 /*init the soap connection*/ |
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
128 void |
20768
48ee7ec3426d
Cleanup the SOAP SSL flag to be a gboolean for clarity. Various sanity checks, sanity checking and I think a couple leak fixes too for the offline IM code.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
20759
diff
changeset
|
129 msn_soap_init(MsnSoapConn *soapconn,char * host, gboolean ssl, |
20539
2c8c6d77f12c
Make use of the GQueue in MsnSoapConn to manage the SOAP requests, allowing them to work perfectly even when dispatching multiple requests at once.
Carlos Silva <typ0@pidgin.im>
parents:
20501
diff
changeset
|
130 MsnSoapSslConnectCbFunction connect_cb, |
2c8c6d77f12c
Make use of the GQueue in MsnSoapConn to manage the SOAP requests, allowing them to work perfectly even when dispatching multiple requests at once.
Carlos Silva <typ0@pidgin.im>
parents:
20501
diff
changeset
|
131 MsnSoapSslErrorCbFunction error_cb) |
20394
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
132 { |
20479
6a8463be5b23
Improve MSN_SOAP_DEBUG and workaround a Win32 bug which would case Pidgin to consume insane amounts of memory when printing a large string to the Debug Window.
Carlos Silva <typ0@pidgin.im>
parents:
20478
diff
changeset
|
133 purple_debug_misc("MSN SOAP","Initializing SOAP connection\n"); |
20832
c6f601a8eeba
Fix leak when initializing msn soap request.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
20774
diff
changeset
|
134 g_free(soapconn->login_host); |
20394
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
135 soapconn->login_host = g_strdup(host); |
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
136 soapconn->ssl_conn = ssl; |
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
137 soapconn->connect_cb = connect_cb; |
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
138 soapconn->error_cb = error_cb; |
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
139 } |
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
140 |
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
141 /*connect the soap connection*/ |
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
142 void |
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
143 msn_soap_connect(MsnSoapConn *soapconn) |
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
144 { |
20539
2c8c6d77f12c
Make use of the GQueue in MsnSoapConn to manage the SOAP requests, allowing them to work perfectly even when dispatching multiple requests at once.
Carlos Silva <typ0@pidgin.im>
parents:
20501
diff
changeset
|
145 if (soapconn->ssl_conn) { |
20401
4ddc27c18781
Fix up some gaim -> purple issues.
Richard Laager <rlaager@wiktel.com>
parents:
20394
diff
changeset
|
146 purple_ssl_connect(soapconn->session->account, soapconn->login_host, |
4ddc27c18781
Fix up some gaim -> purple issues.
Richard Laager <rlaager@wiktel.com>
parents:
20394
diff
changeset
|
147 PURPLE_SSL_DEFAULT_PORT, msn_soap_connect_cb, msn_soap_error_cb, |
20394
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
148 soapconn); |
20539
2c8c6d77f12c
Make use of the GQueue in MsnSoapConn to manage the SOAP requests, allowing them to work perfectly even when dispatching multiple requests at once.
Carlos Silva <typ0@pidgin.im>
parents:
20501
diff
changeset
|
149 } else { |
20394
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
150 } |
20539
2c8c6d77f12c
Make use of the GQueue in MsnSoapConn to manage the SOAP requests, allowing them to work perfectly even when dispatching multiple requests at once.
Carlos Silva <typ0@pidgin.im>
parents:
20501
diff
changeset
|
151 |
2c8c6d77f12c
Make use of the GQueue in MsnSoapConn to manage the SOAP requests, allowing them to work perfectly even when dispatching multiple requests at once.
Carlos Silva <typ0@pidgin.im>
parents:
20501
diff
changeset
|
152 msn_soap_set_process_step(soapconn, MSN_SOAP_CONNECTING); |
20394
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
153 } |
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
154 |
20539
2c8c6d77f12c
Make use of the GQueue in MsnSoapConn to manage the SOAP requests, allowing them to work perfectly even when dispatching multiple requests at once.
Carlos Silva <typ0@pidgin.im>
parents:
20501
diff
changeset
|
155 |
2c8c6d77f12c
Make use of the GQueue in MsnSoapConn to manage the SOAP requests, allowing them to work perfectly even when dispatching multiple requests at once.
Carlos Silva <typ0@pidgin.im>
parents:
20501
diff
changeset
|
156 static void |
2c8c6d77f12c
Make use of the GQueue in MsnSoapConn to manage the SOAP requests, allowing them to work perfectly even when dispatching multiple requests at once.
Carlos Silva <typ0@pidgin.im>
parents:
20501
diff
changeset
|
157 msn_soap_close_handler(guint *handler) |
2c8c6d77f12c
Make use of the GQueue in MsnSoapConn to manage the SOAP requests, allowing them to work perfectly even when dispatching multiple requests at once.
Carlos Silva <typ0@pidgin.im>
parents:
20501
diff
changeset
|
158 { |
2c8c6d77f12c
Make use of the GQueue in MsnSoapConn to manage the SOAP requests, allowing them to work perfectly even when dispatching multiple requests at once.
Carlos Silva <typ0@pidgin.im>
parents:
20501
diff
changeset
|
159 if (*handler > 0) { |
2c8c6d77f12c
Make use of the GQueue in MsnSoapConn to manage the SOAP requests, allowing them to work perfectly even when dispatching multiple requests at once.
Carlos Silva <typ0@pidgin.im>
parents:
20501
diff
changeset
|
160 purple_input_remove(*handler); |
2c8c6d77f12c
Make use of the GQueue in MsnSoapConn to manage the SOAP requests, allowing them to work perfectly even when dispatching multiple requests at once.
Carlos Silva <typ0@pidgin.im>
parents:
20501
diff
changeset
|
161 *handler = 0; |
23300
5cdd93dac7a2
Delete trailing whitespace
Mark Doliner <mark@kingant.net>
parents:
22798
diff
changeset
|
162 } |
20539
2c8c6d77f12c
Make use of the GQueue in MsnSoapConn to manage the SOAP requests, allowing them to work perfectly even when dispatching multiple requests at once.
Carlos Silva <typ0@pidgin.im>
parents:
20501
diff
changeset
|
163 #ifdef MSN_SOAP_DEBUG |
2c8c6d77f12c
Make use of the GQueue in MsnSoapConn to manage the SOAP requests, allowing them to work perfectly even when dispatching multiple requests at once.
Carlos Silva <typ0@pidgin.im>
parents:
20501
diff
changeset
|
164 else { |
2c8c6d77f12c
Make use of the GQueue in MsnSoapConn to manage the SOAP requests, allowing them to work perfectly even when dispatching multiple requests at once.
Carlos Silva <typ0@pidgin.im>
parents:
20501
diff
changeset
|
165 purple_debug_misc("MSN SOAP", "Handler inactive, not removing\n"); |
2c8c6d77f12c
Make use of the GQueue in MsnSoapConn to manage the SOAP requests, allowing them to work perfectly even when dispatching multiple requests at once.
Carlos Silva <typ0@pidgin.im>
parents:
20501
diff
changeset
|
166 } |
2c8c6d77f12c
Make use of the GQueue in MsnSoapConn to manage the SOAP requests, allowing them to work perfectly even when dispatching multiple requests at once.
Carlos Silva <typ0@pidgin.im>
parents:
20501
diff
changeset
|
167 #endif |
2c8c6d77f12c
Make use of the GQueue in MsnSoapConn to manage the SOAP requests, allowing them to work perfectly even when dispatching multiple requests at once.
Carlos Silva <typ0@pidgin.im>
parents:
20501
diff
changeset
|
168 |
2c8c6d77f12c
Make use of the GQueue in MsnSoapConn to manage the SOAP requests, allowing them to work perfectly even when dispatching multiple requests at once.
Carlos Silva <typ0@pidgin.im>
parents:
20501
diff
changeset
|
169 } |
2c8c6d77f12c
Make use of the GQueue in MsnSoapConn to manage the SOAP requests, allowing them to work perfectly even when dispatching multiple requests at once.
Carlos Silva <typ0@pidgin.im>
parents:
20501
diff
changeset
|
170 |
2c8c6d77f12c
Make use of the GQueue in MsnSoapConn to manage the SOAP requests, allowing them to work perfectly even when dispatching multiple requests at once.
Carlos Silva <typ0@pidgin.im>
parents:
20501
diff
changeset
|
171 |
20394
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
172 /*close the soap connection*/ |
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
173 void |
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
174 msn_soap_close(MsnSoapConn *soapconn) |
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
175 { |
20539
2c8c6d77f12c
Make use of the GQueue in MsnSoapConn to manage the SOAP requests, allowing them to work perfectly even when dispatching multiple requests at once.
Carlos Silva <typ0@pidgin.im>
parents:
20501
diff
changeset
|
176 if (soapconn->ssl_conn) { |
2c8c6d77f12c
Make use of the GQueue in MsnSoapConn to manage the SOAP requests, allowing them to work perfectly even when dispatching multiple requests at once.
Carlos Silva <typ0@pidgin.im>
parents:
20501
diff
changeset
|
177 if (soapconn->gsc != NULL) { |
20401
4ddc27c18781
Fix up some gaim -> purple issues.
Richard Laager <rlaager@wiktel.com>
parents:
20394
diff
changeset
|
178 purple_ssl_close(soapconn->gsc); |
20394
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
179 soapconn->gsc = NULL; |
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
180 } |
20539
2c8c6d77f12c
Make use of the GQueue in MsnSoapConn to manage the SOAP requests, allowing them to work perfectly even when dispatching multiple requests at once.
Carlos Silva <typ0@pidgin.im>
parents:
20501
diff
changeset
|
181 } else { |
20394
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
182 } |
20539
2c8c6d77f12c
Make use of the GQueue in MsnSoapConn to manage the SOAP requests, allowing them to work perfectly even when dispatching multiple requests at once.
Carlos Silva <typ0@pidgin.im>
parents:
20501
diff
changeset
|
183 msn_soap_set_process_step(soapconn, MSN_SOAP_UNCONNECTED); |
20394
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
184 } |
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
185 |
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
186 /*clean the unhandled SOAP request*/ |
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
187 void |
20539
2c8c6d77f12c
Make use of the GQueue in MsnSoapConn to manage the SOAP requests, allowing them to work perfectly even when dispatching multiple requests at once.
Carlos Silva <typ0@pidgin.im>
parents:
20501
diff
changeset
|
188 msn_soap_clean_unhandled_requests(MsnSoapConn *soapconn) |
20394
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
189 { |
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
190 MsnSoapReq *request; |
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
191 |
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
192 g_return_if_fail(soapconn != NULL); |
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
193 |
20501
f6dff814d95f
cleans up ownership of soap callback data, this soap stuff is perfect
Ka-Hing Cheung <khc@hxbc.us>
parents:
20492
diff
changeset
|
194 soapconn->body = NULL; |
f6dff814d95f
cleans up ownership of soap callback data, this soap stuff is perfect
Ka-Hing Cheung <khc@hxbc.us>
parents:
20492
diff
changeset
|
195 |
20394
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
196 while ((request = g_queue_pop_head(soapconn->soap_queue)) != NULL){ |
20501
f6dff814d95f
cleans up ownership of soap callback data, this soap stuff is perfect
Ka-Hing Cheung <khc@hxbc.us>
parents:
20492
diff
changeset
|
197 if (soapconn->read_cb) { |
20539
2c8c6d77f12c
Make use of the GQueue in MsnSoapConn to manage the SOAP requests, allowing them to work perfectly even when dispatching multiple requests at once.
Carlos Silva <typ0@pidgin.im>
parents:
20501
diff
changeset
|
198 soapconn->read_cb(soapconn); |
20501
f6dff814d95f
cleans up ownership of soap callback data, this soap stuff is perfect
Ka-Hing Cheung <khc@hxbc.us>
parents:
20492
diff
changeset
|
199 } |
20394
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
200 msn_soap_request_free(request); |
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
201 } |
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
202 } |
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
203 |
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
204 /*destroy the soap connection*/ |
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
205 void |
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
206 msn_soap_destroy(MsnSoapConn *soapconn) |
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
207 { |
20832
c6f601a8eeba
Fix leak when initializing msn soap request.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
20774
diff
changeset
|
208 g_free(soapconn->login_host); |
20394
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
209 |
20832
c6f601a8eeba
Fix leak when initializing msn soap request.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
20774
diff
changeset
|
210 g_free(soapconn->login_path); |
20394
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
211 |
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
212 /*remove the write handler*/ |
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
213 if (soapconn->output_handler > 0){ |
20401
4ddc27c18781
Fix up some gaim -> purple issues.
Richard Laager <rlaager@wiktel.com>
parents:
20394
diff
changeset
|
214 purple_input_remove(soapconn->output_handler); |
20492
f062793410b5
Reset unsigned ints to 0 instead of to -1.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
20490
diff
changeset
|
215 soapconn->output_handler = 0; |
20394
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
216 } |
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
217 /*remove the read handler*/ |
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
218 if (soapconn->input_handler > 0){ |
20401
4ddc27c18781
Fix up some gaim -> purple issues.
Richard Laager <rlaager@wiktel.com>
parents:
20394
diff
changeset
|
219 purple_input_remove(soapconn->input_handler); |
20492
f062793410b5
Reset unsigned ints to 0 instead of to -1.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
20490
diff
changeset
|
220 soapconn->input_handler = 0; |
20394
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
221 } |
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
222 msn_soap_free_read_buf(soapconn); |
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
223 msn_soap_free_write_buf(soapconn); |
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
224 |
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
225 /*close ssl connection*/ |
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
226 msn_soap_close(soapconn); |
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
227 |
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
228 /*process the unhandled soap request*/ |
20539
2c8c6d77f12c
Make use of the GQueue in MsnSoapConn to manage the SOAP requests, allowing them to work perfectly even when dispatching multiple requests at once.
Carlos Silva <typ0@pidgin.im>
parents:
20501
diff
changeset
|
229 msn_soap_clean_unhandled_requests(soapconn); |
20394
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
230 |
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
231 g_queue_free(soapconn->soap_queue); |
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
232 g_free(soapconn); |
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
233 } |
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
234 |
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
235 /*check the soap is connected? |
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
236 * if connected return 1 |
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
237 */ |
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
238 int |
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
239 msn_soap_connected(MsnSoapConn *soapconn) |
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
240 { |
20539
2c8c6d77f12c
Make use of the GQueue in MsnSoapConn to manage the SOAP requests, allowing them to work perfectly even when dispatching multiple requests at once.
Carlos Silva <typ0@pidgin.im>
parents:
20501
diff
changeset
|
241 if (soapconn->ssl_conn) { |
2c8c6d77f12c
Make use of the GQueue in MsnSoapConn to manage the SOAP requests, allowing them to work perfectly even when dispatching multiple requests at once.
Carlos Silva <typ0@pidgin.im>
parents:
20501
diff
changeset
|
242 return (soapconn->gsc == NULL ? 0 : 1); |
20394
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
243 } |
20539
2c8c6d77f12c
Make use of the GQueue in MsnSoapConn to manage the SOAP requests, allowing them to work perfectly even when dispatching multiple requests at once.
Carlos Silva <typ0@pidgin.im>
parents:
20501
diff
changeset
|
244 return (soapconn->fd > 0 ? 1 : 0); |
20394
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
245 } |
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
246 |
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
247 /*read and append the content to the buffer*/ |
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
248 static gssize |
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
249 msn_soap_read(MsnSoapConn *soapconn) |
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
250 { |
20477
9a2a4a0c0003
Add the possibility to create an Address Book, useful for newly registered MSN users.
Carlos Silva <typ0@pidgin.im>
parents:
20471
diff
changeset
|
251 gssize len, requested_len; |
20394
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
252 char temp_buf[MSN_SOAP_READ_BUFF_SIZE]; |
23300
5cdd93dac7a2
Delete trailing whitespace
Mark Doliner <mark@kingant.net>
parents:
22798
diff
changeset
|
253 |
20477
9a2a4a0c0003
Add the possibility to create an Address Book, useful for newly registered MSN users.
Carlos Silva <typ0@pidgin.im>
parents:
20471
diff
changeset
|
254 if ( soapconn->need_to_read == 0 || soapconn->need_to_read > MSN_SOAP_READ_BUFF_SIZE) { |
9a2a4a0c0003
Add the possibility to create an Address Book, useful for newly registered MSN users.
Carlos Silva <typ0@pidgin.im>
parents:
20471
diff
changeset
|
255 requested_len = MSN_SOAP_READ_BUFF_SIZE; |
9a2a4a0c0003
Add the possibility to create an Address Book, useful for newly registered MSN users.
Carlos Silva <typ0@pidgin.im>
parents:
20471
diff
changeset
|
256 } |
9a2a4a0c0003
Add the possibility to create an Address Book, useful for newly registered MSN users.
Carlos Silva <typ0@pidgin.im>
parents:
20471
diff
changeset
|
257 else { |
9a2a4a0c0003
Add the possibility to create an Address Book, useful for newly registered MSN users.
Carlos Silva <typ0@pidgin.im>
parents:
20471
diff
changeset
|
258 requested_len = soapconn->need_to_read; |
9a2a4a0c0003
Add the possibility to create an Address Book, useful for newly registered MSN users.
Carlos Silva <typ0@pidgin.im>
parents:
20471
diff
changeset
|
259 } |
9a2a4a0c0003
Add the possibility to create an Address Book, useful for newly registered MSN users.
Carlos Silva <typ0@pidgin.im>
parents:
20471
diff
changeset
|
260 |
9a2a4a0c0003
Add the possibility to create an Address Book, useful for newly registered MSN users.
Carlos Silva <typ0@pidgin.im>
parents:
20471
diff
changeset
|
261 if ( soapconn->ssl_conn ) { |
9a2a4a0c0003
Add the possibility to create an Address Book, useful for newly registered MSN users.
Carlos Silva <typ0@pidgin.im>
parents:
20471
diff
changeset
|
262 len = purple_ssl_read(soapconn->gsc, temp_buf, requested_len); |
9a2a4a0c0003
Add the possibility to create an Address Book, useful for newly registered MSN users.
Carlos Silva <typ0@pidgin.im>
parents:
20471
diff
changeset
|
263 } else { |
9a2a4a0c0003
Add the possibility to create an Address Book, useful for newly registered MSN users.
Carlos Silva <typ0@pidgin.im>
parents:
20471
diff
changeset
|
264 len = read(soapconn->fd, temp_buf, requested_len); |
9a2a4a0c0003
Add the possibility to create an Address Book, useful for newly registered MSN users.
Carlos Silva <typ0@pidgin.im>
parents:
20471
diff
changeset
|
265 } |
9a2a4a0c0003
Add the possibility to create an Address Book, useful for newly registered MSN users.
Carlos Silva <typ0@pidgin.im>
parents:
20471
diff
changeset
|
266 |
23300
5cdd93dac7a2
Delete trailing whitespace
Mark Doliner <mark@kingant.net>
parents:
22798
diff
changeset
|
267 |
20477
9a2a4a0c0003
Add the possibility to create an Address Book, useful for newly registered MSN users.
Carlos Silva <typ0@pidgin.im>
parents:
20471
diff
changeset
|
268 if ( len <= 0 ) { |
9a2a4a0c0003
Add the possibility to create an Address Book, useful for newly registered MSN users.
Carlos Silva <typ0@pidgin.im>
parents:
20471
diff
changeset
|
269 switch (errno) { |
20394
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
270 |
20477
9a2a4a0c0003
Add the possibility to create an Address Book, useful for newly registered MSN users.
Carlos Silva <typ0@pidgin.im>
parents:
20471
diff
changeset
|
271 case 0: |
9a2a4a0c0003
Add the possibility to create an Address Book, useful for newly registered MSN users.
Carlos Silva <typ0@pidgin.im>
parents:
20471
diff
changeset
|
272 case EBADF: /* we are sometimes getting this in Windows */ |
20479
6a8463be5b23
Improve MSN_SOAP_DEBUG and workaround a Win32 bug which would case Pidgin to consume insane amounts of memory when printing a large string to the Debug Window.
Carlos Silva <typ0@pidgin.im>
parents:
20478
diff
changeset
|
273 case EAGAIN: return len; |
6a8463be5b23
Improve MSN_SOAP_DEBUG and workaround a Win32 bug which would case Pidgin to consume insane amounts of memory when printing a large string to the Debug Window.
Carlos Silva <typ0@pidgin.im>
parents:
20478
diff
changeset
|
274 |
20477
9a2a4a0c0003
Add the possibility to create an Address Book, useful for newly registered MSN users.
Carlos Silva <typ0@pidgin.im>
parents:
20471
diff
changeset
|
275 default : purple_debug_error("MSN SOAP", "Read error!" |
22798
05cb3f04c01e
This cleans up a bunch of warnings that stem from the fact that size_t and
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
21866
diff
changeset
|
276 "read len: %" G_GSSIZE_FORMAT ", error = %s\n", |
21121
35b4f1dc4c8d
replace most calls to strerror with calls to g_strerror. strerror will return
Nathan Walp <nwalp@pidgin.im>
parents:
21102
diff
changeset
|
277 len, g_strerror(errno)); |
20477
9a2a4a0c0003
Add the possibility to create an Address Book, useful for newly registered MSN users.
Carlos Silva <typ0@pidgin.im>
parents:
20471
diff
changeset
|
278 purple_input_remove(soapconn->input_handler); |
20539
2c8c6d77f12c
Make use of the GQueue in MsnSoapConn to manage the SOAP requests, allowing them to work perfectly even when dispatching multiple requests at once.
Carlos Silva <typ0@pidgin.im>
parents:
20501
diff
changeset
|
279 //soapconn->input_handler = 0; |
20477
9a2a4a0c0003
Add the possibility to create an Address Book, useful for newly registered MSN users.
Carlos Silva <typ0@pidgin.im>
parents:
20471
diff
changeset
|
280 g_free(soapconn->read_buf); |
9a2a4a0c0003
Add the possibility to create an Address Book, useful for newly registered MSN users.
Carlos Silva <typ0@pidgin.im>
parents:
20471
diff
changeset
|
281 soapconn->read_buf = NULL; |
9a2a4a0c0003
Add the possibility to create an Address Book, useful for newly registered MSN users.
Carlos Silva <typ0@pidgin.im>
parents:
20471
diff
changeset
|
282 soapconn->read_len = 0; |
9a2a4a0c0003
Add the possibility to create an Address Book, useful for newly registered MSN users.
Carlos Silva <typ0@pidgin.im>
parents:
20471
diff
changeset
|
283 /* TODO: error handling */ |
9a2a4a0c0003
Add the possibility to create an Address Book, useful for newly registered MSN users.
Carlos Silva <typ0@pidgin.im>
parents:
20471
diff
changeset
|
284 return len; |
9a2a4a0c0003
Add the possibility to create an Address Book, useful for newly registered MSN users.
Carlos Silva <typ0@pidgin.im>
parents:
20471
diff
changeset
|
285 } |
20394
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
286 } |
20477
9a2a4a0c0003
Add the possibility to create an Address Book, useful for newly registered MSN users.
Carlos Silva <typ0@pidgin.im>
parents:
20471
diff
changeset
|
287 else { |
20394
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
288 soapconn->read_buf = g_realloc(soapconn->read_buf, |
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
289 soapconn->read_len + len + 1); |
20477
9a2a4a0c0003
Add the possibility to create an Address Book, useful for newly registered MSN users.
Carlos Silva <typ0@pidgin.im>
parents:
20471
diff
changeset
|
290 if ( soapconn->read_buf != NULL ) { |
9a2a4a0c0003
Add the possibility to create an Address Book, useful for newly registered MSN users.
Carlos Silva <typ0@pidgin.im>
parents:
20471
diff
changeset
|
291 memcpy(soapconn->read_buf + soapconn->read_len, temp_buf, len); |
9a2a4a0c0003
Add the possibility to create an Address Book, useful for newly registered MSN users.
Carlos Silva <typ0@pidgin.im>
parents:
20471
diff
changeset
|
292 soapconn->read_len += len; |
9a2a4a0c0003
Add the possibility to create an Address Book, useful for newly registered MSN users.
Carlos Silva <typ0@pidgin.im>
parents:
20471
diff
changeset
|
293 soapconn->read_buf[soapconn->read_len] = '\0'; |
9a2a4a0c0003
Add the possibility to create an Address Book, useful for newly registered MSN users.
Carlos Silva <typ0@pidgin.im>
parents:
20471
diff
changeset
|
294 } |
9a2a4a0c0003
Add the possibility to create an Address Book, useful for newly registered MSN users.
Carlos Silva <typ0@pidgin.im>
parents:
20471
diff
changeset
|
295 else { |
22798
05cb3f04c01e
This cleans up a bunch of warnings that stem from the fact that size_t and
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
21866
diff
changeset
|
296 purple_debug_error("MSN SOAP", |
05cb3f04c01e
This cleans up a bunch of warnings that stem from the fact that size_t and
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
21866
diff
changeset
|
297 "Failure re-allocating %" G_GSIZE_FORMAT " bytes of memory!\n", |
05cb3f04c01e
This cleans up a bunch of warnings that stem from the fact that size_t and
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
21866
diff
changeset
|
298 soapconn->read_len + len + 1); |
20477
9a2a4a0c0003
Add the possibility to create an Address Book, useful for newly registered MSN users.
Carlos Silva <typ0@pidgin.im>
parents:
20471
diff
changeset
|
299 exit(EXIT_FAILURE); |
9a2a4a0c0003
Add the possibility to create an Address Book, useful for newly registered MSN users.
Carlos Silva <typ0@pidgin.im>
parents:
20471
diff
changeset
|
300 } |
23300
5cdd93dac7a2
Delete trailing whitespace
Mark Doliner <mark@kingant.net>
parents:
22798
diff
changeset
|
301 |
20394
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
302 } |
20477
9a2a4a0c0003
Add the possibility to create an Address Book, useful for newly registered MSN users.
Carlos Silva <typ0@pidgin.im>
parents:
20471
diff
changeset
|
303 |
20479
6a8463be5b23
Improve MSN_SOAP_DEBUG and workaround a Win32 bug which would case Pidgin to consume insane amounts of memory when printing a large string to the Debug Window.
Carlos Silva <typ0@pidgin.im>
parents:
20478
diff
changeset
|
304 #if defined(MSN_SOAP_DEBUG) |
6a8463be5b23
Improve MSN_SOAP_DEBUG and workaround a Win32 bug which would case Pidgin to consume insane amounts of memory when printing a large string to the Debug Window.
Carlos Silva <typ0@pidgin.im>
parents:
20478
diff
changeset
|
305 if (len > 0) |
22798
05cb3f04c01e
This cleans up a bunch of warnings that stem from the fact that size_t and
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
21866
diff
changeset
|
306 purple_debug_info("MSN SOAP", |
05cb3f04c01e
This cleans up a bunch of warnings that stem from the fact that size_t and
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
21866
diff
changeset
|
307 "Read %" G_GSIZE_FORMAT " bytes from SOAP server:\n%s\n", len, |
05cb3f04c01e
This cleans up a bunch of warnings that stem from the fact that size_t and
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
21866
diff
changeset
|
308 soapconn->read_buf + soapconn->read_len - len); |
20479
6a8463be5b23
Improve MSN_SOAP_DEBUG and workaround a Win32 bug which would case Pidgin to consume insane amounts of memory when printing a large string to the Debug Window.
Carlos Silva <typ0@pidgin.im>
parents:
20478
diff
changeset
|
309 #endif |
20477
9a2a4a0c0003
Add the possibility to create an Address Book, useful for newly registered MSN users.
Carlos Silva <typ0@pidgin.im>
parents:
20471
diff
changeset
|
310 |
20394
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
311 return len; |
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
312 } |
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
313 |
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
314 /*read the whole SOAP server response*/ |
23300
5cdd93dac7a2
Delete trailing whitespace
Mark Doliner <mark@kingant.net>
parents:
22798
diff
changeset
|
315 static void |
20401
4ddc27c18781
Fix up some gaim -> purple issues.
Richard Laager <rlaager@wiktel.com>
parents:
20394
diff
changeset
|
316 msn_soap_read_cb(gpointer data, gint source, PurpleInputCondition cond) |
20394
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
317 { |
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
318 MsnSoapConn *soapconn = data; |
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
319 MsnSession *session; |
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
320 int len; |
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
321 char * body_start,*body_len; |
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
322 char *length_start,*length_end; |
20477
9a2a4a0c0003
Add the possibility to create an Address Book, useful for newly registered MSN users.
Carlos Silva <typ0@pidgin.im>
parents:
20471
diff
changeset
|
323 #ifdef MSN_SOAP_DEBUG |
20479
6a8463be5b23
Improve MSN_SOAP_DEBUG and workaround a Win32 bug which would case Pidgin to consume insane amounts of memory when printing a large string to the Debug Window.
Carlos Silva <typ0@pidgin.im>
parents:
20478
diff
changeset
|
324 #if !defined(_WIN32) |
6a8463be5b23
Improve MSN_SOAP_DEBUG and workaround a Win32 bug which would case Pidgin to consume insane amounts of memory when printing a large string to the Debug Window.
Carlos Silva <typ0@pidgin.im>
parents:
20478
diff
changeset
|
325 gchar * formattedxml = NULL; |
6a8463be5b23
Improve MSN_SOAP_DEBUG and workaround a Win32 bug which would case Pidgin to consume insane amounts of memory when printing a large string to the Debug Window.
Carlos Silva <typ0@pidgin.im>
parents:
20478
diff
changeset
|
326 gchar * http_headers = NULL; |
6a8463be5b23
Improve MSN_SOAP_DEBUG and workaround a Win32 bug which would case Pidgin to consume insane amounts of memory when printing a large string to the Debug Window.
Carlos Silva <typ0@pidgin.im>
parents:
20478
diff
changeset
|
327 xmlnode * node = NULL; |
6a8463be5b23
Improve MSN_SOAP_DEBUG and workaround a Win32 bug which would case Pidgin to consume insane amounts of memory when printing a large string to the Debug Window.
Carlos Silva <typ0@pidgin.im>
parents:
20478
diff
changeset
|
328 #endif |
20477
9a2a4a0c0003
Add the possibility to create an Address Book, useful for newly registered MSN users.
Carlos Silva <typ0@pidgin.im>
parents:
20471
diff
changeset
|
329 purple_debug_misc("MSN SOAP", "msn_soap_read_cb()\n"); |
9a2a4a0c0003
Add the possibility to create an Address Book, useful for newly registered MSN users.
Carlos Silva <typ0@pidgin.im>
parents:
20471
diff
changeset
|
330 #endif |
20394
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
331 session = soapconn->session; |
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
332 g_return_if_fail(session != NULL); |
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
333 |
23300
5cdd93dac7a2
Delete trailing whitespace
Mark Doliner <mark@kingant.net>
parents:
22798
diff
changeset
|
334 |
20394
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
335 /*read the request header*/ |
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
336 len = msn_soap_read(soapconn); |
23300
5cdd93dac7a2
Delete trailing whitespace
Mark Doliner <mark@kingant.net>
parents:
22798
diff
changeset
|
337 |
20477
9a2a4a0c0003
Add the possibility to create an Address Book, useful for newly registered MSN users.
Carlos Silva <typ0@pidgin.im>
parents:
20471
diff
changeset
|
338 if ( len < 0 ) |
20394
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
339 return; |
20477
9a2a4a0c0003
Add the possibility to create an Address Book, useful for newly registered MSN users.
Carlos Silva <typ0@pidgin.im>
parents:
20471
diff
changeset
|
340 |
9a2a4a0c0003
Add the possibility to create an Address Book, useful for newly registered MSN users.
Carlos Silva <typ0@pidgin.im>
parents:
20471
diff
changeset
|
341 if (soapconn->read_buf == NULL) { |
20394
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
342 return; |
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
343 } |
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
344 |
23300
5cdd93dac7a2
Delete trailing whitespace
Mark Doliner <mark@kingant.net>
parents:
22798
diff
changeset
|
345 if ( (strstr(soapconn->read_buf, "HTTP/1.1 302") != NULL) |
20477
9a2a4a0c0003
Add the possibility to create an Address Book, useful for newly registered MSN users.
Carlos Silva <typ0@pidgin.im>
parents:
20471
diff
changeset
|
346 || ( strstr(soapconn->read_buf, "HTTP/1.1 301") != NULL ) ) |
20394
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
347 { |
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
348 /* Redirect. */ |
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
349 char *location, *c; |
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
350 |
20477
9a2a4a0c0003
Add the possibility to create an Address Book, useful for newly registered MSN users.
Carlos Silva <typ0@pidgin.im>
parents:
20471
diff
changeset
|
351 purple_debug_info("MSN SOAP", "HTTP Redirect\n"); |
20394
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
352 location = strstr(soapconn->read_buf, "Location: "); |
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
353 if (location == NULL) |
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
354 { |
20539
2c8c6d77f12c
Make use of the GQueue in MsnSoapConn to manage the SOAP requests, allowing them to work perfectly even when dispatching multiple requests at once.
Carlos Silva <typ0@pidgin.im>
parents:
20501
diff
changeset
|
355 c = (char *) g_strstr_len(soapconn->read_buf, soapconn->read_len,"\r\n\r\n"); |
2c8c6d77f12c
Make use of the GQueue in MsnSoapConn to manage the SOAP requests, allowing them to work perfectly even when dispatching multiple requests at once.
Carlos Silva <typ0@pidgin.im>
parents:
20501
diff
changeset
|
356 if (c != NULL) { |
2c8c6d77f12c
Make use of the GQueue in MsnSoapConn to manage the SOAP requests, allowing them to work perfectly even when dispatching multiple requests at once.
Carlos Silva <typ0@pidgin.im>
parents:
20501
diff
changeset
|
357 /* we have read the whole HTTP headers and found no Location: */ |
2c8c6d77f12c
Make use of the GQueue in MsnSoapConn to manage the SOAP requests, allowing them to work perfectly even when dispatching multiple requests at once.
Carlos Silva <typ0@pidgin.im>
parents:
20501
diff
changeset
|
358 msn_soap_free_read_buf(soapconn); |
2c8c6d77f12c
Make use of the GQueue in MsnSoapConn to manage the SOAP requests, allowing them to work perfectly even when dispatching multiple requests at once.
Carlos Silva <typ0@pidgin.im>
parents:
20501
diff
changeset
|
359 msn_soap_post(soapconn, NULL); |
2c8c6d77f12c
Make use of the GQueue in MsnSoapConn to manage the SOAP requests, allowing them to work perfectly even when dispatching multiple requests at once.
Carlos Silva <typ0@pidgin.im>
parents:
20501
diff
changeset
|
360 } |
20394
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
361 |
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
362 return; |
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
363 } |
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
364 location = strchr(location, ' ') + 1; |
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
365 |
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
366 if ((c = strchr(location, '\r')) != NULL) |
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
367 *c = '\0'; |
20539
2c8c6d77f12c
Make use of the GQueue in MsnSoapConn to manage the SOAP requests, allowing them to work perfectly even when dispatching multiple requests at once.
Carlos Silva <typ0@pidgin.im>
parents:
20501
diff
changeset
|
368 else |
2c8c6d77f12c
Make use of the GQueue in MsnSoapConn to manage the SOAP requests, allowing them to work perfectly even when dispatching multiple requests at once.
Carlos Silva <typ0@pidgin.im>
parents:
20501
diff
changeset
|
369 return; |
20394
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
370 |
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
371 /* Skip the http:// */ |
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
372 if ((c = strchr(location, '/')) != NULL) |
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
373 location = c + 2; |
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
374 |
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
375 if ((c = strchr(location, '/')) != NULL) |
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
376 { |
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
377 g_free(soapconn->login_path); |
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
378 soapconn->login_path = g_strdup(c); |
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
379 |
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
380 *c = '\0'; |
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
381 } |
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
382 |
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
383 g_free(soapconn->login_host); |
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
384 soapconn->login_host = g_strdup(location); |
23300
5cdd93dac7a2
Delete trailing whitespace
Mark Doliner <mark@kingant.net>
parents:
22798
diff
changeset
|
385 |
20539
2c8c6d77f12c
Make use of the GQueue in MsnSoapConn to manage the SOAP requests, allowing them to work perfectly even when dispatching multiple requests at once.
Carlos Silva <typ0@pidgin.im>
parents:
20501
diff
changeset
|
386 msn_soap_close_handler( &(soapconn->input_handler) ); |
2c8c6d77f12c
Make use of the GQueue in MsnSoapConn to manage the SOAP requests, allowing them to work perfectly even when dispatching multiple requests at once.
Carlos Silva <typ0@pidgin.im>
parents:
20501
diff
changeset
|
387 msn_soap_close(soapconn); |
20394
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
388 |
20539
2c8c6d77f12c
Make use of the GQueue in MsnSoapConn to manage the SOAP requests, allowing them to work perfectly even when dispatching multiple requests at once.
Carlos Silva <typ0@pidgin.im>
parents:
20501
diff
changeset
|
389 if (purple_ssl_connect(session->account, soapconn->login_host, |
20401
4ddc27c18781
Fix up some gaim -> purple issues.
Richard Laager <rlaager@wiktel.com>
parents:
20394
diff
changeset
|
390 PURPLE_SSL_DEFAULT_PORT, msn_soap_connect_cb, |
20539
2c8c6d77f12c
Make use of the GQueue in MsnSoapConn to manage the SOAP requests, allowing them to work perfectly even when dispatching multiple requests at once.
Carlos Silva <typ0@pidgin.im>
parents:
20501
diff
changeset
|
391 msn_soap_error_cb, soapconn) == NULL) { |
23300
5cdd93dac7a2
Delete trailing whitespace
Mark Doliner <mark@kingant.net>
parents:
22798
diff
changeset
|
392 |
20539
2c8c6d77f12c
Make use of the GQueue in MsnSoapConn to manage the SOAP requests, allowing them to work perfectly even when dispatching multiple requests at once.
Carlos Silva <typ0@pidgin.im>
parents:
20501
diff
changeset
|
393 purple_debug_error("MSN SOAP", "Unable to connect to %s !\n", soapconn->login_host); |
2c8c6d77f12c
Make use of the GQueue in MsnSoapConn to manage the SOAP requests, allowing them to work perfectly even when dispatching multiple requests at once.
Carlos Silva <typ0@pidgin.im>
parents:
20501
diff
changeset
|
394 // dispatch next request |
2c8c6d77f12c
Make use of the GQueue in MsnSoapConn to manage the SOAP requests, allowing them to work perfectly even when dispatching multiple requests at once.
Carlos Silva <typ0@pidgin.im>
parents:
20501
diff
changeset
|
395 msn_soap_post(soapconn, NULL); |
2c8c6d77f12c
Make use of the GQueue in MsnSoapConn to manage the SOAP requests, allowing them to work perfectly even when dispatching multiple requests at once.
Carlos Silva <typ0@pidgin.im>
parents:
20501
diff
changeset
|
396 } |
20394
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
397 } |
20416
4c5d68e93ef8
Handles SOAP redirects, thanks Sebasti«¡n E. Peyrott
Ka-Hing Cheung <khc@hxbc.us>
parents:
20404
diff
changeset
|
398 /* Another case of redirection, active on May, 2007 |
4c5d68e93ef8
Handles SOAP redirects, thanks Sebasti«¡n E. Peyrott
Ka-Hing Cheung <khc@hxbc.us>
parents:
20404
diff
changeset
|
399 See http://msnpiki.msnfanatic.com/index.php/MSNP13:SOAPTweener#Redirect |
4c5d68e93ef8
Handles SOAP redirects, thanks Sebasti«¡n E. Peyrott
Ka-Hing Cheung <khc@hxbc.us>
parents:
20404
diff
changeset
|
400 */ |
4c5d68e93ef8
Handles SOAP redirects, thanks Sebasti«¡n E. Peyrott
Ka-Hing Cheung <khc@hxbc.us>
parents:
20404
diff
changeset
|
401 else if (strstr(soapconn->read_buf, |
4c5d68e93ef8
Handles SOAP redirects, thanks Sebasti«¡n E. Peyrott
Ka-Hing Cheung <khc@hxbc.us>
parents:
20404
diff
changeset
|
402 "<faultcode>psf:Redirect</faultcode>") != NULL) |
4c5d68e93ef8
Handles SOAP redirects, thanks Sebasti«¡n E. Peyrott
Ka-Hing Cheung <khc@hxbc.us>
parents:
20404
diff
changeset
|
403 { |
4c5d68e93ef8
Handles SOAP redirects, thanks Sebasti«¡n E. Peyrott
Ka-Hing Cheung <khc@hxbc.us>
parents:
20404
diff
changeset
|
404 char *location, *c; |
4c5d68e93ef8
Handles SOAP redirects, thanks Sebasti«¡n E. Peyrott
Ka-Hing Cheung <khc@hxbc.us>
parents:
20404
diff
changeset
|
405 |
20539
2c8c6d77f12c
Make use of the GQueue in MsnSoapConn to manage the SOAP requests, allowing them to work perfectly even when dispatching multiple requests at once.
Carlos Silva <typ0@pidgin.im>
parents:
20501
diff
changeset
|
406 if ( (location = strstr(soapconn->read_buf, "<psf:redirectUrl>") ) == NULL) |
2c8c6d77f12c
Make use of the GQueue in MsnSoapConn to manage the SOAP requests, allowing them to work perfectly even when dispatching multiple requests at once.
Carlos Silva <typ0@pidgin.im>
parents:
20501
diff
changeset
|
407 return; |
2c8c6d77f12c
Make use of the GQueue in MsnSoapConn to manage the SOAP requests, allowing them to work perfectly even when dispatching multiple requests at once.
Carlos Silva <typ0@pidgin.im>
parents:
20501
diff
changeset
|
408 |
20416
4c5d68e93ef8
Handles SOAP redirects, thanks Sebasti«¡n E. Peyrott
Ka-Hing Cheung <khc@hxbc.us>
parents:
20404
diff
changeset
|
409 /* Omit the tag preceding the URL */ |
4c5d68e93ef8
Handles SOAP redirects, thanks Sebasti«¡n E. Peyrott
Ka-Hing Cheung <khc@hxbc.us>
parents:
20404
diff
changeset
|
410 location += strlen("<psf:redirectUrl>"); |
20539
2c8c6d77f12c
Make use of the GQueue in MsnSoapConn to manage the SOAP requests, allowing them to work perfectly even when dispatching multiple requests at once.
Carlos Silva <typ0@pidgin.im>
parents:
20501
diff
changeset
|
411 if (location > soapconn->read_buf + soapconn->read_len) |
20416
4c5d68e93ef8
Handles SOAP redirects, thanks Sebasti«¡n E. Peyrott
Ka-Hing Cheung <khc@hxbc.us>
parents:
20404
diff
changeset
|
412 return; |
20539
2c8c6d77f12c
Make use of the GQueue in MsnSoapConn to manage the SOAP requests, allowing them to work perfectly even when dispatching multiple requests at once.
Carlos Silva <typ0@pidgin.im>
parents:
20501
diff
changeset
|
413 if ( (location = strstr(location, "://")) == NULL) |
2c8c6d77f12c
Make use of the GQueue in MsnSoapConn to manage the SOAP requests, allowing them to work perfectly even when dispatching multiple requests at once.
Carlos Silva <typ0@pidgin.im>
parents:
20501
diff
changeset
|
414 return; |
20416
4c5d68e93ef8
Handles SOAP redirects, thanks Sebasti«¡n E. Peyrott
Ka-Hing Cheung <khc@hxbc.us>
parents:
20404
diff
changeset
|
415 |
4c5d68e93ef8
Handles SOAP redirects, thanks Sebasti«¡n E. Peyrott
Ka-Hing Cheung <khc@hxbc.us>
parents:
20404
diff
changeset
|
416 location += strlen("://"); /* Skip http:// or https:// */ |
4c5d68e93ef8
Handles SOAP redirects, thanks Sebasti«¡n E. Peyrott
Ka-Hing Cheung <khc@hxbc.us>
parents:
20404
diff
changeset
|
417 |
4c5d68e93ef8
Handles SOAP redirects, thanks Sebasti«¡n E. Peyrott
Ka-Hing Cheung <khc@hxbc.us>
parents:
20404
diff
changeset
|
418 if ( (c = strstr(location, "</psf:redirectUrl>")) != NULL ) |
4c5d68e93ef8
Handles SOAP redirects, thanks Sebasti«¡n E. Peyrott
Ka-Hing Cheung <khc@hxbc.us>
parents:
20404
diff
changeset
|
419 *c = '\0'; |
20539
2c8c6d77f12c
Make use of the GQueue in MsnSoapConn to manage the SOAP requests, allowing them to work perfectly even when dispatching multiple requests at once.
Carlos Silva <typ0@pidgin.im>
parents:
20501
diff
changeset
|
420 else |
2c8c6d77f12c
Make use of the GQueue in MsnSoapConn to manage the SOAP requests, allowing them to work perfectly even when dispatching multiple requests at once.
Carlos Silva <typ0@pidgin.im>
parents:
20501
diff
changeset
|
421 return; |
20416
4c5d68e93ef8
Handles SOAP redirects, thanks Sebasti«¡n E. Peyrott
Ka-Hing Cheung <khc@hxbc.us>
parents:
20404
diff
changeset
|
422 |
4c5d68e93ef8
Handles SOAP redirects, thanks Sebasti«¡n E. Peyrott
Ka-Hing Cheung <khc@hxbc.us>
parents:
20404
diff
changeset
|
423 if ( (c = strstr(location, "/")) != NULL ) |
4c5d68e93ef8
Handles SOAP redirects, thanks Sebasti«¡n E. Peyrott
Ka-Hing Cheung <khc@hxbc.us>
parents:
20404
diff
changeset
|
424 { |
4c5d68e93ef8
Handles SOAP redirects, thanks Sebasti«¡n E. Peyrott
Ka-Hing Cheung <khc@hxbc.us>
parents:
20404
diff
changeset
|
425 g_free(soapconn->login_path); |
4c5d68e93ef8
Handles SOAP redirects, thanks Sebasti«¡n E. Peyrott
Ka-Hing Cheung <khc@hxbc.us>
parents:
20404
diff
changeset
|
426 soapconn->login_path = g_strdup(c); |
4c5d68e93ef8
Handles SOAP redirects, thanks Sebasti«¡n E. Peyrott
Ka-Hing Cheung <khc@hxbc.us>
parents:
20404
diff
changeset
|
427 *c = '\0'; |
4c5d68e93ef8
Handles SOAP redirects, thanks Sebasti«¡n E. Peyrott
Ka-Hing Cheung <khc@hxbc.us>
parents:
20404
diff
changeset
|
428 } |
4c5d68e93ef8
Handles SOAP redirects, thanks Sebasti«¡n E. Peyrott
Ka-Hing Cheung <khc@hxbc.us>
parents:
20404
diff
changeset
|
429 |
4c5d68e93ef8
Handles SOAP redirects, thanks Sebasti«¡n E. Peyrott
Ka-Hing Cheung <khc@hxbc.us>
parents:
20404
diff
changeset
|
430 g_free(soapconn->login_host); |
4c5d68e93ef8
Handles SOAP redirects, thanks Sebasti«¡n E. Peyrott
Ka-Hing Cheung <khc@hxbc.us>
parents:
20404
diff
changeset
|
431 soapconn->login_host = g_strdup(location); |
23300
5cdd93dac7a2
Delete trailing whitespace
Mark Doliner <mark@kingant.net>
parents:
22798
diff
changeset
|
432 |
20539
2c8c6d77f12c
Make use of the GQueue in MsnSoapConn to manage the SOAP requests, allowing them to work perfectly even when dispatching multiple requests at once.
Carlos Silva <typ0@pidgin.im>
parents:
20501
diff
changeset
|
433 msn_soap_close_handler( &(soapconn->input_handler) ); |
2c8c6d77f12c
Make use of the GQueue in MsnSoapConn to manage the SOAP requests, allowing them to work perfectly even when dispatching multiple requests at once.
Carlos Silva <typ0@pidgin.im>
parents:
20501
diff
changeset
|
434 msn_soap_close(soapconn); |
20416
4c5d68e93ef8
Handles SOAP redirects, thanks Sebasti«¡n E. Peyrott
Ka-Hing Cheung <khc@hxbc.us>
parents:
20404
diff
changeset
|
435 |
20539
2c8c6d77f12c
Make use of the GQueue in MsnSoapConn to manage the SOAP requests, allowing them to work perfectly even when dispatching multiple requests at once.
Carlos Silva <typ0@pidgin.im>
parents:
20501
diff
changeset
|
436 if (purple_ssl_connect(session->account, soapconn->login_host, |
2c8c6d77f12c
Make use of the GQueue in MsnSoapConn to manage the SOAP requests, allowing them to work perfectly even when dispatching multiple requests at once.
Carlos Silva <typ0@pidgin.im>
parents:
20501
diff
changeset
|
437 PURPLE_SSL_DEFAULT_PORT, msn_soap_connect_cb, |
2c8c6d77f12c
Make use of the GQueue in MsnSoapConn to manage the SOAP requests, allowing them to work perfectly even when dispatching multiple requests at once.
Carlos Silva <typ0@pidgin.im>
parents:
20501
diff
changeset
|
438 msn_soap_error_cb, soapconn) == NULL) { |
2c8c6d77f12c
Make use of the GQueue in MsnSoapConn to manage the SOAP requests, allowing them to work perfectly even when dispatching multiple requests at once.
Carlos Silva <typ0@pidgin.im>
parents:
20501
diff
changeset
|
439 |
2c8c6d77f12c
Make use of the GQueue in MsnSoapConn to manage the SOAP requests, allowing them to work perfectly even when dispatching multiple requests at once.
Carlos Silva <typ0@pidgin.im>
parents:
20501
diff
changeset
|
440 purple_debug_error("MSN SOAP", "Unable to connect to %s !\n", soapconn->login_host); |
2c8c6d77f12c
Make use of the GQueue in MsnSoapConn to manage the SOAP requests, allowing them to work perfectly even when dispatching multiple requests at once.
Carlos Silva <typ0@pidgin.im>
parents:
20501
diff
changeset
|
441 // dispatch next request |
2c8c6d77f12c
Make use of the GQueue in MsnSoapConn to manage the SOAP requests, allowing them to work perfectly even when dispatching multiple requests at once.
Carlos Silva <typ0@pidgin.im>
parents:
20501
diff
changeset
|
442 msn_soap_post(soapconn, NULL); |
2c8c6d77f12c
Make use of the GQueue in MsnSoapConn to manage the SOAP requests, allowing them to work perfectly even when dispatching multiple requests at once.
Carlos Silva <typ0@pidgin.im>
parents:
20501
diff
changeset
|
443 } |
20416
4c5d68e93ef8
Handles SOAP redirects, thanks Sebasti«¡n E. Peyrott
Ka-Hing Cheung <khc@hxbc.us>
parents:
20404
diff
changeset
|
444 } |
20394
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
445 else if (strstr(soapconn->read_buf, "HTTP/1.1 401 Unauthorized") != NULL) |
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
446 { |
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
447 const char *error; |
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
448 |
20477
9a2a4a0c0003
Add the possibility to create an Address Book, useful for newly registered MSN users.
Carlos Silva <typ0@pidgin.im>
parents:
20471
diff
changeset
|
449 purple_debug_error("MSN SOAP", "Received HTTP error 401 Unauthorized\n"); |
20394
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
450 if ((error = strstr(soapconn->read_buf, "WWW-Authenticate")) != NULL) |
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
451 { |
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
452 if ((error = strstr(error, "cbtxt=")) != NULL) |
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
453 { |
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
454 const char *c; |
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
455 char *temp; |
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
456 |
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
457 error += strlen("cbtxt="); |
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
458 |
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
459 if ((c = strchr(error, '\n')) == NULL) |
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
460 c = error + strlen(error); |
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
461 |
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
462 temp = g_strndup(error, c - error); |
20401
4ddc27c18781
Fix up some gaim -> purple issues.
Richard Laager <rlaager@wiktel.com>
parents:
20394
diff
changeset
|
463 error = purple_url_decode(temp); |
20394
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
464 g_free(temp); |
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
465 } |
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
466 } |
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
467 |
20465
2a5c1de05e0a
Fix authentication failures handling (ticket 1246) and fix some compiler warnings
Carlos Silva <typ0@pidgin.im>
parents:
20416
diff
changeset
|
468 msn_session_set_error(session, MSN_ERROR_AUTH, error); |
2a5c1de05e0a
Fix authentication failures handling (ticket 1246) and fix some compiler warnings
Carlos Silva <typ0@pidgin.im>
parents:
20416
diff
changeset
|
469 } |
2a5c1de05e0a
Fix authentication failures handling (ticket 1246) and fix some compiler warnings
Carlos Silva <typ0@pidgin.im>
parents:
20416
diff
changeset
|
470 /* Handle Passport 3.0 authentication failures. |
2a5c1de05e0a
Fix authentication failures handling (ticket 1246) and fix some compiler warnings
Carlos Silva <typ0@pidgin.im>
parents:
20416
diff
changeset
|
471 * Further info: http://msnpiki.msnfanatic.com/index.php/MSNP13:SOAPTweener |
2a5c1de05e0a
Fix authentication failures handling (ticket 1246) and fix some compiler warnings
Carlos Silva <typ0@pidgin.im>
parents:
20416
diff
changeset
|
472 */ |
2a5c1de05e0a
Fix authentication failures handling (ticket 1246) and fix some compiler warnings
Carlos Silva <typ0@pidgin.im>
parents:
20416
diff
changeset
|
473 else if (strstr(soapconn->read_buf, |
2a5c1de05e0a
Fix authentication failures handling (ticket 1246) and fix some compiler warnings
Carlos Silva <typ0@pidgin.im>
parents:
20416
diff
changeset
|
474 "<faultcode>wsse:FailedAuthentication</faultcode>") != NULL) |
2a5c1de05e0a
Fix authentication failures handling (ticket 1246) and fix some compiler warnings
Carlos Silva <typ0@pidgin.im>
parents:
20416
diff
changeset
|
475 { |
20539
2c8c6d77f12c
Make use of the GQueue in MsnSoapConn to manage the SOAP requests, allowing them to work perfectly even when dispatching multiple requests at once.
Carlos Silva <typ0@pidgin.im>
parents:
20501
diff
changeset
|
476 gchar *faultstring; |
20465
2a5c1de05e0a
Fix authentication failures handling (ticket 1246) and fix some compiler warnings
Carlos Silva <typ0@pidgin.im>
parents:
20416
diff
changeset
|
477 |
2a5c1de05e0a
Fix authentication failures handling (ticket 1246) and fix some compiler warnings
Carlos Silva <typ0@pidgin.im>
parents:
20416
diff
changeset
|
478 faultstring = strstr(soapconn->read_buf, "<faultstring>"); |
2a5c1de05e0a
Fix authentication failures handling (ticket 1246) and fix some compiler warnings
Carlos Silva <typ0@pidgin.im>
parents:
20416
diff
changeset
|
479 |
2a5c1de05e0a
Fix authentication failures handling (ticket 1246) and fix some compiler warnings
Carlos Silva <typ0@pidgin.im>
parents:
20416
diff
changeset
|
480 if (faultstring != NULL) |
2a5c1de05e0a
Fix authentication failures handling (ticket 1246) and fix some compiler warnings
Carlos Silva <typ0@pidgin.im>
parents:
20416
diff
changeset
|
481 { |
20539
2c8c6d77f12c
Make use of the GQueue in MsnSoapConn to manage the SOAP requests, allowing them to work perfectly even when dispatching multiple requests at once.
Carlos Silva <typ0@pidgin.im>
parents:
20501
diff
changeset
|
482 gchar *c; |
20465
2a5c1de05e0a
Fix authentication failures handling (ticket 1246) and fix some compiler warnings
Carlos Silva <typ0@pidgin.im>
parents:
20416
diff
changeset
|
483 faultstring += strlen("<faultstring>"); |
20539
2c8c6d77f12c
Make use of the GQueue in MsnSoapConn to manage the SOAP requests, allowing them to work perfectly even when dispatching multiple requests at once.
Carlos Silva <typ0@pidgin.im>
parents:
20501
diff
changeset
|
484 if (faultstring < soapconn->read_buf + soapconn->read_len) { |
2c8c6d77f12c
Make use of the GQueue in MsnSoapConn to manage the SOAP requests, allowing them to work perfectly even when dispatching multiple requests at once.
Carlos Silva <typ0@pidgin.im>
parents:
20501
diff
changeset
|
485 c = strstr(soapconn->read_buf, "</faultstring>"); |
2c8c6d77f12c
Make use of the GQueue in MsnSoapConn to manage the SOAP requests, allowing them to work perfectly even when dispatching multiple requests at once.
Carlos Silva <typ0@pidgin.im>
parents:
20501
diff
changeset
|
486 if (c != NULL) { |
2c8c6d77f12c
Make use of the GQueue in MsnSoapConn to manage the SOAP requests, allowing them to work perfectly even when dispatching multiple requests at once.
Carlos Silva <typ0@pidgin.im>
parents:
20501
diff
changeset
|
487 *c = '\0'; |
2c8c6d77f12c
Make use of the GQueue in MsnSoapConn to manage the SOAP requests, allowing them to work perfectly even when dispatching multiple requests at once.
Carlos Silva <typ0@pidgin.im>
parents:
20501
diff
changeset
|
488 msn_session_set_error(session, MSN_ERROR_AUTH, faultstring); |
2c8c6d77f12c
Make use of the GQueue in MsnSoapConn to manage the SOAP requests, allowing them to work perfectly even when dispatching multiple requests at once.
Carlos Silva <typ0@pidgin.im>
parents:
20501
diff
changeset
|
489 } |
2c8c6d77f12c
Make use of the GQueue in MsnSoapConn to manage the SOAP requests, allowing them to work perfectly even when dispatching multiple requests at once.
Carlos Silva <typ0@pidgin.im>
parents:
20501
diff
changeset
|
490 } |
20465
2a5c1de05e0a
Fix authentication failures handling (ticket 1246) and fix some compiler warnings
Carlos Silva <typ0@pidgin.im>
parents:
20416
diff
changeset
|
491 } |
23300
5cdd93dac7a2
Delete trailing whitespace
Mark Doliner <mark@kingant.net>
parents:
22798
diff
changeset
|
492 |
20394
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
493 } |
20404
455c5700c866
Really the last of the merge changes.
Richard Laager <rlaager@wiktel.com>
parents:
20401
diff
changeset
|
494 else if (strstr(soapconn->read_buf, "HTTP/1.1 503 Service Unavailable")) |
455c5700c866
Really the last of the merge changes.
Richard Laager <rlaager@wiktel.com>
parents:
20401
diff
changeset
|
495 { |
455c5700c866
Really the last of the merge changes.
Richard Laager <rlaager@wiktel.com>
parents:
20401
diff
changeset
|
496 msn_session_set_error(session, MSN_ERROR_SERV_UNAVAILABLE, NULL); |
455c5700c866
Really the last of the merge changes.
Richard Laager <rlaager@wiktel.com>
parents:
20401
diff
changeset
|
497 } |
20394
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
498 else if ((strstr(soapconn->read_buf, "HTTP/1.1 200 OK")) |
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
499 ||(strstr(soapconn->read_buf, "HTTP/1.1 500"))) |
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
500 { |
20539
2c8c6d77f12c
Make use of the GQueue in MsnSoapConn to manage the SOAP requests, allowing them to work perfectly even when dispatching multiple requests at once.
Carlos Silva <typ0@pidgin.im>
parents:
20501
diff
changeset
|
501 gboolean soapconn_is_valid = FALSE; |
20394
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
502 |
20539
2c8c6d77f12c
Make use of the GQueue in MsnSoapConn to manage the SOAP requests, allowing them to work perfectly even when dispatching multiple requests at once.
Carlos Silva <typ0@pidgin.im>
parents:
20501
diff
changeset
|
503 /*OK! process the SOAP body*/ |
2c8c6d77f12c
Make use of the GQueue in MsnSoapConn to manage the SOAP requests, allowing them to work perfectly even when dispatching multiple requests at once.
Carlos Silva <typ0@pidgin.im>
parents:
20501
diff
changeset
|
504 body_start = (char *)g_strstr_len(soapconn->read_buf, soapconn->read_len,"\r\n\r\n"); |
2c8c6d77f12c
Make use of the GQueue in MsnSoapConn to manage the SOAP requests, allowing them to work perfectly even when dispatching multiple requests at once.
Carlos Silva <typ0@pidgin.im>
parents:
20501
diff
changeset
|
505 if (!body_start) { |
2c8c6d77f12c
Make use of the GQueue in MsnSoapConn to manage the SOAP requests, allowing them to work perfectly even when dispatching multiple requests at once.
Carlos Silva <typ0@pidgin.im>
parents:
20501
diff
changeset
|
506 return; |
2c8c6d77f12c
Make use of the GQueue in MsnSoapConn to manage the SOAP requests, allowing them to work perfectly even when dispatching multiple requests at once.
Carlos Silva <typ0@pidgin.im>
parents:
20501
diff
changeset
|
507 } |
2c8c6d77f12c
Make use of the GQueue in MsnSoapConn to manage the SOAP requests, allowing them to work perfectly even when dispatching multiple requests at once.
Carlos Silva <typ0@pidgin.im>
parents:
20501
diff
changeset
|
508 body_start += 4; |
20394
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
509 |
20539
2c8c6d77f12c
Make use of the GQueue in MsnSoapConn to manage the SOAP requests, allowing them to work perfectly even when dispatching multiple requests at once.
Carlos Silva <typ0@pidgin.im>
parents:
20501
diff
changeset
|
510 if (body_start > soapconn->read_buf + soapconn->read_len) |
2c8c6d77f12c
Make use of the GQueue in MsnSoapConn to manage the SOAP requests, allowing them to work perfectly even when dispatching multiple requests at once.
Carlos Silva <typ0@pidgin.im>
parents:
20501
diff
changeset
|
511 return; |
2c8c6d77f12c
Make use of the GQueue in MsnSoapConn to manage the SOAP requests, allowing them to work perfectly even when dispatching multiple requests at once.
Carlos Silva <typ0@pidgin.im>
parents:
20501
diff
changeset
|
512 |
2c8c6d77f12c
Make use of the GQueue in MsnSoapConn to manage the SOAP requests, allowing them to work perfectly even when dispatching multiple requests at once.
Carlos Silva <typ0@pidgin.im>
parents:
20501
diff
changeset
|
513 /* we read the content-length*/ |
2c8c6d77f12c
Make use of the GQueue in MsnSoapConn to manage the SOAP requests, allowing them to work perfectly even when dispatching multiple requests at once.
Carlos Silva <typ0@pidgin.im>
parents:
20501
diff
changeset
|
514 if ( (length_start = g_strstr_len(soapconn->read_buf, soapconn->read_len, "Content-Length: ")) != NULL) |
20394
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
515 length_start += strlen("Content-Length: "); |
20539
2c8c6d77f12c
Make use of the GQueue in MsnSoapConn to manage the SOAP requests, allowing them to work perfectly even when dispatching multiple requests at once.
Carlos Silva <typ0@pidgin.im>
parents:
20501
diff
changeset
|
516 |
2c8c6d77f12c
Make use of the GQueue in MsnSoapConn to manage the SOAP requests, allowing them to work perfectly even when dispatching multiple requests at once.
Carlos Silva <typ0@pidgin.im>
parents:
20501
diff
changeset
|
517 if (length_start > soapconn->read_buf + soapconn->read_len) |
2c8c6d77f12c
Make use of the GQueue in MsnSoapConn to manage the SOAP requests, allowing them to work perfectly even when dispatching multiple requests at once.
Carlos Silva <typ0@pidgin.im>
parents:
20501
diff
changeset
|
518 return; |
2c8c6d77f12c
Make use of the GQueue in MsnSoapConn to manage the SOAP requests, allowing them to work perfectly even when dispatching multiple requests at once.
Carlos Silva <typ0@pidgin.im>
parents:
20501
diff
changeset
|
519 |
2c8c6d77f12c
Make use of the GQueue in MsnSoapConn to manage the SOAP requests, allowing them to work perfectly even when dispatching multiple requests at once.
Carlos Silva <typ0@pidgin.im>
parents:
20501
diff
changeset
|
520 if ( (length_end = strstr(length_start, "\r\n")) == NULL ) |
2c8c6d77f12c
Make use of the GQueue in MsnSoapConn to manage the SOAP requests, allowing them to work perfectly even when dispatching multiple requests at once.
Carlos Silva <typ0@pidgin.im>
parents:
20501
diff
changeset
|
521 return; |
2c8c6d77f12c
Make use of the GQueue in MsnSoapConn to manage the SOAP requests, allowing them to work perfectly even when dispatching multiple requests at once.
Carlos Silva <typ0@pidgin.im>
parents:
20501
diff
changeset
|
522 |
2c8c6d77f12c
Make use of the GQueue in MsnSoapConn to manage the SOAP requests, allowing them to work perfectly even when dispatching multiple requests at once.
Carlos Silva <typ0@pidgin.im>
parents:
20501
diff
changeset
|
523 body_len = g_strndup(length_start, length_end - length_start); |
20394
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
524 |
20539
2c8c6d77f12c
Make use of the GQueue in MsnSoapConn to manage the SOAP requests, allowing them to work perfectly even when dispatching multiple requests at once.
Carlos Silva <typ0@pidgin.im>
parents:
20501
diff
changeset
|
525 /*setup the conn body */ |
2c8c6d77f12c
Make use of the GQueue in MsnSoapConn to manage the SOAP requests, allowing them to work perfectly even when dispatching multiple requests at once.
Carlos Silva <typ0@pidgin.im>
parents:
20501
diff
changeset
|
526 soapconn->body = body_start; |
2c8c6d77f12c
Make use of the GQueue in MsnSoapConn to manage the SOAP requests, allowing them to work perfectly even when dispatching multiple requests at once.
Carlos Silva <typ0@pidgin.im>
parents:
20501
diff
changeset
|
527 soapconn->body_len = atoi(body_len); |
2c8c6d77f12c
Make use of the GQueue in MsnSoapConn to manage the SOAP requests, allowing them to work perfectly even when dispatching multiple requests at once.
Carlos Silva <typ0@pidgin.im>
parents:
20501
diff
changeset
|
528 g_free(body_len); |
20394
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
529 #ifdef MSN_SOAP_DEBUG |
22798
05cb3f04c01e
This cleans up a bunch of warnings that stem from the fact that size_t and
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
21866
diff
changeset
|
530 purple_debug_misc("MSN SOAP", |
05cb3f04c01e
This cleans up a bunch of warnings that stem from the fact that size_t and
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
21866
diff
changeset
|
531 "SOAP bytes read so far: %" G_GSIZE_FORMAT ", Content-Length: %d\n", |
05cb3f04c01e
This cleans up a bunch of warnings that stem from the fact that size_t and
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
21866
diff
changeset
|
532 soapconn->read_len, soapconn->body_len); |
20394
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
533 #endif |
20539
2c8c6d77f12c
Make use of the GQueue in MsnSoapConn to manage the SOAP requests, allowing them to work perfectly even when dispatching multiple requests at once.
Carlos Silva <typ0@pidgin.im>
parents:
20501
diff
changeset
|
534 soapconn->need_to_read = (body_start - soapconn->read_buf + soapconn->body_len) - soapconn->read_len; |
2c8c6d77f12c
Make use of the GQueue in MsnSoapConn to manage the SOAP requests, allowing them to work perfectly even when dispatching multiple requests at once.
Carlos Silva <typ0@pidgin.im>
parents:
20501
diff
changeset
|
535 if ( soapconn->need_to_read > 0 ) { |
2c8c6d77f12c
Make use of the GQueue in MsnSoapConn to manage the SOAP requests, allowing them to work perfectly even when dispatching multiple requests at once.
Carlos Silva <typ0@pidgin.im>
parents:
20501
diff
changeset
|
536 return; |
2c8c6d77f12c
Make use of the GQueue in MsnSoapConn to manage the SOAP requests, allowing them to work perfectly even when dispatching multiple requests at once.
Carlos Silva <typ0@pidgin.im>
parents:
20501
diff
changeset
|
537 } |
20394
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
538 |
20479
6a8463be5b23
Improve MSN_SOAP_DEBUG and workaround a Win32 bug which would case Pidgin to consume insane amounts of memory when printing a large string to the Debug Window.
Carlos Silva <typ0@pidgin.im>
parents:
20478
diff
changeset
|
539 #if defined(MSN_SOAP_DEBUG) && !defined(_WIN32) |
6a8463be5b23
Improve MSN_SOAP_DEBUG and workaround a Win32 bug which would case Pidgin to consume insane amounts of memory when printing a large string to the Debug Window.
Carlos Silva <typ0@pidgin.im>
parents:
20478
diff
changeset
|
540 |
20539
2c8c6d77f12c
Make use of the GQueue in MsnSoapConn to manage the SOAP requests, allowing them to work perfectly even when dispatching multiple requests at once.
Carlos Silva <typ0@pidgin.im>
parents:
20501
diff
changeset
|
541 node = xmlnode_from_str(soapconn->body, soapconn->body_len); |
23300
5cdd93dac7a2
Delete trailing whitespace
Mark Doliner <mark@kingant.net>
parents:
22798
diff
changeset
|
542 |
20539
2c8c6d77f12c
Make use of the GQueue in MsnSoapConn to manage the SOAP requests, allowing them to work perfectly even when dispatching multiple requests at once.
Carlos Silva <typ0@pidgin.im>
parents:
20501
diff
changeset
|
543 if (node != NULL) { |
2c8c6d77f12c
Make use of the GQueue in MsnSoapConn to manage the SOAP requests, allowing them to work perfectly even when dispatching multiple requests at once.
Carlos Silva <typ0@pidgin.im>
parents:
20501
diff
changeset
|
544 formattedxml = xmlnode_to_formatted_str(node, NULL); |
2c8c6d77f12c
Make use of the GQueue in MsnSoapConn to manage the SOAP requests, allowing them to work perfectly even when dispatching multiple requests at once.
Carlos Silva <typ0@pidgin.im>
parents:
20501
diff
changeset
|
545 http_headers = g_strndup(soapconn->read_buf, soapconn->body - soapconn->read_buf); |
23300
5cdd93dac7a2
Delete trailing whitespace
Mark Doliner <mark@kingant.net>
parents:
22798
diff
changeset
|
546 |
20539
2c8c6d77f12c
Make use of the GQueue in MsnSoapConn to manage the SOAP requests, allowing them to work perfectly even when dispatching multiple requests at once.
Carlos Silva <typ0@pidgin.im>
parents:
20501
diff
changeset
|
547 purple_debug_info("MSN SOAP","Data with XML payload received from the SOAP server:\n%s%s\n", http_headers, formattedxml); |
2c8c6d77f12c
Make use of the GQueue in MsnSoapConn to manage the SOAP requests, allowing them to work perfectly even when dispatching multiple requests at once.
Carlos Silva <typ0@pidgin.im>
parents:
20501
diff
changeset
|
548 g_free(http_headers); |
2c8c6d77f12c
Make use of the GQueue in MsnSoapConn to manage the SOAP requests, allowing them to work perfectly even when dispatching multiple requests at once.
Carlos Silva <typ0@pidgin.im>
parents:
20501
diff
changeset
|
549 g_free(formattedxml); |
2c8c6d77f12c
Make use of the GQueue in MsnSoapConn to manage the SOAP requests, allowing them to work perfectly even when dispatching multiple requests at once.
Carlos Silva <typ0@pidgin.im>
parents:
20501
diff
changeset
|
550 xmlnode_free(node); |
2c8c6d77f12c
Make use of the GQueue in MsnSoapConn to manage the SOAP requests, allowing them to work perfectly even when dispatching multiple requests at once.
Carlos Silva <typ0@pidgin.im>
parents:
20501
diff
changeset
|
551 } |
2c8c6d77f12c
Make use of the GQueue in MsnSoapConn to manage the SOAP requests, allowing them to work perfectly even when dispatching multiple requests at once.
Carlos Silva <typ0@pidgin.im>
parents:
20501
diff
changeset
|
552 else |
2c8c6d77f12c
Make use of the GQueue in MsnSoapConn to manage the SOAP requests, allowing them to work perfectly even when dispatching multiple requests at once.
Carlos Silva <typ0@pidgin.im>
parents:
20501
diff
changeset
|
553 purple_debug_info("MSN SOAP","Data received from the SOAP server:\n%s\n", soapconn->read_buf); |
20479
6a8463be5b23
Improve MSN_SOAP_DEBUG and workaround a Win32 bug which would case Pidgin to consume insane amounts of memory when printing a large string to the Debug Window.
Carlos Silva <typ0@pidgin.im>
parents:
20478
diff
changeset
|
554 #endif |
6a8463be5b23
Improve MSN_SOAP_DEBUG and workaround a Win32 bug which would case Pidgin to consume insane amounts of memory when printing a large string to the Debug Window.
Carlos Silva <typ0@pidgin.im>
parents:
20478
diff
changeset
|
555 |
20539
2c8c6d77f12c
Make use of the GQueue in MsnSoapConn to manage the SOAP requests, allowing them to work perfectly even when dispatching multiple requests at once.
Carlos Silva <typ0@pidgin.im>
parents:
20501
diff
changeset
|
556 /*remove the read handler*/ |
2c8c6d77f12c
Make use of the GQueue in MsnSoapConn to manage the SOAP requests, allowing them to work perfectly even when dispatching multiple requests at once.
Carlos Silva <typ0@pidgin.im>
parents:
20501
diff
changeset
|
557 msn_soap_close_handler( &(soapconn->input_handler) ); |
2c8c6d77f12c
Make use of the GQueue in MsnSoapConn to manage the SOAP requests, allowing them to work perfectly even when dispatching multiple requests at once.
Carlos Silva <typ0@pidgin.im>
parents:
20501
diff
changeset
|
558 // purple_input_remove(soapconn->input_handler); |
2c8c6d77f12c
Make use of the GQueue in MsnSoapConn to manage the SOAP requests, allowing them to work perfectly even when dispatching multiple requests at once.
Carlos Silva <typ0@pidgin.im>
parents:
20501
diff
changeset
|
559 // soapconn->input_handler = 0; |
2c8c6d77f12c
Make use of the GQueue in MsnSoapConn to manage the SOAP requests, allowing them to work perfectly even when dispatching multiple requests at once.
Carlos Silva <typ0@pidgin.im>
parents:
20501
diff
changeset
|
560 /* |
2c8c6d77f12c
Make use of the GQueue in MsnSoapConn to manage the SOAP requests, allowing them to work perfectly even when dispatching multiple requests at once.
Carlos Silva <typ0@pidgin.im>
parents:
20501
diff
changeset
|
561 * close the soap connection,if more soap request came, |
2c8c6d77f12c
Make use of the GQueue in MsnSoapConn to manage the SOAP requests, allowing them to work perfectly even when dispatching multiple requests at once.
Carlos Silva <typ0@pidgin.im>
parents:
20501
diff
changeset
|
562 * Just reconnect to do it, |
2c8c6d77f12c
Make use of the GQueue in MsnSoapConn to manage the SOAP requests, allowing them to work perfectly even when dispatching multiple requests at once.
Carlos Silva <typ0@pidgin.im>
parents:
20501
diff
changeset
|
563 * |
2c8c6d77f12c
Make use of the GQueue in MsnSoapConn to manage the SOAP requests, allowing them to work perfectly even when dispatching multiple requests at once.
Carlos Silva <typ0@pidgin.im>
parents:
20501
diff
changeset
|
564 * To solve the problem described below: |
2c8c6d77f12c
Make use of the GQueue in MsnSoapConn to manage the SOAP requests, allowing them to work perfectly even when dispatching multiple requests at once.
Carlos Silva <typ0@pidgin.im>
parents:
20501
diff
changeset
|
565 * When I post the soap request in one socket one after the other, |
2c8c6d77f12c
Make use of the GQueue in MsnSoapConn to manage the SOAP requests, allowing them to work perfectly even when dispatching multiple requests at once.
Carlos Silva <typ0@pidgin.im>
parents:
20501
diff
changeset
|
566 * The first read is ok, But the second soap read always got 0 bytes, |
2c8c6d77f12c
Make use of the GQueue in MsnSoapConn to manage the SOAP requests, allowing them to work perfectly even when dispatching multiple requests at once.
Carlos Silva <typ0@pidgin.im>
parents:
20501
diff
changeset
|
567 * Weird! |
2c8c6d77f12c
Make use of the GQueue in MsnSoapConn to manage the SOAP requests, allowing them to work perfectly even when dispatching multiple requests at once.
Carlos Silva <typ0@pidgin.im>
parents:
20501
diff
changeset
|
568 * */ |
2c8c6d77f12c
Make use of the GQueue in MsnSoapConn to manage the SOAP requests, allowing them to work perfectly even when dispatching multiple requests at once.
Carlos Silva <typ0@pidgin.im>
parents:
20501
diff
changeset
|
569 msn_soap_close(soapconn); |
20394
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
570 |
20539
2c8c6d77f12c
Make use of the GQueue in MsnSoapConn to manage the SOAP requests, allowing them to work perfectly even when dispatching multiple requests at once.
Carlos Silva <typ0@pidgin.im>
parents:
20501
diff
changeset
|
571 /*call the read callback*/ |
2c8c6d77f12c
Make use of the GQueue in MsnSoapConn to manage the SOAP requests, allowing them to work perfectly even when dispatching multiple requests at once.
Carlos Silva <typ0@pidgin.im>
parents:
20501
diff
changeset
|
572 if ( soapconn->read_cb != NULL ) { |
2c8c6d77f12c
Make use of the GQueue in MsnSoapConn to manage the SOAP requests, allowing them to work perfectly even when dispatching multiple requests at once.
Carlos Silva <typ0@pidgin.im>
parents:
20501
diff
changeset
|
573 soapconn_is_valid = soapconn->read_cb(soapconn); |
2c8c6d77f12c
Make use of the GQueue in MsnSoapConn to manage the SOAP requests, allowing them to work perfectly even when dispatching multiple requests at once.
Carlos Silva <typ0@pidgin.im>
parents:
20501
diff
changeset
|
574 } |
23300
5cdd93dac7a2
Delete trailing whitespace
Mark Doliner <mark@kingant.net>
parents:
22798
diff
changeset
|
575 |
20539
2c8c6d77f12c
Make use of the GQueue in MsnSoapConn to manage the SOAP requests, allowing them to work perfectly even when dispatching multiple requests at once.
Carlos Silva <typ0@pidgin.im>
parents:
20501
diff
changeset
|
576 if (!soapconn_is_valid) { |
2c8c6d77f12c
Make use of the GQueue in MsnSoapConn to manage the SOAP requests, allowing them to work perfectly even when dispatching multiple requests at once.
Carlos Silva <typ0@pidgin.im>
parents:
20501
diff
changeset
|
577 return; |
2c8c6d77f12c
Make use of the GQueue in MsnSoapConn to manage the SOAP requests, allowing them to work perfectly even when dispatching multiple requests at once.
Carlos Silva <typ0@pidgin.im>
parents:
20501
diff
changeset
|
578 } |
2c8c6d77f12c
Make use of the GQueue in MsnSoapConn to manage the SOAP requests, allowing them to work perfectly even when dispatching multiple requests at once.
Carlos Silva <typ0@pidgin.im>
parents:
20501
diff
changeset
|
579 |
2c8c6d77f12c
Make use of the GQueue in MsnSoapConn to manage the SOAP requests, allowing them to work perfectly even when dispatching multiple requests at once.
Carlos Silva <typ0@pidgin.im>
parents:
20501
diff
changeset
|
580 /* dispatch next request in queue */ |
2c8c6d77f12c
Make use of the GQueue in MsnSoapConn to manage the SOAP requests, allowing them to work perfectly even when dispatching multiple requests at once.
Carlos Silva <typ0@pidgin.im>
parents:
20501
diff
changeset
|
581 msn_soap_post(soapconn, NULL); |
23300
5cdd93dac7a2
Delete trailing whitespace
Mark Doliner <mark@kingant.net>
parents:
22798
diff
changeset
|
582 } |
20394
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
583 return; |
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
584 } |
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
585 |
23300
5cdd93dac7a2
Delete trailing whitespace
Mark Doliner <mark@kingant.net>
parents:
22798
diff
changeset
|
586 void |
20394
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
587 msn_soap_free_read_buf(MsnSoapConn *soapconn) |
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
588 { |
20481
eb93710aec4d
Make buddy and group management actually work, add some SOAP templates, redesign some parts of code and separate some bigger functions into its smaller tasks which are completely unrelated to each other
Carlos Silva <typ0@pidgin.im>
parents:
20479
diff
changeset
|
589 g_return_if_fail(soapconn != NULL); |
23300
5cdd93dac7a2
Delete trailing whitespace
Mark Doliner <mark@kingant.net>
parents:
22798
diff
changeset
|
590 |
20478
c1c4468207fa
msn_soap_read_buf() shouldn't be used after calling soapconn->read_cb as this callback function can sometimes free soapconn (such as in nexus_login_read_cb after closing nexus connection)
Carlos Silva <typ0@pidgin.im>
parents:
20477
diff
changeset
|
591 if (soapconn->read_buf) { |
20394
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
592 g_free(soapconn->read_buf); |
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
593 } |
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
594 soapconn->read_buf = NULL; |
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
595 soapconn->read_len = 0; |
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
596 soapconn->need_to_read = 0; |
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
597 } |
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
598 |
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
599 void |
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
600 msn_soap_free_write_buf(MsnSoapConn *soapconn) |
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
601 { |
20481
eb93710aec4d
Make buddy and group management actually work, add some SOAP templates, redesign some parts of code and separate some bigger functions into its smaller tasks which are completely unrelated to each other
Carlos Silva <typ0@pidgin.im>
parents:
20479
diff
changeset
|
602 g_return_if_fail(soapconn != NULL); |
eb93710aec4d
Make buddy and group management actually work, add some SOAP templates, redesign some parts of code and separate some bigger functions into its smaller tasks which are completely unrelated to each other
Carlos Silva <typ0@pidgin.im>
parents:
20479
diff
changeset
|
603 |
eb93710aec4d
Make buddy and group management actually work, add some SOAP templates, redesign some parts of code and separate some bigger functions into its smaller tasks which are completely unrelated to each other
Carlos Silva <typ0@pidgin.im>
parents:
20479
diff
changeset
|
604 if (soapconn->write_buf) { |
20394
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
605 g_free(soapconn->write_buf); |
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
606 } |
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
607 soapconn->write_buf = NULL; |
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
608 soapconn->written_len = 0; |
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
609 } |
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
610 |
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
611 /*Soap write process func*/ |
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
612 static void |
20401
4ddc27c18781
Fix up some gaim -> purple issues.
Richard Laager <rlaager@wiktel.com>
parents:
20394
diff
changeset
|
613 msn_soap_write_cb(gpointer data, gint source, PurpleInputCondition cond) |
20394
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
614 { |
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
615 MsnSoapConn *soapconn = data; |
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
616 int len, total_len; |
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
617 |
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
618 g_return_if_fail(soapconn != NULL); |
20477
9a2a4a0c0003
Add the possibility to create an Address Book, useful for newly registered MSN users.
Carlos Silva <typ0@pidgin.im>
parents:
20471
diff
changeset
|
619 if ( soapconn->write_buf == NULL ) { |
20539
2c8c6d77f12c
Make use of the GQueue in MsnSoapConn to manage the SOAP requests, allowing them to work perfectly even when dispatching multiple requests at once.
Carlos Silva <typ0@pidgin.im>
parents:
20501
diff
changeset
|
620 purple_debug_error("MSN SOAP","SOAP write buffer is NULL\n"); |
2c8c6d77f12c
Make use of the GQueue in MsnSoapConn to manage the SOAP requests, allowing them to work perfectly even when dispatching multiple requests at once.
Carlos Silva <typ0@pidgin.im>
parents:
20501
diff
changeset
|
621 // msn_soap_check_conn_errors(soapconn); |
2c8c6d77f12c
Make use of the GQueue in MsnSoapConn to manage the SOAP requests, allowing them to work perfectly even when dispatching multiple requests at once.
Carlos Silva <typ0@pidgin.im>
parents:
20501
diff
changeset
|
622 // purple_input_remove(soapconn->output_handler); |
2c8c6d77f12c
Make use of the GQueue in MsnSoapConn to manage the SOAP requests, allowing them to work perfectly even when dispatching multiple requests at once.
Carlos Silva <typ0@pidgin.im>
parents:
20501
diff
changeset
|
623 // soapconn->output_handler = 0; |
2c8c6d77f12c
Make use of the GQueue in MsnSoapConn to manage the SOAP requests, allowing them to work perfectly even when dispatching multiple requests at once.
Carlos Silva <typ0@pidgin.im>
parents:
20501
diff
changeset
|
624 msn_soap_close_handler( &(soapconn->output_handler) ); |
20394
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
625 return; |
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
626 } |
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
627 total_len = strlen(soapconn->write_buf); |
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
628 |
23300
5cdd93dac7a2
Delete trailing whitespace
Mark Doliner <mark@kingant.net>
parents:
22798
diff
changeset
|
629 /* |
20394
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
630 * write the content to SSL server, |
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
631 */ |
20401
4ddc27c18781
Fix up some gaim -> purple issues.
Richard Laager <rlaager@wiktel.com>
parents:
20394
diff
changeset
|
632 len = purple_ssl_write(soapconn->gsc, |
20394
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
633 soapconn->write_buf + soapconn->written_len, |
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
634 total_len - soapconn->written_len); |
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
635 |
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
636 if (len < 0 && errno == EAGAIN) |
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
637 return; |
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
638 else if (len <= 0){ |
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
639 /*SSL write error!*/ |
20539
2c8c6d77f12c
Make use of the GQueue in MsnSoapConn to manage the SOAP requests, allowing them to work perfectly even when dispatching multiple requests at once.
Carlos Silva <typ0@pidgin.im>
parents:
20501
diff
changeset
|
640 // msn_soap_check_conn_errors(soapconn); |
2c8c6d77f12c
Make use of the GQueue in MsnSoapConn to manage the SOAP requests, allowing them to work perfectly even when dispatching multiple requests at once.
Carlos Silva <typ0@pidgin.im>
parents:
20501
diff
changeset
|
641 |
2c8c6d77f12c
Make use of the GQueue in MsnSoapConn to manage the SOAP requests, allowing them to work perfectly even when dispatching multiple requests at once.
Carlos Silva <typ0@pidgin.im>
parents:
20501
diff
changeset
|
642 msn_soap_close_handler( &(soapconn->output_handler) ); |
2c8c6d77f12c
Make use of the GQueue in MsnSoapConn to manage the SOAP requests, allowing them to work perfectly even when dispatching multiple requests at once.
Carlos Silva <typ0@pidgin.im>
parents:
20501
diff
changeset
|
643 // purple_input_remove(soapconn->output_handler); |
2c8c6d77f12c
Make use of the GQueue in MsnSoapConn to manage the SOAP requests, allowing them to work perfectly even when dispatching multiple requests at once.
Carlos Silva <typ0@pidgin.im>
parents:
20501
diff
changeset
|
644 // soapconn->output_handler = 0; |
2c8c6d77f12c
Make use of the GQueue in MsnSoapConn to manage the SOAP requests, allowing them to work perfectly even when dispatching multiple requests at once.
Carlos Silva <typ0@pidgin.im>
parents:
20501
diff
changeset
|
645 |
2c8c6d77f12c
Make use of the GQueue in MsnSoapConn to manage the SOAP requests, allowing them to work perfectly even when dispatching multiple requests at once.
Carlos Silva <typ0@pidgin.im>
parents:
20501
diff
changeset
|
646 msn_soap_close(soapconn); |
2c8c6d77f12c
Make use of the GQueue in MsnSoapConn to manage the SOAP requests, allowing them to work perfectly even when dispatching multiple requests at once.
Carlos Silva <typ0@pidgin.im>
parents:
20501
diff
changeset
|
647 |
20394
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
648 /* TODO: notify of the error */ |
20539
2c8c6d77f12c
Make use of the GQueue in MsnSoapConn to manage the SOAP requests, allowing them to work perfectly even when dispatching multiple requests at once.
Carlos Silva <typ0@pidgin.im>
parents:
20501
diff
changeset
|
649 purple_debug_error("MSN SOAP", "Error writing to SSL connection!\n"); |
2c8c6d77f12c
Make use of the GQueue in MsnSoapConn to manage the SOAP requests, allowing them to work perfectly even when dispatching multiple requests at once.
Carlos Silva <typ0@pidgin.im>
parents:
20501
diff
changeset
|
650 msn_soap_post(soapconn, NULL); |
20394
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
651 return; |
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
652 } |
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
653 soapconn->written_len += len; |
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
654 |
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
655 if (soapconn->written_len < total_len) |
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
656 return; |
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
657 |
20539
2c8c6d77f12c
Make use of the GQueue in MsnSoapConn to manage the SOAP requests, allowing them to work perfectly even when dispatching multiple requests at once.
Carlos Silva <typ0@pidgin.im>
parents:
20501
diff
changeset
|
658 msn_soap_close_handler( &(soapconn->output_handler) ); |
2c8c6d77f12c
Make use of the GQueue in MsnSoapConn to manage the SOAP requests, allowing them to work perfectly even when dispatching multiple requests at once.
Carlos Silva <typ0@pidgin.im>
parents:
20501
diff
changeset
|
659 // purple_input_remove(soapconn->output_handler); |
2c8c6d77f12c
Make use of the GQueue in MsnSoapConn to manage the SOAP requests, allowing them to work perfectly even when dispatching multiple requests at once.
Carlos Silva <typ0@pidgin.im>
parents:
20501
diff
changeset
|
660 // soapconn->output_handler = 0; |
20394
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
661 |
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
662 /*clear the write buff*/ |
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
663 msn_soap_free_write_buf(soapconn); |
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
664 |
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
665 /* Write finish! |
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
666 * callback for write done |
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
667 */ |
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
668 if(soapconn->written_cb != NULL){ |
20539
2c8c6d77f12c
Make use of the GQueue in MsnSoapConn to manage the SOAP requests, allowing them to work perfectly even when dispatching multiple requests at once.
Carlos Silva <typ0@pidgin.im>
parents:
20501
diff
changeset
|
669 soapconn->written_cb(soapconn); |
20394
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
670 } |
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
671 /*maybe we need to read the input?*/ |
20539
2c8c6d77f12c
Make use of the GQueue in MsnSoapConn to manage the SOAP requests, allowing them to work perfectly even when dispatching multiple requests at once.
Carlos Silva <typ0@pidgin.im>
parents:
20501
diff
changeset
|
672 if ( soapconn->input_handler == 0 ) { |
20477
9a2a4a0c0003
Add the possibility to create an Address Book, useful for newly registered MSN users.
Carlos Silva <typ0@pidgin.im>
parents:
20471
diff
changeset
|
673 soapconn->input_handler = purple_input_add(soapconn->gsc->fd, |
9a2a4a0c0003
Add the possibility to create an Address Book, useful for newly registered MSN users.
Carlos Silva <typ0@pidgin.im>
parents:
20471
diff
changeset
|
674 PURPLE_INPUT_READ, msn_soap_read_cb, soapconn); |
9a2a4a0c0003
Add the possibility to create an Address Book, useful for newly registered MSN users.
Carlos Silva <typ0@pidgin.im>
parents:
20471
diff
changeset
|
675 } |
20394
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
676 } |
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
677 |
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
678 /*write the buffer to SOAP connection*/ |
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
679 void |
20539
2c8c6d77f12c
Make use of the GQueue in MsnSoapConn to manage the SOAP requests, allowing them to work perfectly even when dispatching multiple requests at once.
Carlos Silva <typ0@pidgin.im>
parents:
20501
diff
changeset
|
680 msn_soap_write(MsnSoapConn * soapconn, char *write_buf, MsnSoapWrittenCbFunction written_cb) |
20394
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
681 { |
20539
2c8c6d77f12c
Make use of the GQueue in MsnSoapConn to manage the SOAP requests, allowing them to work perfectly even when dispatching multiple requests at once.
Carlos Silva <typ0@pidgin.im>
parents:
20501
diff
changeset
|
682 if (soapconn == NULL) { |
2c8c6d77f12c
Make use of the GQueue in MsnSoapConn to manage the SOAP requests, allowing them to work perfectly even when dispatching multiple requests at once.
Carlos Silva <typ0@pidgin.im>
parents:
20501
diff
changeset
|
683 return; |
2c8c6d77f12c
Make use of the GQueue in MsnSoapConn to manage the SOAP requests, allowing them to work perfectly even when dispatching multiple requests at once.
Carlos Silva <typ0@pidgin.im>
parents:
20501
diff
changeset
|
684 } |
2c8c6d77f12c
Make use of the GQueue in MsnSoapConn to manage the SOAP requests, allowing them to work perfectly even when dispatching multiple requests at once.
Carlos Silva <typ0@pidgin.im>
parents:
20501
diff
changeset
|
685 |
2c8c6d77f12c
Make use of the GQueue in MsnSoapConn to manage the SOAP requests, allowing them to work perfectly even when dispatching multiple requests at once.
Carlos Silva <typ0@pidgin.im>
parents:
20501
diff
changeset
|
686 msn_soap_set_process_step(soapconn, MSN_SOAP_PROCESSING); |
2c8c6d77f12c
Make use of the GQueue in MsnSoapConn to manage the SOAP requests, allowing them to work perfectly even when dispatching multiple requests at once.
Carlos Silva <typ0@pidgin.im>
parents:
20501
diff
changeset
|
687 |
20989
2097b1664fa3
Fix some leaks and prevent some unnecessary allocations and frees.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
20832
diff
changeset
|
688 /* Ideally this wouldn't ever be necessary, but i believe that it is leaking the previous value */ |
2097b1664fa3
Fix some leaks and prevent some unnecessary allocations and frees.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
20832
diff
changeset
|
689 g_free(soapconn->write_buf); |
20394
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
690 soapconn->write_buf = write_buf; |
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
691 soapconn->written_len = 0; |
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
692 soapconn->written_cb = written_cb; |
23300
5cdd93dac7a2
Delete trailing whitespace
Mark Doliner <mark@kingant.net>
parents:
22798
diff
changeset
|
693 |
20477
9a2a4a0c0003
Add the possibility to create an Address Book, useful for newly registered MSN users.
Carlos Silva <typ0@pidgin.im>
parents:
20471
diff
changeset
|
694 msn_soap_free_read_buf(soapconn); |
20394
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
695 |
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
696 /*clear the read buffer first*/ |
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
697 /*start the write*/ |
20401
4ddc27c18781
Fix up some gaim -> purple issues.
Richard Laager <rlaager@wiktel.com>
parents:
20394
diff
changeset
|
698 soapconn->output_handler = purple_input_add(soapconn->gsc->fd, PURPLE_INPUT_WRITE, |
20539
2c8c6d77f12c
Make use of the GQueue in MsnSoapConn to manage the SOAP requests, allowing them to work perfectly even when dispatching multiple requests at once.
Carlos Silva <typ0@pidgin.im>
parents:
20501
diff
changeset
|
699 msn_soap_write_cb, soapconn); |
20401
4ddc27c18781
Fix up some gaim -> purple issues.
Richard Laager <rlaager@wiktel.com>
parents:
20394
diff
changeset
|
700 msn_soap_write_cb(soapconn, soapconn->gsc->fd, PURPLE_INPUT_WRITE); |
20394
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
701 } |
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
702 |
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
703 /* New a soap request*/ |
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
704 MsnSoapReq * |
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
705 msn_soap_request_new(const char *host,const char *post_url,const char *soap_action, |
20481
eb93710aec4d
Make buddy and group management actually work, add some SOAP templates, redesign some parts of code and separate some bigger functions into its smaller tasks which are completely unrelated to each other
Carlos Silva <typ0@pidgin.im>
parents:
20479
diff
changeset
|
706 const char *body, const gpointer data_cb, |
20539
2c8c6d77f12c
Make use of the GQueue in MsnSoapConn to manage the SOAP requests, allowing them to work perfectly even when dispatching multiple requests at once.
Carlos Silva <typ0@pidgin.im>
parents:
20501
diff
changeset
|
707 MsnSoapReadCbFunction read_cb, |
2c8c6d77f12c
Make use of the GQueue in MsnSoapConn to manage the SOAP requests, allowing them to work perfectly even when dispatching multiple requests at once.
Carlos Silva <typ0@pidgin.im>
parents:
20501
diff
changeset
|
708 MsnSoapWrittenCbFunction written_cb, |
2c8c6d77f12c
Make use of the GQueue in MsnSoapConn to manage the SOAP requests, allowing them to work perfectly even when dispatching multiple requests at once.
Carlos Silva <typ0@pidgin.im>
parents:
20501
diff
changeset
|
709 MsnSoapConnectInitFunction connect_init) |
20394
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
710 { |
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
711 MsnSoapReq *request; |
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
712 |
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
713 request = g_new0(MsnSoapReq, 1); |
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
714 request->id = 0; |
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
715 |
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
716 request->login_host = g_strdup(host); |
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
717 request->login_path = g_strdup(post_url); |
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
718 request->soap_action = g_strdup(soap_action); |
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
719 request->body = g_strdup(body); |
20481
eb93710aec4d
Make buddy and group management actually work, add some SOAP templates, redesign some parts of code and separate some bigger functions into its smaller tasks which are completely unrelated to each other
Carlos Silva <typ0@pidgin.im>
parents:
20479
diff
changeset
|
720 request->data_cb = data_cb; |
20394
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
721 request->read_cb = read_cb; |
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
722 request->written_cb = written_cb; |
20539
2c8c6d77f12c
Make use of the GQueue in MsnSoapConn to manage the SOAP requests, allowing them to work perfectly even when dispatching multiple requests at once.
Carlos Silva <typ0@pidgin.im>
parents:
20501
diff
changeset
|
723 request->connect_init = connect_init; |
20394
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
724 |
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
725 return request; |
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
726 } |
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
727 |
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
728 /*free a soap request*/ |
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
729 void |
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
730 msn_soap_request_free(MsnSoapReq *request) |
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
731 { |
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
732 g_return_if_fail(request != NULL); |
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
733 |
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
734 g_free(request->login_host); |
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
735 g_free(request->login_path); |
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
736 g_free(request->soap_action); |
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
737 g_free(request->body); |
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
738 request->read_cb = NULL; |
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
739 request->written_cb = NULL; |
20539
2c8c6d77f12c
Make use of the GQueue in MsnSoapConn to manage the SOAP requests, allowing them to work perfectly even when dispatching multiple requests at once.
Carlos Silva <typ0@pidgin.im>
parents:
20501
diff
changeset
|
740 request->connect_init = NULL; |
20394
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
741 |
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
742 g_free(request); |
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
743 } |
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
744 |
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
745 /*post the soap request queue's head request*/ |
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
746 void |
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
747 msn_soap_post_head_request(MsnSoapConn *soapconn) |
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
748 { |
20539
2c8c6d77f12c
Make use of the GQueue in MsnSoapConn to manage the SOAP requests, allowing them to work perfectly even when dispatching multiple requests at once.
Carlos Silva <typ0@pidgin.im>
parents:
20501
diff
changeset
|
749 g_return_if_fail(soapconn != NULL); |
2c8c6d77f12c
Make use of the GQueue in MsnSoapConn to manage the SOAP requests, allowing them to work perfectly even when dispatching multiple requests at once.
Carlos Silva <typ0@pidgin.im>
parents:
20501
diff
changeset
|
750 g_return_if_fail(soapconn->soap_queue != NULL); |
23300
5cdd93dac7a2
Delete trailing whitespace
Mark Doliner <mark@kingant.net>
parents:
22798
diff
changeset
|
751 |
20539
2c8c6d77f12c
Make use of the GQueue in MsnSoapConn to manage the SOAP requests, allowing them to work perfectly even when dispatching multiple requests at once.
Carlos Silva <typ0@pidgin.im>
parents:
20501
diff
changeset
|
752 if (soapconn->step == MSN_SOAP_CONNECTED || |
2c8c6d77f12c
Make use of the GQueue in MsnSoapConn to manage the SOAP requests, allowing them to work perfectly even when dispatching multiple requests at once.
Carlos Silva <typ0@pidgin.im>
parents:
20501
diff
changeset
|
753 soapconn->step == MSN_SOAP_CONNECTED_IDLE) { |
2c8c6d77f12c
Make use of the GQueue in MsnSoapConn to manage the SOAP requests, allowing them to work perfectly even when dispatching multiple requests at once.
Carlos Silva <typ0@pidgin.im>
parents:
20501
diff
changeset
|
754 |
2c8c6d77f12c
Make use of the GQueue in MsnSoapConn to manage the SOAP requests, allowing them to work perfectly even when dispatching multiple requests at once.
Carlos Silva <typ0@pidgin.im>
parents:
20501
diff
changeset
|
755 purple_debug_info("MSN SOAP", "Posting new request from head of the queue\n"); |
20394
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
756 |
20539
2c8c6d77f12c
Make use of the GQueue in MsnSoapConn to manage the SOAP requests, allowing them to work perfectly even when dispatching multiple requests at once.
Carlos Silva <typ0@pidgin.im>
parents:
20501
diff
changeset
|
757 if ( !g_queue_is_empty(soapconn->soap_queue) ) { |
2c8c6d77f12c
Make use of the GQueue in MsnSoapConn to manage the SOAP requests, allowing them to work perfectly even when dispatching multiple requests at once.
Carlos Silva <typ0@pidgin.im>
parents:
20501
diff
changeset
|
758 MsnSoapReq *request; |
2c8c6d77f12c
Make use of the GQueue in MsnSoapConn to manage the SOAP requests, allowing them to work perfectly even when dispatching multiple requests at once.
Carlos Silva <typ0@pidgin.im>
parents:
20501
diff
changeset
|
759 |
2c8c6d77f12c
Make use of the GQueue in MsnSoapConn to manage the SOAP requests, allowing them to work perfectly even when dispatching multiple requests at once.
Carlos Silva <typ0@pidgin.im>
parents:
20501
diff
changeset
|
760 if ( (request = g_queue_pop_head(soapconn->soap_queue)) != NULL ) { |
2c8c6d77f12c
Make use of the GQueue in MsnSoapConn to manage the SOAP requests, allowing them to work perfectly even when dispatching multiple requests at once.
Carlos Silva <typ0@pidgin.im>
parents:
20501
diff
changeset
|
761 msn_soap_post_request(soapconn,request); |
2c8c6d77f12c
Make use of the GQueue in MsnSoapConn to manage the SOAP requests, allowing them to work perfectly even when dispatching multiple requests at once.
Carlos Silva <typ0@pidgin.im>
parents:
20501
diff
changeset
|
762 } |
2c8c6d77f12c
Make use of the GQueue in MsnSoapConn to manage the SOAP requests, allowing them to work perfectly even when dispatching multiple requests at once.
Carlos Silva <typ0@pidgin.im>
parents:
20501
diff
changeset
|
763 } else { |
2c8c6d77f12c
Make use of the GQueue in MsnSoapConn to manage the SOAP requests, allowing them to work perfectly even when dispatching multiple requests at once.
Carlos Silva <typ0@pidgin.im>
parents:
20501
diff
changeset
|
764 purple_debug_info("MSN SOAP", "No requests to process found.\n"); |
2c8c6d77f12c
Make use of the GQueue in MsnSoapConn to manage the SOAP requests, allowing them to work perfectly even when dispatching multiple requests at once.
Carlos Silva <typ0@pidgin.im>
parents:
20501
diff
changeset
|
765 msn_soap_set_process_step(soapconn, MSN_SOAP_CONNECTED_IDLE); |
20394
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
766 } |
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
767 } |
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
768 } |
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
769 |
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
770 /*post the soap request , |
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
771 * if not connected, Connected first. |
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
772 */ |
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
773 void |
20770
58ce69a8582d
Correctly remove a buddy from the Pending list after it is accepted.
Carlos Silva <typ0@pidgin.im>
parents:
20759
diff
changeset
|
774 msn_soap_post(MsnSoapConn *soapconn, MsnSoapReq *request) |
20394
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
775 { |
20539
2c8c6d77f12c
Make use of the GQueue in MsnSoapConn to manage the SOAP requests, allowing them to work perfectly even when dispatching multiple requests at once.
Carlos Silva <typ0@pidgin.im>
parents:
20501
diff
changeset
|
776 MsnSoapReq *head_request; |
2c8c6d77f12c
Make use of the GQueue in MsnSoapConn to manage the SOAP requests, allowing them to work perfectly even when dispatching multiple requests at once.
Carlos Silva <typ0@pidgin.im>
parents:
20501
diff
changeset
|
777 |
2c8c6d77f12c
Make use of the GQueue in MsnSoapConn to manage the SOAP requests, allowing them to work perfectly even when dispatching multiple requests at once.
Carlos Silva <typ0@pidgin.im>
parents:
20501
diff
changeset
|
778 if (soapconn == NULL) |
2c8c6d77f12c
Make use of the GQueue in MsnSoapConn to manage the SOAP requests, allowing them to work perfectly even when dispatching multiple requests at once.
Carlos Silva <typ0@pidgin.im>
parents:
20501
diff
changeset
|
779 return; |
2c8c6d77f12c
Make use of the GQueue in MsnSoapConn to manage the SOAP requests, allowing them to work perfectly even when dispatching multiple requests at once.
Carlos Silva <typ0@pidgin.im>
parents:
20501
diff
changeset
|
780 |
20477
9a2a4a0c0003
Add the possibility to create an Address Book, useful for newly registered MSN users.
Carlos Silva <typ0@pidgin.im>
parents:
20471
diff
changeset
|
781 if (request != NULL) { |
20539
2c8c6d77f12c
Make use of the GQueue in MsnSoapConn to manage the SOAP requests, allowing them to work perfectly even when dispatching multiple requests at once.
Carlos Silva <typ0@pidgin.im>
parents:
20501
diff
changeset
|
782 #ifdef MSN_SOAP_DEBUG |
2c8c6d77f12c
Make use of the GQueue in MsnSoapConn to manage the SOAP requests, allowing them to work perfectly even when dispatching multiple requests at once.
Carlos Silva <typ0@pidgin.im>
parents:
20501
diff
changeset
|
783 purple_debug_misc("MSN SOAP", "Request added to the queue\n"); |
2c8c6d77f12c
Make use of the GQueue in MsnSoapConn to manage the SOAP requests, allowing them to work perfectly even when dispatching multiple requests at once.
Carlos Silva <typ0@pidgin.im>
parents:
20501
diff
changeset
|
784 #endif |
20394
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
785 g_queue_push_tail(soapconn->soap_queue, request); |
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
786 } |
20539
2c8c6d77f12c
Make use of the GQueue in MsnSoapConn to manage the SOAP requests, allowing them to work perfectly even when dispatching multiple requests at once.
Carlos Silva <typ0@pidgin.im>
parents:
20501
diff
changeset
|
787 |
2c8c6d77f12c
Make use of the GQueue in MsnSoapConn to manage the SOAP requests, allowing them to work perfectly even when dispatching multiple requests at once.
Carlos Silva <typ0@pidgin.im>
parents:
20501
diff
changeset
|
788 if ( !g_queue_is_empty(soapconn->soap_queue)) { |
2c8c6d77f12c
Make use of the GQueue in MsnSoapConn to manage the SOAP requests, allowing them to work perfectly even when dispatching multiple requests at once.
Carlos Silva <typ0@pidgin.im>
parents:
20501
diff
changeset
|
789 |
2c8c6d77f12c
Make use of the GQueue in MsnSoapConn to manage the SOAP requests, allowing them to work perfectly even when dispatching multiple requests at once.
Carlos Silva <typ0@pidgin.im>
parents:
20501
diff
changeset
|
790 /* we may have to reinitialize the soap connection, so avoid |
2c8c6d77f12c
Make use of the GQueue in MsnSoapConn to manage the SOAP requests, allowing them to work perfectly even when dispatching multiple requests at once.
Carlos Silva <typ0@pidgin.im>
parents:
20501
diff
changeset
|
791 * reusing the connection for now */ |
2c8c6d77f12c
Make use of the GQueue in MsnSoapConn to manage the SOAP requests, allowing them to work perfectly even when dispatching multiple requests at once.
Carlos Silva <typ0@pidgin.im>
parents:
20501
diff
changeset
|
792 |
2c8c6d77f12c
Make use of the GQueue in MsnSoapConn to manage the SOAP requests, allowing them to work perfectly even when dispatching multiple requests at once.
Carlos Silva <typ0@pidgin.im>
parents:
20501
diff
changeset
|
793 if (soapconn->step == MSN_SOAP_CONNECTED_IDLE) { |
2c8c6d77f12c
Make use of the GQueue in MsnSoapConn to manage the SOAP requests, allowing them to work perfectly even when dispatching multiple requests at once.
Carlos Silva <typ0@pidgin.im>
parents:
20501
diff
changeset
|
794 purple_debug_misc("MSN SOAP","Already connected to SOAP server, re-initializing\n"); |
2c8c6d77f12c
Make use of the GQueue in MsnSoapConn to manage the SOAP requests, allowing them to work perfectly even when dispatching multiple requests at once.
Carlos Silva <typ0@pidgin.im>
parents:
20501
diff
changeset
|
795 msn_soap_close_handler( &(soapconn->input_handler) ); |
2c8c6d77f12c
Make use of the GQueue in MsnSoapConn to manage the SOAP requests, allowing them to work perfectly even when dispatching multiple requests at once.
Carlos Silva <typ0@pidgin.im>
parents:
20501
diff
changeset
|
796 msn_soap_close_handler( &(soapconn->output_handler) ); |
2c8c6d77f12c
Make use of the GQueue in MsnSoapConn to manage the SOAP requests, allowing them to work perfectly even when dispatching multiple requests at once.
Carlos Silva <typ0@pidgin.im>
parents:
20501
diff
changeset
|
797 msn_soap_close(soapconn); |
2c8c6d77f12c
Make use of the GQueue in MsnSoapConn to manage the SOAP requests, allowing them to work perfectly even when dispatching multiple requests at once.
Carlos Silva <typ0@pidgin.im>
parents:
20501
diff
changeset
|
798 } |
2c8c6d77f12c
Make use of the GQueue in MsnSoapConn to manage the SOAP requests, allowing them to work perfectly even when dispatching multiple requests at once.
Carlos Silva <typ0@pidgin.im>
parents:
20501
diff
changeset
|
799 |
2c8c6d77f12c
Make use of the GQueue in MsnSoapConn to manage the SOAP requests, allowing them to work perfectly even when dispatching multiple requests at once.
Carlos Silva <typ0@pidgin.im>
parents:
20501
diff
changeset
|
800 if (!msn_soap_connected(soapconn) && (soapconn->step == MSN_SOAP_UNCONNECTED)) { |
20394
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
801 |
20539
2c8c6d77f12c
Make use of the GQueue in MsnSoapConn to manage the SOAP requests, allowing them to work perfectly even when dispatching multiple requests at once.
Carlos Silva <typ0@pidgin.im>
parents:
20501
diff
changeset
|
802 /*not connected?and we have something to process connect it first*/ |
2c8c6d77f12c
Make use of the GQueue in MsnSoapConn to manage the SOAP requests, allowing them to work perfectly even when dispatching multiple requests at once.
Carlos Silva <typ0@pidgin.im>
parents:
20501
diff
changeset
|
803 purple_debug_misc("MSN SOAP","No connection to SOAP server. Connecting...\n"); |
2c8c6d77f12c
Make use of the GQueue in MsnSoapConn to manage the SOAP requests, allowing them to work perfectly even when dispatching multiple requests at once.
Carlos Silva <typ0@pidgin.im>
parents:
20501
diff
changeset
|
804 head_request = g_queue_peek_head(soapconn->soap_queue); |
2c8c6d77f12c
Make use of the GQueue in MsnSoapConn to manage the SOAP requests, allowing them to work perfectly even when dispatching multiple requests at once.
Carlos Silva <typ0@pidgin.im>
parents:
20501
diff
changeset
|
805 |
2c8c6d77f12c
Make use of the GQueue in MsnSoapConn to manage the SOAP requests, allowing them to work perfectly even when dispatching multiple requests at once.
Carlos Silva <typ0@pidgin.im>
parents:
20501
diff
changeset
|
806 if (head_request == NULL) { |
2c8c6d77f12c
Make use of the GQueue in MsnSoapConn to manage the SOAP requests, allowing them to work perfectly even when dispatching multiple requests at once.
Carlos Silva <typ0@pidgin.im>
parents:
20501
diff
changeset
|
807 purple_debug_error("MSN SOAP", "Queue is not empty, but failed to peek the head request!\n"); |
2c8c6d77f12c
Make use of the GQueue in MsnSoapConn to manage the SOAP requests, allowing them to work perfectly even when dispatching multiple requests at once.
Carlos Silva <typ0@pidgin.im>
parents:
20501
diff
changeset
|
808 return; |
2c8c6d77f12c
Make use of the GQueue in MsnSoapConn to manage the SOAP requests, allowing them to work perfectly even when dispatching multiple requests at once.
Carlos Silva <typ0@pidgin.im>
parents:
20501
diff
changeset
|
809 } |
2c8c6d77f12c
Make use of the GQueue in MsnSoapConn to manage the SOAP requests, allowing them to work perfectly even when dispatching multiple requests at once.
Carlos Silva <typ0@pidgin.im>
parents:
20501
diff
changeset
|
810 |
2c8c6d77f12c
Make use of the GQueue in MsnSoapConn to manage the SOAP requests, allowing them to work perfectly even when dispatching multiple requests at once.
Carlos Silva <typ0@pidgin.im>
parents:
20501
diff
changeset
|
811 if (head_request->connect_init != NULL) { |
2c8c6d77f12c
Make use of the GQueue in MsnSoapConn to manage the SOAP requests, allowing them to work perfectly even when dispatching multiple requests at once.
Carlos Silva <typ0@pidgin.im>
parents:
20501
diff
changeset
|
812 head_request->connect_init(soapconn); |
2c8c6d77f12c
Make use of the GQueue in MsnSoapConn to manage the SOAP requests, allowing them to work perfectly even when dispatching multiple requests at once.
Carlos Silva <typ0@pidgin.im>
parents:
20501
diff
changeset
|
813 } |
2c8c6d77f12c
Make use of the GQueue in MsnSoapConn to manage the SOAP requests, allowing them to work perfectly even when dispatching multiple requests at once.
Carlos Silva <typ0@pidgin.im>
parents:
20501
diff
changeset
|
814 msn_soap_connect(soapconn); |
2c8c6d77f12c
Make use of the GQueue in MsnSoapConn to manage the SOAP requests, allowing them to work perfectly even when dispatching multiple requests at once.
Carlos Silva <typ0@pidgin.im>
parents:
20501
diff
changeset
|
815 return; |
2c8c6d77f12c
Make use of the GQueue in MsnSoapConn to manage the SOAP requests, allowing them to work perfectly even when dispatching multiple requests at once.
Carlos Silva <typ0@pidgin.im>
parents:
20501
diff
changeset
|
816 } |
2c8c6d77f12c
Make use of the GQueue in MsnSoapConn to manage the SOAP requests, allowing them to work perfectly even when dispatching multiple requests at once.
Carlos Silva <typ0@pidgin.im>
parents:
20501
diff
changeset
|
817 |
20770
58ce69a8582d
Correctly remove a buddy from the Pending list after it is accepted.
Carlos Silva <typ0@pidgin.im>
parents:
20759
diff
changeset
|
818 #ifdef MSN_SOAP_DEBUG |
20539
2c8c6d77f12c
Make use of the GQueue in MsnSoapConn to manage the SOAP requests, allowing them to work perfectly even when dispatching multiple requests at once.
Carlos Silva <typ0@pidgin.im>
parents:
20501
diff
changeset
|
819 purple_debug_info("MSN SOAP", "Currently processing another SOAP request\n"); |
2c8c6d77f12c
Make use of the GQueue in MsnSoapConn to manage the SOAP requests, allowing them to work perfectly even when dispatching multiple requests at once.
Carlos Silva <typ0@pidgin.im>
parents:
20501
diff
changeset
|
820 } else { |
2c8c6d77f12c
Make use of the GQueue in MsnSoapConn to manage the SOAP requests, allowing them to work perfectly even when dispatching multiple requests at once.
Carlos Silva <typ0@pidgin.im>
parents:
20501
diff
changeset
|
821 purple_debug_info("MSN SOAP", "No requests left to dispatch\n"); |
21866
03c950701fac
Move some curly braces around so static analysis tools can properly detect
Stu Tomlinson <stu@nosnilmot.com>
parents:
21121
diff
changeset
|
822 #endif |
20394
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
823 } |
20770
58ce69a8582d
Correctly remove a buddy from the Pending list after it is accepted.
Carlos Silva <typ0@pidgin.im>
parents:
20759
diff
changeset
|
824 |
20394
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
825 } |
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
826 |
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
827 /*Post the soap request action*/ |
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
828 void |
20539
2c8c6d77f12c
Make use of the GQueue in MsnSoapConn to manage the SOAP requests, allowing them to work perfectly even when dispatching multiple requests at once.
Carlos Silva <typ0@pidgin.im>
parents:
20501
diff
changeset
|
829 msn_soap_post_request(MsnSoapConn *soapconn, MsnSoapReq *request) |
20394
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
830 { |
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
831 char * request_str = NULL; |
20477
9a2a4a0c0003
Add the possibility to create an Address Book, useful for newly registered MSN users.
Carlos Silva <typ0@pidgin.im>
parents:
20471
diff
changeset
|
832 #ifdef MSN_SOAP_DEBUG |
20479
6a8463be5b23
Improve MSN_SOAP_DEBUG and workaround a Win32 bug which would case Pidgin to consume insane amounts of memory when printing a large string to the Debug Window.
Carlos Silva <typ0@pidgin.im>
parents:
20478
diff
changeset
|
833 #if !defined(_WIN32) |
20477
9a2a4a0c0003
Add the possibility to create an Address Book, useful for newly registered MSN users.
Carlos Silva <typ0@pidgin.im>
parents:
20471
diff
changeset
|
834 xmlnode * node; |
20479
6a8463be5b23
Improve MSN_SOAP_DEBUG and workaround a Win32 bug which would case Pidgin to consume insane amounts of memory when printing a large string to the Debug Window.
Carlos Silva <typ0@pidgin.im>
parents:
20478
diff
changeset
|
835 #endif |
6a8463be5b23
Improve MSN_SOAP_DEBUG and workaround a Win32 bug which would case Pidgin to consume insane amounts of memory when printing a large string to the Debug Window.
Carlos Silva <typ0@pidgin.im>
parents:
20478
diff
changeset
|
836 purple_debug_misc("MSN SOAP","msn_soap_post_request()\n"); |
6a8463be5b23
Improve MSN_SOAP_DEBUG and workaround a Win32 bug which would case Pidgin to consume insane amounts of memory when printing a large string to the Debug Window.
Carlos Silva <typ0@pidgin.im>
parents:
20478
diff
changeset
|
837 #endif |
20477
9a2a4a0c0003
Add the possibility to create an Address Book, useful for newly registered MSN users.
Carlos Silva <typ0@pidgin.im>
parents:
20471
diff
changeset
|
838 |
20489
321d25932f5e
Fix a bug where we were g_strdup'ing a previously freed pointer. Thanks to khc for the debugging.
Carlos Silva <typ0@pidgin.im>
parents:
20481
diff
changeset
|
839 msn_soap_set_process_step(soapconn, MSN_SOAP_PROCESSING); |
20989
2097b1664fa3
Fix some leaks and prevent some unnecessary allocations and frees.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
20832
diff
changeset
|
840 request_str = g_strdup_printf( |
20394
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
841 "POST %s HTTP/1.1\r\n" |
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
842 "SOAPAction: %s\r\n" |
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
843 "Content-Type:text/xml; charset=utf-8\r\n" |
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
844 "Cookie: MSPAuth=%s\r\n" |
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
845 "User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1)\r\n" |
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
846 "Accept: */*\r\n" |
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
847 "Host: %s\r\n" |
20465
2a5c1de05e0a
Fix authentication failures handling (ticket 1246) and fix some compiler warnings
Carlos Silva <typ0@pidgin.im>
parents:
20416
diff
changeset
|
848 "Content-Length: %" G_GSIZE_FORMAT "\r\n" |
20394
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
849 "Connection: Keep-Alive\r\n" |
20989
2097b1664fa3
Fix some leaks and prevent some unnecessary allocations and frees.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
20832
diff
changeset
|
850 "Cache-Control: no-cache\r\n\r\n" |
2097b1664fa3
Fix some leaks and prevent some unnecessary allocations and frees.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
20832
diff
changeset
|
851 "%s", |
20394
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
852 request->login_path, |
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
853 request->soap_action, |
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
854 soapconn->session->passport_info.mspauth, |
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
855 request->login_host, |
20989
2097b1664fa3
Fix some leaks and prevent some unnecessary allocations and frees.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
20832
diff
changeset
|
856 strlen(request->body), |
2097b1664fa3
Fix some leaks and prevent some unnecessary allocations and frees.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
20832
diff
changeset
|
857 request->body |
20394
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
858 ); |
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
859 |
20479
6a8463be5b23
Improve MSN_SOAP_DEBUG and workaround a Win32 bug which would case Pidgin to consume insane amounts of memory when printing a large string to the Debug Window.
Carlos Silva <typ0@pidgin.im>
parents:
20478
diff
changeset
|
860 #if defined(MSN_SOAP_DEBUG) && !defined(_WIN32) |
20477
9a2a4a0c0003
Add the possibility to create an Address Book, useful for newly registered MSN users.
Carlos Silva <typ0@pidgin.im>
parents:
20471
diff
changeset
|
861 node = xmlnode_from_str(request->body, -1); |
9a2a4a0c0003
Add the possibility to create an Address Book, useful for newly registered MSN users.
Carlos Silva <typ0@pidgin.im>
parents:
20471
diff
changeset
|
862 if (node != NULL) { |
20479
6a8463be5b23
Improve MSN_SOAP_DEBUG and workaround a Win32 bug which would case Pidgin to consume insane amounts of memory when printing a large string to the Debug Window.
Carlos Silva <typ0@pidgin.im>
parents:
20478
diff
changeset
|
863 char *formattedstr = xmlnode_to_formatted_str(node, NULL); |
20994
1054e35acf65
Fix compile with --enable-debug
Kevin Stange <kevin@simguy.net>
parents:
20989
diff
changeset
|
864 purple_debug_info("MSN SOAP","Posting request to SOAP server:\n%s%s\n",request_str, formattedstr); |
20479
6a8463be5b23
Improve MSN_SOAP_DEBUG and workaround a Win32 bug which would case Pidgin to consume insane amounts of memory when printing a large string to the Debug Window.
Carlos Silva <typ0@pidgin.im>
parents:
20478
diff
changeset
|
865 g_free(formattedstr); |
20477
9a2a4a0c0003
Add the possibility to create an Address Book, useful for newly registered MSN users.
Carlos Silva <typ0@pidgin.im>
parents:
20471
diff
changeset
|
866 xmlnode_free(node); |
9a2a4a0c0003
Add the possibility to create an Address Book, useful for newly registered MSN users.
Carlos Silva <typ0@pidgin.im>
parents:
20471
diff
changeset
|
867 } |
9a2a4a0c0003
Add the possibility to create an Address Book, useful for newly registered MSN users.
Carlos Silva <typ0@pidgin.im>
parents:
20471
diff
changeset
|
868 else |
20479
6a8463be5b23
Improve MSN_SOAP_DEBUG and workaround a Win32 bug which would case Pidgin to consume insane amounts of memory when printing a large string to the Debug Window.
Carlos Silva <typ0@pidgin.im>
parents:
20478
diff
changeset
|
869 purple_debug_info("MSN SOAP","Failed to parse SOAP request being sent:\n%s\n", request_str); |
20394
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
870 #endif |
23300
5cdd93dac7a2
Delete trailing whitespace
Mark Doliner <mark@kingant.net>
parents:
22798
diff
changeset
|
871 |
20394
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
872 /*free read buffer*/ |
20481
eb93710aec4d
Make buddy and group management actually work, add some SOAP templates, redesign some parts of code and separate some bigger functions into its smaller tasks which are completely unrelated to each other
Carlos Silva <typ0@pidgin.im>
parents:
20479
diff
changeset
|
873 // msn_soap_free_read_buf(soapconn); |
20394
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
874 /*post it to server*/ |
20481
eb93710aec4d
Make buddy and group management actually work, add some SOAP templates, redesign some parts of code and separate some bigger functions into its smaller tasks which are completely unrelated to each other
Carlos Silva <typ0@pidgin.im>
parents:
20479
diff
changeset
|
875 soapconn->data_cb = request->data_cb; |
eb93710aec4d
Make buddy and group management actually work, add some SOAP templates, redesign some parts of code and separate some bigger functions into its smaller tasks which are completely unrelated to each other
Carlos Silva <typ0@pidgin.im>
parents:
20479
diff
changeset
|
876 msn_soap_write(soapconn, request_str, request->written_cb); |
20394
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
877 } |
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
878 |