Mercurial > pidgin
annotate libpurple/protocols/msn/soap2.c @ 20528:06527cc0f79b
removes public handle to soap connection, instead a connection is looked up
from session
author | Ka-Hing Cheung <khc@hxbc.us> |
---|---|
date | Mon, 24 Sep 2007 05:29:07 +0000 |
parents | 0034d7e89032 |
children | 1180920ffcec |
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; |
06527cc0f79b
removes public handle to soap connection, instead a connection is looked up
Ka-Hing Cheung <khc@hxbc.us>
parents:
20527
diff
changeset
|
58 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
|
59 |
06527cc0f79b
removes public handle to soap connection, instead a connection is looked up
Ka-Hing Cheung <khc@hxbc.us>
parents:
20527
diff
changeset
|
60 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
|
61 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
|
62 } MsnSoapConnection; |
06527cc0f79b
removes public handle to soap connection, instead a connection is looked up
Ka-Hing Cheung <khc@hxbc.us>
parents:
20527
diff
changeset
|
63 |
06527cc0f79b
removes public handle to soap connection, instead a connection is looked up
Ka-Hing Cheung <khc@hxbc.us>
parents:
20527
diff
changeset
|
64 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
|
65 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
|
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 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
|
68 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
|
69 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
|
70 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
|
71 |
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_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
|
73 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
|
74 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
|
75 |
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_request_destroy(MsnSoapRequest *req); |
20526
915e11fbaeb0
beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@hxbc.us>
parents:
diff
changeset
|
77 |
915e11fbaeb0
beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@hxbc.us>
parents:
diff
changeset
|
78 |
20528
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 MsnSoapConnection * |
06527cc0f79b
removes public handle to soap connection, instead a connection is looked up
Ka-Hing Cheung <khc@hxbc.us>
parents:
20527
diff
changeset
|
80 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
|
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 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
|
83 |
06527cc0f79b
removes public handle to soap connection, instead a connection is looked up
Ka-Hing Cheung <khc@hxbc.us>
parents:
20527
diff
changeset
|
84 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
|
85 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
|
86 } else { |
06527cc0f79b
removes public handle to soap connection, instead a connection is looked up
Ka-Hing Cheung <khc@hxbc.us>
parents:
20527
diff
changeset
|
87 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
|
88 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
|
89 } |
06527cc0f79b
removes public handle to soap connection, instead a connection is looked up
Ka-Hing Cheung <khc@hxbc.us>
parents:
20527
diff
changeset
|
90 |
06527cc0f79b
removes public handle to soap connection, instead a connection is looked up
Ka-Hing Cheung <khc@hxbc.us>
parents:
20527
diff
changeset
|
91 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
|
92 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
|
93 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
|
94 } |
06527cc0f79b
removes public handle to soap connection, instead a connection is looked up
Ka-Hing Cheung <khc@hxbc.us>
parents:
20527
diff
changeset
|
95 |
06527cc0f79b
removes public handle to soap connection, instead a connection is looked up
Ka-Hing Cheung <khc@hxbc.us>
parents:
20527
diff
changeset
|
96 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
|
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 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
|
100 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
|
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 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
|
103 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
|
104 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
|
105 conn->queue = g_queue_new(); |
915e11fbaeb0
beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@hxbc.us>
parents:
diff
changeset
|
106 return conn; |
915e11fbaeb0
beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@hxbc.us>
parents:
diff
changeset
|
107 } |
915e11fbaeb0
beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@hxbc.us>
parents:
diff
changeset
|
108 |
915e11fbaeb0
beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@hxbc.us>
parents:
diff
changeset
|
109 static void |
915e11fbaeb0
beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@hxbc.us>
parents:
diff
changeset
|
110 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
|
111 PurpleInputCondition cond) |
915e11fbaeb0
beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@hxbc.us>
parents:
diff
changeset
|
112 { |
20528
06527cc0f79b
removes public handle to soap connection, instead a connection is looked up
Ka-Hing Cheung <khc@hxbc.us>
parents:
20527
diff
changeset
|
113 MsnSoapConnection *conn = data; |
20526
915e11fbaeb0
beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@hxbc.us>
parents:
diff
changeset
|
114 |
915e11fbaeb0
beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@hxbc.us>
parents:
diff
changeset
|
115 conn->connected = TRUE; |
915e11fbaeb0
beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@hxbc.us>
parents:
diff
changeset
|
116 |
20528
06527cc0f79b
removes public handle to soap connection, instead a connection is looked up
Ka-Hing Cheung <khc@hxbc.us>
parents:
20527
diff
changeset
|
117 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
|
118 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
|
119 } |
915e11fbaeb0
beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@hxbc.us>
parents:
diff
changeset
|
120 |
915e11fbaeb0
beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@hxbc.us>
parents:
diff
changeset
|
121 static void |
915e11fbaeb0
beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@hxbc.us>
parents:
diff
changeset
|
122 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
|
123 gpointer data) |
915e11fbaeb0
beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@hxbc.us>
parents:
diff
changeset
|
124 { |
20528
06527cc0f79b
removes public handle to soap connection, instead a connection is looked up
Ka-Hing Cheung <khc@hxbc.us>
parents:
20527
diff
changeset
|
125 MsnSoapConnection *conn = data; |
20526
915e11fbaeb0
beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@hxbc.us>
parents:
diff
changeset
|
126 |
20528
06527cc0f79b
removes public handle to soap connection, instead a connection is looked up
Ka-Hing Cheung <khc@hxbc.us>
parents:
20527
diff
changeset
|
127 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
|
128 } |
915e11fbaeb0
beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@hxbc.us>
parents:
diff
changeset
|
129 |
20527
0034d7e89032
mostly done with soap level parsing, compiles
Ka-Hing Cheung <khc@hxbc.us>
parents:
20526
diff
changeset
|
130 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
|
131 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
|
132 { |
0034d7e89032
mostly done with soap level parsing, compiles
Ka-Hing Cheung <khc@hxbc.us>
parents:
20526
diff
changeset
|
133 char *c; |
0034d7e89032
mostly done with soap level parsing, compiles
Ka-Hing Cheung <khc@hxbc.us>
parents:
20526
diff
changeset
|
134 |
0034d7e89032
mostly done with soap level parsing, compiles
Ka-Hing Cheung <khc@hxbc.us>
parents:
20526
diff
changeset
|
135 /* Skip the http:// */ |
0034d7e89032
mostly done with soap level parsing, compiles
Ka-Hing Cheung <khc@hxbc.us>
parents:
20526
diff
changeset
|
136 if ((c = strchr(url, '/')) != NULL) |
0034d7e89032
mostly done with soap level parsing, compiles
Ka-Hing Cheung <khc@hxbc.us>
parents:
20526
diff
changeset
|
137 url += 2; |
0034d7e89032
mostly done with soap level parsing, compiles
Ka-Hing Cheung <khc@hxbc.us>
parents:
20526
diff
changeset
|
138 |
0034d7e89032
mostly done with soap level parsing, compiles
Ka-Hing Cheung <khc@hxbc.us>
parents:
20526
diff
changeset
|
139 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
|
140 char *host, *path; |
20527
0034d7e89032
mostly done with soap level parsing, compiles
Ka-Hing Cheung <khc@hxbc.us>
parents:
20526
diff
changeset
|
141 |
20528
06527cc0f79b
removes public handle to soap connection, instead a connection is looked up
Ka-Hing Cheung <khc@hxbc.us>
parents:
20527
diff
changeset
|
142 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
|
143 path = g_strdup(c); |
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 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
|
146 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
|
147 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
|
148 |
20528
06527cc0f79b
removes public handle to soap connection, instead a connection is looked up
Ka-Hing Cheung <khc@hxbc.us>
parents:
20527
diff
changeset
|
149 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
|
150 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
|
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 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
|
153 g_free(path); |
20527
0034d7e89032
mostly done with soap level parsing, compiles
Ka-Hing Cheung <khc@hxbc.us>
parents:
20526
diff
changeset
|
154 |
0034d7e89032
mostly done with soap level parsing, compiles
Ka-Hing Cheung <khc@hxbc.us>
parents:
20526
diff
changeset
|
155 return TRUE; |
0034d7e89032
mostly done with soap level parsing, compiles
Ka-Hing Cheung <khc@hxbc.us>
parents:
20526
diff
changeset
|
156 } |
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 FALSE; |
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 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
|
162 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
|
163 { |
20528
06527cc0f79b
removes public handle to soap connection, instead a connection is looked up
Ka-Hing Cheung <khc@hxbc.us>
parents:
20527
diff
changeset
|
164 xmlnode *node = response->xml; |
20527
0034d7e89032
mostly done with soap level parsing, compiles
Ka-Hing Cheung <khc@hxbc.us>
parents:
20526
diff
changeset
|
165 |
0034d7e89032
mostly done with soap level parsing, compiles
Ka-Hing Cheung <khc@hxbc.us>
parents:
20526
diff
changeset
|
166 if (strcmp(node->name, "Envelop") == 0 && |
0034d7e89032
mostly done with soap level parsing, compiles
Ka-Hing Cheung <khc@hxbc.us>
parents:
20526
diff
changeset
|
167 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
|
168 node->child->next) { |
0034d7e89032
mostly done with soap level parsing, compiles
Ka-Hing Cheung <khc@hxbc.us>
parents:
20526
diff
changeset
|
169 xmlnode *body = node->child->next; |
0034d7e89032
mostly done with soap level parsing, compiles
Ka-Hing Cheung <khc@hxbc.us>
parents:
20526
diff
changeset
|
170 |
0034d7e89032
mostly done with soap level parsing, compiles
Ka-Hing Cheung <khc@hxbc.us>
parents:
20526
diff
changeset
|
171 if (strcmp(body->name, "Fault")) { |
0034d7e89032
mostly done with soap level parsing, compiles
Ka-Hing Cheung <khc@hxbc.us>
parents:
20526
diff
changeset
|
172 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
|
173 |
0034d7e89032
mostly done with soap level parsing, compiles
Ka-Hing Cheung <khc@hxbc.us>
parents:
20526
diff
changeset
|
174 if (fault != NULL) { |
0034d7e89032
mostly done with soap level parsing, compiles
Ka-Hing Cheung <khc@hxbc.us>
parents:
20526
diff
changeset
|
175 if (strcmp(fault->data, "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
|
176 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
|
177 |
20528
06527cc0f79b
removes public handle to soap connection, instead a connection is looked up
Ka-Hing Cheung <khc@hxbc.us>
parents:
20527
diff
changeset
|
178 if (url) { |
06527cc0f79b
removes public handle to soap connection, instead a connection is looked up
Ka-Hing Cheung <khc@hxbc.us>
parents:
20527
diff
changeset
|
179 msn_soap_handle_redirect(conn, url->data); |
20527
0034d7e89032
mostly done with soap level parsing, compiles
Ka-Hing Cheung <khc@hxbc.us>
parents:
20526
diff
changeset
|
180 } |
20528
06527cc0f79b
removes public handle to soap connection, instead a connection is looked up
Ka-Hing Cheung <khc@hxbc.us>
parents:
20527
diff
changeset
|
181 |
06527cc0f79b
removes public handle to soap connection, instead a connection is looked up
Ka-Hing Cheung <khc@hxbc.us>
parents:
20527
diff
changeset
|
182 return TRUE; |
20527
0034d7e89032
mostly done with soap level parsing, compiles
Ka-Hing Cheung <khc@hxbc.us>
parents:
20526
diff
changeset
|
183 } else if (strcmp(fault->data, "wsse:FailedAuthentication")) { |
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 xmlnode *reason = xmlnode_get_child(body, "faultstring"); |
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 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
|
187 reason ? reason->data : NULL); |
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 return FALSE; |
20527
0034d7e89032
mostly done with soap level parsing, compiles
Ka-Hing Cheung <khc@hxbc.us>
parents:
20526
diff
changeset
|
190 } |
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 |
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 conn->current_request->cb(conn->current_request->message, response, |
06527cc0f79b
removes public handle to soap connection, instead a connection is looked up
Ka-Hing Cheung <khc@hxbc.us>
parents:
20527
diff
changeset
|
194 conn->current_request->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
|
195 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
|
196 conn->current_request = NULL; |
20527
0034d7e89032
mostly done with soap level parsing, compiles
Ka-Hing Cheung <khc@hxbc.us>
parents:
20526
diff
changeset
|
197 } |
0034d7e89032
mostly done with soap level parsing, compiles
Ka-Hing Cheung <khc@hxbc.us>
parents:
20526
diff
changeset
|
198 } |
0034d7e89032
mostly done with soap level parsing, compiles
Ka-Hing Cheung <khc@hxbc.us>
parents:
20526
diff
changeset
|
199 |
20528
06527cc0f79b
removes public handle to soap connection, instead a connection is looked up
Ka-Hing Cheung <khc@hxbc.us>
parents:
20527
diff
changeset
|
200 return TRUE; |
20527
0034d7e89032
mostly done with soap level parsing, compiles
Ka-Hing Cheung <khc@hxbc.us>
parents:
20526
diff
changeset
|
201 } |
0034d7e89032
mostly done with soap level parsing, compiles
Ka-Hing Cheung <khc@hxbc.us>
parents:
20526
diff
changeset
|
202 |
20526
915e11fbaeb0
beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@hxbc.us>
parents:
diff
changeset
|
203 static void |
915e11fbaeb0
beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@hxbc.us>
parents:
diff
changeset
|
204 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
|
205 { |
20528
06527cc0f79b
removes public handle to soap connection, instead a connection is looked up
Ka-Hing Cheung <khc@hxbc.us>
parents:
20527
diff
changeset
|
206 MsnSoapConnection *conn = data; |
20526
915e11fbaeb0
beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@hxbc.us>
parents:
diff
changeset
|
207 int count; |
915e11fbaeb0
beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@hxbc.us>
parents:
diff
changeset
|
208 char buf[8192]; |
20527
0034d7e89032
mostly done with soap level parsing, compiles
Ka-Hing Cheung <khc@hxbc.us>
parents:
20526
diff
changeset
|
209 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
|
210 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
|
211 gboolean handled = FALSE; |
20526
915e11fbaeb0
beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@hxbc.us>
parents:
diff
changeset
|
212 |
915e11fbaeb0
beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@hxbc.us>
parents:
diff
changeset
|
213 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
|
214 |
915e11fbaeb0
beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@hxbc.us>
parents:
diff
changeset
|
215 count = purple_ssl_read(conn->ssl, buf, sizeof(buf)); |
915e11fbaeb0
beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@hxbc.us>
parents:
diff
changeset
|
216 if (count < 0 && errno == EAGAIN) |
915e11fbaeb0
beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@hxbc.us>
parents:
diff
changeset
|
217 return; |
915e11fbaeb0
beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@hxbc.us>
parents:
diff
changeset
|
218 else if (count <= 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
|
219 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
|
220 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
|
221 conn->ssl = NULL; |
20526
915e11fbaeb0
beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@hxbc.us>
parents:
diff
changeset
|
222 return; |
915e11fbaeb0
beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@hxbc.us>
parents:
diff
changeset
|
223 } |
915e11fbaeb0
beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@hxbc.us>
parents:
diff
changeset
|
224 |
20528
06527cc0f79b
removes public handle to soap connection, instead a connection is looked up
Ka-Hing Cheung <khc@hxbc.us>
parents:
20527
diff
changeset
|
225 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
|
226 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
|
227 } |
0034d7e89032
mostly done with soap level parsing, compiles
Ka-Hing Cheung <khc@hxbc.us>
parents:
20526
diff
changeset
|
228 |
20528
06527cc0f79b
removes public handle to soap connection, instead a connection is looked up
Ka-Hing Cheung <khc@hxbc.us>
parents:
20527
diff
changeset
|
229 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
|
230 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
|
231 } 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
|
232 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
|
233 } |
0034d7e89032
mostly done with soap level parsing, compiles
Ka-Hing Cheung <khc@hxbc.us>
parents:
20526
diff
changeset
|
234 |
20528
06527cc0f79b
removes public handle to soap connection, instead a connection is looked up
Ka-Hing Cheung <khc@hxbc.us>
parents:
20527
diff
changeset
|
235 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
|
236 |
06527cc0f79b
removes public handle to soap connection, instead a connection is looked up
Ka-Hing Cheung <khc@hxbc.us>
parents:
20527
diff
changeset
|
237 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
|
238 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
|
239 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
|
240 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
|
241 |
0034d7e89032
mostly done with soap level parsing, compiles
Ka-Hing Cheung <khc@hxbc.us>
parents:
20526
diff
changeset
|
242 if (node == NULL) { |
0034d7e89032
mostly done with soap level parsing, compiles
Ka-Hing Cheung <khc@hxbc.us>
parents:
20526
diff
changeset
|
243 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
|
244 cursor); |
20527
0034d7e89032
mostly done with soap level parsing, compiles
Ka-Hing Cheung <khc@hxbc.us>
parents:
20526
diff
changeset
|
245 } 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
|
246 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
|
247 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
|
248 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
|
249 |
06527cc0f79b
removes public handle to soap connection, instead a connection is looked up
Ka-Hing Cheung <khc@hxbc.us>
parents:
20527
diff
changeset
|
250 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
|
251 return; |
20527
0034d7e89032
mostly done with soap level parsing, compiles
Ka-Hing Cheung <khc@hxbc.us>
parents:
20526
diff
changeset
|
252 } |
20528
06527cc0f79b
removes public handle to soap connection, instead a connection is looked up
Ka-Hing Cheung <khc@hxbc.us>
parents:
20527
diff
changeset
|
253 |
06527cc0f79b
removes public handle to soap connection, instead a connection is looked up
Ka-Hing Cheung <khc@hxbc.us>
parents:
20527
diff
changeset
|
254 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
|
255 } |
0034d7e89032
mostly done with soap level parsing, compiles
Ka-Hing Cheung <khc@hxbc.us>
parents:
20526
diff
changeset
|
256 |
0034d7e89032
mostly done with soap level parsing, compiles
Ka-Hing Cheung <khc@hxbc.us>
parents:
20526
diff
changeset
|
257 return; |
20526
915e11fbaeb0
beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@hxbc.us>
parents:
diff
changeset
|
258 } |
915e11fbaeb0
beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@hxbc.us>
parents:
diff
changeset
|
259 |
20528
06527cc0f79b
removes public handle to soap connection, instead a connection is looked up
Ka-Hing Cheung <khc@hxbc.us>
parents:
20527
diff
changeset
|
260 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
|
261 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
|
262 |
20528
06527cc0f79b
removes public handle to soap connection, instead a connection is looked up
Ka-Hing Cheung <khc@hxbc.us>
parents:
20527
diff
changeset
|
263 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
|
264 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
|
265 /* 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
|
266 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
|
267 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
|
268 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
|
269 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
|
270 break; |
06527cc0f79b
removes public handle to soap connection, instead a connection is looked up
Ka-Hing Cheung <khc@hxbc.us>
parents:
20527
diff
changeset
|
271 } else if (conn->response_code == 503) { |
20527
0034d7e89032
mostly done with soap level parsing, compiles
Ka-Hing Cheung <khc@hxbc.us>
parents:
20526
diff
changeset
|
272 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
|
273 return; |
20527
0034d7e89032
mostly done with soap level parsing, compiles
Ka-Hing Cheung <khc@hxbc.us>
parents:
20526
diff
changeset
|
274 } |
20528
06527cc0f79b
removes public handle to soap connection, instead a connection is looked up
Ka-Hing Cheung <khc@hxbc.us>
parents:
20527
diff
changeset
|
275 } else if (cursor == linebreak) { |
20527
0034d7e89032
mostly done with soap level parsing, compiles
Ka-Hing Cheung <khc@hxbc.us>
parents:
20526
diff
changeset
|
276 /* 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
|
277 conn->headers_done = TRUE; |
20527
0034d7e89032
mostly done with soap level parsing, compiles
Ka-Hing Cheung <khc@hxbc.us>
parents:
20526
diff
changeset
|
278 } 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
|
279 char *sep = strstr(cursor, ": "); |
06527cc0f79b
removes public handle to soap connection, instead a connection is looked up
Ka-Hing Cheung <khc@hxbc.us>
parents:
20527
diff
changeset
|
280 char *key = cursor; |
20527
0034d7e89032
mostly done with soap level parsing, compiles
Ka-Hing Cheung <khc@hxbc.us>
parents:
20526
diff
changeset
|
281 char *value = sep + 2; |
20526
915e11fbaeb0
beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@hxbc.us>
parents:
diff
changeset
|
282 |
20527
0034d7e89032
mostly done with soap level parsing, compiles
Ka-Hing Cheung <khc@hxbc.us>
parents:
20526
diff
changeset
|
283 *sep = '\0'; |
0034d7e89032
mostly done with soap level parsing, compiles
Ka-Hing Cheung <khc@hxbc.us>
parents:
20526
diff
changeset
|
284 *linebreak = '\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
|
285 msn_soap_message_add_header(conn->message, key, value); |
20527
0034d7e89032
mostly done with soap level parsing, compiles
Ka-Hing Cheung <khc@hxbc.us>
parents:
20526
diff
changeset
|
286 |
20528
06527cc0f79b
removes public handle to soap connection, instead a connection is looked up
Ka-Hing Cheung <khc@hxbc.us>
parents:
20527
diff
changeset
|
287 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
|
288 && strcmp(key, "Location") == 0) { |
0034d7e89032
mostly done with soap level parsing, compiles
Ka-Hing Cheung <khc@hxbc.us>
parents:
20526
diff
changeset
|
289 |
20528
06527cc0f79b
removes public handle to soap connection, instead a connection is looked up
Ka-Hing Cheung <khc@hxbc.us>
parents:
20527
diff
changeset
|
290 if (!msn_soap_handle_redirect(conn, value) && |
06527cc0f79b
removes public handle to soap connection, instead a connection is looked up
Ka-Hing Cheung <khc@hxbc.us>
parents:
20527
diff
changeset
|
291 conn->current_request->cb) { |
06527cc0f79b
removes public handle to soap connection, instead a connection is looked up
Ka-Hing Cheung <khc@hxbc.us>
parents:
20527
diff
changeset
|
292 conn->current_request->cb(conn->current_request->message, |
06527cc0f79b
removes public handle to soap connection, instead a connection is looked up
Ka-Hing Cheung <khc@hxbc.us>
parents:
20527
diff
changeset
|
293 NULL, conn->current_request->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
|
294 } |
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 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
|
297 break; |
06527cc0f79b
removes public handle to soap connection, instead a connection is looked up
Ka-Hing Cheung <khc@hxbc.us>
parents:
20527
diff
changeset
|
298 } 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
|
299 strcmp(key, "WWW-Authenticate") == 0) { |
0034d7e89032
mostly done with soap level parsing, compiles
Ka-Hing Cheung <khc@hxbc.us>
parents:
20526
diff
changeset
|
300 char *error = strstr(value, "cbtxt="); |
0034d7e89032
mostly done with soap level parsing, compiles
Ka-Hing Cheung <khc@hxbc.us>
parents:
20526
diff
changeset
|
301 |
0034d7e89032
mostly done with soap level parsing, compiles
Ka-Hing Cheung <khc@hxbc.us>
parents:
20526
diff
changeset
|
302 if (error) { |
0034d7e89032
mostly done with soap level parsing, compiles
Ka-Hing Cheung <khc@hxbc.us>
parents:
20526
diff
changeset
|
303 error += strlen("cbtxt="); |
0034d7e89032
mostly done with soap level parsing, compiles
Ka-Hing Cheung <khc@hxbc.us>
parents:
20526
diff
changeset
|
304 } |
0034d7e89032
mostly done with soap level parsing, compiles
Ka-Hing Cheung <khc@hxbc.us>
parents:
20526
diff
changeset
|
305 |
0034d7e89032
mostly done with soap level parsing, compiles
Ka-Hing Cheung <khc@hxbc.us>
parents:
20526
diff
changeset
|
306 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
|
307 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
|
308 |
06527cc0f79b
removes public handle to soap connection, instead a connection is looked up
Ka-Hing Cheung <khc@hxbc.us>
parents:
20527
diff
changeset
|
309 return; |
20527
0034d7e89032
mostly done with soap level parsing, compiles
Ka-Hing Cheung <khc@hxbc.us>
parents:
20526
diff
changeset
|
310 } 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
|
311 conn->body_len = atoi(value); |
20527
0034d7e89032
mostly done with soap level parsing, compiles
Ka-Hing Cheung <khc@hxbc.us>
parents:
20526
diff
changeset
|
312 } |
0034d7e89032
mostly done with soap level parsing, compiles
Ka-Hing Cheung <khc@hxbc.us>
parents:
20526
diff
changeset
|
313 } |
20526
915e11fbaeb0
beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@hxbc.us>
parents:
diff
changeset
|
314 } |
20528
06527cc0f79b
removes public handle to soap connection, instead a connection is looked up
Ka-Hing Cheung <khc@hxbc.us>
parents:
20527
diff
changeset
|
315 |
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 (handled) { |
06527cc0f79b
removes public handle to soap connection, instead a connection is looked up
Ka-Hing Cheung <khc@hxbc.us>
parents:
20527
diff
changeset
|
317 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
|
318 } |
20526
915e11fbaeb0
beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@hxbc.us>
parents:
diff
changeset
|
319 } |
915e11fbaeb0
beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@hxbc.us>
parents:
diff
changeset
|
320 |
915e11fbaeb0
beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@hxbc.us>
parents:
diff
changeset
|
321 static void |
915e11fbaeb0
beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@hxbc.us>
parents:
diff
changeset
|
322 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
|
323 { |
20528
06527cc0f79b
removes public handle to soap connection, instead a connection is looked up
Ka-Hing Cheung <khc@hxbc.us>
parents:
20527
diff
changeset
|
324 MsnSoapConnection *conn = data; |
20526
915e11fbaeb0
beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@hxbc.us>
parents:
diff
changeset
|
325 int written; |
915e11fbaeb0
beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@hxbc.us>
parents:
diff
changeset
|
326 |
915e11fbaeb0
beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@hxbc.us>
parents:
diff
changeset
|
327 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
|
328 |
20528
06527cc0f79b
removes public handle to soap connection, instead a connection is looked up
Ka-Hing Cheung <khc@hxbc.us>
parents:
20527
diff
changeset
|
329 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
|
330 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
|
331 |
915e11fbaeb0
beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@hxbc.us>
parents:
diff
changeset
|
332 if (written < 0 && errno == EAGAIN) |
915e11fbaeb0
beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@hxbc.us>
parents:
diff
changeset
|
333 return; |
915e11fbaeb0
beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@hxbc.us>
parents:
diff
changeset
|
334 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
|
335 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
|
336 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
|
337 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
|
338 return; |
915e11fbaeb0
beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@hxbc.us>
parents:
diff
changeset
|
339 } |
915e11fbaeb0
beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@hxbc.us>
parents:
diff
changeset
|
340 |
20528
06527cc0f79b
removes public handle to soap connection, instead a connection is looked up
Ka-Hing Cheung <khc@hxbc.us>
parents:
20527
diff
changeset
|
341 conn->handled_len += written; |
20526
915e11fbaeb0
beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@hxbc.us>
parents:
diff
changeset
|
342 |
20528
06527cc0f79b
removes public handle to soap connection, instead a connection is looked up
Ka-Hing Cheung <khc@hxbc.us>
parents:
20527
diff
changeset
|
343 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
|
344 return; |
915e11fbaeb0
beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@hxbc.us>
parents:
diff
changeset
|
345 |
915e11fbaeb0
beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@hxbc.us>
parents:
diff
changeset
|
346 /* we are done! */ |
20528
06527cc0f79b
removes public handle to soap connection, instead a connection is looked up
Ka-Hing Cheung <khc@hxbc.us>
parents:
20527
diff
changeset
|
347 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
|
348 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
|
349 msn_soap_read_cb, conn); |
915e11fbaeb0
beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@hxbc.us>
parents:
diff
changeset
|
350 } |
915e11fbaeb0
beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@hxbc.us>
parents:
diff
changeset
|
351 |
915e11fbaeb0
beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@hxbc.us>
parents:
diff
changeset
|
352 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
|
353 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
|
354 { |
20528
06527cc0f79b
removes public handle to soap connection, instead a connection is looked up
Ka-Hing Cheung <khc@hxbc.us>
parents:
20527
diff
changeset
|
355 MsnSoapConnection *conn = data; |
20527
0034d7e89032
mostly done with soap level parsing, compiles
Ka-Hing Cheung <khc@hxbc.us>
parents:
20526
diff
changeset
|
356 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
|
357 |
20528
06527cc0f79b
removes public handle to soap connection, instead a connection is looked up
Ka-Hing Cheung <khc@hxbc.us>
parents:
20527
diff
changeset
|
358 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
|
359 |
20526
915e11fbaeb0
beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@hxbc.us>
parents:
diff
changeset
|
360 if (req) { |
915e11fbaeb0
beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@hxbc.us>
parents:
diff
changeset
|
361 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
|
362 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
|
363 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
|
364 } else if (conn->connected) { |
20526
915e11fbaeb0
beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@hxbc.us>
parents:
diff
changeset
|
365 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
|
366 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
|
367 GSList *iter; |
915e11fbaeb0
beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@hxbc.us>
parents:
diff
changeset
|
368 |
915e11fbaeb0
beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@hxbc.us>
parents:
diff
changeset
|
369 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
|
370 |
20528
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->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
|
372 |
06527cc0f79b
removes public handle to soap connection, instead a connection is looked up
Ka-Hing Cheung <khc@hxbc.us>
parents:
20527
diff
changeset
|
373 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
|
374 "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
|
375 "SOAPAction: %s\r\n" |
915e11fbaeb0
beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@hxbc.us>
parents:
diff
changeset
|
376 "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
|
377 "Cookie: MSPAuth=%s\r\n" |
915e11fbaeb0
beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@hxbc.us>
parents:
diff
changeset
|
378 "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
|
379 "Accept: */*\r\n" |
915e11fbaeb0
beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@hxbc.us>
parents:
diff
changeset
|
380 "Host: %s\r\n" |
915e11fbaeb0
beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@hxbc.us>
parents:
diff
changeset
|
381 "Content-Length: %d\r\n" |
915e11fbaeb0
beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@hxbc.us>
parents:
diff
changeset
|
382 "Connection: Keep-Alive\r\n" |
915e11fbaeb0
beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@hxbc.us>
parents:
diff
changeset
|
383 "Cache-Control: no-cache\r\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
|
384 req->path, req->message->action, |
20526
915e11fbaeb0
beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@hxbc.us>
parents:
diff
changeset
|
385 conn->session->passport_info.mspauth, |
20528
06527cc0f79b
removes public handle to soap connection, instead a connection is looked up
Ka-Hing Cheung <khc@hxbc.us>
parents:
20527
diff
changeset
|
386 conn->host, len); |
20526
915e11fbaeb0
beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@hxbc.us>
parents:
diff
changeset
|
387 |
20527
0034d7e89032
mostly done with soap level parsing, compiles
Ka-Hing Cheung <khc@hxbc.us>
parents:
20526
diff
changeset
|
388 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
|
389 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
|
390 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
|
391 } |
915e11fbaeb0
beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@hxbc.us>
parents:
diff
changeset
|
392 |
20528
06527cc0f79b
removes public handle to soap connection, instead a connection is looked up
Ka-Hing Cheung <khc@hxbc.us>
parents:
20527
diff
changeset
|
393 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
|
394 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
|
395 |
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 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
|
397 conn->current_request = req; |
20526
915e11fbaeb0
beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@hxbc.us>
parents:
diff
changeset
|
398 |
20528
06527cc0f79b
removes public handle to soap connection, instead a connection is looked up
Ka-Hing Cheung <khc@hxbc.us>
parents:
20527
diff
changeset
|
399 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
|
400 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
|
401 msn_soap_write_cb(conn, conn->ssl->fd, PURPLE_INPUT_WRITE); |
915e11fbaeb0
beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@hxbc.us>
parents:
diff
changeset
|
402 } |
915e11fbaeb0
beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@hxbc.us>
parents:
diff
changeset
|
403 } |
915e11fbaeb0
beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@hxbc.us>
parents:
diff
changeset
|
404 |
915e11fbaeb0
beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@hxbc.us>
parents:
diff
changeset
|
405 return FALSE; |
915e11fbaeb0
beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@hxbc.us>
parents:
diff
changeset
|
406 } |
915e11fbaeb0
beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@hxbc.us>
parents:
diff
changeset
|
407 |
915e11fbaeb0
beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@hxbc.us>
parents:
diff
changeset
|
408 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
|
409 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
|
410 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
|
411 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
|
412 { |
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 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
|
414 FALSE); |
06527cc0f79b
removes public handle to soap connection, instead a connection is looked up
Ka-Hing Cheung <khc@hxbc.us>
parents:
20527
diff
changeset
|
415 } |
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 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
|
418 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
|
419 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
|
420 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
|
421 { |
06527cc0f79b
removes public handle to soap connection, instead a connection is looked up
Ka-Hing Cheung <khc@hxbc.us>
parents:
20527
diff
changeset
|
422 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
|
423 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
|
424 |
06527cc0f79b
removes public handle to soap connection, instead a connection is looked up
Ka-Hing Cheung <khc@hxbc.us>
parents:
20527
diff
changeset
|
425 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
|
426 req->message = message; |
20526
915e11fbaeb0
beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@hxbc.us>
parents:
diff
changeset
|
427 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
|
428 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
|
429 |
20528
06527cc0f79b
removes public handle to soap connection, instead a connection is looked up
Ka-Hing Cheung <khc@hxbc.us>
parents:
20527
diff
changeset
|
430 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
|
431 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
|
432 } else { |
06527cc0f79b
removes public handle to soap connection, instead a connection is looked up
Ka-Hing Cheung <khc@hxbc.us>
parents:
20527
diff
changeset
|
433 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
|
434 } |
20526
915e11fbaeb0
beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@hxbc.us>
parents:
diff
changeset
|
435 |
20528
06527cc0f79b
removes public handle to soap connection, instead a connection is looked up
Ka-Hing Cheung <khc@hxbc.us>
parents:
20527
diff
changeset
|
436 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
|
437 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
|
438 conn); |
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 |
915e11fbaeb0
beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@hxbc.us>
parents:
diff
changeset
|
441 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
|
442 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
|
443 { |
20528
06527cc0f79b
removes public handle to soap connection, instead a connection is looked up
Ka-Hing Cheung <khc@hxbc.us>
parents:
20527
diff
changeset
|
444 if (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
|
445 msn_soap_connection_destroy_foreach_cb(conn->current_request, conn); |
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->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
|
447 } |
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 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
|
450 conn->event_handle = 0; |
20526
915e11fbaeb0
beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@hxbc.us>
parents:
diff
changeset
|
451 |
20528
06527cc0f79b
removes public handle to soap connection, instead a connection is looked up
Ka-Hing Cheung <khc@hxbc.us>
parents:
20527
diff
changeset
|
452 msn_soap_message_destroy(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
|
453 g_string_free(conn->buf, TRUE); |
06527cc0f79b
removes public handle to soap connection, instead a connection is looked up
Ka-Hing Cheung <khc@hxbc.us>
parents:
20527
diff
changeset
|
454 |
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->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
|
456 } |
915e11fbaeb0
beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@hxbc.us>
parents:
diff
changeset
|
457 |
915e11fbaeb0
beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@hxbc.us>
parents:
diff
changeset
|
458 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
|
459 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
|
460 { |
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 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
|
462 |
06527cc0f79b
removes public handle to soap connection, instead a connection is looked up
Ka-Hing Cheung <khc@hxbc.us>
parents:
20527
diff
changeset
|
463 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
|
464 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
|
465 |
06527cc0f79b
removes public handle to soap connection, instead a connection is looked up
Ka-Hing Cheung <khc@hxbc.us>
parents:
20527
diff
changeset
|
466 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
|
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_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
|
471 { |
06527cc0f79b
removes public handle to soap connection, instead a connection is looked up
Ka-Hing Cheung <khc@hxbc.us>
parents:
20527
diff
changeset
|
472 if (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
|
473 msn_soap_connection_destroy_foreach_cb(conn->current_request, conn); |
06527cc0f79b
removes public handle to soap connection, instead a connection is looked up
Ka-Hing Cheung <khc@hxbc.us>
parents:
20527
diff
changeset
|
474 conn->current_request = NULL; |
20526
915e11fbaeb0
beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@hxbc.us>
parents:
diff
changeset
|
475 } |
915e11fbaeb0
beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@hxbc.us>
parents:
diff
changeset
|
476 |
20528
06527cc0f79b
removes public handle to soap connection, instead a connection is looked up
Ka-Hing Cheung <khc@hxbc.us>
parents:
20527
diff
changeset
|
477 g_queue_foreach(conn->queue, msn_soap_connection_destroy_foreach_cb, conn); |
06527cc0f79b
removes public handle to soap connection, instead a connection is looked up
Ka-Hing Cheung <khc@hxbc.us>
parents:
20527
diff
changeset
|
478 |
06527cc0f79b
removes public handle to soap connection, instead a connection is looked up
Ka-Hing Cheung <khc@hxbc.us>
parents:
20527
diff
changeset
|
479 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
|
480 conn->event_handle = 0; |
20526
915e11fbaeb0
beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@hxbc.us>
parents:
diff
changeset
|
481 |
915e11fbaeb0
beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@hxbc.us>
parents:
diff
changeset
|
482 if (conn->ssl) { |
915e11fbaeb0
beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@hxbc.us>
parents:
diff
changeset
|
483 purple_ssl_close(conn->ssl); |
915e11fbaeb0
beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@hxbc.us>
parents:
diff
changeset
|
484 conn->ssl = NULL; |
915e11fbaeb0
beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@hxbc.us>
parents:
diff
changeset
|
485 } |
915e11fbaeb0
beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@hxbc.us>
parents:
diff
changeset
|
486 |
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 msn_soap_message_destroy(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
|
488 g_string_free(conn->buf, TRUE); |
06527cc0f79b
removes public handle to soap connection, instead a connection is looked up
Ka-Hing Cheung <khc@hxbc.us>
parents:
20527
diff
changeset
|
489 g_free(conn->host); |
20526
915e11fbaeb0
beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@hxbc.us>
parents:
diff
changeset
|
490 g_queue_free(conn->queue); |
915e11fbaeb0
beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@hxbc.us>
parents:
diff
changeset
|
491 g_free(conn); |
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 |
915e11fbaeb0
beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@hxbc.us>
parents:
diff
changeset
|
494 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
|
495 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
|
496 { |
20528
06527cc0f79b
removes public handle to soap connection, instead a connection is looked up
Ka-Hing Cheung <khc@hxbc.us>
parents:
20527
diff
changeset
|
497 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
|
498 |
20528
06527cc0f79b
removes public handle to soap connection, instead a connection is looked up
Ka-Hing Cheung <khc@hxbc.us>
parents:
20527
diff
changeset
|
499 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
|
500 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
|
501 |
06527cc0f79b
removes public handle to soap connection, instead a connection is looked up
Ka-Hing Cheung <khc@hxbc.us>
parents:
20527
diff
changeset
|
502 return message; |
20526
915e11fbaeb0
beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@hxbc.us>
parents:
diff
changeset
|
503 } |
915e11fbaeb0
beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@hxbc.us>
parents:
diff
changeset
|
504 |
915e11fbaeb0
beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@hxbc.us>
parents:
diff
changeset
|
505 void |
20527
0034d7e89032
mostly done with soap level parsing, compiles
Ka-Hing Cheung <khc@hxbc.us>
parents:
20526
diff
changeset
|
506 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
|
507 { |
20528
06527cc0f79b
removes public handle to soap connection, instead a connection is looked up
Ka-Hing Cheung <khc@hxbc.us>
parents:
20527
diff
changeset
|
508 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
|
509 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
|
510 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
|
511 g_free(message->action); |
06527cc0f79b
removes public handle to soap connection, instead a connection is looked up
Ka-Hing Cheung <khc@hxbc.us>
parents:
20527
diff
changeset
|
512 xmlnode_free(message->xml); |
06527cc0f79b
removes public handle to soap connection, instead a connection is looked up
Ka-Hing Cheung <khc@hxbc.us>
parents:
20527
diff
changeset
|
513 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
|
514 } |
20526
915e11fbaeb0
beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@hxbc.us>
parents:
diff
changeset
|
515 } |
915e11fbaeb0
beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@hxbc.us>
parents:
diff
changeset
|
516 |
915e11fbaeb0
beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@hxbc.us>
parents:
diff
changeset
|
517 void |
915e11fbaeb0
beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@hxbc.us>
parents:
diff
changeset
|
518 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
|
519 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
|
520 { |
915e11fbaeb0
beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@hxbc.us>
parents:
diff
changeset
|
521 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
|
522 |
915e11fbaeb0
beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@hxbc.us>
parents:
diff
changeset
|
523 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
|
524 } |
20527
0034d7e89032
mostly done with soap level parsing, compiles
Ka-Hing Cheung <khc@hxbc.us>
parents:
20526
diff
changeset
|
525 |
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 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
|
527 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
|
528 { |
0034d7e89032
mostly done with soap level parsing, compiles
Ka-Hing Cheung <khc@hxbc.us>
parents:
20526
diff
changeset
|
529 g_free(req->path); |
0034d7e89032
mostly done with soap level parsing, compiles
Ka-Hing Cheung <khc@hxbc.us>
parents:
20526
diff
changeset
|
530 msn_soap_message_destroy(req->message); |
0034d7e89032
mostly done with soap level parsing, compiles
Ka-Hing Cheung <khc@hxbc.us>
parents:
20526
diff
changeset
|
531 g_free(req); |
0034d7e89032
mostly done with soap level parsing, compiles
Ka-Hing Cheung <khc@hxbc.us>
parents:
20526
diff
changeset
|
532 } |