changeset 28650:dab0d17dc6c1

Minor cleanup. gc->prpl is guarranteed to be a PurplePlugin with type PURPLE_PLUGIN_PROTOCOL
author Mark Doliner <mark@kingant.net>
date Tue, 22 Sep 2009 06:01:08 +0000
parents 7983230cc1c0
children e8cd57c14643
files libpurple/connection.c libpurple/server.c libpurple/util.c
diffstat 3 files changed, 10 insertions(+), 19 deletions(-) [+]
line wrap: on
line diff
--- a/libpurple/connection.c	Tue Sep 22 02:12:42 2009 +0000
+++ b/libpurple/connection.c	Tue Sep 22 06:01:08 2009 +0000
@@ -52,10 +52,7 @@
 send_keepalive(gpointer data)
 {
 	PurpleConnection *gc = data;
-	PurplePluginProtocolInfo *prpl_info = NULL;
-
-	if (gc == NULL)
-		return TRUE;
+	PurplePluginProtocolInfo *prpl_info;
 
 	/* Only send keep-alives if we haven't heard from the
 	 * server in a while.
@@ -63,12 +60,8 @@
 	if ((time(NULL) - gc->last_received) < KEEPALIVE_INTERVAL)
 		return TRUE;
 
-	if (gc->prpl == NULL)
-		return TRUE;
-
 	prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(gc->prpl);
-
-	if (prpl_info && prpl_info->keepalive)
+	if (prpl_info->keepalive)
 		prpl_info->keepalive(gc);
 
 	return TRUE;
--- a/libpurple/server.c	Tue Sep 22 02:12:42 2009 +0000
+++ b/libpurple/server.c	Tue Sep 22 06:01:08 2009 +0000
@@ -142,7 +142,7 @@
 
 	conv = purple_find_conversation_with_account(PURPLE_CONV_TYPE_IM, name, account);
 
-	if(prpl_info && prpl_info->send_im)
+	if (prpl_info->send_im)
 		val = prpl_info->send_im(gc, name, message, flags);
 
 	/*
@@ -176,7 +176,7 @@
 	if(prpl)
 		prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(prpl);
 
-	if(gc && prpl_info && prpl_info->get_info)
+	if (prpl_info && prpl_info->get_info)
 		prpl_info->get_info(gc, name);
 }
 
@@ -229,7 +229,7 @@
 	if(prpl)
 		prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(prpl);
 
-	if(b && prpl_info && prpl_info->alias_buddy) {
+	if (prpl_info && prpl_info->alias_buddy) {
 		prpl_info->alias_buddy(gc, purple_buddy_get_name(b), purple_buddy_get_local_buddy_alias(b));
 	}
 }
@@ -367,12 +367,10 @@
 	if(prpl)
 		prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(prpl);
 
-	if(gc && og && ng) {
-		if (prpl_info && prpl_info->group_buddy) {
-			prpl_info->group_buddy(gc, purple_buddy_get_name(b),
-			                       purple_group_get_name(og),
-								   purple_group_get_name(ng));
-		}
+	if (prpl_info && prpl_info->group_buddy) {
+		prpl_info->group_buddy(gc, purple_buddy_get_name(b),
+		                       purple_group_get_name(og),
+							   purple_group_get_name(ng));
 	}
 }
 
--- a/libpurple/util.c	Tue Sep 22 02:12:42 2009 +0000
+++ b/libpurple/util.c	Tue Sep 22 06:01:08 2009 +0000
@@ -3140,7 +3140,7 @@
 		{
 			PurplePluginProtocolInfo *prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(prpl);
 
-			if(prpl_info && prpl_info->normalize)
+			if (prpl_info->normalize)
 				ret = prpl_info->normalize(account, str);
 		}
 	}