changeset 19796:21cb7a79ac7f

[gaim-migrate @ 17523] accurate with the Offline Message send's Fault Code recognize and resend the OIM Get Message. committed by MaYuan<mayuan2006@gmail.com> committer: Ethan Blanton <elb@pidgin.im>
author Ma Yuan <mayuan2006@gmail.com>
date Wed, 18 Oct 2006 16:28:51 +0000
parents 6fc33ac621d9
children e354528c4163
files src/protocols/msn/msg.c src/protocols/msn/notification.c src/protocols/msn/oim.c
diffstat 3 files changed, 32 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/src/protocols/msn/msg.c	Sun Oct 15 13:26:34 2006 +0000
+++ b/src/protocols/msn/msg.c	Wed Oct 18 16:28:51 2006 +0000
@@ -215,7 +215,7 @@
 	char **elems, **cur, **tokens;
 
 	g_return_if_fail(payload != NULL);
-	gaim_debug_info("MaYuan","payload:{%s}\n",payload);
+//	gaim_debug_info("MaYuan","payload:{%s}\n",payload);
 	tmp_base = tmp = g_malloc0(payload_len + 1);
 	memcpy(tmp_base, payload, payload_len);
 
--- a/src/protocols/msn/notification.c	Sun Oct 15 13:26:34 2006 +0000
+++ b/src/protocols/msn/notification.c	Wed Oct 18 16:28:51 2006 +0000
@@ -1409,7 +1409,7 @@
 	const char *passport, *psm_str;
 
 	/*get the payload content*/
-	gaim_debug_info("MaYuan","UBX {%s} payload{%s}\n",cmd->params[0], cmd->payload);
+//	gaim_debug_info("MaYuan","UBX {%s} payload{%s}\n",cmd->params[0], cmd->payload);
 
 	session = cmdproc->session;
 	account = session->account;
--- a/src/protocols/msn/oim.c	Sun Oct 15 13:26:34 2006 +0000
+++ b/src/protocols/msn/oim.c	Wed Oct 18 16:28:51 2006 +0000
@@ -157,8 +157,10 @@
 void
 msn_oim_send_process(MsnOim *oim,char *body,int len)
 {
-	xmlnode *responseNode,*bodyNode,*faultNode;
+	xmlnode *responseNode,*bodyNode;
+	xmlnode	*faultNode,*faultCodeNode,*faultstringNode;
 	xmlnode *detailNode,*challengeNode;
+	char *faultCodeStr,*faultstring;
 	char *challenge;
 
 	responseNode = xmlnode_from_str(body,len);
@@ -178,18 +180,43 @@
 		return;
 	}
 	/*get the challenge,and repost it*/
+	faultCodeNode = xmlnode_get_child(faultNode,"faultcode");
+	if(faultCodeNode == NULL){
+		gaim_debug_info("MaYuan","faultcode Node is NULL\n");
+		goto oim_send_process_fail;
+	}
+	faultCodeStr = xmlnode_get_data(faultCodeNode);
+	gaim_debug_info("MaYuan","fault code:{%s}\n",faultCodeStr);
+
+	if(strcmp(faultCodeStr,"q0:AuthenticationFailed")){
+		/*other Fault Reason?*/
+		goto oim_send_process_fail;
+	}
+
+	faultstringNode = xmlnode_get_child(faultNode,"faultstring");
+	faultstring = xmlnode_get_data(faultstringNode);
+	gaim_debug_info("MaYuan","fault string :{%s}\n",faultstring);
+
+	/* lock key fault reason,
+	 * compute the challenge and resend it
+	 */
 	detailNode = xmlnode_get_child(faultNode, "detail");
+	if(detailNode == NULL){
+			goto oim_send_process_fail;
+	}
 	challengeNode = xmlnode_get_child(detailNode,"LockKeyChallenge");
 
 	g_free(oim->challenge);
 	oim->challenge = xmlnode_get_data(challengeNode);
 	gaim_debug_info("MaYuan","lockkey:{%s}\n",oim->challenge);
 
-	xmlnode_free(responseNode);
-
 	/*repost the send*/
 	gaim_debug_info("MaYuan","prepare to repost the send...\n");
 	msn_oim_send_msg(oim);
+
+oim_send_process_fail:
+	xmlnode_free(responseNode);
+	return ;
 }
 
 static void