libpurple/protocols/msn/soap.c

Wed, 16 Jul 2008 21:55:08 +0000

author
Michael Ruprecht <maiku@pidgin.im>
date
Wed, 16 Jul 2008 21:55:08 +0000
branch
soc.2008.vv
changeset 26095
0eea4b8fd48c
parent 23469
libpurple/protocols/msn/soap2.c@74429b4ad296
parent 23846
libpurple/protocols/msn/soap2.c@70ad66bcda1b
child 26106
afdca955b6f4
child 26361
eeb395e3523f
permissions
-rw-r--r--

propagate from branch 'im.pidgin.pidgin' (head ed811e1aea8072d306d472ee970bd5755e60c0ea)
to branch 'im.pidgin.soc.2008.vv' (head e4022bc472320aed5b828b40425e436d457d9990)

21353
a70d31127cb6 beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@pidgin.im>
parents:
diff changeset
1 /**
23819
c3bbef4646b1 Clean up some MSN SOAP stuff.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23798
diff changeset
2 * @file soap.c
21353
a70d31127cb6 beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@pidgin.im>
parents:
diff changeset
3 * C file for SOAP connection related process
a70d31127cb6 beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@pidgin.im>
parents:
diff changeset
4 *
a70d31127cb6 beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@pidgin.im>
parents:
diff changeset
5 * purple
a70d31127cb6 beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@pidgin.im>
parents:
diff changeset
6 *
a70d31127cb6 beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@pidgin.im>
parents:
diff changeset
7 * Purple is the legal property of its developers, whose names are too numerous
a70d31127cb6 beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@pidgin.im>
parents:
diff changeset
8 * to list here. Please refer to the COPYRIGHT file distributed with this
a70d31127cb6 beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@pidgin.im>
parents:
diff changeset
9 * source distribution.
a70d31127cb6 beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@pidgin.im>
parents:
diff changeset
10 *
a70d31127cb6 beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@pidgin.im>
parents:
diff changeset
11 * This program is free software; you can redistribute it and/or modify
a70d31127cb6 beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@pidgin.im>
parents:
diff changeset
12 * it under the terms of the GNU General Public License as published by
a70d31127cb6 beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@pidgin.im>
parents:
diff changeset
13 * the Free Software Foundation; either version 2 of the License, or
a70d31127cb6 beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@pidgin.im>
parents:
diff changeset
14 * (at your option) any later version.
a70d31127cb6 beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@pidgin.im>
parents:
diff changeset
15 *
a70d31127cb6 beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@pidgin.im>
parents:
diff changeset
16 * This program is distributed in the hope that it will be useful,
a70d31127cb6 beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@pidgin.im>
parents:
diff changeset
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
a70d31127cb6 beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@pidgin.im>
parents:
diff changeset
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
a70d31127cb6 beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@pidgin.im>
parents:
diff changeset
19 * GNU General Public License for more details.
a70d31127cb6 beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@pidgin.im>
parents:
diff changeset
20 *
a70d31127cb6 beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@pidgin.im>
parents:
diff changeset
21 * You should have received a copy of the GNU General Public License
a70d31127cb6 beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@pidgin.im>
parents:
diff changeset
22 * along with this program; if not, write to the Free Software
a70d31127cb6 beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@pidgin.im>
parents:
diff changeset
23 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
a70d31127cb6 beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@pidgin.im>
parents:
diff changeset
24 */
a70d31127cb6 beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@pidgin.im>
parents:
diff changeset
25
21391
000024cbb022 #include "internal.h" to get a definition for G_GNUC_NULL_TERMINATED where
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 21389
diff changeset
26 #include "internal.h"
000024cbb022 #include "internal.h" to get a definition for G_GNUC_NULL_TERMINATED where
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 21389
diff changeset
27
23819
c3bbef4646b1 Clean up some MSN SOAP stuff.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23798
diff changeset
28 #include "soap.h"
21353
a70d31127cb6 beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@pidgin.im>
parents:
diff changeset
29
21355
500740852250 removes public handle to soap connection, instead a connection is looked up
Ka-Hing Cheung <khc@pidgin.im>
parents: 21354
diff changeset
30 #include "session.h"
500740852250 removes public handle to soap connection, instead a connection is looked up
Ka-Hing Cheung <khc@pidgin.im>
parents: 21354
diff changeset
31
21354
5c6020f03f2d mostly done with soap level parsing, compiles
Ka-Hing Cheung <khc@pidgin.im>
parents: 21353
diff changeset
32 #include "debug.h"
21353
a70d31127cb6 beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@pidgin.im>
parents:
diff changeset
33 #include "xmlnode.h"
a70d31127cb6 beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@pidgin.im>
parents:
diff changeset
34
a70d31127cb6 beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@pidgin.im>
parents:
diff changeset
35 #include <glib.h>
23078
4900794b4c3b Build fixes for MSVC
Daniel Atallah <datallah@pidgin.im>
parents: 22981
diff changeset
36 #if !defined(_WIN32) || !defined(_WINERROR_)
21353
a70d31127cb6 beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@pidgin.im>
parents:
diff changeset
37 #include <error.h>
23078
4900794b4c3b Build fixes for MSVC
Daniel Atallah <datallah@pidgin.im>
parents: 22981
diff changeset
38 #endif
21353
a70d31127cb6 beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@pidgin.im>
parents:
diff changeset
39
21361
f890366c8ec6 oim migrated to new soap code, quadruply duplicated message!
Ka-Hing Cheung <khc@pidgin.im>
parents: 21360
diff changeset
40 #define SOAP_TIMEOUT (5 * 60)
21355
500740852250 removes public handle to soap connection, instead a connection is looked up
Ka-Hing Cheung <khc@pidgin.im>
parents: 21354
diff changeset
41
500740852250 removes public handle to soap connection, instead a connection is looked up
Ka-Hing Cheung <khc@pidgin.im>
parents: 21354
diff changeset
42 typedef struct _MsnSoapRequest {
500740852250 removes public handle to soap connection, instead a connection is looked up
Ka-Hing Cheung <khc@pidgin.im>
parents: 21354
diff changeset
43 char *path;
500740852250 removes public handle to soap connection, instead a connection is looked up
Ka-Hing Cheung <khc@pidgin.im>
parents: 21354
diff changeset
44 MsnSoapMessage *message;
500740852250 removes public handle to soap connection, instead a connection is looked up
Ka-Hing Cheung <khc@pidgin.im>
parents: 21354
diff changeset
45 MsnSoapCallback cb;
500740852250 removes public handle to soap connection, instead a connection is looked up
Ka-Hing Cheung <khc@pidgin.im>
parents: 21354
diff changeset
46 gpointer cb_data;
500740852250 removes public handle to soap connection, instead a connection is looked up
Ka-Hing Cheung <khc@pidgin.im>
parents: 21354
diff changeset
47 } MsnSoapRequest;
500740852250 removes public handle to soap connection, instead a connection is looked up
Ka-Hing Cheung <khc@pidgin.im>
parents: 21354
diff changeset
48
500740852250 removes public handle to soap connection, instead a connection is looked up
Ka-Hing Cheung <khc@pidgin.im>
parents: 21354
diff changeset
49 typedef struct _MsnSoapConnection {
500740852250 removes public handle to soap connection, instead a connection is looked up
Ka-Hing Cheung <khc@pidgin.im>
parents: 21354
diff changeset
50 MsnSession *session;
500740852250 removes public handle to soap connection, instead a connection is looked up
Ka-Hing Cheung <khc@pidgin.im>
parents: 21354
diff changeset
51 char *host;
500740852250 removes public handle to soap connection, instead a connection is looked up
Ka-Hing Cheung <khc@pidgin.im>
parents: 21354
diff changeset
52
21360
92d5c6c58c85 cleanup soap connection with a timeout
Ka-Hing Cheung <khc@pidgin.im>
parents: 21358
diff changeset
53 time_t last_used;
21355
500740852250 removes public handle to soap connection, instead a connection is looked up
Ka-Hing Cheung <khc@pidgin.im>
parents: 21354
diff changeset
54 PurpleSslConnection *ssl;
500740852250 removes public handle to soap connection, instead a connection is looked up
Ka-Hing Cheung <khc@pidgin.im>
parents: 21354
diff changeset
55 gboolean connected;
500740852250 removes public handle to soap connection, instead a connection is looked up
Ka-Hing Cheung <khc@pidgin.im>
parents: 21354
diff changeset
56
500740852250 removes public handle to soap connection, instead a connection is looked up
Ka-Hing Cheung <khc@pidgin.im>
parents: 21354
diff changeset
57 guint event_handle;
500740852250 removes public handle to soap connection, instead a connection is looked up
Ka-Hing Cheung <khc@pidgin.im>
parents: 21354
diff changeset
58 GString *buf;
500740852250 removes public handle to soap connection, instead a connection is looked up
Ka-Hing Cheung <khc@pidgin.im>
parents: 21354
diff changeset
59 gsize handled_len;
500740852250 removes public handle to soap connection, instead a connection is looked up
Ka-Hing Cheung <khc@pidgin.im>
parents: 21354
diff changeset
60 gsize body_len;
500740852250 removes public handle to soap connection, instead a connection is looked up
Ka-Hing Cheung <khc@pidgin.im>
parents: 21354
diff changeset
61 int response_code;
500740852250 removes public handle to soap connection, instead a connection is looked up
Ka-Hing Cheung <khc@pidgin.im>
parents: 21354
diff changeset
62 gboolean headers_done;
21358
0e54f76775d4 signs on!
Ka-Hing Cheung <khc@pidgin.im>
parents: 21357
diff changeset
63 gboolean close_when_done;
0e54f76775d4 signs on!
Ka-Hing Cheung <khc@pidgin.im>
parents: 21357
diff changeset
64
21355
500740852250 removes public handle to soap connection, instead a connection is looked up
Ka-Hing Cheung <khc@pidgin.im>
parents: 21354
diff changeset
65 MsnSoapMessage *message;
500740852250 removes public handle to soap connection, instead a connection is looked up
Ka-Hing Cheung <khc@pidgin.im>
parents: 21354
diff changeset
66
500740852250 removes public handle to soap connection, instead a connection is looked up
Ka-Hing Cheung <khc@pidgin.im>
parents: 21354
diff changeset
67 GQueue *queue;
500740852250 removes public handle to soap connection, instead a connection is looked up
Ka-Hing Cheung <khc@pidgin.im>
parents: 21354
diff changeset
68 MsnSoapRequest *current_request;
500740852250 removes public handle to soap connection, instead a connection is looked up
Ka-Hing Cheung <khc@pidgin.im>
parents: 21354
diff changeset
69 } MsnSoapConnection;
500740852250 removes public handle to soap connection, instead a connection is looked up
Ka-Hing Cheung <khc@pidgin.im>
parents: 21354
diff changeset
70
500740852250 removes public handle to soap connection, instead a connection is looked up
Ka-Hing Cheung <khc@pidgin.im>
parents: 21354
diff changeset
71 static void msn_soap_connection_destroy_foreach_cb(gpointer item, gpointer data);
500740852250 removes public handle to soap connection, instead a connection is looked up
Ka-Hing Cheung <khc@pidgin.im>
parents: 21354
diff changeset
72 static gboolean msn_soap_connection_run(gpointer data);
500740852250 removes public handle to soap connection, instead a connection is looked up
Ka-Hing Cheung <khc@pidgin.im>
parents: 21354
diff changeset
73
500740852250 removes public handle to soap connection, instead a connection is looked up
Ka-Hing Cheung <khc@pidgin.im>
parents: 21354
diff changeset
74 static MsnSoapConnection *msn_soap_connection_new(MsnSession *session,
500740852250 removes public handle to soap connection, instead a connection is looked up
Ka-Hing Cheung <khc@pidgin.im>
parents: 21354
diff changeset
75 const char *host);
500740852250 removes public handle to soap connection, instead a connection is looked up
Ka-Hing Cheung <khc@pidgin.im>
parents: 21354
diff changeset
76 static void msn_soap_connection_handle_next(MsnSoapConnection *conn);
500740852250 removes public handle to soap connection, instead a connection is looked up
Ka-Hing Cheung <khc@pidgin.im>
parents: 21354
diff changeset
77 static void msn_soap_connection_destroy(MsnSoapConnection *conn);
500740852250 removes public handle to soap connection, instead a connection is looked up
Ka-Hing Cheung <khc@pidgin.im>
parents: 21354
diff changeset
78
500740852250 removes public handle to soap connection, instead a connection is looked up
Ka-Hing Cheung <khc@pidgin.im>
parents: 21354
diff changeset
79 static void msn_soap_message_send_internal(MsnSession *session,
500740852250 removes public handle to soap connection, instead a connection is looked up
Ka-Hing Cheung <khc@pidgin.im>
parents: 21354
diff changeset
80 MsnSoapMessage *message, const char *host, const char *path,
500740852250 removes public handle to soap connection, instead a connection is looked up
Ka-Hing Cheung <khc@pidgin.im>
parents: 21354
diff changeset
81 MsnSoapCallback cb, gpointer cb_data, gboolean first);
500740852250 removes public handle to soap connection, instead a connection is looked up
Ka-Hing Cheung <khc@pidgin.im>
parents: 21354
diff changeset
82
23798
604090d9bfb0 Don't free the SOAP message when we're still using it for a redirect.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23797
diff changeset
83 static void msn_soap_request_destroy(MsnSoapRequest *req, gboolean keep_message);
21358
0e54f76775d4 signs on!
Ka-Hing Cheung <khc@pidgin.im>
parents: 21357
diff changeset
84 static void msn_soap_connection_sanitize(MsnSoapConnection *conn, gboolean disconnect);
23774
032236e2eb9e Patch from tomgr to resend once if the connection is down, fixes #5379
Ka-Hing Cheung <khc@pidgin.im>
parents: 23773
diff changeset
85 static gboolean msn_soap_write_cb_internal(gpointer data, gint fd, PurpleInputCondition cond, gboolean initial);
23469
74429b4ad296 Patch from tomgr and Maiku that workarounds some OS X issue,
Ka-Hing Cheung <khc@pidgin.im>
parents: 23078
diff changeset
86 static void msn_soap_process(MsnSoapConnection *conn);
21353
a70d31127cb6 beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@pidgin.im>
parents:
diff changeset
87
21360
92d5c6c58c85 cleanup soap connection with a timeout
Ka-Hing Cheung <khc@pidgin.im>
parents: 21358
diff changeset
88 static gboolean
92d5c6c58c85 cleanup soap connection with a timeout
Ka-Hing Cheung <khc@pidgin.im>
parents: 21358
diff changeset
89 msn_soap_cleanup_each(gpointer key, gpointer value, gpointer data)
92d5c6c58c85 cleanup soap connection with a timeout
Ka-Hing Cheung <khc@pidgin.im>
parents: 21358
diff changeset
90 {
92d5c6c58c85 cleanup soap connection with a timeout
Ka-Hing Cheung <khc@pidgin.im>
parents: 21358
diff changeset
91 MsnSoapConnection *conn = value;
92d5c6c58c85 cleanup soap connection with a timeout
Ka-Hing Cheung <khc@pidgin.im>
parents: 21358
diff changeset
92 time_t *t = data;
92d5c6c58c85 cleanup soap connection with a timeout
Ka-Hing Cheung <khc@pidgin.im>
parents: 21358
diff changeset
93
92d5c6c58c85 cleanup soap connection with a timeout
Ka-Hing Cheung <khc@pidgin.im>
parents: 21358
diff changeset
94 if ((*t - conn->last_used) > SOAP_TIMEOUT * 2) {
92d5c6c58c85 cleanup soap connection with a timeout
Ka-Hing Cheung <khc@pidgin.im>
parents: 21358
diff changeset
95 purple_debug_info("soap", "cleaning up soap conn %p\n", conn);
92d5c6c58c85 cleanup soap connection with a timeout
Ka-Hing Cheung <khc@pidgin.im>
parents: 21358
diff changeset
96 return TRUE;
92d5c6c58c85 cleanup soap connection with a timeout
Ka-Hing Cheung <khc@pidgin.im>
parents: 21358
diff changeset
97 }
92d5c6c58c85 cleanup soap connection with a timeout
Ka-Hing Cheung <khc@pidgin.im>
parents: 21358
diff changeset
98
92d5c6c58c85 cleanup soap connection with a timeout
Ka-Hing Cheung <khc@pidgin.im>
parents: 21358
diff changeset
99 return FALSE;
92d5c6c58c85 cleanup soap connection with a timeout
Ka-Hing Cheung <khc@pidgin.im>
parents: 21358
diff changeset
100 }
92d5c6c58c85 cleanup soap connection with a timeout
Ka-Hing Cheung <khc@pidgin.im>
parents: 21358
diff changeset
101
92d5c6c58c85 cleanup soap connection with a timeout
Ka-Hing Cheung <khc@pidgin.im>
parents: 21358
diff changeset
102 static gboolean
92d5c6c58c85 cleanup soap connection with a timeout
Ka-Hing Cheung <khc@pidgin.im>
parents: 21358
diff changeset
103 msn_soap_cleanup_for_session(gpointer data)
92d5c6c58c85 cleanup soap connection with a timeout
Ka-Hing Cheung <khc@pidgin.im>
parents: 21358
diff changeset
104 {
92d5c6c58c85 cleanup soap connection with a timeout
Ka-Hing Cheung <khc@pidgin.im>
parents: 21358
diff changeset
105 MsnSession *sess = data;
92d5c6c58c85 cleanup soap connection with a timeout
Ka-Hing Cheung <khc@pidgin.im>
parents: 21358
diff changeset
106 time_t t = time(NULL);
92d5c6c58c85 cleanup soap connection with a timeout
Ka-Hing Cheung <khc@pidgin.im>
parents: 21358
diff changeset
107
92d5c6c58c85 cleanup soap connection with a timeout
Ka-Hing Cheung <khc@pidgin.im>
parents: 21358
diff changeset
108 purple_debug_info("soap", "session cleanup timeout\n");
92d5c6c58c85 cleanup soap connection with a timeout
Ka-Hing Cheung <khc@pidgin.im>
parents: 21358
diff changeset
109
92d5c6c58c85 cleanup soap connection with a timeout
Ka-Hing Cheung <khc@pidgin.im>
parents: 21358
diff changeset
110 if (sess->soap_table) {
92d5c6c58c85 cleanup soap connection with a timeout
Ka-Hing Cheung <khc@pidgin.im>
parents: 21358
diff changeset
111 g_hash_table_foreach_remove(sess->soap_table, msn_soap_cleanup_each,
92d5c6c58c85 cleanup soap connection with a timeout
Ka-Hing Cheung <khc@pidgin.im>
parents: 21358
diff changeset
112 &t);
92d5c6c58c85 cleanup soap connection with a timeout
Ka-Hing Cheung <khc@pidgin.im>
parents: 21358
diff changeset
113
92d5c6c58c85 cleanup soap connection with a timeout
Ka-Hing Cheung <khc@pidgin.im>
parents: 21358
diff changeset
114 if (g_hash_table_size(sess->soap_table) == 0) {
92d5c6c58c85 cleanup soap connection with a timeout
Ka-Hing Cheung <khc@pidgin.im>
parents: 21358
diff changeset
115 purple_timeout_remove(sess->soap_cleanup_handle);
92d5c6c58c85 cleanup soap connection with a timeout
Ka-Hing Cheung <khc@pidgin.im>
parents: 21358
diff changeset
116 sess->soap_cleanup_handle = 0;
92d5c6c58c85 cleanup soap connection with a timeout
Ka-Hing Cheung <khc@pidgin.im>
parents: 21358
diff changeset
117 }
92d5c6c58c85 cleanup soap connection with a timeout
Ka-Hing Cheung <khc@pidgin.im>
parents: 21358
diff changeset
118 }
92d5c6c58c85 cleanup soap connection with a timeout
Ka-Hing Cheung <khc@pidgin.im>
parents: 21358
diff changeset
119
92d5c6c58c85 cleanup soap connection with a timeout
Ka-Hing Cheung <khc@pidgin.im>
parents: 21358
diff changeset
120 return TRUE;
92d5c6c58c85 cleanup soap connection with a timeout
Ka-Hing Cheung <khc@pidgin.im>
parents: 21358
diff changeset
121 }
21353
a70d31127cb6 beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@pidgin.im>
parents:
diff changeset
122
21355
500740852250 removes public handle to soap connection, instead a connection is looked up
Ka-Hing Cheung <khc@pidgin.im>
parents: 21354
diff changeset
123 static MsnSoapConnection *
500740852250 removes public handle to soap connection, instead a connection is looked up
Ka-Hing Cheung <khc@pidgin.im>
parents: 21354
diff changeset
124 msn_soap_get_connection(MsnSession *session, const char *host)
21353
a70d31127cb6 beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@pidgin.im>
parents:
diff changeset
125 {
21355
500740852250 removes public handle to soap connection, instead a connection is looked up
Ka-Hing Cheung <khc@pidgin.im>
parents: 21354
diff changeset
126 MsnSoapConnection *conn = NULL;
500740852250 removes public handle to soap connection, instead a connection is looked up
Ka-Hing Cheung <khc@pidgin.im>
parents: 21354
diff changeset
127
500740852250 removes public handle to soap connection, instead a connection is looked up
Ka-Hing Cheung <khc@pidgin.im>
parents: 21354
diff changeset
128 if (session->soap_table) {
21361
f890366c8ec6 oim migrated to new soap code, quadruply duplicated message!
Ka-Hing Cheung <khc@pidgin.im>
parents: 21360
diff changeset
129 conn = g_hash_table_lookup(session->soap_table, host);
21355
500740852250 removes public handle to soap connection, instead a connection is looked up
Ka-Hing Cheung <khc@pidgin.im>
parents: 21354
diff changeset
130 } else {
500740852250 removes public handle to soap connection, instead a connection is looked up
Ka-Hing Cheung <khc@pidgin.im>
parents: 21354
diff changeset
131 session->soap_table = g_hash_table_new_full(g_str_hash, g_str_equal,
500740852250 removes public handle to soap connection, instead a connection is looked up
Ka-Hing Cheung <khc@pidgin.im>
parents: 21354
diff changeset
132 NULL, (GDestroyNotify)msn_soap_connection_destroy);
500740852250 removes public handle to soap connection, instead a connection is looked up
Ka-Hing Cheung <khc@pidgin.im>
parents: 21354
diff changeset
133 }
500740852250 removes public handle to soap connection, instead a connection is looked up
Ka-Hing Cheung <khc@pidgin.im>
parents: 21354
diff changeset
134
21360
92d5c6c58c85 cleanup soap connection with a timeout
Ka-Hing Cheung <khc@pidgin.im>
parents: 21358
diff changeset
135 if (session->soap_cleanup_handle == 0)
92d5c6c58c85 cleanup soap connection with a timeout
Ka-Hing Cheung <khc@pidgin.im>
parents: 21358
diff changeset
136 session->soap_cleanup_handle = purple_timeout_add(SOAP_TIMEOUT * 1000,
92d5c6c58c85 cleanup soap connection with a timeout
Ka-Hing Cheung <khc@pidgin.im>
parents: 21358
diff changeset
137 msn_soap_cleanup_for_session, session);
92d5c6c58c85 cleanup soap connection with a timeout
Ka-Hing Cheung <khc@pidgin.im>
parents: 21358
diff changeset
138
21355
500740852250 removes public handle to soap connection, instead a connection is looked up
Ka-Hing Cheung <khc@pidgin.im>
parents: 21354
diff changeset
139 if (conn == NULL) {
500740852250 removes public handle to soap connection, instead a connection is looked up
Ka-Hing Cheung <khc@pidgin.im>
parents: 21354
diff changeset
140 conn = msn_soap_connection_new(session, host);
500740852250 removes public handle to soap connection, instead a connection is looked up
Ka-Hing Cheung <khc@pidgin.im>
parents: 21354
diff changeset
141 g_hash_table_insert(session->soap_table, conn->host, conn);
500740852250 removes public handle to soap connection, instead a connection is looked up
Ka-Hing Cheung <khc@pidgin.im>
parents: 21354
diff changeset
142 }
500740852250 removes public handle to soap connection, instead a connection is looked up
Ka-Hing Cheung <khc@pidgin.im>
parents: 21354
diff changeset
143
21360
92d5c6c58c85 cleanup soap connection with a timeout
Ka-Hing Cheung <khc@pidgin.im>
parents: 21358
diff changeset
144 conn->last_used = time(NULL);
92d5c6c58c85 cleanup soap connection with a timeout
Ka-Hing Cheung <khc@pidgin.im>
parents: 21358
diff changeset
145
21355
500740852250 removes public handle to soap connection, instead a connection is looked up
Ka-Hing Cheung <khc@pidgin.im>
parents: 21354
diff changeset
146 return conn;
500740852250 removes public handle to soap connection, instead a connection is looked up
Ka-Hing Cheung <khc@pidgin.im>
parents: 21354
diff changeset
147 }
500740852250 removes public handle to soap connection, instead a connection is looked up
Ka-Hing Cheung <khc@pidgin.im>
parents: 21354
diff changeset
148
500740852250 removes public handle to soap connection, instead a connection is looked up
Ka-Hing Cheung <khc@pidgin.im>
parents: 21354
diff changeset
149 static MsnSoapConnection *
500740852250 removes public handle to soap connection, instead a connection is looked up
Ka-Hing Cheung <khc@pidgin.im>
parents: 21354
diff changeset
150 msn_soap_connection_new(MsnSession *session, const char *host)
500740852250 removes public handle to soap connection, instead a connection is looked up
Ka-Hing Cheung <khc@pidgin.im>
parents: 21354
diff changeset
151 {
500740852250 removes public handle to soap connection, instead a connection is looked up
Ka-Hing Cheung <khc@pidgin.im>
parents: 21354
diff changeset
152 MsnSoapConnection *conn = g_new0(MsnSoapConnection, 1);
21353
a70d31127cb6 beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@pidgin.im>
parents:
diff changeset
153 conn->session = session;
21355
500740852250 removes public handle to soap connection, instead a connection is looked up
Ka-Hing Cheung <khc@pidgin.im>
parents: 21354
diff changeset
154 conn->host = g_strdup(host);
21353
a70d31127cb6 beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@pidgin.im>
parents:
diff changeset
155 conn->queue = g_queue_new();
a70d31127cb6 beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@pidgin.im>
parents:
diff changeset
156 return conn;
a70d31127cb6 beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@pidgin.im>
parents:
diff changeset
157 }
a70d31127cb6 beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@pidgin.im>
parents:
diff changeset
158
a70d31127cb6 beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@pidgin.im>
parents:
diff changeset
159 static void
a70d31127cb6 beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@pidgin.im>
parents:
diff changeset
160 msn_soap_connected_cb(gpointer data, PurpleSslConnection *ssl,
a70d31127cb6 beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@pidgin.im>
parents:
diff changeset
161 PurpleInputCondition cond)
a70d31127cb6 beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@pidgin.im>
parents:
diff changeset
162 {
21355
500740852250 removes public handle to soap connection, instead a connection is looked up
Ka-Hing Cheung <khc@pidgin.im>
parents: 21354
diff changeset
163 MsnSoapConnection *conn = data;
21353
a70d31127cb6 beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@pidgin.im>
parents:
diff changeset
164
a70d31127cb6 beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@pidgin.im>
parents:
diff changeset
165 conn->connected = TRUE;
a70d31127cb6 beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@pidgin.im>
parents:
diff changeset
166
21355
500740852250 removes public handle to soap connection, instead a connection is looked up
Ka-Hing Cheung <khc@pidgin.im>
parents: 21354
diff changeset
167 if (conn->event_handle == 0)
21398
a31c84608fcb read as much from the fd as possible if we get a read event, hopefully will
Ka-Hing Cheung <khc@pidgin.im>
parents: 21391
diff changeset
168 conn->event_handle = purple_timeout_add(0, msn_soap_connection_run, conn);
21353
a70d31127cb6 beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@pidgin.im>
parents:
diff changeset
169 }
a70d31127cb6 beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@pidgin.im>
parents:
diff changeset
170
a70d31127cb6 beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@pidgin.im>
parents:
diff changeset
171 static void
a70d31127cb6 beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@pidgin.im>
parents:
diff changeset
172 msn_soap_error_cb(PurpleSslConnection *ssl, PurpleSslErrorType error,
a70d31127cb6 beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@pidgin.im>
parents:
diff changeset
173 gpointer data)
a70d31127cb6 beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@pidgin.im>
parents:
diff changeset
174 {
21355
500740852250 removes public handle to soap connection, instead a connection is looked up
Ka-Hing Cheung <khc@pidgin.im>
parents: 21354
diff changeset
175 MsnSoapConnection *conn = data;
21353
a70d31127cb6 beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@pidgin.im>
parents:
diff changeset
176
22060
5cf20e84d1b5 fix a double free
Ka-Hing Cheung <khc@pidgin.im>
parents: 21672
diff changeset
177 /* sslconn already frees the connection in case of error */
5cf20e84d1b5 fix a double free
Ka-Hing Cheung <khc@pidgin.im>
parents: 21672
diff changeset
178 conn->ssl = NULL;
5cf20e84d1b5 fix a double free
Ka-Hing Cheung <khc@pidgin.im>
parents: 21672
diff changeset
179
21355
500740852250 removes public handle to soap connection, instead a connection is looked up
Ka-Hing Cheung <khc@pidgin.im>
parents: 21354
diff changeset
180 g_hash_table_remove(conn->session->soap_table, conn->host);
21353
a70d31127cb6 beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@pidgin.im>
parents:
diff changeset
181 }
a70d31127cb6 beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@pidgin.im>
parents:
diff changeset
182
21354
5c6020f03f2d mostly done with soap level parsing, compiles
Ka-Hing Cheung <khc@pidgin.im>
parents: 21353
diff changeset
183 static gboolean
21355
500740852250 removes public handle to soap connection, instead a connection is looked up
Ka-Hing Cheung <khc@pidgin.im>
parents: 21354
diff changeset
184 msn_soap_handle_redirect(MsnSoapConnection *conn, const char *url)
21354
5c6020f03f2d mostly done with soap level parsing, compiles
Ka-Hing Cheung <khc@pidgin.im>
parents: 21353
diff changeset
185 {
23797
be32acbae9ce Use purple_url_parse for splitting up the MSN SOAP redirect instead of
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23794
diff changeset
186 char *host;
be32acbae9ce Use purple_url_parse for splitting up the MSN SOAP redirect instead of
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23794
diff changeset
187 char *path;
21354
5c6020f03f2d mostly done with soap level parsing, compiles
Ka-Hing Cheung <khc@pidgin.im>
parents: 21353
diff changeset
188
23797
be32acbae9ce Use purple_url_parse for splitting up the MSN SOAP redirect instead of
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23794
diff changeset
189 if (purple_url_parse(url, &host, NULL, &path, NULL, NULL)) {
21355
500740852250 removes public handle to soap connection, instead a connection is looked up
Ka-Hing Cheung <khc@pidgin.im>
parents: 21354
diff changeset
190 msn_soap_message_send_internal(conn->session,
500740852250 removes public handle to soap connection, instead a connection is looked up
Ka-Hing Cheung <khc@pidgin.im>
parents: 21354
diff changeset
191 conn->current_request->message, host, path,
500740852250 removes public handle to soap connection, instead a connection is looked up
Ka-Hing Cheung <khc@pidgin.im>
parents: 21354
diff changeset
192 conn->current_request->cb, conn->current_request->cb_data, TRUE);
21354
5c6020f03f2d mostly done with soap level parsing, compiles
Ka-Hing Cheung <khc@pidgin.im>
parents: 21353
diff changeset
193
23798
604090d9bfb0 Don't free the SOAP message when we're still using it for a redirect.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23797
diff changeset
194 msn_soap_request_destroy(conn->current_request, TRUE);
21355
500740852250 removes public handle to soap connection, instead a connection is looked up
Ka-Hing Cheung <khc@pidgin.im>
parents: 21354
diff changeset
195 conn->current_request = NULL;
500740852250 removes public handle to soap connection, instead a connection is looked up
Ka-Hing Cheung <khc@pidgin.im>
parents: 21354
diff changeset
196
500740852250 removes public handle to soap connection, instead a connection is looked up
Ka-Hing Cheung <khc@pidgin.im>
parents: 21354
diff changeset
197 g_free(host);
500740852250 removes public handle to soap connection, instead a connection is looked up
Ka-Hing Cheung <khc@pidgin.im>
parents: 21354
diff changeset
198 g_free(path);
21354
5c6020f03f2d mostly done with soap level parsing, compiles
Ka-Hing Cheung <khc@pidgin.im>
parents: 21353
diff changeset
199
5c6020f03f2d mostly done with soap level parsing, compiles
Ka-Hing Cheung <khc@pidgin.im>
parents: 21353
diff changeset
200 return TRUE;
5c6020f03f2d mostly done with soap level parsing, compiles
Ka-Hing Cheung <khc@pidgin.im>
parents: 21353
diff changeset
201 }
5c6020f03f2d mostly done with soap level parsing, compiles
Ka-Hing Cheung <khc@pidgin.im>
parents: 21353
diff changeset
202
5c6020f03f2d mostly done with soap level parsing, compiles
Ka-Hing Cheung <khc@pidgin.im>
parents: 21353
diff changeset
203 return FALSE;
5c6020f03f2d mostly done with soap level parsing, compiles
Ka-Hing Cheung <khc@pidgin.im>
parents: 21353
diff changeset
204 }
5c6020f03f2d mostly done with soap level parsing, compiles
Ka-Hing Cheung <khc@pidgin.im>
parents: 21353
diff changeset
205
5c6020f03f2d mostly done with soap level parsing, compiles
Ka-Hing Cheung <khc@pidgin.im>
parents: 21353
diff changeset
206 static gboolean
21355
500740852250 removes public handle to soap connection, instead a connection is looked up
Ka-Hing Cheung <khc@pidgin.im>
parents: 21354
diff changeset
207 msn_soap_handle_body(MsnSoapConnection *conn, MsnSoapMessage *response)
21354
5c6020f03f2d mostly done with soap level parsing, compiles
Ka-Hing Cheung <khc@pidgin.im>
parents: 21353
diff changeset
208 {
21361
f890366c8ec6 oim migrated to new soap code, quadruply duplicated message!
Ka-Hing Cheung <khc@pidgin.im>
parents: 21360
diff changeset
209 xmlnode *body = xmlnode_get_child(response->xml, "Body");
21672
cb25ada4f6a0 soap faults are now properly handled
Ka-Hing Cheung <khc@pidgin.im>
parents: 21398
diff changeset
210 xmlnode *fault = xmlnode_get_child(response->xml, "Fault");
21354
5c6020f03f2d mostly done with soap level parsing, compiles
Ka-Hing Cheung <khc@pidgin.im>
parents: 21353
diff changeset
211
21672
cb25ada4f6a0 soap faults are now properly handled
Ka-Hing Cheung <khc@pidgin.im>
parents: 21398
diff changeset
212 if (fault) {
cb25ada4f6a0 soap faults are now properly handled
Ka-Hing Cheung <khc@pidgin.im>
parents: 21398
diff changeset
213 xmlnode *faultcode = xmlnode_get_child(fault, "faultcode");
21354
5c6020f03f2d mostly done with soap level parsing, compiles
Ka-Hing Cheung <khc@pidgin.im>
parents: 21353
diff changeset
214
21672
cb25ada4f6a0 soap faults are now properly handled
Ka-Hing Cheung <khc@pidgin.im>
parents: 21398
diff changeset
215 if (faultcode != NULL) {
cb25ada4f6a0 soap faults are now properly handled
Ka-Hing Cheung <khc@pidgin.im>
parents: 21398
diff changeset
216 char *faultdata = xmlnode_get_data(faultcode);
21354
5c6020f03f2d mostly done with soap level parsing, compiles
Ka-Hing Cheung <khc@pidgin.im>
parents: 21353
diff changeset
217
21672
cb25ada4f6a0 soap faults are now properly handled
Ka-Hing Cheung <khc@pidgin.im>
parents: 21398
diff changeset
218 if (g_str_equal(faultdata, "psf:Redirect")) {
23794
3175e940fa12 Use the correct xmlnode when processing SOAP Faults.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23787
diff changeset
219 xmlnode *url = xmlnode_get_child(fault, "redirectUrl");
21355
500740852250 removes public handle to soap connection, instead a connection is looked up
Ka-Hing Cheung <khc@pidgin.im>
parents: 21354
diff changeset
220
21672
cb25ada4f6a0 soap faults are now properly handled
Ka-Hing Cheung <khc@pidgin.im>
parents: 21398
diff changeset
221 if (url) {
cb25ada4f6a0 soap faults are now properly handled
Ka-Hing Cheung <khc@pidgin.im>
parents: 21398
diff changeset
222 char *urldata = xmlnode_get_data(url);
cb25ada4f6a0 soap faults are now properly handled
Ka-Hing Cheung <khc@pidgin.im>
parents: 21398
diff changeset
223 msn_soap_handle_redirect(conn, urldata);
cb25ada4f6a0 soap faults are now properly handled
Ka-Hing Cheung <khc@pidgin.im>
parents: 21398
diff changeset
224 g_free(urldata);
21354
5c6020f03f2d mostly done with soap level parsing, compiles
Ka-Hing Cheung <khc@pidgin.im>
parents: 21353
diff changeset
225 }
21358
0e54f76775d4 signs on!
Ka-Hing Cheung <khc@pidgin.im>
parents: 21357
diff changeset
226
0e54f76775d4 signs on!
Ka-Hing Cheung <khc@pidgin.im>
parents: 21357
diff changeset
227 g_free(faultdata);
23762
8bb3533742fd fixed a memleak or 3, or maybe 4, or 5. Some of these applies to the p14
Ka-Hing Cheung <khc@pidgin.im>
parents: 23760
diff changeset
228 msn_soap_message_destroy(response);
21672
cb25ada4f6a0 soap faults are now properly handled
Ka-Hing Cheung <khc@pidgin.im>
parents: 21398
diff changeset
229 return TRUE;
cb25ada4f6a0 soap faults are now properly handled
Ka-Hing Cheung <khc@pidgin.im>
parents: 21398
diff changeset
230 } else if (g_str_equal(faultdata, "wsse:FailedAuthentication")) {
23794
3175e940fa12 Use the correct xmlnode when processing SOAP Faults.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23787
diff changeset
231 xmlnode *reason = xmlnode_get_child(fault, "faultstring");
21672
cb25ada4f6a0 soap faults are now properly handled
Ka-Hing Cheung <khc@pidgin.im>
parents: 21398
diff changeset
232 char *reasondata = xmlnode_get_data(reason);
cb25ada4f6a0 soap faults are now properly handled
Ka-Hing Cheung <khc@pidgin.im>
parents: 21398
diff changeset
233
cb25ada4f6a0 soap faults are now properly handled
Ka-Hing Cheung <khc@pidgin.im>
parents: 21398
diff changeset
234 msn_soap_connection_sanitize(conn, TRUE);
cb25ada4f6a0 soap faults are now properly handled
Ka-Hing Cheung <khc@pidgin.im>
parents: 21398
diff changeset
235 msn_session_set_error(conn->session, MSN_ERROR_AUTH,
cb25ada4f6a0 soap faults are now properly handled
Ka-Hing Cheung <khc@pidgin.im>
parents: 21398
diff changeset
236 reasondata);
cb25ada4f6a0 soap faults are now properly handled
Ka-Hing Cheung <khc@pidgin.im>
parents: 21398
diff changeset
237
cb25ada4f6a0 soap faults are now properly handled
Ka-Hing Cheung <khc@pidgin.im>
parents: 21398
diff changeset
238 g_free(reasondata);
cb25ada4f6a0 soap faults are now properly handled
Ka-Hing Cheung <khc@pidgin.im>
parents: 21398
diff changeset
239 g_free(faultdata);
23762
8bb3533742fd fixed a memleak or 3, or maybe 4, or 5. Some of these applies to the p14
Ka-Hing Cheung <khc@pidgin.im>
parents: 23760
diff changeset
240 msn_soap_message_destroy(response);
21672
cb25ada4f6a0 soap faults are now properly handled
Ka-Hing Cheung <khc@pidgin.im>
parents: 21398
diff changeset
241 return FALSE;
21354
5c6020f03f2d mostly done with soap level parsing, compiles
Ka-Hing Cheung <khc@pidgin.im>
parents: 21353
diff changeset
242 }
21672
cb25ada4f6a0 soap faults are now properly handled
Ka-Hing Cheung <khc@pidgin.im>
parents: 21398
diff changeset
243
cb25ada4f6a0 soap faults are now properly handled
Ka-Hing Cheung <khc@pidgin.im>
parents: 21398
diff changeset
244 g_free(faultdata);
21358
0e54f76775d4 signs on!
Ka-Hing Cheung <khc@pidgin.im>
parents: 21357
diff changeset
245 }
21672
cb25ada4f6a0 soap faults are now properly handled
Ka-Hing Cheung <khc@pidgin.im>
parents: 21398
diff changeset
246 }
21354
5c6020f03f2d mostly done with soap level parsing, compiles
Ka-Hing Cheung <khc@pidgin.im>
parents: 21353
diff changeset
247
21672
cb25ada4f6a0 soap faults are now properly handled
Ka-Hing Cheung <khc@pidgin.im>
parents: 21398
diff changeset
248 if (fault || body) {
cb25ada4f6a0 soap faults are now properly handled
Ka-Hing Cheung <khc@pidgin.im>
parents: 21398
diff changeset
249 MsnSoapRequest *request = conn->current_request;
21358
0e54f76775d4 signs on!
Ka-Hing Cheung <khc@pidgin.im>
parents: 21357
diff changeset
250 conn->current_request = NULL;
0e54f76775d4 signs on!
Ka-Hing Cheung <khc@pidgin.im>
parents: 21357
diff changeset
251 request->cb(request->message, response,
0e54f76775d4 signs on!
Ka-Hing Cheung <khc@pidgin.im>
parents: 21357
diff changeset
252 request->cb_data);
23762
8bb3533742fd fixed a memleak or 3, or maybe 4, or 5. Some of these applies to the p14
Ka-Hing Cheung <khc@pidgin.im>
parents: 23760
diff changeset
253 msn_soap_message_destroy(response);
23798
604090d9bfb0 Don't free the SOAP message when we're still using it for a redirect.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23797
diff changeset
254 msn_soap_request_destroy(request, FALSE);
21354
5c6020f03f2d mostly done with soap level parsing, compiles
Ka-Hing Cheung <khc@pidgin.im>
parents: 21353
diff changeset
255 }
5c6020f03f2d mostly done with soap level parsing, compiles
Ka-Hing Cheung <khc@pidgin.im>
parents: 21353
diff changeset
256
21355
500740852250 removes public handle to soap connection, instead a connection is looked up
Ka-Hing Cheung <khc@pidgin.im>
parents: 21354
diff changeset
257 return TRUE;
21354
5c6020f03f2d mostly done with soap level parsing, compiles
Ka-Hing Cheung <khc@pidgin.im>
parents: 21353
diff changeset
258 }
5c6020f03f2d mostly done with soap level parsing, compiles
Ka-Hing Cheung <khc@pidgin.im>
parents: 21353
diff changeset
259
21353
a70d31127cb6 beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@pidgin.im>
parents:
diff changeset
260 static void
a70d31127cb6 beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@pidgin.im>
parents:
diff changeset
261 msn_soap_read_cb(gpointer data, gint fd, PurpleInputCondition cond)
a70d31127cb6 beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@pidgin.im>
parents:
diff changeset
262 {
22981
b83a23981419 Fix a number of leaks. As far as I can tell, MSNP14 now logs in without
Daniel Atallah <datallah@pidgin.im>
parents: 22060
diff changeset
263 MsnSoapConnection *conn = data;
23469
74429b4ad296 Patch from tomgr and Maiku that workarounds some OS X issue,
Ka-Hing Cheung <khc@pidgin.im>
parents: 23078
diff changeset
264 int count = 0, cnt, perrno;
74429b4ad296 Patch from tomgr and Maiku that workarounds some OS X issue,
Ka-Hing Cheung <khc@pidgin.im>
parents: 23078
diff changeset
265 /* This buffer needs to be larger than any packets received from
74429b4ad296 Patch from tomgr and Maiku that workarounds some OS X issue,
Ka-Hing Cheung <khc@pidgin.im>
parents: 23078
diff changeset
266 login.live.com or Adium will fail to receive the packet
74429b4ad296 Patch from tomgr and Maiku that workarounds some OS X issue,
Ka-Hing Cheung <khc@pidgin.im>
parents: 23078
diff changeset
267 (something weird with the login.live.com server). With NSS it works
74429b4ad296 Patch from tomgr and Maiku that workarounds some OS X issue,
Ka-Hing Cheung <khc@pidgin.im>
parents: 23078
diff changeset
268 fine, so I believe it's some bug with OS X */
74429b4ad296 Patch from tomgr and Maiku that workarounds some OS X issue,
Ka-Hing Cheung <khc@pidgin.im>
parents: 23078
diff changeset
269 char buf[16 * 1024];
21353
a70d31127cb6 beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@pidgin.im>
parents:
diff changeset
270
21398
a31c84608fcb read as much from the fd as possible if we get a read event, hopefully will
Ka-Hing Cheung <khc@pidgin.im>
parents: 21391
diff changeset
271 if (conn->message == NULL) {
a31c84608fcb read as much from the fd as possible if we get a read event, hopefully will
Ka-Hing Cheung <khc@pidgin.im>
parents: 21391
diff changeset
272 conn->message = msn_soap_message_new(NULL, NULL);
a31c84608fcb read as much from the fd as possible if we get a read event, hopefully will
Ka-Hing Cheung <khc@pidgin.im>
parents: 21391
diff changeset
273 }
a31c84608fcb read as much from the fd as possible if we get a read event, hopefully will
Ka-Hing Cheung <khc@pidgin.im>
parents: 21391
diff changeset
274
23469
74429b4ad296 Patch from tomgr and Maiku that workarounds some OS X issue,
Ka-Hing Cheung <khc@pidgin.im>
parents: 23078
diff changeset
275 if (conn->buf == NULL) {
74429b4ad296 Patch from tomgr and Maiku that workarounds some OS X issue,
Ka-Hing Cheung <khc@pidgin.im>
parents: 23078
diff changeset
276 conn->buf = g_string_new_len(buf, 0);
74429b4ad296 Patch from tomgr and Maiku that workarounds some OS X issue,
Ka-Hing Cheung <khc@pidgin.im>
parents: 23078
diff changeset
277 }
74429b4ad296 Patch from tomgr and Maiku that workarounds some OS X issue,
Ka-Hing Cheung <khc@pidgin.im>
parents: 23078
diff changeset
278
21398
a31c84608fcb read as much from the fd as possible if we get a read event, hopefully will
Ka-Hing Cheung <khc@pidgin.im>
parents: 21391
diff changeset
279 while ((cnt = purple_ssl_read(conn->ssl, buf, sizeof(buf))) > 0) {
a31c84608fcb read as much from the fd as possible if we get a read event, hopefully will
Ka-Hing Cheung <khc@pidgin.im>
parents: 21391
diff changeset
280 purple_debug_info("soap", "read %d bytes\n", cnt);
a31c84608fcb read as much from the fd as possible if we get a read event, hopefully will
Ka-Hing Cheung <khc@pidgin.im>
parents: 21391
diff changeset
281 count += cnt;
23469
74429b4ad296 Patch from tomgr and Maiku that workarounds some OS X issue,
Ka-Hing Cheung <khc@pidgin.im>
parents: 23078
diff changeset
282 g_string_append_len(conn->buf, buf, cnt);
21398
a31c84608fcb read as much from the fd as possible if we get a read event, hopefully will
Ka-Hing Cheung <khc@pidgin.im>
parents: 21391
diff changeset
283 }
21353
a70d31127cb6 beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@pidgin.im>
parents:
diff changeset
284
23469
74429b4ad296 Patch from tomgr and Maiku that workarounds some OS X issue,
Ka-Hing Cheung <khc@pidgin.im>
parents: 23078
diff changeset
285 /* && count is necessary for Adium, on OS X the last read always
74429b4ad296 Patch from tomgr and Maiku that workarounds some OS X issue,
Ka-Hing Cheung <khc@pidgin.im>
parents: 23078
diff changeset
286 return an error, so we want to proceed anyway. See #5212 for
74429b4ad296 Patch from tomgr and Maiku that workarounds some OS X issue,
Ka-Hing Cheung <khc@pidgin.im>
parents: 23078
diff changeset
287 discussion on this and the above buffer size issues */
74429b4ad296 Patch from tomgr and Maiku that workarounds some OS X issue,
Ka-Hing Cheung <khc@pidgin.im>
parents: 23078
diff changeset
288 if(cnt < 0 && errno == EAGAIN && count == 0)
74429b4ad296 Patch from tomgr and Maiku that workarounds some OS X issue,
Ka-Hing Cheung <khc@pidgin.im>
parents: 23078
diff changeset
289 return;
74429b4ad296 Patch from tomgr and Maiku that workarounds some OS X issue,
Ka-Hing Cheung <khc@pidgin.im>
parents: 23078
diff changeset
290
23833
1a4c1d44858d Take care of more cleanup in the MSN code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23827
diff changeset
291 /* msn_soap_process could alter errno */
23469
74429b4ad296 Patch from tomgr and Maiku that workarounds some OS X issue,
Ka-Hing Cheung <khc@pidgin.im>
parents: 23078
diff changeset
292 perrno = errno;
74429b4ad296 Patch from tomgr and Maiku that workarounds some OS X issue,
Ka-Hing Cheung <khc@pidgin.im>
parents: 23078
diff changeset
293 msn_soap_process(conn);
74429b4ad296 Patch from tomgr and Maiku that workarounds some OS X issue,
Ka-Hing Cheung <khc@pidgin.im>
parents: 23078
diff changeset
294
74429b4ad296 Patch from tomgr and Maiku that workarounds some OS X issue,
Ka-Hing Cheung <khc@pidgin.im>
parents: 23078
diff changeset
295 if (cnt < 0 && perrno != EAGAIN) {
74429b4ad296 Patch from tomgr and Maiku that workarounds some OS X issue,
Ka-Hing Cheung <khc@pidgin.im>
parents: 23078
diff changeset
296 purple_debug_info("soap", "read: %s\n", g_strerror(perrno));
23833
1a4c1d44858d Take care of more cleanup in the MSN code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23827
diff changeset
297 /* It's possible msn_soap_process closed the ssl connection */
23469
74429b4ad296 Patch from tomgr and Maiku that workarounds some OS X issue,
Ka-Hing Cheung <khc@pidgin.im>
parents: 23078
diff changeset
298 if (conn->ssl) {
21398
a31c84608fcb read as much from the fd as possible if we get a read event, hopefully will
Ka-Hing Cheung <khc@pidgin.im>
parents: 21391
diff changeset
299 purple_ssl_close(conn->ssl);
a31c84608fcb read as much from the fd as possible if we get a read event, hopefully will
Ka-Hing Cheung <khc@pidgin.im>
parents: 21391
diff changeset
300 conn->ssl = NULL;
a31c84608fcb read as much from the fd as possible if we get a read event, hopefully will
Ka-Hing Cheung <khc@pidgin.im>
parents: 21391
diff changeset
301 msn_soap_connection_handle_next(conn);
a31c84608fcb read as much from the fd as possible if we get a read event, hopefully will
Ka-Hing Cheung <khc@pidgin.im>
parents: 21391
diff changeset
302 }
a31c84608fcb read as much from the fd as possible if we get a read event, hopefully will
Ka-Hing Cheung <khc@pidgin.im>
parents: 21391
diff changeset
303 }
23469
74429b4ad296 Patch from tomgr and Maiku that workarounds some OS X issue,
Ka-Hing Cheung <khc@pidgin.im>
parents: 23078
diff changeset
304 }
21398
a31c84608fcb read as much from the fd as possible if we get a read event, hopefully will
Ka-Hing Cheung <khc@pidgin.im>
parents: 21391
diff changeset
305
23469
74429b4ad296 Patch from tomgr and Maiku that workarounds some OS X issue,
Ka-Hing Cheung <khc@pidgin.im>
parents: 23078
diff changeset
306 static void
74429b4ad296 Patch from tomgr and Maiku that workarounds some OS X issue,
Ka-Hing Cheung <khc@pidgin.im>
parents: 23078
diff changeset
307 msn_soap_process(MsnSoapConnection *conn) {
74429b4ad296 Patch from tomgr and Maiku that workarounds some OS X issue,
Ka-Hing Cheung <khc@pidgin.im>
parents: 23078
diff changeset
308 gboolean handled = FALSE;
74429b4ad296 Patch from tomgr and Maiku that workarounds some OS X issue,
Ka-Hing Cheung <khc@pidgin.im>
parents: 23078
diff changeset
309 char *cursor;
74429b4ad296 Patch from tomgr and Maiku that workarounds some OS X issue,
Ka-Hing Cheung <khc@pidgin.im>
parents: 23078
diff changeset
310 char *linebreak;
21353
a70d31127cb6 beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@pidgin.im>
parents:
diff changeset
311
21358
0e54f76775d4 signs on!
Ka-Hing Cheung <khc@pidgin.im>
parents: 21357
diff changeset
312 purple_debug_info("soap", "current %s\n", conn->buf->str);
0e54f76775d4 signs on!
Ka-Hing Cheung <khc@pidgin.im>
parents: 21357
diff changeset
313
21355
500740852250 removes public handle to soap connection, instead a connection is looked up
Ka-Hing Cheung <khc@pidgin.im>
parents: 21354
diff changeset
314 cursor = conn->buf->str + conn->handled_len;
500740852250 removes public handle to soap connection, instead a connection is looked up
Ka-Hing Cheung <khc@pidgin.im>
parents: 21354
diff changeset
315
21361
f890366c8ec6 oim migrated to new soap code, quadruply duplicated message!
Ka-Hing Cheung <khc@pidgin.im>
parents: 21360
diff changeset
316 if (!conn->headers_done) {
f890366c8ec6 oim migrated to new soap code, quadruply duplicated message!
Ka-Hing Cheung <khc@pidgin.im>
parents: 21360
diff changeset
317 while ((linebreak = strstr(cursor, "\r\n")) != NULL) {
f890366c8ec6 oim migrated to new soap code, quadruply duplicated message!
Ka-Hing Cheung <khc@pidgin.im>
parents: 21360
diff changeset
318 conn->handled_len = linebreak - conn->buf->str + 2;
f890366c8ec6 oim migrated to new soap code, quadruply duplicated message!
Ka-Hing Cheung <khc@pidgin.im>
parents: 21360
diff changeset
319
f890366c8ec6 oim migrated to new soap code, quadruply duplicated message!
Ka-Hing Cheung <khc@pidgin.im>
parents: 21360
diff changeset
320 if (conn->response_code == 0) {
f890366c8ec6 oim migrated to new soap code, quadruply duplicated message!
Ka-Hing Cheung <khc@pidgin.im>
parents: 21360
diff changeset
321 if (sscanf(cursor, "HTTP/1.1 %d", &conn->response_code) != 1) {
f890366c8ec6 oim migrated to new soap code, quadruply duplicated message!
Ka-Hing Cheung <khc@pidgin.im>
parents: 21360
diff changeset
322 /* something horribly wrong */
f890366c8ec6 oim migrated to new soap code, quadruply duplicated message!
Ka-Hing Cheung <khc@pidgin.im>
parents: 21360
diff changeset
323 purple_ssl_close(conn->ssl);
f890366c8ec6 oim migrated to new soap code, quadruply duplicated message!
Ka-Hing Cheung <khc@pidgin.im>
parents: 21360
diff changeset
324 conn->ssl = NULL;
f890366c8ec6 oim migrated to new soap code, quadruply duplicated message!
Ka-Hing Cheung <khc@pidgin.im>
parents: 21360
diff changeset
325 msn_soap_connection_handle_next(conn);
f890366c8ec6 oim migrated to new soap code, quadruply duplicated message!
Ka-Hing Cheung <khc@pidgin.im>
parents: 21360
diff changeset
326 handled = TRUE;
f890366c8ec6 oim migrated to new soap code, quadruply duplicated message!
Ka-Hing Cheung <khc@pidgin.im>
parents: 21360
diff changeset
327 break;
f890366c8ec6 oim migrated to new soap code, quadruply duplicated message!
Ka-Hing Cheung <khc@pidgin.im>
parents: 21360
diff changeset
328 } else if (conn->response_code == 503) {
f890366c8ec6 oim migrated to new soap code, quadruply duplicated message!
Ka-Hing Cheung <khc@pidgin.im>
parents: 21360
diff changeset
329 msn_soap_connection_sanitize(conn, TRUE);
f890366c8ec6 oim migrated to new soap code, quadruply duplicated message!
Ka-Hing Cheung <khc@pidgin.im>
parents: 21360
diff changeset
330 msn_session_set_error(conn->session, MSN_ERROR_SERV_UNAVAILABLE, NULL);
f890366c8ec6 oim migrated to new soap code, quadruply duplicated message!
Ka-Hing Cheung <khc@pidgin.im>
parents: 21360
diff changeset
331 return;
f890366c8ec6 oim migrated to new soap code, quadruply duplicated message!
Ka-Hing Cheung <khc@pidgin.im>
parents: 21360
diff changeset
332 }
f890366c8ec6 oim migrated to new soap code, quadruply duplicated message!
Ka-Hing Cheung <khc@pidgin.im>
parents: 21360
diff changeset
333 } else if (cursor == linebreak) {
f890366c8ec6 oim migrated to new soap code, quadruply duplicated message!
Ka-Hing Cheung <khc@pidgin.im>
parents: 21360
diff changeset
334 /* blank line */
f890366c8ec6 oim migrated to new soap code, quadruply duplicated message!
Ka-Hing Cheung <khc@pidgin.im>
parents: 21360
diff changeset
335 conn->headers_done = TRUE;
f890366c8ec6 oim migrated to new soap code, quadruply duplicated message!
Ka-Hing Cheung <khc@pidgin.im>
parents: 21360
diff changeset
336 cursor = conn->buf->str + conn->handled_len;
f890366c8ec6 oim migrated to new soap code, quadruply duplicated message!
Ka-Hing Cheung <khc@pidgin.im>
parents: 21360
diff changeset
337 break;
f890366c8ec6 oim migrated to new soap code, quadruply duplicated message!
Ka-Hing Cheung <khc@pidgin.im>
parents: 21360
diff changeset
338 } else {
f890366c8ec6 oim migrated to new soap code, quadruply duplicated message!
Ka-Hing Cheung <khc@pidgin.im>
parents: 21360
diff changeset
339 char *line = g_strndup(cursor, linebreak - cursor);
f890366c8ec6 oim migrated to new soap code, quadruply duplicated message!
Ka-Hing Cheung <khc@pidgin.im>
parents: 21360
diff changeset
340 char *sep = strstr(line, ": ");
f890366c8ec6 oim migrated to new soap code, quadruply duplicated message!
Ka-Hing Cheung <khc@pidgin.im>
parents: 21360
diff changeset
341 char *key = line;
f890366c8ec6 oim migrated to new soap code, quadruply duplicated message!
Ka-Hing Cheung <khc@pidgin.im>
parents: 21360
diff changeset
342 char *value;
f890366c8ec6 oim migrated to new soap code, quadruply duplicated message!
Ka-Hing Cheung <khc@pidgin.im>
parents: 21360
diff changeset
343
f890366c8ec6 oim migrated to new soap code, quadruply duplicated message!
Ka-Hing Cheung <khc@pidgin.im>
parents: 21360
diff changeset
344 if (sep == NULL) {
f890366c8ec6 oim migrated to new soap code, quadruply duplicated message!
Ka-Hing Cheung <khc@pidgin.im>
parents: 21360
diff changeset
345 purple_debug_info("soap", "ignoring malformed line: %s\n", line);
f890366c8ec6 oim migrated to new soap code, quadruply duplicated message!
Ka-Hing Cheung <khc@pidgin.im>
parents: 21360
diff changeset
346 g_free(line);
f890366c8ec6 oim migrated to new soap code, quadruply duplicated message!
Ka-Hing Cheung <khc@pidgin.im>
parents: 21360
diff changeset
347 goto loop_end;
f890366c8ec6 oim migrated to new soap code, quadruply duplicated message!
Ka-Hing Cheung <khc@pidgin.im>
parents: 21360
diff changeset
348 }
f890366c8ec6 oim migrated to new soap code, quadruply duplicated message!
Ka-Hing Cheung <khc@pidgin.im>
parents: 21360
diff changeset
349
f890366c8ec6 oim migrated to new soap code, quadruply duplicated message!
Ka-Hing Cheung <khc@pidgin.im>
parents: 21360
diff changeset
350 value = sep + 2;
f890366c8ec6 oim migrated to new soap code, quadruply duplicated message!
Ka-Hing Cheung <khc@pidgin.im>
parents: 21360
diff changeset
351 *sep = '\0';
f890366c8ec6 oim migrated to new soap code, quadruply duplicated message!
Ka-Hing Cheung <khc@pidgin.im>
parents: 21360
diff changeset
352 msn_soap_message_add_header(conn->message, key, value);
f890366c8ec6 oim migrated to new soap code, quadruply duplicated message!
Ka-Hing Cheung <khc@pidgin.im>
parents: 21360
diff changeset
353
f890366c8ec6 oim migrated to new soap code, quadruply duplicated message!
Ka-Hing Cheung <khc@pidgin.im>
parents: 21360
diff changeset
354 if ((conn->response_code == 301 || conn->response_code == 300)
f890366c8ec6 oim migrated to new soap code, quadruply duplicated message!
Ka-Hing Cheung <khc@pidgin.im>
parents: 21360
diff changeset
355 && strcmp(key, "Location") == 0) {
f890366c8ec6 oim migrated to new soap code, quadruply duplicated message!
Ka-Hing Cheung <khc@pidgin.im>
parents: 21360
diff changeset
356
f890366c8ec6 oim migrated to new soap code, quadruply duplicated message!
Ka-Hing Cheung <khc@pidgin.im>
parents: 21360
diff changeset
357 msn_soap_handle_redirect(conn, value);
f890366c8ec6 oim migrated to new soap code, quadruply duplicated message!
Ka-Hing Cheung <khc@pidgin.im>
parents: 21360
diff changeset
358
f890366c8ec6 oim migrated to new soap code, quadruply duplicated message!
Ka-Hing Cheung <khc@pidgin.im>
parents: 21360
diff changeset
359 handled = TRUE;
f890366c8ec6 oim migrated to new soap code, quadruply duplicated message!
Ka-Hing Cheung <khc@pidgin.im>
parents: 21360
diff changeset
360 g_free(line);
f890366c8ec6 oim migrated to new soap code, quadruply duplicated message!
Ka-Hing Cheung <khc@pidgin.im>
parents: 21360
diff changeset
361 break;
f890366c8ec6 oim migrated to new soap code, quadruply duplicated message!
Ka-Hing Cheung <khc@pidgin.im>
parents: 21360
diff changeset
362 } else if (conn->response_code == 401 &&
f890366c8ec6 oim migrated to new soap code, quadruply duplicated message!
Ka-Hing Cheung <khc@pidgin.im>
parents: 21360
diff changeset
363 strcmp(key, "WWW-Authenticate") == 0) {
f890366c8ec6 oim migrated to new soap code, quadruply duplicated message!
Ka-Hing Cheung <khc@pidgin.im>
parents: 21360
diff changeset
364 char *error = strstr(value, "cbtxt=");
f890366c8ec6 oim migrated to new soap code, quadruply duplicated message!
Ka-Hing Cheung <khc@pidgin.im>
parents: 21360
diff changeset
365
f890366c8ec6 oim migrated to new soap code, quadruply duplicated message!
Ka-Hing Cheung <khc@pidgin.im>
parents: 21360
diff changeset
366 if (error) {
f890366c8ec6 oim migrated to new soap code, quadruply duplicated message!
Ka-Hing Cheung <khc@pidgin.im>
parents: 21360
diff changeset
367 error += strlen("cbtxt=");
f890366c8ec6 oim migrated to new soap code, quadruply duplicated message!
Ka-Hing Cheung <khc@pidgin.im>
parents: 21360
diff changeset
368 }
f890366c8ec6 oim migrated to new soap code, quadruply duplicated message!
Ka-Hing Cheung <khc@pidgin.im>
parents: 21360
diff changeset
369
f890366c8ec6 oim migrated to new soap code, quadruply duplicated message!
Ka-Hing Cheung <khc@pidgin.im>
parents: 21360
diff changeset
370 msn_soap_connection_sanitize(conn, TRUE);
f890366c8ec6 oim migrated to new soap code, quadruply duplicated message!
Ka-Hing Cheung <khc@pidgin.im>
parents: 21360
diff changeset
371 msn_session_set_error(conn->session, MSN_ERROR_AUTH,
f890366c8ec6 oim migrated to new soap code, quadruply duplicated message!
Ka-Hing Cheung <khc@pidgin.im>
parents: 21360
diff changeset
372 error ? purple_url_decode(error) : NULL);
f890366c8ec6 oim migrated to new soap code, quadruply duplicated message!
Ka-Hing Cheung <khc@pidgin.im>
parents: 21360
diff changeset
373
f890366c8ec6 oim migrated to new soap code, quadruply duplicated message!
Ka-Hing Cheung <khc@pidgin.im>
parents: 21360
diff changeset
374 g_free(line);
f890366c8ec6 oim migrated to new soap code, quadruply duplicated message!
Ka-Hing Cheung <khc@pidgin.im>
parents: 21360
diff changeset
375 return;
f890366c8ec6 oim migrated to new soap code, quadruply duplicated message!
Ka-Hing Cheung <khc@pidgin.im>
parents: 21360
diff changeset
376 } else if (strcmp(key, "Content-Length") == 0) {
f890366c8ec6 oim migrated to new soap code, quadruply duplicated message!
Ka-Hing Cheung <khc@pidgin.im>
parents: 21360
diff changeset
377 conn->body_len = atoi(value);
f890366c8ec6 oim migrated to new soap code, quadruply duplicated message!
Ka-Hing Cheung <khc@pidgin.im>
parents: 21360
diff changeset
378 } else if (strcmp(key, "Connection") == 0) {
f890366c8ec6 oim migrated to new soap code, quadruply duplicated message!
Ka-Hing Cheung <khc@pidgin.im>
parents: 21360
diff changeset
379 if (strcmp(value, "close") == 0) {
f890366c8ec6 oim migrated to new soap code, quadruply duplicated message!
Ka-Hing Cheung <khc@pidgin.im>
parents: 21360
diff changeset
380 conn->close_when_done = TRUE;
f890366c8ec6 oim migrated to new soap code, quadruply duplicated message!
Ka-Hing Cheung <khc@pidgin.im>
parents: 21360
diff changeset
381 }
f890366c8ec6 oim migrated to new soap code, quadruply duplicated message!
Ka-Hing Cheung <khc@pidgin.im>
parents: 21360
diff changeset
382 }
21364
a701729fef5d fix a memleak or 2
Ka-Hing Cheung <khc@pidgin.im>
parents: 21361
diff changeset
383 g_free(line);
21361
f890366c8ec6 oim migrated to new soap code, quadruply duplicated message!
Ka-Hing Cheung <khc@pidgin.im>
parents: 21360
diff changeset
384 }
f890366c8ec6 oim migrated to new soap code, quadruply duplicated message!
Ka-Hing Cheung <khc@pidgin.im>
parents: 21360
diff changeset
385
f890366c8ec6 oim migrated to new soap code, quadruply duplicated message!
Ka-Hing Cheung <khc@pidgin.im>
parents: 21360
diff changeset
386 loop_end:
f890366c8ec6 oim migrated to new soap code, quadruply duplicated message!
Ka-Hing Cheung <khc@pidgin.im>
parents: 21360
diff changeset
387 cursor = conn->buf->str + conn->handled_len;
f890366c8ec6 oim migrated to new soap code, quadruply duplicated message!
Ka-Hing Cheung <khc@pidgin.im>
parents: 21360
diff changeset
388 }
f890366c8ec6 oim migrated to new soap code, quadruply duplicated message!
Ka-Hing Cheung <khc@pidgin.im>
parents: 21360
diff changeset
389 }
f890366c8ec6 oim migrated to new soap code, quadruply duplicated message!
Ka-Hing Cheung <khc@pidgin.im>
parents: 21360
diff changeset
390
f890366c8ec6 oim migrated to new soap code, quadruply duplicated message!
Ka-Hing Cheung <khc@pidgin.im>
parents: 21360
diff changeset
391 if (!handled && conn->headers_done) {
22981
b83a23981419 Fix a number of leaks. As far as I can tell, MSNP14 now logs in without
Daniel Atallah <datallah@pidgin.im>
parents: 22060
diff changeset
392 if (conn->buf->len - conn->handled_len >=
21355
500740852250 removes public handle to soap connection, instead a connection is looked up
Ka-Hing Cheung <khc@pidgin.im>
parents: 21354
diff changeset
393 conn->body_len) {
500740852250 removes public handle to soap connection, instead a connection is looked up
Ka-Hing Cheung <khc@pidgin.im>
parents: 21354
diff changeset
394 xmlnode *node = xmlnode_from_str(cursor, conn->body_len);
21354
5c6020f03f2d mostly done with soap level parsing, compiles
Ka-Hing Cheung <khc@pidgin.im>
parents: 21353
diff changeset
395
5c6020f03f2d mostly done with soap level parsing, compiles
Ka-Hing Cheung <khc@pidgin.im>
parents: 21353
diff changeset
396 if (node == NULL) {
5c6020f03f2d mostly done with soap level parsing, compiles
Ka-Hing Cheung <khc@pidgin.im>
parents: 21353
diff changeset
397 purple_debug_info("soap", "Malformed SOAP response: %s\n",
21355
500740852250 removes public handle to soap connection, instead a connection is looked up
Ka-Hing Cheung <khc@pidgin.im>
parents: 21354
diff changeset
398 cursor);
21354
5c6020f03f2d mostly done with soap level parsing, compiles
Ka-Hing Cheung <khc@pidgin.im>
parents: 21353
diff changeset
399 } else {
21355
500740852250 removes public handle to soap connection, instead a connection is looked up
Ka-Hing Cheung <khc@pidgin.im>
parents: 21354
diff changeset
400 MsnSoapMessage *message = conn->message;
500740852250 removes public handle to soap connection, instead a connection is looked up
Ka-Hing Cheung <khc@pidgin.im>
parents: 21354
diff changeset
401 conn->message = NULL;
500740852250 removes public handle to soap connection, instead a connection is looked up
Ka-Hing Cheung <khc@pidgin.im>
parents: 21354
diff changeset
402 message->xml = node;
500740852250 removes public handle to soap connection, instead a connection is looked up
Ka-Hing Cheung <khc@pidgin.im>
parents: 21354
diff changeset
403
22981
b83a23981419 Fix a number of leaks. As far as I can tell, MSNP14 now logs in without
Daniel Atallah <datallah@pidgin.im>
parents: 22060
diff changeset
404 if (!msn_soap_handle_body(conn, message)) {
21355
500740852250 removes public handle to soap connection, instead a connection is looked up
Ka-Hing Cheung <khc@pidgin.im>
parents: 21354
diff changeset
405 return;
22981
b83a23981419 Fix a number of leaks. As far as I can tell, MSNP14 now logs in without
Daniel Atallah <datallah@pidgin.im>
parents: 22060
diff changeset
406 }
21354
5c6020f03f2d mostly done with soap level parsing, compiles
Ka-Hing Cheung <khc@pidgin.im>
parents: 21353
diff changeset
407 }
21355
500740852250 removes public handle to soap connection, instead a connection is looked up
Ka-Hing Cheung <khc@pidgin.im>
parents: 21354
diff changeset
408
500740852250 removes public handle to soap connection, instead a connection is looked up
Ka-Hing Cheung <khc@pidgin.im>
parents: 21354
diff changeset
409 msn_soap_connection_handle_next(conn);
21354
5c6020f03f2d mostly done with soap level parsing, compiles
Ka-Hing Cheung <khc@pidgin.im>
parents: 21353
diff changeset
410 }
5c6020f03f2d mostly done with soap level parsing, compiles
Ka-Hing Cheung <khc@pidgin.im>
parents: 21353
diff changeset
411
5c6020f03f2d mostly done with soap level parsing, compiles
Ka-Hing Cheung <khc@pidgin.im>
parents: 21353
diff changeset
412 return;
21353
a70d31127cb6 beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@pidgin.im>
parents:
diff changeset
413 }
a70d31127cb6 beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@pidgin.im>
parents:
diff changeset
414
21355
500740852250 removes public handle to soap connection, instead a connection is looked up
Ka-Hing Cheung <khc@pidgin.im>
parents: 21354
diff changeset
415 if (handled) {
500740852250 removes public handle to soap connection, instead a connection is looked up
Ka-Hing Cheung <khc@pidgin.im>
parents: 21354
diff changeset
416 msn_soap_connection_handle_next(conn);
500740852250 removes public handle to soap connection, instead a connection is looked up
Ka-Hing Cheung <khc@pidgin.im>
parents: 21354
diff changeset
417 }
21353
a70d31127cb6 beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@pidgin.im>
parents:
diff changeset
418 }
a70d31127cb6 beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@pidgin.im>
parents:
diff changeset
419
a70d31127cb6 beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@pidgin.im>
parents:
diff changeset
420 static void
a70d31127cb6 beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@pidgin.im>
parents:
diff changeset
421 msn_soap_write_cb(gpointer data, gint fd, PurpleInputCondition cond)
a70d31127cb6 beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@pidgin.im>
parents:
diff changeset
422 {
23774
032236e2eb9e Patch from tomgr to resend once if the connection is down, fixes #5379
Ka-Hing Cheung <khc@pidgin.im>
parents: 23773
diff changeset
423 msn_soap_write_cb_internal(data, fd, cond, FALSE);
032236e2eb9e Patch from tomgr to resend once if the connection is down, fixes #5379
Ka-Hing Cheung <khc@pidgin.im>
parents: 23773
diff changeset
424 }
032236e2eb9e Patch from tomgr to resend once if the connection is down, fixes #5379
Ka-Hing Cheung <khc@pidgin.im>
parents: 23773
diff changeset
425
032236e2eb9e Patch from tomgr to resend once if the connection is down, fixes #5379
Ka-Hing Cheung <khc@pidgin.im>
parents: 23773
diff changeset
426 static gboolean
032236e2eb9e Patch from tomgr to resend once if the connection is down, fixes #5379
Ka-Hing Cheung <khc@pidgin.im>
parents: 23773
diff changeset
427 msn_soap_write_cb_internal(gpointer data, gint fd, PurpleInputCondition cond,
032236e2eb9e Patch from tomgr to resend once if the connection is down, fixes #5379
Ka-Hing Cheung <khc@pidgin.im>
parents: 23773
diff changeset
428 gboolean initial)
032236e2eb9e Patch from tomgr to resend once if the connection is down, fixes #5379
Ka-Hing Cheung <khc@pidgin.im>
parents: 23773
diff changeset
429 {
21355
500740852250 removes public handle to soap connection, instead a connection is looked up
Ka-Hing Cheung <khc@pidgin.im>
parents: 21354
diff changeset
430 MsnSoapConnection *conn = data;
21353
a70d31127cb6 beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@pidgin.im>
parents:
diff changeset
431 int written;
a70d31127cb6 beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@pidgin.im>
parents:
diff changeset
432
23774
032236e2eb9e Patch from tomgr to resend once if the connection is down, fixes #5379
Ka-Hing Cheung <khc@pidgin.im>
parents: 23773
diff changeset
433 if (cond != PURPLE_INPUT_WRITE) return TRUE;
21353
a70d31127cb6 beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@pidgin.im>
parents:
diff changeset
434
21355
500740852250 removes public handle to soap connection, instead a connection is looked up
Ka-Hing Cheung <khc@pidgin.im>
parents: 21354
diff changeset
435 written = purple_ssl_write(conn->ssl, conn->buf->str + conn->handled_len,
500740852250 removes public handle to soap connection, instead a connection is looked up
Ka-Hing Cheung <khc@pidgin.im>
parents: 21354
diff changeset
436 conn->buf->len - conn->handled_len);
21353
a70d31127cb6 beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@pidgin.im>
parents:
diff changeset
437
a70d31127cb6 beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@pidgin.im>
parents:
diff changeset
438 if (written < 0 && errno == EAGAIN)
23774
032236e2eb9e Patch from tomgr to resend once if the connection is down, fixes #5379
Ka-Hing Cheung <khc@pidgin.im>
parents: 23773
diff changeset
439 return TRUE;
21353
a70d31127cb6 beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@pidgin.im>
parents:
diff changeset
440 else if (written <= 0) {
21355
500740852250 removes public handle to soap connection, instead a connection is looked up
Ka-Hing Cheung <khc@pidgin.im>
parents: 21354
diff changeset
441 purple_ssl_close(conn->ssl);
500740852250 removes public handle to soap connection, instead a connection is looked up
Ka-Hing Cheung <khc@pidgin.im>
parents: 21354
diff changeset
442 conn->ssl = NULL;
23774
032236e2eb9e Patch from tomgr to resend once if the connection is down, fixes #5379
Ka-Hing Cheung <khc@pidgin.im>
parents: 23773
diff changeset
443 if (!initial) msn_soap_connection_handle_next(conn);
032236e2eb9e Patch from tomgr to resend once if the connection is down, fixes #5379
Ka-Hing Cheung <khc@pidgin.im>
parents: 23773
diff changeset
444 return FALSE;
21353
a70d31127cb6 beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@pidgin.im>
parents:
diff changeset
445 }
a70d31127cb6 beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@pidgin.im>
parents:
diff changeset
446
21355
500740852250 removes public handle to soap connection, instead a connection is looked up
Ka-Hing Cheung <khc@pidgin.im>
parents: 21354
diff changeset
447 conn->handled_len += written;
21353
a70d31127cb6 beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@pidgin.im>
parents:
diff changeset
448
21355
500740852250 removes public handle to soap connection, instead a connection is looked up
Ka-Hing Cheung <khc@pidgin.im>
parents: 21354
diff changeset
449 if (conn->handled_len < conn->buf->len)
23774
032236e2eb9e Patch from tomgr to resend once if the connection is down, fixes #5379
Ka-Hing Cheung <khc@pidgin.im>
parents: 23773
diff changeset
450 return TRUE;
21353
a70d31127cb6 beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@pidgin.im>
parents:
diff changeset
451
a70d31127cb6 beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@pidgin.im>
parents:
diff changeset
452 /* we are done! */
21358
0e54f76775d4 signs on!
Ka-Hing Cheung <khc@pidgin.im>
parents: 21357
diff changeset
453 g_string_free(conn->buf, TRUE);
0e54f76775d4 signs on!
Ka-Hing Cheung <khc@pidgin.im>
parents: 21357
diff changeset
454 conn->buf = NULL;
0e54f76775d4 signs on!
Ka-Hing Cheung <khc@pidgin.im>
parents: 21357
diff changeset
455 conn->handled_len = 0;
0e54f76775d4 signs on!
Ka-Hing Cheung <khc@pidgin.im>
parents: 21357
diff changeset
456 conn->body_len = 0;
0e54f76775d4 signs on!
Ka-Hing Cheung <khc@pidgin.im>
parents: 21357
diff changeset
457 conn->response_code = 0;
0e54f76775d4 signs on!
Ka-Hing Cheung <khc@pidgin.im>
parents: 21357
diff changeset
458 conn->headers_done = FALSE;
0e54f76775d4 signs on!
Ka-Hing Cheung <khc@pidgin.im>
parents: 21357
diff changeset
459 conn->close_when_done = FALSE;
0e54f76775d4 signs on!
Ka-Hing Cheung <khc@pidgin.im>
parents: 21357
diff changeset
460
21355
500740852250 removes public handle to soap connection, instead a connection is looked up
Ka-Hing Cheung <khc@pidgin.im>
parents: 21354
diff changeset
461 purple_input_remove(conn->event_handle);
500740852250 removes public handle to soap connection, instead a connection is looked up
Ka-Hing Cheung <khc@pidgin.im>
parents: 21354
diff changeset
462 conn->event_handle = purple_input_add(conn->ssl->fd, PURPLE_INPUT_READ,
21353
a70d31127cb6 beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@pidgin.im>
parents:
diff changeset
463 msn_soap_read_cb, conn);
23774
032236e2eb9e Patch from tomgr to resend once if the connection is down, fixes #5379
Ka-Hing Cheung <khc@pidgin.im>
parents: 23773
diff changeset
464 return TRUE;
21353
a70d31127cb6 beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@pidgin.im>
parents:
diff changeset
465 }
a70d31127cb6 beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@pidgin.im>
parents:
diff changeset
466
a70d31127cb6 beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@pidgin.im>
parents:
diff changeset
467 static gboolean
21355
500740852250 removes public handle to soap connection, instead a connection is looked up
Ka-Hing Cheung <khc@pidgin.im>
parents: 21354
diff changeset
468 msn_soap_connection_run(gpointer data)
21353
a70d31127cb6 beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@pidgin.im>
parents:
diff changeset
469 {
21355
500740852250 removes public handle to soap connection, instead a connection is looked up
Ka-Hing Cheung <khc@pidgin.im>
parents: 21354
diff changeset
470 MsnSoapConnection *conn = data;
21354
5c6020f03f2d mostly done with soap level parsing, compiles
Ka-Hing Cheung <khc@pidgin.im>
parents: 21353
diff changeset
471 MsnSoapRequest *req = g_queue_peek_head(conn->queue);
21353
a70d31127cb6 beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@pidgin.im>
parents:
diff changeset
472
21355
500740852250 removes public handle to soap connection, instead a connection is looked up
Ka-Hing Cheung <khc@pidgin.im>
parents: 21354
diff changeset
473 conn->event_handle = 0;
500740852250 removes public handle to soap connection, instead a connection is looked up
Ka-Hing Cheung <khc@pidgin.im>
parents: 21354
diff changeset
474
21353
a70d31127cb6 beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@pidgin.im>
parents:
diff changeset
475 if (req) {
a70d31127cb6 beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@pidgin.im>
parents:
diff changeset
476 if (conn->ssl == NULL) {
21355
500740852250 removes public handle to soap connection, instead a connection is looked up
Ka-Hing Cheung <khc@pidgin.im>
parents: 21354
diff changeset
477 conn->ssl = purple_ssl_connect(conn->session->account, conn->host,
21353
a70d31127cb6 beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@pidgin.im>
parents:
diff changeset
478 443, msn_soap_connected_cb, msn_soap_error_cb, conn);
21355
500740852250 removes public handle to soap connection, instead a connection is looked up
Ka-Hing Cheung <khc@pidgin.im>
parents: 21354
diff changeset
479 } else if (conn->connected) {
21353
a70d31127cb6 beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@pidgin.im>
parents:
diff changeset
480 int len = -1;
21355
500740852250 removes public handle to soap connection, instead a connection is looked up
Ka-Hing Cheung <khc@pidgin.im>
parents: 21354
diff changeset
481 char *body = xmlnode_to_str(req->message->xml, &len);
21353
a70d31127cb6 beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@pidgin.im>
parents:
diff changeset
482 GSList *iter;
a70d31127cb6 beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@pidgin.im>
parents:
diff changeset
483
a70d31127cb6 beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@pidgin.im>
parents:
diff changeset
484 g_queue_pop_head(conn->queue);
a70d31127cb6 beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@pidgin.im>
parents:
diff changeset
485
21355
500740852250 removes public handle to soap connection, instead a connection is looked up
Ka-Hing Cheung <khc@pidgin.im>
parents: 21354
diff changeset
486 conn->buf = g_string_new("");
500740852250 removes public handle to soap connection, instead a connection is looked up
Ka-Hing Cheung <khc@pidgin.im>
parents: 21354
diff changeset
487
500740852250 removes public handle to soap connection, instead a connection is looked up
Ka-Hing Cheung <khc@pidgin.im>
parents: 21354
diff changeset
488 g_string_append_printf(conn->buf,
23798
604090d9bfb0 Don't free the SOAP message when we're still using it for a redirect.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23797
diff changeset
489 "POST /%s HTTP/1.1\r\n"
21353
a70d31127cb6 beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@pidgin.im>
parents:
diff changeset
490 "SOAPAction: %s\r\n"
a70d31127cb6 beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@pidgin.im>
parents:
diff changeset
491 "Content-Type:text/xml; charset=utf-8\r\n"
a70d31127cb6 beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@pidgin.im>
parents:
diff changeset
492 "User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1)\r\n"
a70d31127cb6 beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@pidgin.im>
parents:
diff changeset
493 "Accept: */*\r\n"
a70d31127cb6 beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@pidgin.im>
parents:
diff changeset
494 "Host: %s\r\n"
a70d31127cb6 beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@pidgin.im>
parents:
diff changeset
495 "Content-Length: %d\r\n"
a70d31127cb6 beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@pidgin.im>
parents:
diff changeset
496 "Connection: Keep-Alive\r\n"
a70d31127cb6 beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@pidgin.im>
parents:
diff changeset
497 "Cache-Control: no-cache\r\n",
21356
50afac513011 handle unauthenticated soap connection
Ka-Hing Cheung <khc@pidgin.im>
parents: 21355
diff changeset
498 req->path, req->message->action ? req->message->action : "",
23757
bf5c8c3d6374 Patch 3 from Qulogic, this one updates contact list actions to use ticket
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 21672
diff changeset
499 conn->host, len);
21353
a70d31127cb6 beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@pidgin.im>
parents:
diff changeset
500
21354
5c6020f03f2d mostly done with soap level parsing, compiles
Ka-Hing Cheung <khc@pidgin.im>
parents: 21353
diff changeset
501 for (iter = req->message->headers; iter; iter = iter->next) {
21355
500740852250 removes public handle to soap connection, instead a connection is looked up
Ka-Hing Cheung <khc@pidgin.im>
parents: 21354
diff changeset
502 g_string_append(conn->buf, (char *)iter->data);
500740852250 removes public handle to soap connection, instead a connection is looked up
Ka-Hing Cheung <khc@pidgin.im>
parents: 21354
diff changeset
503 g_string_append(conn->buf, "\r\n");
21353
a70d31127cb6 beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@pidgin.im>
parents:
diff changeset
504 }
a70d31127cb6 beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@pidgin.im>
parents:
diff changeset
505
21355
500740852250 removes public handle to soap connection, instead a connection is looked up
Ka-Hing Cheung <khc@pidgin.im>
parents: 21354
diff changeset
506 g_string_append(conn->buf, "\r\n");
500740852250 removes public handle to soap connection, instead a connection is looked up
Ka-Hing Cheung <khc@pidgin.im>
parents: 21354
diff changeset
507 g_string_append(conn->buf, body);
21353
a70d31127cb6 beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@pidgin.im>
parents:
diff changeset
508
21358
0e54f76775d4 signs on!
Ka-Hing Cheung <khc@pidgin.im>
parents: 21357
diff changeset
509 purple_debug_info("soap", "%s\n", conn->buf->str);
0e54f76775d4 signs on!
Ka-Hing Cheung <khc@pidgin.im>
parents: 21357
diff changeset
510
21355
500740852250 removes public handle to soap connection, instead a connection is looked up
Ka-Hing Cheung <khc@pidgin.im>
parents: 21354
diff changeset
511 conn->handled_len = 0;
500740852250 removes public handle to soap connection, instead a connection is looked up
Ka-Hing Cheung <khc@pidgin.im>
parents: 21354
diff changeset
512 conn->current_request = req;
21353
a70d31127cb6 beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@pidgin.im>
parents:
diff changeset
513
21355
500740852250 removes public handle to soap connection, instead a connection is looked up
Ka-Hing Cheung <khc@pidgin.im>
parents: 21354
diff changeset
514 conn->event_handle = purple_input_add(conn->ssl->fd,
21353
a70d31127cb6 beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@pidgin.im>
parents:
diff changeset
515 PURPLE_INPUT_WRITE, msn_soap_write_cb, conn);
23774
032236e2eb9e Patch from tomgr to resend once if the connection is down, fixes #5379
Ka-Hing Cheung <khc@pidgin.im>
parents: 23773
diff changeset
516 if (!msn_soap_write_cb_internal(conn, conn->ssl->fd, PURPLE_INPUT_WRITE, TRUE)) {
032236e2eb9e Patch from tomgr to resend once if the connection is down, fixes #5379
Ka-Hing Cheung <khc@pidgin.im>
parents: 23773
diff changeset
517 /* Not connected => reconnect and retry */
23819
c3bbef4646b1 Clean up some MSN SOAP stuff.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23798
diff changeset
518 purple_debug_info("soap", "not connected, reconnecting\n");
23774
032236e2eb9e Patch from tomgr to resend once if the connection is down, fixes #5379
Ka-Hing Cheung <khc@pidgin.im>
parents: 23773
diff changeset
519
032236e2eb9e Patch from tomgr to resend once if the connection is down, fixes #5379
Ka-Hing Cheung <khc@pidgin.im>
parents: 23773
diff changeset
520 conn->connected = FALSE;
032236e2eb9e Patch from tomgr to resend once if the connection is down, fixes #5379
Ka-Hing Cheung <khc@pidgin.im>
parents: 23773
diff changeset
521 conn->current_request = NULL;
032236e2eb9e Patch from tomgr to resend once if the connection is down, fixes #5379
Ka-Hing Cheung <khc@pidgin.im>
parents: 23773
diff changeset
522 msn_soap_connection_sanitize(conn, FALSE);
032236e2eb9e Patch from tomgr to resend once if the connection is down, fixes #5379
Ka-Hing Cheung <khc@pidgin.im>
parents: 23773
diff changeset
523
032236e2eb9e Patch from tomgr to resend once if the connection is down, fixes #5379
Ka-Hing Cheung <khc@pidgin.im>
parents: 23773
diff changeset
524 g_queue_push_head(conn->queue, req);
032236e2eb9e Patch from tomgr to resend once if the connection is down, fixes #5379
Ka-Hing Cheung <khc@pidgin.im>
parents: 23773
diff changeset
525 conn->event_handle = purple_timeout_add(0, msn_soap_connection_run, conn);
032236e2eb9e Patch from tomgr to resend once if the connection is down, fixes #5379
Ka-Hing Cheung <khc@pidgin.im>
parents: 23773
diff changeset
526 }
21356
50afac513011 handle unauthenticated soap connection
Ka-Hing Cheung <khc@pidgin.im>
parents: 21355
diff changeset
527
21364
a701729fef5d fix a memleak or 2
Ka-Hing Cheung <khc@pidgin.im>
parents: 21361
diff changeset
528 g_free(body);
22981
b83a23981419 Fix a number of leaks. As far as I can tell, MSNP14 now logs in without
Daniel Atallah <datallah@pidgin.im>
parents: 22060
diff changeset
529 }
21353
a70d31127cb6 beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@pidgin.im>
parents:
diff changeset
530 }
a70d31127cb6 beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@pidgin.im>
parents:
diff changeset
531
a70d31127cb6 beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@pidgin.im>
parents:
diff changeset
532 return FALSE;
a70d31127cb6 beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@pidgin.im>
parents:
diff changeset
533 }
a70d31127cb6 beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@pidgin.im>
parents:
diff changeset
534
a70d31127cb6 beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@pidgin.im>
parents:
diff changeset
535 void
21355
500740852250 removes public handle to soap connection, instead a connection is looked up
Ka-Hing Cheung <khc@pidgin.im>
parents: 21354
diff changeset
536 msn_soap_message_send(MsnSession *session, MsnSoapMessage *message,
500740852250 removes public handle to soap connection, instead a connection is looked up
Ka-Hing Cheung <khc@pidgin.im>
parents: 21354
diff changeset
537 const char *host, const char *path,
500740852250 removes public handle to soap connection, instead a connection is looked up
Ka-Hing Cheung <khc@pidgin.im>
parents: 21354
diff changeset
538 MsnSoapCallback cb, gpointer cb_data)
21353
a70d31127cb6 beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@pidgin.im>
parents:
diff changeset
539 {
21355
500740852250 removes public handle to soap connection, instead a connection is looked up
Ka-Hing Cheung <khc@pidgin.im>
parents: 21354
diff changeset
540 msn_soap_message_send_internal(session, message, host, path, cb, cb_data,
500740852250 removes public handle to soap connection, instead a connection is looked up
Ka-Hing Cheung <khc@pidgin.im>
parents: 21354
diff changeset
541 FALSE);
500740852250 removes public handle to soap connection, instead a connection is looked up
Ka-Hing Cheung <khc@pidgin.im>
parents: 21354
diff changeset
542 }
500740852250 removes public handle to soap connection, instead a connection is looked up
Ka-Hing Cheung <khc@pidgin.im>
parents: 21354
diff changeset
543
500740852250 removes public handle to soap connection, instead a connection is looked up
Ka-Hing Cheung <khc@pidgin.im>
parents: 21354
diff changeset
544 static void
500740852250 removes public handle to soap connection, instead a connection is looked up
Ka-Hing Cheung <khc@pidgin.im>
parents: 21354
diff changeset
545 msn_soap_message_send_internal(MsnSession *session,
500740852250 removes public handle to soap connection, instead a connection is looked up
Ka-Hing Cheung <khc@pidgin.im>
parents: 21354
diff changeset
546 MsnSoapMessage *message, const char *host, const char *path,
500740852250 removes public handle to soap connection, instead a connection is looked up
Ka-Hing Cheung <khc@pidgin.im>
parents: 21354
diff changeset
547 MsnSoapCallback cb, gpointer cb_data, gboolean first)
500740852250 removes public handle to soap connection, instead a connection is looked up
Ka-Hing Cheung <khc@pidgin.im>
parents: 21354
diff changeset
548 {
500740852250 removes public handle to soap connection, instead a connection is looked up
Ka-Hing Cheung <khc@pidgin.im>
parents: 21354
diff changeset
549 MsnSoapConnection *conn = msn_soap_get_connection(session, host);
500740852250 removes public handle to soap connection, instead a connection is looked up
Ka-Hing Cheung <khc@pidgin.im>
parents: 21354
diff changeset
550 MsnSoapRequest *req = g_new0(MsnSoapRequest, 1);
500740852250 removes public handle to soap connection, instead a connection is looked up
Ka-Hing Cheung <khc@pidgin.im>
parents: 21354
diff changeset
551
500740852250 removes public handle to soap connection, instead a connection is looked up
Ka-Hing Cheung <khc@pidgin.im>
parents: 21354
diff changeset
552 req->path = g_strdup(path);
500740852250 removes public handle to soap connection, instead a connection is looked up
Ka-Hing Cheung <khc@pidgin.im>
parents: 21354
diff changeset
553 req->message = message;
21353
a70d31127cb6 beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@pidgin.im>
parents:
diff changeset
554 req->cb = cb;
21355
500740852250 removes public handle to soap connection, instead a connection is looked up
Ka-Hing Cheung <khc@pidgin.im>
parents: 21354
diff changeset
555 req->cb_data = cb_data;
21353
a70d31127cb6 beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@pidgin.im>
parents:
diff changeset
556
21355
500740852250 removes public handle to soap connection, instead a connection is looked up
Ka-Hing Cheung <khc@pidgin.im>
parents: 21354
diff changeset
557 if (first) {
500740852250 removes public handle to soap connection, instead a connection is looked up
Ka-Hing Cheung <khc@pidgin.im>
parents: 21354
diff changeset
558 g_queue_push_head(conn->queue, req);
500740852250 removes public handle to soap connection, instead a connection is looked up
Ka-Hing Cheung <khc@pidgin.im>
parents: 21354
diff changeset
559 } else {
500740852250 removes public handle to soap connection, instead a connection is looked up
Ka-Hing Cheung <khc@pidgin.im>
parents: 21354
diff changeset
560 g_queue_push_tail(conn->queue, req);
500740852250 removes public handle to soap connection, instead a connection is looked up
Ka-Hing Cheung <khc@pidgin.im>
parents: 21354
diff changeset
561 }
21353
a70d31127cb6 beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@pidgin.im>
parents:
diff changeset
562
21355
500740852250 removes public handle to soap connection, instead a connection is looked up
Ka-Hing Cheung <khc@pidgin.im>
parents: 21354
diff changeset
563 if (conn->event_handle == 0)
500740852250 removes public handle to soap connection, instead a connection is looked up
Ka-Hing Cheung <khc@pidgin.im>
parents: 21354
diff changeset
564 conn->event_handle = purple_timeout_add(0, msn_soap_connection_run,
500740852250 removes public handle to soap connection, instead a connection is looked up
Ka-Hing Cheung <khc@pidgin.im>
parents: 21354
diff changeset
565 conn);
21353
a70d31127cb6 beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@pidgin.im>
parents:
diff changeset
566 }
a70d31127cb6 beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@pidgin.im>
parents:
diff changeset
567
a70d31127cb6 beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@pidgin.im>
parents:
diff changeset
568 static void
21358
0e54f76775d4 signs on!
Ka-Hing Cheung <khc@pidgin.im>
parents: 21357
diff changeset
569 msn_soap_connection_sanitize(MsnSoapConnection *conn, gboolean disconnect)
0e54f76775d4 signs on!
Ka-Hing Cheung <khc@pidgin.im>
parents: 21357
diff changeset
570 {
0e54f76775d4 signs on!
Ka-Hing Cheung <khc@pidgin.im>
parents: 21357
diff changeset
571 if (conn->event_handle) {
0e54f76775d4 signs on!
Ka-Hing Cheung <khc@pidgin.im>
parents: 21357
diff changeset
572 purple_input_remove(conn->event_handle);
0e54f76775d4 signs on!
Ka-Hing Cheung <khc@pidgin.im>
parents: 21357
diff changeset
573 conn->event_handle = 0;
0e54f76775d4 signs on!
Ka-Hing Cheung <khc@pidgin.im>
parents: 21357
diff changeset
574 }
0e54f76775d4 signs on!
Ka-Hing Cheung <khc@pidgin.im>
parents: 21357
diff changeset
575
0e54f76775d4 signs on!
Ka-Hing Cheung <khc@pidgin.im>
parents: 21357
diff changeset
576 if (conn->message) {
0e54f76775d4 signs on!
Ka-Hing Cheung <khc@pidgin.im>
parents: 21357
diff changeset
577 msn_soap_message_destroy(conn->message);
0e54f76775d4 signs on!
Ka-Hing Cheung <khc@pidgin.im>
parents: 21357
diff changeset
578 conn->message = NULL;
0e54f76775d4 signs on!
Ka-Hing Cheung <khc@pidgin.im>
parents: 21357
diff changeset
579 }
0e54f76775d4 signs on!
Ka-Hing Cheung <khc@pidgin.im>
parents: 21357
diff changeset
580
0e54f76775d4 signs on!
Ka-Hing Cheung <khc@pidgin.im>
parents: 21357
diff changeset
581 if (conn->buf) {
0e54f76775d4 signs on!
Ka-Hing Cheung <khc@pidgin.im>
parents: 21357
diff changeset
582 g_string_free(conn->buf, TRUE);
0e54f76775d4 signs on!
Ka-Hing Cheung <khc@pidgin.im>
parents: 21357
diff changeset
583 conn->buf = NULL;
0e54f76775d4 signs on!
Ka-Hing Cheung <khc@pidgin.im>
parents: 21357
diff changeset
584 }
0e54f76775d4 signs on!
Ka-Hing Cheung <khc@pidgin.im>
parents: 21357
diff changeset
585
0e54f76775d4 signs on!
Ka-Hing Cheung <khc@pidgin.im>
parents: 21357
diff changeset
586 if (conn->ssl && (disconnect || conn->close_when_done)) {
0e54f76775d4 signs on!
Ka-Hing Cheung <khc@pidgin.im>
parents: 21357
diff changeset
587 purple_ssl_close(conn->ssl);
0e54f76775d4 signs on!
Ka-Hing Cheung <khc@pidgin.im>
parents: 21357
diff changeset
588 conn->ssl = NULL;
0e54f76775d4 signs on!
Ka-Hing Cheung <khc@pidgin.im>
parents: 21357
diff changeset
589 }
0e54f76775d4 signs on!
Ka-Hing Cheung <khc@pidgin.im>
parents: 21357
diff changeset
590
0e54f76775d4 signs on!
Ka-Hing Cheung <khc@pidgin.im>
parents: 21357
diff changeset
591 if (conn->current_request) {
23798
604090d9bfb0 Don't free the SOAP message when we're still using it for a redirect.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23797
diff changeset
592 msn_soap_request_destroy(conn->current_request, FALSE);
21358
0e54f76775d4 signs on!
Ka-Hing Cheung <khc@pidgin.im>
parents: 21357
diff changeset
593 conn->current_request = NULL;
0e54f76775d4 signs on!
Ka-Hing Cheung <khc@pidgin.im>
parents: 21357
diff changeset
594 }
0e54f76775d4 signs on!
Ka-Hing Cheung <khc@pidgin.im>
parents: 21357
diff changeset
595 }
0e54f76775d4 signs on!
Ka-Hing Cheung <khc@pidgin.im>
parents: 21357
diff changeset
596
0e54f76775d4 signs on!
Ka-Hing Cheung <khc@pidgin.im>
parents: 21357
diff changeset
597 static void
21355
500740852250 removes public handle to soap connection, instead a connection is looked up
Ka-Hing Cheung <khc@pidgin.im>
parents: 21354
diff changeset
598 msn_soap_connection_handle_next(MsnSoapConnection *conn)
21353
a70d31127cb6 beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@pidgin.im>
parents:
diff changeset
599 {
21358
0e54f76775d4 signs on!
Ka-Hing Cheung <khc@pidgin.im>
parents: 21357
diff changeset
600 msn_soap_connection_sanitize(conn, FALSE);
21355
500740852250 removes public handle to soap connection, instead a connection is looked up
Ka-Hing Cheung <khc@pidgin.im>
parents: 21354
diff changeset
601
500740852250 removes public handle to soap connection, instead a connection is looked up
Ka-Hing Cheung <khc@pidgin.im>
parents: 21354
diff changeset
602 conn->event_handle = purple_timeout_add(0, msn_soap_connection_run, conn);
21357
64a63a153c62 the new soap code finally doesn't crash on startup, still can't
Ka-Hing Cheung <khc@pidgin.im>
parents: 21356
diff changeset
603
64a63a153c62 the new soap code finally doesn't crash on startup, still can't
Ka-Hing Cheung <khc@pidgin.im>
parents: 21356
diff changeset
604 if (conn->current_request) {
64a63a153c62 the new soap code finally doesn't crash on startup, still can't
Ka-Hing Cheung <khc@pidgin.im>
parents: 21356
diff changeset
605 MsnSoapRequest *req = conn->current_request;
64a63a153c62 the new soap code finally doesn't crash on startup, still can't
Ka-Hing Cheung <khc@pidgin.im>
parents: 21356
diff changeset
606 conn->current_request = NULL;
64a63a153c62 the new soap code finally doesn't crash on startup, still can't
Ka-Hing Cheung <khc@pidgin.im>
parents: 21356
diff changeset
607 msn_soap_connection_destroy_foreach_cb(req, conn);
64a63a153c62 the new soap code finally doesn't crash on startup, still can't
Ka-Hing Cheung <khc@pidgin.im>
parents: 21356
diff changeset
608 }
21353
a70d31127cb6 beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@pidgin.im>
parents:
diff changeset
609 }
a70d31127cb6 beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@pidgin.im>
parents:
diff changeset
610
a70d31127cb6 beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@pidgin.im>
parents:
diff changeset
611 static void
21355
500740852250 removes public handle to soap connection, instead a connection is looked up
Ka-Hing Cheung <khc@pidgin.im>
parents: 21354
diff changeset
612 msn_soap_connection_destroy_foreach_cb(gpointer item, gpointer data)
21353
a70d31127cb6 beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@pidgin.im>
parents:
diff changeset
613 {
21355
500740852250 removes public handle to soap connection, instead a connection is looked up
Ka-Hing Cheung <khc@pidgin.im>
parents: 21354
diff changeset
614 MsnSoapRequest *req = item;
500740852250 removes public handle to soap connection, instead a connection is looked up
Ka-Hing Cheung <khc@pidgin.im>
parents: 21354
diff changeset
615
500740852250 removes public handle to soap connection, instead a connection is looked up
Ka-Hing Cheung <khc@pidgin.im>
parents: 21354
diff changeset
616 if (req->cb)
500740852250 removes public handle to soap connection, instead a connection is looked up
Ka-Hing Cheung <khc@pidgin.im>
parents: 21354
diff changeset
617 req->cb(req->message, NULL, req->cb_data);
500740852250 removes public handle to soap connection, instead a connection is looked up
Ka-Hing Cheung <khc@pidgin.im>
parents: 21354
diff changeset
618
23798
604090d9bfb0 Don't free the SOAP message when we're still using it for a redirect.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23797
diff changeset
619 msn_soap_request_destroy(req, FALSE);
21355
500740852250 removes public handle to soap connection, instead a connection is looked up
Ka-Hing Cheung <khc@pidgin.im>
parents: 21354
diff changeset
620 }
500740852250 removes public handle to soap connection, instead a connection is looked up
Ka-Hing Cheung <khc@pidgin.im>
parents: 21354
diff changeset
621
500740852250 removes public handle to soap connection, instead a connection is looked up
Ka-Hing Cheung <khc@pidgin.im>
parents: 21354
diff changeset
622 static void
500740852250 removes public handle to soap connection, instead a connection is looked up
Ka-Hing Cheung <khc@pidgin.im>
parents: 21354
diff changeset
623 msn_soap_connection_destroy(MsnSoapConnection *conn)
500740852250 removes public handle to soap connection, instead a connection is looked up
Ka-Hing Cheung <khc@pidgin.im>
parents: 21354
diff changeset
624 {
500740852250 removes public handle to soap connection, instead a connection is looked up
Ka-Hing Cheung <khc@pidgin.im>
parents: 21354
diff changeset
625 if (conn->current_request) {
21357
64a63a153c62 the new soap code finally doesn't crash on startup, still can't
Ka-Hing Cheung <khc@pidgin.im>
parents: 21356
diff changeset
626 MsnSoapRequest *req = conn->current_request;
21355
500740852250 removes public handle to soap connection, instead a connection is looked up
Ka-Hing Cheung <khc@pidgin.im>
parents: 21354
diff changeset
627 conn->current_request = NULL;
21357
64a63a153c62 the new soap code finally doesn't crash on startup, still can't
Ka-Hing Cheung <khc@pidgin.im>
parents: 21356
diff changeset
628 msn_soap_connection_destroy_foreach_cb(req, conn);
21353
a70d31127cb6 beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@pidgin.im>
parents:
diff changeset
629 }
a70d31127cb6 beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@pidgin.im>
parents:
diff changeset
630
21358
0e54f76775d4 signs on!
Ka-Hing Cheung <khc@pidgin.im>
parents: 21357
diff changeset
631 msn_soap_connection_sanitize(conn, TRUE);
21355
500740852250 removes public handle to soap connection, instead a connection is looked up
Ka-Hing Cheung <khc@pidgin.im>
parents: 21354
diff changeset
632 g_queue_foreach(conn->queue, msn_soap_connection_destroy_foreach_cb, conn);
21358
0e54f76775d4 signs on!
Ka-Hing Cheung <khc@pidgin.im>
parents: 21357
diff changeset
633 g_queue_free(conn->queue);
21353
a70d31127cb6 beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@pidgin.im>
parents:
diff changeset
634
21355
500740852250 removes public handle to soap connection, instead a connection is looked up
Ka-Hing Cheung <khc@pidgin.im>
parents: 21354
diff changeset
635 g_free(conn->host);
21353
a70d31127cb6 beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@pidgin.im>
parents:
diff changeset
636 g_free(conn);
a70d31127cb6 beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@pidgin.im>
parents:
diff changeset
637 }
a70d31127cb6 beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@pidgin.im>
parents:
diff changeset
638
a70d31127cb6 beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@pidgin.im>
parents:
diff changeset
639 MsnSoapMessage *
21355
500740852250 removes public handle to soap connection, instead a connection is looked up
Ka-Hing Cheung <khc@pidgin.im>
parents: 21354
diff changeset
640 msn_soap_message_new(const char *action, xmlnode *xml)
21353
a70d31127cb6 beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@pidgin.im>
parents:
diff changeset
641 {
21355
500740852250 removes public handle to soap connection, instead a connection is looked up
Ka-Hing Cheung <khc@pidgin.im>
parents: 21354
diff changeset
642 MsnSoapMessage *message = g_new0(MsnSoapMessage, 1);
21353
a70d31127cb6 beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@pidgin.im>
parents:
diff changeset
643
21355
500740852250 removes public handle to soap connection, instead a connection is looked up
Ka-Hing Cheung <khc@pidgin.im>
parents: 21354
diff changeset
644 message->action = g_strdup(action);
500740852250 removes public handle to soap connection, instead a connection is looked up
Ka-Hing Cheung <khc@pidgin.im>
parents: 21354
diff changeset
645 message->xml = xml;
500740852250 removes public handle to soap connection, instead a connection is looked up
Ka-Hing Cheung <khc@pidgin.im>
parents: 21354
diff changeset
646
500740852250 removes public handle to soap connection, instead a connection is looked up
Ka-Hing Cheung <khc@pidgin.im>
parents: 21354
diff changeset
647 return message;
21353
a70d31127cb6 beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@pidgin.im>
parents:
diff changeset
648 }
a70d31127cb6 beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@pidgin.im>
parents:
diff changeset
649
a70d31127cb6 beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@pidgin.im>
parents:
diff changeset
650 void
21354
5c6020f03f2d mostly done with soap level parsing, compiles
Ka-Hing Cheung <khc@pidgin.im>
parents: 21353
diff changeset
651 msn_soap_message_destroy(MsnSoapMessage *message)
21353
a70d31127cb6 beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@pidgin.im>
parents:
diff changeset
652 {
21355
500740852250 removes public handle to soap connection, instead a connection is looked up
Ka-Hing Cheung <khc@pidgin.im>
parents: 21354
diff changeset
653 if (message) {
500740852250 removes public handle to soap connection, instead a connection is looked up
Ka-Hing Cheung <khc@pidgin.im>
parents: 21354
diff changeset
654 g_slist_foreach(message->headers, (GFunc)g_free, NULL);
500740852250 removes public handle to soap connection, instead a connection is looked up
Ka-Hing Cheung <khc@pidgin.im>
parents: 21354
diff changeset
655 g_slist_free(message->headers);
500740852250 removes public handle to soap connection, instead a connection is looked up
Ka-Hing Cheung <khc@pidgin.im>
parents: 21354
diff changeset
656 g_free(message->action);
21357
64a63a153c62 the new soap code finally doesn't crash on startup, still can't
Ka-Hing Cheung <khc@pidgin.im>
parents: 21356
diff changeset
657 if (message->xml)
64a63a153c62 the new soap code finally doesn't crash on startup, still can't
Ka-Hing Cheung <khc@pidgin.im>
parents: 21356
diff changeset
658 xmlnode_free(message->xml);
21355
500740852250 removes public handle to soap connection, instead a connection is looked up
Ka-Hing Cheung <khc@pidgin.im>
parents: 21354
diff changeset
659 g_free(message);
500740852250 removes public handle to soap connection, instead a connection is looked up
Ka-Hing Cheung <khc@pidgin.im>
parents: 21354
diff changeset
660 }
21353
a70d31127cb6 beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@pidgin.im>
parents:
diff changeset
661 }
a70d31127cb6 beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@pidgin.im>
parents:
diff changeset
662
a70d31127cb6 beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@pidgin.im>
parents:
diff changeset
663 void
22981
b83a23981419 Fix a number of leaks. As far as I can tell, MSNP14 now logs in without
Daniel Atallah <datallah@pidgin.im>
parents: 22060
diff changeset
664 msn_soap_message_add_header(MsnSoapMessage *message,
21353
a70d31127cb6 beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@pidgin.im>
parents:
diff changeset
665 const char *name, const char *value)
a70d31127cb6 beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@pidgin.im>
parents:
diff changeset
666 {
a70d31127cb6 beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@pidgin.im>
parents:
diff changeset
667 char *header = g_strdup_printf("%s: %s\r\n", name, value);
a70d31127cb6 beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@pidgin.im>
parents:
diff changeset
668
22981
b83a23981419 Fix a number of leaks. As far as I can tell, MSNP14 now logs in without
Daniel Atallah <datallah@pidgin.im>
parents: 22060
diff changeset
669 message->headers = g_slist_prepend(message->headers, header);
21353
a70d31127cb6 beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@pidgin.im>
parents:
diff changeset
670 }
21354
5c6020f03f2d mostly done with soap level parsing, compiles
Ka-Hing Cheung <khc@pidgin.im>
parents: 21353
diff changeset
671
21355
500740852250 removes public handle to soap connection, instead a connection is looked up
Ka-Hing Cheung <khc@pidgin.im>
parents: 21354
diff changeset
672 static void
23798
604090d9bfb0 Don't free the SOAP message when we're still using it for a redirect.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23797
diff changeset
673 msn_soap_request_destroy(MsnSoapRequest *req, gboolean keep_message)
21354
5c6020f03f2d mostly done with soap level parsing, compiles
Ka-Hing Cheung <khc@pidgin.im>
parents: 21353
diff changeset
674 {
5c6020f03f2d mostly done with soap level parsing, compiles
Ka-Hing Cheung <khc@pidgin.im>
parents: 21353
diff changeset
675 g_free(req->path);
23798
604090d9bfb0 Don't free the SOAP message when we're still using it for a redirect.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23797
diff changeset
676 if (!keep_message)
604090d9bfb0 Don't free the SOAP message when we're still using it for a redirect.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23797
diff changeset
677 msn_soap_message_destroy(req->message);
21354
5c6020f03f2d mostly done with soap level parsing, compiles
Ka-Hing Cheung <khc@pidgin.im>
parents: 21353
diff changeset
678 g_free(req);
5c6020f03f2d mostly done with soap level parsing, compiles
Ka-Hing Cheung <khc@pidgin.im>
parents: 21353
diff changeset
679 }
21357
64a63a153c62 the new soap code finally doesn't crash on startup, still can't
Ka-Hing Cheung <khc@pidgin.im>
parents: 21356
diff changeset
680

mercurial