--- a/libpurple/protocols/msn/command.c Wed Jul 16 21:42:13 2008 +0000 +++ b/libpurple/protocols/msn/command.c Wed Jul 16 21:55:08 2008 +0000 @@ -36,53 +36,6 @@ return TRUE; } -/* - * check the command is the command with payload content - * if it is return TRUE - * else return FALSE - */ -static gboolean -msn_check_payload_cmd(const char *str) -{ - g_return_val_if_fail(str != NULL, FALSE); - - if((!strcmp(str,"ADL")) || - (!strcmp(str,"GCF")) || - (!strcmp(str,"SG")) || - (!strcmp(str,"MSG")) || - (!strcmp(str,"RML")) || - (!strcmp(str,"UBX")) || - (!strcmp(str,"UBN")) || - (!strcmp(str,"UUM")) || - (!strcmp(str,"UBM")) || - (!strcmp(str,"FQY")) || - (!strcmp(str,"UUN")) || - (!strcmp(str,"UUX")) || - (!strcmp(str,"IPG")) || - (is_num(str))){ - return TRUE; - } - - return FALSE; -} - -/* - * set command Payload length - */ -static void -msn_set_payload_len(MsnCommand *cmd) -{ - char *param; - int 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; - } - - cmd->payload_len = len; -} - MsnCommand * msn_command_from_string(const char *string) { @@ -98,31 +51,28 @@ if (param_start) { *param_start++ = '\0'; - cmd->params = g_strsplit(param_start, " ", 0); + cmd->params = g_strsplit_set(param_start, " ", 0); } if (cmd->params != NULL) { - char *param; int c; - for (c = 0; cmd->params[c]; c++); + for (c = 0; cmd->params[c] && cmd->params[c][0]; c++); cmd->param_count = c; - param = cmd->params[0]; - - cmd->trId = is_num(param) ? atoi(param) : 0; + if (cmd->param_count) { + char *param = cmd->params[0]; + cmd->trId = is_num(param) ? atoi(param) : 0; + } else { + cmd->trId = 0; + } } else { cmd->trId = 0; } - /* khc: Huh! */ - /*add payload Length checking*/ - msn_set_payload_len(cmd); - purple_debug_info("MSNP14","get payload len:%" G_GSIZE_FORMAT "\n", cmd->payload_len); - msn_command_ref(cmd); return cmd;