Mercurial > pidgin
annotate libpurple/protocols/msn/soap2.c @ 20531:a96b5015395a
signs on!
author | Ka-Hing Cheung <khc@hxbc.us> |
---|---|
date | Mon, 01 Oct 2007 00:29:44 +0000 |
parents | 719ce4acfcb9 |
children | 66921a5c9ae9 |
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 |
915e11fbaeb0
beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@hxbc.us>
parents:
diff
changeset
|
26 #include "soap2.h" |
915e11fbaeb0
beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@hxbc.us>
parents:
diff
changeset
|
27 |
20528
06527cc0f79b
removes public handle to soap connection, instead a connection is looked up
Ka-Hing Cheung <khc@hxbc.us>
parents:
20527
diff
changeset
|
28 #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
|
29 |
20527
0034d7e89032
mostly done with soap level parsing, compiles
Ka-Hing Cheung <khc@hxbc.us>
parents:
20526
diff
changeset
|
30 #include "debug.h" |
20526
915e11fbaeb0
beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@hxbc.us>
parents:
diff
changeset
|
31 #include "xmlnode.h" |
915e11fbaeb0
beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@hxbc.us>
parents:
diff
changeset
|
32 |
915e11fbaeb0
beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@hxbc.us>
parents:
diff
changeset
|
33 #include <glib.h> |
915e11fbaeb0
beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@hxbc.us>
parents:
diff
changeset
|
34 #include <error.h> |
915e11fbaeb0
beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@hxbc.us>
parents:
diff
changeset
|
35 |
20528
06527cc0f79b
removes public handle to soap connection, instead a connection is looked up
Ka-Hing Cheung <khc@hxbc.us>
parents:
20527
diff
changeset
|
36 static GHashTable *conn_table = NULL; |
06527cc0f79b
removes public handle to soap connection, instead a connection is looked up
Ka-Hing Cheung <khc@hxbc.us>
parents:
20527
diff
changeset
|
37 |
06527cc0f79b
removes public handle to soap connection, instead a connection is looked up
Ka-Hing Cheung <khc@hxbc.us>
parents:
20527
diff
changeset
|
38 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
|
39 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
|
40 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
|
41 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
|
42 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
|
43 } MsnSoapRequest; |
06527cc0f79b
removes public handle to soap connection, instead a connection is looked up
Ka-Hing Cheung <khc@hxbc.us>
parents:
20527
diff
changeset
|
44 |
06527cc0f79b
removes public handle to soap connection, instead a connection is looked up
Ka-Hing Cheung <khc@hxbc.us>
parents:
20527
diff
changeset
|
45 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
|
46 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
|
47 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
|
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 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
|
50 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
|
51 |
06527cc0f79b
removes public handle to soap connection, instead a connection is looked up
Ka-Hing Cheung <khc@hxbc.us>
parents:
20527
diff
changeset
|
52 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
|
53 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
|
54 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
|
55 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
|
56 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
|
57 gboolean headers_done; |
20531 | 58 gboolean close_when_done; |
59 | |
20528
06527cc0f79b
removes public handle to soap connection, instead a connection is looked up
Ka-Hing Cheung <khc@hxbc.us>
parents:
20527
diff
changeset
|
60 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
|
61 |
06527cc0f79b
removes public handle to soap connection, instead a connection is looked up
Ka-Hing Cheung <khc@hxbc.us>
parents:
20527
diff
changeset
|
62 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
|
63 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
|
64 } MsnSoapConnection; |
06527cc0f79b
removes public handle to soap connection, instead a connection is looked up
Ka-Hing Cheung <khc@hxbc.us>
parents:
20527
diff
changeset
|
65 |
06527cc0f79b
removes public handle to soap connection, instead a connection is looked up
Ka-Hing Cheung <khc@hxbc.us>
parents:
20527
diff
changeset
|
66 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
|
67 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
|
68 |
06527cc0f79b
removes public handle to soap connection, instead a connection is looked up
Ka-Hing Cheung <khc@hxbc.us>
parents:
20527
diff
changeset
|
69 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
|
70 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
|
71 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
|
72 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
|
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 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
|
75 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
|
76 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
|
77 |
06527cc0f79b
removes public handle to soap connection, instead a connection is looked up
Ka-Hing Cheung <khc@hxbc.us>
parents:
20527
diff
changeset
|
78 static void msn_soap_request_destroy(MsnSoapRequest *req); |
20531 | 79 static void msn_soap_connection_sanitize(MsnSoapConnection *conn, gboolean disconnect); |
20526
915e11fbaeb0
beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@hxbc.us>
parents:
diff
changeset
|
80 |
915e11fbaeb0
beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@hxbc.us>
parents:
diff
changeset
|
81 |
20528
06527cc0f79b
removes public handle to soap connection, instead a connection is looked up
Ka-Hing Cheung <khc@hxbc.us>
parents:
20527
diff
changeset
|
82 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
|
83 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
|
84 { |
20528
06527cc0f79b
removes public handle to soap connection, instead a connection is looked up
Ka-Hing Cheung <khc@hxbc.us>
parents:
20527
diff
changeset
|
85 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
|
86 |
06527cc0f79b
removes public handle to soap connection, instead a connection is looked up
Ka-Hing Cheung <khc@hxbc.us>
parents:
20527
diff
changeset
|
87 if (session->soap_table) { |
06527cc0f79b
removes public handle to soap connection, instead a connection is looked up
Ka-Hing Cheung <khc@hxbc.us>
parents:
20527
diff
changeset
|
88 conn = g_hash_table_lookup(conn_table, host); |
06527cc0f79b
removes public handle to soap connection, instead a connection is looked up
Ka-Hing Cheung <khc@hxbc.us>
parents:
20527
diff
changeset
|
89 } else { |
06527cc0f79b
removes public handle to soap connection, instead a connection is looked up
Ka-Hing Cheung <khc@hxbc.us>
parents:
20527
diff
changeset
|
90 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
|
91 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
|
92 } |
06527cc0f79b
removes public handle to soap connection, instead a connection is looked up
Ka-Hing Cheung <khc@hxbc.us>
parents:
20527
diff
changeset
|
93 |
06527cc0f79b
removes public handle to soap connection, instead a connection is looked up
Ka-Hing Cheung <khc@hxbc.us>
parents:
20527
diff
changeset
|
94 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
|
95 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
|
96 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
|
97 } |
06527cc0f79b
removes public handle to soap connection, instead a connection is looked up
Ka-Hing Cheung <khc@hxbc.us>
parents:
20527
diff
changeset
|
98 |
06527cc0f79b
removes public handle to soap connection, instead a connection is looked up
Ka-Hing Cheung <khc@hxbc.us>
parents:
20527
diff
changeset
|
99 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
|
100 } |
06527cc0f79b
removes public handle to soap connection, instead a connection is looked up
Ka-Hing Cheung <khc@hxbc.us>
parents:
20527
diff
changeset
|
101 |
06527cc0f79b
removes public handle to soap connection, instead a connection is looked up
Ka-Hing Cheung <khc@hxbc.us>
parents:
20527
diff
changeset
|
102 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
|
103 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
|
104 { |
06527cc0f79b
removes public handle to soap connection, instead a connection is looked up
Ka-Hing Cheung <khc@hxbc.us>
parents:
20527
diff
changeset
|
105 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
|
106 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
|
107 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
|
108 conn->queue = g_queue_new(); |
915e11fbaeb0
beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@hxbc.us>
parents:
diff
changeset
|
109 return conn; |
915e11fbaeb0
beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@hxbc.us>
parents:
diff
changeset
|
110 } |
915e11fbaeb0
beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@hxbc.us>
parents:
diff
changeset
|
111 |
915e11fbaeb0
beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@hxbc.us>
parents:
diff
changeset
|
112 static void |
915e11fbaeb0
beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@hxbc.us>
parents:
diff
changeset
|
113 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
|
114 PurpleInputCondition cond) |
915e11fbaeb0
beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@hxbc.us>
parents:
diff
changeset
|
115 { |
20528
06527cc0f79b
removes public handle to soap connection, instead a connection is looked up
Ka-Hing Cheung <khc@hxbc.us>
parents:
20527
diff
changeset
|
116 MsnSoapConnection *conn = data; |
20526
915e11fbaeb0
beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@hxbc.us>
parents:
diff
changeset
|
117 |
915e11fbaeb0
beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@hxbc.us>
parents:
diff
changeset
|
118 conn->connected = TRUE; |
915e11fbaeb0
beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@hxbc.us>
parents:
diff
changeset
|
119 |
20528
06527cc0f79b
removes public handle to soap connection, instead a connection is looked up
Ka-Hing Cheung <khc@hxbc.us>
parents:
20527
diff
changeset
|
120 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
|
121 conn->event_handle = g_idle_add(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
|
122 } |
915e11fbaeb0
beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@hxbc.us>
parents:
diff
changeset
|
123 |
915e11fbaeb0
beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@hxbc.us>
parents:
diff
changeset
|
124 static void |
915e11fbaeb0
beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@hxbc.us>
parents:
diff
changeset
|
125 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
|
126 gpointer data) |
915e11fbaeb0
beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@hxbc.us>
parents:
diff
changeset
|
127 { |
20528
06527cc0f79b
removes public handle to soap connection, instead a connection is looked up
Ka-Hing Cheung <khc@hxbc.us>
parents:
20527
diff
changeset
|
128 MsnSoapConnection *conn = data; |
20526
915e11fbaeb0
beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@hxbc.us>
parents:
diff
changeset
|
129 |
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 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
|
131 } |
915e11fbaeb0
beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@hxbc.us>
parents:
diff
changeset
|
132 |
20527
0034d7e89032
mostly done with soap level parsing, compiles
Ka-Hing Cheung <khc@hxbc.us>
parents:
20526
diff
changeset
|
133 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
|
134 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
|
135 { |
0034d7e89032
mostly done with soap level parsing, compiles
Ka-Hing Cheung <khc@hxbc.us>
parents:
20526
diff
changeset
|
136 char *c; |
0034d7e89032
mostly done with soap level parsing, compiles
Ka-Hing Cheung <khc@hxbc.us>
parents:
20526
diff
changeset
|
137 |
0034d7e89032
mostly done with soap level parsing, compiles
Ka-Hing Cheung <khc@hxbc.us>
parents:
20526
diff
changeset
|
138 /* Skip the http:// */ |
0034d7e89032
mostly done with soap level parsing, compiles
Ka-Hing Cheung <khc@hxbc.us>
parents:
20526
diff
changeset
|
139 if ((c = strchr(url, '/')) != NULL) |
0034d7e89032
mostly done with soap level parsing, compiles
Ka-Hing Cheung <khc@hxbc.us>
parents:
20526
diff
changeset
|
140 url += 2; |
0034d7e89032
mostly done with soap level parsing, compiles
Ka-Hing Cheung <khc@hxbc.us>
parents:
20526
diff
changeset
|
141 |
0034d7e89032
mostly done with soap level parsing, compiles
Ka-Hing Cheung <khc@hxbc.us>
parents:
20526
diff
changeset
|
142 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
|
143 char *host, *path; |
20527
0034d7e89032
mostly done with soap level parsing, compiles
Ka-Hing Cheung <khc@hxbc.us>
parents:
20526
diff
changeset
|
144 |
20528
06527cc0f79b
removes public handle to soap connection, instead a connection is looked up
Ka-Hing Cheung <khc@hxbc.us>
parents:
20527
diff
changeset
|
145 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
|
146 path = g_strdup(c); |
20527
0034d7e89032
mostly done with soap level parsing, compiles
Ka-Hing Cheung <khc@hxbc.us>
parents:
20526
diff
changeset
|
147 |
20528
06527cc0f79b
removes public handle to soap connection, instead a connection is looked up
Ka-Hing Cheung <khc@hxbc.us>
parents:
20527
diff
changeset
|
148 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
|
149 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
|
150 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
|
151 |
20528
06527cc0f79b
removes public handle to soap connection, instead a connection is looked up
Ka-Hing Cheung <khc@hxbc.us>
parents:
20527
diff
changeset
|
152 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
|
153 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
|
154 |
06527cc0f79b
removes public handle to soap connection, instead a connection is looked up
Ka-Hing Cheung <khc@hxbc.us>
parents:
20527
diff
changeset
|
155 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
|
156 g_free(path); |
20527
0034d7e89032
mostly done with soap level parsing, compiles
Ka-Hing Cheung <khc@hxbc.us>
parents:
20526
diff
changeset
|
157 |
0034d7e89032
mostly done with soap level parsing, compiles
Ka-Hing Cheung <khc@hxbc.us>
parents:
20526
diff
changeset
|
158 return TRUE; |
0034d7e89032
mostly done with soap level parsing, compiles
Ka-Hing Cheung <khc@hxbc.us>
parents:
20526
diff
changeset
|
159 } |
0034d7e89032
mostly done with soap level parsing, compiles
Ka-Hing Cheung <khc@hxbc.us>
parents:
20526
diff
changeset
|
160 |
0034d7e89032
mostly done with soap level parsing, compiles
Ka-Hing Cheung <khc@hxbc.us>
parents:
20526
diff
changeset
|
161 return FALSE; |
0034d7e89032
mostly done with soap level parsing, compiles
Ka-Hing Cheung <khc@hxbc.us>
parents:
20526
diff
changeset
|
162 } |
0034d7e89032
mostly done with soap level parsing, compiles
Ka-Hing Cheung <khc@hxbc.us>
parents:
20526
diff
changeset
|
163 |
0034d7e89032
mostly done with soap level parsing, compiles
Ka-Hing Cheung <khc@hxbc.us>
parents:
20526
diff
changeset
|
164 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
|
165 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
|
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 xmlnode *node = response->xml; |
20527
0034d7e89032
mostly done with soap level parsing, compiles
Ka-Hing Cheung <khc@hxbc.us>
parents:
20526
diff
changeset
|
168 |
20531 | 169 if (strcmp(node->name, "Envelope") == 0 && |
20527
0034d7e89032
mostly done with soap level parsing, compiles
Ka-Hing Cheung <khc@hxbc.us>
parents:
20526
diff
changeset
|
170 node->child && strcmp(node->child->name, "Header") == 0 && |
0034d7e89032
mostly done with soap level parsing, compiles
Ka-Hing Cheung <khc@hxbc.us>
parents:
20526
diff
changeset
|
171 node->child->next) { |
0034d7e89032
mostly done with soap level parsing, compiles
Ka-Hing Cheung <khc@hxbc.us>
parents:
20526
diff
changeset
|
172 xmlnode *body = node->child->next; |
20531 | 173 MsnSoapRequest *request; |
20527
0034d7e89032
mostly done with soap level parsing, compiles
Ka-Hing Cheung <khc@hxbc.us>
parents:
20526
diff
changeset
|
174 |
20531 | 175 if (strcmp(body->name, "Fault") == 0) { |
20527
0034d7e89032
mostly done with soap level parsing, compiles
Ka-Hing Cheung <khc@hxbc.us>
parents:
20526
diff
changeset
|
176 xmlnode *fault = xmlnode_get_child(body, "faultcode"); |
0034d7e89032
mostly done with soap level parsing, compiles
Ka-Hing Cheung <khc@hxbc.us>
parents:
20526
diff
changeset
|
177 |
0034d7e89032
mostly done with soap level parsing, compiles
Ka-Hing Cheung <khc@hxbc.us>
parents:
20526
diff
changeset
|
178 if (fault != NULL) { |
20531 | 179 char *faultdata = xmlnode_get_data(fault); |
180 | |
181 if (strcmp(faultdata, "psf:Redirect") == 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
|
182 xmlnode *url = xmlnode_get_child(body, "redirectUrl"); |
20527
0034d7e89032
mostly done with soap level parsing, compiles
Ka-Hing Cheung <khc@hxbc.us>
parents:
20526
diff
changeset
|
183 |
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 if (url) { |
20531 | 185 char *urldata = xmlnode_get_data(url); |
186 msn_soap_handle_redirect(conn, urldata); | |
187 g_free(urldata); | |
20527
0034d7e89032
mostly done with soap level parsing, compiles
Ka-Hing Cheung <khc@hxbc.us>
parents:
20526
diff
changeset
|
188 } |
20528
06527cc0f79b
removes public handle to soap connection, instead a connection is looked up
Ka-Hing Cheung <khc@hxbc.us>
parents:
20527
diff
changeset
|
189 |
20531 | 190 g_free(faultdata); |
20528
06527cc0f79b
removes public handle to soap connection, instead a connection is looked up
Ka-Hing Cheung <khc@hxbc.us>
parents:
20527
diff
changeset
|
191 return TRUE; |
20531 | 192 } else if (strcmp(faultdata, "wsse:FailedAuthentication") == 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
|
193 xmlnode *reason = xmlnode_get_child(body, "faultstring"); |
20531 | 194 char *reasondata = xmlnode_get_data(reason); |
20527
0034d7e89032
mostly done with soap level parsing, compiles
Ka-Hing Cheung <khc@hxbc.us>
parents:
20526
diff
changeset
|
195 |
20531 | 196 msn_soap_connection_sanitize(conn, TRUE); |
20527
0034d7e89032
mostly done with soap level parsing, compiles
Ka-Hing Cheung <khc@hxbc.us>
parents:
20526
diff
changeset
|
197 msn_session_set_error(conn->session, MSN_ERROR_AUTH, |
20531 | 198 reasondata); |
20527
0034d7e89032
mostly done with soap level parsing, compiles
Ka-Hing Cheung <khc@hxbc.us>
parents:
20526
diff
changeset
|
199 |
20531 | 200 g_free(reasondata); |
201 g_free(faultdata); | |
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 return FALSE; |
20527
0034d7e89032
mostly done with soap level parsing, compiles
Ka-Hing Cheung <khc@hxbc.us>
parents:
20526
diff
changeset
|
203 } |
20531 | 204 |
205 g_free(faultdata); | |
20527
0034d7e89032
mostly done with soap level parsing, compiles
Ka-Hing Cheung <khc@hxbc.us>
parents:
20526
diff
changeset
|
206 } |
20531 | 207 } |
20527
0034d7e89032
mostly done with soap level parsing, compiles
Ka-Hing Cheung <khc@hxbc.us>
parents:
20526
diff
changeset
|
208 |
20531 | 209 request = conn->current_request; |
210 conn->current_request = NULL; | |
211 request->cb(request->message, response, | |
212 request->cb_data); | |
213 msn_soap_request_destroy(request); | |
20527
0034d7e89032
mostly done with soap level parsing, compiles
Ka-Hing Cheung <khc@hxbc.us>
parents:
20526
diff
changeset
|
214 } |
0034d7e89032
mostly done with soap level parsing, compiles
Ka-Hing Cheung <khc@hxbc.us>
parents:
20526
diff
changeset
|
215 |
20528
06527cc0f79b
removes public handle to soap connection, instead a connection is looked up
Ka-Hing Cheung <khc@hxbc.us>
parents:
20527
diff
changeset
|
216 return TRUE; |
20527
0034d7e89032
mostly done with soap level parsing, compiles
Ka-Hing Cheung <khc@hxbc.us>
parents:
20526
diff
changeset
|
217 } |
0034d7e89032
mostly done with soap level parsing, compiles
Ka-Hing Cheung <khc@hxbc.us>
parents:
20526
diff
changeset
|
218 |
20526
915e11fbaeb0
beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@hxbc.us>
parents:
diff
changeset
|
219 static void |
915e11fbaeb0
beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@hxbc.us>
parents:
diff
changeset
|
220 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
|
221 { |
20528
06527cc0f79b
removes public handle to soap connection, instead a connection is looked up
Ka-Hing Cheung <khc@hxbc.us>
parents:
20527
diff
changeset
|
222 MsnSoapConnection *conn = data; |
20526
915e11fbaeb0
beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@hxbc.us>
parents:
diff
changeset
|
223 int count; |
915e11fbaeb0
beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@hxbc.us>
parents:
diff
changeset
|
224 char buf[8192]; |
20527
0034d7e89032
mostly done with soap level parsing, compiles
Ka-Hing Cheung <khc@hxbc.us>
parents:
20526
diff
changeset
|
225 char *linebreak; |
20528
06527cc0f79b
removes public handle to soap connection, instead a connection is looked up
Ka-Hing Cheung <khc@hxbc.us>
parents:
20527
diff
changeset
|
226 char *cursor; |
06527cc0f79b
removes public handle to soap connection, instead a connection is looked up
Ka-Hing Cheung <khc@hxbc.us>
parents:
20527
diff
changeset
|
227 gboolean handled = FALSE; |
20526
915e11fbaeb0
beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@hxbc.us>
parents:
diff
changeset
|
228 |
915e11fbaeb0
beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@hxbc.us>
parents:
diff
changeset
|
229 g_return_if_fail(cond == PURPLE_INPUT_READ); |
915e11fbaeb0
beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@hxbc.us>
parents:
diff
changeset
|
230 |
915e11fbaeb0
beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@hxbc.us>
parents:
diff
changeset
|
231 count = purple_ssl_read(conn->ssl, buf, sizeof(buf)); |
20531 | 232 purple_debug_info("soap", "read %d bytes\n", count); |
20526
915e11fbaeb0
beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@hxbc.us>
parents:
diff
changeset
|
233 if (count < 0 && errno == EAGAIN) |
915e11fbaeb0
beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@hxbc.us>
parents:
diff
changeset
|
234 return; |
915e11fbaeb0
beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@hxbc.us>
parents:
diff
changeset
|
235 else if (count <= 0) { |
20531 | 236 purple_debug_info("soap", "read: %s\n", strerror(errno)); |
20528
06527cc0f79b
removes public handle to soap connection, instead a connection is looked up
Ka-Hing Cheung <khc@hxbc.us>
parents:
20527
diff
changeset
|
237 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
|
238 conn->ssl = 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
|
239 msn_soap_connection_handle_next(conn); |
20526
915e11fbaeb0
beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@hxbc.us>
parents:
diff
changeset
|
240 return; |
915e11fbaeb0
beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@hxbc.us>
parents:
diff
changeset
|
241 } |
915e11fbaeb0
beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@hxbc.us>
parents:
diff
changeset
|
242 |
20528
06527cc0f79b
removes public handle to soap connection, instead a connection is looked up
Ka-Hing Cheung <khc@hxbc.us>
parents:
20527
diff
changeset
|
243 if (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
|
244 conn->message = msn_soap_message_new(NULL, NULL); |
20527
0034d7e89032
mostly done with soap level parsing, compiles
Ka-Hing Cheung <khc@hxbc.us>
parents:
20526
diff
changeset
|
245 } |
0034d7e89032
mostly done with soap level parsing, compiles
Ka-Hing Cheung <khc@hxbc.us>
parents:
20526
diff
changeset
|
246 |
20528
06527cc0f79b
removes public handle to soap connection, instead a connection is looked up
Ka-Hing Cheung <khc@hxbc.us>
parents:
20527
diff
changeset
|
247 if (conn->buf == NULL) { |
06527cc0f79b
removes public handle to soap connection, instead a connection is looked up
Ka-Hing Cheung <khc@hxbc.us>
parents:
20527
diff
changeset
|
248 conn->buf = g_string_new_len(buf, count); |
20526
915e11fbaeb0
beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@hxbc.us>
parents:
diff
changeset
|
249 } 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
|
250 g_string_append_len(conn->buf, buf, count); |
20527
0034d7e89032
mostly done with soap level parsing, compiles
Ka-Hing Cheung <khc@hxbc.us>
parents:
20526
diff
changeset
|
251 } |
0034d7e89032
mostly done with soap level parsing, compiles
Ka-Hing Cheung <khc@hxbc.us>
parents:
20526
diff
changeset
|
252 |
20531 | 253 purple_debug_info("soap", "current %s\n", conn->buf->str); |
254 | |
20528
06527cc0f79b
removes public handle to soap connection, instead a connection is looked up
Ka-Hing Cheung <khc@hxbc.us>
parents:
20527
diff
changeset
|
255 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
|
256 |
06527cc0f79b
removes public handle to soap connection, instead a connection is looked up
Ka-Hing Cheung <khc@hxbc.us>
parents:
20527
diff
changeset
|
257 if (conn->headers_done) { |
06527cc0f79b
removes public handle to soap connection, instead a connection is looked up
Ka-Hing Cheung <khc@hxbc.us>
parents:
20527
diff
changeset
|
258 if (conn->buf->len - 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
|
259 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
|
260 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
|
261 |
0034d7e89032
mostly done with soap level parsing, compiles
Ka-Hing Cheung <khc@hxbc.us>
parents:
20526
diff
changeset
|
262 if (node == NULL) { |
0034d7e89032
mostly done with soap level parsing, compiles
Ka-Hing Cheung <khc@hxbc.us>
parents:
20526
diff
changeset
|
263 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
|
264 cursor); |
20527
0034d7e89032
mostly done with soap level parsing, compiles
Ka-Hing Cheung <khc@hxbc.us>
parents:
20526
diff
changeset
|
265 } 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
|
266 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
|
267 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
|
268 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
|
269 |
06527cc0f79b
removes public handle to soap connection, instead a connection is looked up
Ka-Hing Cheung <khc@hxbc.us>
parents:
20527
diff
changeset
|
270 if (!msn_soap_handle_body(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
|
271 return; |
20527
0034d7e89032
mostly done with soap level parsing, compiles
Ka-Hing Cheung <khc@hxbc.us>
parents:
20526
diff
changeset
|
272 } |
20528
06527cc0f79b
removes public handle to soap connection, instead a connection is looked up
Ka-Hing Cheung <khc@hxbc.us>
parents:
20527
diff
changeset
|
273 |
06527cc0f79b
removes public handle to soap connection, instead a connection is looked up
Ka-Hing Cheung <khc@hxbc.us>
parents:
20527
diff
changeset
|
274 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
|
275 } |
0034d7e89032
mostly done with soap level parsing, compiles
Ka-Hing Cheung <khc@hxbc.us>
parents:
20526
diff
changeset
|
276 |
0034d7e89032
mostly done with soap level parsing, compiles
Ka-Hing Cheung <khc@hxbc.us>
parents:
20526
diff
changeset
|
277 return; |
20526
915e11fbaeb0
beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@hxbc.us>
parents:
diff
changeset
|
278 } |
915e11fbaeb0
beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@hxbc.us>
parents:
diff
changeset
|
279 |
20528
06527cc0f79b
removes public handle to soap connection, instead a connection is looked up
Ka-Hing Cheung <khc@hxbc.us>
parents:
20527
diff
changeset
|
280 while ((linebreak = strstr(cursor, "\r\n")) != NULL) { |
06527cc0f79b
removes public handle to soap connection, instead a connection is looked up
Ka-Hing Cheung <khc@hxbc.us>
parents:
20527
diff
changeset
|
281 conn->handled_len = linebreak - conn->buf->str + 2; |
20527
0034d7e89032
mostly done with soap level parsing, compiles
Ka-Hing Cheung <khc@hxbc.us>
parents:
20526
diff
changeset
|
282 |
20528
06527cc0f79b
removes public handle to soap connection, instead a connection is looked up
Ka-Hing Cheung <khc@hxbc.us>
parents:
20527
diff
changeset
|
283 if (conn->response_code == 0) { |
06527cc0f79b
removes public handle to soap connection, instead a connection is looked up
Ka-Hing Cheung <khc@hxbc.us>
parents:
20527
diff
changeset
|
284 if (sscanf(cursor, "HTTP/1.1 %d", &conn->response_code) != 1) { |
20527
0034d7e89032
mostly done with soap level parsing, compiles
Ka-Hing Cheung <khc@hxbc.us>
parents:
20526
diff
changeset
|
285 /* something horribly wrong */ |
20528
06527cc0f79b
removes public handle to soap connection, instead a connection is looked up
Ka-Hing Cheung <khc@hxbc.us>
parents:
20527
diff
changeset
|
286 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
|
287 conn->ssl = NULL; |
20531 | 288 msn_soap_connection_handle_next(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
|
289 handled = TRUE; |
06527cc0f79b
removes public handle to soap connection, instead a connection is looked up
Ka-Hing Cheung <khc@hxbc.us>
parents:
20527
diff
changeset
|
290 break; |
06527cc0f79b
removes public handle to soap connection, instead a connection is looked up
Ka-Hing Cheung <khc@hxbc.us>
parents:
20527
diff
changeset
|
291 } else if (conn->response_code == 503) { |
20531 | 292 msn_soap_connection_sanitize(conn, TRUE); |
20527
0034d7e89032
mostly done with soap level parsing, compiles
Ka-Hing Cheung <khc@hxbc.us>
parents:
20526
diff
changeset
|
293 msn_session_set_error(conn->session, MSN_ERROR_SERV_UNAVAILABLE, 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
|
294 return; |
20527
0034d7e89032
mostly done with soap level parsing, compiles
Ka-Hing Cheung <khc@hxbc.us>
parents:
20526
diff
changeset
|
295 } |
20528
06527cc0f79b
removes public handle to soap connection, instead a connection is looked up
Ka-Hing Cheung <khc@hxbc.us>
parents:
20527
diff
changeset
|
296 } else if (cursor == linebreak) { |
20527
0034d7e89032
mostly done with soap level parsing, compiles
Ka-Hing Cheung <khc@hxbc.us>
parents:
20526
diff
changeset
|
297 /* blank line */ |
20528
06527cc0f79b
removes public handle to soap connection, instead a connection is looked up
Ka-Hing Cheung <khc@hxbc.us>
parents:
20527
diff
changeset
|
298 conn->headers_done = TRUE; |
20527
0034d7e89032
mostly done with soap level parsing, compiles
Ka-Hing Cheung <khc@hxbc.us>
parents:
20526
diff
changeset
|
299 } else { |
20531 | 300 char *line = g_strndup(cursor, linebreak - cursor); |
301 char *sep = strstr(line, ": "); | |
302 char *key = line; | |
303 char *value; | |
20526
915e11fbaeb0
beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@hxbc.us>
parents:
diff
changeset
|
304 |
20531 | 305 if (sep == NULL) { |
306 purple_debug_info("soap", "ignoring malformed line: %s\n", line); | |
307 g_free(line); | |
308 goto loop_end; | |
309 } | |
310 | |
311 value = sep + 2; | |
20527
0034d7e89032
mostly done with soap level parsing, compiles
Ka-Hing Cheung <khc@hxbc.us>
parents:
20526
diff
changeset
|
312 *sep = '\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
|
313 msn_soap_message_add_header(conn->message, key, value); |
20531 | 314 purple_debug_info("soap", "header %s: %s\n", key, value); |
20527
0034d7e89032
mostly done with soap level parsing, compiles
Ka-Hing Cheung <khc@hxbc.us>
parents:
20526
diff
changeset
|
315 |
20528
06527cc0f79b
removes public handle to soap connection, instead a connection is looked up
Ka-Hing Cheung <khc@hxbc.us>
parents:
20527
diff
changeset
|
316 if ((conn->response_code == 301 || conn->response_code == 300) |
20527
0034d7e89032
mostly done with soap level parsing, compiles
Ka-Hing Cheung <khc@hxbc.us>
parents:
20526
diff
changeset
|
317 && strcmp(key, "Location") == 0) { |
0034d7e89032
mostly done with soap level parsing, compiles
Ka-Hing Cheung <khc@hxbc.us>
parents:
20526
diff
changeset
|
318 |
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
|
319 msn_soap_handle_redirect(conn, value); |
20527
0034d7e89032
mostly done with soap level parsing, compiles
Ka-Hing Cheung <khc@hxbc.us>
parents:
20526
diff
changeset
|
320 |
20528
06527cc0f79b
removes public handle to soap connection, instead a connection is looked up
Ka-Hing Cheung <khc@hxbc.us>
parents:
20527
diff
changeset
|
321 handled = TRUE; |
20531 | 322 g_free(line); |
20528
06527cc0f79b
removes public handle to soap connection, instead a connection is looked up
Ka-Hing Cheung <khc@hxbc.us>
parents:
20527
diff
changeset
|
323 break; |
06527cc0f79b
removes public handle to soap connection, instead a connection is looked up
Ka-Hing Cheung <khc@hxbc.us>
parents:
20527
diff
changeset
|
324 } else if (conn->response_code == 401 && |
20527
0034d7e89032
mostly done with soap level parsing, compiles
Ka-Hing Cheung <khc@hxbc.us>
parents:
20526
diff
changeset
|
325 strcmp(key, "WWW-Authenticate") == 0) { |
0034d7e89032
mostly done with soap level parsing, compiles
Ka-Hing Cheung <khc@hxbc.us>
parents:
20526
diff
changeset
|
326 char *error = strstr(value, "cbtxt="); |
0034d7e89032
mostly done with soap level parsing, compiles
Ka-Hing Cheung <khc@hxbc.us>
parents:
20526
diff
changeset
|
327 |
0034d7e89032
mostly done with soap level parsing, compiles
Ka-Hing Cheung <khc@hxbc.us>
parents:
20526
diff
changeset
|
328 if (error) { |
0034d7e89032
mostly done with soap level parsing, compiles
Ka-Hing Cheung <khc@hxbc.us>
parents:
20526
diff
changeset
|
329 error += strlen("cbtxt="); |
0034d7e89032
mostly done with soap level parsing, compiles
Ka-Hing Cheung <khc@hxbc.us>
parents:
20526
diff
changeset
|
330 } |
0034d7e89032
mostly done with soap level parsing, compiles
Ka-Hing Cheung <khc@hxbc.us>
parents:
20526
diff
changeset
|
331 |
20531 | 332 msn_soap_connection_sanitize(conn, TRUE); |
20527
0034d7e89032
mostly done with soap level parsing, compiles
Ka-Hing Cheung <khc@hxbc.us>
parents:
20526
diff
changeset
|
333 msn_session_set_error(conn->session, MSN_ERROR_AUTH, |
0034d7e89032
mostly done with soap level parsing, compiles
Ka-Hing Cheung <khc@hxbc.us>
parents:
20526
diff
changeset
|
334 error ? purple_url_decode(error) : 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
|
335 |
20531 | 336 g_free(line); |
20528
06527cc0f79b
removes public handle to soap connection, instead a connection is looked up
Ka-Hing Cheung <khc@hxbc.us>
parents:
20527
diff
changeset
|
337 return; |
20527
0034d7e89032
mostly done with soap level parsing, compiles
Ka-Hing Cheung <khc@hxbc.us>
parents:
20526
diff
changeset
|
338 } else if (strcmp(key, "Content-Length") == 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
|
339 conn->body_len = atoi(value); |
20531 | 340 } else if (strcmp(key, "Connection") == 0) { |
341 if (strcmp(value, "close") == 0) { | |
342 conn->close_when_done = TRUE; | |
343 } | |
20527
0034d7e89032
mostly done with soap level parsing, compiles
Ka-Hing Cheung <khc@hxbc.us>
parents:
20526
diff
changeset
|
344 } |
0034d7e89032
mostly done with soap level parsing, compiles
Ka-Hing Cheung <khc@hxbc.us>
parents:
20526
diff
changeset
|
345 } |
20531 | 346 |
347 loop_end: | |
348 cursor = conn->buf->str + conn->handled_len; | |
20526
915e11fbaeb0
beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@hxbc.us>
parents:
diff
changeset
|
349 } |
20528
06527cc0f79b
removes public handle to soap connection, instead a connection is looked up
Ka-Hing Cheung <khc@hxbc.us>
parents:
20527
diff
changeset
|
350 |
06527cc0f79b
removes public handle to soap connection, instead a connection is looked up
Ka-Hing Cheung <khc@hxbc.us>
parents:
20527
diff
changeset
|
351 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
|
352 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
|
353 } |
20526
915e11fbaeb0
beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@hxbc.us>
parents:
diff
changeset
|
354 } |
915e11fbaeb0
beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@hxbc.us>
parents:
diff
changeset
|
355 |
915e11fbaeb0
beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@hxbc.us>
parents:
diff
changeset
|
356 static void |
915e11fbaeb0
beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@hxbc.us>
parents:
diff
changeset
|
357 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
|
358 { |
20528
06527cc0f79b
removes public handle to soap connection, instead a connection is looked up
Ka-Hing Cheung <khc@hxbc.us>
parents:
20527
diff
changeset
|
359 MsnSoapConnection *conn = data; |
20526
915e11fbaeb0
beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@hxbc.us>
parents:
diff
changeset
|
360 int written; |
915e11fbaeb0
beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@hxbc.us>
parents:
diff
changeset
|
361 |
915e11fbaeb0
beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@hxbc.us>
parents:
diff
changeset
|
362 g_return_if_fail(cond == PURPLE_INPUT_WRITE); |
915e11fbaeb0
beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@hxbc.us>
parents:
diff
changeset
|
363 |
20528
06527cc0f79b
removes public handle to soap connection, instead a connection is looked up
Ka-Hing Cheung <khc@hxbc.us>
parents:
20527
diff
changeset
|
364 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
|
365 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
|
366 |
915e11fbaeb0
beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@hxbc.us>
parents:
diff
changeset
|
367 if (written < 0 && errno == EAGAIN) |
915e11fbaeb0
beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@hxbc.us>
parents:
diff
changeset
|
368 return; |
915e11fbaeb0
beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@hxbc.us>
parents:
diff
changeset
|
369 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
|
370 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
|
371 conn->ssl = NULL; |
06527cc0f79b
removes public handle to soap connection, instead a connection is looked up
Ka-Hing Cheung <khc@hxbc.us>
parents:
20527
diff
changeset
|
372 msn_soap_connection_handle_next(conn); |
20526
915e11fbaeb0
beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@hxbc.us>
parents:
diff
changeset
|
373 return; |
915e11fbaeb0
beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@hxbc.us>
parents:
diff
changeset
|
374 } |
915e11fbaeb0
beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@hxbc.us>
parents:
diff
changeset
|
375 |
20528
06527cc0f79b
removes public handle to soap connection, instead a connection is looked up
Ka-Hing Cheung <khc@hxbc.us>
parents:
20527
diff
changeset
|
376 conn->handled_len += written; |
20526
915e11fbaeb0
beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@hxbc.us>
parents:
diff
changeset
|
377 |
20528
06527cc0f79b
removes public handle to soap connection, instead a connection is looked up
Ka-Hing Cheung <khc@hxbc.us>
parents:
20527
diff
changeset
|
378 if (conn->handled_len < conn->buf->len) |
20526
915e11fbaeb0
beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@hxbc.us>
parents:
diff
changeset
|
379 return; |
915e11fbaeb0
beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@hxbc.us>
parents:
diff
changeset
|
380 |
915e11fbaeb0
beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@hxbc.us>
parents:
diff
changeset
|
381 /* we are done! */ |
20531 | 382 g_string_free(conn->buf, TRUE); |
383 conn->buf = NULL; | |
384 conn->handled_len = 0; | |
385 conn->body_len = 0; | |
386 conn->response_code = 0; | |
387 conn->headers_done = FALSE; | |
388 conn->close_when_done = FALSE; | |
389 | |
20528
06527cc0f79b
removes public handle to soap connection, instead a connection is looked up
Ka-Hing Cheung <khc@hxbc.us>
parents:
20527
diff
changeset
|
390 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
|
391 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
|
392 msn_soap_read_cb, conn); |
915e11fbaeb0
beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@hxbc.us>
parents:
diff
changeset
|
393 } |
915e11fbaeb0
beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@hxbc.us>
parents:
diff
changeset
|
394 |
915e11fbaeb0
beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@hxbc.us>
parents:
diff
changeset
|
395 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
|
396 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
|
397 { |
20528
06527cc0f79b
removes public handle to soap connection, instead a connection is looked up
Ka-Hing Cheung <khc@hxbc.us>
parents:
20527
diff
changeset
|
398 MsnSoapConnection *conn = data; |
20527
0034d7e89032
mostly done with soap level parsing, compiles
Ka-Hing Cheung <khc@hxbc.us>
parents:
20526
diff
changeset
|
399 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
|
400 |
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->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
|
402 |
20526
915e11fbaeb0
beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@hxbc.us>
parents:
diff
changeset
|
403 if (req) { |
915e11fbaeb0
beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@hxbc.us>
parents:
diff
changeset
|
404 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
|
405 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
|
406 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
|
407 } else if (conn->connected) { |
20526
915e11fbaeb0
beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@hxbc.us>
parents:
diff
changeset
|
408 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
|
409 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
|
410 GSList *iter; |
20529
1180920ffcec
handle unauthenticated soap connection
Ka-Hing Cheung <khc@hxbc.us>
parents:
20528
diff
changeset
|
411 char *authstr = NULL; |
20526
915e11fbaeb0
beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@hxbc.us>
parents:
diff
changeset
|
412 |
915e11fbaeb0
beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@hxbc.us>
parents:
diff
changeset
|
413 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
|
414 |
20528
06527cc0f79b
removes public handle to soap connection, instead a connection is looked up
Ka-Hing Cheung <khc@hxbc.us>
parents:
20527
diff
changeset
|
415 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
|
416 |
20529
1180920ffcec
handle unauthenticated soap connection
Ka-Hing Cheung <khc@hxbc.us>
parents:
20528
diff
changeset
|
417 if (conn->session->passport_info.mspauth) |
1180920ffcec
handle unauthenticated soap connection
Ka-Hing Cheung <khc@hxbc.us>
parents:
20528
diff
changeset
|
418 authstr = g_strdup_printf("Cookie: MSPAuth=%s\r\n", |
1180920ffcec
handle unauthenticated soap connection
Ka-Hing Cheung <khc@hxbc.us>
parents:
20528
diff
changeset
|
419 conn->session->passport_info.mspauth); |
1180920ffcec
handle unauthenticated soap connection
Ka-Hing Cheung <khc@hxbc.us>
parents:
20528
diff
changeset
|
420 |
1180920ffcec
handle unauthenticated soap connection
Ka-Hing Cheung <khc@hxbc.us>
parents:
20528
diff
changeset
|
421 |
20528
06527cc0f79b
removes public handle to soap connection, instead a connection is looked up
Ka-Hing Cheung <khc@hxbc.us>
parents:
20527
diff
changeset
|
422 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
|
423 "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
|
424 "SOAPAction: %s\r\n" |
915e11fbaeb0
beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@hxbc.us>
parents:
diff
changeset
|
425 "Content-Type:text/xml; charset=utf-8\r\n" |
20529
1180920ffcec
handle unauthenticated soap connection
Ka-Hing Cheung <khc@hxbc.us>
parents:
20528
diff
changeset
|
426 "%s" |
20526
915e11fbaeb0
beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@hxbc.us>
parents:
diff
changeset
|
427 "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
|
428 "Accept: */*\r\n" |
915e11fbaeb0
beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@hxbc.us>
parents:
diff
changeset
|
429 "Host: %s\r\n" |
915e11fbaeb0
beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@hxbc.us>
parents:
diff
changeset
|
430 "Content-Length: %d\r\n" |
915e11fbaeb0
beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@hxbc.us>
parents:
diff
changeset
|
431 "Connection: Keep-Alive\r\n" |
915e11fbaeb0
beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@hxbc.us>
parents:
diff
changeset
|
432 "Cache-Control: no-cache\r\n", |
20529
1180920ffcec
handle unauthenticated soap connection
Ka-Hing Cheung <khc@hxbc.us>
parents:
20528
diff
changeset
|
433 req->path, req->message->action ? req->message->action : "", |
1180920ffcec
handle unauthenticated soap connection
Ka-Hing Cheung <khc@hxbc.us>
parents:
20528
diff
changeset
|
434 authstr ? authstr : "", conn->host, len); |
20526
915e11fbaeb0
beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@hxbc.us>
parents:
diff
changeset
|
435 |
20527
0034d7e89032
mostly done with soap level parsing, compiles
Ka-Hing Cheung <khc@hxbc.us>
parents:
20526
diff
changeset
|
436 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
|
437 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
|
438 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
|
439 } |
915e11fbaeb0
beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@hxbc.us>
parents:
diff
changeset
|
440 |
20528
06527cc0f79b
removes public handle to soap connection, instead a connection is looked up
Ka-Hing Cheung <khc@hxbc.us>
parents:
20527
diff
changeset
|
441 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
|
442 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
|
443 |
20531 | 444 purple_debug_info("soap", "%s\n", conn->buf->str); |
445 | |
20528
06527cc0f79b
removes public handle to soap connection, instead a connection is looked up
Ka-Hing Cheung <khc@hxbc.us>
parents:
20527
diff
changeset
|
446 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
|
447 conn->current_request = req; |
20526
915e11fbaeb0
beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@hxbc.us>
parents:
diff
changeset
|
448 |
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 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
|
450 PURPLE_INPUT_WRITE, msn_soap_write_cb, conn); |
915e11fbaeb0
beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@hxbc.us>
parents:
diff
changeset
|
451 msn_soap_write_cb(conn, conn->ssl->fd, PURPLE_INPUT_WRITE); |
20529
1180920ffcec
handle unauthenticated soap connection
Ka-Hing Cheung <khc@hxbc.us>
parents:
20528
diff
changeset
|
452 |
1180920ffcec
handle unauthenticated soap connection
Ka-Hing Cheung <khc@hxbc.us>
parents:
20528
diff
changeset
|
453 g_free(authstr); |
20526
915e11fbaeb0
beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@hxbc.us>
parents:
diff
changeset
|
454 } |
915e11fbaeb0
beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@hxbc.us>
parents:
diff
changeset
|
455 } |
915e11fbaeb0
beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@hxbc.us>
parents:
diff
changeset
|
456 |
915e11fbaeb0
beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@hxbc.us>
parents:
diff
changeset
|
457 return FALSE; |
915e11fbaeb0
beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@hxbc.us>
parents:
diff
changeset
|
458 } |
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 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
|
461 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
|
462 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
|
463 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
|
464 { |
20528
06527cc0f79b
removes public handle to soap connection, instead a connection is looked up
Ka-Hing Cheung <khc@hxbc.us>
parents:
20527
diff
changeset
|
465 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
|
466 FALSE); |
06527cc0f79b
removes public handle to soap connection, instead a connection is looked up
Ka-Hing Cheung <khc@hxbc.us>
parents:
20527
diff
changeset
|
467 } |
06527cc0f79b
removes public handle to soap connection, instead a connection is looked up
Ka-Hing Cheung <khc@hxbc.us>
parents:
20527
diff
changeset
|
468 |
06527cc0f79b
removes public handle to soap connection, instead a connection is looked up
Ka-Hing Cheung <khc@hxbc.us>
parents:
20527
diff
changeset
|
469 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
|
470 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
|
471 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
|
472 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
|
473 { |
06527cc0f79b
removes public handle to soap connection, instead a connection is looked up
Ka-Hing Cheung <khc@hxbc.us>
parents:
20527
diff
changeset
|
474 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
|
475 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
|
476 |
06527cc0f79b
removes public handle to soap connection, instead a connection is looked up
Ka-Hing Cheung <khc@hxbc.us>
parents:
20527
diff
changeset
|
477 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
|
478 req->message = message; |
20526
915e11fbaeb0
beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@hxbc.us>
parents:
diff
changeset
|
479 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
|
480 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
|
481 |
20528
06527cc0f79b
removes public handle to soap connection, instead a connection is looked up
Ka-Hing Cheung <khc@hxbc.us>
parents:
20527
diff
changeset
|
482 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
|
483 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
|
484 } else { |
06527cc0f79b
removes public handle to soap connection, instead a connection is looked up
Ka-Hing Cheung <khc@hxbc.us>
parents:
20527
diff
changeset
|
485 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
|
486 } |
20526
915e11fbaeb0
beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@hxbc.us>
parents:
diff
changeset
|
487 |
20528
06527cc0f79b
removes public handle to soap connection, instead a connection is looked up
Ka-Hing Cheung <khc@hxbc.us>
parents:
20527
diff
changeset
|
488 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
|
489 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
|
490 conn); |
20526
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 |
915e11fbaeb0
beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@hxbc.us>
parents:
diff
changeset
|
493 static void |
20531 | 494 msn_soap_connection_sanitize(MsnSoapConnection *conn, gboolean disconnect) |
495 { | |
496 if (conn->event_handle) { | |
497 purple_input_remove(conn->event_handle); | |
498 conn->event_handle = 0; | |
499 } | |
500 | |
501 if (conn->message) { | |
502 msn_soap_message_destroy(conn->message); | |
503 conn->message = NULL; | |
504 } | |
505 | |
506 if (conn->buf) { | |
507 g_string_free(conn->buf, TRUE); | |
508 conn->buf = NULL; | |
509 } | |
510 | |
511 if (conn->ssl && (disconnect || conn->close_when_done)) { | |
512 purple_ssl_close(conn->ssl); | |
513 conn->ssl = NULL; | |
514 } | |
515 | |
516 if (conn->current_request) { | |
517 msn_soap_request_destroy(conn->current_request); | |
518 conn->current_request = NULL; | |
519 } | |
520 } | |
521 | |
522 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
|
523 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
|
524 { |
20531 | 525 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
|
526 |
06527cc0f79b
removes public handle to soap connection, instead a connection is looked up
Ka-Hing Cheung <khc@hxbc.us>
parents:
20527
diff
changeset
|
527 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
|
528 |
719ce4acfcb9
the new soap code finally doesn't crash on startup, still can't
Ka-Hing Cheung <khc@hxbc.us>
parents:
20529
diff
changeset
|
529 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
|
530 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
|
531 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
|
532 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
|
533 } |
20526
915e11fbaeb0
beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@hxbc.us>
parents:
diff
changeset
|
534 } |
915e11fbaeb0
beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@hxbc.us>
parents:
diff
changeset
|
535 |
915e11fbaeb0
beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@hxbc.us>
parents:
diff
changeset
|
536 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
|
537 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
|
538 { |
20528
06527cc0f79b
removes public handle to soap connection, instead a connection is looked up
Ka-Hing Cheung <khc@hxbc.us>
parents:
20527
diff
changeset
|
539 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
|
540 |
06527cc0f79b
removes public handle to soap connection, instead a connection is looked up
Ka-Hing Cheung <khc@hxbc.us>
parents:
20527
diff
changeset
|
541 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
|
542 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
|
543 |
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_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
|
545 } |
06527cc0f79b
removes public handle to soap connection, instead a connection is looked up
Ka-Hing Cheung <khc@hxbc.us>
parents:
20527
diff
changeset
|
546 |
06527cc0f79b
removes public handle to soap connection, instead a connection is looked up
Ka-Hing Cheung <khc@hxbc.us>
parents:
20527
diff
changeset
|
547 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
|
548 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
|
549 { |
06527cc0f79b
removes public handle to soap connection, instead a connection is looked up
Ka-Hing Cheung <khc@hxbc.us>
parents:
20527
diff
changeset
|
550 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
|
551 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
|
552 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
|
553 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
|
554 } |
915e11fbaeb0
beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@hxbc.us>
parents:
diff
changeset
|
555 |
20531 | 556 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
|
557 g_queue_foreach(conn->queue, msn_soap_connection_destroy_foreach_cb, conn); |
20531 | 558 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
|
559 |
20528
06527cc0f79b
removes public handle to soap connection, instead a connection is looked up
Ka-Hing Cheung <khc@hxbc.us>
parents:
20527
diff
changeset
|
560 g_free(conn->host); |
20526
915e11fbaeb0
beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@hxbc.us>
parents:
diff
changeset
|
561 g_free(conn); |
915e11fbaeb0
beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@hxbc.us>
parents:
diff
changeset
|
562 } |
915e11fbaeb0
beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@hxbc.us>
parents:
diff
changeset
|
563 |
915e11fbaeb0
beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@hxbc.us>
parents:
diff
changeset
|
564 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
|
565 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
|
566 { |
20528
06527cc0f79b
removes public handle to soap connection, instead a connection is looked up
Ka-Hing Cheung <khc@hxbc.us>
parents:
20527
diff
changeset
|
567 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
|
568 |
20528
06527cc0f79b
removes public handle to soap connection, instead a connection is looked up
Ka-Hing Cheung <khc@hxbc.us>
parents:
20527
diff
changeset
|
569 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
|
570 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
|
571 |
06527cc0f79b
removes public handle to soap connection, instead a connection is looked up
Ka-Hing Cheung <khc@hxbc.us>
parents:
20527
diff
changeset
|
572 return message; |
20526
915e11fbaeb0
beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@hxbc.us>
parents:
diff
changeset
|
573 } |
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 void |
20527
0034d7e89032
mostly done with soap level parsing, compiles
Ka-Hing Cheung <khc@hxbc.us>
parents:
20526
diff
changeset
|
576 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
|
577 { |
20528
06527cc0f79b
removes public handle to soap connection, instead a connection is looked up
Ka-Hing Cheung <khc@hxbc.us>
parents:
20527
diff
changeset
|
578 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
|
579 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
|
580 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
|
581 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
|
582 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
|
583 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
|
584 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
|
585 } |
20526
915e11fbaeb0
beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@hxbc.us>
parents:
diff
changeset
|
586 } |
915e11fbaeb0
beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@hxbc.us>
parents:
diff
changeset
|
587 |
915e11fbaeb0
beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@hxbc.us>
parents:
diff
changeset
|
588 void |
915e11fbaeb0
beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@hxbc.us>
parents:
diff
changeset
|
589 msn_soap_message_add_header(MsnSoapMessage *req, |
915e11fbaeb0
beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@hxbc.us>
parents:
diff
changeset
|
590 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
|
591 { |
915e11fbaeb0
beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@hxbc.us>
parents:
diff
changeset
|
592 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
|
593 |
915e11fbaeb0
beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@hxbc.us>
parents:
diff
changeset
|
594 req->headers = g_slist_prepend(req->headers, header); |
915e11fbaeb0
beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@hxbc.us>
parents:
diff
changeset
|
595 } |
20527
0034d7e89032
mostly done with soap level parsing, compiles
Ka-Hing Cheung <khc@hxbc.us>
parents:
20526
diff
changeset
|
596 |
20528
06527cc0f79b
removes public handle to soap connection, instead a connection is looked up
Ka-Hing Cheung <khc@hxbc.us>
parents:
20527
diff
changeset
|
597 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
|
598 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
|
599 { |
0034d7e89032
mostly done with soap level parsing, compiles
Ka-Hing Cheung <khc@hxbc.us>
parents:
20526
diff
changeset
|
600 g_free(req->path); |
0034d7e89032
mostly done with soap level parsing, compiles
Ka-Hing Cheung <khc@hxbc.us>
parents:
20526
diff
changeset
|
601 msn_soap_message_destroy(req->message); |
0034d7e89032
mostly done with soap level parsing, compiles
Ka-Hing Cheung <khc@hxbc.us>
parents:
20526
diff
changeset
|
602 g_free(req); |
0034d7e89032
mostly done with soap level parsing, compiles
Ka-Hing Cheung <khc@hxbc.us>
parents:
20526
diff
changeset
|
603 } |
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
|
604 |
719ce4acfcb9
the new soap code finally doesn't crash on startup, still can't
Ka-Hing Cheung <khc@hxbc.us>
parents:
20529
diff
changeset
|
605 xmlnode * |
719ce4acfcb9
the new soap code finally doesn't crash on startup, still can't
Ka-Hing Cheung <khc@hxbc.us>
parents:
20529
diff
changeset
|
606 msn_soap_xml_get(xmlnode *parent, const char *node) |
719ce4acfcb9
the new soap code finally doesn't crash on startup, still can't
Ka-Hing Cheung <khc@hxbc.us>
parents:
20529
diff
changeset
|
607 { |
719ce4acfcb9
the new soap code finally doesn't crash on startup, still can't
Ka-Hing Cheung <khc@hxbc.us>
parents:
20529
diff
changeset
|
608 xmlnode *ret; |
719ce4acfcb9
the new soap code finally doesn't crash on startup, still can't
Ka-Hing Cheung <khc@hxbc.us>
parents:
20529
diff
changeset
|
609 char **tokens = g_strsplit(node, "/", -1); |
719ce4acfcb9
the new soap code finally doesn't crash on startup, still can't
Ka-Hing Cheung <khc@hxbc.us>
parents:
20529
diff
changeset
|
610 int i; |
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 for (i = 0; tokens[i]; i++) { |
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 if ((ret = xmlnode_get_child(parent, tokens[i])) != 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
|
614 parent = ret; |
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 else |
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 break; |
719ce4acfcb9
the new soap code finally doesn't crash on startup, still can't
Ka-Hing Cheung <khc@hxbc.us>
parents:
20529
diff
changeset
|
617 } |
719ce4acfcb9
the new soap code finally doesn't crash on startup, still can't
Ka-Hing Cheung <khc@hxbc.us>
parents:
20529
diff
changeset
|
618 |
719ce4acfcb9
the new soap code finally doesn't crash on startup, still can't
Ka-Hing Cheung <khc@hxbc.us>
parents:
20529
diff
changeset
|
619 g_strfreev(tokens); |
719ce4acfcb9
the new soap code finally doesn't crash on startup, still can't
Ka-Hing Cheung <khc@hxbc.us>
parents:
20529
diff
changeset
|
620 return ret; |
719ce4acfcb9
the new soap code finally doesn't crash on startup, still can't
Ka-Hing Cheung <khc@hxbc.us>
parents:
20529
diff
changeset
|
621 } |
719ce4acfcb9
the new soap code finally doesn't crash on startup, still can't
Ka-Hing Cheung <khc@hxbc.us>
parents:
20529
diff
changeset
|
622 |