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