changeset 14607:f23506e8f812

[gaim-migrate @ 17335] Get rid of some checks to make sure gc is valid. They shouldn't be necessary (and a lot of them were poorly implemented anyway). Let me know if you notice any crashes. committer: Tailor Script <tailor@pidgin.im>
author Mark Doliner <mark@kingant.net>
date Fri, 22 Sep 2006 05:42:01 +0000
parents a35ed72bf50a
children 98776da658d1
files libgaim/account.c libgaim/connection.c libgaim/privacy.c libgaim/protocols/jabber/buddy.c libgaim/server.c
diffstat 5 files changed, 20 insertions(+), 38 deletions(-) [+]
line wrap: on
line diff
--- a/libgaim/account.c	Thu Sep 21 21:56:19 2006 +0000
+++ b/libgaim/account.c	Fri Sep 22 05:42:01 2006 +0000
@@ -1141,11 +1141,8 @@
 	GaimConnection *gc;
 
 	gaim_account_set_user_info(account, user_info);
-
 	gc = gaim_account_get_connection(account);
-
-	if (gc != NULL)
-		serv_set_info(gc, user_info);
+	serv_set_info(gc, user_info);
 }
 
 void
@@ -1959,8 +1956,7 @@
 	if (gc != NULL && gc->prpl != NULL)
 		prpl_info = GAIM_PLUGIN_PROTOCOL_INFO(gc->prpl);
 
-	if (prpl_info != NULL && g_list_find(gaim_connections_get_all(), gc) &&
-			prpl_info->add_buddy != NULL)
+	if (prpl_info != NULL && prpl_info->add_buddy != NULL)
 		prpl_info->add_buddy(gc, buddy, gaim_buddy_get_group(buddy));
 }
 
@@ -1973,7 +1969,7 @@
 	if (gc != NULL && gc->prpl != NULL)
 		prpl_info = GAIM_PLUGIN_PROTOCOL_INFO(gc->prpl);
 
-	if (prpl_info && g_list_find(gaim_connections_get_all(), gc)) {
+	if (prpl_info) {
 		GList *cur, *groups = NULL;
 
 		/* Make a list of what group each buddy is in */
@@ -2008,7 +2004,7 @@
 	if (gc != NULL && gc->prpl != NULL)
 		prpl_info = GAIM_PLUGIN_PROTOCOL_INFO(gc->prpl);
 
-	if (prpl_info && g_list_find(gaim_connections_get_all(), gc) && prpl_info->remove_buddy)
+	if (prpl_info && prpl_info->remove_buddy)
 		prpl_info->remove_buddy(gc, buddy, group);
 }
 
@@ -2018,13 +2014,10 @@
 	GaimPluginProtocolInfo *prpl_info = NULL;
 	GaimConnection *gc = gaim_account_get_connection(account);
 
-	if (!g_list_find(gaim_connections_get_all(), gc))
-		return;
-
 	if (gc != NULL && gc->prpl != NULL)
 		prpl_info = GAIM_PLUGIN_PROTOCOL_INFO(gc->prpl);
 
-	if (prpl_info && g_list_find(gaim_connections_get_all(), gc)) {
+	if (prpl_info) {
 		if (prpl_info->remove_buddies)
 			prpl_info->remove_buddies(gc, buddies, groups);
 		else {
@@ -2048,7 +2041,7 @@
 	if (gc != NULL && gc->prpl != NULL)
 		prpl_info = GAIM_PLUGIN_PROTOCOL_INFO(gc->prpl);
 
-	if (prpl_info && g_list_find(gaim_connections_get_all(), gc) && prpl_info->remove_group)
+	if (prpl_info && prpl_info->remove_group)
 		prpl_info->remove_group(gc, group);
 }
 
@@ -2064,7 +2057,7 @@
 	if (gc != NULL && gc->prpl != NULL)
 		prpl_info = GAIM_PLUGIN_PROTOCOL_INFO(gc->prpl);
 
-	if (prpl_info && g_list_find(gaim_connections_get_all(), gc) && prpl_info->change_passwd)
+	if (prpl_info && prpl_info->change_passwd)
 		prpl_info->change_passwd(gc, orig_pw, new_pw);
 }
 
--- a/libgaim/connection.c	Thu Sep 21 21:56:19 2006 +0000
+++ b/libgaim/connection.c	Fri Sep 22 05:42:01 2006 +0000
@@ -428,7 +428,6 @@
 	GaimConnectionUiOps *ops;
 
 	g_return_if_fail(gc   != NULL);
-	g_return_if_fail(GAIM_CONNECTION_IS_VALID(gc));
 	g_return_if_fail(text != NULL);
 
 	/* If we've already got one error, we don't need any more */
--- a/libgaim/privacy.c	Thu Sep 21 21:56:19 2006 +0000
+++ b/libgaim/privacy.c	Fri Sep 22 05:42:01 2006 +0000
@@ -46,10 +46,10 @@
 			break;
 	}
 
- 	if (l != NULL)
+	if (l != NULL)
 	{
 		g_free(name);
- 		return FALSE;
+		return FALSE;
 	}
 
 	account->permit = g_slist_append(account->permit, name);
--- a/libgaim/protocols/jabber/buddy.c	Thu Sep 21 21:56:19 2006 +0000
+++ b/libgaim/protocols/jabber/buddy.c	Fri Sep 22 05:42:01 2006 +0000
@@ -506,14 +506,8 @@
 	p = xmlnode_to_str(vc_node, NULL);
 	xmlnode_free(vc_node);
 
-	if (gc != NULL) {
-		GaimAccount *account = gaim_connection_get_account(gc);
-
-		if (account != NULL) {
-			gaim_account_set_user_info(account, p);
-			serv_set_info(gc, p);
-		}
-	}
+	gaim_account_set_user_info(gaim_connection_get_account(gc), p);
+	serv_set_info(gc, p);
 
 	g_free(p);
 }
