cpw.qulogic.msn: 86d2aabc: Get rid of that whole msn_set_payload_le...
qulogic at pidgin.im
qulogic at pidgin.im
Tue Jul 8 22:26:11 EDT 2008
-----------------------------------------------------------------
Revision: 86d2aabc8c0973823a48a28d3c74e0a8b988d8dd
Ancestor: 3176b20f2adc48a505c7b33388b79b091c8c83ae
Author: qulogic at pidgin.im
Date: 2008-07-09T01:46:10
Branch: im.pidgin.cpw.qulogic.msn
URL: http://d.pidgin.im/viewmtn/revision/info/86d2aabc8c0973823a48a28d3c74e0a8b988d8dd
Modified files:
libpurple/protocols/msn/command.c
libpurple/protocols/msn/notification.c
libpurple/protocols/msn/switchboard.c
ChangeLog:
Get rid of that whole msn_set_payload_len thing and correctly set the
cmd->payload_len in each command handler callback. This should take
care of that CAL 3 error and a few sporadic "unhandled commands" I saw
while testing HTTP method.
References #5377.
-------------- next part --------------
============================================================
--- libpurple/protocols/msn/command.c 5c706023ef1e6a4154625f275ff874f51b54a33a
+++ libpurple/protocols/msn/command.c 4fcae296d3a68be6c4e108944473b0b1f1038a16
@@ -36,57 +36,6 @@ is_num(const char *str)
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 gboolean
-msn_set_payload_len(MsnCommand *cmd)
-{
- char *param;
- int len = 0;
- gboolean has_payload = FALSE;
-
- 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;
- has_payload = TRUE;
- }
-
- cmd->payload_len = len;
-
- return has_payload;
-}
-
MsnCommand *
msn_command_from_string(const char *string)
{
@@ -124,11 +73,6 @@ msn_command_from_string(const char *stri
cmd->trId = 0;
}
- /* khc: Huh! */
- /*add payload Length checking*/
- if (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;
============================================================
--- libpurple/protocols/msn/notification.c 130be3aa14e0711d8577ef99a64ec65eebf82df7
+++ libpurple/protocols/msn/notification.c df04a4e5bc06fa83590ced64249c872e852c16d5
@@ -376,14 +376,12 @@ msg_cmd(MsnCmdProc *cmdproc, MsnCommand
msg_cmd(MsnCmdProc *cmdproc, MsnCommand *cmd)
{
purple_debug_info("MSNP14","Processing MSG... \n");
- if (cmd->payload_len == 0) {
- return;
- }
+
/* NOTE: cmd is not always cmdproc->last_cmd, sometimes cmd is a queued
* command and we are processing it */
if (cmd->payload == NULL) {
cmdproc->last_cmd->payload_cb = msg_cmd_post;
- cmdproc->servconn->payload_len = atoi(cmd->params[2]);
+ cmd->payload_len = atoi(cmd->params[2]);
} else {
g_return_if_fail(cmd->payload_cb != NULL);
@@ -499,14 +497,12 @@ ubm_cmd(MsnCmdProc *cmdproc, MsnCommand
ubm_cmd(MsnCmdProc *cmdproc, MsnCommand *cmd)
{
purple_debug_info("MSNP14","Processing UBM... \n");
- if (cmd->payload_len == 0) {
- return;
- }
+
/* NOTE: cmd is not always cmdproc->last_cmd, sometimes cmd is a queued
* command and we are processing it */
- if (cmd->payload == NULL ){
- cmdproc->last_cmd->payload_cb = msg_cmd_post;
- cmdproc->servconn->payload_len = atoi(cmd->params[4]);
+ if (cmd->payload == NULL) {
+ cmdproc->last_cmd->payload_cb = msg_cmd_post;
+ cmd->payload_len = atoi(cmd->params[4]);
} else {
g_return_if_fail(cmd->payload_cb != NULL);
@@ -771,11 +767,12 @@ adl_cmd(MsnCmdProc *cmdproc, MsnCommand
session = cmdproc->session;
- if ( !strcmp(cmd->params[1], "OK")) {
+ if (!strcmp(cmd->params[1], "OK")) {
/* ADL ack */
msn_session_finish_login(session);
} else {
cmdproc->last_cmd->payload_cb = adl_cmd_parse;
+ cmd->payload_len = atoi(cmd->params[1]);
}
return;
@@ -814,24 +811,23 @@ fqy_cmd(MsnCmdProc *cmdproc, MsnCommand
{
purple_debug_info("MSNP14","Process FQY\n");
cmdproc->last_cmd->payload_cb = fqy_cmd_post;
+ cmd->payload_len = atoi(cmd->params[1]);
}
static void
-rml_cmd(MsnCmdProc *cmdproc, MsnCommand *cmd)
+rml_cmd_post(MsnCmdProc *cmdproc, MsnCommand *cmd, char *payload,
+ size_t len)
{
-#if 0
- MsnTransaction *trans;
- char * payload;
-#endif
+ if (payload != NULL)
+ purple_debug_info("msn", "Received RML:\n%s\n", payload);
+}
+static void
+rml_cmd(MsnCmdProc *cmdproc, MsnCommand *cmd)
+{
purple_debug_info("MSNP14","Process RML\n");
-#if 0
- trans = msn_transaction_new(cmdproc, "RML","");
-
- msn_transaction_set_payload(trans, payload, strlen(payload));
-
- msn_cmdproc_send_trans(cmdproc, trans);
-#endif
+ cmd->payload_len = atoi(cmd->params[1]);
+ cmdproc->last_cmd->payload_cb = rml_cmd_post;
}
static void
@@ -1098,7 +1094,7 @@ ipg_cmd(MsnCmdProc *cmdproc, MsnCommand
static void
ipg_cmd(MsnCmdProc *cmdproc, MsnCommand *cmd)
{
- cmdproc->servconn->payload_len = atoi(cmd->params[0]);
+ cmd->payload_len = atoi(cmd->params[0]);
cmdproc->last_cmd->payload_cb = ipg_cmd_post;
}
@@ -1640,8 +1636,9 @@ gcf_cmd(MsnCmdProc *cmdproc, MsnCommand
gcf_cmd(MsnCmdProc *cmdproc, MsnCommand *cmd)
{
purple_debug_info("MSNP14","Processing GCF command\n");
+
cmdproc->last_cmd->payload_cb = gcf_cmd_post;
- return;
+ cmd->payload_len = atoi(cmd->params[1]);
}
static void
@@ -1697,16 +1694,25 @@ ubx_cmd(MsnCmdProc *cmdproc, MsnCommand
ubx_cmd(MsnCmdProc *cmdproc, MsnCommand *cmd)
{
purple_debug_misc("MSNP14","UBX received.\n");
- if(cmd->payload_len == 0){
- return;
- }
cmdproc->last_cmd->payload_cb = ubx_cmd_post;
+ cmd->payload_len = atoi(cmd->params[2]);
}
static void
+uux_cmd_post(MsnCmdProc *cmdproc, MsnCommand *cmd, char *payload,
+ size_t len)
+{
+ /* Do Nothing, right now. */
+ if (payload != NULL)
+ purple_debug_info("msn", "UUX payload:\n%s\n", payload);
+}
+
+static void
uux_cmd(MsnCmdProc *cmdproc, MsnCommand *cmd)
{
- purple_debug_misc("MSNP14","UUX received.\n");
+ purple_debug_misc("msn", "UUX received.\n");
+ cmdproc->last_cmd->payload_cb = uux_cmd_post;
+ cmd->payload_len = atoi(cmd->params[1]);
}
/**************************************************************************
============================================================
--- libpurple/protocols/msn/switchboard.c bbb567925c8db48b823cf3ca1fd595aab149b68b
+++ libpurple/protocols/msn/switchboard.c e1620a3daec10ff7ea5e83255f61e61585610a4e
@@ -752,7 +752,7 @@ msg_cmd(MsnCmdProc *cmdproc, MsnCommand
static void
msg_cmd(MsnCmdProc *cmdproc, MsnCommand *cmd)
{
- cmdproc->servconn->payload_len = atoi(cmd->params[2]);
+ cmd->payload_len = atoi(cmd->params[2]);
cmdproc->last_cmd->payload_cb = msg_cmd_post;
}
@@ -760,7 +760,7 @@ ubm_cmd(MsnCmdProc *cmdproc, MsnCommand
ubm_cmd(MsnCmdProc *cmdproc, MsnCommand *cmd)
{
purple_debug_misc("MSNP14","get UBM...\n");
- cmdproc->servconn->payload_len = atoi(cmd->params[4]);
+ cmd->payload_len = atoi(cmd->params[4]);
cmdproc->last_cmd->payload_cb = msg_cmd_post;
}
More information about the Commits
mailing list