diff libpurple/protocols/msn/command.c @ 20439:bee467c81570

A bunch of MSNP14 stuff: Don't store the group id on the group blist node. Fix & tidy up payload length detection for commands (errors can have payloads too) Avoid a crash when connecting to a new account with no contact list Tidy up addressbook parsing slightly Fix crashes when buddy list sync issues are detected Fix initial email notifications, Fixes #1293 Plug a few memory leaks Detect OIM authentication failures correctly NOTE: I have disabled dynamic address book retrieval, instead we now receive the whole address book. This is because the blist sync stuff is still very wonky.
author Stu Tomlinson <stu@nosnilmot.com>
date Sun, 27 May 2007 17:00:06 +0000
parents 0d67ac110e2b
children 530a92d50c5e
line wrap: on
line diff
--- a/libpurple/protocols/msn/command.c	Sun May 27 11:23:09 2007 +0000
+++ b/libpurple/protocols/msn/command.c	Sun May 27 17:00:06 2007 +0000
@@ -24,10 +24,6 @@
 #include "msn.h"
 #include "command.h"
 
-/*local Function prototype*/
-static int msn_get_payload_position(char *str);
-static int msn_set_payload_len(MsnCommand *cmd);
-
 static gboolean
 is_num(char *str)
 {
@@ -59,51 +55,29 @@
 		(!strcmp(str,"UBM")) ||
 		(!strcmp(str,"FQY")) ||
 		(!strcmp(str,"UUN")) ||
-		(!strcmp(str,"UUX"))){
+		(!strcmp(str,"UUX")) ||
+		(is_num(str))){
 			return TRUE;
 		}
 
 	return FALSE;
 }
 
-/*get the payload positon*/
-static int msn_get_payload_position(char *str)
-{
-	/*because MSG has "MSG hotmail hotmail [payload length]"*/
-	if(!(strcmp(str,"MSG"))|| (!strcmp(str,"UBX")) ){
-		return 2;
-	}
-	/*Yahoo User Message UBM 
-	 * Format UBM email@yahoo.com 32 1 [payload length]*/
-	if(!(strcmp(str,"UBM"))|| (!strcmp(str,"UUM")) ){
-		return 3;
-	}
-
-	return 1;
-}
-
 /*
  * set command Payload length
  */
-static int
+static void
 msn_set_payload_len(MsnCommand *cmd)
 {
-	char * param;
+	char *param;
+	int len = 0;
 
-	if(msn_check_payload_cmd(cmd->command)){
-		param = cmd->params[msn_get_payload_position(cmd->command)];
-#if 0
-		if(!(strcmp(cmd->command,"MSG"))){
-			param = cmd->params[2];
-		}else{
-			param = cmd->params[1];
-		}
-#endif
-		cmd->payload_len = is_num(param) ? atoi(param) : 0;
-	}else{
-		cmd->payload_len = 0;
+	if (msn_check_payload_cmd(cmd->command) && (cmd->param_count > 0)){
+		param = cmd->params[cmd->param_count - 1];
+		len = is_num(param) ? atoi(param) : 0;
 	}
-	return 0;
+
+	cmd->payload_len = len;
 }
 
 MsnCommand *