changeset 19826:1d1e5163b0eb

[gaim-migrate @ 17042] Send OIM in a sequence committed by MaYuan<mayuan2006@gmail.com> committer: Ethan Blanton <elb@pidgin.im>
author Ma Yuan <mayuan2006@gmail.com>
date Sat, 26 Aug 2006 09:23:40 +0000
parents 9cc3a3407816
children 349b85feaefa
files src/protocols/msn/contact.c src/protocols/msn/oim.c src/protocols/msn/soap.c
diffstat 3 files changed, 26 insertions(+), 16 deletions(-) [+]
line wrap: on
line diff
--- a/src/protocols/msn/contact.c	Sat Aug 26 08:31:37 2006 +0000
+++ b/src/protocols/msn/contact.c	Sat Aug 26 09:23:40 2006 +0000
@@ -30,6 +30,9 @@
 #include "xmlnode.h"
 #include "group.h"
 
+/*define This to debug the Contact Server*/
+#undef  MSN_CONTACT_SOAP_DEBUG
+
 void msn_contact_connect_init(MsnSoapConn *soapconn);
 
 /*new a contact*/
@@ -207,7 +210,9 @@
 	session = soapconn->session;
 	g_return_if_fail(session != NULL);
 
-//	gaim_debug_misc("msn", "soap contact server Reply: {%s}\n", soapconn->read_buf);
+#ifdef  MSN_CONTACT_SOAP_DEBUG
+	gaim_debug_misc("msn", "soap contact server Reply: {%s}\n", soapconn->read_buf);
+#endif
 	msn_parse_contact_list(contact);
 	/*free the read buffer*/
 	msn_soap_free_read_buf(soapconn);
@@ -463,7 +468,6 @@
 
 	gaim_debug_info("MaYuan","finish contact written\n");
 	soapconn->read_cb = msn_get_address_cb;
-//	msn_soap_read_cb(data,source,cond);
 }
 
 /*get the address book*/
--- a/src/protocols/msn/oim.c	Sat Aug 26 08:31:37 2006 +0000
+++ b/src/protocols/msn/oim.c	Sat Aug 26 09:23:40 2006 +0000
@@ -115,7 +115,6 @@
 	gaim_debug_info("MaYuan","encode OIM Message...\n");	
 	oim_base64 = gaim_base64_encode((const guchar *)body, strlen(body));
 	gaim_debug_info("MaYuan","encoded base64 body:{%s}\n",oim_base64);	
-	gaim_debug_info("MaYuan","url_encode:{%s}\n",gaim_url_encode(body));
 	oim_body = g_strdup_printf(MSN_OIM_MSG_TEMPLATE,
 				oim->run_id,oim->send_seq,oim_base64);
 
@@ -240,11 +239,9 @@
 	char buf[33];
 
 	g_return_if_fail(oim != NULL);
-	gaim_debug_info("MaYuan","queue:{%p}\n",oim->send_queue);
 	oim_request = g_queue_pop_head(oim->send_queue);
-	if(oim_request == NULL){
-		return;
-	}
+	g_return_if_fail(oim_request != NULL);
+
 	gaim_debug_info("MaYuan","send single OIM Message\n");
 	mspauth = g_strdup_printf("t=%s&amp;p=%s",
 		oim->session->passport_info.t,
--- a/src/protocols/msn/soap.c	Sat Aug 26 08:31:37 2006 +0000
+++ b/src/protocols/msn/soap.c	Sat Aug 26 09:23:40 2006 +0000
@@ -26,6 +26,9 @@
 #include "msn.h"
 #include "soap.h"
 
+/*define this Macro to debug soap server action*/
+#define MSN_SOAP_DEBUG
+
 /*local function prototype*/
 void msn_soap_set_process_step(MsnSoapConn *soapconn, MsnSoapStep step);
 
@@ -111,7 +114,6 @@
 	soapconn->ssl_conn = ssl;
 	soapconn->connect_cb = connect_cb;
 	soapconn->error_cb = error_cb;
-	gaim_debug_info("MaYuan","msn_soap_init...done\n");
 }
 
 /*connect the soap connection*/
@@ -214,13 +216,14 @@
 	if(len >0){
 		soapconn->read_buf = g_realloc(soapconn->read_buf,
 						soapconn->read_len + len + 1);
-//		strncpy(soapconn->read_buf + soapconn->read_len, temp_buf, len);
 		memcpy(soapconn->read_buf + soapconn->read_len, temp_buf, len);
 		soapconn->read_len += len;
 		soapconn->read_buf[soapconn->read_len] = '\0';
 	}
+#ifdef MSN_SOAP_DEBUG
 	gaim_debug_info("MaYuan","++soap ssl read:{%d}\n",len);
-//	gaim_debug_info("MaYuan","nexus ssl read:{%s}\n",soapconn->read_buf);
+	gaim_debug_info("MaYuan","nexus ssl read:{%s}\n",soapconn->read_buf);
+#endif
 	return len;
 }
 
@@ -345,16 +348,15 @@
 			/*setup the conn body */
 			soapconn->body		= body_start;
 			soapconn->body_len	= atoi(body_len);
+#ifdef MSN_SOAP_DEBUG
 			gaim_debug_misc("MaYuan","SOAP Read length :%d,body len:%d\n",soapconn->read_len,soapconn->body_len);
-
+#endif
 			soapconn->need_to_read = (body_start - soapconn->read_buf +soapconn->body_len) - soapconn->read_len;
-			if(soapconn->read_len < body_start - soapconn->read_buf + soapconn->body_len){
-//			if(soapconn->need_to_read >0){
+			if(soapconn->need_to_read >0){
 				return;
 			}
 			g_free(body_len);
 
-#if 1
 			/*remove the read handler*/
 			gaim_input_remove(soapconn->input_handler);
 			soapconn->input_handler = -1;
@@ -368,7 +370,6 @@
 			 * Weird!
 			 * */
 			msn_soap_close(soapconn);
-#endif
 
 			/*call the read callback*/
 			if(soapconn->read_cb != NULL){
@@ -538,13 +539,17 @@
 		return;
 	}
 	gaim_debug_info("Ma Yuan","soap  connected!\n");
+
 	/*if connected, what we only needed to do is to queue the request, 
 	 * when SOAP request in the queue processed done, will do this command.
 	 * we just waiting...
+	 * If we send the request this time,error may occure
 	 */
+#if 0
 	if(soapconn->step == MSN_SOAP_CONNECTED_IDLE){
 		msn_soap_post_head_request(soapconn);
 	}
+#endif
 }
 
 /*Post the soap request action*/
@@ -576,9 +581,13 @@
 	request_str = g_strdup_printf("%s%s", soap_head,request->body);
 	g_free(soap_head);
 
+#ifdef MSN_SOAP_DEBUG
+	gaim_debug_info("MaYuan","send to  server{%s}\n",request_str);
+#endif
+
 	/*free read buffer*/
 	msn_soap_free_read_buf(soapconn);
-	gaim_debug_info("MaYuan","send to  server{%s}\n",request_str);
+	/*post it to server*/
 	msn_soap_write(soapconn,request_str,request->written_cb);
 }