Mercurial > pidgin.yaz
annotate libpurple/protocols/msn/soap2.c @ 20526:915e11fbaeb0
beginning of soap layer rewrite, does that even compile?
author | Ka-Hing Cheung <khc@hxbc.us> |
---|---|
date | Wed, 19 Sep 2007 06:20:08 +0000 |
parents | |
children | 0034d7e89032 |
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 |
915e11fbaeb0
beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@hxbc.us>
parents:
diff
changeset
|
28 #include "xmlnode.h" |
915e11fbaeb0
beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@hxbc.us>
parents:
diff
changeset
|
29 |
915e11fbaeb0
beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@hxbc.us>
parents:
diff
changeset
|
30 #include <glib.h> |
915e11fbaeb0
beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@hxbc.us>
parents:
diff
changeset
|
31 #include <error.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 static void msn_soap_connection2_destroy_foreach_cb(gpointer item, gpointer data); |
915e11fbaeb0
beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@hxbc.us>
parents:
diff
changeset
|
34 static void msn_soap_connection2_cleanup(MsnSoapConnection2 *conn); |
915e11fbaeb0
beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@hxbc.us>
parents:
diff
changeset
|
35 static gboolean msn_soap_connection2_run(gpointer data); |
915e11fbaeb0
beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@hxbc.us>
parents:
diff
changeset
|
36 |
915e11fbaeb0
beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@hxbc.us>
parents:
diff
changeset
|
37 |
915e11fbaeb0
beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@hxbc.us>
parents:
diff
changeset
|
38 MsnSoapConnection2 * |
915e11fbaeb0
beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@hxbc.us>
parents:
diff
changeset
|
39 msn_soap_connection2_new(MsnSession *session) |
915e11fbaeb0
beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@hxbc.us>
parents:
diff
changeset
|
40 { |
915e11fbaeb0
beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@hxbc.us>
parents:
diff
changeset
|
41 MsnSoapConnection2 *conn = g_new0(MsnSoapConnection2, 1); |
915e11fbaeb0
beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@hxbc.us>
parents:
diff
changeset
|
42 conn->session = session; |
915e11fbaeb0
beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@hxbc.us>
parents:
diff
changeset
|
43 conn->queue = g_queue_new(); |
915e11fbaeb0
beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@hxbc.us>
parents:
diff
changeset
|
44 return conn; |
915e11fbaeb0
beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@hxbc.us>
parents:
diff
changeset
|
45 } |
915e11fbaeb0
beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@hxbc.us>
parents:
diff
changeset
|
46 |
915e11fbaeb0
beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@hxbc.us>
parents:
diff
changeset
|
47 static void |
915e11fbaeb0
beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@hxbc.us>
parents:
diff
changeset
|
48 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
|
49 PurpleInputCondition cond) |
915e11fbaeb0
beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@hxbc.us>
parents:
diff
changeset
|
50 { |
915e11fbaeb0
beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@hxbc.us>
parents:
diff
changeset
|
51 MsnSoapConnection2 *conn = data; |
915e11fbaeb0
beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@hxbc.us>
parents:
diff
changeset
|
52 |
915e11fbaeb0
beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@hxbc.us>
parents:
diff
changeset
|
53 conn->connected = TRUE; |
915e11fbaeb0
beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@hxbc.us>
parents:
diff
changeset
|
54 |
915e11fbaeb0
beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@hxbc.us>
parents:
diff
changeset
|
55 if (conn->idle_handle == 0) |
915e11fbaeb0
beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@hxbc.us>
parents:
diff
changeset
|
56 conn->idle_handle = g_idle_add(msn_soap_connection2_run, conn); |
915e11fbaeb0
beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@hxbc.us>
parents:
diff
changeset
|
57 } |
915e11fbaeb0
beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@hxbc.us>
parents:
diff
changeset
|
58 |
915e11fbaeb0
beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@hxbc.us>
parents:
diff
changeset
|
59 static void |
915e11fbaeb0
beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@hxbc.us>
parents:
diff
changeset
|
60 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
|
61 gpointer data) |
915e11fbaeb0
beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@hxbc.us>
parents:
diff
changeset
|
62 { |
915e11fbaeb0
beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@hxbc.us>
parents:
diff
changeset
|
63 MsnSoapConnection2 *conn = data; |
915e11fbaeb0
beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@hxbc.us>
parents:
diff
changeset
|
64 |
915e11fbaeb0
beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@hxbc.us>
parents:
diff
changeset
|
65 msn_soap_connection2_cleanup(conn); |
915e11fbaeb0
beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@hxbc.us>
parents:
diff
changeset
|
66 } |
915e11fbaeb0
beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@hxbc.us>
parents:
diff
changeset
|
67 |
915e11fbaeb0
beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@hxbc.us>
parents:
diff
changeset
|
68 static void |
915e11fbaeb0
beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@hxbc.us>
parents:
diff
changeset
|
69 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
|
70 { |
915e11fbaeb0
beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@hxbc.us>
parents:
diff
changeset
|
71 MsnSoapConnection2 *conn = data; |
915e11fbaeb0
beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@hxbc.us>
parents:
diff
changeset
|
72 int count; |
915e11fbaeb0
beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@hxbc.us>
parents:
diff
changeset
|
73 char buf[8192]; |
915e11fbaeb0
beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@hxbc.us>
parents:
diff
changeset
|
74 int linebreak; |
915e11fbaeb0
beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@hxbc.us>
parents:
diff
changeset
|
75 |
915e11fbaeb0
beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@hxbc.us>
parents:
diff
changeset
|
76 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
|
77 |
915e11fbaeb0
beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@hxbc.us>
parents:
diff
changeset
|
78 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
|
79 if (count < 0 && errno == EAGAIN) |
915e11fbaeb0
beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@hxbc.us>
parents:
diff
changeset
|
80 return; |
915e11fbaeb0
beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@hxbc.us>
parents:
diff
changeset
|
81 else if (count <= 0) { |
915e11fbaeb0
beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@hxbc.us>
parents:
diff
changeset
|
82 msn_soap_connection2_cleanup(conn); |
915e11fbaeb0
beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@hxbc.us>
parents:
diff
changeset
|
83 return; |
915e11fbaeb0
beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@hxbc.us>
parents:
diff
changeset
|
84 } |
915e11fbaeb0
beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@hxbc.us>
parents:
diff
changeset
|
85 |
915e11fbaeb0
beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@hxbc.us>
parents:
diff
changeset
|
86 if (conn->buf == NULL) { |
915e11fbaeb0
beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@hxbc.us>
parents:
diff
changeset
|
87 conn->buf = g_memdup(buf, count); |
915e11fbaeb0
beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@hxbc.us>
parents:
diff
changeset
|
88 conn->buf_len = len; |
915e11fbaeb0
beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@hxbc.us>
parents:
diff
changeset
|
89 } else { |
915e11fbaeb0
beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@hxbc.us>
parents:
diff
changeset
|
90 conn->buf = g_realloc(conn->buf, conn->buf_len + count); |
915e11fbaeb0
beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@hxbc.us>
parents:
diff
changeset
|
91 memcpy(conn->buf + conn->buf_len, buf, count); |
915e11fbaeb0
beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@hxbc.us>
parents:
diff
changeset
|
92 conn->buf_len += count; |
915e11fbaeb0
beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@hxbc.us>
parents:
diff
changeset
|
93 } |
915e11fbaeb0
beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@hxbc.us>
parents:
diff
changeset
|
94 |
915e11fbaeb0
beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@hxbc.us>
parents:
diff
changeset
|
95 if (conn->response == NULL) { |
915e11fbaeb0
beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@hxbc.us>
parents:
diff
changeset
|
96 conn->response = msn_soap_message_new(conn->current->action, NULL); |
915e11fbaeb0
beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@hxbc.us>
parents:
diff
changeset
|
97 } |
915e11fbaeb0
beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@hxbc.us>
parents:
diff
changeset
|
98 |
915e11fbaeb0
beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@hxbc.us>
parents:
diff
changeset
|
99 while ((linebreak = strstr(conn->buf + conn->buf_count, "\r\n")) != NULL) { |
915e11fbaeb0
beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@hxbc.us>
parents:
diff
changeset
|
100 |
915e11fbaeb0
beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@hxbc.us>
parents:
diff
changeset
|
101 } |
915e11fbaeb0
beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@hxbc.us>
parents:
diff
changeset
|
102 } |
915e11fbaeb0
beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@hxbc.us>
parents:
diff
changeset
|
103 |
915e11fbaeb0
beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@hxbc.us>
parents:
diff
changeset
|
104 static void |
915e11fbaeb0
beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@hxbc.us>
parents:
diff
changeset
|
105 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
|
106 { |
915e11fbaeb0
beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@hxbc.us>
parents:
diff
changeset
|
107 MsnSoapConnection2 *conn = data; |
915e11fbaeb0
beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@hxbc.us>
parents:
diff
changeset
|
108 int written; |
915e11fbaeb0
beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@hxbc.us>
parents:
diff
changeset
|
109 |
915e11fbaeb0
beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@hxbc.us>
parents:
diff
changeset
|
110 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
|
111 |
915e11fbaeb0
beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@hxbc.us>
parents:
diff
changeset
|
112 written = purple_ssl_write(conn->ssl, conn->buf + conn->buf_count, |
915e11fbaeb0
beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@hxbc.us>
parents:
diff
changeset
|
113 conn->buf_len - conn->buf_count); |
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 if (written < 0 && errno == EAGAIN) |
915e11fbaeb0
beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@hxbc.us>
parents:
diff
changeset
|
116 return; |
915e11fbaeb0
beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@hxbc.us>
parents:
diff
changeset
|
117 else if (written <= 0) { |
915e11fbaeb0
beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@hxbc.us>
parents:
diff
changeset
|
118 msn_soap_connection2_cleanup(conn); |
915e11fbaeb0
beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@hxbc.us>
parents:
diff
changeset
|
119 return; |
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 |
915e11fbaeb0
beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@hxbc.us>
parents:
diff
changeset
|
122 conn->buf_count += written; |
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 if (conn->buf_count < conn->buf_len) |
915e11fbaeb0
beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@hxbc.us>
parents:
diff
changeset
|
125 return; |
915e11fbaeb0
beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@hxbc.us>
parents:
diff
changeset
|
126 |
915e11fbaeb0
beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@hxbc.us>
parents:
diff
changeset
|
127 /* we are done! */ |
915e11fbaeb0
beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@hxbc.us>
parents:
diff
changeset
|
128 g_free(conn->buf); |
915e11fbaeb0
beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@hxbc.us>
parents:
diff
changeset
|
129 conn->buf_len = 0; |
915e11fbaeb0
beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@hxbc.us>
parents:
diff
changeset
|
130 conn->buf_count = 0; |
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 purple_input_remove(conn->io_handle); |
915e11fbaeb0
beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@hxbc.us>
parents:
diff
changeset
|
133 conn->io_handle = purple_input_add(conn->ssl->fd, PURPLE_INPUT_READ, |
915e11fbaeb0
beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@hxbc.us>
parents:
diff
changeset
|
134 msn_soap_read_cb, conn); |
915e11fbaeb0
beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@hxbc.us>
parents:
diff
changeset
|
135 } |
915e11fbaeb0
beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@hxbc.us>
parents:
diff
changeset
|
136 |
915e11fbaeb0
beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@hxbc.us>
parents:
diff
changeset
|
137 static gboolean |
915e11fbaeb0
beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@hxbc.us>
parents:
diff
changeset
|
138 msn_soap_connection2_run(gpointer data) |
915e11fbaeb0
beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@hxbc.us>
parents:
diff
changeset
|
139 { |
915e11fbaeb0
beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@hxbc.us>
parents:
diff
changeset
|
140 MsnSoapConnection2 *conn = data; |
915e11fbaeb0
beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@hxbc.us>
parents:
diff
changeset
|
141 MsnSoapMessage *req = g_queue_peek_head(conn->queue); |
915e11fbaeb0
beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@hxbc.us>
parents:
diff
changeset
|
142 |
915e11fbaeb0
beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@hxbc.us>
parents:
diff
changeset
|
143 if (req) { |
915e11fbaeb0
beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@hxbc.us>
parents:
diff
changeset
|
144 if (conn->ssl) { |
915e11fbaeb0
beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@hxbc.us>
parents:
diff
changeset
|
145 if (strcmp(conn->ssl->host, req->host) != 0 || |
915e11fbaeb0
beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@hxbc.us>
parents:
diff
changeset
|
146 strcmp(conn->path, req->path) != 0) { |
915e11fbaeb0
beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@hxbc.us>
parents:
diff
changeset
|
147 purple_ssl_close(conn->ssl); |
915e11fbaeb0
beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@hxbc.us>
parents:
diff
changeset
|
148 conn->ssl = NULL; |
915e11fbaeb0
beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@hxbc.us>
parents:
diff
changeset
|
149 g_free(conn->path); |
915e11fbaeb0
beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@hxbc.us>
parents:
diff
changeset
|
150 conn->path = NULL; |
915e11fbaeb0
beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@hxbc.us>
parents:
diff
changeset
|
151 } |
915e11fbaeb0
beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@hxbc.us>
parents:
diff
changeset
|
152 } |
915e11fbaeb0
beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@hxbc.us>
parents:
diff
changeset
|
153 |
915e11fbaeb0
beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@hxbc.us>
parents:
diff
changeset
|
154 if (conn->ssl == NULL) { |
915e11fbaeb0
beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@hxbc.us>
parents:
diff
changeset
|
155 conn->ssl = purple_ssl_connect(conn->session->account, req->host, |
915e11fbaeb0
beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@hxbc.us>
parents:
diff
changeset
|
156 443, msn_soap_connected_cb, msn_soap_error_cb, conn); |
915e11fbaeb0
beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@hxbc.us>
parents:
diff
changeset
|
157 conn->path = g_strdup(req->path); |
915e11fbaeb0
beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@hxbc.us>
parents:
diff
changeset
|
158 } else { |
915e11fbaeb0
beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@hxbc.us>
parents:
diff
changeset
|
159 int len = -1; |
915e11fbaeb0
beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@hxbc.us>
parents:
diff
changeset
|
160 char *body = xmlnode_to_str(req->message, &len); |
915e11fbaeb0
beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@hxbc.us>
parents:
diff
changeset
|
161 GString *str = g_string_new(""); |
915e11fbaeb0
beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@hxbc.us>
parents:
diff
changeset
|
162 GSList *iter; |
915e11fbaeb0
beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@hxbc.us>
parents:
diff
changeset
|
163 |
915e11fbaeb0
beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@hxbc.us>
parents:
diff
changeset
|
164 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
|
165 |
915e11fbaeb0
beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@hxbc.us>
parents:
diff
changeset
|
166 g_string_append_printf(str, |
915e11fbaeb0
beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@hxbc.us>
parents:
diff
changeset
|
167 "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
|
168 "SOAPAction: %s\r\n" |
915e11fbaeb0
beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@hxbc.us>
parents:
diff
changeset
|
169 "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
|
170 "Cookie: MSPAuth=%s\r\n" |
915e11fbaeb0
beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@hxbc.us>
parents:
diff
changeset
|
171 "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
|
172 "Accept: */*\r\n" |
915e11fbaeb0
beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@hxbc.us>
parents:
diff
changeset
|
173 "Host: %s\r\n" |
915e11fbaeb0
beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@hxbc.us>
parents:
diff
changeset
|
174 "Content-Length: %d\r\n" |
915e11fbaeb0
beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@hxbc.us>
parents:
diff
changeset
|
175 "Connection: Keep-Alive\r\n" |
915e11fbaeb0
beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@hxbc.us>
parents:
diff
changeset
|
176 "Cache-Control: no-cache\r\n", |
915e11fbaeb0
beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@hxbc.us>
parents:
diff
changeset
|
177 req->path, req->action, |
915e11fbaeb0
beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@hxbc.us>
parents:
diff
changeset
|
178 conn->session->passport_info.mspauth, |
915e11fbaeb0
beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@hxbc.us>
parents:
diff
changeset
|
179 req->host, len); |
915e11fbaeb0
beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@hxbc.us>
parents:
diff
changeset
|
180 |
915e11fbaeb0
beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@hxbc.us>
parents:
diff
changeset
|
181 for (iter = req->headers; iter; iter = iter->next) { |
915e11fbaeb0
beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@hxbc.us>
parents:
diff
changeset
|
182 g_string_append(str, (char *)iter->data); |
915e11fbaeb0
beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@hxbc.us>
parents:
diff
changeset
|
183 g_string_append(str, "\r\n"); |
915e11fbaeb0
beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@hxbc.us>
parents:
diff
changeset
|
184 } |
915e11fbaeb0
beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@hxbc.us>
parents:
diff
changeset
|
185 |
915e11fbaeb0
beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@hxbc.us>
parents:
diff
changeset
|
186 g_string_append(str, "\r\n"); |
915e11fbaeb0
beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@hxbc.us>
parents:
diff
changeset
|
187 g_string_append(str, body); |
915e11fbaeb0
beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@hxbc.us>
parents:
diff
changeset
|
188 |
915e11fbaeb0
beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@hxbc.us>
parents:
diff
changeset
|
189 conn->buf_len = str->len; |
915e11fbaeb0
beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@hxbc.us>
parents:
diff
changeset
|
190 conn->buf = g_string_free(str, FALSE); |
915e11fbaeb0
beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@hxbc.us>
parents:
diff
changeset
|
191 conn->buf_count = 0; |
915e11fbaeb0
beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@hxbc.us>
parents:
diff
changeset
|
192 conn->current = req; |
915e11fbaeb0
beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@hxbc.us>
parents:
diff
changeset
|
193 |
915e11fbaeb0
beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@hxbc.us>
parents:
diff
changeset
|
194 conn->io_handle = purple_input_add(conn->ssl->fd, |
915e11fbaeb0
beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@hxbc.us>
parents:
diff
changeset
|
195 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
|
196 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
|
197 } |
915e11fbaeb0
beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@hxbc.us>
parents:
diff
changeset
|
198 } |
915e11fbaeb0
beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@hxbc.us>
parents:
diff
changeset
|
199 |
915e11fbaeb0
beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@hxbc.us>
parents:
diff
changeset
|
200 conn->idle_handle = 0; |
915e11fbaeb0
beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@hxbc.us>
parents:
diff
changeset
|
201 return FALSE; |
915e11fbaeb0
beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@hxbc.us>
parents:
diff
changeset
|
202 } |
915e11fbaeb0
beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@hxbc.us>
parents:
diff
changeset
|
203 |
915e11fbaeb0
beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@hxbc.us>
parents:
diff
changeset
|
204 void |
915e11fbaeb0
beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@hxbc.us>
parents:
diff
changeset
|
205 msn_soap_connection2_post(MsnSoapConnection2 *conn, MsnSoapMessage *req, |
915e11fbaeb0
beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@hxbc.us>
parents:
diff
changeset
|
206 const char *host, const char *path, MsnSoapCallback cb, gpointer data) |
915e11fbaeb0
beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@hxbc.us>
parents:
diff
changeset
|
207 { |
915e11fbaeb0
beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@hxbc.us>
parents:
diff
changeset
|
208 req->cb = cb; |
915e11fbaeb0
beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@hxbc.us>
parents:
diff
changeset
|
209 req->data = data; |
915e11fbaeb0
beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@hxbc.us>
parents:
diff
changeset
|
210 req->host = g_strdup(host); |
915e11fbaeb0
beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@hxbc.us>
parents:
diff
changeset
|
211 req->path = g_strdup(path); |
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_queue_push_tail(conn->queue, req); |
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 if (conn->idle_handle == 0) |
915e11fbaeb0
beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@hxbc.us>
parents:
diff
changeset
|
216 conn->idle_handle = g_idle_add(msn_soap_connection2_run, conn); |
915e11fbaeb0
beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@hxbc.us>
parents:
diff
changeset
|
217 } |
915e11fbaeb0
beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@hxbc.us>
parents:
diff
changeset
|
218 |
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_connection2_destroy_foreach_cb(gpointer item, gpointer data) |
915e11fbaeb0
beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@hxbc.us>
parents:
diff
changeset
|
221 { |
915e11fbaeb0
beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@hxbc.us>
parents:
diff
changeset
|
222 MsnSoapMessage *req = item; |
915e11fbaeb0
beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@hxbc.us>
parents:
diff
changeset
|
223 MsnSoapConnection2 *conn = data; |
915e11fbaeb0
beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@hxbc.us>
parents:
diff
changeset
|
224 |
915e11fbaeb0
beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@hxbc.us>
parents:
diff
changeset
|
225 if (req->cb) |
915e11fbaeb0
beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@hxbc.us>
parents:
diff
changeset
|
226 req->cb(conn, req, NULL, req->data); |
915e11fbaeb0
beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@hxbc.us>
parents:
diff
changeset
|
227 |
915e11fbaeb0
beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@hxbc.us>
parents:
diff
changeset
|
228 msn_soap_message_destroy(req); |
915e11fbaeb0
beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@hxbc.us>
parents:
diff
changeset
|
229 } |
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 static void |
915e11fbaeb0
beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@hxbc.us>
parents:
diff
changeset
|
232 msn_soap_connection2_cleanup(MsnSoapConnection2 *conn) |
915e11fbaeb0
beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@hxbc.us>
parents:
diff
changeset
|
233 { |
915e11fbaeb0
beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@hxbc.us>
parents:
diff
changeset
|
234 g_queue_foreach(conn->queue, msn_soap_connection2_destroy_foreach_cb, conn); |
915e11fbaeb0
beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@hxbc.us>
parents:
diff
changeset
|
235 if (conn->current) { |
915e11fbaeb0
beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@hxbc.us>
parents:
diff
changeset
|
236 msn_soap_connection2_destroy_foreach_cb(conn->current, conn); |
915e11fbaeb0
beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@hxbc.us>
parents:
diff
changeset
|
237 conn->current = NULL; |
915e11fbaeb0
beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@hxbc.us>
parents:
diff
changeset
|
238 } |
915e11fbaeb0
beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@hxbc.us>
parents:
diff
changeset
|
239 |
915e11fbaeb0
beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@hxbc.us>
parents:
diff
changeset
|
240 purple_input_remove(conn->io_handle); |
915e11fbaeb0
beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@hxbc.us>
parents:
diff
changeset
|
241 conn->io_handle = 0; |
915e11fbaeb0
beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@hxbc.us>
parents:
diff
changeset
|
242 g_source_remove(conn->idle_handle); |
915e11fbaeb0
beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@hxbc.us>
parents:
diff
changeset
|
243 conn->idle_handle = 0; |
915e11fbaeb0
beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@hxbc.us>
parents:
diff
changeset
|
244 |
915e11fbaeb0
beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@hxbc.us>
parents:
diff
changeset
|
245 g_free(conn->buf); |
915e11fbaeb0
beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@hxbc.us>
parents:
diff
changeset
|
246 conn->buf_len = 0; |
915e11fbaeb0
beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@hxbc.us>
parents:
diff
changeset
|
247 conn->buf_count = 0; |
915e11fbaeb0
beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@hxbc.us>
parents:
diff
changeset
|
248 |
915e11fbaeb0
beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@hxbc.us>
parents:
diff
changeset
|
249 if (conn->ssl) { |
915e11fbaeb0
beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@hxbc.us>
parents:
diff
changeset
|
250 purple_ssl_close(conn->ssl); |
915e11fbaeb0
beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@hxbc.us>
parents:
diff
changeset
|
251 conn->ssl = NULL; |
915e11fbaeb0
beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@hxbc.us>
parents:
diff
changeset
|
252 } |
915e11fbaeb0
beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@hxbc.us>
parents:
diff
changeset
|
253 |
915e11fbaeb0
beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@hxbc.us>
parents:
diff
changeset
|
254 while (g_queue_pop_head(conn->queue) != NULL); |
915e11fbaeb0
beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@hxbc.us>
parents:
diff
changeset
|
255 |
915e11fbaeb0
beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@hxbc.us>
parents:
diff
changeset
|
256 g_free(conn->path); |
915e11fbaeb0
beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@hxbc.us>
parents:
diff
changeset
|
257 } |
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 void |
915e11fbaeb0
beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@hxbc.us>
parents:
diff
changeset
|
260 msn_soap_connection2_destroy(MsnSoapConnection2 *conn) |
915e11fbaeb0
beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@hxbc.us>
parents:
diff
changeset
|
261 { |
915e11fbaeb0
beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@hxbc.us>
parents:
diff
changeset
|
262 msn_soap_connection2_cleanup(conn); |
915e11fbaeb0
beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@hxbc.us>
parents:
diff
changeset
|
263 g_queue_free(conn->queue); |
915e11fbaeb0
beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@hxbc.us>
parents:
diff
changeset
|
264 g_free(conn); |
915e11fbaeb0
beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@hxbc.us>
parents:
diff
changeset
|
265 } |
915e11fbaeb0
beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@hxbc.us>
parents:
diff
changeset
|
266 |
915e11fbaeb0
beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@hxbc.us>
parents:
diff
changeset
|
267 MsnSoapMessage * |
915e11fbaeb0
beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@hxbc.us>
parents:
diff
changeset
|
268 msn_soap_message_new(const char *action, xmlnode *message) |
915e11fbaeb0
beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@hxbc.us>
parents:
diff
changeset
|
269 { |
915e11fbaeb0
beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@hxbc.us>
parents:
diff
changeset
|
270 MsnSoapMessage *req = g_new0(MsnSoapMessage, 1); |
915e11fbaeb0
beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@hxbc.us>
parents:
diff
changeset
|
271 |
915e11fbaeb0
beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@hxbc.us>
parents:
diff
changeset
|
272 req->action = g_strdup(action); |
915e11fbaeb0
beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@hxbc.us>
parents:
diff
changeset
|
273 req->message = message; |
915e11fbaeb0
beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@hxbc.us>
parents:
diff
changeset
|
274 |
915e11fbaeb0
beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@hxbc.us>
parents:
diff
changeset
|
275 return req; |
915e11fbaeb0
beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@hxbc.us>
parents:
diff
changeset
|
276 } |
915e11fbaeb0
beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@hxbc.us>
parents:
diff
changeset
|
277 |
915e11fbaeb0
beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@hxbc.us>
parents:
diff
changeset
|
278 void |
915e11fbaeb0
beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@hxbc.us>
parents:
diff
changeset
|
279 msn_soap_message_destroy(MsnSoapMessage *req) |
915e11fbaeb0
beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@hxbc.us>
parents:
diff
changeset
|
280 { |
915e11fbaeb0
beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@hxbc.us>
parents:
diff
changeset
|
281 g_free(req->action); |
915e11fbaeb0
beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@hxbc.us>
parents:
diff
changeset
|
282 g_slist_foreach(req->headers, (GFunc)g_free, NULL); |
915e11fbaeb0
beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@hxbc.us>
parents:
diff
changeset
|
283 g_free(req->host); |
915e11fbaeb0
beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@hxbc.us>
parents:
diff
changeset
|
284 g_free(req->path); |
915e11fbaeb0
beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@hxbc.us>
parents:
diff
changeset
|
285 g_free(req); |
915e11fbaeb0
beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@hxbc.us>
parents:
diff
changeset
|
286 } |
915e11fbaeb0
beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@hxbc.us>
parents:
diff
changeset
|
287 |
915e11fbaeb0
beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@hxbc.us>
parents:
diff
changeset
|
288 void |
915e11fbaeb0
beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@hxbc.us>
parents:
diff
changeset
|
289 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
|
290 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
|
291 { |
915e11fbaeb0
beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@hxbc.us>
parents:
diff
changeset
|
292 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
|
293 |
915e11fbaeb0
beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@hxbc.us>
parents:
diff
changeset
|
294 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
|
295 } |