annotate libpurple/protocols/msn/soap2.c @ 23523:31b5a1334e7e

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