--- a/libgaim/server.c	Thu Sep 21 21:56:19 2006 +0000
+++ b/libgaim/server.c	Fri Sep 22 05:42:01 2006 +0000
@@ -173,8 +173,7 @@
 	if (gc != NULL && gc->prpl != NULL)
 		prpl_info = GAIM_PLUGIN_PROTOCOL_INFO(gc->prpl);
 
-	if (prpl_info && g_list_find(gaim_connections_get_all(), gc) &&
-		prpl_info->set_info) {
+	if (prpl_info && prpl_info->set_info) {
 
 		account = gaim_connection_get_account(gc);
 
@@ -270,7 +269,7 @@
 	if (g != NULL && g->prpl != NULL)
 		prpl_info = GAIM_PLUGIN_PROTOCOL_INFO(g->prpl);
 
-	if (prpl_info && g_list_find(gaim_connections_get_all(), g) && prpl_info->add_permit)
+	if (prpl_info && prpl_info->add_permit)
 		prpl_info->add_permit(g, name);
 }
 
@@ -281,7 +280,7 @@
 	if (g != NULL && g->prpl != NULL)
 		prpl_info = GAIM_PLUGIN_PROTOCOL_INFO(g->prpl);
 
-	if (prpl_info && g_list_find(gaim_connections_get_all(), g) && prpl_info->add_deny)
+	if (prpl_info && prpl_info->add_deny)
 		prpl_info->add_deny(g, name);
 }
 
@@ -292,7 +291,7 @@
 	if (g != NULL && g->prpl != NULL)
 		prpl_info = GAIM_PLUGIN_PROTOCOL_INFO(g->prpl);
 
-	if (prpl_info && g_list_find(gaim_connections_get_all(), g) && prpl_info->rem_permit)
+	if (prpl_info && prpl_info->rem_permit)
 		prpl_info->rem_permit(g, name);
 }
 
@@ -303,7 +302,7 @@
 	if (g != NULL && g->prpl != NULL)
 		prpl_info = GAIM_PLUGIN_PROTOCOL_INFO(g->prpl);
 
-	if (prpl_info && g_list_find(gaim_connections_get_all(), g) && prpl_info->rem_deny)
+	if (prpl_info && prpl_info->rem_deny)
 		prpl_info->rem_deny(g, name);
 }
 
@@ -320,7 +319,7 @@
 	 * in the prefs. In either case you should probably be resetting and
 	 * resending the permit/deny info when you get this.
 	 */
-	if (prpl_info && g_list_find(gaim_connections_get_all(), g) && prpl_info->set_permit_deny)
+	if (prpl_info && prpl_info->set_permit_deny)
 		prpl_info->set_permit_deny(g);
 }
 
@@ -331,7 +330,7 @@
 	if (g != NULL && g->prpl != NULL)
 		prpl_info = GAIM_PLUGIN_PROTOCOL_INFO(g->prpl);
 
-	if (prpl_info && g_list_find(gaim_connections_get_all(), g) && prpl_info->join_chat)
+	if (prpl_info && prpl_info->join_chat)
 		prpl_info->join_chat(g, data);
 }
 
@@ -343,7 +342,7 @@
 	if (g != NULL && g->prpl != NULL)
 		prpl_info = GAIM_PLUGIN_PROTOCOL_INFO(g->prpl);
 
-	if (prpl_info && g_list_find(gaim_connections_get_all(), g) && prpl_info->reject_chat)
+	if (prpl_info && prpl_info->reject_chat)
 		prpl_info->reject_chat(g, data);
 }
 
@@ -364,7 +363,7 @@
 	gaim_signal_emit(gaim_conversations_get_handle(), "chat-inviting-user",
 					 conv, name, &buffy);
 
-	if (prpl_info && g_list_find(gaim_connections_get_all(), g) && prpl_info->chat_invite)
+	if (prpl_info && prpl_info->chat_invite)
 		prpl_info->chat_invite(g, id, buffy, name);
 
 	gaim_signal_emit(gaim_conversations_get_handle(), "chat-invited-user",
@@ -383,9 +382,6 @@
 {
 	GaimPluginProtocolInfo *prpl_info = NULL;
 
-	if (!g_list_find(gaim_connections_get_all(), g))
-		return;
-
 	if (g->prpl != NULL)
 		prpl_info = GAIM_PLUGIN_PROTOCOL_INFO(g->prpl);