changeset 19771: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 2e078c892e0b
files src/protocols/msn/notification.c src/protocols/msn/oim.c src/protocols/msn/soap.c
diffstat 3 files changed, 38 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/src/protocols/msn/notification.c	Tue Aug 22 06:10:01 2006 +0000
+++ b/src/protocols/msn/notification.c	Tue Aug 22 16:13:43 2006 +0000
@@ -419,8 +419,8 @@
 	gaim_debug_info("MaYuan","send UUM,payload{%s},strlen:%d,len:%d\n",
 		payload,strlen(payload),payload_len);
 	type = msg->type;
-	trans = msn_transaction_new(cmdproc, "UUM","%s 32 %d %d",msg->remote_user,type,payload_len);
-	msn_transaction_set_payload(trans, payload, payload_len);
+	trans = msn_transaction_new(cmdproc, "UUM","%s 32 %d %d",msg->remote_user,type,strlen(payload));
+	msn_transaction_set_payload(trans, payload, strlen(payload));
 	msn_cmdproc_send_trans(cmdproc, trans);
 }
 
--- a/src/protocols/msn/oim.c	Tue Aug 22 06:10:01 2006 +0000
+++ b/src/protocols/msn/oim.c	Tue Aug 22 16:13:43 2006 +0000
@@ -163,7 +163,7 @@
 	session = soapconn->session;
 	g_return_if_fail(session != NULL);
 
-	msn_session_set_error(session, MSN_ERROR_SERV_DOWN, _("Unable to connect to OIM server"));
+//	msn_session_set_error(session, MSN_ERROR_SERV_DOWN, _("Unable to connect to OIM server"));
 }
 
 /*msn oim SOAP server connect process*/
@@ -188,13 +188,44 @@
 msn_oim_report_to_user(MsnOim *oim,char *msg_str)
 {
 	MsnMessage *message;
-	char * end,*endline;
+	char *date,*from,*decode_msg;
+	gsize body_len;
+	char **tokens;
+	char *start,*end;
+	int has_nick = 0;
+	char *passport_str,*passport;
 
 	message = msn_message_new(MSN_MSG_UNKNOWN);
 
 	msn_message_parse_payload(message,msg_str,strlen(msg_str),
 					MSG_OIM_LINE_DEM, MSG_OIM_BODY_DEM);
 	gaim_debug_info("MaYuan","oim body:{%s}\n",message->body);
+	decode_msg = gaim_base64_decode(message->body,&body_len);
+	date =	(char *)g_hash_table_lookup(message->attr_table, "Date");
+	from =	(char *)g_hash_table_lookup(message->attr_table, "From");
+	if(strstr(from," ")){
+		has_nick = 1;
+	}
+	if(has_nick){
+		tokens = g_strsplit(from , " " , 2);
+		passport_str = g_strdup(tokens[1]);
+		gaim_debug_info("MaYuan","oim Date:{%s},nickname:{%s},tokens[1]:{%s} passport{%s}\n",
+							date,tokens[0],tokens[1],passport_str);
+		g_strfreev(tokens);
+	}else{
+		passport_str = g_strdup(from);
+		gaim_debug_info("MaYuan","oim Date:{%s},passport{%s}\n",
+					date,passport_str);
+	}
+	start = strstr(passport_str,"<");
+	start += 1;
+	end = strstr(passport_str,">");
+	passport = g_strndup(start,end - start);
+	g_free(passport_str);
+	gaim_debug_info("MaYuan","oim Date:{%s},passport{%s}\n",date,passport);
+
+	msn_session_report_user(oim->session,passport,decode_msg,GAIM_MESSAGE_SYSTEM);
+	g_free(passport);
 }
 
 void
--- a/src/protocols/msn/soap.c	Tue Aug 22 06:10:01 2006 +0000
+++ b/src/protocols/msn/soap.c	Tue Aug 22 16:13:43 2006 +0000
@@ -89,13 +89,15 @@
 msn_soap_error_cb(GaimSslConnection *gsc, GaimSslErrorType error, void *data)
 {	
 	MsnSoapConn * soapconn = data;
+
 	g_return_if_fail(data != NULL);
 	gaim_debug_info("MaYuan","Soap connection error!\n");
+	msn_soap_set_process_step(soapconn, MSN_SOAP_UNCONNECTED);
+
 	/*error callback*/
 	if(soapconn->error_cb != NULL){
 		soapconn->error_cb(gsc,error,data);
 	}
-	msn_soap_set_process_step(soapconn, MSN_SOAP_UNCONNECTED);
 }
 
 /*init the soap connection*/