im.pidgin.pidgin: 4f5de5f19bb139c75a1fcc86d4913b152272014f

rekkanoryo at pidgin.im rekkanoryo at pidgin.im
Sun Feb 3 14:50:45 EST 2008


-----------------------------------------------------------------
Revision: 4f5de5f19bb139c75a1fcc86d4913b152272014f
Ancestor: 9434ad8c4736c82c89b91de919d8f91d16352224
Author: rekkanoryo at pidgin.im
Date: 2008-02-03T19:43:41
Branch: im.pidgin.pidgin
URL: http://d.pidgin.im/viewmtn/revision/info/4f5de5f19bb139c75a1fcc86d4913b152272014f

Modified files:
        libpurple/blist.c libpurple/buddyicon.c
        libpurple/conversation.c libpurple/roomlist.c
        libpurple/server.c libpurple/status.c libpurple/whiteboard.c

ChangeLog: 

Kill off gc->prpl in the core everywhere but connection.c (when the struct
is hidden, it will exist there and be accessible).  While I was here I fixed
some other minor struct member usage along the way, including attention type
stuff I missed when I initially added its new API.  I also fixed a couple
initializations that will warn on some strict non-gcc compilers.

-------------- next part --------------
============================================================
--- libpurple/blist.c	161630d41acb5ec0eeac73f47f8fead0f8c9380b
+++ libpurple/blist.c	255777faa61869c79f5bf76ab8ce032da1ff216b
@@ -1087,12 +1087,19 @@ void purple_blist_rename_group(PurpleGro
 	if(old_name && source && strcmp(source->name, old_name)) {
 		for (accts = purple_group_get_accounts(source); accts; accts = g_slist_remove(accts, accts->data)) {
 			PurpleAccount *account = accts->data;
+			PurpleConnection *gc = NULL;
+			PurplePlugin *prpl = NULL;
 			PurplePluginProtocolInfo *prpl_info = NULL;
 			GList *l = NULL, *buddies = NULL;
 
-			if(account->gc && account->gc->prpl)
-				prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(account->gc->prpl);
+			gc = purple_account_get_connection(account);
+			
+			if(gc)
+				prpl = purple_connection_get_prpl(gc);
 
+			if(gc && prpl)
+				prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(prpl);
+
 			if(!prpl_info)
 				continue;
 
@@ -1104,7 +1111,7 @@ void purple_blist_rename_group(PurpleGro
 			}
 
 			if(prpl_info->rename_group) {
-				prpl_info->rename_group(account->gc, old_name, source, buddies);
+				prpl_info->rename_group(gc, old_name, source, buddies);
 			} else {
 				GList *cur, *groups = NULL;
 
============================================================
--- libpurple/buddyicon.c	7e3021d171dbc56f69469993f4e696f2357424d4
+++ libpurple/buddyicon.c	e7e68daa3510b42b31f8c472aa70d692a50180f7
@@ -707,7 +707,7 @@ purple_buddy_icons_set_account_icon(Purp
 		PurplePluginProtocolInfo *prpl_info;
 
 		gc = purple_account_get_connection(account);
-		prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(gc->prpl);
+		prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(purple_connection_get_prpl(gc));
 
 		if (prpl_info && prpl_info->set_buddy_icon)
 			prpl_info->set_buddy_icon(gc, img);
============================================================
--- libpurple/conversation.c	879f90587e8d3a00246a15f46752d3b5b9365dbe
+++ libpurple/conversation.c	0d3b0c408e6e0980d7b9faadd4f4414e27206540
@@ -402,7 +402,7 @@ purple_conversation_destroy(PurpleConver
 	if (gc != NULL)
 	{
 		/* Still connected */
-		prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(gc->prpl);
+		prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(purple_connection_get_prpl(gc));
 
 		if (purple_conversation_get_type(conv) == PURPLE_CONV_TYPE_IM)
 		{
@@ -1455,7 +1455,7 @@ purple_conv_chat_write(PurpleConvChat *c
 	conv      = purple_conv_chat_get_conversation(chat);
 	gc        = purple_conversation_get_gc(conv);
 	account   = purple_connection_get_account(gc);
-	prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(gc->prpl);
+	prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(purple_connection_get_prpl(gc));
 
 	/* Don't display this if the person who wrote it is ignored. */
 	if (purple_conv_chat_is_user_ignored(chat, who))
@@ -1574,7 +1574,7 @@ purple_conv_chat_add_users(PurpleConvCha
 
 	gc = purple_conversation_get_gc(conv);
 	g_return_if_fail(gc != NULL);
-	prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(gc->prpl);
+	prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(purple_connection_get_prpl(gc));
 	g_return_if_fail(prpl_info != NULL);
 
 	ul = users;
@@ -1675,7 +1675,7 @@ purple_conv_chat_rename_user(PurpleConvC
 
 	gc = purple_conversation_get_gc(conv);
 	g_return_if_fail(gc != NULL);
-	prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(gc->prpl);
+	prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(purple_connection_get_prpl(gc));
 	g_return_if_fail(prpl_info != NULL);
 
 	if (!strcmp(chat->nick, purple_normalize(conv->account, old_user))) {
@@ -1793,7 +1793,7 @@ purple_conv_chat_remove_users(PurpleConv
 
 	gc = purple_conversation_get_gc(conv);
 	g_return_if_fail(gc != NULL);
-	prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(gc->prpl);
+	prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(purple_connection_get_prpl(gc));
 	g_return_if_fail(prpl_info != NULL);
 
 	ops  = purple_conversation_get_ui_ops(conv);
============================================================
--- libpurple/roomlist.c	8b066b55c6d3953503739a094d83365463a095da
+++ libpurple/roomlist.c	ad55c2f49f87a510d56d6cb9a92b7a3108a0f876
@@ -169,20 +169,25 @@ PurpleRoomlist *purple_roomlist_get_list
 
 PurpleRoomlist *purple_roomlist_get_list(PurpleConnection *gc)
 {
+	PurplePlugin *prpl = NULL;
 	PurplePluginProtocolInfo *prpl_info = NULL;
 
 	g_return_val_if_fail(gc != NULL, NULL);
 
-	if (gc->prpl != NULL)
-		prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(gc->prpl);
+	prpl = purple_connection_get_prpl(gc);
 
-	if (prpl_info && prpl_info->roomlist_get_list)
+	if(prpl != NULL)
+		prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(prpl);
+
+	if(prpl_info && prpl_info->roomlist_get_list)
 		return prpl_info->roomlist_get_list(gc);
+
 	return NULL;
 }
 
 void purple_roomlist_cancel_get_list(PurpleRoomlist *list)
 {
+	PurplePlugin *prpl = NULL;
 	PurplePluginProtocolInfo *prpl_info = NULL;
 	PurpleConnection *gc;
 
@@ -192,15 +197,19 @@ void purple_roomlist_cancel_get_list(Pur
 
 	g_return_if_fail(gc != NULL);
 
-	if (gc != NULL && gc->prpl != NULL)
-		prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(gc->prpl);
+	if(gc)
+		prpl = purple_connection_get_prpl(gc);
 
-	if (prpl_info && prpl_info->roomlist_cancel)
+	if(prpl)
+		prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(prpl);
+
+	if(prpl_info && prpl_info->roomlist_cancel)
 		prpl_info->roomlist_cancel(list);
 }
 
 void purple_roomlist_expand_category(PurpleRoomlist *list, PurpleRoomlistRoom *category)
 {
+	PurplePlugin *prpl = NULL;
 	PurplePluginProtocolInfo *prpl_info = NULL;
 	PurpleConnection *gc;
 
@@ -211,10 +220,13 @@ void purple_roomlist_expand_category(Pur
 	gc = purple_account_get_connection(list->account);
 	g_return_if_fail(gc != NULL);
 
-	if (gc->prpl != NULL)
-		prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(gc->prpl);
+	if(gc)
+		prpl = purple_connection_get_prpl(gc);
 
-	if (prpl_info && prpl_info->roomlist_expand_category)
+	if(prpl)
+		prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(prpl);
+
+	if(prpl_info && prpl_info->roomlist_expand_category)
 		prpl_info->roomlist_expand_category(list, category);
 }
 
============================================================
--- libpurple/server.c	c3f99b11b1dddfcb13ca83be1716ae2b99221047
+++ libpurple/server.c	77022a785f6b2eb3ab0a89a1fa2c940d6270d2ec
@@ -44,12 +44,16 @@ serv_send_typing(PurpleConnection *gc, c
 unsigned int
 serv_send_typing(PurpleConnection *gc, const char *name, PurpleTypingState state)
 {
+	PurplePlugin *prpl = NULL;
 	PurplePluginProtocolInfo *prpl_info = NULL;
 
-	if (gc != NULL && gc->prpl != NULL)
-		prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(gc->prpl);
+	if(gc)
+		prpl = purple_connection_get_prpl(gc);
 
-	if (prpl_info && prpl_info->send_typing)
+	if(prpl)
+		prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(prpl);
+
+	if(prpl_info && prpl_info->send_typing)
 		return prpl_info->send_typing(gc, name, state);
 
 	return 0;
@@ -117,24 +121,28 @@ int serv_send_im(PurpleConnection *gc, c
 int serv_send_im(PurpleConnection *gc, const char *name, const char *message,
 				 PurpleMessageFlags flags)
 {
-	PurpleConversation *conv;
-	PurpleAccount *account;
-	PurplePresence *presence;
-	PurplePluginProtocolInfo *prpl_info;
+	PurpleConversation *conv = NULL;
+	PurpleAccount *account = NULL;
+	PurplePresence *presence = NULL;
+	PurplePlugin *prpl = NULL;
+	PurplePluginProtocolInfo *prpl_info = NULL;
 	int val = -EINVAL;
-	const gchar *auto_reply_pref;
+	const gchar *auto_reply_pref = NULL;
 
 	g_return_val_if_fail(gc != NULL, val);
-	g_return_val_if_fail(gc->prpl != NULL, val);
 
-	prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(gc->prpl);
+	prpl = purple_connection_get_prpl(gc);
 
+	g_return_val_if_fail(prpl != NULL, val);
+
+	prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(prpl);
+
 	account  = purple_connection_get_account(gc);
 	presence = purple_account_get_presence(account);
 
-	conv = purple_find_conversation_with_account(PURPLE_CONV_TYPE_IM, name, gc->account);
+	conv = purple_find_conversation_with_account(PURPLE_CONV_TYPE_IM, name, account);
 
-	if (prpl_info && prpl_info->send_im)
+	if(prpl_info && prpl_info->send_im)
 		val = prpl_info->send_im(gc, name, message, flags);
 
 	/*
@@ -142,7 +150,7 @@ int serv_send_im(PurpleConnection *gc, c
 	 * this only reset lar->sent if we're away AND idle?
 	 */
 	auto_reply_pref = purple_prefs_get_string("/purple/away/auto_reply");
-	if ((gc->flags & PURPLE_CONNECTION_AUTO_RESP) &&
+	if((gc->flags & PURPLE_CONNECTION_AUTO_RESP) &&
 			flags & PURPLE_MESSAGE_AUTO_RESP &&
 			!purple_presence_is_available(presence) &&
 			strcmp(auto_reply_pref, "never")) {
@@ -152,7 +160,7 @@ int serv_send_im(PurpleConnection *gc, c
 		lar->sent = time(NULL);
 	}
 
-	if (conv && purple_conv_im_get_send_typed_timeout(PURPLE_CONV_IM(conv)))
+	if(conv && purple_conv_im_get_send_typed_timeout(PURPLE_CONV_IM(conv)))
 		purple_conv_im_stop_send_typed_timeout(PURPLE_CONV_IM(conv));
 
 	return val;
@@ -160,28 +168,36 @@ void serv_get_info(PurpleConnection *gc,
 
 void serv_get_info(PurpleConnection *gc, const char *name)
 {
+	PurplePlugin *prpl = NULL;
 	PurplePluginProtocolInfo *prpl_info = NULL;
 
-	if (gc != NULL && gc->prpl != NULL)
-		prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(gc->prpl);
+	if(gc)
+		prpl = purple_connection_get_prpl(gc);
+	
+	if(prpl)
+		prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(prpl);
 
-	if (gc && prpl_info && prpl_info->get_info)
+	if(gc && prpl_info && prpl_info->get_info)
 		prpl_info->get_info(gc, name);
 }
 
 void serv_set_info(PurpleConnection *gc, const char *info)
 {
+	PurplePlugin *prpl = NULL;
 	PurplePluginProtocolInfo *prpl_info = NULL;
-	PurpleAccount *account;
+	PurpleAccount *account = NULL;;
 
-	if (gc != NULL && gc->prpl != NULL)
-		prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(gc->prpl);
+	if(gc)
+		prpl = purple_connection_get_prpl(gc);
+	
+	if(prpl)
+		prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(prpl);
 
-	if (prpl_info && prpl_info->set_info) {
+	if(prpl_info && prpl_info->set_info) {
 
 		account = purple_connection_get_account(gc);
 
-		if (purple_signal_emit_return_1(purple_accounts_get_handle(),
+		if(purple_signal_emit_return_1(purple_accounts_get_handle(),
 									  "account-setting-info", account, info))
 			return;
 
@@ -197,30 +213,45 @@ void serv_alias_buddy(PurpleBuddy *b)
  */
 void serv_alias_buddy(PurpleBuddy *b)
 {
+	PurpleAccount *account = NULL;
+	PurpleConnection *gc = NULL;
+	PurplePlugin *prpl = NULL;
 	PurplePluginProtocolInfo *prpl_info = NULL;
 
-	if (b != NULL && b->account->gc && b->account->gc->prpl != NULL)
-		prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(b->account->gc->prpl);
+	if(b)
+		account = purple_buddy_get_account(b);
 
-	if (b && prpl_info && prpl_info->alias_buddy) {
-		prpl_info->alias_buddy(b->account->gc, b->name, b->alias);
+	if(account)
+		gc = purple_account_get_connection(account);
+
+	if(gc)
+		prpl = purple_connection_get_prpl(gc);
+
+	if(prpl)
+		prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(prpl);
+
+	if(b && prpl_info && prpl_info->alias_buddy) {
+		prpl_info->alias_buddy(gc, b->name, b->alias);
 	}
 }
 
 void
 serv_got_alias(PurpleConnection *gc, const char *who, const char *alias)
 {
-	PurpleAccount *account = purple_connection_get_account(gc);
-	GSList *buddies = purple_find_buddies(account, who);
+	PurpleAccount *account;
+	GSList *buddies;
 	PurpleBuddy *b;
 	PurpleConversation *conv;
 
+	account = purple_connection_get_account(gc);
+	buddies = purple_find_buddies(account, who);
+
 	while (buddies != NULL)
 	{
 		b = buddies->data;
 		buddies = g_slist_delete_link(buddies, buddies);
 
-		if ((b->server_alias == NULL && alias == NULL) ||
+		if((b->server_alias == NULL && alias == NULL) ||
 		    (b->server_alias && alias && !strcmp(b->server_alias, alias)))
 		{
 			continue;
@@ -229,7 +260,7 @@ serv_got_alias(PurpleConnection *gc, con
 		purple_blist_server_alias_buddy(b, alias);
 
 		conv = purple_find_conversation_with_account(PURPLE_CONV_TYPE_IM, b->name, account);
-		if (conv != NULL && alias != NULL && strcmp(alias, who))
+		if(conv != NULL && alias != NULL && strcmp(alias, who))
 		{
 			char *tmp = g_strdup_printf(_("%s is now known as %s.\n"),
 										who, alias);
@@ -296,8 +327,8 @@ serv_send_attention(PurpleConnection *gc
 	else
 		alias = who;
 
-	if (attn && attn->outgoing_description) {
-		description = g_strdup_printf(attn->outgoing_description, alias);
+	if (attn && purple_attention_type_get_outgoing_desc(attn)) {
+		description = g_strdup_printf(purple_attention_type_get_outgoing_desc(attn), alias);
 	} else {
 		description = g_strdup_printf(_("Requesting %s's attention..."), alias);
 	}
@@ -341,8 +372,8 @@ serv_got_attention(PurpleConnection *gc,
 	else
 		alias = who;
 
-	if (attn && attn->incoming_description) {
-		description = g_strdup_printf(attn->incoming_description, alias);
+	if (attn && purple_attention_type_get_incoming_desc(attn)) {
+		description = g_strdup_printf(purple_attention_type_get_incoming_desc(attn), alias);
 	} else {
 		description = g_strdup_printf(_("%s has requested your attention!"), alias);
 	}
@@ -367,125 +398,166 @@ void serv_move_buddy(PurpleBuddy *b, Pur
  */
 void serv_move_buddy(PurpleBuddy *b, PurpleGroup *og, PurpleGroup *ng)
 {
+	PurpleAccount *account = NULL;
+	PurpleConnection *gc = NULL;
+	PurplePlugin *prpl = NULL;
 	PurplePluginProtocolInfo *prpl_info = NULL;
 
 	g_return_if_fail(b != NULL);
 	g_return_if_fail(og != NULL);
 	g_return_if_fail(ng != NULL);
 
-	if (b->account->gc != NULL && b->account->gc->prpl != NULL)
-		prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(b->account->gc->prpl);
+	account = purple_buddy_get_account(b);
+	gc = purple_account_get_connection(account);
 
-	if (b->account->gc && og && ng) {
+	if(gc)
+		prpl = purple_connection_get_prpl(gc);
+
+	if(prpl)
+		prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(prpl);
+
+	if(gc && og && ng) {
 		if (prpl_info && prpl_info->group_buddy) {
-			prpl_info->group_buddy(b->account->gc, b->name, og->name, ng->name);
+			prpl_info->group_buddy(gc, b->name, og->name, ng->name);
 		}
 	}
 }
 
-void serv_add_permit(PurpleConnection *g, const char *name)
+void serv_add_permit(PurpleConnection *gc, const char *name)
 {
+	PurplePlugin *prpl = NULL;
 	PurplePluginProtocolInfo *prpl_info = NULL;
 
-	if (g != NULL && g->prpl != NULL)
-		prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(g->prpl);
+	if(gc)
+		prpl = purple_connection_get_prpl(gc);
 
-	if (prpl_info && prpl_info->add_permit)
-		prpl_info->add_permit(g, name);
+	if(prpl)
+		prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(prpl);
+
+	if(prpl_info && prpl_info->add_permit)
+		prpl_info->add_permit(gc, name);
 }
 
-void serv_add_deny(PurpleConnection *g, const char *name)
+void serv_add_deny(PurpleConnection *gc, const char *name)
 {
+	PurplePlugin *prpl = NULL;
 	PurplePluginProtocolInfo *prpl_info = NULL;
 
-	if (g != NULL && g->prpl != NULL)
-		prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(g->prpl);
+	if(gc)
+		prpl = purple_connection_get_prpl(gc);
 
-	if (prpl_info && prpl_info->add_deny)
-		prpl_info->add_deny(g, name);
+	if(prpl)
+		prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(prpl);
+
+	if(prpl_info && prpl_info->add_deny)
+		prpl_info->add_deny(gc, name);
 }
 
-void serv_rem_permit(PurpleConnection *g, const char *name)
+void serv_rem_permit(PurpleConnection *gc, const char *name)
 {
+	PurplePlugin *prpl = NULL;
 	PurplePluginProtocolInfo *prpl_info = NULL;
 
-	if (g != NULL && g->prpl != NULL)
-		prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(g->prpl);
+	if(gc)
+		prpl = purple_connection_get_prpl(gc);
 
-	if (prpl_info && prpl_info->rem_permit)
-		prpl_info->rem_permit(g, name);
+	if(prpl)
+		prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(prpl);
+
+	if(prpl_info && prpl_info->rem_permit)
+		prpl_info->rem_permit(gc, name);
 }
 
-void serv_rem_deny(PurpleConnection *g, const char *name)
+void serv_rem_deny(PurpleConnection *gc, const char *name)
 {
+	PurplePlugin *prpl = NULL;
 	PurplePluginProtocolInfo *prpl_info = NULL;
 
-	if (g != NULL && g->prpl != NULL)
-		prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(g->prpl);
+	if(gc)
+		prpl = purple_connection_get_prpl(gc);
 
-	if (prpl_info && prpl_info->rem_deny)
-		prpl_info->rem_deny(g, name);
+	if(prpl)
+		prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(prpl);
+
+	if(prpl_info && prpl_info->rem_deny)
+		prpl_info->rem_deny(gc, name);
 }
 
-void serv_set_permit_deny(PurpleConnection *g)
+void serv_set_permit_deny(PurpleConnection *gc)
 {
+	PurplePlugin *prpl = NULL;
 	PurplePluginProtocolInfo *prpl_info = NULL;
 
-	if (g != NULL && g->prpl != NULL)
-		prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(g->prpl);
+	if(gc)
+		prpl = purple_connection_get_prpl(gc);
 
+	if(prpl)
+		prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(prpl);
+
 	/*
 	 * this is called when either you import a buddy list, and make lots
 	 * of changes that way, or when the user toggles the permit/deny mode
 	 * in the prefs. In either case you should probably be resetting and
 	 * resending the permit/deny info when you get this.
 	 */
-	if (prpl_info && prpl_info->set_permit_deny)
-		prpl_info->set_permit_deny(g);
+	if(prpl_info && prpl_info->set_permit_deny)
+		prpl_info->set_permit_deny(gc);
 }
 
-void serv_join_chat(PurpleConnection *g, GHashTable *data)
+void serv_join_chat(PurpleConnection *gc, GHashTable *data)
 {
+	PurplePlugin *prpl = NULL;
 	PurplePluginProtocolInfo *prpl_info = NULL;
 
-	if (g != NULL && g->prpl != NULL)
-		prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(g->prpl);
+	if(gc)
+		prpl = purple_connection_get_prpl(gc);
 
-	if (prpl_info && prpl_info->join_chat)
-		prpl_info->join_chat(g, data);
+	if(prpl)
+		prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(prpl);
+
+	if(prpl_info && prpl_info->join_chat)
+		prpl_info->join_chat(gc, data);
 }
 
 
-void serv_reject_chat(PurpleConnection *g, GHashTable *data)
+void serv_reject_chat(PurpleConnection *gc, GHashTable *data)
 {
+	PurplePlugin *prpl = NULL;
 	PurplePluginProtocolInfo *prpl_info = NULL;
 
-	if (g != NULL && g->prpl != NULL)
-		prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(g->prpl);
+	if(gc)
+		prpl = purple_connection_get_prpl(gc);
 
-	if (prpl_info && prpl_info->reject_chat)
-		prpl_info->reject_chat(g, data);
+	if(prpl)
+		prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(prpl);
+
+	if(prpl_info && prpl_info->reject_chat)
+		prpl_info->reject_chat(gc, data);
 }
 
-void serv_chat_invite(PurpleConnection *g, int id, const char *message, const char *name)
+void serv_chat_invite(PurpleConnection *gc, int id, const char *message, const char *name)
 {
+	PurplePlugin *prpl = NULL;
 	PurplePluginProtocolInfo *prpl_info = NULL;
 	PurpleConversation *conv;
 	char *buffy = message && *message ? g_strdup(message) : NULL;
 
-	conv = purple_find_chat(g, id);
+	conv = purple_find_chat(gc, id);
 
-	if (conv == NULL)
+	if(conv == NULL)
 		return;
 
-	if (g != NULL && g->prpl != NULL)
-		prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(g->prpl);
+	if(gc)
+		prpl = purple_connection_get_prpl(gc);
 
+	if(prpl)
+		prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(prpl);
+
 	purple_signal_emit(purple_conversations_get_handle(), "chat-inviting-user",
 					 conv, name, &buffy);
 
 	if (prpl_info && prpl_info->chat_invite)
-		prpl_info->chat_invite(g, id, buffy, name);
+		prpl_info->chat_invite(gc, id, buffy, name);
 
 	purple_signal_emit(purple_conversations_get_handle(), "chat-invited-user",
 					 conv, name, buffy);
@@ -499,37 +571,47 @@ void serv_chat_invite(PurpleConnection *
  * to leave a chat without destroying the conversation.
  */
 
-void serv_chat_leave(PurpleConnection *g, int id)
+void serv_chat_leave(PurpleConnection *gc, int id)
 {
+	PurplePlugin *prpl = NULL;
 	PurplePluginProtocolInfo *prpl_info = NULL;
 
-	if (g->prpl != NULL)
-		prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(g->prpl);
+	prpl = purple_connection_get_prpl(gc);
 
-	if (prpl_info && prpl_info->chat_leave)
-		prpl_info->chat_leave(g, id);
+	if(prpl)
+		prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(prpl);
+
+	if(prpl_info && prpl_info->chat_leave)
+		prpl_info->chat_leave(gc, id);
 }
 
-void serv_chat_whisper(PurpleConnection *g, int id, const char *who, const char *message)
+void serv_chat_whisper(PurpleConnection *gc, int id, const char *who, const char *message)
 {
+	PurplePlugin *prpl = NULL;
 	PurplePluginProtocolInfo *prpl_info = NULL;
 
-	if (g != NULL && g->prpl != NULL)
-		prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(g->prpl);
+	if(gc)
+		prpl = purple_connection_get_prpl(gc);
 
-	if (prpl_info && prpl_info->chat_whisper)
-		prpl_info->chat_whisper(g, id, who, message);
+	if(prpl)
+		prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(prpl);
+
+	if(prpl_info && prpl_info->chat_whisper)
+		prpl_info->chat_whisper(gc, id, who, message);
 }
 
 int serv_chat_send(PurpleConnection *gc, int id, const char *message, PurpleMessageFlags flags)
 {
 	int val = -EINVAL;
+	PurplePlugin *prpl = NULL;
 	PurplePluginProtocolInfo *prpl_info = NULL;
 
-	if (gc->prpl != NULL)
-		prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(gc->prpl);
+	prpl = purple_connection_get_prpl(gc);
 
-	if (prpl_info && prpl_info->chat_send)
+	if(prpl)
+		prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(prpl);
+
+	if(prpl_info && prpl_info->chat_send)
 		val = prpl_info->chat_send(gc, id, message, flags);
 
 	return val;
@@ -552,7 +634,7 @@ void serv_got_im(PurpleConnection *gc, c
 
 	account  = purple_connection_get_account(gc);
 
-	if (PURPLE_PLUGIN_PROTOCOL_INFO(gc->prpl)->set_permit_deny == NULL) {
+	if (PURPLE_PLUGIN_PROTOCOL_INFO(purple_connection_get_prpl(gc))->set_permit_deny == NULL) {
 		/* protocol does not support privacy, handle it ourselves */
 		if (!purple_privacy_check(account, who))
 			return;
@@ -772,7 +854,7 @@ void serv_got_chat_invite(PurpleConnecti
 	int plugin_return;
 
 	account = purple_connection_get_account(gc);
-	if (PURPLE_PLUGIN_PROTOCOL_INFO(gc->prpl)->set_permit_deny == NULL) {
+	if (PURPLE_PLUGIN_PROTOCOL_INFO(purple_connection_get_prpl(gc))->set_permit_deny == NULL) {
 		/* protocol does not support privacy, handle it ourselves */
 		if (!purple_privacy_check(account, who))
 			return;
@@ -920,11 +1002,15 @@ void serv_send_file(PurpleConnection *gc
 
 void serv_send_file(PurpleConnection *gc, const char *who, const char *file)
 {
+	PurplePlugin *prpl = NULL;
 	PurplePluginProtocolInfo *prpl_info = NULL;
 
-	if (gc != NULL && gc->prpl != NULL)
-		prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(gc->prpl);
+	if(gc)
+		prpl = purple_connection_get_prpl(gc);
 
+	if(prpl)
+		prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(prpl);
+
 	if (prpl_info && prpl_info->send_file) {
 		if (!prpl_info->can_receive_file || prpl_info->can_receive_file(gc, who)) {
 			prpl_info->send_file(gc, who, file);
============================================================
--- libpurple/status.c	14251f1ce9442881421d3d7c7fd34055b4806a2c
+++ libpurple/status.c	7b9223f99bc3107073a842afd4655617588c6c1f
@@ -1310,7 +1310,8 @@ purple_presence_set_idle(PurplePresence 
 	else if (purple_presence_get_context(presence) == PURPLE_PRESENCE_CONTEXT_ACCOUNT)
 	{
 		PurpleAccount *account;
-		PurpleConnection *gc;
+		PurpleConnection *gc = NULL;
+		PurplePlugin *prpl = NULL;
 		PurplePluginProtocolInfo *prpl_info = NULL;
 
 		account = purple_presence_get_account(presence);
@@ -1339,10 +1340,12 @@ purple_presence_set_idle(PurplePresence 
 
 		gc = purple_account_get_connection(account);
 
-		if (gc != NULL && PURPLE_CONNECTION_IS_CONNECTED(gc) &&
-				gc->prpl != NULL)
-			prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(gc->prpl);
+		if(gc)
+			prpl = purple_connection_get_prpl(gc);
 
+		if(PURPLE_CONNECTION_IS_CONNECTED(gc) && prpl != NULL)
+			prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(prpl);
+
 		if (prpl_info && prpl_info->set_idle)
 			prpl_info->set_idle(gc, (idle ? (current_time - idle_time) : 0));
 	}
============================================================
--- libpurple/whiteboard.c	d3bbb91c29326a2ded986f3694d78d875f671f88
+++ libpurple/whiteboard.c	7d81d4843faa1752537444cd1b3736cfa673f91d
@@ -59,7 +59,8 @@ PurpleWhiteboard *purple_whiteboard_crea
 	wb->state   = state;
 	wb->who     = g_strdup(who);
 
-	prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(account->gc->prpl);
+	prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(purple_connection_get_prpl(
+				purple_account_get_connection(account)));
 	purple_whiteboard_set_prpl_ops(wb, prpl_info->whiteboard_prpl_ops);
 
 	/* Start up protocol specifics */


More information about the Commits mailing list