Mercurial > pidgin
comparison libpurple/protocols/msn/soap.c @ 20401:4ddc27c18781
Fix up some gaim -> purple issues.
author | Richard Laager <rlaager@wiktel.com> |
---|---|
date | Sun, 15 Apr 2007 04:59:43 +0000 |
parents | 4a099e4d0d09 |
children | 455c5700c866 |
comparison
equal
deleted
inserted
replaced
20398:61d6a3dfbb3c | 20401:4ddc27c18781 |
---|---|
1 /** | 1 /** |
2 * @file soap.c | 2 * @file soap.c |
3 * SOAP connection related process | 3 * SOAP connection related process |
4 * Author | 4 * Author |
5 * MaYuan<mayuan2006@gmail.com> | 5 * MaYuan<mayuan2006@gmail.com> |
6 * gaim | 6 * purple |
7 * | 7 * |
8 * Gaim is the legal property of its developers, whose names are too numerous | 8 * Purple is the legal property of its developers, whose names are too numerous |
9 * to list here. Please refer to the COPYRIGHT file distributed with this | 9 * to list here. Please refer to the COPYRIGHT file distributed with this |
10 * source distribution. | 10 * source distribution. |
11 * | 11 * |
12 * This program is free software; you can redistribute it and/or modify | 12 * This program is free software; you can redistribute it and/or modify |
13 * it under the terms of the GNU General Public License as published by | 13 * it under the terms of the GNU General Public License as published by |
60 return soapconn; | 60 return soapconn; |
61 } | 61 } |
62 | 62 |
63 /*ssl soap connect callback*/ | 63 /*ssl soap connect callback*/ |
64 void | 64 void |
65 msn_soap_connect_cb(gpointer data, GaimSslConnection *gsc, | 65 msn_soap_connect_cb(gpointer data, PurpleSslConnection *gsc, |
66 GaimInputCondition cond) | 66 PurpleInputCondition cond) |
67 { | 67 { |
68 MsnSoapConn * soapconn; | 68 MsnSoapConn * soapconn; |
69 MsnSession *session; | 69 MsnSession *session; |
70 | 70 |
71 gaim_debug_info("MaYuan","Soap connection connected!\n"); | 71 purple_debug_info("MaYuan","Soap connection connected!\n"); |
72 soapconn = data; | 72 soapconn = data; |
73 g_return_if_fail(soapconn != NULL); | 73 g_return_if_fail(soapconn != NULL); |
74 | 74 |
75 session = soapconn->session; | 75 session = soapconn->session; |
76 g_return_if_fail(session != NULL); | 76 g_return_if_fail(session != NULL); |
87 msn_soap_post_head_request(soapconn); | 87 msn_soap_post_head_request(soapconn); |
88 } | 88 } |
89 | 89 |
90 /*ssl soap error callback*/ | 90 /*ssl soap error callback*/ |
91 static void | 91 static void |
92 msn_soap_error_cb(GaimSslConnection *gsc, GaimSslErrorType error, void *data) | 92 msn_soap_error_cb(PurpleSslConnection *gsc, PurpleSslErrorType error, void *data) |
93 { | 93 { |
94 MsnSoapConn * soapconn = data; | 94 MsnSoapConn * soapconn = data; |
95 | 95 |
96 g_return_if_fail(data != NULL); | 96 g_return_if_fail(data != NULL); |
97 gaim_debug_info("MaYuan","Soap connection error!\n"); | 97 purple_debug_info("MaYuan","Soap connection error!\n"); |
98 msn_soap_set_process_step(soapconn, MSN_SOAP_UNCONNECTED); | 98 msn_soap_set_process_step(soapconn, MSN_SOAP_UNCONNECTED); |
99 | 99 |
100 /*error callback*/ | 100 /*error callback*/ |
101 if(soapconn->error_cb != NULL){ | 101 if(soapconn->error_cb != NULL){ |
102 soapconn->error_cb(gsc,error,data); | 102 soapconn->error_cb(gsc,error,data); |
104 } | 104 } |
105 | 105 |
106 /*init the soap connection*/ | 106 /*init the soap connection*/ |
107 void | 107 void |
108 msn_soap_init(MsnSoapConn *soapconn,char * host,int ssl, | 108 msn_soap_init(MsnSoapConn *soapconn,char * host,int ssl, |
109 GaimSslInputFunction connect_cb, | 109 PurpleSslInputFunction connect_cb, |
110 GaimSslErrorFunction error_cb) | 110 PurpleSslErrorFunction error_cb) |
111 { | 111 { |
112 gaim_debug_info("MaYuan","msn_soap_init...\n"); | 112 purple_debug_info("MaYuan","msn_soap_init...\n"); |
113 soapconn->login_host = g_strdup(host); | 113 soapconn->login_host = g_strdup(host); |
114 soapconn->ssl_conn = ssl; | 114 soapconn->ssl_conn = ssl; |
115 soapconn->connect_cb = connect_cb; | 115 soapconn->connect_cb = connect_cb; |
116 soapconn->error_cb = error_cb; | 116 soapconn->error_cb = error_cb; |
117 } | 117 } |
119 /*connect the soap connection*/ | 119 /*connect the soap connection*/ |
120 void | 120 void |
121 msn_soap_connect(MsnSoapConn *soapconn) | 121 msn_soap_connect(MsnSoapConn *soapconn) |
122 { | 122 { |
123 if(soapconn->ssl_conn){ | 123 if(soapconn->ssl_conn){ |
124 gaim_ssl_connect(soapconn->session->account, soapconn->login_host, | 124 purple_ssl_connect(soapconn->session->account, soapconn->login_host, |
125 GAIM_SSL_DEFAULT_PORT, msn_soap_connect_cb, msn_soap_error_cb, | 125 PURPLE_SSL_DEFAULT_PORT, msn_soap_connect_cb, msn_soap_error_cb, |
126 soapconn); | 126 soapconn); |
127 }else{ | 127 }else{ |
128 } | 128 } |
129 msn_soap_set_process_step(soapconn,MSN_SOAP_CONNECTING); | 129 msn_soap_set_process_step(soapconn,MSN_SOAP_CONNECTING); |
130 } | 130 } |
133 void | 133 void |
134 msn_soap_close(MsnSoapConn *soapconn) | 134 msn_soap_close(MsnSoapConn *soapconn) |
135 { | 135 { |
136 if(soapconn->ssl_conn){ | 136 if(soapconn->ssl_conn){ |
137 if(soapconn->gsc != NULL){ | 137 if(soapconn->gsc != NULL){ |
138 gaim_ssl_close(soapconn->gsc); | 138 purple_ssl_close(soapconn->gsc); |
139 soapconn->gsc = NULL; | 139 soapconn->gsc = NULL; |
140 } | 140 } |
141 }else{ | 141 }else{ |
142 } | 142 } |
143 msn_soap_set_process_step(soapconn,MSN_SOAP_UNCONNECTED); | 143 msn_soap_set_process_step(soapconn,MSN_SOAP_UNCONNECTED); |
166 if(soapconn->login_path) | 166 if(soapconn->login_path) |
167 g_free(soapconn->login_path); | 167 g_free(soapconn->login_path); |
168 | 168 |
169 /*remove the write handler*/ | 169 /*remove the write handler*/ |
170 if (soapconn->output_handler > 0){ | 170 if (soapconn->output_handler > 0){ |
171 gaim_input_remove(soapconn->output_handler); | 171 purple_input_remove(soapconn->output_handler); |
172 } | 172 } |
173 /*remove the read handler*/ | 173 /*remove the read handler*/ |
174 if (soapconn->input_handler > 0){ | 174 if (soapconn->input_handler > 0){ |
175 gaim_input_remove(soapconn->input_handler); | 175 purple_input_remove(soapconn->input_handler); |
176 } | 176 } |
177 msn_soap_free_read_buf(soapconn); | 177 msn_soap_free_read_buf(soapconn); |
178 msn_soap_free_write_buf(soapconn); | 178 msn_soap_free_write_buf(soapconn); |
179 | 179 |
180 /*close ssl connection*/ | 180 /*close ssl connection*/ |
207 char temp_buf[MSN_SOAP_READ_BUFF_SIZE]; | 207 char temp_buf[MSN_SOAP_READ_BUFF_SIZE]; |
208 | 208 |
209 // requested_len = (soapconn->need_to_read > 0) ? soapconn->need_to_read : MSN_SOAP_READ_BUFF_SIZE; | 209 // requested_len = (soapconn->need_to_read > 0) ? soapconn->need_to_read : MSN_SOAP_READ_BUFF_SIZE; |
210 requested_len = MSN_SOAP_READ_BUFF_SIZE; | 210 requested_len = MSN_SOAP_READ_BUFF_SIZE; |
211 if(soapconn->ssl_conn){ | 211 if(soapconn->ssl_conn){ |
212 len = gaim_ssl_read(soapconn->gsc, temp_buf,requested_len); | 212 len = purple_ssl_read(soapconn->gsc, temp_buf,requested_len); |
213 }else{ | 213 }else{ |
214 len = read(soapconn->fd, temp_buf,requested_len); | 214 len = read(soapconn->fd, temp_buf,requested_len); |
215 } | 215 } |
216 if(len >0){ | 216 if(len >0){ |
217 soapconn->read_buf = g_realloc(soapconn->read_buf, | 217 soapconn->read_buf = g_realloc(soapconn->read_buf, |
219 memcpy(soapconn->read_buf + soapconn->read_len, temp_buf, len); | 219 memcpy(soapconn->read_buf + soapconn->read_len, temp_buf, len); |
220 soapconn->read_len += len; | 220 soapconn->read_len += len; |
221 soapconn->read_buf[soapconn->read_len] = '\0'; | 221 soapconn->read_buf[soapconn->read_len] = '\0'; |
222 } | 222 } |
223 #ifdef MSN_SOAP_DEBUG | 223 #ifdef MSN_SOAP_DEBUG |
224 gaim_debug_info("MaYuan","++soap ssl read:{%d}\n",len); | 224 purple_debug_info("MaYuan","++soap ssl read:{%d}\n",len); |
225 gaim_debug_info("MaYuan","nexus ssl read:{%s}\n",soapconn->read_buf); | 225 purple_debug_info("MaYuan","nexus ssl read:{%s}\n",soapconn->read_buf); |
226 #endif | 226 #endif |
227 return len; | 227 return len; |
228 } | 228 } |
229 | 229 |
230 /*read the whole SOAP server response*/ | 230 /*read the whole SOAP server response*/ |
231 void | 231 void |
232 msn_soap_read_cb(gpointer data, gint source, GaimInputCondition cond) | 232 msn_soap_read_cb(gpointer data, gint source, PurpleInputCondition cond) |
233 { | 233 { |
234 MsnSoapConn *soapconn = data; | 234 MsnSoapConn *soapconn = data; |
235 MsnSession *session; | 235 MsnSession *session; |
236 int len; | 236 int len; |
237 char * body_start,*body_len; | 237 char * body_start,*body_len; |
238 char *length_start,*length_end; | 238 char *length_start,*length_end; |
239 | 239 |
240 // gaim_debug_misc("MaYuan", "soap read cb\n"); | 240 // purple_debug_misc("MaYuan", "soap read cb\n"); |
241 session = soapconn->session; | 241 session = soapconn->session; |
242 g_return_if_fail(session != NULL); | 242 g_return_if_fail(session != NULL); |
243 | 243 |
244 if (soapconn->input_handler == -1){ | 244 if (soapconn->input_handler == -1){ |
245 soapconn->input_handler = gaim_input_add(soapconn->gsc->fd, | 245 soapconn->input_handler = purple_input_add(soapconn->gsc->fd, |
246 GAIM_INPUT_READ, msn_soap_read_cb, soapconn); | 246 PURPLE_INPUT_READ, msn_soap_read_cb, soapconn); |
247 } | 247 } |
248 | 248 |
249 /*read the request header*/ | 249 /*read the request header*/ |
250 len = msn_soap_read(soapconn); | 250 len = msn_soap_read(soapconn); |
251 if (len < 0 && errno == EAGAIN){ | 251 if (len < 0 && errno == EAGAIN){ |
252 return; | 252 return; |
253 }else if (len < 0) { | 253 }else if (len < 0) { |
254 gaim_debug_error("msn", "read Error!len:%d\n",len); | 254 purple_debug_error("msn", "read Error!len:%d\n",len); |
255 gaim_input_remove(soapconn->input_handler); | 255 purple_input_remove(soapconn->input_handler); |
256 soapconn->input_handler = -1; | 256 soapconn->input_handler = -1; |
257 g_free(soapconn->read_buf); | 257 g_free(soapconn->read_buf); |
258 soapconn->read_buf = NULL; | 258 soapconn->read_buf = NULL; |
259 soapconn->read_len = 0; | 259 soapconn->read_len = 0; |
260 /* TODO: error handling */ | 260 /* TODO: error handling */ |
268 if (strstr(soapconn->read_buf, "HTTP/1.1 302") != NULL) | 268 if (strstr(soapconn->read_buf, "HTTP/1.1 302") != NULL) |
269 { | 269 { |
270 /* Redirect. */ | 270 /* Redirect. */ |
271 char *location, *c; | 271 char *location, *c; |
272 | 272 |
273 gaim_debug_error("MaYuan", "soap redirect\n"); | 273 purple_debug_error("MaYuan", "soap redirect\n"); |
274 location = strstr(soapconn->read_buf, "Location: "); | 274 location = strstr(soapconn->read_buf, "Location: "); |
275 if (location == NULL) | 275 if (location == NULL) |
276 { | 276 { |
277 msn_soap_free_read_buf(soapconn); | 277 msn_soap_free_read_buf(soapconn); |
278 | 278 |
296 } | 296 } |
297 | 297 |
298 g_free(soapconn->login_host); | 298 g_free(soapconn->login_host); |
299 soapconn->login_host = g_strdup(location); | 299 soapconn->login_host = g_strdup(location); |
300 | 300 |
301 gaim_ssl_connect(session->account, soapconn->login_host, | 301 purple_ssl_connect(session->account, soapconn->login_host, |
302 GAIM_SSL_DEFAULT_PORT, msn_soap_connect_cb, | 302 PURPLE_SSL_DEFAULT_PORT, msn_soap_connect_cb, |
303 msn_soap_error_cb, soapconn); | 303 msn_soap_error_cb, soapconn); |
304 } | 304 } |
305 else if (strstr(soapconn->read_buf, "HTTP/1.1 401 Unauthorized") != NULL) | 305 else if (strstr(soapconn->read_buf, "HTTP/1.1 401 Unauthorized") != NULL) |
306 { | 306 { |
307 const char *error; | 307 const char *error; |
308 | 308 |
309 gaim_debug_error("MaYuan", "soap 401\n"); | 309 purple_debug_error("MaYuan", "soap 401\n"); |
310 if ((error = strstr(soapconn->read_buf, "WWW-Authenticate")) != NULL) | 310 if ((error = strstr(soapconn->read_buf, "WWW-Authenticate")) != NULL) |
311 { | 311 { |
312 if ((error = strstr(error, "cbtxt=")) != NULL) | 312 if ((error = strstr(error, "cbtxt=")) != NULL) |
313 { | 313 { |
314 const char *c; | 314 const char *c; |
318 | 318 |
319 if ((c = strchr(error, '\n')) == NULL) | 319 if ((c = strchr(error, '\n')) == NULL) |
320 c = error + strlen(error); | 320 c = error + strlen(error); |
321 | 321 |
322 temp = g_strndup(error, c - error); | 322 temp = g_strndup(error, c - error); |
323 error = gaim_url_decode(temp); | 323 error = purple_url_decode(temp); |
324 g_free(temp); | 324 g_free(temp); |
325 } | 325 } |
326 } | 326 } |
327 | 327 |
328 msn_session_set_error(session, MSN_ERROR_SERV_UNAVAILABLE, error); | 328 msn_session_set_error(session, MSN_ERROR_SERV_UNAVAILABLE, error); |
335 if(!body_start){ | 335 if(!body_start){ |
336 return; | 336 return; |
337 } | 337 } |
338 body_start += 4; | 338 body_start += 4; |
339 | 339 |
340 // gaim_debug_misc("msn", "Soap Read: {%s}\n", soapconn->read_buf); | 340 // purple_debug_misc("msn", "Soap Read: {%s}\n", soapconn->read_buf); |
341 | 341 |
342 /* we read the content-length*/ | 342 /* we read the content-length*/ |
343 length_start = strstr(soapconn->read_buf, "Content-Length: "); | 343 length_start = strstr(soapconn->read_buf, "Content-Length: "); |
344 length_start += strlen("Content-Length: "); | 344 length_start += strlen("Content-Length: "); |
345 length_end = strstr(length_start, "\r\n"); | 345 length_end = strstr(length_start, "\r\n"); |
347 | 347 |
348 /*setup the conn body */ | 348 /*setup the conn body */ |
349 soapconn->body = body_start; | 349 soapconn->body = body_start; |
350 soapconn->body_len = atoi(body_len); | 350 soapconn->body_len = atoi(body_len); |
351 #ifdef MSN_SOAP_DEBUG | 351 #ifdef MSN_SOAP_DEBUG |
352 gaim_debug_misc("MaYuan","SOAP Read length :%d,body len:%d\n",soapconn->read_len,soapconn->body_len); | 352 purple_debug_misc("MaYuan","SOAP Read length :%d,body len:%d\n",soapconn->read_len,soapconn->body_len); |
353 #endif | 353 #endif |
354 soapconn->need_to_read = (body_start - soapconn->read_buf +soapconn->body_len) - soapconn->read_len; | 354 soapconn->need_to_read = (body_start - soapconn->read_buf +soapconn->body_len) - soapconn->read_len; |
355 if(soapconn->need_to_read >0){ | 355 if(soapconn->need_to_read >0){ |
356 return; | 356 return; |
357 } | 357 } |
358 g_free(body_len); | 358 g_free(body_len); |
359 | 359 |
360 /*remove the read handler*/ | 360 /*remove the read handler*/ |
361 gaim_input_remove(soapconn->input_handler); | 361 purple_input_remove(soapconn->input_handler); |
362 soapconn->input_handler = -1; | 362 soapconn->input_handler = -1; |
363 /* | 363 /* |
364 * close the soap connection,if more soap request came, | 364 * close the soap connection,if more soap request came, |
365 * Just reconnect to do it, | 365 * Just reconnect to do it, |
366 * | 366 * |
400 soapconn->written_len = 0; | 400 soapconn->written_len = 0; |
401 } | 401 } |
402 | 402 |
403 /*Soap write process func*/ | 403 /*Soap write process func*/ |
404 static void | 404 static void |
405 msn_soap_write_cb(gpointer data, gint source, GaimInputCondition cond) | 405 msn_soap_write_cb(gpointer data, gint source, PurpleInputCondition cond) |
406 { | 406 { |
407 MsnSoapConn *soapconn = data; | 407 MsnSoapConn *soapconn = data; |
408 int len, total_len; | 408 int len, total_len; |
409 | 409 |
410 g_return_if_fail(soapconn != NULL); | 410 g_return_if_fail(soapconn != NULL); |
411 if(soapconn->write_buf == NULL){ | 411 if(soapconn->write_buf == NULL){ |
412 gaim_debug_error("MaYuan","soap buffer is NULL\n"); | 412 purple_debug_error("MaYuan","soap buffer is NULL\n"); |
413 gaim_input_remove(soapconn->output_handler); | 413 purple_input_remove(soapconn->output_handler); |
414 soapconn->output_handler = -1; | 414 soapconn->output_handler = -1; |
415 return; | 415 return; |
416 } | 416 } |
417 total_len = strlen(soapconn->write_buf); | 417 total_len = strlen(soapconn->write_buf); |
418 | 418 |
419 /* | 419 /* |
420 * write the content to SSL server, | 420 * write the content to SSL server, |
421 */ | 421 */ |
422 len = gaim_ssl_write(soapconn->gsc, | 422 len = purple_ssl_write(soapconn->gsc, |
423 soapconn->write_buf + soapconn->written_len, | 423 soapconn->write_buf + soapconn->written_len, |
424 total_len - soapconn->written_len); | 424 total_len - soapconn->written_len); |
425 | 425 |
426 if (len < 0 && errno == EAGAIN) | 426 if (len < 0 && errno == EAGAIN) |
427 return; | 427 return; |
428 else if (len <= 0){ | 428 else if (len <= 0){ |
429 /*SSL write error!*/ | 429 /*SSL write error!*/ |
430 gaim_input_remove(soapconn->output_handler); | 430 purple_input_remove(soapconn->output_handler); |
431 soapconn->output_handler = -1; | 431 soapconn->output_handler = -1; |
432 /* TODO: notify of the error */ | 432 /* TODO: notify of the error */ |
433 return; | 433 return; |
434 } | 434 } |
435 soapconn->written_len += len; | 435 soapconn->written_len += len; |
436 | 436 |
437 if (soapconn->written_len < total_len) | 437 if (soapconn->written_len < total_len) |
438 return; | 438 return; |
439 | 439 |
440 gaim_input_remove(soapconn->output_handler); | 440 purple_input_remove(soapconn->output_handler); |
441 soapconn->output_handler = -1; | 441 soapconn->output_handler = -1; |
442 | 442 |
443 /*clear the write buff*/ | 443 /*clear the write buff*/ |
444 msn_soap_free_write_buf(soapconn); | 444 msn_soap_free_write_buf(soapconn); |
445 | 445 |
453 msn_soap_read_cb(soapconn,source,0); | 453 msn_soap_read_cb(soapconn,source,0); |
454 } | 454 } |
455 | 455 |
456 /*write the buffer to SOAP connection*/ | 456 /*write the buffer to SOAP connection*/ |
457 void | 457 void |
458 msn_soap_write(MsnSoapConn * soapconn, char *write_buf, GaimInputFunction written_cb) | 458 msn_soap_write(MsnSoapConn * soapconn, char *write_buf, PurpleInputFunction written_cb) |
459 { | 459 { |
460 soapconn->write_buf = write_buf; | 460 soapconn->write_buf = write_buf; |
461 soapconn->written_len = 0; | 461 soapconn->written_len = 0; |
462 soapconn->written_cb = written_cb; | 462 soapconn->written_cb = written_cb; |
463 | 463 |
464 /*clear the read buffer first*/ | 464 /*clear the read buffer first*/ |
465 /*start the write*/ | 465 /*start the write*/ |
466 soapconn->output_handler = gaim_input_add(soapconn->gsc->fd, GAIM_INPUT_WRITE, | 466 soapconn->output_handler = purple_input_add(soapconn->gsc->fd, PURPLE_INPUT_WRITE, |
467 msn_soap_write_cb, soapconn); | 467 msn_soap_write_cb, soapconn); |
468 msn_soap_write_cb(soapconn, soapconn->gsc->fd, GAIM_INPUT_WRITE); | 468 msn_soap_write_cb(soapconn, soapconn->gsc->fd, PURPLE_INPUT_WRITE); |
469 } | 469 } |
470 | 470 |
471 /* New a soap request*/ | 471 /* New a soap request*/ |
472 MsnSoapReq * | 472 MsnSoapReq * |
473 msn_soap_request_new(const char *host,const char *post_url,const char *soap_action, | 473 msn_soap_request_new(const char *host,const char *post_url,const char *soap_action, |
474 const char *body, | 474 const char *body, |
475 GaimInputFunction read_cb,GaimInputFunction written_cb) | 475 PurpleInputFunction read_cb,PurpleInputFunction written_cb) |
476 { | 476 { |
477 MsnSoapReq *request; | 477 MsnSoapReq *request; |
478 | 478 |
479 request = g_new0(MsnSoapReq, 1); | 479 request = g_new0(MsnSoapReq, 1); |
480 request->id = 0; | 480 request->id = 0; |
531 g_queue_push_tail(soapconn->soap_queue, request); | 531 g_queue_push_tail(soapconn->soap_queue, request); |
532 } | 532 } |
533 if(!msn_soap_connected(soapconn)&&(soapconn->step == MSN_SOAP_UNCONNECTED) | 533 if(!msn_soap_connected(soapconn)&&(soapconn->step == MSN_SOAP_UNCONNECTED) |
534 &&(!g_queue_is_empty(soapconn->soap_queue))){ | 534 &&(!g_queue_is_empty(soapconn->soap_queue))){ |
535 /*not connected?and we have something to process connect it first*/ | 535 /*not connected?and we have something to process connect it first*/ |
536 gaim_debug_info("Ma Yuan","soap is not connected!\n"); | 536 purple_debug_info("Ma Yuan","soap is not connected!\n"); |
537 msn_soap_init_func(soapconn); | 537 msn_soap_init_func(soapconn); |
538 msn_soap_connect(soapconn); | 538 msn_soap_connect(soapconn); |
539 return; | 539 return; |
540 } | 540 } |
541 gaim_debug_info("Ma Yuan","soap connected!\n"); | 541 purple_debug_info("Ma Yuan","soap connected!\n"); |
542 | 542 |
543 /*if connected, what we only needed to do is to queue the request, | 543 /*if connected, what we only needed to do is to queue the request, |
544 * when SOAP request in the queue processed done, will do this command. | 544 * when SOAP request in the queue processed done, will do this command. |
545 * we just waiting... | 545 * we just waiting... |
546 * If we send the request this time,error may occure | 546 * If we send the request this time,error may occure |
557 msn_soap_post_request(MsnSoapConn *soapconn,MsnSoapReq *request) | 557 msn_soap_post_request(MsnSoapConn *soapconn,MsnSoapReq *request) |
558 { | 558 { |
559 char * soap_head = NULL; | 559 char * soap_head = NULL; |
560 char * request_str = NULL; | 560 char * request_str = NULL; |
561 | 561 |
562 gaim_debug_info("MaYuan","msn_soap_post_request()...\n"); | 562 purple_debug_info("MaYuan","msn_soap_post_request()...\n"); |
563 msn_soap_set_process_step(soapconn,MSN_SOAP_PROCESSING); | 563 msn_soap_set_process_step(soapconn,MSN_SOAP_PROCESSING); |
564 soap_head = g_strdup_printf( | 564 soap_head = g_strdup_printf( |
565 "POST %s HTTP/1.1\r\n" | 565 "POST %s HTTP/1.1\r\n" |
566 "SOAPAction: %s\r\n" | 566 "SOAPAction: %s\r\n" |
567 "Content-Type:text/xml; charset=utf-8\r\n" | 567 "Content-Type:text/xml; charset=utf-8\r\n" |
580 ); | 580 ); |
581 request_str = g_strdup_printf("%s%s", soap_head,request->body); | 581 request_str = g_strdup_printf("%s%s", soap_head,request->body); |
582 g_free(soap_head); | 582 g_free(soap_head); |
583 | 583 |
584 #ifdef MSN_SOAP_DEBUG | 584 #ifdef MSN_SOAP_DEBUG |
585 gaim_debug_info("MaYuan","send to server{%s}\n",request_str); | 585 purple_debug_info("MaYuan","send to server{%s}\n",request_str); |
586 #endif | 586 #endif |
587 | 587 |
588 /*free read buffer*/ | 588 /*free read buffer*/ |
589 msn_soap_free_read_buf(soapconn); | 589 msn_soap_free_read_buf(soapconn); |
590 /*post it to server*/ | 590 /*post it to server*/ |