changeset 28243:28485b9ea656

Simplify. A lot of these checks aren't necessary because msn_table_new() always creates these hash tables.
author Mark Doliner <mark@kingant.net>
date Thu, 13 Aug 2009 02:32:33 +0000
parents e0dc076ba642
children c93ed4d7cabe
files libpurple/protocols/msn/cmdproc.c
diffstat 1 files changed, 16 insertions(+), 27 deletions(-) [+]
line wrap: on
line diff
--- a/libpurple/protocols/msn/cmdproc.c	Thu Aug 13 02:24:55 2009 +0000
+++ b/libpurple/protocols/msn/cmdproc.c	Thu Aug 13 02:32:33 2009 +0000
@@ -333,49 +333,38 @@
 			trans->timer = 0;
 		}
 
-	if (g_ascii_isdigit(cmd->command[0]))
+	if (g_ascii_isdigit(cmd->command[0]) && trans != NULL)
 	{
-		if (trans != NULL)
-		{
-			MsnErrorCb error_cb;
-			int error;
+		MsnErrorCb error_cb;
+		int error;
 
-			error = atoi(cmd->command);
+		error = atoi(cmd->command);
 
-			error_cb = trans->error_cb;
-			if (error_cb == NULL)
-				error_cb = g_hash_table_lookup(cmdproc->cbs_table->errors, trans->command);
+		error_cb = trans->error_cb;
+		if (error_cb == NULL)
+			error_cb = g_hash_table_lookup(cmdproc->cbs_table->errors, trans->command);
 
-			if (error_cb != NULL)
-				error_cb(cmdproc, trans, error);
-			else
-				msn_error_handle(cmdproc->session, error);
+		if (error_cb != NULL)
+			error_cb(cmdproc, trans, error);
+		else
+			msn_error_handle(cmdproc->session, error);
 
-			return;
-		}
+		return;
 	}
 
-	if (cmdproc->cbs_table->async != NULL)
-		cb = g_hash_table_lookup(cmdproc->cbs_table->async, cmd->command);
+	cb = g_hash_table_lookup(cmdproc->cbs_table->async, cmd->command);
 
-	if (cb == NULL && trans != NULL)
-	{
-		if (trans->callbacks != NULL)
-			cb = g_hash_table_lookup(trans->callbacks, cmd->command);
-	}
+	if (cb == NULL && trans != NULL && trans->callbacks != NULL)
+		cb = g_hash_table_lookup(trans->callbacks, cmd->command);
 
-	if (cb == NULL && cmdproc->cbs_table->fallback != NULL)
+	if (cb == NULL)
 		cb = g_hash_table_lookup(cmdproc->cbs_table->fallback, cmd->command);
 
 	if (cb != NULL)
-	{
 		cb(cmdproc, cmd);
-	}
 	else
-	{
 		purple_debug_warning("msn", "Unhandled command '%s'\n",
 						   cmd->command);
-	}
 
 	if (trans != NULL && trans->pendent_cmd != NULL)
 		msn_transaction_unqueue_cmd(trans, cmdproc);