pidgin: f0342956: Minor cleanup. gc->prpl is guarranteed ...

markdoliner at pidgin.im markdoliner at pidgin.im
Tue Sep 22 02:07:34 EDT 2009


-----------------------------------------------------------------
Revision: f0342956fb34a6b5eeb65508b9ccbd8a79bde528
Ancestor: 16d8175863cc4377639b973817caa1ca4391087c
Author: markdoliner at pidgin.im
Date: 2009-09-22T06:01:08
Branch: im.pidgin.pidgin
URL: http://d.pidgin.im/viewmtn/revision/info/f0342956fb34a6b5eeb65508b9ccbd8a79bde528

Modified files:
        libpurple/connection.c libpurple/server.c libpurple/util.c

ChangeLog: 

Minor cleanup.  gc->prpl is guarranteed to be a PurplePlugin with
type PURPLE_PLUGIN_PROTOCOL

-------------- next part --------------
============================================================
--- libpurple/connection.c	2c3a9606fb0f4a835820cff037e5ca13eac1a3b5
+++ libpurple/connection.c	56265112fe3e22b67168eb522ffe432d60772546
@@ -52,23 +52,16 @@ send_keepalive(gpointer data)
 send_keepalive(gpointer data)
 {
 	PurpleConnection *gc = data;
-	PurplePluginProtocolInfo *prpl_info = NULL;
+	PurplePluginProtocolInfo *prpl_info;
 
-	if (gc == NULL)
-		return TRUE;
-
 	/* Only send keep-alives if we haven't heard from the
 	 * server in a while.
 	 */
 	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;
============================================================
--- libpurple/server.c	080c1cb559263aca544f49a3f5aaf04b1882594b
+++ libpurple/server.c	883c7aef8d8a3a8479c693364fa5487a9bb342b5
@@ -142,7 +142,7 @@ int serv_send_im(PurpleConnection *gc, c
 
 	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 @@ void serv_get_info(PurpleConnection *gc,
 	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 @@ void serv_alias_buddy(PurpleBuddy *b)
 	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 @@ void serv_move_buddy(PurpleBuddy *b, Pur
 	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));
 	}
 }
 
============================================================
--- libpurple/util.c	7657ccb850736aa92558f17694f5642e49359292
+++ libpurple/util.c	18926393631e24f44ff0a661537c8e5ad031ba58
@@ -3140,7 +3140,7 @@ purple_normalize(const PurpleAccount *ac
 		{
 			PurplePluginProtocolInfo *prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(prpl);
 
-			if(prpl_info && prpl_info->normalize)
+			if (prpl_info->normalize)
 				ret = prpl_info->normalize(account, str);
 		}
 	}


More information about the Commits mailing list