annotate src/protocols/msn/soap.c @ 19817:cf0611260c6b

[gaim-migrate @ 16979] oim message post to user committed by Ma Yuan<mayuan2006@gmail.com> committer: Ethan Blanton <elb@pidgin.im>
author Ma Yuan <mayuan2006@gmail.com>
date Tue, 22 Aug 2006 16:13:43 +0000
parents 1aa5494587e8
children 509383ef25f8
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
19784
bc30c6270d9f [gaim-migrate @ 16473]
Ma Yuan <mayuan2006@gmail.com>
parents:
diff changeset
1 /**
bc30c6270d9f [gaim-migrate @ 16473]
Ma Yuan <mayuan2006@gmail.com>
parents:
diff changeset
2 * @file soap.c
bc30c6270d9f [gaim-migrate @ 16473]
Ma Yuan <mayuan2006@gmail.com>
parents:
diff changeset
3 * SOAP connection related process
bc30c6270d9f [gaim-migrate @ 16473]
Ma Yuan <mayuan2006@gmail.com>
parents:
diff changeset
4 * Author
bc30c6270d9f [gaim-migrate @ 16473]
Ma Yuan <mayuan2006@gmail.com>
parents:
diff changeset
5 * MaYuan<mayuan2006@gmail.com>
bc30c6270d9f [gaim-migrate @ 16473]
Ma Yuan <mayuan2006@gmail.com>
parents:
diff changeset
6 * gaim
bc30c6270d9f [gaim-migrate @ 16473]
Ma Yuan <mayuan2006@gmail.com>
parents:
diff changeset
7 *
bc30c6270d9f [gaim-migrate @ 16473]
Ma Yuan <mayuan2006@gmail.com>
parents:
diff changeset
8 * Gaim is the legal property of its developers, whose names are too numerous
bc30c6270d9f [gaim-migrate @ 16473]
Ma Yuan <mayuan2006@gmail.com>
parents:
diff changeset
9 * to list here. Please refer to the COPYRIGHT file distributed with this
bc30c6270d9f [gaim-migrate @ 16473]
Ma Yuan <mayuan2006@gmail.com>
parents:
diff changeset
10 * source distribution.
bc30c6270d9f [gaim-migrate @ 16473]
Ma Yuan <mayuan2006@gmail.com>
parents:
diff changeset
11 *
bc30c6270d9f [gaim-migrate @ 16473]
Ma Yuan <mayuan2006@gmail.com>
parents:
diff changeset
12 * This program is free software; you can redistribute it and/or modify
bc30c6270d9f [gaim-migrate @ 16473]
Ma Yuan <mayuan2006@gmail.com>
parents:
diff changeset
13 * it under the terms of the GNU General Public License as published by
bc30c6270d9f [gaim-migrate @ 16473]
Ma Yuan <mayuan2006@gmail.com>
parents:
diff changeset
14 * the Free Software Foundation; either version 2 of the License, or
bc30c6270d9f [gaim-migrate @ 16473]
Ma Yuan <mayuan2006@gmail.com>
parents:
diff changeset
15 * (at your option) any later version.
bc30c6270d9f [gaim-migrate @ 16473]
Ma Yuan <mayuan2006@gmail.com>
parents:
diff changeset
16 *
bc30c6270d9f [gaim-migrate @ 16473]
Ma Yuan <mayuan2006@gmail.com>
parents:
diff changeset
17 * This program is distributed in the hope that it will be useful,
bc30c6270d9f [gaim-migrate @ 16473]
Ma Yuan <mayuan2006@gmail.com>
parents:
diff changeset
18 * but WITHOUT ANY WARRANTY; without even the implied warranty of
bc30c6270d9f [gaim-migrate @ 16473]
Ma Yuan <mayuan2006@gmail.com>
parents:
diff changeset
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
bc30c6270d9f [gaim-migrate @ 16473]
Ma Yuan <mayuan2006@gmail.com>
parents:
diff changeset
20 * GNU General Public License for more details.
bc30c6270d9f [gaim-migrate @ 16473]
Ma Yuan <mayuan2006@gmail.com>
parents:
diff changeset
21 *
bc30c6270d9f [gaim-migrate @ 16473]
Ma Yuan <mayuan2006@gmail.com>
parents:
diff changeset
22 * You should have received a copy of the GNU General Public License
bc30c6270d9f [gaim-migrate @ 16473]
Ma Yuan <mayuan2006@gmail.com>
parents:
diff changeset
23 * along with this program; if not, write to the Free Software
bc30c6270d9f [gaim-migrate @ 16473]
Ma Yuan <mayuan2006@gmail.com>
parents:
diff changeset
24 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
bc30c6270d9f [gaim-migrate @ 16473]
Ma Yuan <mayuan2006@gmail.com>
parents:
diff changeset
25 */
bc30c6270d9f [gaim-migrate @ 16473]
Ma Yuan <mayuan2006@gmail.com>
parents:
diff changeset
26 #include "msn.h"
bc30c6270d9f [gaim-migrate @ 16473]
Ma Yuan <mayuan2006@gmail.com>
parents:
diff changeset
27 #include "soap.h"
bc30c6270d9f [gaim-migrate @ 16473]
Ma Yuan <mayuan2006@gmail.com>
parents:
diff changeset
28
19814
78fea5515221 [gaim-migrate @ 16956]
Ma Yuan <mayuan2006@gmail.com>
parents: 19811
diff changeset
29 /*local function prototype*/
78fea5515221 [gaim-migrate @ 16956]
Ma Yuan <mayuan2006@gmail.com>
parents: 19811
diff changeset
30 void msn_soap_set_process_step(MsnSoapConn *soapconn, MsnSoapStep step);
78fea5515221 [gaim-migrate @ 16956]
Ma Yuan <mayuan2006@gmail.com>
parents: 19811
diff changeset
31
19807
74334aadd843 [gaim-migrate @ 16876]
Ma Yuan <mayuan2006@gmail.com>
parents: 19806
diff changeset
32 /*setup the soap process step*/
19806
cabf9165c9ce [gaim-migrate @ 16873]
Ma Yuan <mayuan2006@gmail.com>
parents: 19804
diff changeset
33 void
cabf9165c9ce [gaim-migrate @ 16873]
Ma Yuan <mayuan2006@gmail.com>
parents: 19804
diff changeset
34 msn_soap_set_process_step(MsnSoapConn *soapconn, MsnSoapStep step)
cabf9165c9ce [gaim-migrate @ 16873]
Ma Yuan <mayuan2006@gmail.com>
parents: 19804
diff changeset
35 {
cabf9165c9ce [gaim-migrate @ 16873]
Ma Yuan <mayuan2006@gmail.com>
parents: 19804
diff changeset
36 soapconn->step = step;
cabf9165c9ce [gaim-migrate @ 16873]
Ma Yuan <mayuan2006@gmail.com>
parents: 19804
diff changeset
37 }
cabf9165c9ce [gaim-migrate @ 16873]
Ma Yuan <mayuan2006@gmail.com>
parents: 19804
diff changeset
38
19785
852b32710df0 [gaim-migrate @ 16507]
Ma Yuan <mayuan2006@gmail.com>
parents: 19784
diff changeset
39 //msn_soap_new(MsnSession *session,gpointer data,int sslconn)
19784
bc30c6270d9f [gaim-migrate @ 16473]
Ma Yuan <mayuan2006@gmail.com>
parents:
diff changeset
40 /*new a soap connection*/
bc30c6270d9f [gaim-migrate @ 16473]
Ma Yuan <mayuan2006@gmail.com>
parents:
diff changeset
41 MsnSoapConn *
19785
852b32710df0 [gaim-migrate @ 16507]
Ma Yuan <mayuan2006@gmail.com>
parents: 19784
diff changeset
42 msn_soap_new(MsnSession *session,gpointer data,int sslconn)
19784
bc30c6270d9f [gaim-migrate @ 16473]
Ma Yuan <mayuan2006@gmail.com>
parents:
diff changeset
43 {
bc30c6270d9f [gaim-migrate @ 16473]
Ma Yuan <mayuan2006@gmail.com>
parents:
diff changeset
44 MsnSoapConn *soapconn;
bc30c6270d9f [gaim-migrate @ 16473]
Ma Yuan <mayuan2006@gmail.com>
parents:
diff changeset
45
bc30c6270d9f [gaim-migrate @ 16473]
Ma Yuan <mayuan2006@gmail.com>
parents:
diff changeset
46 soapconn = g_new0(MsnSoapConn, 1);
bc30c6270d9f [gaim-migrate @ 16473]
Ma Yuan <mayuan2006@gmail.com>
parents:
diff changeset
47 soapconn->session = session;
19785
852b32710df0 [gaim-migrate @ 16507]
Ma Yuan <mayuan2006@gmail.com>
parents: 19784
diff changeset
48 soapconn->parent = data;
852b32710df0 [gaim-migrate @ 16507]
Ma Yuan <mayuan2006@gmail.com>
parents: 19784
diff changeset
49 soapconn->ssl_conn = sslconn;
852b32710df0 [gaim-migrate @ 16507]
Ma Yuan <mayuan2006@gmail.com>
parents: 19784
diff changeset
50
852b32710df0 [gaim-migrate @ 16507]
Ma Yuan <mayuan2006@gmail.com>
parents: 19784
diff changeset
51 soapconn->gsc = NULL;
19784
bc30c6270d9f [gaim-migrate @ 16473]
Ma Yuan <mayuan2006@gmail.com>
parents:
diff changeset
52 soapconn->input_handler = -1;
bc30c6270d9f [gaim-migrate @ 16473]
Ma Yuan <mayuan2006@gmail.com>
parents:
diff changeset
53 soapconn->output_handler = -1;
19804
22eeb4882d77 [gaim-migrate @ 16790]
Ma Yuan <mayuan2006@gmail.com>
parents: 19796
diff changeset
54
19806
cabf9165c9ce [gaim-migrate @ 16873]
Ma Yuan <mayuan2006@gmail.com>
parents: 19804
diff changeset
55 msn_soap_set_process_step(soapconn,MSN_SOAP_UNCONNECTED);
19804
22eeb4882d77 [gaim-migrate @ 16790]
Ma Yuan <mayuan2006@gmail.com>
parents: 19796
diff changeset
56 soapconn->soap_queue = g_queue_new();
19784
bc30c6270d9f [gaim-migrate @ 16473]
Ma Yuan <mayuan2006@gmail.com>
parents:
diff changeset
57 return soapconn;
bc30c6270d9f [gaim-migrate @ 16473]
Ma Yuan <mayuan2006@gmail.com>
parents:
diff changeset
58 }
bc30c6270d9f [gaim-migrate @ 16473]
Ma Yuan <mayuan2006@gmail.com>
parents:
diff changeset
59
bc30c6270d9f [gaim-migrate @ 16473]
Ma Yuan <mayuan2006@gmail.com>
parents:
diff changeset
60 /*ssl soap connect callback*/
bc30c6270d9f [gaim-migrate @ 16473]
Ma Yuan <mayuan2006@gmail.com>
parents:
diff changeset
61 void
bc30c6270d9f [gaim-migrate @ 16473]
Ma Yuan <mayuan2006@gmail.com>
parents:
diff changeset
62 msn_soap_connect_cb(gpointer data, GaimSslConnection *gsc,
bc30c6270d9f [gaim-migrate @ 16473]
Ma Yuan <mayuan2006@gmail.com>
parents:
diff changeset
63 GaimInputCondition cond)
bc30c6270d9f [gaim-migrate @ 16473]
Ma Yuan <mayuan2006@gmail.com>
parents:
diff changeset
64 {
bc30c6270d9f [gaim-migrate @ 16473]
Ma Yuan <mayuan2006@gmail.com>
parents:
diff changeset
65 MsnSoapConn * soapconn;
bc30c6270d9f [gaim-migrate @ 16473]
Ma Yuan <mayuan2006@gmail.com>
parents:
diff changeset
66 MsnSession *session;
bc30c6270d9f [gaim-migrate @ 16473]
Ma Yuan <mayuan2006@gmail.com>
parents:
diff changeset
67
bc30c6270d9f [gaim-migrate @ 16473]
Ma Yuan <mayuan2006@gmail.com>
parents:
diff changeset
68 gaim_debug_info("MaYuan","Soap connection connected!\n");
bc30c6270d9f [gaim-migrate @ 16473]
Ma Yuan <mayuan2006@gmail.com>
parents:
diff changeset
69 soapconn = data;
bc30c6270d9f [gaim-migrate @ 16473]
Ma Yuan <mayuan2006@gmail.com>
parents:
diff changeset
70 g_return_if_fail(soapconn != NULL);
bc30c6270d9f [gaim-migrate @ 16473]
Ma Yuan <mayuan2006@gmail.com>
parents:
diff changeset
71
bc30c6270d9f [gaim-migrate @ 16473]
Ma Yuan <mayuan2006@gmail.com>
parents:
diff changeset
72 session = soapconn->session;
bc30c6270d9f [gaim-migrate @ 16473]
Ma Yuan <mayuan2006@gmail.com>
parents:
diff changeset
73 g_return_if_fail(session != NULL);
bc30c6270d9f [gaim-migrate @ 16473]
Ma Yuan <mayuan2006@gmail.com>
parents:
diff changeset
74
bc30c6270d9f [gaim-migrate @ 16473]
Ma Yuan <mayuan2006@gmail.com>
parents:
diff changeset
75 soapconn->gsc = gsc;
bc30c6270d9f [gaim-migrate @ 16473]
Ma Yuan <mayuan2006@gmail.com>
parents:
diff changeset
76
bc30c6270d9f [gaim-migrate @ 16473]
Ma Yuan <mayuan2006@gmail.com>
parents:
diff changeset
77 /*connection callback*/
bc30c6270d9f [gaim-migrate @ 16473]
Ma Yuan <mayuan2006@gmail.com>
parents:
diff changeset
78 if(soapconn->connect_cb != NULL){
bc30c6270d9f [gaim-migrate @ 16473]
Ma Yuan <mayuan2006@gmail.com>
parents:
diff changeset
79 soapconn->connect_cb(data,gsc,cond);
bc30c6270d9f [gaim-migrate @ 16473]
Ma Yuan <mayuan2006@gmail.com>
parents:
diff changeset
80 }
19804
22eeb4882d77 [gaim-migrate @ 16790]
Ma Yuan <mayuan2006@gmail.com>
parents: 19796
diff changeset
81
19806
cabf9165c9ce [gaim-migrate @ 16873]
Ma Yuan <mayuan2006@gmail.com>
parents: 19804
diff changeset
82 msn_soap_set_process_step(soapconn,MSN_SOAP_CONNECTED);
19804
22eeb4882d77 [gaim-migrate @ 16790]
Ma Yuan <mayuan2006@gmail.com>
parents: 19796
diff changeset
83 /*we do the SOAP request here*/
22eeb4882d77 [gaim-migrate @ 16790]
Ma Yuan <mayuan2006@gmail.com>
parents: 19796
diff changeset
84 msn_soap_post_head_request(soapconn);
19784
bc30c6270d9f [gaim-migrate @ 16473]
Ma Yuan <mayuan2006@gmail.com>
parents:
diff changeset
85 }
bc30c6270d9f [gaim-migrate @ 16473]
Ma Yuan <mayuan2006@gmail.com>
parents:
diff changeset
86
bc30c6270d9f [gaim-migrate @ 16473]
Ma Yuan <mayuan2006@gmail.com>
parents:
diff changeset
87 /*ssl soap error callback*/
bc30c6270d9f [gaim-migrate @ 16473]
Ma Yuan <mayuan2006@gmail.com>
parents:
diff changeset
88 static void
bc30c6270d9f [gaim-migrate @ 16473]
Ma Yuan <mayuan2006@gmail.com>
parents:
diff changeset
89 msn_soap_error_cb(GaimSslConnection *gsc, GaimSslErrorType error, void *data)
bc30c6270d9f [gaim-migrate @ 16473]
Ma Yuan <mayuan2006@gmail.com>
parents:
diff changeset
90 {
bc30c6270d9f [gaim-migrate @ 16473]
Ma Yuan <mayuan2006@gmail.com>
parents:
diff changeset
91 MsnSoapConn * soapconn = data;
19817
cf0611260c6b [gaim-migrate @ 16979]
Ma Yuan <mayuan2006@gmail.com>
parents: 19816
diff changeset
92
19784
bc30c6270d9f [gaim-migrate @ 16473]
Ma Yuan <mayuan2006@gmail.com>
parents:
diff changeset
93 g_return_if_fail(data != NULL);
bc30c6270d9f [gaim-migrate @ 16473]
Ma Yuan <mayuan2006@gmail.com>
parents:
diff changeset
94 gaim_debug_info("MaYuan","Soap connection error!\n");
19817
cf0611260c6b [gaim-migrate @ 16979]
Ma Yuan <mayuan2006@gmail.com>
parents: 19816
diff changeset
95 msn_soap_set_process_step(soapconn, MSN_SOAP_UNCONNECTED);
cf0611260c6b [gaim-migrate @ 16979]
Ma Yuan <mayuan2006@gmail.com>
parents: 19816
diff changeset
96
19784
bc30c6270d9f [gaim-migrate @ 16473]
Ma Yuan <mayuan2006@gmail.com>
parents:
diff changeset
97 /*error callback*/
bc30c6270d9f [gaim-migrate @ 16473]
Ma Yuan <mayuan2006@gmail.com>
parents:
diff changeset
98 if(soapconn->error_cb != NULL){
bc30c6270d9f [gaim-migrate @ 16473]
Ma Yuan <mayuan2006@gmail.com>
parents:
diff changeset
99 soapconn->error_cb(gsc,error,data);
bc30c6270d9f [gaim-migrate @ 16473]
Ma Yuan <mayuan2006@gmail.com>
parents:
diff changeset
100 }
bc30c6270d9f [gaim-migrate @ 16473]
Ma Yuan <mayuan2006@gmail.com>
parents:
diff changeset
101 }
bc30c6270d9f [gaim-migrate @ 16473]
Ma Yuan <mayuan2006@gmail.com>
parents:
diff changeset
102
bc30c6270d9f [gaim-migrate @ 16473]
Ma Yuan <mayuan2006@gmail.com>
parents:
diff changeset
103 /*init the soap connection*/
bc30c6270d9f [gaim-migrate @ 16473]
Ma Yuan <mayuan2006@gmail.com>
parents:
diff changeset
104 void
bc30c6270d9f [gaim-migrate @ 16473]
Ma Yuan <mayuan2006@gmail.com>
parents:
diff changeset
105 msn_soap_init(MsnSoapConn *soapconn,char * host,int ssl,
bc30c6270d9f [gaim-migrate @ 16473]
Ma Yuan <mayuan2006@gmail.com>
parents:
diff changeset
106 GaimSslInputFunction connect_cb,
bc30c6270d9f [gaim-migrate @ 16473]
Ma Yuan <mayuan2006@gmail.com>
parents:
diff changeset
107 GaimSslErrorFunction error_cb)
bc30c6270d9f [gaim-migrate @ 16473]
Ma Yuan <mayuan2006@gmail.com>
parents:
diff changeset
108 {
19808
75ecc42d3e8d [gaim-migrate @ 16882]
Ma Yuan <mayuan2006@gmail.com>
parents: 19807
diff changeset
109 gaim_debug_info("MaYuan","msn_soap_init...\n");
19784
bc30c6270d9f [gaim-migrate @ 16473]
Ma Yuan <mayuan2006@gmail.com>
parents:
diff changeset
110 soapconn->login_host = g_strdup(host);
bc30c6270d9f [gaim-migrate @ 16473]
Ma Yuan <mayuan2006@gmail.com>
parents:
diff changeset
111 soapconn->ssl_conn = ssl;
bc30c6270d9f [gaim-migrate @ 16473]
Ma Yuan <mayuan2006@gmail.com>
parents:
diff changeset
112 soapconn->connect_cb = connect_cb;
bc30c6270d9f [gaim-migrate @ 16473]
Ma Yuan <mayuan2006@gmail.com>
parents:
diff changeset
113 soapconn->error_cb = error_cb;
19808
75ecc42d3e8d [gaim-migrate @ 16882]
Ma Yuan <mayuan2006@gmail.com>
parents: 19807
diff changeset
114 gaim_debug_info("MaYuan","msn_soap_init...done\n");
19804
22eeb4882d77 [gaim-migrate @ 16790]
Ma Yuan <mayuan2006@gmail.com>
parents: 19796
diff changeset
115 }
22eeb4882d77 [gaim-migrate @ 16790]
Ma Yuan <mayuan2006@gmail.com>
parents: 19796
diff changeset
116
19806
cabf9165c9ce [gaim-migrate @ 16873]
Ma Yuan <mayuan2006@gmail.com>
parents: 19804
diff changeset
117 /*connect the soap connection*/
19804
22eeb4882d77 [gaim-migrate @ 16790]
Ma Yuan <mayuan2006@gmail.com>
parents: 19796
diff changeset
118 void
22eeb4882d77 [gaim-migrate @ 16790]
Ma Yuan <mayuan2006@gmail.com>
parents: 19796
diff changeset
119 msn_soap_connect(MsnSoapConn *soapconn)
22eeb4882d77 [gaim-migrate @ 16790]
Ma Yuan <mayuan2006@gmail.com>
parents: 19796
diff changeset
120 {
19784
bc30c6270d9f [gaim-migrate @ 16473]
Ma Yuan <mayuan2006@gmail.com>
parents:
diff changeset
121 if(soapconn->ssl_conn){
bc30c6270d9f [gaim-migrate @ 16473]
Ma Yuan <mayuan2006@gmail.com>
parents:
diff changeset
122 gaim_ssl_connect(soapconn->session->account, soapconn->login_host,
bc30c6270d9f [gaim-migrate @ 16473]
Ma Yuan <mayuan2006@gmail.com>
parents:
diff changeset
123 GAIM_SSL_DEFAULT_PORT, msn_soap_connect_cb, msn_soap_error_cb,
bc30c6270d9f [gaim-migrate @ 16473]
Ma Yuan <mayuan2006@gmail.com>
parents:
diff changeset
124 soapconn);
bc30c6270d9f [gaim-migrate @ 16473]
Ma Yuan <mayuan2006@gmail.com>
parents:
diff changeset
125 }else{
bc30c6270d9f [gaim-migrate @ 16473]
Ma Yuan <mayuan2006@gmail.com>
parents:
diff changeset
126 }
19809
b488205ad0bc [gaim-migrate @ 16884]
Ma Yuan <mayuan2006@gmail.com>
parents: 19808
diff changeset
127 msn_soap_set_process_step(soapconn,MSN_SOAP_CONNECTING);
19784
bc30c6270d9f [gaim-migrate @ 16473]
Ma Yuan <mayuan2006@gmail.com>
parents:
diff changeset
128 }
bc30c6270d9f [gaim-migrate @ 16473]
Ma Yuan <mayuan2006@gmail.com>
parents:
diff changeset
129
19806
cabf9165c9ce [gaim-migrate @ 16873]
Ma Yuan <mayuan2006@gmail.com>
parents: 19804
diff changeset
130 /*close the soap connection*/
19804
22eeb4882d77 [gaim-migrate @ 16790]
Ma Yuan <mayuan2006@gmail.com>
parents: 19796
diff changeset
131 void
22eeb4882d77 [gaim-migrate @ 16790]
Ma Yuan <mayuan2006@gmail.com>
parents: 19796
diff changeset
132 msn_soap_close(MsnSoapConn *soapconn)
22eeb4882d77 [gaim-migrate @ 16790]
Ma Yuan <mayuan2006@gmail.com>
parents: 19796
diff changeset
133 {
22eeb4882d77 [gaim-migrate @ 16790]
Ma Yuan <mayuan2006@gmail.com>
parents: 19796
diff changeset
134 if(soapconn->ssl_conn){
22eeb4882d77 [gaim-migrate @ 16790]
Ma Yuan <mayuan2006@gmail.com>
parents: 19796
diff changeset
135 if(soapconn->gsc != NULL){
22eeb4882d77 [gaim-migrate @ 16790]
Ma Yuan <mayuan2006@gmail.com>
parents: 19796
diff changeset
136 gaim_ssl_close(soapconn->gsc);
22eeb4882d77 [gaim-migrate @ 16790]
Ma Yuan <mayuan2006@gmail.com>
parents: 19796
diff changeset
137 soapconn->gsc = NULL;
22eeb4882d77 [gaim-migrate @ 16790]
Ma Yuan <mayuan2006@gmail.com>
parents: 19796
diff changeset
138 }
22eeb4882d77 [gaim-migrate @ 16790]
Ma Yuan <mayuan2006@gmail.com>
parents: 19796
diff changeset
139 }else{
22eeb4882d77 [gaim-migrate @ 16790]
Ma Yuan <mayuan2006@gmail.com>
parents: 19796
diff changeset
140 }
19806
cabf9165c9ce [gaim-migrate @ 16873]
Ma Yuan <mayuan2006@gmail.com>
parents: 19804
diff changeset
141 msn_soap_set_process_step(soapconn,MSN_SOAP_UNCONNECTED);
19804
22eeb4882d77 [gaim-migrate @ 16790]
Ma Yuan <mayuan2006@gmail.com>
parents: 19796
diff changeset
142 }
22eeb4882d77 [gaim-migrate @ 16790]
Ma Yuan <mayuan2006@gmail.com>
parents: 19796
diff changeset
143
19784
bc30c6270d9f [gaim-migrate @ 16473]
Ma Yuan <mayuan2006@gmail.com>
parents:
diff changeset
144 /*destroy the soap connection*/
bc30c6270d9f [gaim-migrate @ 16473]
Ma Yuan <mayuan2006@gmail.com>
parents:
diff changeset
145 void
bc30c6270d9f [gaim-migrate @ 16473]
Ma Yuan <mayuan2006@gmail.com>
parents:
diff changeset
146 msn_soap_destroy(MsnSoapConn *soapconn)
bc30c6270d9f [gaim-migrate @ 16473]
Ma Yuan <mayuan2006@gmail.com>
parents:
diff changeset
147 {
19804
22eeb4882d77 [gaim-migrate @ 16790]
Ma Yuan <mayuan2006@gmail.com>
parents: 19796
diff changeset
148 MsnSoapReq *request;
22eeb4882d77 [gaim-migrate @ 16790]
Ma Yuan <mayuan2006@gmail.com>
parents: 19796
diff changeset
149
19791
bddd32f36bde [gaim-migrate @ 16653]
Ma Yuan <mayuan2006@gmail.com>
parents: 19790
diff changeset
150 if(soapconn->login_host)
bddd32f36bde [gaim-migrate @ 16653]
Ma Yuan <mayuan2006@gmail.com>
parents: 19790
diff changeset
151 g_free(soapconn->login_host);
bddd32f36bde [gaim-migrate @ 16653]
Ma Yuan <mayuan2006@gmail.com>
parents: 19790
diff changeset
152
bddd32f36bde [gaim-migrate @ 16653]
Ma Yuan <mayuan2006@gmail.com>
parents: 19790
diff changeset
153 if(soapconn->login_path)
bddd32f36bde [gaim-migrate @ 16653]
Ma Yuan <mayuan2006@gmail.com>
parents: 19790
diff changeset
154 g_free(soapconn->login_path);
19784
bc30c6270d9f [gaim-migrate @ 16473]
Ma Yuan <mayuan2006@gmail.com>
parents:
diff changeset
155
bc30c6270d9f [gaim-migrate @ 16473]
Ma Yuan <mayuan2006@gmail.com>
parents:
diff changeset
156 /*remove the write handler*/
bc30c6270d9f [gaim-migrate @ 16473]
Ma Yuan <mayuan2006@gmail.com>
parents:
diff changeset
157 if (soapconn->output_handler > 0){
bc30c6270d9f [gaim-migrate @ 16473]
Ma Yuan <mayuan2006@gmail.com>
parents:
diff changeset
158 gaim_input_remove(soapconn->output_handler);
bc30c6270d9f [gaim-migrate @ 16473]
Ma Yuan <mayuan2006@gmail.com>
parents:
diff changeset
159 }
bc30c6270d9f [gaim-migrate @ 16473]
Ma Yuan <mayuan2006@gmail.com>
parents:
diff changeset
160 /*remove the read handler*/
bc30c6270d9f [gaim-migrate @ 16473]
Ma Yuan <mayuan2006@gmail.com>
parents:
diff changeset
161 if (soapconn->input_handler > 0){
bc30c6270d9f [gaim-migrate @ 16473]
Ma Yuan <mayuan2006@gmail.com>
parents:
diff changeset
162 gaim_input_remove(soapconn->input_handler);
bc30c6270d9f [gaim-migrate @ 16473]
Ma Yuan <mayuan2006@gmail.com>
parents:
diff changeset
163 }
bc30c6270d9f [gaim-migrate @ 16473]
Ma Yuan <mayuan2006@gmail.com>
parents:
diff changeset
164 msn_soap_free_read_buf(soapconn);
bc30c6270d9f [gaim-migrate @ 16473]
Ma Yuan <mayuan2006@gmail.com>
parents:
diff changeset
165 msn_soap_free_write_buf(soapconn);
bc30c6270d9f [gaim-migrate @ 16473]
Ma Yuan <mayuan2006@gmail.com>
parents:
diff changeset
166
bc30c6270d9f [gaim-migrate @ 16473]
Ma Yuan <mayuan2006@gmail.com>
parents:
diff changeset
167 /*close ssl connection*/
19804
22eeb4882d77 [gaim-migrate @ 16790]
Ma Yuan <mayuan2006@gmail.com>
parents: 19796
diff changeset
168 msn_soap_close(soapconn);
22eeb4882d77 [gaim-migrate @ 16790]
Ma Yuan <mayuan2006@gmail.com>
parents: 19796
diff changeset
169
19806
cabf9165c9ce [gaim-migrate @ 16873]
Ma Yuan <mayuan2006@gmail.com>
parents: 19804
diff changeset
170 /*process the unhandled soap request*/
19804
22eeb4882d77 [gaim-migrate @ 16790]
Ma Yuan <mayuan2006@gmail.com>
parents: 19796
diff changeset
171 while ((request = g_queue_pop_head(soapconn->soap_queue)) != NULL){
22eeb4882d77 [gaim-migrate @ 16790]
Ma Yuan <mayuan2006@gmail.com>
parents: 19796
diff changeset
172 msn_soap_request_free(request);
19788
8b4653986e8e [gaim-migrate @ 16600]
Ma Yuan <mayuan2006@gmail.com>
parents: 19785
diff changeset
173 }
19804
22eeb4882d77 [gaim-migrate @ 16790]
Ma Yuan <mayuan2006@gmail.com>
parents: 19796
diff changeset
174 g_queue_free(soapconn->soap_queue);
19784
bc30c6270d9f [gaim-migrate @ 16473]
Ma Yuan <mayuan2006@gmail.com>
parents:
diff changeset
175 g_free(soapconn);
bc30c6270d9f [gaim-migrate @ 16473]
Ma Yuan <mayuan2006@gmail.com>
parents:
diff changeset
176 }
bc30c6270d9f [gaim-migrate @ 16473]
Ma Yuan <mayuan2006@gmail.com>
parents:
diff changeset
177
19785
852b32710df0 [gaim-migrate @ 16507]
Ma Yuan <mayuan2006@gmail.com>
parents: 19784
diff changeset
178 /*check the soap is connected?
19806
cabf9165c9ce [gaim-migrate @ 16873]
Ma Yuan <mayuan2006@gmail.com>
parents: 19804
diff changeset
179 * if connected return 1
19785
852b32710df0 [gaim-migrate @ 16507]
Ma Yuan <mayuan2006@gmail.com>
parents: 19784
diff changeset
180 */
852b32710df0 [gaim-migrate @ 16507]
Ma Yuan <mayuan2006@gmail.com>
parents: 19784
diff changeset
181 int
852b32710df0 [gaim-migrate @ 16507]
Ma Yuan <mayuan2006@gmail.com>
parents: 19784
diff changeset
182 msn_soap_connected(MsnSoapConn *soapconn)
852b32710df0 [gaim-migrate @ 16507]
Ma Yuan <mayuan2006@gmail.com>
parents: 19784
diff changeset
183 {
852b32710df0 [gaim-migrate @ 16507]
Ma Yuan <mayuan2006@gmail.com>
parents: 19784
diff changeset
184 if(soapconn->ssl_conn){
19806
cabf9165c9ce [gaim-migrate @ 16873]
Ma Yuan <mayuan2006@gmail.com>
parents: 19804
diff changeset
185 return (soapconn->gsc == NULL? 0 : 1);
19785
852b32710df0 [gaim-migrate @ 16507]
Ma Yuan <mayuan2006@gmail.com>
parents: 19784
diff changeset
186 }
19806
cabf9165c9ce [gaim-migrate @ 16873]
Ma Yuan <mayuan2006@gmail.com>
parents: 19804
diff changeset
187 return(soapconn->fd>0? 1 : 0);
19785
852b32710df0 [gaim-migrate @ 16507]
Ma Yuan <mayuan2006@gmail.com>
parents: 19784
diff changeset
188 }
852b32710df0 [gaim-migrate @ 16507]
Ma Yuan <mayuan2006@gmail.com>
parents: 19784
diff changeset
189
19784
bc30c6270d9f [gaim-migrate @ 16473]
Ma Yuan <mayuan2006@gmail.com>
parents:
diff changeset
190 /*read and append the content to the buffer*/
bc30c6270d9f [gaim-migrate @ 16473]
Ma Yuan <mayuan2006@gmail.com>
parents:
diff changeset
191 static gssize
bc30c6270d9f [gaim-migrate @ 16473]
Ma Yuan <mayuan2006@gmail.com>
parents:
diff changeset
192 msn_soap_read(MsnSoapConn *soapconn)
bc30c6270d9f [gaim-migrate @ 16473]
Ma Yuan <mayuan2006@gmail.com>
parents:
diff changeset
193 {
19809
b488205ad0bc [gaim-migrate @ 16884]
Ma Yuan <mayuan2006@gmail.com>
parents: 19808
diff changeset
194 gssize len,requested_len;
19796
3a15b4e5c336 [gaim-migrate @ 16716]
Ma Yuan <mayuan2006@gmail.com>
parents: 19791
diff changeset
195 char temp_buf[MSN_SOAP_READ_BUFF_SIZE];
19784
bc30c6270d9f [gaim-migrate @ 16473]
Ma Yuan <mayuan2006@gmail.com>
parents:
diff changeset
196
19809
b488205ad0bc [gaim-migrate @ 16884]
Ma Yuan <mayuan2006@gmail.com>
parents: 19808
diff changeset
197 // requested_len = (soapconn->need_to_read > 0) ? soapconn->need_to_read : MSN_SOAP_READ_BUFF_SIZE;
b488205ad0bc [gaim-migrate @ 16884]
Ma Yuan <mayuan2006@gmail.com>
parents: 19808
diff changeset
198 requested_len = MSN_SOAP_READ_BUFF_SIZE;
19784
bc30c6270d9f [gaim-migrate @ 16473]
Ma Yuan <mayuan2006@gmail.com>
parents:
diff changeset
199 if(soapconn->ssl_conn){
19809
b488205ad0bc [gaim-migrate @ 16884]
Ma Yuan <mayuan2006@gmail.com>
parents: 19808
diff changeset
200 len = gaim_ssl_read(soapconn->gsc, temp_buf,requested_len);
19784
bc30c6270d9f [gaim-migrate @ 16473]
Ma Yuan <mayuan2006@gmail.com>
parents:
diff changeset
201 }else{
19809
b488205ad0bc [gaim-migrate @ 16884]
Ma Yuan <mayuan2006@gmail.com>
parents: 19808
diff changeset
202 len = read(soapconn->fd, temp_buf,requested_len);
19784
bc30c6270d9f [gaim-migrate @ 16473]
Ma Yuan <mayuan2006@gmail.com>
parents:
diff changeset
203 }
bc30c6270d9f [gaim-migrate @ 16473]
Ma Yuan <mayuan2006@gmail.com>
parents:
diff changeset
204 if(len >0){
bc30c6270d9f [gaim-migrate @ 16473]
Ma Yuan <mayuan2006@gmail.com>
parents:
diff changeset
205 soapconn->read_buf = g_realloc(soapconn->read_buf,
bc30c6270d9f [gaim-migrate @ 16473]
Ma Yuan <mayuan2006@gmail.com>
parents:
diff changeset
206 soapconn->read_len + len + 1);
bc30c6270d9f [gaim-migrate @ 16473]
Ma Yuan <mayuan2006@gmail.com>
parents:
diff changeset
207 // strncpy(soapconn->read_buf + soapconn->read_len, temp_buf, len);
bc30c6270d9f [gaim-migrate @ 16473]
Ma Yuan <mayuan2006@gmail.com>
parents:
diff changeset
208 memcpy(soapconn->read_buf + soapconn->read_len, temp_buf, len);
bc30c6270d9f [gaim-migrate @ 16473]
Ma Yuan <mayuan2006@gmail.com>
parents:
diff changeset
209 soapconn->read_len += len;
bc30c6270d9f [gaim-migrate @ 16473]
Ma Yuan <mayuan2006@gmail.com>
parents:
diff changeset
210 soapconn->read_buf[soapconn->read_len] = '\0';
bc30c6270d9f [gaim-migrate @ 16473]
Ma Yuan <mayuan2006@gmail.com>
parents:
diff changeset
211 }
19814
78fea5515221 [gaim-migrate @ 16956]
Ma Yuan <mayuan2006@gmail.com>
parents: 19811
diff changeset
212 gaim_debug_info("MaYuan","++soap ssl read:{%d}\n",len);
19784
bc30c6270d9f [gaim-migrate @ 16473]
Ma Yuan <mayuan2006@gmail.com>
parents:
diff changeset
213 // gaim_debug_info("MaYuan","nexus ssl read:{%s}\n",soapconn->read_buf);
19814
78fea5515221 [gaim-migrate @ 16956]
Ma Yuan <mayuan2006@gmail.com>
parents: 19811
diff changeset
214 return len;
19784
bc30c6270d9f [gaim-migrate @ 16473]
Ma Yuan <mayuan2006@gmail.com>
parents:
diff changeset
215 }
bc30c6270d9f [gaim-migrate @ 16473]
Ma Yuan <mayuan2006@gmail.com>
parents:
diff changeset
216
bc30c6270d9f [gaim-migrate @ 16473]
Ma Yuan <mayuan2006@gmail.com>
parents:
diff changeset
217 /*read the whole SOAP server response*/
bc30c6270d9f [gaim-migrate @ 16473]
Ma Yuan <mayuan2006@gmail.com>
parents:
diff changeset
218 void
bc30c6270d9f [gaim-migrate @ 16473]
Ma Yuan <mayuan2006@gmail.com>
parents:
diff changeset
219 msn_soap_read_cb(gpointer data, gint source, GaimInputCondition cond)
bc30c6270d9f [gaim-migrate @ 16473]
Ma Yuan <mayuan2006@gmail.com>
parents:
diff changeset
220 {
bc30c6270d9f [gaim-migrate @ 16473]
Ma Yuan <mayuan2006@gmail.com>
parents:
diff changeset
221 MsnSoapConn *soapconn = data;
bc30c6270d9f [gaim-migrate @ 16473]
Ma Yuan <mayuan2006@gmail.com>
parents:
diff changeset
222 MsnSession *session;
bc30c6270d9f [gaim-migrate @ 16473]
Ma Yuan <mayuan2006@gmail.com>
parents:
diff changeset
223 int len;
bc30c6270d9f [gaim-migrate @ 16473]
Ma Yuan <mayuan2006@gmail.com>
parents:
diff changeset
224 char * body_start,*body_len;
bc30c6270d9f [gaim-migrate @ 16473]
Ma Yuan <mayuan2006@gmail.com>
parents:
diff changeset
225 char *length_start,*length_end;
bc30c6270d9f [gaim-migrate @ 16473]
Ma Yuan <mayuan2006@gmail.com>
parents:
diff changeset
226
19785
852b32710df0 [gaim-migrate @ 16507]
Ma Yuan <mayuan2006@gmail.com>
parents: 19784
diff changeset
227 // gaim_debug_misc("MaYuan", "soap read cb\n");
19784
bc30c6270d9f [gaim-migrate @ 16473]
Ma Yuan <mayuan2006@gmail.com>
parents:
diff changeset
228 session = soapconn->session;
bc30c6270d9f [gaim-migrate @ 16473]
Ma Yuan <mayuan2006@gmail.com>
parents:
diff changeset
229 g_return_if_fail(session != NULL);
bc30c6270d9f [gaim-migrate @ 16473]
Ma Yuan <mayuan2006@gmail.com>
parents:
diff changeset
230
bc30c6270d9f [gaim-migrate @ 16473]
Ma Yuan <mayuan2006@gmail.com>
parents:
diff changeset
231 if (soapconn->input_handler == -1){
bc30c6270d9f [gaim-migrate @ 16473]
Ma Yuan <mayuan2006@gmail.com>
parents:
diff changeset
232 soapconn->input_handler = gaim_input_add(soapconn->gsc->fd,
bc30c6270d9f [gaim-migrate @ 16473]
Ma Yuan <mayuan2006@gmail.com>
parents:
diff changeset
233 GAIM_INPUT_READ, msn_soap_read_cb, soapconn);
bc30c6270d9f [gaim-migrate @ 16473]
Ma Yuan <mayuan2006@gmail.com>
parents:
diff changeset
234 }
bc30c6270d9f [gaim-migrate @ 16473]
Ma Yuan <mayuan2006@gmail.com>
parents:
diff changeset
235
bc30c6270d9f [gaim-migrate @ 16473]
Ma Yuan <mayuan2006@gmail.com>
parents:
diff changeset
236 /*read the request header*/
bc30c6270d9f [gaim-migrate @ 16473]
Ma Yuan <mayuan2006@gmail.com>
parents:
diff changeset
237 len = msn_soap_read(soapconn);
bc30c6270d9f [gaim-migrate @ 16473]
Ma Yuan <mayuan2006@gmail.com>
parents:
diff changeset
238 if (len < 0 && errno == EAGAIN){
bc30c6270d9f [gaim-migrate @ 16473]
Ma Yuan <mayuan2006@gmail.com>
parents:
diff changeset
239 return;
bc30c6270d9f [gaim-migrate @ 16473]
Ma Yuan <mayuan2006@gmail.com>
parents:
diff changeset
240 }else if (len < 0) {
bc30c6270d9f [gaim-migrate @ 16473]
Ma Yuan <mayuan2006@gmail.com>
parents:
diff changeset
241 gaim_debug_error("msn", "read Error!len:%d\n",len);
bc30c6270d9f [gaim-migrate @ 16473]
Ma Yuan <mayuan2006@gmail.com>
parents:
diff changeset
242 gaim_input_remove(soapconn->input_handler);
bc30c6270d9f [gaim-migrate @ 16473]
Ma Yuan <mayuan2006@gmail.com>
parents:
diff changeset
243 soapconn->input_handler = -1;
bc30c6270d9f [gaim-migrate @ 16473]
Ma Yuan <mayuan2006@gmail.com>
parents:
diff changeset
244 g_free(soapconn->read_buf);
bc30c6270d9f [gaim-migrate @ 16473]
Ma Yuan <mayuan2006@gmail.com>
parents:
diff changeset
245 soapconn->read_buf = NULL;
bc30c6270d9f [gaim-migrate @ 16473]
Ma Yuan <mayuan2006@gmail.com>
parents:
diff changeset
246 soapconn->read_len = 0;
bc30c6270d9f [gaim-migrate @ 16473]
Ma Yuan <mayuan2006@gmail.com>
parents:
diff changeset
247 /* TODO: error handling */
bc30c6270d9f [gaim-migrate @ 16473]
Ma Yuan <mayuan2006@gmail.com>
parents:
diff changeset
248 return;
bc30c6270d9f [gaim-migrate @ 16473]
Ma Yuan <mayuan2006@gmail.com>
parents:
diff changeset
249 }
bc30c6270d9f [gaim-migrate @ 16473]
Ma Yuan <mayuan2006@gmail.com>
parents:
diff changeset
250
bc30c6270d9f [gaim-migrate @ 16473]
Ma Yuan <mayuan2006@gmail.com>
parents:
diff changeset
251 if(soapconn->read_buf == NULL){
bc30c6270d9f [gaim-migrate @ 16473]
Ma Yuan <mayuan2006@gmail.com>
parents:
diff changeset
252 return;
bc30c6270d9f [gaim-migrate @ 16473]
Ma Yuan <mayuan2006@gmail.com>
parents:
diff changeset
253 }
bc30c6270d9f [gaim-migrate @ 16473]
Ma Yuan <mayuan2006@gmail.com>
parents:
diff changeset
254
19788
8b4653986e8e [gaim-migrate @ 16600]
Ma Yuan <mayuan2006@gmail.com>
parents: 19785
diff changeset
255 if (strstr(soapconn->read_buf, "HTTP/1.1 302") != NULL)
8b4653986e8e [gaim-migrate @ 16600]
Ma Yuan <mayuan2006@gmail.com>
parents: 19785
diff changeset
256 {
8b4653986e8e [gaim-migrate @ 16600]
Ma Yuan <mayuan2006@gmail.com>
parents: 19785
diff changeset
257 /* Redirect. */
8b4653986e8e [gaim-migrate @ 16600]
Ma Yuan <mayuan2006@gmail.com>
parents: 19785
diff changeset
258 char *location, *c;
8b4653986e8e [gaim-migrate @ 16600]
Ma Yuan <mayuan2006@gmail.com>
parents: 19785
diff changeset
259
19796
3a15b4e5c336 [gaim-migrate @ 16716]
Ma Yuan <mayuan2006@gmail.com>
parents: 19791
diff changeset
260 gaim_debug_error("MaYuan", "soap redirect\n");
19788
8b4653986e8e [gaim-migrate @ 16600]
Ma Yuan <mayuan2006@gmail.com>
parents: 19785
diff changeset
261 location = strstr(soapconn->read_buf, "Location: ");
8b4653986e8e [gaim-migrate @ 16600]
Ma Yuan <mayuan2006@gmail.com>
parents: 19785
diff changeset
262 if (location == NULL)
8b4653986e8e [gaim-migrate @ 16600]
Ma Yuan <mayuan2006@gmail.com>
parents: 19785
diff changeset
263 {
8b4653986e8e [gaim-migrate @ 16600]
Ma Yuan <mayuan2006@gmail.com>
parents: 19785
diff changeset
264 msn_soap_free_read_buf(soapconn);
8b4653986e8e [gaim-migrate @ 16600]
Ma Yuan <mayuan2006@gmail.com>
parents: 19785
diff changeset
265
8b4653986e8e [gaim-migrate @ 16600]
Ma Yuan <mayuan2006@gmail.com>
parents: 19785
diff changeset
266 return;
8b4653986e8e [gaim-migrate @ 16600]
Ma Yuan <mayuan2006@gmail.com>
parents: 19785
diff changeset
267 }
8b4653986e8e [gaim-migrate @ 16600]
Ma Yuan <mayuan2006@gmail.com>
parents: 19785
diff changeset
268 location = strchr(location, ' ') + 1;
8b4653986e8e [gaim-migrate @ 16600]
Ma Yuan <mayuan2006@gmail.com>
parents: 19785
diff changeset
269
8b4653986e8e [gaim-migrate @ 16600]
Ma Yuan <mayuan2006@gmail.com>
parents: 19785
diff changeset
270 if ((c = strchr(location, '\r')) != NULL)
8b4653986e8e [gaim-migrate @ 16600]
Ma Yuan <mayuan2006@gmail.com>
parents: 19785
diff changeset
271 *c = '\0';
8b4653986e8e [gaim-migrate @ 16600]
Ma Yuan <mayuan2006@gmail.com>
parents: 19785
diff changeset
272
8b4653986e8e [gaim-migrate @ 16600]
Ma Yuan <mayuan2006@gmail.com>
parents: 19785
diff changeset
273 /* Skip the http:// */
8b4653986e8e [gaim-migrate @ 16600]
Ma Yuan <mayuan2006@gmail.com>
parents: 19785
diff changeset
274 if ((c = strchr(location, '/')) != NULL)
8b4653986e8e [gaim-migrate @ 16600]
Ma Yuan <mayuan2006@gmail.com>
parents: 19785
diff changeset
275 location = c + 2;
8b4653986e8e [gaim-migrate @ 16600]
Ma Yuan <mayuan2006@gmail.com>
parents: 19785
diff changeset
276
8b4653986e8e [gaim-migrate @ 16600]
Ma Yuan <mayuan2006@gmail.com>
parents: 19785
diff changeset
277 if ((c = strchr(location, '/')) != NULL)
8b4653986e8e [gaim-migrate @ 16600]
Ma Yuan <mayuan2006@gmail.com>
parents: 19785
diff changeset
278 {
8b4653986e8e [gaim-migrate @ 16600]
Ma Yuan <mayuan2006@gmail.com>
parents: 19785
diff changeset
279 g_free(soapconn->login_path);
8b4653986e8e [gaim-migrate @ 16600]
Ma Yuan <mayuan2006@gmail.com>
parents: 19785
diff changeset
280 soapconn->login_path = g_strdup(c);
8b4653986e8e [gaim-migrate @ 16600]
Ma Yuan <mayuan2006@gmail.com>
parents: 19785
diff changeset
281
8b4653986e8e [gaim-migrate @ 16600]
Ma Yuan <mayuan2006@gmail.com>
parents: 19785
diff changeset
282 *c = '\0';
8b4653986e8e [gaim-migrate @ 16600]
Ma Yuan <mayuan2006@gmail.com>
parents: 19785
diff changeset
283 }
8b4653986e8e [gaim-migrate @ 16600]
Ma Yuan <mayuan2006@gmail.com>
parents: 19785
diff changeset
284
8b4653986e8e [gaim-migrate @ 16600]
Ma Yuan <mayuan2006@gmail.com>
parents: 19785
diff changeset
285 g_free(soapconn->login_host);
8b4653986e8e [gaim-migrate @ 16600]
Ma Yuan <mayuan2006@gmail.com>
parents: 19785
diff changeset
286 soapconn->login_host = g_strdup(location);
8b4653986e8e [gaim-migrate @ 16600]
Ma Yuan <mayuan2006@gmail.com>
parents: 19785
diff changeset
287
8b4653986e8e [gaim-migrate @ 16600]
Ma Yuan <mayuan2006@gmail.com>
parents: 19785
diff changeset
288 gaim_ssl_connect(session->account, soapconn->login_host,
8b4653986e8e [gaim-migrate @ 16600]
Ma Yuan <mayuan2006@gmail.com>
parents: 19785
diff changeset
289 GAIM_SSL_DEFAULT_PORT, msn_soap_connect_cb,
8b4653986e8e [gaim-migrate @ 16600]
Ma Yuan <mayuan2006@gmail.com>
parents: 19785
diff changeset
290 msn_soap_error_cb, soapconn);
19784
bc30c6270d9f [gaim-migrate @ 16473]
Ma Yuan <mayuan2006@gmail.com>
parents:
diff changeset
291 }
19788
8b4653986e8e [gaim-migrate @ 16600]
Ma Yuan <mayuan2006@gmail.com>
parents: 19785
diff changeset
292 else if (strstr(soapconn->read_buf, "HTTP/1.1 401 Unauthorized") != NULL)
8b4653986e8e [gaim-migrate @ 16600]
Ma Yuan <mayuan2006@gmail.com>
parents: 19785
diff changeset
293 {
8b4653986e8e [gaim-migrate @ 16600]
Ma Yuan <mayuan2006@gmail.com>
parents: 19785
diff changeset
294 const char *error;
19784
bc30c6270d9f [gaim-migrate @ 16473]
Ma Yuan <mayuan2006@gmail.com>
parents:
diff changeset
295
19796
3a15b4e5c336 [gaim-migrate @ 16716]
Ma Yuan <mayuan2006@gmail.com>
parents: 19791
diff changeset
296 gaim_debug_error("MaYuan", "soap 401\n");
19788
8b4653986e8e [gaim-migrate @ 16600]
Ma Yuan <mayuan2006@gmail.com>
parents: 19785
diff changeset
297 if ((error = strstr(soapconn->read_buf, "WWW-Authenticate")) != NULL)
8b4653986e8e [gaim-migrate @ 16600]
Ma Yuan <mayuan2006@gmail.com>
parents: 19785
diff changeset
298 {
8b4653986e8e [gaim-migrate @ 16600]
Ma Yuan <mayuan2006@gmail.com>
parents: 19785
diff changeset
299 if ((error = strstr(error, "cbtxt=")) != NULL)
8b4653986e8e [gaim-migrate @ 16600]
Ma Yuan <mayuan2006@gmail.com>
parents: 19785
diff changeset
300 {
8b4653986e8e [gaim-migrate @ 16600]
Ma Yuan <mayuan2006@gmail.com>
parents: 19785
diff changeset
301 const char *c;
8b4653986e8e [gaim-migrate @ 16600]
Ma Yuan <mayuan2006@gmail.com>
parents: 19785
diff changeset
302 char *temp;
8b4653986e8e [gaim-migrate @ 16600]
Ma Yuan <mayuan2006@gmail.com>
parents: 19785
diff changeset
303
8b4653986e8e [gaim-migrate @ 16600]
Ma Yuan <mayuan2006@gmail.com>
parents: 19785
diff changeset
304 error += strlen("cbtxt=");
8b4653986e8e [gaim-migrate @ 16600]
Ma Yuan <mayuan2006@gmail.com>
parents: 19785
diff changeset
305
8b4653986e8e [gaim-migrate @ 16600]
Ma Yuan <mayuan2006@gmail.com>
parents: 19785
diff changeset
306 if ((c = strchr(error, '\n')) == NULL)
8b4653986e8e [gaim-migrate @ 16600]
Ma Yuan <mayuan2006@gmail.com>
parents: 19785
diff changeset
307 c = error + strlen(error);
8b4653986e8e [gaim-migrate @ 16600]
Ma Yuan <mayuan2006@gmail.com>
parents: 19785
diff changeset
308
8b4653986e8e [gaim-migrate @ 16600]
Ma Yuan <mayuan2006@gmail.com>
parents: 19785
diff changeset
309 temp = g_strndup(error, c - error);
8b4653986e8e [gaim-migrate @ 16600]
Ma Yuan <mayuan2006@gmail.com>
parents: 19785
diff changeset
310 error = gaim_url_decode(temp);
8b4653986e8e [gaim-migrate @ 16600]
Ma Yuan <mayuan2006@gmail.com>
parents: 19785
diff changeset
311 g_free(temp);
8b4653986e8e [gaim-migrate @ 16600]
Ma Yuan <mayuan2006@gmail.com>
parents: 19785
diff changeset
312 }
8b4653986e8e [gaim-migrate @ 16600]
Ma Yuan <mayuan2006@gmail.com>
parents: 19785
diff changeset
313 }
19784
bc30c6270d9f [gaim-migrate @ 16473]
Ma Yuan <mayuan2006@gmail.com>
parents:
diff changeset
314
19788
8b4653986e8e [gaim-migrate @ 16600]
Ma Yuan <mayuan2006@gmail.com>
parents: 19785
diff changeset
315 msn_session_set_error(session, MSN_ERROR_SERV_UNAVAILABLE, error);
8b4653986e8e [gaim-migrate @ 16600]
Ma Yuan <mayuan2006@gmail.com>
parents: 19785
diff changeset
316 }
8b4653986e8e [gaim-migrate @ 16600]
Ma Yuan <mayuan2006@gmail.com>
parents: 19785
diff changeset
317 else if (strstr(soapconn->read_buf, "HTTP/1.1 200 OK"))
8b4653986e8e [gaim-migrate @ 16600]
Ma Yuan <mayuan2006@gmail.com>
parents: 19785
diff changeset
318 {
8b4653986e8e [gaim-migrate @ 16600]
Ma Yuan <mayuan2006@gmail.com>
parents: 19785
diff changeset
319 /*OK! process the SOAP body*/
8b4653986e8e [gaim-migrate @ 16600]
Ma Yuan <mayuan2006@gmail.com>
parents: 19785
diff changeset
320 body_start = (char *)g_strstr_len(soapconn->read_buf, soapconn->read_len,"\r\n\r\n");
8b4653986e8e [gaim-migrate @ 16600]
Ma Yuan <mayuan2006@gmail.com>
parents: 19785
diff changeset
321 if(!body_start){
8b4653986e8e [gaim-migrate @ 16600]
Ma Yuan <mayuan2006@gmail.com>
parents: 19785
diff changeset
322 return;
8b4653986e8e [gaim-migrate @ 16600]
Ma Yuan <mayuan2006@gmail.com>
parents: 19785
diff changeset
323 }
8b4653986e8e [gaim-migrate @ 16600]
Ma Yuan <mayuan2006@gmail.com>
parents: 19785
diff changeset
324 body_start += 4;
8b4653986e8e [gaim-migrate @ 16600]
Ma Yuan <mayuan2006@gmail.com>
parents: 19785
diff changeset
325
8b4653986e8e [gaim-migrate @ 16600]
Ma Yuan <mayuan2006@gmail.com>
parents: 19785
diff changeset
326 // gaim_debug_misc("msn", "Soap Read: {%s}\n", soapconn->read_buf);
19784
bc30c6270d9f [gaim-migrate @ 16473]
Ma Yuan <mayuan2006@gmail.com>
parents:
diff changeset
327
19788
8b4653986e8e [gaim-migrate @ 16600]
Ma Yuan <mayuan2006@gmail.com>
parents: 19785
diff changeset
328 /* we read the content-length*/
8b4653986e8e [gaim-migrate @ 16600]
Ma Yuan <mayuan2006@gmail.com>
parents: 19785
diff changeset
329 length_start = strstr(soapconn->read_buf, "Content-Length: ");
8b4653986e8e [gaim-migrate @ 16600]
Ma Yuan <mayuan2006@gmail.com>
parents: 19785
diff changeset
330 length_start += strlen("Content-Length: ");
8b4653986e8e [gaim-migrate @ 16600]
Ma Yuan <mayuan2006@gmail.com>
parents: 19785
diff changeset
331 length_end = strstr(length_start, "\r\n");
8b4653986e8e [gaim-migrate @ 16600]
Ma Yuan <mayuan2006@gmail.com>
parents: 19785
diff changeset
332 body_len = g_strndup(length_start,length_end - length_start);
19784
bc30c6270d9f [gaim-migrate @ 16473]
Ma Yuan <mayuan2006@gmail.com>
parents:
diff changeset
333
19788
8b4653986e8e [gaim-migrate @ 16600]
Ma Yuan <mayuan2006@gmail.com>
parents: 19785
diff changeset
334 /*setup the conn body */
8b4653986e8e [gaim-migrate @ 16600]
Ma Yuan <mayuan2006@gmail.com>
parents: 19785
diff changeset
335 soapconn->body = body_start;
8b4653986e8e [gaim-migrate @ 16600]
Ma Yuan <mayuan2006@gmail.com>
parents: 19785
diff changeset
336 soapconn->body_len = atoi(body_len);
19796
3a15b4e5c336 [gaim-migrate @ 16716]
Ma Yuan <mayuan2006@gmail.com>
parents: 19791
diff changeset
337 gaim_debug_misc("MaYuan","SOAP Read length :%d,body len:%d\n",soapconn->read_len,soapconn->body_len);
19788
8b4653986e8e [gaim-migrate @ 16600]
Ma Yuan <mayuan2006@gmail.com>
parents: 19785
diff changeset
338
19809
b488205ad0bc [gaim-migrate @ 16884]
Ma Yuan <mayuan2006@gmail.com>
parents: 19808
diff changeset
339 soapconn->need_to_read = (body_start - soapconn->read_buf +soapconn->body_len) - soapconn->read_len;
19796
3a15b4e5c336 [gaim-migrate @ 16716]
Ma Yuan <mayuan2006@gmail.com>
parents: 19791
diff changeset
340 if(soapconn->read_len < body_start - soapconn->read_buf + soapconn->body_len){
19809
b488205ad0bc [gaim-migrate @ 16884]
Ma Yuan <mayuan2006@gmail.com>
parents: 19808
diff changeset
341 // if(soapconn->need_to_read >0){
19804
22eeb4882d77 [gaim-migrate @ 16790]
Ma Yuan <mayuan2006@gmail.com>
parents: 19796
diff changeset
342 return;
19788
8b4653986e8e [gaim-migrate @ 16600]
Ma Yuan <mayuan2006@gmail.com>
parents: 19785
diff changeset
343 }
8b4653986e8e [gaim-migrate @ 16600]
Ma Yuan <mayuan2006@gmail.com>
parents: 19785
diff changeset
344 g_free(body_len);
19784
bc30c6270d9f [gaim-migrate @ 16473]
Ma Yuan <mayuan2006@gmail.com>
parents:
diff changeset
345
19785
852b32710df0 [gaim-migrate @ 16507]
Ma Yuan <mayuan2006@gmail.com>
parents: 19784
diff changeset
346 #if 1
19788
8b4653986e8e [gaim-migrate @ 16600]
Ma Yuan <mayuan2006@gmail.com>
parents: 19785
diff changeset
347 /*remove the read handler*/
8b4653986e8e [gaim-migrate @ 16600]
Ma Yuan <mayuan2006@gmail.com>
parents: 19785
diff changeset
348 gaim_input_remove(soapconn->input_handler);
8b4653986e8e [gaim-migrate @ 16600]
Ma Yuan <mayuan2006@gmail.com>
parents: 19785
diff changeset
349 soapconn->input_handler = -1;
19816
1aa5494587e8 [gaim-migrate @ 16973]
Ma Yuan <mayuan2006@gmail.com>
parents: 19814
diff changeset
350 /*
1aa5494587e8 [gaim-migrate @ 16973]
Ma Yuan <mayuan2006@gmail.com>
parents: 19814
diff changeset
351 * close the soap connection,if more soap request came,
1aa5494587e8 [gaim-migrate @ 16973]
Ma Yuan <mayuan2006@gmail.com>
parents: 19814
diff changeset
352 * Just reconnect to do it,
1aa5494587e8 [gaim-migrate @ 16973]
Ma Yuan <mayuan2006@gmail.com>
parents: 19814
diff changeset
353 *
1aa5494587e8 [gaim-migrate @ 16973]
Ma Yuan <mayuan2006@gmail.com>
parents: 19814
diff changeset
354 * To solve the problem described below:
1aa5494587e8 [gaim-migrate @ 16973]
Ma Yuan <mayuan2006@gmail.com>
parents: 19814
diff changeset
355 * When I post the soap request in one socket one after the other,
1aa5494587e8 [gaim-migrate @ 16973]
Ma Yuan <mayuan2006@gmail.com>
parents: 19814
diff changeset
356 * The first read is ok, But the second soap read always got 0 bytes,
1aa5494587e8 [gaim-migrate @ 16973]
Ma Yuan <mayuan2006@gmail.com>
parents: 19814
diff changeset
357 * Weird!
1aa5494587e8 [gaim-migrate @ 16973]
Ma Yuan <mayuan2006@gmail.com>
parents: 19814
diff changeset
358 * */
1aa5494587e8 [gaim-migrate @ 16973]
Ma Yuan <mayuan2006@gmail.com>
parents: 19814
diff changeset
359 msn_soap_close(soapconn);
19785
852b32710df0 [gaim-migrate @ 16507]
Ma Yuan <mayuan2006@gmail.com>
parents: 19784
diff changeset
360 #endif
852b32710df0 [gaim-migrate @ 16507]
Ma Yuan <mayuan2006@gmail.com>
parents: 19784
diff changeset
361
19788
8b4653986e8e [gaim-migrate @ 16600]
Ma Yuan <mayuan2006@gmail.com>
parents: 19785
diff changeset
362 /*call the read callback*/
8b4653986e8e [gaim-migrate @ 16600]
Ma Yuan <mayuan2006@gmail.com>
parents: 19785
diff changeset
363 if(soapconn->read_cb != NULL){
19804
22eeb4882d77 [gaim-migrate @ 16790]
Ma Yuan <mayuan2006@gmail.com>
parents: 19796
diff changeset
364 soapconn->read_cb(soapconn,source,0);
19788
8b4653986e8e [gaim-migrate @ 16600]
Ma Yuan <mayuan2006@gmail.com>
parents: 19785
diff changeset
365 }
8b4653986e8e [gaim-migrate @ 16600]
Ma Yuan <mayuan2006@gmail.com>
parents: 19785
diff changeset
366 }
19796
3a15b4e5c336 [gaim-migrate @ 16716]
Ma Yuan <mayuan2006@gmail.com>
parents: 19791
diff changeset
367 return;
19784
bc30c6270d9f [gaim-migrate @ 16473]
Ma Yuan <mayuan2006@gmail.com>
parents:
diff changeset
368 }
bc30c6270d9f [gaim-migrate @ 16473]
Ma Yuan <mayuan2006@gmail.com>
parents:
diff changeset
369
bc30c6270d9f [gaim-migrate @ 16473]
Ma Yuan <mayuan2006@gmail.com>
parents:
diff changeset
370 void
bc30c6270d9f [gaim-migrate @ 16473]
Ma Yuan <mayuan2006@gmail.com>
parents:
diff changeset
371 msn_soap_free_read_buf(MsnSoapConn *soapconn)
bc30c6270d9f [gaim-migrate @ 16473]
Ma Yuan <mayuan2006@gmail.com>
parents:
diff changeset
372 {
bc30c6270d9f [gaim-migrate @ 16473]
Ma Yuan <mayuan2006@gmail.com>
parents:
diff changeset
373 if(soapconn->read_buf){
bc30c6270d9f [gaim-migrate @ 16473]
Ma Yuan <mayuan2006@gmail.com>
parents:
diff changeset
374 g_free(soapconn->read_buf);
bc30c6270d9f [gaim-migrate @ 16473]
Ma Yuan <mayuan2006@gmail.com>
parents:
diff changeset
375 }
bc30c6270d9f [gaim-migrate @ 16473]
Ma Yuan <mayuan2006@gmail.com>
parents:
diff changeset
376 soapconn->read_buf = NULL;
bc30c6270d9f [gaim-migrate @ 16473]
Ma Yuan <mayuan2006@gmail.com>
parents:
diff changeset
377 soapconn->read_len = 0;
19809
b488205ad0bc [gaim-migrate @ 16884]
Ma Yuan <mayuan2006@gmail.com>
parents: 19808
diff changeset
378 soapconn->need_to_read = 0;
19784
bc30c6270d9f [gaim-migrate @ 16473]
Ma Yuan <mayuan2006@gmail.com>
parents:
diff changeset
379 }
bc30c6270d9f [gaim-migrate @ 16473]
Ma Yuan <mayuan2006@gmail.com>
parents:
diff changeset
380
bc30c6270d9f [gaim-migrate @ 16473]
Ma Yuan <mayuan2006@gmail.com>
parents:
diff changeset
381 void
bc30c6270d9f [gaim-migrate @ 16473]
Ma Yuan <mayuan2006@gmail.com>
parents:
diff changeset
382 msn_soap_free_write_buf(MsnSoapConn *soapconn)
bc30c6270d9f [gaim-migrate @ 16473]
Ma Yuan <mayuan2006@gmail.com>
parents:
diff changeset
383 {
bc30c6270d9f [gaim-migrate @ 16473]
Ma Yuan <mayuan2006@gmail.com>
parents:
diff changeset
384 if(soapconn->write_buf){
bc30c6270d9f [gaim-migrate @ 16473]
Ma Yuan <mayuan2006@gmail.com>
parents:
diff changeset
385 g_free(soapconn->write_buf);
bc30c6270d9f [gaim-migrate @ 16473]
Ma Yuan <mayuan2006@gmail.com>
parents:
diff changeset
386 }
bc30c6270d9f [gaim-migrate @ 16473]
Ma Yuan <mayuan2006@gmail.com>
parents:
diff changeset
387 soapconn->write_buf = NULL;
bc30c6270d9f [gaim-migrate @ 16473]
Ma Yuan <mayuan2006@gmail.com>
parents:
diff changeset
388 soapconn->written_len = 0;
bc30c6270d9f [gaim-migrate @ 16473]
Ma Yuan <mayuan2006@gmail.com>
parents:
diff changeset
389 }
bc30c6270d9f [gaim-migrate @ 16473]
Ma Yuan <mayuan2006@gmail.com>
parents:
diff changeset
390
bc30c6270d9f [gaim-migrate @ 16473]
Ma Yuan <mayuan2006@gmail.com>
parents:
diff changeset
391 /*Soap write process func*/
bc30c6270d9f [gaim-migrate @ 16473]
Ma Yuan <mayuan2006@gmail.com>
parents:
diff changeset
392 static void
bc30c6270d9f [gaim-migrate @ 16473]
Ma Yuan <mayuan2006@gmail.com>
parents:
diff changeset
393 msn_soap_write_cb(gpointer data, gint source, GaimInputCondition cond)
bc30c6270d9f [gaim-migrate @ 16473]
Ma Yuan <mayuan2006@gmail.com>
parents:
diff changeset
394 {
bc30c6270d9f [gaim-migrate @ 16473]
Ma Yuan <mayuan2006@gmail.com>
parents:
diff changeset
395 MsnSoapConn *soapconn = data;
bc30c6270d9f [gaim-migrate @ 16473]
Ma Yuan <mayuan2006@gmail.com>
parents:
diff changeset
396 int len, total_len;
bc30c6270d9f [gaim-migrate @ 16473]
Ma Yuan <mayuan2006@gmail.com>
parents:
diff changeset
397
19796
3a15b4e5c336 [gaim-migrate @ 16716]
Ma Yuan <mayuan2006@gmail.com>
parents: 19791
diff changeset
398 g_return_if_fail(soapconn != NULL);
3a15b4e5c336 [gaim-migrate @ 16716]
Ma Yuan <mayuan2006@gmail.com>
parents: 19791
diff changeset
399 if(soapconn->write_buf == NULL){
3a15b4e5c336 [gaim-migrate @ 16716]
Ma Yuan <mayuan2006@gmail.com>
parents: 19791
diff changeset
400 gaim_debug_error("MaYuan","soap buffer is NULL\n");
3a15b4e5c336 [gaim-migrate @ 16716]
Ma Yuan <mayuan2006@gmail.com>
parents: 19791
diff changeset
401 gaim_input_remove(soapconn->output_handler);
3a15b4e5c336 [gaim-migrate @ 16716]
Ma Yuan <mayuan2006@gmail.com>
parents: 19791
diff changeset
402 soapconn->output_handler = -1;
3a15b4e5c336 [gaim-migrate @ 16716]
Ma Yuan <mayuan2006@gmail.com>
parents: 19791
diff changeset
403 return;
3a15b4e5c336 [gaim-migrate @ 16716]
Ma Yuan <mayuan2006@gmail.com>
parents: 19791
diff changeset
404 }
19784
bc30c6270d9f [gaim-migrate @ 16473]
Ma Yuan <mayuan2006@gmail.com>
parents:
diff changeset
405 total_len = strlen(soapconn->write_buf);
bc30c6270d9f [gaim-migrate @ 16473]
Ma Yuan <mayuan2006@gmail.com>
parents:
diff changeset
406
bc30c6270d9f [gaim-migrate @ 16473]
Ma Yuan <mayuan2006@gmail.com>
parents:
diff changeset
407 /*
bc30c6270d9f [gaim-migrate @ 16473]
Ma Yuan <mayuan2006@gmail.com>
parents:
diff changeset
408 * write the content to SSL server,
bc30c6270d9f [gaim-migrate @ 16473]
Ma Yuan <mayuan2006@gmail.com>
parents:
diff changeset
409 */
bc30c6270d9f [gaim-migrate @ 16473]
Ma Yuan <mayuan2006@gmail.com>
parents:
diff changeset
410 len = gaim_ssl_write(soapconn->gsc,
bc30c6270d9f [gaim-migrate @ 16473]
Ma Yuan <mayuan2006@gmail.com>
parents:
diff changeset
411 soapconn->write_buf + soapconn->written_len,
bc30c6270d9f [gaim-migrate @ 16473]
Ma Yuan <mayuan2006@gmail.com>
parents:
diff changeset
412 total_len - soapconn->written_len);
bc30c6270d9f [gaim-migrate @ 16473]
Ma Yuan <mayuan2006@gmail.com>
parents:
diff changeset
413
bc30c6270d9f [gaim-migrate @ 16473]
Ma Yuan <mayuan2006@gmail.com>
parents:
diff changeset
414 if (len < 0 && errno == EAGAIN)
bc30c6270d9f [gaim-migrate @ 16473]
Ma Yuan <mayuan2006@gmail.com>
parents:
diff changeset
415 return;
bc30c6270d9f [gaim-migrate @ 16473]
Ma Yuan <mayuan2006@gmail.com>
parents:
diff changeset
416 else if (len <= 0){
bc30c6270d9f [gaim-migrate @ 16473]
Ma Yuan <mayuan2006@gmail.com>
parents:
diff changeset
417 /*SSL write error!*/
bc30c6270d9f [gaim-migrate @ 16473]
Ma Yuan <mayuan2006@gmail.com>
parents:
diff changeset
418 gaim_input_remove(soapconn->output_handler);
bc30c6270d9f [gaim-migrate @ 16473]
Ma Yuan <mayuan2006@gmail.com>
parents:
diff changeset
419 soapconn->output_handler = -1;
bc30c6270d9f [gaim-migrate @ 16473]
Ma Yuan <mayuan2006@gmail.com>
parents:
diff changeset
420 /* TODO: notify of the error */
bc30c6270d9f [gaim-migrate @ 16473]
Ma Yuan <mayuan2006@gmail.com>
parents:
diff changeset
421 return;
bc30c6270d9f [gaim-migrate @ 16473]
Ma Yuan <mayuan2006@gmail.com>
parents:
diff changeset
422 }
bc30c6270d9f [gaim-migrate @ 16473]
Ma Yuan <mayuan2006@gmail.com>
parents:
diff changeset
423 soapconn->written_len += len;
bc30c6270d9f [gaim-migrate @ 16473]
Ma Yuan <mayuan2006@gmail.com>
parents:
diff changeset
424
bc30c6270d9f [gaim-migrate @ 16473]
Ma Yuan <mayuan2006@gmail.com>
parents:
diff changeset
425 if (soapconn->written_len < total_len)
bc30c6270d9f [gaim-migrate @ 16473]
Ma Yuan <mayuan2006@gmail.com>
parents:
diff changeset
426 return;
bc30c6270d9f [gaim-migrate @ 16473]
Ma Yuan <mayuan2006@gmail.com>
parents:
diff changeset
427
bc30c6270d9f [gaim-migrate @ 16473]
Ma Yuan <mayuan2006@gmail.com>
parents:
diff changeset
428 gaim_input_remove(soapconn->output_handler);
bc30c6270d9f [gaim-migrate @ 16473]
Ma Yuan <mayuan2006@gmail.com>
parents:
diff changeset
429 soapconn->output_handler = -1;
bc30c6270d9f [gaim-migrate @ 16473]
Ma Yuan <mayuan2006@gmail.com>
parents:
diff changeset
430
bc30c6270d9f [gaim-migrate @ 16473]
Ma Yuan <mayuan2006@gmail.com>
parents:
diff changeset
431 /*clear the write buff*/
bc30c6270d9f [gaim-migrate @ 16473]
Ma Yuan <mayuan2006@gmail.com>
parents:
diff changeset
432 msn_soap_free_write_buf(soapconn);
bc30c6270d9f [gaim-migrate @ 16473]
Ma Yuan <mayuan2006@gmail.com>
parents:
diff changeset
433
bc30c6270d9f [gaim-migrate @ 16473]
Ma Yuan <mayuan2006@gmail.com>
parents:
diff changeset
434 /* Write finish!
bc30c6270d9f [gaim-migrate @ 16473]
Ma Yuan <mayuan2006@gmail.com>
parents:
diff changeset
435 * callback for write done
bc30c6270d9f [gaim-migrate @ 16473]
Ma Yuan <mayuan2006@gmail.com>
parents:
diff changeset
436 */
bc30c6270d9f [gaim-migrate @ 16473]
Ma Yuan <mayuan2006@gmail.com>
parents:
diff changeset
437 if(soapconn->written_cb != NULL){
bc30c6270d9f [gaim-migrate @ 16473]
Ma Yuan <mayuan2006@gmail.com>
parents:
diff changeset
438 soapconn->written_cb(soapconn, source, 0);
bc30c6270d9f [gaim-migrate @ 16473]
Ma Yuan <mayuan2006@gmail.com>
parents:
diff changeset
439 }
19810
da1075366756 [gaim-migrate @ 16885]
Ma Yuan <mayuan2006@gmail.com>
parents: 19809
diff changeset
440 /*maybe we need to read the input?*/
da1075366756 [gaim-migrate @ 16885]
Ma Yuan <mayuan2006@gmail.com>
parents: 19809
diff changeset
441 msn_soap_read_cb(soapconn,source,0);
19784
bc30c6270d9f [gaim-migrate @ 16473]
Ma Yuan <mayuan2006@gmail.com>
parents:
diff changeset
442 }
bc30c6270d9f [gaim-migrate @ 16473]
Ma Yuan <mayuan2006@gmail.com>
parents:
diff changeset
443
bc30c6270d9f [gaim-migrate @ 16473]
Ma Yuan <mayuan2006@gmail.com>
parents:
diff changeset
444 /*write the buffer to SOAP connection*/
bc30c6270d9f [gaim-migrate @ 16473]
Ma Yuan <mayuan2006@gmail.com>
parents:
diff changeset
445 void
bc30c6270d9f [gaim-migrate @ 16473]
Ma Yuan <mayuan2006@gmail.com>
parents:
diff changeset
446 msn_soap_write(MsnSoapConn * soapconn, char *write_buf, GaimInputFunction written_cb)
bc30c6270d9f [gaim-migrate @ 16473]
Ma Yuan <mayuan2006@gmail.com>
parents:
diff changeset
447 {
bc30c6270d9f [gaim-migrate @ 16473]
Ma Yuan <mayuan2006@gmail.com>
parents:
diff changeset
448 soapconn->write_buf = write_buf;
bc30c6270d9f [gaim-migrate @ 16473]
Ma Yuan <mayuan2006@gmail.com>
parents:
diff changeset
449 soapconn->written_len = 0;
bc30c6270d9f [gaim-migrate @ 16473]
Ma Yuan <mayuan2006@gmail.com>
parents:
diff changeset
450 soapconn->written_cb = written_cb;
19785
852b32710df0 [gaim-migrate @ 16507]
Ma Yuan <mayuan2006@gmail.com>
parents: 19784
diff changeset
451
852b32710df0 [gaim-migrate @ 16507]
Ma Yuan <mayuan2006@gmail.com>
parents: 19784
diff changeset
452 /*clear the read buffer first*/
19784
bc30c6270d9f [gaim-migrate @ 16473]
Ma Yuan <mayuan2006@gmail.com>
parents:
diff changeset
453 /*start the write*/
bc30c6270d9f [gaim-migrate @ 16473]
Ma Yuan <mayuan2006@gmail.com>
parents:
diff changeset
454 soapconn->output_handler = gaim_input_add(soapconn->gsc->fd, GAIM_INPUT_WRITE,
bc30c6270d9f [gaim-migrate @ 16473]
Ma Yuan <mayuan2006@gmail.com>
parents:
diff changeset
455 msn_soap_write_cb, soapconn);
bc30c6270d9f [gaim-migrate @ 16473]
Ma Yuan <mayuan2006@gmail.com>
parents:
diff changeset
456 msn_soap_write_cb(soapconn, soapconn->gsc->fd, GAIM_INPUT_WRITE);
bc30c6270d9f [gaim-migrate @ 16473]
Ma Yuan <mayuan2006@gmail.com>
parents:
diff changeset
457 }
bc30c6270d9f [gaim-migrate @ 16473]
Ma Yuan <mayuan2006@gmail.com>
parents:
diff changeset
458
19804
22eeb4882d77 [gaim-migrate @ 16790]
Ma Yuan <mayuan2006@gmail.com>
parents: 19796
diff changeset
459 /* New a soap request*/
22eeb4882d77 [gaim-migrate @ 16790]
Ma Yuan <mayuan2006@gmail.com>
parents: 19796
diff changeset
460 MsnSoapReq *
22eeb4882d77 [gaim-migrate @ 16790]
Ma Yuan <mayuan2006@gmail.com>
parents: 19796
diff changeset
461 msn_soap_request_new(const char *host,const char *post_url,const char *soap_action,
22eeb4882d77 [gaim-migrate @ 16790]
Ma Yuan <mayuan2006@gmail.com>
parents: 19796
diff changeset
462 const char *body,
22eeb4882d77 [gaim-migrate @ 16790]
Ma Yuan <mayuan2006@gmail.com>
parents: 19796
diff changeset
463 GaimInputFunction read_cb,GaimInputFunction written_cb)
22eeb4882d77 [gaim-migrate @ 16790]
Ma Yuan <mayuan2006@gmail.com>
parents: 19796
diff changeset
464 {
22eeb4882d77 [gaim-migrate @ 16790]
Ma Yuan <mayuan2006@gmail.com>
parents: 19796
diff changeset
465 MsnSoapReq *request;
22eeb4882d77 [gaim-migrate @ 16790]
Ma Yuan <mayuan2006@gmail.com>
parents: 19796
diff changeset
466
22eeb4882d77 [gaim-migrate @ 16790]
Ma Yuan <mayuan2006@gmail.com>
parents: 19796
diff changeset
467 request = g_new0(MsnSoapReq, 1);
22eeb4882d77 [gaim-migrate @ 16790]
Ma Yuan <mayuan2006@gmail.com>
parents: 19796
diff changeset
468 request->id = 0;
22eeb4882d77 [gaim-migrate @ 16790]
Ma Yuan <mayuan2006@gmail.com>
parents: 19796
diff changeset
469
22eeb4882d77 [gaim-migrate @ 16790]
Ma Yuan <mayuan2006@gmail.com>
parents: 19796
diff changeset
470 request->login_host = g_strdup(host);
22eeb4882d77 [gaim-migrate @ 16790]
Ma Yuan <mayuan2006@gmail.com>
parents: 19796
diff changeset
471 request->login_path = g_strdup(post_url);
22eeb4882d77 [gaim-migrate @ 16790]
Ma Yuan <mayuan2006@gmail.com>
parents: 19796
diff changeset
472 request->soap_action = g_strdup(soap_action);
22eeb4882d77 [gaim-migrate @ 16790]
Ma Yuan <mayuan2006@gmail.com>
parents: 19796
diff changeset
473 request->body = g_strdup(body);
22eeb4882d77 [gaim-migrate @ 16790]
Ma Yuan <mayuan2006@gmail.com>
parents: 19796
diff changeset
474 request->read_cb = read_cb;
22eeb4882d77 [gaim-migrate @ 16790]
Ma Yuan <mayuan2006@gmail.com>
parents: 19796
diff changeset
475 request->written_cb = written_cb;
22eeb4882d77 [gaim-migrate @ 16790]
Ma Yuan <mayuan2006@gmail.com>
parents: 19796
diff changeset
476
22eeb4882d77 [gaim-migrate @ 16790]
Ma Yuan <mayuan2006@gmail.com>
parents: 19796
diff changeset
477 return request;
22eeb4882d77 [gaim-migrate @ 16790]
Ma Yuan <mayuan2006@gmail.com>
parents: 19796
diff changeset
478 }
22eeb4882d77 [gaim-migrate @ 16790]
Ma Yuan <mayuan2006@gmail.com>
parents: 19796
diff changeset
479
22eeb4882d77 [gaim-migrate @ 16790]
Ma Yuan <mayuan2006@gmail.com>
parents: 19796
diff changeset
480 /*free a soap request*/
19785
852b32710df0 [gaim-migrate @ 16507]
Ma Yuan <mayuan2006@gmail.com>
parents: 19784
diff changeset
481 void
19804
22eeb4882d77 [gaim-migrate @ 16790]
Ma Yuan <mayuan2006@gmail.com>
parents: 19796
diff changeset
482 msn_soap_request_free(MsnSoapReq *request)
22eeb4882d77 [gaim-migrate @ 16790]
Ma Yuan <mayuan2006@gmail.com>
parents: 19796
diff changeset
483 {
22eeb4882d77 [gaim-migrate @ 16790]
Ma Yuan <mayuan2006@gmail.com>
parents: 19796
diff changeset
484 g_return_if_fail(request != NULL);
22eeb4882d77 [gaim-migrate @ 16790]
Ma Yuan <mayuan2006@gmail.com>
parents: 19796
diff changeset
485
22eeb4882d77 [gaim-migrate @ 16790]
Ma Yuan <mayuan2006@gmail.com>
parents: 19796
diff changeset
486 g_free(request->login_host);
22eeb4882d77 [gaim-migrate @ 16790]
Ma Yuan <mayuan2006@gmail.com>
parents: 19796
diff changeset
487 g_free(request->login_path);
22eeb4882d77 [gaim-migrate @ 16790]
Ma Yuan <mayuan2006@gmail.com>
parents: 19796
diff changeset
488 g_free(request->soap_action);
22eeb4882d77 [gaim-migrate @ 16790]
Ma Yuan <mayuan2006@gmail.com>
parents: 19796
diff changeset
489 g_free(request->body);
22eeb4882d77 [gaim-migrate @ 16790]
Ma Yuan <mayuan2006@gmail.com>
parents: 19796
diff changeset
490 request->read_cb = NULL;
22eeb4882d77 [gaim-migrate @ 16790]
Ma Yuan <mayuan2006@gmail.com>
parents: 19796
diff changeset
491 request->written_cb = NULL;
22eeb4882d77 [gaim-migrate @ 16790]
Ma Yuan <mayuan2006@gmail.com>
parents: 19796
diff changeset
492
22eeb4882d77 [gaim-migrate @ 16790]
Ma Yuan <mayuan2006@gmail.com>
parents: 19796
diff changeset
493 g_free(request);
22eeb4882d77 [gaim-migrate @ 16790]
Ma Yuan <mayuan2006@gmail.com>
parents: 19796
diff changeset
494 }
22eeb4882d77 [gaim-migrate @ 16790]
Ma Yuan <mayuan2006@gmail.com>
parents: 19796
diff changeset
495
19807
74334aadd843 [gaim-migrate @ 16876]
Ma Yuan <mayuan2006@gmail.com>
parents: 19806
diff changeset
496 /*post the soap request queue's head request*/
19804
22eeb4882d77 [gaim-migrate @ 16790]
Ma Yuan <mayuan2006@gmail.com>
parents: 19796
diff changeset
497 void
22eeb4882d77 [gaim-migrate @ 16790]
Ma Yuan <mayuan2006@gmail.com>
parents: 19796
diff changeset
498 msn_soap_post_head_request(MsnSoapConn *soapconn)
22eeb4882d77 [gaim-migrate @ 16790]
Ma Yuan <mayuan2006@gmail.com>
parents: 19796
diff changeset
499 {
19810
da1075366756 [gaim-migrate @ 16885]
Ma Yuan <mayuan2006@gmail.com>
parents: 19809
diff changeset
500 g_return_if_fail(soapconn->soap_queue != NULL);
da1075366756 [gaim-migrate @ 16885]
Ma Yuan <mayuan2006@gmail.com>
parents: 19809
diff changeset
501
19804
22eeb4882d77 [gaim-migrate @ 16790]
Ma Yuan <mayuan2006@gmail.com>
parents: 19796
diff changeset
502 if(!g_queue_is_empty(soapconn->soap_queue)){
22eeb4882d77 [gaim-migrate @ 16790]
Ma Yuan <mayuan2006@gmail.com>
parents: 19796
diff changeset
503 MsnSoapReq *request;
22eeb4882d77 [gaim-migrate @ 16790]
Ma Yuan <mayuan2006@gmail.com>
parents: 19796
diff changeset
504 if((request = g_queue_pop_head(soapconn->soap_queue)) != NULL){
22eeb4882d77 [gaim-migrate @ 16790]
Ma Yuan <mayuan2006@gmail.com>
parents: 19796
diff changeset
505 msn_soap_post_request(soapconn,request);
22eeb4882d77 [gaim-migrate @ 16790]
Ma Yuan <mayuan2006@gmail.com>
parents: 19796
diff changeset
506 }
22eeb4882d77 [gaim-migrate @ 16790]
Ma Yuan <mayuan2006@gmail.com>
parents: 19796
diff changeset
507 }
19806
cabf9165c9ce [gaim-migrate @ 16873]
Ma Yuan <mayuan2006@gmail.com>
parents: 19804
diff changeset
508 msn_soap_set_process_step(soapconn,MSN_SOAP_CONNECTED_IDLE);
19804
22eeb4882d77 [gaim-migrate @ 16790]
Ma Yuan <mayuan2006@gmail.com>
parents: 19796
diff changeset
509 }
22eeb4882d77 [gaim-migrate @ 16790]
Ma Yuan <mayuan2006@gmail.com>
parents: 19796
diff changeset
510
19807
74334aadd843 [gaim-migrate @ 16876]
Ma Yuan <mayuan2006@gmail.com>
parents: 19806
diff changeset
511 /*post the soap request ,
74334aadd843 [gaim-migrate @ 16876]
Ma Yuan <mayuan2006@gmail.com>
parents: 19806
diff changeset
512 * if not connected, Connected first.
74334aadd843 [gaim-migrate @ 16876]
Ma Yuan <mayuan2006@gmail.com>
parents: 19806
diff changeset
513 */
19804
22eeb4882d77 [gaim-migrate @ 16790]
Ma Yuan <mayuan2006@gmail.com>
parents: 19796
diff changeset
514 void
19806
cabf9165c9ce [gaim-migrate @ 16873]
Ma Yuan <mayuan2006@gmail.com>
parents: 19804
diff changeset
515 msn_soap_post(MsnSoapConn *soapconn,MsnSoapReq *request,
cabf9165c9ce [gaim-migrate @ 16873]
Ma Yuan <mayuan2006@gmail.com>
parents: 19804
diff changeset
516 MsnSoapConnectInitFunction msn_soap_init_func)
19804
22eeb4882d77 [gaim-migrate @ 16790]
Ma Yuan <mayuan2006@gmail.com>
parents: 19796
diff changeset
517 {
19816
1aa5494587e8 [gaim-migrate @ 16973]
Ma Yuan <mayuan2006@gmail.com>
parents: 19814
diff changeset
518 if(request != NULL){
1aa5494587e8 [gaim-migrate @ 16973]
Ma Yuan <mayuan2006@gmail.com>
parents: 19814
diff changeset
519 g_queue_push_tail(soapconn->soap_queue, request);
1aa5494587e8 [gaim-migrate @ 16973]
Ma Yuan <mayuan2006@gmail.com>
parents: 19814
diff changeset
520 }
1aa5494587e8 [gaim-migrate @ 16973]
Ma Yuan <mayuan2006@gmail.com>
parents: 19814
diff changeset
521 if(!msn_soap_connected(soapconn)&&(soapconn->step == MSN_SOAP_UNCONNECTED)
1aa5494587e8 [gaim-migrate @ 16973]
Ma Yuan <mayuan2006@gmail.com>
parents: 19814
diff changeset
522 &&(!g_queue_is_empty(soapconn->soap_queue))){
1aa5494587e8 [gaim-migrate @ 16973]
Ma Yuan <mayuan2006@gmail.com>
parents: 19814
diff changeset
523 /*not connected?and we have something to process connect it first*/
19806
cabf9165c9ce [gaim-migrate @ 16873]
Ma Yuan <mayuan2006@gmail.com>
parents: 19804
diff changeset
524 gaim_debug_info("Ma Yuan","soap is not connected!\n");
cabf9165c9ce [gaim-migrate @ 16873]
Ma Yuan <mayuan2006@gmail.com>
parents: 19804
diff changeset
525 msn_soap_init_func(soapconn);
19804
22eeb4882d77 [gaim-migrate @ 16790]
Ma Yuan <mayuan2006@gmail.com>
parents: 19796
diff changeset
526 msn_soap_connect(soapconn);
22eeb4882d77 [gaim-migrate @ 16790]
Ma Yuan <mayuan2006@gmail.com>
parents: 19796
diff changeset
527 return;
22eeb4882d77 [gaim-migrate @ 16790]
Ma Yuan <mayuan2006@gmail.com>
parents: 19796
diff changeset
528 }
19806
cabf9165c9ce [gaim-migrate @ 16873]
Ma Yuan <mayuan2006@gmail.com>
parents: 19804
diff changeset
529 gaim_debug_info("Ma Yuan","soap connected!\n");
19804
22eeb4882d77 [gaim-migrate @ 16790]
Ma Yuan <mayuan2006@gmail.com>
parents: 19796
diff changeset
530 /*if connected, what we only needed to do is to queue the request,
22eeb4882d77 [gaim-migrate @ 16790]
Ma Yuan <mayuan2006@gmail.com>
parents: 19796
diff changeset
531 * when SOAP request in the queue processed done, will do this command.
22eeb4882d77 [gaim-migrate @ 16790]
Ma Yuan <mayuan2006@gmail.com>
parents: 19796
diff changeset
532 * we just waiting...
22eeb4882d77 [gaim-migrate @ 16790]
Ma Yuan <mayuan2006@gmail.com>
parents: 19796
diff changeset
533 */
19806
cabf9165c9ce [gaim-migrate @ 16873]
Ma Yuan <mayuan2006@gmail.com>
parents: 19804
diff changeset
534 if(soapconn->step == MSN_SOAP_CONNECTED_IDLE){
cabf9165c9ce [gaim-migrate @ 16873]
Ma Yuan <mayuan2006@gmail.com>
parents: 19804
diff changeset
535 msn_soap_post_head_request(soapconn);
cabf9165c9ce [gaim-migrate @ 16873]
Ma Yuan <mayuan2006@gmail.com>
parents: 19804
diff changeset
536 }
19804
22eeb4882d77 [gaim-migrate @ 16790]
Ma Yuan <mayuan2006@gmail.com>
parents: 19796
diff changeset
537 }
22eeb4882d77 [gaim-migrate @ 16790]
Ma Yuan <mayuan2006@gmail.com>
parents: 19796
diff changeset
538
22eeb4882d77 [gaim-migrate @ 16790]
Ma Yuan <mayuan2006@gmail.com>
parents: 19796
diff changeset
539 /*Post the soap request action*/
22eeb4882d77 [gaim-migrate @ 16790]
Ma Yuan <mayuan2006@gmail.com>
parents: 19796
diff changeset
540 void
22eeb4882d77 [gaim-migrate @ 16790]
Ma Yuan <mayuan2006@gmail.com>
parents: 19796
diff changeset
541 msn_soap_post_request(MsnSoapConn *soapconn,MsnSoapReq *request)
19785
852b32710df0 [gaim-migrate @ 16507]
Ma Yuan <mayuan2006@gmail.com>
parents: 19784
diff changeset
542 {
852b32710df0 [gaim-migrate @ 16507]
Ma Yuan <mayuan2006@gmail.com>
parents: 19784
diff changeset
543 char * soap_head = NULL;
852b32710df0 [gaim-migrate @ 16507]
Ma Yuan <mayuan2006@gmail.com>
parents: 19784
diff changeset
544 char * request_str = NULL;
852b32710df0 [gaim-migrate @ 16507]
Ma Yuan <mayuan2006@gmail.com>
parents: 19784
diff changeset
545
19814
78fea5515221 [gaim-migrate @ 16956]
Ma Yuan <mayuan2006@gmail.com>
parents: 19811
diff changeset
546 gaim_debug_info("MaYuan","msn_soap_post_request()...\n");
19806
cabf9165c9ce [gaim-migrate @ 16873]
Ma Yuan <mayuan2006@gmail.com>
parents: 19804
diff changeset
547 msn_soap_set_process_step(soapconn,MSN_SOAP_PROCESSING);
19785
852b32710df0 [gaim-migrate @ 16507]
Ma Yuan <mayuan2006@gmail.com>
parents: 19784
diff changeset
548 soap_head = g_strdup_printf(
852b32710df0 [gaim-migrate @ 16507]
Ma Yuan <mayuan2006@gmail.com>
parents: 19784
diff changeset
549 "POST %s HTTP/1.1\r\n"
852b32710df0 [gaim-migrate @ 16507]
Ma Yuan <mayuan2006@gmail.com>
parents: 19784
diff changeset
550 "SOAPAction: %s\r\n"
852b32710df0 [gaim-migrate @ 16507]
Ma Yuan <mayuan2006@gmail.com>
parents: 19784
diff changeset
551 "Content-Type:text/xml; charset=utf-8\r\n"
852b32710df0 [gaim-migrate @ 16507]
Ma Yuan <mayuan2006@gmail.com>
parents: 19784
diff changeset
552 "Cookie: MSPAuth=%s\r\n"
852b32710df0 [gaim-migrate @ 16507]
Ma Yuan <mayuan2006@gmail.com>
parents: 19784
diff changeset
553 "User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1)\r\n"
852b32710df0 [gaim-migrate @ 16507]
Ma Yuan <mayuan2006@gmail.com>
parents: 19784
diff changeset
554 "Accept: text/*\r\n"
852b32710df0 [gaim-migrate @ 16507]
Ma Yuan <mayuan2006@gmail.com>
parents: 19784
diff changeset
555 "Host: %s\r\n"
852b32710df0 [gaim-migrate @ 16507]
Ma Yuan <mayuan2006@gmail.com>
parents: 19784
diff changeset
556 "Content-Length: %d\r\n"
852b32710df0 [gaim-migrate @ 16507]
Ma Yuan <mayuan2006@gmail.com>
parents: 19784
diff changeset
557 "Connection: Keep-Alive\r\n"
852b32710df0 [gaim-migrate @ 16507]
Ma Yuan <mayuan2006@gmail.com>
parents: 19784
diff changeset
558 "Cache-Control: no-cache\r\n\r\n",
19804
22eeb4882d77 [gaim-migrate @ 16790]
Ma Yuan <mayuan2006@gmail.com>
parents: 19796
diff changeset
559 request->login_path,
22eeb4882d77 [gaim-migrate @ 16790]
Ma Yuan <mayuan2006@gmail.com>
parents: 19796
diff changeset
560 request->soap_action,
19785
852b32710df0 [gaim-migrate @ 16507]
Ma Yuan <mayuan2006@gmail.com>
parents: 19784
diff changeset
561 soapconn->session->passport_info.mspauth,
19804
22eeb4882d77 [gaim-migrate @ 16790]
Ma Yuan <mayuan2006@gmail.com>
parents: 19796
diff changeset
562 request->login_host,
22eeb4882d77 [gaim-migrate @ 16790]
Ma Yuan <mayuan2006@gmail.com>
parents: 19796
diff changeset
563 strlen(request->body)
19785
852b32710df0 [gaim-migrate @ 16507]
Ma Yuan <mayuan2006@gmail.com>
parents: 19784
diff changeset
564 );
19804
22eeb4882d77 [gaim-migrate @ 16790]
Ma Yuan <mayuan2006@gmail.com>
parents: 19796
diff changeset
565 request_str = g_strdup_printf("%s%s", soap_head,request->body);
19785
852b32710df0 [gaim-migrate @ 16507]
Ma Yuan <mayuan2006@gmail.com>
parents: 19784
diff changeset
566 g_free(soap_head);
852b32710df0 [gaim-migrate @ 16507]
Ma Yuan <mayuan2006@gmail.com>
parents: 19784
diff changeset
567
852b32710df0 [gaim-migrate @ 16507]
Ma Yuan <mayuan2006@gmail.com>
parents: 19784
diff changeset
568 /*free read buffer*/
852b32710df0 [gaim-migrate @ 16507]
Ma Yuan <mayuan2006@gmail.com>
parents: 19784
diff changeset
569 msn_soap_free_read_buf(soapconn);
19788
8b4653986e8e [gaim-migrate @ 16600]
Ma Yuan <mayuan2006@gmail.com>
parents: 19785
diff changeset
570 gaim_debug_info("MaYuan","send to server{%s}\n",request_str);
19804
22eeb4882d77 [gaim-migrate @ 16790]
Ma Yuan <mayuan2006@gmail.com>
parents: 19796
diff changeset
571 msn_soap_write(soapconn,request_str,request->written_cb);
19785
852b32710df0 [gaim-migrate @ 16507]
Ma Yuan <mayuan2006@gmail.com>
parents: 19784
diff changeset
572 }
852b32710df0 [gaim-migrate @ 16507]
Ma Yuan <mayuan2006@gmail.com>
parents: 19784
diff changeset
573