gobjectification: 853ef8a3: Start converting PurpleConnection into a...

sadrul at pidgin.im sadrul at pidgin.im
Thu Mar 13 04:38:26 EDT 2008


-----------------------------------------------------------------
Revision: 853ef8a304909716698b82fe56f7e96b2af64c98
Ancestor: 5f10e94b8de5b7c3b4b506830f437b5b842daecc
Author: sadrul at pidgin.im
Date: 2008-03-10T07:26:47
Branch: im.pidgin.gobjectification
URL: http://d.pidgin.im/viewmtn/revision/info/853ef8a304909716698b82fe56f7e96b2af64c98

Modified files:
        libpurple/account.c libpurple/blist.c libpurple/connection.c
        libpurple/connection.h libpurple/conversation.c
        libpurple/core.c libpurple/dbus-useful.c
        libpurple/example/nullclient.c libpurple/idle.c
        libpurple/log.c libpurple/plugins/filectl.c
        libpurple/plugins/idle.c libpurple/plugins/log_reader.c
        libpurple/plugins/perl/common/Connection.xs
        libpurple/plugins/perl/common/Prpl.xs
        libpurple/plugins/signals-test.c
        libpurple/plugins/tcl/tcl_cmds.c libpurple/pounce.c
        libpurple/protocols/bonjour/bonjour.c
        libpurple/protocols/bonjour/bonjour_ft.c
        libpurple/protocols/bonjour/jabber.c
        libpurple/protocols/bonjour/mdns_avahi.c
        libpurple/protocols/bonjour/mdns_win32.c
        libpurple/protocols/gg/gg.c
        libpurple/protocols/gg/lib/events.c
        libpurple/protocols/gg/lib/libgadu.c
        libpurple/protocols/irc/irc.c libpurple/protocols/irc/msgs.c
        libpurple/protocols/jabber/auth.c
        libpurple/protocols/jabber/buddy.c
        libpurple/protocols/jabber/chat.c
        libpurple/protocols/jabber/disco.c
        libpurple/protocols/jabber/google.c
        libpurple/protocols/jabber/jabber.c
        libpurple/protocols/jabber/jutil.c
        libpurple/protocols/jabber/message.c
        libpurple/protocols/jabber/oob.c
        libpurple/protocols/jabber/parser.c
        libpurple/protocols/jabber/ping.c
        libpurple/protocols/jabber/presence.c
        libpurple/protocols/jabber/roster.c
        libpurple/protocols/jabber/si.c
        libpurple/protocols/jabber/usermood.c
        libpurple/protocols/jabber/usernick.c
        libpurple/protocols/jabber/usertune.c
        libpurple/protocols/jabber/xdata.c
        libpurple/protocols/msn/contact.c
        libpurple/protocols/msn/dialog.c
        libpurple/protocols/msn/error.c
        libpurple/protocols/msn/msn.c
        libpurple/protocols/msn/nexus.c
        libpurple/protocols/msn/notification.c
        libpurple/protocols/msn/oim.c
        libpurple/protocols/msn/servconn.c
        libpurple/protocols/msn/session.c
        libpurple/protocols/msn/slp.c
        libpurple/protocols/msn/switchboard.c
        libpurple/protocols/msn/sync.c
        libpurple/protocols/msn/userlist.c
        libpurple/protocols/msnp9/dialog.c
        libpurple/protocols/msnp9/error.c
        libpurple/protocols/msnp9/msn.c
        libpurple/protocols/msnp9/nexus.c
        libpurple/protocols/msnp9/notification.c
        libpurple/protocols/msnp9/servconn.c
        libpurple/protocols/msnp9/session.c
        libpurple/protocols/msnp9/slp.c
        libpurple/protocols/msnp9/switchboard.c
        libpurple/protocols/msnp9/sync.c
        libpurple/protocols/msnp9/userlist.c
        libpurple/protocols/myspace/myspace.c
        libpurple/protocols/myspace/session.c
        libpurple/protocols/myspace/user.c
        libpurple/protocols/myspace/zap.c
        libpurple/protocols/novell/novell.c
        libpurple/protocols/null/nullprpl.c
        libpurple/protocols/oscar/family_chatnav.c
        libpurple/protocols/oscar/family_icbm.c
        libpurple/protocols/oscar/family_icq.c
        libpurple/protocols/oscar/flap_connection.c
        libpurple/protocols/oscar/odc.c
        libpurple/protocols/oscar/oscar.c
        libpurple/protocols/oscar/peer.c
        libpurple/protocols/oscar/peer_proxy.c
        libpurple/protocols/qq/buddy_info.c
        libpurple/protocols/qq/buddy_list.c
        libpurple/protocols/qq/buddy_opt.c
        libpurple/protocols/qq/buddy_status.c
        libpurple/protocols/qq/group_im.c
        libpurple/protocols/qq/group_join.c
        libpurple/protocols/qq/group_opt.c
        libpurple/protocols/qq/im.c
        libpurple/protocols/qq/keep_alive.c
        libpurple/protocols/qq/login_logout.c
        libpurple/protocols/qq/qq.c
        libpurple/protocols/qq/qq_proxy.c
        libpurple/protocols/qq/send_file.c
        libpurple/protocols/qq/sys_msg.c
        libpurple/protocols/sametime/sametime.c
        libpurple/protocols/silc/buddy.c
        libpurple/protocols/silc/chat.c
        libpurple/protocols/silc/ft.c libpurple/protocols/silc/ops.c
        libpurple/protocols/silc/silc.c
        libpurple/protocols/silc/util.c
        libpurple/protocols/silc10/buddy.c
        libpurple/protocols/silc10/chat.c
        libpurple/protocols/silc10/ft.c
        libpurple/protocols/silc10/ops.c
        libpurple/protocols/silc10/silc.c
        libpurple/protocols/silc10/util.c
        libpurple/protocols/simple/simple.c
        libpurple/protocols/toc/toc.c
        libpurple/protocols/yahoo/yahoo.c
        libpurple/protocols/yahoo/yahoo_aliases.c
        libpurple/protocols/yahoo/yahoo_doodle.c
        libpurple/protocols/yahoo/yahoo_filexfer.c
        libpurple/protocols/yahoo/yahoo_packet.c
        libpurple/protocols/yahoo/yahoo_picture.c
        libpurple/protocols/yahoo/yahoo_profile.c
        libpurple/protocols/yahoo/ycht.c
        libpurple/protocols/zephyr/zephyr.c libpurple/server.c

ChangeLog: 

Start converting PurpleConnection into a GObject with proper struct hiding. libpurple itself and plugins/ compile. But there are a lot of compile errors in protocols/. I hope to get to them in a night or two.

ChangeLog: 

This commit includes a lot of changes from an earlier commit by grim.
-------------- next part --------------
============================================================
--- libpurple/account.c	396264872baf572061b4b3c2f1e1981cf20a248e
+++ libpurple/account.c	c27f1e23afbc6eb308f22fec5ec9e08182567cc9
@@ -1050,6 +1050,7 @@ purple_account_request_change_user_info(
 {
 	PurpleConnection *gc;
 	char primary[256];
+	PurpleConnectionFlags flags = 0;
 
 	g_return_if_fail(account != NULL);
 	g_return_if_fail(purple_account_is_connected(account));
@@ -1060,10 +1061,11 @@ purple_account_request_change_user_info(
 			   _("Change user information for %s"),
 			   purple_account_get_username(account));
 
+	g_object_get(G_OBJECT(gc), "flags", &flags, NULL);
 	purple_request_input(gc, _("Set User Info"), primary, NULL,
 					   purple_account_get_user_info(account),
 					   TRUE, FALSE, ((gc != NULL) &&
-					   (gc->flags & PURPLE_CONNECTION_HTML) ? "html" : NULL),
+					   (flags & PURPLE_CONNECTION_FLAGS_HTML) ? "html" : NULL),
 					   _("Save"), G_CALLBACK(set_user_info_cb),
 					   _("Cancel"), NULL,
 					   account, NULL, NULL,
@@ -1160,7 +1162,10 @@ purple_account_set_connection(PurpleAcco
 {
 	g_return_if_fail(account != NULL);
 
-	account->gc = gc;
+#warning Connect and disconnect to 'signed-on' and 'connection-error' on gc and set/clear current_error.
+	if (account->gc)
+		g_object_unref(account->gc);
+	account->gc = gc ? g_object_ref(gc) : NULL;
 }
 
 void
@@ -1201,7 +1206,12 @@ purple_account_set_enabled(PurpleAccount
 	else if(!was_enabled && value)
 		purple_signal_emit(purple_accounts_get_handle(), "account-enabled", account);
 
+#if 0
 	if ((gc != NULL) && (gc->wants_to_die == TRUE))
+#else
+#warning Do something about wants-to-die. Perhaps check if current_error is fatal?
+	if (gc != NULL)
+#endif
 		return;
 
 	if (value && purple_presence_is_online(account->presence))
@@ -1448,11 +1458,11 @@ purple_account_get_state(const PurpleAcc
 {
 	PurpleConnection *gc;
 
-	g_return_val_if_fail(account != NULL, PURPLE_DISCONNECTED);
+	g_return_val_if_fail(account != NULL, PURPLE_CONNECTION_STATE_DISCONNECTED);
 
 	gc = purple_account_get_connection(account);
 	if (!gc)
-		return PURPLE_DISCONNECTED;
+		return PURPLE_CONNECTION_STATE_DISCONNECTED;
 
 	return purple_connection_get_state(gc);
 }
@@ -1460,19 +1470,19 @@ purple_account_is_connected(const Purple
 gboolean
 purple_account_is_connected(const PurpleAccount *account)
 {
-	return (purple_account_get_state(account) == PURPLE_CONNECTED);
+	return (purple_account_get_state(account) == PURPLE_CONNECTION_STATE_CONNECTED);
 }
 
 gboolean
 purple_account_is_connecting(const PurpleAccount *account)
 {
-	return (purple_account_get_state(account) == PURPLE_CONNECTING);
+	return (purple_account_get_state(account) == PURPLE_CONNECTION_STATE_CONNECTING);
 }
 
 gboolean
 purple_account_is_disconnected(const PurpleAccount *account)
 {
-	return (purple_account_get_state(account) == PURPLE_DISCONNECTED);
+	return (purple_account_get_state(account) == PURPLE_CONNECTION_STATE_DISCONNECTED);
 }
 
 const char *
@@ -1480,7 +1490,7 @@ purple_account_get_username(const Purple
 {
 	g_return_val_if_fail(account != NULL, NULL);
 
-	return account->username;
+	return purple_account_get_username(account);
 }
 
 const char *
@@ -1488,7 +1498,7 @@ purple_account_get_password(const Purple
 {
 	g_return_val_if_fail(account != NULL, NULL);
 
-	return account->password;
+	return purple_account_get_password(account);
 }
 
 const char *
@@ -1519,7 +1529,7 @@ purple_account_get_protocol_id(const Pur
 purple_account_get_protocol_id(const PurpleAccount *account)
 {
 	g_return_val_if_fail(account != NULL, NULL);
-	return account->protocol_id;
+	return purple_account_get_protocol_id(account);
 }
 
 const char *
@@ -1539,7 +1549,7 @@ purple_account_get_connection(const Purp
 {
 	g_return_val_if_fail(account != NULL, NULL);
 
-	return account->gc;
+	return purple_account_get_connection(account);
 }
 
 gboolean
@@ -2184,7 +2194,7 @@ purple_accounts_find(const char *name, c
 
 		who = g_strdup(purple_normalize(account, name));
 		if (!strcmp(purple_normalize(account, purple_account_get_username(account)), who) &&
-			(!protocol_id || !strcmp(account->protocol_id, protocol_id))) {
+			(!protocol_id || !strcmp(purple_account_get_protocol_id(account), protocol_id))) {
 			g_free(who);
 			break;
 		}
@@ -2243,7 +2253,6 @@ purple_accounts_init(void)
 purple_accounts_init(void)
 {
 	void *handle = purple_accounts_get_handle();
-	void *conn_handle = purple_connections_get_handle();
 
 	purple_signal_register(handle, "account-connecting",
 						 purple_marshal_VOID__POINTER, NULL, 1,
@@ -2314,11 +2323,12 @@ purple_accounts_init(void)
 	                       purple_value_new(PURPLE_TYPE_POINTER),
 	                       purple_value_new(PURPLE_TYPE_POINTER));
 
+#if 0
 	purple_signal_connect(conn_handle, "signed-on", handle,
 	                      PURPLE_CALLBACK(signed_on_cb), NULL);
 	purple_signal_connect(conn_handle, "connection-error", handle,
 	                      PURPLE_CALLBACK(connection_error_cb), NULL);
-
+#endif
 }
 
 void
============================================================
--- libpurple/blist.c	303cce32a1214e4a724f19817c2e4644b956eb4f
+++ libpurple/blist.c	66cb58c05c8c75b7b7f350049abda56a4310a755
@@ -978,7 +978,7 @@ void purple_blist_server_alias_buddy(Pur
 
 	g_return_if_fail(buddy != NULL);
 
-	if (!purple_strings_are_different(buddy->server_alias, alias))
+	if (!purple_strings_are_different(purple_buddy_get_server_alias(buddy), alias))
 		return;
 
 	old_alias = buddy->server_alias;
@@ -1962,7 +1962,7 @@ void purple_blist_remove_group(PurpleGro
 	{
 		PurpleConnection *gc = (PurpleConnection *)l->data;
 
-		if (purple_connection_get_state(gc) == PURPLE_CONNECTED)
+		if (purple_connection_get_state(gc) == PURPLE_CONNECTION_STATE_CONNECTED)
 			purple_account_remove_group(purple_connection_get_account(gc), group);
 	}
 
@@ -1989,10 +1989,10 @@ const char *purple_buddy_get_alias_only(
 
 	if ((buddy->alias != NULL) && (*buddy->alias != '\0')) {
 		return buddy->alias;
-	} else if ((buddy->server_alias != NULL) &&
-		   (*buddy->server_alias != '\0')) {
+	} else if ((purple_buddy_get_server_alias(buddy) != NULL) &&
+		   (*purple_buddy_get_server_alias(buddy) != '\0')) {
 
-		return buddy->server_alias;
+		return purple_buddy_get_server_alias(buddy);
 	}
 
 	return NULL;
@@ -2016,8 +2016,8 @@ const char *purple_buddy_get_contact_ali
 		return c->alias;
 
 	/* The server alias */
-	if ((buddy->server_alias) && (*buddy->server_alias))
-		return buddy->server_alias;
+	if ((purple_buddy_get_server_alias(buddy)) && (*purple_buddy_get_server_alias(buddy)))
+		return purple_buddy_get_server_alias(buddy);
 
 	/* The buddy's user name (i.e. no alias) */
 	return buddy->name;
@@ -2034,8 +2034,8 @@ const char *purple_buddy_get_alias(Purpl
 		return buddy->alias;
 
 	/* The server alias */
-	if ((buddy->server_alias) && (*buddy->server_alias))
-		return buddy->server_alias;
+	if ((purple_buddy_get_server_alias(buddy)) && (*purple_buddy_get_server_alias(buddy)))
+		return purple_buddy_get_server_alias(buddy);
 
 	/* The buddy's user name (i.e. no alias) */
 	return buddy->name;
@@ -2045,8 +2045,8 @@ const char *purple_buddy_get_server_alia
 {
         g_return_val_if_fail(buddy != NULL, NULL);
 
-	if ((buddy->server_alias) && (*buddy->server_alias))
-	    return buddy->server_alias;
+	if ((purple_buddy_get_server_alias(buddy)) && (*purple_buddy_get_server_alias(buddy)))
+	    return purple_buddy_get_server_alias(buddy);
 
 	return NULL;
 }
============================================================
--- libpurple/connection.c	99d100199ff71455d6a80af4dbfb7226e5ae2fb1
+++ libpurple/connection.c	3e9f856da62a04b1691daf11d1abbf06ae9e300e
@@ -30,22 +30,83 @@
 #include "dbus-maybe.h"
 #include "debug.h"
 #include "log.h"
+#include "marshallers.h"
 #include "notify.h"
 #include "prefs.h"
 #include "proxy.h"
 #include "request.h"
 #include "server.h"
-#include "signals.h"
 #include "util.h"
 
+/******************************************************************************
+ * Structs
+ *****************************************************************************/
+struct _PurpleConnectionPrivate
+{
+	PurpleConnectionFlags flags;
+
+	PurpleConnectionState state;
+
+	PurpleAccount *account;
+	char *password;
+
+	gint inpa;
+
+	GSList *buddy_chats;
+
+	guint keepalive;
+
+	gboolean wants_to_die;
+	guint disconnect_timeout;
+	time_t last_received;
+	PurplePlugin *prpl;
+	char *display_name;
+};
+
+/******************************************************************************
+ * Enums
+ *****************************************************************************/
+enum
+{
+	PROP_ZERO,
+	PROP_FLAGS,
+	PROP_STATE,
+	PROP_ACCOUNT,
+#if 0
+	PROP_INPUT_WATCHER,
+	PROP_BUDDY_CHATS,
+	PROP_KEEPALIVE,
+	PROP_WANTS_TO_DIE,
+	PROP_DISCONNECT_TIMEOUT,
+#endif
+	PROP_LAST,
+};
+
+enum
+{
+	SIG_SIGNING_ON,
+	SIG_SIGNED_ON,
+	SIG_SIGNING_OFF,
+	SIG_SIGNED_OFF,
+	SIG_DISCONNECTED,
+	SIG_LAST
+};
+
 #define KEEPALIVE_INTERVAL 30
 
+#warning Do we want to use a ConnectionManager for these?
 static GList *connections = NULL;
 static GList *connections_connecting = NULL;
-static PurpleConnectionUiOps *connection_ui_ops = NULL;
 
-static int connections_handle;
+/******************************************************************************
+ * Globals
+ *****************************************************************************/
+static GObjectClass *parent_class = NULL;
+static guint signals[SIG_LAST] = { 0, };
 
+/******************************************************************************
+ * OLD CODE
+ *****************************************************************************/
 static gboolean
 send_keepalive(gpointer data)
 {
@@ -58,13 +119,13 @@ send_keepalive(gpointer data)
 	/* Only send keep-alives if we haven't heard from the
 	 * server in a while.
 	 */
-	if ((time(NULL) - gc->last_received) < KEEPALIVE_INTERVAL)
+	if ((time(NULL) - gc->priv->last_received) < KEEPALIVE_INTERVAL)
 		return TRUE;
 
-	if (gc->prpl == NULL)
+	if (gc->priv->prpl == NULL)
 		return TRUE;
 
-	prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(gc->prpl);
+	prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(gc->priv->prpl);
 
 	if (prpl_info && prpl_info->keepalive)
 		prpl_info->keepalive(gc);
@@ -77,22 +138,22 @@ update_keepalive(PurpleConnection *gc, g
 {
 	PurplePluginProtocolInfo *prpl_info = NULL;
 
-	if (gc != NULL && gc->prpl != NULL)
-		prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(gc->prpl);
+	if (gc != NULL && gc->priv->prpl != NULL)
+		prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(gc->priv->prpl);
 
 	if (!prpl_info || !prpl_info->keepalive)
 		return;
 
-	if (on && !gc->keepalive)
+	if (on && !gc->priv->keepalive)
 	{
 		purple_debug_info("connection", "Activating keepalive.\n");
-		gc->keepalive = purple_timeout_add_seconds(KEEPALIVE_INTERVAL, send_keepalive, gc);
+		gc->priv->keepalive = purple_timeout_add_seconds(KEEPALIVE_INTERVAL, send_keepalive, gc);
 	}
-	else if (!on && gc->keepalive > 0)
+	else if (!on && gc->priv->keepalive > 0)
 	{
 		purple_debug_info("connection", "Deactivating keepalive.\n");
-		purple_timeout_remove(gc->keepalive);
-		gc->keepalive = 0;
+		purple_timeout_remove(gc->priv->keepalive);
+		gc->priv->keepalive = 0;
 	}
 }
 
@@ -103,7 +164,12 @@ purple_connection_new(PurpleAccount *acc
 	PurplePlugin *prpl;
 	PurplePluginProtocolInfo *prpl_info;
 
+#warning Bring back when PurpleAccount is GObject
+#if 0
+	g_return_val_if_fail(PURPLE_IS_ACCOUNT(account), NULL);
+#else
 	g_return_if_fail(account != NULL);
+#endif
 
 	if (!purple_account_is_disconnected(account))
 		return;
@@ -140,25 +206,21 @@ purple_connection_new(PurpleAccount *acc
 		}
 	}
 
-	gc = g_new0(PurpleConnection, 1);
+	gc = g_object_new(PURPLE_TYPE_CONNECTION, "account", account, NULL);
 	PURPLE_DBUS_REGISTER_POINTER(gc, PurpleConnection);
 
-	gc->prpl = prpl;
-	if ((password != NULL) && (*password != '\0'))
-		gc->password = g_strdup(password);
-	purple_connection_set_account(gc, account);
-	purple_connection_set_state(gc, PURPLE_CONNECTING);
-	connections = g_list_append(connections, gc);
-	purple_account_set_connection(account, gc);
+	gc->priv->password = g_strdup(password);
 
+#if 0
 	purple_signal_emit(purple_connections_get_handle(), "signing-on", gc);
+#endif
 
 	if (regist)
 	{
 		purple_debug_info("connection", "Registering.  gc = %p\n", gc);
 
 		/* set this so we don't auto-reconnect after registering */
-		gc->wants_to_die = TRUE;
+		gc->priv->wants_to_die = TRUE;
 
 		prpl_info->register_user(account);
 	}
@@ -212,15 +274,16 @@ purple_connection_new_unregister(PurpleA
 	gc = g_new0(PurpleConnection, 1);
 	PURPLE_DBUS_REGISTER_POINTER(gc, PurpleConnection);
 	
-	gc->prpl = prpl;
-	if ((password != NULL) && (*password != '\0'))
-		gc->password = g_strdup(password);
+	gc->priv->prpl = prpl;
+	gc->priv->password = g_strdup(password);
 	purple_connection_set_account(gc, account);
-	purple_connection_set_state(gc, PURPLE_CONNECTING);
+	purple_connection_set_state(gc, PURPLE_CONNECTION_STATE_CONNECTING);
 	connections = g_list_append(connections, gc);
 	purple_account_set_connection(account, gc);
 	
+#if 0
 	purple_signal_emit(purple_connections_get_handle(), "signing-on", gc);
+#endif
 	
 	purple_debug_info("connection", "Unregistering.  gc = %p\n", gc);
 	
@@ -241,16 +304,18 @@ purple_connection_destroy(PurpleConnecti
 
 	purple_debug_info("connection", "Disconnecting connection %p\n", gc);
 
-	if (purple_connection_get_state(gc) != PURPLE_CONNECTING)
+	if (purple_connection_get_state(gc) != PURPLE_CONNECTION_STATE_CONNECTING)
 		remove = TRUE;
 
+#if 0
 	purple_signal_emit(purple_connections_get_handle(), "signing-off", gc);
+#endif
 
-	while (gc->buddy_chats)
+	while (gc->priv->buddy_chats)
 	{
-		PurpleConversation *b = gc->buddy_chats->data;
+		PurpleConversation *b = gc->priv->buddy_chats->data;
 
-		gc->buddy_chats = g_slist_remove(gc->buddy_chats, b);
+		gc->priv->buddy_chats = g_slist_remove(gc->priv->buddy_chats, b);
 		purple_conv_chat_left(PURPLE_CONV_CHAT(b));
 	}
 
@@ -258,7 +323,7 @@ purple_connection_destroy(PurpleConnecti
 
 	purple_proxy_connect_cancel_with_handle(gc);
 
-	prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(gc->prpl);
+	prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(gc->priv->prpl);
 	if (prpl_info->close)
 		(prpl_info->close)(gc);
 
@@ -272,12 +337,14 @@ purple_connection_destroy(PurpleConnecti
 
 	connections = g_list_remove(connections, gc);
 
-	purple_connection_set_state(gc, PURPLE_DISCONNECTED);
+	purple_connection_set_state(gc, PURPLE_CONNECTION_STATE_DISCONNECTED);
 
 	if (remove)
 		purple_blist_remove_account(account);
 
+#if 0
 	purple_signal_emit(purple_connections_get_handle(), "signed-off", gc);
+#endif
 
 	purple_account_request_close_with_account(account);
 	purple_request_close_with_handle(gc);
@@ -287,11 +354,11 @@ purple_connection_destroy(PurpleConnecti
 
 	purple_account_set_connection(account, NULL);
 
-	g_free(gc->password);
-	g_free(gc->display_name);
+	g_free(gc->priv->password);
+	g_free(gc->priv->display_name);
 
-	if (gc->disconnect_timeout)
-		purple_timeout_remove(gc->disconnect_timeout);
+	if (gc->priv->disconnect_timeout)
+		purple_timeout_remove(gc->priv->disconnect_timeout);
 
 	PURPLE_DBUS_UNREGISTER_POINTER(gc);
 	g_free(gc);
@@ -314,21 +381,21 @@ purple_connection_set_state(PurpleConnec
 
 	g_return_if_fail(gc != NULL);
 
-	if (gc->state == state)
+	if (gc->priv->state == state)
 		return;
 
-	gc->state = state;
+	gc->priv->state = state;
 
 	ops = purple_connections_get_ui_ops();
 
-	if (gc->state == PURPLE_CONNECTING) {
+	if (gc->priv->state == PURPLE_CONNECTION_STATE_CONNECTING) {
 		connections_connecting = g_list_append(connections_connecting, gc);
 	}
 	else {
 		connections_connecting = g_list_remove(connections_connecting, gc);
 	}
 
-	if (gc->state == PURPLE_CONNECTED) {
+	if (gc->priv->state == PURPLE_CONNECTION_STATE_CONNECTED) {
 		PurpleAccount *account;
 		PurplePresence *presence;
 
@@ -359,13 +426,15 @@ purple_connection_set_state(PurpleConnec
 
 		purple_blist_add_account(account);
 
+#if 0
 		purple_signal_emit(purple_connections_get_handle(), "signed-on", gc);
+#endif
 
 		serv_set_permit_deny(gc);
 
 		update_keepalive(gc, TRUE);
 	}
-	else if (gc->state == PURPLE_DISCONNECTED) {
+	else if (gc->priv->state == PURPLE_CONNECTION_STATE_DISCONNECTED) {
 		PurpleAccount *account = purple_connection_get_account(gc);
 
 		if (purple_prefs_get_bool("/purple/logging/log_system"))
@@ -396,7 +465,20 @@ purple_connection_set_account(PurpleConn
 	g_return_if_fail(gc != NULL);
 	g_return_if_fail(account != NULL);
 
-	gc->account = account;
+	if (gc->priv->account == account)
+		return;
+
+	purple_account_set_connection(gc->priv->account, NULL);
+
+#if 1
+#warning Remove this after PurpleAccount is GObject
+	gc->priv->account = account;
+#else
+	gc->priv->account = g_object_ref(account);
+#endif
+	gc->priv->prpl = account ? purple_find_prpl(purple_account_get_protocol_id(account)) : NULL;
+
+	purple_account_set_connection(account, gc);
 }
 
 void
@@ -404,24 +486,32 @@ purple_connection_set_display_name(Purpl
 {
 	g_return_if_fail(gc != NULL);
 
-	g_free(gc->display_name);
-	gc->display_name = g_strdup(name);
+	g_free(gc->priv->display_name);
+	gc->priv->display_name = g_strdup(name);
 }
 
 PurpleConnectionState
 purple_connection_get_state(const PurpleConnection *gc)
 {
-	g_return_val_if_fail(gc != NULL, PURPLE_DISCONNECTED);
+	g_return_val_if_fail(gc != NULL, PURPLE_CONNECTION_STATE_DISCONNECTED);
 
-	return gc->state;
+	return gc->priv->state;
 }
 
+PurpleConnectionFlags
+purple_connection_get_flags(PurpleConnection *gc)
+{
+	g_return_val_if_fail(gc != NULL, 0);
+
+	return gc->priv->flags;
+}
+
 PurpleAccount *
 purple_connection_get_account(const PurpleConnection *gc)
 {
 	g_return_val_if_fail(gc != NULL, NULL);
 
-	return gc->account;
+	return gc->priv->account;
 }
 
 PurplePlugin *
@@ -429,7 +519,7 @@ purple_connection_get_prpl(const PurpleC
 {
 	g_return_val_if_fail(gc != NULL, NULL);
 
-	return gc->prpl;
+	return gc->priv->prpl;
 }
 
 const char *
@@ -437,7 +527,7 @@ purple_connection_get_password(const Pur
 {
 	g_return_val_if_fail(gc != NULL, NULL);
 
-	return gc->password ? gc->password : gc->account->password;
+	return purple_connection_get_password(gc) ? purple_connection_get_password(gc) : purple_account_get_password(gc->priv->account);
 }
 
 const char *
@@ -445,7 +535,7 @@ purple_connection_get_display_name(const
 {
 	g_return_val_if_fail(gc != NULL, NULL);
 
-	return gc->display_name;
+	return gc->priv->display_name;
 }
 
 void
@@ -499,7 +589,7 @@ purple_connection_error(PurpleConnection
 	 * and PURPLE_CONNECTION_ERROR_NETWORK_ERROR (which isn't) if not.  See
 	 * the documentation in connection.h.
 	 */
-	PurpleConnectionError reason = gc->wants_to_die
+	PurpleConnectionError reason = gc->priv->wants_to_die
 	                             ? PURPLE_CONNECTION_ERROR_OTHER_ERROR
 	                             : PURPLE_CONNECTION_ERROR_NETWORK_ERROR;
 	purple_connection_error_reason (gc, reason, text);
@@ -531,10 +621,10 @@ purple_connection_error_reason (PurpleCo
 	}
 
 	/* If we've already got one error, we don't need any more */
-	if (gc->disconnect_timeout)
+	if (gc->priv->disconnect_timeout)
 		return;
 
-	gc->wants_to_die = purple_connection_error_is_fatal (reason);
+	gc->priv->wants_to_die = purple_connection_error_is_fatal (reason);
 
 	ops = purple_connections_get_ui_ops();
 
@@ -546,10 +636,12 @@ purple_connection_error_reason (PurpleCo
 			ops->report_disconnect (gc, description);
 	}
 
+#if 0
 	purple_signal_emit(purple_connections_get_handle(), "connection-error",
 		gc, reason, description);
+#endif
 
-	gc->disconnect_timeout = purple_timeout_add(0, purple_connection_disconnect_cb,
+	gc->priv->disconnect_timeout = purple_timeout_add(0, purple_connection_disconnect_cb,
 			purple_connection_get_account(gc));
 }
 
@@ -608,85 +700,319 @@ purple_connection_error_is_fatal (Purple
 	}
 }
 
-void
-purple_connections_disconnect_all(void)
+/******************************************************************************
+ * Object Stuff
+ *****************************************************************************/
+static void
+purple_connection_get_property(GObject *obj, guint param_id, GValue *value,
+							   GParamSpec *pspec)
 {
-	GList *l;
-	PurpleConnection *gc;
+	PurpleConnection *pc = PURPLE_CONNECTION(obj);
 
-	while ((l = purple_connections_get_all()) != NULL) {
-		gc = l->data;
-		gc->wants_to_die = TRUE;
-		purple_account_disconnect(gc->account);
+	switch(param_id) {
+		case PROP_FLAGS:
+			g_value_set_flags(value, pc->priv->flags);
+			break;
+		case PROP_STATE:
+			g_value_set_enum(value, purple_connection_get_state(pc));
+			break;
+		case PROP_ACCOUNT:
+			#warning fix me when account is an object
+			g_value_set_pointer(value, purple_connection_get_account(pc));
+			break;
+#if 0
+		case PROP_INPUT_WATCHER:
+			g_value_set_int(value, purple_connection_get_input_watcher(pc));
+			break;
+		case PROP_BUDDY_CHATS:
+			g_value_set_pointer(value, purple_connection_get_buddy_chats(pc));
+			break;
+		case PROP_KEEPALIVE:
+			g_value_set_uint(value, purple_connection_get_keepalive(pc));
+			break;
+		case PROP_WANTS_TO_DIE:
+			g_value_set_boolean(value, purple_connection_get_wants_to_die(pc));
+			break;
+		case PROP_DISCONNECT_TIMEOUT:
+			g_value_set_uint(value,
+							 purple_connection_get_disconnect_timeout(pc));
+			break;
+#endif
+		default:
+			G_OBJECT_WARN_INVALID_PROPERTY_ID(obj, param_id, pspec);
+			break;
 	}
 }
 
-GList *
-purple_connections_get_all(void)
+static void
+purple_connection_set_property(GObject *obj, guint param_id,
+							   const GValue *value, GParamSpec *pspec)
 {
-	return connections;
-}
+	PurpleConnection *pc = PURPLE_CONNECTION(obj);
 
-GList *
-purple_connections_get_connecting(void)
-{
-	return connections_connecting;
+	switch(param_id) {
+		case PROP_FLAGS:
+			pc->priv->flags = g_value_get_flags(value);
+			break;
+		case PROP_STATE:
+			purple_connection_set_state(pc, g_value_get_enum(value));
+			break;
+		case PROP_ACCOUNT:
+			#warning fix me when account is an object
+			purple_connection_set_account(pc, g_value_get_pointer(value));
+			break;
+#if 0
+		case PROP_INPUT_WATCHER:
+			purple_connection_set_input_watcher(pc, g_value_get_int(value));
+			break;
+		case PROP_BUDDY_CHATS:
+			purple_connection_set_buddy_chats(pc, g_value_get_pointer(value));
+			break;
+		case PROP_KEEPALIVE:
+			purple_connection_set_keepalive(pc, g_value_get_uint(value));
+			break;
+		case PROP_WANTS_TO_DIE:
+			purple_connection_set_wants_to_die(pc, g_value_get_boolean(value));
+			break;
+		case PROP_DISCONNECT_TIMEOUT:
+			purple_connection_set_disconnect_timeout(pc,
+													 g_value_get_uint(value));
+			break;
+#endif
+		default:
+			G_OBJECT_WARN_INVALID_PROPERTY_ID(obj, param_id, pspec);
+			break;
+	}
 }
 
-void
-purple_connections_set_ui_ops(PurpleConnectionUiOps *ops)
+static void
+purple_connection_finalize(GObject *obj)
 {
-	connection_ui_ops = ops;
+	PurpleConnection *pc = PURPLE_CONNECTION(obj);
+
+#warning Enable this when PurpleAccount is a GObject.
+#if 0
+	if (PURPLE_IS_ACCOUNT(pc->priv->account))
+		g_object_unref(G_OBJECT(pc->priv->account));
+#endif
+
+	g_free(pc->priv);
+
+	G_OBJECT_CLASS(parent_class)->finalize(obj);
 }
 
-PurpleConnectionUiOps *
-purple_connections_get_ui_ops(void)
+static void
+purple_connection_init(GTypeInstance *instance, gpointer klass)
 {
-	return connection_ui_ops;
+	PurpleConnection *pc = PURPLE_CONNECTION(instance);
+
+	pc->priv = g_new0(PurpleConnectionPrivate, 1);
+	purple_connection_set_state(pc, PURPLE_CONNECTION_STATE_CONNECTING);
 }
 
-void
-purple_connections_init(void)
+static void
+purple_connection_class_init(PurpleConnectionClass *klass)
 {
-	void *handle = purple_connections_get_handle();
+	GObjectClass *obj_class = G_OBJECT_CLASS(klass);
+	GParamSpec *pspec;
 
-	purple_signal_register(handle, "signing-on",
-						 purple_marshal_VOID__POINTER, NULL, 1,
-						 purple_value_new(PURPLE_TYPE_SUBTYPE,
-										PURPLE_SUBTYPE_CONNECTION));
+	parent_class = g_type_class_peek_parent(klass);
 
-	purple_signal_register(handle, "signed-on",
-						 purple_marshal_VOID__POINTER, NULL, 1,
-						 purple_value_new(PURPLE_TYPE_SUBTYPE,
-										PURPLE_SUBTYPE_CONNECTION));
+	obj_class->get_property = purple_connection_get_property;
+	obj_class->set_property = purple_connection_set_property;
+	obj_class->finalize = purple_connection_finalize;
 
-	purple_signal_register(handle, "signing-off",
-						 purple_marshal_VOID__POINTER, NULL, 1,
-						 purple_value_new(PURPLE_TYPE_SUBTYPE,
-										PURPLE_SUBTYPE_CONNECTION));
+	pspec = g_param_spec_enum("flags", "flags",
+							  "The flags for this connection.",
+							  PURPLE_TYPE_CONNECTION_FLAGS,
+							  0,
+							  G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY);
+	g_object_class_install_property(obj_class, PROP_FLAGS, pspec);
 
-	purple_signal_register(handle, "signed-off",
-						 purple_marshal_VOID__POINTER, NULL, 1,
-						 purple_value_new(PURPLE_TYPE_SUBTYPE,
-										PURPLE_SUBTYPE_CONNECTION));
+	pspec = g_param_spec_enum("state", "state",
+							  "The state of this connection.",
+							  PURPLE_TYPE_CONNECTION_STATE,
+							  PURPLE_CONNECTION_STATE_DISCONNECTED,
+							  G_PARAM_READWRITE);
+	g_object_class_install_property(obj_class, PROP_STATE, pspec);
 
-	purple_signal_register(handle, "connection-error",
-	                       purple_marshal_VOID__POINTER_INT_POINTER, NULL, 3,
-	                       purple_value_new(PURPLE_TYPE_SUBTYPE,
-	                                        PURPLE_SUBTYPE_CONNECTION),
-	                       purple_value_new(PURPLE_TYPE_ENUM),
-	                       purple_value_new(PURPLE_TYPE_STRING));
+	#warning This needs to be moved to g_param_spec_object when account is objectified
+	pspec = g_param_spec_pointer("account", "account",
+								 "The account this connection belongs to.",
+								 G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY);
+	g_object_class_install_property(obj_class, PROP_ACCOUNT, pspec);
 
+#warning These probably doesn't need any exposing
+#if 0
+	pspec = g_param_spec_int("inpa", "inpa",
+							 "The input watcher's fd for this connection.",
+							 G_MININT, G_MAXINT, -1,
+							 G_PARAM_READWRITE);
+	g_object_class_install_property(obj_class, PROP_INPA, pspec);
+
+	pspec = g_param_spec_pointer("buddy-chats", "buddy-chats",
+								 "A list of buddy chats for this connection.",
+								 G_PARAM_READWRITE);
+	g_object_class_install_property(obj_class, PROP_BUDDY_CHATS, pspec);
+
+	pspec = g_param_spec_uint("keepalive", "keepalive",
+							  "The keepalive value for this connection.",
+							  0, G_MAXUINT, 0,
+							  G_PARAM_READWRITE);
+	g_object_class_install_property(obj_class, PROP_KEEPALIVE, pspec);
+
+#warning wants-to-die needs-to-die
+	pspec = g_param_spec_boolean("wants-to-die", "wants-to-die",
+								 "Whether or not this connection wants to "
+								 "die.",
+								 FALSE, G_PARAM_READWRITE);
+	g_object_class_install_property(obj_class, PROP_WANTS_TO_DIE, pspec);
+
+	pspec = g_param_spec_uint("disconnect-timeout", "disconnect-timeout",
+							  "The disconnect timeout handle for this "
+							  "connection.",
+							  0, G_MAXUINT, 0,
+							  G_PARAM_READWRITE);
+	g_object_class_install_property(obj_class, PROP_DISCONNECT_TIMEOUT, pspec);
+#endif
+
+	signals[SIG_SIGNING_ON] =
+		g_signal_new("signing-on",
+					 G_OBJECT_CLASS_TYPE(klass),
+					 G_SIGNAL_RUN_LAST,
+					 G_STRUCT_OFFSET(PurpleConnectionClass, signing_on),
+					 NULL, NULL,
+					 purple_smarshal_VOID__OBJECT,
+					 G_TYPE_NONE,
+					 0);
+
+	signals[SIG_SIGNED_ON] =
+		g_signal_new("signed-on",
+					 G_OBJECT_CLASS_TYPE(klass),
+					 G_SIGNAL_RUN_LAST,
+					 G_STRUCT_OFFSET(PurpleConnectionClass, signed_on),
+					 NULL, NULL,
+					 purple_smarshal_VOID__OBJECT,
+					 G_TYPE_NONE,
+					 0);
+
+	signals[SIG_SIGNING_OFF] =
+		g_signal_new("signing-off",
+					 G_OBJECT_CLASS_TYPE(klass),
+					 G_SIGNAL_RUN_LAST,
+					 G_STRUCT_OFFSET(PurpleConnectionClass, signing_off),
+					 NULL, NULL,
+					 purple_smarshal_VOID__OBJECT,
+					 G_TYPE_NONE,
+					 0);
+
+	signals[SIG_SIGNED_OFF] =
+		g_signal_new("signed-off",
+					 G_OBJECT_CLASS_TYPE(klass),
+					 G_SIGNAL_RUN_LAST,
+					 G_STRUCT_OFFSET(PurpleConnectionClass, signed_off),
+					 NULL, NULL,
+					 purple_smarshal_VOID__OBJECT,
+					 G_TYPE_NONE,
+					 0);
+
+	signals[SIG_DISCONNECTED] =
+		g_signal_new("disconnected",
+					 G_OBJECT_CLASS_TYPE(klass),
+					 G_SIGNAL_RUN_LAST,
+					 G_STRUCT_OFFSET(PurpleConnectionClass, disconnected),
+					 NULL, NULL,
+					 purple_smarshal_VOID__OBJECT,
+					 G_TYPE_NONE,
+					 0);
 }
 
-void
-purple_connections_uninit(void)
+/******************************************************************************
+ * API
+ *****************************************************************************/
+GType
+purple_connection_get_gtype(void)
 {
-	purple_signals_unregister_by_instance(purple_connections_get_handle());
+	static GType type = 0;
+
+	if(type == 0) {
+		static const GTypeInfo info = {
+			sizeof(PurpleConnectionClass),
+			NULL,
+			NULL,
+			(GClassInitFunc)purple_connection_class_init,
+			NULL,
+			NULL,
+			sizeof(PurpleConnection),
+			0,
+			purple_connection_init,
+			NULL,
+		};
+
+		type = g_type_register_static(G_TYPE_OBJECT,
+									  "PurpleConnection",
+									  &info, 0);
+	}
+
+	return type;
 }
 
-void *
-purple_connections_get_handle(void)
+/******************************************************************************
+ * PurpleConnectionFlags API
+ *****************************************************************************/
+GType
+purple_connection_flags_get_gtype(void)
 {
-	return &connections_handle;
+	static GType type = 0;
+
+	if(type == 0) {
+		static const GFlagsValue values[] = {
+			{ PURPLE_CONNECTION_FLAGS_HTML, "HTML", "HTML" },
+			{ PURPLE_CONNECTION_FLAGS_NO_BGCOLOR, "NO BG", "NO BG" },
+			{ PURPLE_CONNECTION_FLAGS_AUTO_RESP, "Autoresponse",
+			  "Autoresponse"
+			},
+			{ PURPLE_CONNECTION_FLAGS_FORMATTING_WBFO, "WBFO", "WBFO" },
+			{ PURPLE_CONNECTION_FLAGS_NO_NEWLINES, "No newlines",
+			  "No newlines"
+			},
+			{ PURPLE_CONNECTION_FLAGS_NO_FONTSIZE, "No fontsize",
+			  "No fontsize"
+			},
+			{ PURPLE_CONNECTION_FLAGS_NO_URLDESC, "No url desc",
+			  "No url desc"
+			},
+			{ PURPLE_CONNECTION_FLAGS_NO_IMAGES, "No images", "No images", },
+			{ 0, NULL, NULL },
+		};
+
+		type = g_flags_register_static("PurpleConnectionState", values);
+	}
+
+	return type;
 }
+
+/******************************************************************************
+ * PurpleConnectionState API
+ *****************************************************************************/
+GType
+purple_connection_state_get_gtype(void)
+{
+	static GType type = 0;
+
+	if(type == 0) {
+		static const GEnumValue values[] = {
+			{ PURPLE_CONNECTION_STATE_DISCONNECTED, "Disconnected",
+			  "Disconnected"
+			},
+			{ PURPLE_CONNECTION_STATE_CONNECTING, "Connecting", "Connecting" },
+			{ PURPLE_CONNECTION_STATE_CONNECTED, "Connected", "Connected" },
+			{ 0, NULL, NULL },
+		};
+
+		type = g_enum_register_static("PurpleConnectionState", values);
+	}
+
+	return type;
+}
+
============================================================
--- libpurple/connection.h	c3fed808d1ad12de763ce0a7f93bfc39b6292275
+++ libpurple/connection.h	a353dd2ca7f9f082dd5893055326a54ef932f95e
@@ -24,33 +24,49 @@
  * along with this program; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02111-1301  USA
  */
-#ifndef _PURPLE_CONNECTION_H_
-#define _PURPLE_CONNECTION_H_
+#ifndef PURPLE_CONNECTION_H
+#define PURPLE_CONNECTION_H
 
-typedef struct _PurpleConnection PurpleConnection;
+#include <glib.h>
+#include <glib-object.h>
 
+#define PURPLE_TYPE_CONNECTION				(purple_connection_get_gtype())
+#define PURPLE_CONNECTION(obj)				(G_TYPE_CHECK_INSTANCE_CAST((obj), PURPLE_TYPE_CONNECTION, PurpleConnection))
+#define PURPLE_CONNECTION_CLASS(klass)		(G_TYPE_CHECK_CLASS_CAST((klass), PURPLE_TYPE_CONNECTION, PurpleConnectionClass))
+#define PURPLE_IS_CONNECTION(obj)			(G_TYPE_CHECK_INSTANCE_TYPE((obj), PURPLE_TYPE_CONNECTION))
+#define PURPLE_IS_CONNECTION_CLASS(klass)	(G_TYPE_CHECK_CLASS_TYPE((klass), PURPLE_TYPE_CONNECTION))
+#define PURPLE_CONNECTION_GET_CLASS(obj)	(G_TYPE_INSTANCE_GET_CLASS((obj), PURPLE_TYPE_CONNECTION, PurpleConnectionClass))
+
+typedef struct _PurpleConnection			PurpleConnection;
+typedef struct _PurpleConnectionPrivate		PurpleConnectionPrivate;
+typedef struct _PurpleConnectionClass		PurpleConnectionClass;
+
+#define PURPLE_TYPE_CONNECTION_FLAGS		(purple_connection_flags_get_gtype())
+
 /**
  * Flags to change behavior of the client for a given connection.
  */
 typedef enum
 {
-	PURPLE_CONNECTION_HTML       = 0x0001, /**< Connection sends/receives in 'HTML'. */
-	PURPLE_CONNECTION_NO_BGCOLOR = 0x0002, /**< Connection does not send/receive
+	PURPLE_CONNECTION_FLAGS_HTML       = 0x0001, /**< Connection sends/receives in 'HTML'. */
+	PURPLE_CONNECTION_FLAGS_NO_BGCOLOR = 0x0002, /**< Connection does not send/receive
 					           background colors.                  */
-	PURPLE_CONNECTION_AUTO_RESP  = 0x0004,  /**< Send auto responses when away.       */
-	PURPLE_CONNECTION_FORMATTING_WBFO = 0x0008, /**< The text buffer must be formatted as a whole */
-	PURPLE_CONNECTION_NO_NEWLINES = 0x0010, /**< No new lines are allowed in outgoing messages */
-	PURPLE_CONNECTION_NO_FONTSIZE = 0x0020, /**< Connection does not send/receive font sizes */
-	PURPLE_CONNECTION_NO_URLDESC = 0x0040,  /**< Connection does not support descriptions with links */ 
-	PURPLE_CONNECTION_NO_IMAGES = 0x0080,  /**< Connection does not support sending of images */
+	PURPLE_CONNECTION_FLAGS_AUTO_RESP  = 0x0004,  /**< Send auto responses when away.       */
+	PURPLE_CONNECTION_FLAGS_FORMATTING_WBFO = 0x0008, /**< The text buffer must be formatted as a whole */
+	PURPLE_CONNECTION_FLAGS_NO_NEWLINES = 0x0010, /**< No new lines are allowed in outgoing messages */
+	PURPLE_CONNECTION_FLAGS_NO_FONTSIZE = 0x0020, /**< Connection does not send/receive font sizes */
+	PURPLE_CONNECTION_FLAGS_NO_URLDESC = 0x0040,  /**< Connection does not support descriptions with links */ 
+	PURPLE_CONNECTION_FLAGS_NO_IMAGES = 0x0080,  /**< Connection does not support sending of images */
 
 } PurpleConnectionFlags;
 
+#define PURPLE_TYPE_CONNECTION_STATE		(purple_connection_state_get_gtype())
+
 typedef enum
 {
-	PURPLE_DISCONNECTED = 0, /**< Disconnected. */
-	PURPLE_CONNECTED,        /**< Connected.    */
-	PURPLE_CONNECTING        /**< Connecting.   */
+	PURPLE_CONNECTION_STATE_DISCONNECTED = 0, /**< Disconnected. */
+	PURPLE_CONNECTION_STATE_CONNECTED,        /**< Connected.    */
+	PURPLE_CONNECTION_STATE_CONNECTING        /**< Connecting.   */
 
 } PurpleConnectionState;
 
@@ -224,41 +240,37 @@ struct _PurpleConnection
 
 struct _PurpleConnection
 {
-	PurplePlugin *prpl;            /**< The protocol plugin.               */
-	PurpleConnectionFlags flags;   /**< Connection flags.                  */
+	GObject gparent;
 
-	PurpleConnectionState state;   /**< The connection state.              */
+	PurpleConnectionPrivate *priv;
 
-	PurpleAccount *account;        /**< The account being connected to.    */
-	char *password;              /**< The password used.                 */
-	int inpa;                    /**< The input watcher.                 */
+	void (*_purple_reserved1)(void);
+	void (*_purple_reserved2)(void);
+	void (*_purple_reserved3)(void);
+	void (*_purple_reserved4)(void);
+};
 
-	GSList *buddy_chats;         /**< A list of active chats
-	                                  (#PurpleConversation structs of type
-	                                  #PURPLE_CONV_TYPE_CHAT).           */
-	void *proto_data;            /**< Protocol-specific data.            */
+struct _PurpleConnectionClass
+{
+	GObjectClass gparent;
 
-	char *display_name;          /**< How you appear to other people.    */
-	guint keepalive;             /**< Keep-alive.                        */
+	void (*signing_on)(PurpleConnection *pc);
+	void (*signed_on)(PurpleConnection *pc);
 
-	/** Wants to Die state.  This is set when the user chooses to log out, or
-	 * when the protocol is disconnected and should not be automatically
-	 * reconnected (incorrect password, etc.).  prpls should rely on
-	 * purple_connection_error_reason() to set this for them rather than
-	 * setting it themselves.
-	 * @see purple_connection_error_is_fatal
-	 */
-	gboolean wants_to_die;
+	void (*signing_off)(PurpleConnection *pc);
+	void (*signed_off)(PurpleConnection *pc);
 
-	guint disconnect_timeout;    /**< Timer used for nasty stack tricks  */
-	time_t last_received;        /**< When we last received a packet. Set by the
-					  prpl to avoid sending unneeded keepalives */
+	void (*disconnected)(PurpleConnection *pc);
+
+	void (*_purple_reserved1)(void);
+	void (*_purple_reserved2)(void);
+	void (*_purple_reserved3)(void);
+	void (*_purple_reserved4)(void);
 };
 
-#ifdef __cplusplus
-extern "C" {
-#endif
+G_BEGIN_DECLS
 
+
 /**************************************************************************/
 /** @name Connection API                                                  */
 /**************************************************************************/
@@ -323,7 +335,7 @@ void purple_connection_destroy(PurpleCon
 
 /**
  * Sets the connection state.  PRPLs should call this and pass in
- * the state #PURPLE_CONNECTED when the account is completely
+ * the state #PURPLE_CONNECTION_STATE_CONNECTED when the account is completely
  * signed on.  What does it mean to be completely signed on?  If
  * the core can call prpl->set_status, and it successfully changes
  * your status, then the account is online.
@@ -358,13 +370,15 @@ PurpleConnectionState purple_connection_
  */
 PurpleConnectionState purple_connection_get_state(const PurpleConnection *gc);
 
+PurpleConnectionFlags purple_connection_get_flags(PurpleConnection *gc);
+
 /**
  * Returns TRUE if the account is connected, otherwise returns FALSE.
  *
  * @return TRUE if the account is connected, otherwise returns FALSE.
  */
 #define PURPLE_CONNECTION_IS_CONNECTED(gc) \
-	(purple_connection_get_state(gc) == PURPLE_CONNECTED)
+	(purple_connection_get_state(gc) == PURPLE_CONNECTION_STATE_CONNECTED)
 
 /**
  * Returns the connection's account.
@@ -546,33 +560,13 @@ PurpleConnectionUiOps *purple_connection
 
 /*@}*/
 
-/**************************************************************************/
-/** @name Connections Subsystem                                           */
-/**************************************************************************/
-/*@{*/
+/******************************************************************************
+ * New API
+ *****************************************************************************/
+GType purple_connection_get_gtype(void);
+GType purple_connection_flags_get_gtype(void);
+GType purple_connection_state_get_gtype(void);
 
-/**
- * Initializes the connections subsystem.
- */
-void purple_connections_init(void);
+G_END_DECLS
 
+#endif /* PURPLE_CONNECTION_H */
-/**
- * Uninitializes the connections subsystem.
- */
-void purple_connections_uninit(void);
-
-/**
- * Returns the handle to the connections subsystem.
- *
- * @return The connections subsystem handle.
- */
-void *purple_connections_get_handle(void);
-
-/*@}*/
-
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* _PURPLE_CONNECTION_H_ */
============================================================
--- libpurple/conversation.c	91daa642a7b1b219f3549cd1ca7a61dec598baf2
+++ libpurple/conversation.c	383f63f32505d9ff13bb32586f1746c4ade5873f
@@ -118,7 +118,7 @@ common_send(PurpleConversation *conv, co
 			displayed = purple_markup_linkify(message);
 	}
 
-	if (displayed && (conv->features & PURPLE_CONNECTION_HTML) &&
+	if (displayed && (conv->features & PURPLE_CONNECTION_FLAGS_HTML) &&
 		!(msgflags & PURPLE_MESSAGE_RAW)) {
 		sent = g_strdup(displayed);
 	} else
@@ -218,7 +218,7 @@ add_message_to_history(PurpleConversatio
 		if (gc)
 			me = purple_connection_get_display_name(gc);
 		if (!me)
-			me = conv->account->username;
+			me = purple_account_get_username(conv->account);
 		who = me;
 	}
 
@@ -321,7 +321,7 @@ purple_conversation_new(PurpleConversati
 	conv->data         = g_hash_table_new_full(g_str_hash, g_str_equal,
 											   g_free, NULL);
 	/* copy features from the connection. */
-	conv->features = gc->flags;
+	conv->features = purple_connection_get_flags(gc);
 
 	if (type == PURPLE_CONV_TYPE_IM)
 	{
@@ -354,7 +354,7 @@ purple_conversation_new(PurpleConversati
 
 		chats = g_list_append(chats, conv);
 
-		if ((disp = purple_connection_get_display_name(account->gc)))
+		if ((disp = purple_connection_get_display_name(purple_account_get_connection(account))))
 			purple_conv_chat_set_nick(conv->u.chat, disp);
 		else
 			purple_conv_chat_set_nick(conv->u.chat,
@@ -626,7 +626,7 @@ purple_conversation_get_gc(const PurpleC
 	if (account == NULL)
 		return NULL;
 
-	return account->gc;
+	return purple_account_get_connection(account);
 }
 
 void
@@ -861,9 +861,12 @@ purple_conversation_write(PurpleConversa
 	if (account != NULL)
 		gc = purple_account_get_connection(account);
 
+#warning I think commenting this breaks unnamed chats
+#if 0
 	if (purple_conversation_get_type(conv) == PURPLE_CONV_TYPE_CHAT &&
 		(gc == NULL || !g_slist_find(gc->buddy_chats, conv)))
 		return;
+#endif
 
 	if (purple_conversation_get_type(conv) == PURPLE_CONV_TYPE_IM &&
 		!g_list_find(purple_get_conversations(), conv))
@@ -1602,7 +1605,7 @@ purple_conv_chat_add_users(PurpleConvCha
 				}
 			} else {
 				PurpleBuddy *buddy;
-				if ((buddy = purple_find_buddy(gc->account, user)) != NULL)
+				if ((buddy = purple_find_buddy(purple_connection_get_account(gc), user)) != NULL)
 					alias = purple_buddy_get_contact_alias(buddy);
 			}
 		}
@@ -1700,7 +1703,7 @@ purple_conv_chat_rename_user(PurpleConvC
 		}
 	} else if (!(prpl_info->options & OPT_PROTO_UNIQUE_CHATNAME)) {
 		PurpleBuddy *buddy;
-		if ((buddy = purple_find_buddy(gc->account, new_user)) != NULL)
+		if ((buddy = purple_find_buddy(purple_connection_get_account(gc), new_user)) != NULL)
 			new_alias = purple_buddy_get_contact_alias(buddy);
 	}
 
@@ -1748,9 +1751,9 @@ purple_conv_chat_rename_user(PurpleConvC
 			if (!(prpl_info->options & OPT_PROTO_UNIQUE_CHATNAME)) {
 				PurpleBuddy *buddy;
 
-				if ((buddy = purple_find_buddy(gc->account, old_user)) != NULL)
+				if ((buddy = purple_find_buddy(purple_connection_get_account(gc), old_user)) != NULL)
 					old_alias = purple_buddy_get_contact_alias(buddy);
-				if ((buddy = purple_find_buddy(gc->account, new_user)) != NULL)
+				if ((buddy = purple_find_buddy(purple_connection_get_account(gc), new_user)) != NULL)
 					new_alias = purple_buddy_get_contact_alias(buddy);
 			}
 
@@ -1825,7 +1828,7 @@ purple_conv_chat_remove_users(PurpleConv
 			if (!(prpl_info->options & OPT_PROTO_UNIQUE_CHATNAME)) {
 				PurpleBuddy *buddy;
 
-				if ((buddy = purple_find_buddy(gc->account, user)) != NULL)
+				if ((buddy = purple_find_buddy(purple_connection_get_account(gc), user)) != NULL)
 					alias = purple_buddy_get_contact_alias(buddy);
 			}
 
============================================================
--- libpurple/core.c	5da5caf4d14b0d77ad5077f3d2fc0060088cd0dc
+++ libpurple/core.c	e9b3397198dbde5e6dacea354988f6515bb0d6d2
@@ -143,7 +143,6 @@ purple_core_init(const char *ui)
 	 */
 	purple_status_init();
 	purple_buddy_icons_init();
-	purple_connections_init();
 
 	purple_account_manager_load_accounts(purple_account_manager_get());
 	purple_accounts_init();
@@ -197,7 +196,6 @@ purple_core_quit(void)
 	purple_blist_uninit();
 	purple_notify_uninit();
 	purple_conversations_uninit();
-	purple_connections_uninit();
 	purple_certificate_uninit();
 	purple_buddy_icons_uninit();
 	purple_accounts_uninit();
============================================================
--- libpurple/dbus-useful.c	121af7c96cfa2087f961dc8ad2d8d20a3dcab904
+++ libpurple/dbus-useful.c	d1f02a0b6b85605efe46457908c394e2c9c23486
@@ -25,7 +25,7 @@ purple_accounts_find_ext(const char *nam
 		if (who && strcmp(purple_normalize(NULL, purple_account_get_username(account)), who))
 			continue;
 
-		if (protocol_id && strcmp(account->protocol_id, protocol_id))
+		if (protocol_id && strcmp(purple_account_get_protocol_id(account), protocol_id))
 			continue;
 
 		if (account_test && !account_test(account))
============================================================
--- libpurple/example/nullclient.c	587f78d7b0f0c1d170ac1eac35d526ca62efa8f8
+++ libpurple/example/nullclient.c	fdbd7623b555ee4cdb674733575fbe4760323bee
@@ -229,14 +229,14 @@ signed_on(PurpleConnection *gc, gpointer
 signed_on(PurpleConnection *gc, gpointer null)
 {
 	PurpleAccount *account = purple_connection_get_account(gc);
-	printf("Account connected: %s %s\n", account->username, account->protocol_id);
+	printf("Account connected: %s %s\n", purple_account_get_username(account), purple_account_get_protocol_id(account));
 }
 
 static void
 connect_to_signals_for_demonstration_purposes_only(void)
 {
 	static int handle;
-	purple_signal_connect(purple_connections_get_handle(), "signed-on", &handle,
+	purple_signal_connect(NULL, "signed-on", &handle,
 				PURPLE_CALLBACK(signed_on), NULL);
 }
 
============================================================
--- libpurple/idle.c	4c2f40738284bcb7eca06867ba0f4c3c09771d9b
+++ libpurple/idle.c	f976aed838d317f0a8fed15dd4970e21bb553724
@@ -322,10 +322,10 @@ purple_idle_init()
 	purple_signal_connect(purple_conversations_get_handle(), "sent-im-msg",
 						purple_idle_get_handle(),
 						PURPLE_CALLBACK(im_msg_sent_cb), NULL);
-	purple_signal_connect(purple_connections_get_handle(), "signing-on",
+	purple_signal_connect(NULL, "signing-on",
 						purple_idle_get_handle(),
 						PURPLE_CALLBACK(signing_on_cb), NULL);
-	purple_signal_connect(purple_connections_get_handle(), "signing-off",
+	purple_signal_connect(NULL, "signing-off",
 						purple_idle_get_handle(),
 						PURPLE_CALLBACK(signing_off_cb), NULL);
 
============================================================
--- libpurple/log.c	0a150afe4dffb81e04ac49e93cfc20c2d16858db
+++ libpurple/log.c	dddb3af604d3f59f48a28b019d4af1fe7195141f
@@ -1028,7 +1028,7 @@ static void log_get_log_sets_common(GHas
 			/* Find the account for username in the list of accounts for protocol. */
 			username_unescaped = purple_unescape_filename(username);
 			for (account_iter = g_list_first(accounts) ; account_iter != NULL ; account_iter = account_iter->next) {
-				if (!strcmp(((PurpleAccount *)account_iter->data)->username, username_unescaped)) {
+				if (!strcmp(purple_account_get_username((PurpleAccount *)account_iter->data), username_unescaped)) {
 					account = account_iter->data;
 					break;
 				}
============================================================
--- libpurple/plugins/filectl.c	3663c344f6e2a9882fa17ee77fafeba92e9a4a20
+++ libpurple/plugins/filectl.c	44b78c62f98f6f038c67461f1d50d2d8cc49437a
@@ -99,7 +99,7 @@ run_commands()
 			{
 				/*
 				purple_conversation_write(conv, arg2, WFLAG_SEND, NULL, time(NULL), -1);
-				serv_send_im(conv->gc, arg1, arg2, 0);
+				serv_send_im(purple_account_get_connection(conv), arg1, arg2, 0);
 				*/
 			}
 
============================================================
--- libpurple/plugins/idle.c	060f0c3502b52ed82201e890dc8d61259ec85c74
+++ libpurple/plugins/idle.c	7b0753dcfb62f6f3d54238239649e1f92af7b359
@@ -286,7 +286,7 @@ plugin_load(PurplePlugin *plugin)
 static gboolean
 plugin_load(PurplePlugin *plugin)
 {
-	purple_signal_connect(purple_connections_get_handle(), "signing-off",
+	purple_signal_connect(NULL, "signing-off",
 						plugin,
 						PURPLE_CALLBACK(signing_off_cb), NULL);
 
============================================================
--- libpurple/plugins/log_reader.c	c042ffa023b044b0e7b49fd3c2c945f8c056f04e
+++ libpurple/plugins/log_reader.c	3f2017ee630d98a99a27aa4d8cc9e40e43727024
@@ -92,7 +92,7 @@ static GList *adium_logger_list(PurpleLo
 
 	prpl_name = g_ascii_strup(prpl_info->list_icon(account, NULL), -1);
 
-	temp = g_strdup_printf("%s.%s", prpl_name, account->username);
+	temp = g_strdup_printf("%s.%s", prpl_name, purple_account_get_username(account));
 	path = g_build_filename(logdir, temp, sn, NULL);
 	g_free(temp);
 
@@ -635,7 +635,7 @@ static GList *msn_logger_list(PurpleLogT
 	g_return_val_if_fail(sn != NULL, NULL);
 	g_return_val_if_fail(account != NULL, NULL);
 
-	if (strcmp(account->protocol_id, "prpl-msn"))
+	if (strcmp(purple_account_get_protocol_id(account), "prpl-msn"))
 		return NULL;
 
 	logdir = purple_prefs_get_string("/plugins/core/log_reader/msn/log_directory");
@@ -658,7 +658,7 @@ static GList *msn_logger_list(PurpleLogT
 			return list;
 		}
 	} else {
-		username = g_strdup(purple_normalize(account, account->username));
+		username = g_strdup(purple_normalize(account, purple_account_get_username(account)));
 	}
 
 	if (buddy)
@@ -971,7 +971,7 @@ static char * msn_logger_read (PurpleLog
 
 		their_name = from_name;
 		if (from_name && purple_prefs_get_bool("/plugins/core/log_reader/use_name_heuristics")) {
-			const char *friendly_name = purple_connection_get_display_name(log->account->gc);
+			const char *friendly_name = purple_connection_get_display_name(purple_account_get_connection(log->account));
 
 			if (friendly_name != NULL) {
 				int friendly_name_length = strlen(friendly_name);
@@ -1056,9 +1056,9 @@ static char * msn_logger_read (PurpleLog
 							}
 						} else if (to_name_matches) {
 							name_guessed = NAME_GUESS_ME;
-						} else if (buddy->server_alias) {
+						} else if (purple_buddy_get_server_alias(buddy)) {
 							friendly_name_length =
-								strlen(buddy->server_alias);
+								strlen(purple_buddy_get_server_alias(buddy));
 
 							/* Try to guess which user is them.
 							 * The first step is to determine if either of
@@ -1068,13 +1068,13 @@ static char * msn_logger_read (PurpleLog
 							 */
 							from_name_matches = (purple_str_has_prefix(
 									from_name,
-									buddy->server_alias) &&
+									purple_buddy_get_server_alias(buddy)) &&
 									!isalnum(*(from_name +
 									friendly_name_length)));
 
 							to_name_matches = to_name && (
 									(purple_str_has_prefix(
-									to_name, buddy->server_alias) &&
+									to_name, purple_buddy_get_server_alias(buddy)) &&
 									!isalnum(*(to_name +
 									friendly_name_length))));
 
@@ -1114,7 +1114,7 @@ static char * msn_logger_read (PurpleLog
 				if (log->account->alias)
 					text = g_string_append(text, log->account->alias);
 				else
-					text = g_string_append(text, log->account->username);
+					text = g_string_append(text, purple_account_get_username(log->account));
 			}
 			else if (name_guessed == NAME_GUESS_THEM)
 				text = g_string_append(text, their_name);
@@ -1757,7 +1757,7 @@ static GList *qip_logger_list(PurpleLogT
 	g_return_val_if_fail(account != NULL, NULL);
 
 	/* QIP only supports ICQ. */
-	if (strcmp(account->protocol_id, "prpl-icq"))
+	if (strcmp(purple_account_get_protocol_id(account), "prpl-icq"))
 		return NULL;
 
 	logdir = purple_prefs_get_string("/plugins/core/log_reader/qip/log_directory");
@@ -1774,7 +1774,7 @@ static GList *qip_logger_list(PurpleLogT
 	if (!prpl_info->list_icon)
 		return NULL;
 
-	username = g_strdup(purple_normalize(account, account->username));
+	username = g_strdup(purple_normalize(account, purple_account_get_username(account)));
 	filename = g_strdup_printf("%s.txt", purple_normalize(account, sn));
 	path = g_build_filename(logdir, username, "History", filename, NULL);
 	g_free(username);
@@ -2213,10 +2213,10 @@ static GList *amsn_logger_list(PurpleLog
 		return NULL;
 
 	/* aMSN only works with MSN/WLM */
-	if (strcmp(account->protocol_id, "prpl-msn"))
+	if (strcmp(purple_account_get_protocol_id(account), "prpl-msn"))
 		return NULL;
 
-	username = g_strdup(purple_normalize(account, account->username));
+	username = g_strdup(purple_normalize(account, purple_account_get_username(account)));
 	buddy_log = g_strdup_printf("%s.log", purple_normalize(account, sn));
 	log_path = g_build_filename(logdir, username, "logs", NULL);
 
============================================================
--- libpurple/plugins/perl/common/Connection.xs	932a3b80a28c38ed6d79b27a4fd97fb7c7ef3303
+++ libpurple/plugins/perl/common/Connection.xs	1a8896279c7c8d0eb4fb7203153142516910793a
@@ -8,7 +8,7 @@ BOOT:
 	HV *stash = gv_stashpv("Purple::Connection::State", 1);
 
 	static const constiv *civ, const_iv[] = {
-#define const_iv(name) {#name, (IV)PURPLE_##name}
+#define const_iv(name) {#name, (IV)PURPLE_CONNECTION_STATE_##name}
 		const_iv(DISCONNECTED),
 		const_iv(CONNECTED),
 		const_iv(CONNECTING),
@@ -94,11 +94,3 @@ purple_connections_get_ui_ops()
 Purple::Connection::UiOps
 purple_connections_get_ui_ops()
 
-void
-purple_connections_init()
-
-void
-purple_connections_uninit()
-
-Purple::Handle
-purple_connections_get_handle()
============================================================
--- libpurple/plugins/perl/common/Prpl.xs	d2a20de2fb6c0620e43ec12285ee93213a379719
+++ libpurple/plugins/perl/common/Prpl.xs	e0b7e541da1bde5deb8a5b634219822017d7483d
@@ -62,7 +62,7 @@ CODE:
 PREINIT:
 	PurplePluginProtocolInfo *prpl_info;
 CODE:
-	prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(gc->prpl);
+	prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(purple_connection_get_prpl(gc));
 	if (prpl_info && prpl_info->send_raw != NULL) {
 		RETVAL = prpl_info->send_raw(gc, str, strlen(str));
 	} else {
============================================================
--- libpurple/plugins/signals-test.c	ba95d635caefcaa947ae2035bee94c1054ea5825
+++ libpurple/plugins/signals-test.c	886485358ccc7e2a33edd6a84da33608645d7f3f
@@ -568,7 +568,6 @@ plugin_load(PurplePlugin *plugin)
 {
 	void *core_handle     = purple_get_core();
 	void *blist_handle    = purple_blist_get_handle();
-	void *conn_handle     = purple_connections_get_handle();
 	void *conv_handle     = purple_conversations_get_handle();
 	void *accounts_handle = purple_accounts_get_handle();
 	void *ft_handle       = purple_xfers_get_handle();
@@ -613,6 +612,7 @@ plugin_load(PurplePlugin *plugin)
 	purple_signal_connect(blist_handle, "blist-node-extended-menu",
 						plugin, PURPLE_CALLBACK(blist_node_extended_menu_cb), NULL);
 
+#if 0
 	/* Connection subsystem signals */
 	purple_signal_connect(conn_handle, "signing-on",
 						plugin, PURPLE_CALLBACK(signing_on_cb), NULL);
@@ -624,6 +624,7 @@ plugin_load(PurplePlugin *plugin)
 						plugin, PURPLE_CALLBACK(signed_off_cb), NULL);
 	purple_signal_connect(conn_handle, "connection-error",
 						plugin, PURPLE_CALLBACK(connection_error_cb), NULL);
+#endif
 
 	/* Conversations subsystem signals */
 	purple_signal_connect(conv_handle, "writing-im-msg",
============================================================
--- libpurple/plugins/tcl/tcl_cmds.c	3103e2ca8041f296979f316d9c3b5ff8b216b187
+++ libpurple/plugins/tcl/tcl_cmds.c	1aab9da792e98a2a67633bef6a6cbeb71e25e177
@@ -720,7 +720,7 @@ int tcl_cmd_connection(ClientData unused
 			return TCL_ERROR;
 		}
 		Tcl_SetObjResult(interp, purple_tcl_ref_new(PurpleTclRefHandle,
-							    purple_connections_get_handle()));
+							    NULL));
 		break;
 	case CMD_CONN_LIST:
 		if (objc != 2) {
============================================================
--- libpurple/pounce.c	f233c62325a39c831e318edf257241dd0c5b8125
+++ libpurple/pounce.c	2e6fbb16518e6aa8ea0d55801cb0fbf857ec35f6
@@ -180,7 +180,7 @@ pounce_to_xmlnode(PurplePounce *pounce)
 	xmlnode_set_attrib(node, "ui", pounce->ui_type);
 
 	child = xmlnode_new_child(node, "account");
-	xmlnode_set_attrib(child, "protocol", pouncer->protocol_id);
+	xmlnode_set_attrib(child, "protocol", purple_account_get_protocol_id(pouncer));
 	xmlnode_insert_data(child,
 			purple_normalize(pouncer, purple_account_get_username(pouncer)), -1);
 
============================================================
--- libpurple/protocols/bonjour/bonjour.c	193d7ec7ffc3265767b73922ece594d556189bef
+++ libpurple/protocols/bonjour/bonjour.c	2ebf62770c3aba4a0ce3bcffab88402dc224c100
@@ -105,7 +105,7 @@ bonjour_login(PurpleAccount *account)
 	}
 #endif
 
-	gc->flags |= PURPLE_CONNECTION_HTML;
+	gc->flags |= PURPLE_CONNECTION_FLAGS_HTML;
 	gc->proto_data = bd = g_new0(BonjourData, 1);
 
 	/* Start waiting for jabber connections (iChat style) */
@@ -155,7 +155,7 @@ bonjour_login(PurpleAccount *account)
 	purple_blist_add_group(bonjour_group, NULL);
 
 	/* Show the buddy list by telling Purple we have already connected */
-	purple_connection_set_state(gc, PURPLE_CONNECTED);
+	purple_connection_set_state(gc, PURPLE_CONNECTION_STATE_CONNECTED);
 }
 
 static void
============================================================
--- libpurple/protocols/bonjour/bonjour_ft.c	009fde2bf1549e8c868c6b98a1df68de568dab2e
+++ libpurple/protocols/bonjour/bonjour_ft.c	8653bec6764145acedd450fb7194c0919f178e9b
@@ -344,7 +344,7 @@ bonjour_new_xfer(PurpleConnection *gc, c
 		return NULL;
 
 	/* Build the file transfer handle */
-	xfer = purple_xfer_new(gc->account, PURPLE_XFER_SEND, who);
+	xfer = purple_xfer_new(purple_connection_get_account(gc), PURPLE_XFER_SEND, who);
 	xfer->data = xep_xfer = g_new0(XepXfer, 1);
 	xep_xfer->data = bd;
 
============================================================
--- libpurple/protocols/bonjour/jabber.c	d907b13b82dd3527fdc40a5c15cb524a6c75f0df
+++ libpurple/protocols/bonjour/jabber.c	b595d378db05e3cc5c244b296c0c1bc07d664355
@@ -118,7 +118,7 @@ _jabber_parse_and_write_message_to_ui(xm
 _jabber_parse_and_write_message_to_ui(xmlnode *message_node, PurpleBuddy *pb)
 {
 	xmlnode *body_node, *html_node, *events_node;
-	PurpleConnection *gc = pb->account->gc;
+	PurpleConnection *gc = purple_account_get_connection(pb->account);
 	gchar *body = NULL;
 	gboolean composing_event = FALSE;
 
@@ -656,7 +656,7 @@ bonjour_jabber_start(BonjourJabber *jdat
 	if ((jdata->socket = socket(PF_INET, SOCK_STREAM, 0)) < 0)
 	{
 		purple_debug_error("bonjour", "Cannot open socket: %s\n", g_strerror(errno));
-		purple_connection_error_reason (jdata->account->gc,
+		purple_connection_error_reason (purple_account_get_connection(jdata->account),
 			PURPLE_CONNECTION_ERROR_NETWORK_ERROR,
 			_("Cannot open socket"));
 		return -1;
@@ -666,7 +666,7 @@ bonjour_jabber_start(BonjourJabber *jdat
 	if (setsockopt(jdata->socket, SOL_SOCKET, SO_REUSEADDR, &yes, sizeof(int)) != 0)
 	{
 		purple_debug_error("bonjour", "Error setting socket options: %s\n", g_strerror(errno));
-		purple_connection_error_reason (jdata->account->gc,
+		purple_connection_error_reason (purple_account_get_connection(jdata->account),
 			PURPLE_CONNECTION_ERROR_NETWORK_ERROR,
 			_("Error setting socket options"));
 		return -1;
@@ -692,7 +692,7 @@ bonjour_jabber_start(BonjourJabber *jdat
 	if (!bind_successful)
 	{
 		purple_debug_error("bonjour", "Cannot bind socket: %s\n", g_strerror(errno));
-		purple_connection_error_reason (jdata->account->gc,
+		purple_connection_error_reason (purple_account_get_connection(jdata->account),
 			PURPLE_CONNECTION_ERROR_NETWORK_ERROR,
 			_("Could not bind socket to port"));
 		return -1;
@@ -702,7 +702,7 @@ bonjour_jabber_start(BonjourJabber *jdat
 	if (listen(jdata->socket, 10) != 0)
 	{
 		purple_debug_error("bonjour", "Cannot listen on socket: %s\n", g_strerror(errno));
-		purple_connection_error_reason (jdata->account->gc,
+		purple_connection_error_reason (purple_account_get_connection(jdata->account),
 			PURPLE_CONNECTION_ERROR_NETWORK_ERROR,
 			_("Could not listen on socket"));
 		return -1;
@@ -794,7 +794,7 @@ bonjour_jabber_conv_match_by_name(Bonjou
 		while(tmp) {
 			ip = tmp->data;
 			if (ip != NULL && g_ascii_strcasecmp(ip, bconv->ip) == 0) {
-				BonjourJabber *jdata = ((BonjourData*) bconv->account->gc->proto_data)->jabber_data;
+				BonjourJabber *jdata = ((BonjourData*) purple_account_get_connection(bconv->account)->proto_data)->jabber_data;
 
 				purple_debug_info("bonjour", "Matched buddy %s to incoming conversation \"from\" attrib and IP (%s)\n",
 					purple_buddy_get_name(pb), bconv->ip);
@@ -827,7 +827,7 @@ bonjour_jabber_conv_match_by_ip(BonjourJ
 
 void
 bonjour_jabber_conv_match_by_ip(BonjourJabberConversation *bconv) {
-	BonjourJabber *jdata = ((BonjourData*) bconv->account->gc->proto_data)->jabber_data;
+	BonjourJabber *jdata = ((BonjourData*) purple_account_get_connection(bconv->account)->proto_data)->jabber_data;
 	struct _match_buddies_by_address_t *mbba;
 
 	mbba = g_new0(struct _match_buddies_by_address_t, 1);
@@ -984,7 +984,7 @@ async_bonjour_jabber_close_conversation(
 
 void
 async_bonjour_jabber_close_conversation(BonjourJabberConversation *bconv) {
-	BonjourJabber *jdata = ((BonjourData*) bconv->account->gc->proto_data)->jabber_data;
+	BonjourJabber *jdata = ((BonjourData*) purple_account_get_connection(bconv->account)->proto_data)->jabber_data;
 
 	jdata->pending_conversations = g_slist_remove(jdata->pending_conversations, bconv);
 
@@ -1004,8 +1004,8 @@ bonjour_jabber_close_conversation(Bonjou
 	if (bconv != NULL) {
 		BonjourData *bd = NULL;
 
-		if(PURPLE_CONNECTION_IS_VALID(bconv->account->gc)) {
-			bd = bconv->account->gc->proto_data;
+		if(PURPLE_CONNECTION_IS_VALID(purple_account_get_connection(bconv->account))) {
+			bd = purple_account_get_connection(bconv->account)->proto_data;
 			bd->jabber_data->pending_conversations = g_slist_remove(bd->jabber_data->pending_conversations, bconv);
 		}
 
@@ -1073,7 +1073,7 @@ bonjour_jabber_stop(BonjourJabber *jdata
 		purple_input_remove(jdata->watcher_id);
 
 	/* Close all the conversation sockets and remove all the watchers after sending end streams */
-	if (jdata->account->gc != NULL) {
+	if (purple_account_get_connection(jdata->account) != NULL) {
 		GSList *buddies, *l;
 
 		buddies = purple_find_buddies(jdata->account, NULL);
@@ -1149,7 +1149,7 @@ check_if_blocked(PurpleBuddy *pb)
 
 	for(l = acc->deny; l != NULL; l = l->next) {
 		if(!purple_utf8_strcasecmp(pb->name, (char *)l->data)) {
-			purple_debug_info("bonjour", "%s has been blocked.\n", pb->name, acc->username);
+			purple_debug_info("bonjour", "%s has been blocked.\n", pb->name, purple_account_get_username(acc));
 			blocked = TRUE;
 			break;
 		}
@@ -1167,7 +1167,7 @@ xep_iq_parse(xmlnode *packet, PurpleConn
 
 	if(connection == NULL) {
 		if(pb->account != NULL)
-			connection = (pb->account)->gc;
+			connection = (pb->account)purple_account_get_connection();
 	}
 
 	if(check_if_blocked(pb))
============================================================
--- libpurple/protocols/bonjour/mdns_avahi.c	50eeeab9da353cf1740e876d12041a84b44d1a31
+++ libpurple/protocols/bonjour/mdns_avahi.c	ec06a91f17f229a73e022cb56823a06f3e14ff3b
@@ -242,7 +242,7 @@ _browser_callback(AvahiServiceBrowser *b
 			/* A new peer has joined the network and uses iChat bonjour */
 			purple_debug_info("bonjour", "_browser_callback - new service\n");
 			/* Make sure it isn't us */
-			if (purple_utf8_strcasecmp(name, account->username) != 0) {
+			if (purple_utf8_strcasecmp(name, purple_account_get_username(account)) != 0) {
 				if (!avahi_service_resolver_new(avahi_service_browser_get_client(b),
 						interface, protocol, name, type, domain, AVAHI_PROTO_INET,
 						0, _resolver_callback, account)) {
============================================================
--- libpurple/protocols/bonjour/mdns_win32.c	910816f450ae0213f7f7f0298285ad974bf6fc47
+++ libpurple/protocols/bonjour/mdns_win32.c	f864ab47547852210288ab6a2b0161fb7f26a454
@@ -106,7 +106,7 @@ _mdns_handle_event(gpointer data, gint s
 		purple_debug_error("bonjour", "Error (%d) handling mDNS response.\n", errorCode);
 		/* This happens when the mDNSResponder goes down, I haven't seen it happen any other time (in my limited testing) */
 		if (errorCode == kDNSServiceErr_Unknown) {
-			purple_connection_error_reason(srh->account->gc, PURPLE_CONNECTION_ERROR_NETWORK_ERROR,
+			purple_connection_error_reason(purple_account_get_connection(srh->account), PURPLE_CONNECTION_ERROR_NETWORK_ERROR,
 				_("Error communicating with local mDNSResponder."));
 		}
 	}
@@ -317,7 +317,7 @@ _mdns_service_browse_callback(DNSService
 		purple_debug_error("bonjour", "service browser - callback error (%d)\n", errorCode);
 	else if (flags & kDNSServiceFlagsAdd) {
 		/* A presence service instance has been discovered... check it isn't us! */
-		if (purple_utf8_strcasecmp(serviceName, account->username) != 0) {
+		if (purple_utf8_strcasecmp(serviceName, purple_account_get_username(account)) != 0) {
 			DNSServiceErrorType resErrorCode;
 			/* OK, lets go ahead and resolve it to add to the buddy list */
 			ResolveCallbackArgs *args = g_new0(ResolveCallbackArgs, 1);
============================================================
--- libpurple/protocols/gg/gg.c	30aeb5eaee935bfd9c7901e39bd3de49bb3bae2f
+++ libpurple/protocols/gg/gg.c	dcc4958ad43fc7e197f4d977e47a6f4653ea92b5
@@ -1505,7 +1505,7 @@ static void ggp_async_login_handler(gpoi
 				status = purple_presence_get_active_status(presence);
 
 				ggp_set_status(account, status);
-				purple_connection_set_state(gc, PURPLE_CONNECTED);
+				purple_connection_set_state(gc, PURPLE_CONNECTION_STATE_CONNECTED);
 				ggp_buddylist_send(gc);
 			}
 			break;
@@ -1712,7 +1712,7 @@ static void ggp_login(PurpleAccount *acc
 	gc->proto_data = info;
 
 	glp->uin = ggp_get_uin(account);
-	glp->password = (char *)purple_account_get_password(account);
+	purple_account_get_password(glp) = (char *)purple_account_get_password(account);
 
 	glp->async = 1;
 	glp->status = GG_STATUS_AVAIL;
============================================================
--- libpurple/protocols/gg/lib/events.c	c67c8bfde77d3245124d709267257c77443041e2
+++ libpurple/protocols/gg/lib/events.c	9391bec260b9c5c0c52c607415494988be5291a1
@@ -1339,7 +1339,7 @@ struct gg_event *gg_watch_fd(struct gg_s
 			struct gg_welcome *w;
 			struct gg_login60 l;
 			unsigned int hash;
-			char *password = sess->password;
+			char *password = purple_account_get_password(sess);
 			int ret;
 			
 			gg_debug(GG_DEBUG_MISC, "// gg_watch_fd() GG_STATE_READING_KEY\n");
@@ -1406,8 +1406,8 @@ struct gg_event *gg_watch_fd(struct gg_s
 	
 			free(h);
 
-			free(sess->password);
-			sess->password = NULL;
+			free(purple_account_get_password(sess));
+			purple_account_get_password(sess) = NULL;
 
 			{
 				struct in_addr dcc_ip;
============================================================
--- libpurple/protocols/gg/lib/libgadu.c	f1bef314ab64c75e4d40ff5671c8c5ca7d774b39
+++ libpurple/protocols/gg/lib/libgadu.c	91021c83f2e46b36dee45fff0cf1f4f5368c9fc0
@@ -968,13 +968,13 @@ struct gg_session *gg_login(const struct
 
 	memset(sess, 0, sizeof(struct gg_session));
 
-	if (!p->password || !p->uin) {
+	if (!purple_account_get_password(p) || !p->uin) {
 		gg_debug(GG_DEBUG_MISC, "// gg_login() invalid arguments. uin and password needed\n");
 		errno = EFAULT;
 		goto fail;
 	}
 
-	if (!(sess->password = strdup(p->password))) {
+	if (!(purple_account_get_password(sess) = strdup(purple_account_get_password(p)))) {
 		gg_debug(GG_DEBUG_MISC, "// gg_login() not enough memory for password\n");
 		goto fail;
 	}
@@ -1137,8 +1137,8 @@ fail:
 
 fail:
 	if (sess) {
-		if (sess->password)
-			free(sess->password);
+		if (purple_account_get_password(sess))
+			free(purple_account_get_password(sess));
 		if (sess->initial_descr)
 			free(sess->initial_descr);
 		free(sess);
@@ -1161,8 +1161,8 @@ void gg_free_session(struct gg_session *
 
 	/* XXX dopisaæ zwalnianie i zamykanie wszystkiego, co mog³o zostaæ */
 
-	if (sess->password)
-		free(sess->password);
+	if (purple_account_get_password(sess))
+		free(purple_account_get_password(sess));
 	
 	if (sess->initial_descr)
 		free(sess->initial_descr);
============================================================
--- libpurple/protocols/irc/irc.c	123ab56826fab72d4e46f7dfdc7b0d385e4e61e0
+++ libpurple/protocols/irc/irc.c	68126a987474b36d73e3fc280deae9b391fc20c3
@@ -303,7 +303,7 @@ static void irc_login(PurpleAccount *acc
 	const char *username = purple_account_get_username(account);
 
 	gc = purple_account_get_connection(account);
-	gc->flags |= PURPLE_CONNECTION_NO_NEWLINES;
+	gc->flags |= PURPLE_CONNECTION_FLAGS_NO_NEWLINES;
 
 	if (strpbrk(username, " \t\v\r\n") != NULL) {
 		purple_connection_error_reason (gc,
@@ -572,7 +572,7 @@ static void read_input(struct irc_conn *
 {
 	char *cur, *end;
 
-	irc->account->gc->last_received = time(NULL);
+	purple_account_get_connection(irc->account)->last_received = time(NULL);
 	irc->inbufused += len;
 	irc->inbuf[irc->inbufused] = '\0';
 
============================================================
--- libpurple/protocols/irc/msgs.c	76e6395bef71aa519327f57dbf3fd688424c2858
+++ libpurple/protocols/irc/msgs.c	0cd1476dd24901cd40a3bf3762a7a4a731df3ad0
@@ -82,7 +82,7 @@ static void irc_connected(struct irc_con
 		return;
 
 	purple_connection_set_display_name(gc, nick);
-	purple_connection_set_state(gc, PURPLE_CONNECTED);
+	purple_connection_set_state(gc, PURPLE_CONNECTION_STATE_CONNECTED);
 
 	/* If we're away then set our away message */
 	status = purple_account_get_active_status(irc->account);
@@ -103,7 +103,7 @@ static void irc_connected(struct irc_con
 				if(!PURPLE_BLIST_NODE_IS_BUDDY(bnode))
 					continue;
 				b = (PurpleBuddy *)bnode;
-				if(b->account == gc->account) {
+				if(b->account == purple_connection_get_account(gc)) {
 					struct irc_buddy *ib = g_new0(struct irc_buddy, 1);
 					ib->name = g_strdup(b->name);
 					g_hash_table_insert(irc->buddies, ib->name, ib);
@@ -637,7 +637,7 @@ void irc_msg_notinchan(struct irc_conn *
 
 	purple_debug(PURPLE_DEBUG_INFO, "irc", "We're apparently not in %s, but tried to use it\n", args[1]);
 	if (convo) {
-		/*g_slist_remove(irc->gc->buddy_chats, convo);
+		/*g_slist_remove(purple_account_get_connection(irc)->buddy_chats, convo);
 		  purple_conversation_set_account(convo, NULL);*/
 		purple_conv_chat_write(PURPLE_CONV_CHAT(convo), args[1], args[2], PURPLE_MESSAGE_SYSTEM|PURPLE_MESSAGE_NO_LOG, time(NULL));
 	}
@@ -915,7 +915,7 @@ void irc_msg_badnick(struct irc_conn *ir
 void irc_msg_badnick(struct irc_conn *irc, const char *name, const char *from, char **args)
 {
 	PurpleConnection *gc = purple_account_get_connection(irc->account);
-	if (purple_connection_get_state(gc) == PURPLE_CONNECTED) {
+	if (purple_connection_get_state(gc) == PURPLE_CONNECTION_STATE_CONNECTED) {
 		purple_notify_error(gc, _("Invalid nickname"),
 				  _("Invalid nickname"),
 				  _("Your selected nickname was rejected by the server.  It probably contains invalid characters."));
============================================================
--- libpurple/protocols/jabber/auth.c	33c6d085cc13ad727f9a48c0f8815f95239f19b5
+++ libpurple/protocols/jabber/auth.c	614e361267945e9b30c59e8b85a91fc31cc45148
@@ -51,7 +51,7 @@ jabber_process_starttls(JabberStream *js
 					"<starttls xmlns='urn:ietf:params:xml:ns:xmpp-tls'/>", -1);
 			return TRUE;
 		} else if(xmlnode_get_child(starttls, "required")) {
-			purple_connection_error_reason (js->gc,
+			purple_connection_error_reason (purple_account_get_connection(js),
 				PURPLE_CONNECTION_ERROR_NO_SSL_SUPPORT,
 				_("Server requires TLS/SSL for login.  No TLS/SSL support found."));
 			return TRUE;
@@ -79,7 +79,7 @@ static void finish_plaintext_authenticat
 		response = g_string_append(response, js->user->node);
 		response = g_string_append_len(response, "\0", 1);
 		response = g_string_append(response,
-				purple_connection_get_password(js->gc));
+				purple_connection_get_password(purple_account_get_connection(js)));
 
 		enc_out = purple_base64_encode((guchar *)response->str, response->len);
 
@@ -101,7 +101,7 @@ static void finish_plaintext_authenticat
 		x = xmlnode_new_child(query, "resource");
 		xmlnode_insert_data(x, js->user->resource, -1);
 		x = xmlnode_new_child(query, "password");
-		xmlnode_insert_data(x, purple_connection_get_password(js->gc), -1);
+		xmlnode_insert_data(x, purple_connection_get_password(purple_account_get_connection(js)), -1);
 		jabber_iq_set_callback(iq, auth_old_result_cb, NULL);
 		jabber_iq_send(iq);
 	}
@@ -111,12 +111,12 @@ static void allow_plaintext_auth(PurpleA
 {
 	purple_account_set_bool(account, "auth_plain_in_clear", TRUE);
 
-	finish_plaintext_authentication(account->gc->proto_data);
+	finish_plaintext_authentication(purple_account_get_connection(account)->proto_data);
 }
 
 static void disallow_plaintext_auth(PurpleAccount *account)
 {
-	purple_connection_error_reason (account->gc,
+	purple_connection_error_reason (purple_account_get_connection(account),
 		PURPLE_CONNECTION_ERROR_ENCRYPTION_ERROR,
 		_("Server requires plaintext authentication over an unencrypted stream"));
 }
@@ -160,7 +160,7 @@ static int jabber_sasl_cb_secret(sasl_co
 static int jabber_sasl_cb_secret(sasl_conn_t *conn, void *ctx, int id, sasl_secret_t **secret)
 {
 	JabberStream *js = (JabberStream *)ctx;
-	const char *pw = purple_account_get_password(js->gc->account);
+	const char *pw = purple_account_get_password(purple_account_get_connection(js)->account);
 	size_t len;
 	static sasl_secret_t *x = NULL;
 
@@ -184,7 +184,7 @@ static void allow_cyrus_plaintext_auth(P
 {
 	purple_account_set_bool(account, "auth_plain_in_clear", TRUE);
 
-	jabber_auth_start_cyrus(account->gc->proto_data);
+	jabber_auth_start_cyrus(purple_account_get_connection(account)->proto_data);
 }
 
 static gboolean auth_pass_generic(JabberStream *js, PurpleRequestFields *fields)
@@ -197,14 +197,14 @@ static gboolean auth_pass_generic(Jabber
 
 	if (!entry || !*entry)
 	{
-		purple_notify_error(js->gc->account, NULL, _("Password is required to sign on."), NULL);
+		purple_notify_error(purple_account_get_connection(js)->account, NULL, _("Password is required to sign on."), NULL);
 		return FALSE;
 	}
 
 	if (remember)
-		purple_account_set_remember_password(js->gc->account, TRUE);
+		purple_account_set_remember_password(purple_account_get_connection(js)->account, TRUE);
 
-	purple_account_set_password(js->gc->account, entry);
+	purple_account_set_password(purple_account_get_connection(js)->account, entry);
 
 	return TRUE;
 }
@@ -280,7 +280,7 @@ static void jabber_auth_start_cyrus(Jabb
 	if (!js->gsc) {
 		secprops.max_ssf = -1;
 		secprops.maxbufsize = 4096;
-		plaintext = purple_account_get_bool(js->gc->account, "auth_plain_in_clear", FALSE);
+		plaintext = purple_account_get_bool(purple_account_get_connection(js)->account, "auth_plain_in_clear", FALSE);
 		if (!plaintext)
 			secprops.security_flags |= SASL_SEC_NOPLAINTEXT;
 	} else {
@@ -312,8 +312,8 @@ static void jabber_auth_start_cyrus(Jabb
 				 * to get one
 				 */
 
-				if (!purple_account_get_password(js->gc->account)) {
-					purple_account_request_password(js->gc->account, G_CALLBACK(auth_pass_cb), G_CALLBACK(auth_no_pass_cb), js->gc);
+				if (!purple_account_get_password(purple_account_get_connection(js)->account)) {
+					purple_account_request_password(purple_account_get_connection(js)->account, G_CALLBACK(auth_pass_cb), G_CALLBACK(auth_no_pass_cb), purple_account_get_connection(js));
 					return;
 
 				/* If we've got a password, but aren't sending
@@ -322,11 +322,11 @@ static void jabber_auth_start_cyrus(Jabb
 				 */
 				} else if (!plaintext) {
 					char *msg = g_strdup_printf(_("%s requires plaintext authentication over an unencrypted connection.  Allow this and continue authentication?"),
-							js->gc->account->username);
-					purple_request_yes_no(js->gc, _("Plaintext Authentication"),
+							purple_account_get_connection(js)purple_account_get_username(->account));
+					purple_request_yes_no(purple_account_get_connection(js), _("Plaintext Authentication"),
 							_("Plaintext Authentication"),
 							msg,
-							1, js->gc->account, NULL, NULL, js->gc->account,
+							1, purple_account_get_connection(js)->account, NULL, NULL, purple_account_get_connection(js)->account,
 							allow_cyrus_plaintext_auth,
 							disallow_plaintext_auth);
 					g_free(msg);
@@ -401,7 +401,7 @@ static void jabber_auth_start_cyrus(Jabb
 		jabber_send(js, auth);
 		xmlnode_free(auth);
 	} else {
-		purple_connection_error_reason (js->gc,
+		purple_connection_error_reason (purple_account_get_connection(js),
 			PURPLE_CONNECTION_ERROR_AUTHENTICATION_IMPOSSIBLE,
 			"SASL authentication failed\n");
 	}
@@ -441,7 +441,7 @@ jabber_sasl_build_callbacks(JabberStream
 	js->sasl_cb[id].context = (void *)js;
 	id++;
 
-	if (purple_account_get_password(js->gc->account) != NULL ) {
+	if (purple_account_get_password(purple_account_get_connection(js)->account) != NULL ) {
 		js->sasl_cb[id].id = SASL_CB_PASS;
 		js->sasl_cb[id].proc = jabber_sasl_cb_secret;
 		js->sasl_cb[id].context = (void *)js;
@@ -476,7 +476,7 @@ jabber_auth_start(JabberStream *js, xmln
 	mechs = xmlnode_get_child(packet, "mechanisms");
 
 	if(!mechs) {
-		purple_connection_error_reason (js->gc,
+		purple_connection_error_reason (purple_account_get_connection(js),
 			PURPLE_CONNECTION_ERROR_NETWORK_ERROR,
 			_("Invalid response from server."));
 		return;
@@ -523,22 +523,22 @@ jabber_auth_start(JabberStream *js, xmln
 	} else if(plain) {
 		js->auth_type = JABBER_AUTH_PLAIN;
 
-		if(js->gsc == NULL && !purple_account_get_bool(js->gc->account, "auth_plain_in_clear", FALSE)) {
+		if(js->gsc == NULL && !purple_account_get_bool(purple_account_get_connection(js)->account, "auth_plain_in_clear", FALSE)) {
 			char *msg = g_strdup_printf(_("%s requires plaintext authentication over an unencrypted connection.  Allow this and continue authentication?"),
-					js->gc->account->username);
-			purple_request_yes_no(js->gc, _("Plaintext Authentication"),
+					purple_account_get_connection(js)purple_account_get_username(->account));
+			purple_request_yes_no(purple_account_get_connection(js), _("Plaintext Authentication"),
 					_("Plaintext Authentication"),
 					msg,
 					1,
-					purple_connection_get_account(js->gc), NULL, NULL,
-					purple_connection_get_account(js->gc), allow_plaintext_auth,
+					purple_connection_get_account(purple_account_get_connection(js)), NULL, NULL,
+					purple_connection_get_account(purple_account_get_connection(js)), allow_plaintext_auth,
 					disallow_plaintext_auth);
 			g_free(msg);
 			return;
 		}
 		finish_plaintext_authentication(js);
 	} else {
-		purple_connection_error_reason (js->gc,
+		purple_connection_error_reason (purple_account_get_connection(js),
 				PURPLE_CONNECTION_ERROR_AUTHENTICATION_IMPOSSIBLE,
 				_("Server does not use any supported authentication method"));
 	}
@@ -563,11 +563,11 @@ static void auth_old_result_cb(JabberStr
 					!strcmp(err_code, "401")) {
 			reason = PURPLE_CONNECTION_ERROR_AUTHENTICATION_FAILED;
 			/* Clear the pasword if it isn't being saved */
-			if (!purple_account_get_remember_password(js->gc->account))
-				purple_account_set_password(js->gc->account, NULL);
+			if (!purple_account_get_remember_password(purple_account_get_connection(js)->account))
+				purple_account_set_password(purple_account_get_connection(js)->account, NULL);
 		}
 
-		purple_connection_error_reason (js->gc, reason, msg);
+		purple_connection_error_reason (purple_account_get_connection(js), reason, msg);
 		g_free(msg);
 	}
 }
@@ -642,17 +642,17 @@ static void auth_old_cb(JabberStream *js
 	JabberIq *iq;
 	xmlnode *query, *x;
 	const char *type = xmlnode_get_attrib(packet, "type");
-	const char *pw = purple_connection_get_password(js->gc);
+	const char *pw = purple_connection_get_password(purple_account_get_connection(js));
 
 	if(!type) {
-		purple_connection_error_reason (js->gc,
+		purple_connection_error_reason (purple_account_get_connection(js),
 			PURPLE_CONNECTION_ERROR_NETWORK_ERROR,
 			_("Invalid response from server."));
 		return;
 	} else if(!strcmp(type, "error")) {
 		PurpleConnectionError reason = PURPLE_CONNECTION_ERROR_NETWORK_ERROR;
 		char *msg = jabber_parse_error(js, packet, &reason);
-		purple_connection_error_reason (js->gc, reason, msg);
+		purple_connection_error_reason (purple_account_get_connection(js), reason, msg);
 		g_free(msg);
 	} else if(!strcmp(type, "result")) {
 		query = xmlnode_get_child(packet, "query");
@@ -715,20 +715,20 @@ static void auth_old_cb(JabberStream *js
 			jabber_iq_send(iq);
 
 		} else if(xmlnode_get_child(query, "password")) {
-			if(js->gsc == NULL && !purple_account_get_bool(js->gc->account,
+			if(js->gsc == NULL && !purple_account_get_bool(purple_account_get_connection(js)->account,
 						"auth_plain_in_clear", FALSE)) {
-				purple_request_yes_no(js->gc, _("Plaintext Authentication"),
+				purple_request_yes_no(purple_account_get_connection(js), _("Plaintext Authentication"),
 						_("Plaintext Authentication"),
 						_("This server requires plaintext authentication over an unencrypted connection.  Allow this and continue authentication?"),
 						1,
-						purple_connection_get_account(js->gc), NULL, NULL,
-						purple_connection_get_account(js->gc), allow_plaintext_auth,
+						purple_connection_get_account(purple_account_get_connection(js)), NULL, NULL,
+						purple_connection_get_account(purple_account_get_connection(js)), allow_plaintext_auth,
 						disallow_plaintext_auth);
 				return;
 			}
 			finish_plaintext_authentication(js);
 		} else {
-			purple_connection_error_reason (js->gc,
+			purple_connection_error_reason (purple_account_get_connection(js),
 				PURPLE_CONNECTION_ERROR_AUTHENTICATION_IMPOSSIBLE,
 				_("Server does not use any supported authentication method"));
 			return;
@@ -747,8 +747,8 @@ void jabber_auth_start_old(JabberStream 
 	 * password prompting here
 	 */
 
-	if (!purple_account_get_password(js->gc->account)) {
-		purple_account_request_password(js->gc->account, G_CALLBACK(auth_old_pass_cb), G_CALLBACK(auth_no_pass_cb), js->gc);
+	if (!purple_account_get_password(purple_account_get_connection(js)->account)) {
+		purple_account_request_password(purple_account_get_connection(js)->account, G_CALLBACK(auth_old_pass_cb), G_CALLBACK(auth_no_pass_cb), purple_account_get_connection(js));
 		return;
 	}
 #endif
@@ -894,7 +894,7 @@ jabber_auth_handle_challenge(JabberStrea
 		GHashTable *parts;
 
 		if(!enc_in) {
-			purple_connection_error_reason (js->gc,
+			purple_connection_error_reason (purple_account_get_connection(js),
 				PURPLE_CONNECTION_ERROR_NETWORK_ERROR,
 				_("Invalid response from server."));
 			return;
@@ -917,7 +917,7 @@ jabber_auth_handle_challenge(JabberStrea
 						"<response xmlns='urn:ietf:params:xml:ns:xmpp-sasl' />",
 						-1);
 			} else {
-				purple_connection_error_reason (js->gc,
+				purple_connection_error_reason (purple_account_get_connection(js),
 					PURPLE_CONNECTION_ERROR_NETWORK_ERROR,
 					_("Invalid challenge from server"));
 			}
@@ -942,7 +942,7 @@ jabber_auth_handle_challenge(JabberStrea
 				realm = js->user->domain;
 
 			if (nonce == NULL || realm == NULL)
-				purple_connection_error_reason (js->gc,
+				purple_connection_error_reason (purple_account_get_connection(js),
 					PURPLE_CONNECTION_ERROR_NETWORK_ERROR,
 					_("Invalid challenge from server"));
 			else {
@@ -957,12 +957,12 @@ jabber_auth_handle_challenge(JabberStrea
 
 				a2 = g_strdup_printf("AUTHENTICATE:xmpp/%s", realm);
 				auth_resp = generate_response_value(js->user,
-						purple_connection_get_password(js->gc), nonce, cnonce, a2, realm);
+						purple_connection_get_password(purple_account_get_connection(js)), nonce, cnonce, a2, realm);
 				g_free(a2);
 
 				a2 = g_strdup_printf(":xmpp/%s", realm);
 				js->expected_rspauth = generate_response_value(js->user,
-						purple_connection_get_password(js->gc), nonce, cnonce, a2, realm);
+						purple_connection_get_password(purple_account_get_connection(js)), nonce, cnonce, a2, realm);
 				g_free(a2);
 
 				g_string_append_printf(response, "username=\"%s\"", js->user->node);
@@ -1016,7 +1016,7 @@ jabber_auth_handle_challenge(JabberStrea
 		g_free(dec_in);
 		if (js->sasl_state != SASL_CONTINUE && js->sasl_state != SASL_OK) {
 			purple_debug_error("jabber", "Error is %d : %s\n",js->sasl_state,sasl_errdetail(js->sasl));
-			purple_connection_error_reason (js->gc,
+			purple_connection_error_reason (purple_account_get_connection(js),
 				PURPLE_CONNECTION_ERROR_NETWORK_ERROR,
 				_("SASL error"));
 			return;
@@ -1043,7 +1043,7 @@ void jabber_auth_handle_success(JabberSt
 #endif
 
 	if(!ns || strcmp(ns, "urn:ietf:params:xml:ns:xmpp-sasl")) {
-		purple_connection_error_reason (js->gc,
+		purple_connection_error_reason (purple_account_get_connection(js),
 			PURPLE_CONNECTION_ERROR_NETWORK_ERROR,
 			_("Invalid response from server."));
 		return;
@@ -1070,7 +1070,7 @@ void jabber_auth_handle_success(JabberSt
 
 		if (js->sasl_state != SASL_OK) {
 			/* This should never happen! */
-			purple_connection_error_reason (js->gc,
+			purple_connection_error_reason (purple_account_get_connection(js),
 				PURPLE_CONNECTION_ERROR_NETWORK_ERROR,
 				_("Invalid response from server."));
 		}
@@ -1094,11 +1094,11 @@ void jabber_auth_handle_failure(JabberSt
 	char *msg = jabber_parse_error(js, packet, &reason);
 
 	if(!msg) {
-		purple_connection_error_reason (js->gc,
+		purple_connection_error_reason (purple_account_get_connection(js),
 			PURPLE_CONNECTION_ERROR_NETWORK_ERROR,
 			_("Invalid response from server."));
 	} else {
-		purple_connection_error_reason (js->gc, reason, msg);
+		purple_connection_error_reason (purple_account_get_connection(js), reason, msg);
 		g_free(msg);
 	}
 }
============================================================
--- libpurple/protocols/jabber/buddy.c	92e77a1bfd36a611df12142633bc431a9ace7f27
+++ libpurple/protocols/jabber/buddy.c	32a628382a9f100dd6e2ae6e2dc82586644b88ef
@@ -73,7 +73,7 @@ JabberBuddy *jabber_buddy_find(JabberStr
 	if (js->buddies == NULL)
 		return NULL;
 
-	if(!(realname = jabber_normalize(js->gc->account, name)))
+	if(!(realname = jabber_normalize(purple_account_get_connection(js)->account, name)))
 		return NULL;
 
 	jb = g_hash_table_lookup(js->buddies, realname);
@@ -445,7 +445,7 @@ void jabber_set_info(PurpleConnection *g
 		vc_node = NULL;
 	}
 
-	if ((img = purple_buddy_icons_find_account_icon(gc->account))) {
+	if ((img = purple_buddy_icons_find_account_icon(purple_connection_get_account(gc)))) {
 		gconstpointer avatar_data;
 		gsize avatar_len;
 		xmlnode *photo, *binval, *type;
@@ -623,11 +623,11 @@ void jabber_set_buddy_icon(PurpleConnect
 	   one doesn't require a specific image type */
 
 	/* publish vCard for those poor older clients */
-	jabber_set_info(gc, purple_account_get_user_info(gc->account));
+	jabber_set_info(gc, purple_account_get_user_info(purple_connection_get_account(gc)));
 
-	gpresence = purple_account_get_presence(gc->account);
+	gpresence = purple_account_get_presence(purple_connection_get_account(gc));
 	status = purple_presence_get_active_status(gpresence);
-	jabber_presence_send(gc->account, status);
+	jabber_presence_send(purple_connection_get_account(gc), status);
 }
 
 /*
@@ -710,7 +710,7 @@ void jabber_setup_set_info(PurplePluginA
 	/*
 	 * Get existing, XML-formatted, user info
 	 */
-	if((user_info = purple_account_get_user_info(gc->account)) != NULL)
+	if((user_info = purple_account_get_user_info(purple_connection_get_account(gc))) != NULL)
 		x_vc_data = xmlnode_from_str(user_info, -1);
 
 	/*
@@ -1127,7 +1127,7 @@ static void jabber_buddy_info_show_if_re
 		purple_notify_user_info_add_pair(user_info, NULL, jbi->vcard_text);
 	}
 
-	purple_notify_userinfo(jbi->js->gc, jbi->jid, user_info, NULL, NULL);
+	purple_notify_userinfo(purple_account_get_connection(jbi->js), jbi->jid, user_info, NULL, NULL);
 	purple_notify_user_info_destroy(user_info);
 
 	while(jbi->vcard_imgids) {
@@ -1169,7 +1169,7 @@ static void jabber_vcard_save_mine(Jabbe
 			(vcard = xmlnode_get_child_with_namespace(packet, "query", "vcard-temp")))
 	{
 		txt = xmlnode_to_str(vcard, NULL);
-		purple_account_set_user_info(purple_connection_get_account(js->gc), txt);
+		purple_account_set_user_info(purple_connection_get_account(purple_account_get_connection(js)), txt);
 
 		g_free(txt);
 	} else {
@@ -1178,8 +1178,8 @@ static void jabber_vcard_save_mine(Jabbe
 
 	js->vcard_fetched = TRUE;
 
-	if(NULL != (img = purple_buddy_icons_find_account_icon(js->gc->account))) {
-		jabber_set_buddy_icon(js->gc, img);
+	if(NULL != (img = purple_buddy_icons_find_account_icon(purple_account_get_connection(js)->account))) {
+		jabber_set_buddy_icon(purple_account_get_connection(js), img);
 		purple_imgstore_unref(img);
 	}
 }
@@ -1234,7 +1234,7 @@ static void jabber_vcard_parse(JabberStr
 
 	bare_jid = jabber_get_bare_jid(from);
 
-	b = purple_find_buddy(js->gc->account, bare_jid);
+	b = purple_find_buddy(purple_account_get_connection(js)->account, bare_jid);
 
 	info_text = g_string_new("");
 
@@ -1274,7 +1274,7 @@ static void jabber_vcard_parse(JabberStr
 					g_free(text2);
 				}
 			} else if(text && !strcmp(child->name, "NICKNAME")) {
-				serv_got_alias(js->gc, from, text);
+				serv_got_alias(purple_account_get_connection(js), from, text);
 				if(b) {
 					purple_blist_node_set_string((PurpleBlistNode*)b, "servernick", text);
 				}
@@ -1431,7 +1431,7 @@ static void jabber_vcard_parse(JabberStr
 						for(i=0; i<20; i++, p+=2)
 							snprintf(p, 3, "%02x", hashval[i]);
 
-						purple_buddy_icons_set_for_user(js->gc->account, bare_jid,
+						purple_buddy_icons_set_for_user(purple_account_get_connection(js)->account, bare_jid,
 								data, size, hash);
 						g_free(bintext);
 					}
@@ -1462,7 +1462,7 @@ static void do_buddy_avatar_update_fromu
 		return;
 	}
 	
-	purple_buddy_icons_set_for_user(purple_connection_get_account(info->js->gc), info->from, (void*)url_text, len, info->id);
+	purple_buddy_icons_set_for_user(purple_connection_get_account(purple_account_get_connection(info->js)), info->from, (void*)url_text, len, info->id);
 	g_free(info->from);
 	g_free(info->id);
 	g_free(info);
@@ -1499,12 +1499,12 @@ static void do_buddy_avatar_update_data(
 		return;
 	}
 	
-	purple_buddy_icons_set_for_user(purple_connection_get_account(js->gc), from, img, size, checksum);
+	purple_buddy_icons_set_for_user(purple_connection_get_account(purple_account_get_connection(js)), from, img, size, checksum);
 	g_free(b64data);
 }
 
 void jabber_buddy_avatar_update_metadata(JabberStream *js, const char *from, xmlnode *items) {
-	PurpleBuddy *buddy = purple_find_buddy(purple_connection_get_account(js->gc), from);
+	PurpleBuddy *buddy = purple_find_buddy(purple_connection_get_account(purple_account_get_connection(js)), from);
 	const char *checksum;
 	xmlnode *item, *metadata;
 	if(!buddy)
@@ -1517,7 +1517,7 @@ void jabber_buddy_avatar_update_metadata
 		return;
 	/* check if we have received a stop */
 	if(xmlnode_get_child(metadata, "stop")) {
-		purple_buddy_icons_set_for_user(purple_connection_get_account(js->gc), from, NULL, 0, NULL);
+		purple_buddy_icons_set_for_user(purple_connection_get_account(purple_account_get_connection(js)), from, NULL, 0, NULL);
 	} else {
 		xmlnode *info, *goodinfo = NULL;
 		
@@ -1823,7 +1823,7 @@ static void jabber_buddy_set_invisibilit
 	char *msg;
 	int priority;
 
-	account   = purple_connection_get_account(js->gc);
+	account   = purple_connection_get_account(purple_account_get_connection(js));
 	gpresence = purple_account_get_presence(account);
 	status    = purple_presence_get_active_status(gpresence);
 
@@ -2283,7 +2283,7 @@ static void user_search_result_cb(Jabber
 	purple_notify_searchresults_button_add(results, PURPLE_NOTIFY_BUTTON_ADD,
 			user_search_result_add_buddy_cb);
 
-	purple_notify_searchresults(js->gc, NULL, NULL, _("The following are the results of your search"), results, NULL, NULL);
+	purple_notify_searchresults(purple_account_get_connection(js), NULL, NULL, _("The following are the results of your search"), results, NULL, NULL);
 }
 
 static void user_search_x_data_cb(JabberStream *js, xmlnode *result, gpointer data)
@@ -2388,7 +2388,7 @@ static void user_search_fields_result_cb
 		if(!msg)
 			msg = g_strdup(_("Unknown error"));
 
-		purple_notify_error(js->gc, _("Directory Query Failed"),
+		purple_notify_error(purple_account_get_connection(js), _("Directory Query Failed"),
 				  _("Could not query the directory server."), msg);
 		g_free(msg);
 
@@ -2459,11 +2459,11 @@ static void user_search_fields_result_cb
 		usi->js = js;
 		usi->directory_server = g_strdup(from);
 
-		purple_request_fields(js->gc, _("Search for XMPP users"),
+		purple_request_fields(purple_account_get_connection(js), _("Search for XMPP users"),
 				_("Search for XMPP users"), instructions, fields,
 				_("Search"), G_CALLBACK(user_search_cb),
 				_("Cancel"), G_CALLBACK(user_search_cancel_cb),
-				purple_connection_get_account(js->gc), NULL, NULL,
+				purple_connection_get_account(purple_account_get_connection(js)), NULL, NULL,
 				usi);
 
 		g_free(instructions);
@@ -2476,7 +2476,7 @@ void jabber_user_search(JabberStream *js
 
 	/* XXX: should probably better validate the directory we're given */
 	if(!directory || !*directory) {
-		purple_notify_error(js->gc, _("Invalid Directory"), _("Invalid Directory"), NULL);
+		purple_notify_error(purple_account_get_connection(js), _("Invalid Directory"), _("Invalid Directory"), NULL);
 		return;
 	}
 
============================================================
--- libpurple/protocols/jabber/chat.c	b5b8660c8310f8cb7b35e270bafa23c575157d82
+++ libpurple/protocols/jabber/chat.c	9831cd3c31ce4bc211f22bc1e8de21ffaaede2f0
@@ -256,7 +256,7 @@ void jabber_chat_join(PurpleConnection *
 
 	g_hash_table_insert(js->chats, room_jid, chat);
 
-	gpresence = purple_account_get_presence(gc->account);
+	gpresence = purple_account_get_presence(purple_connection_get_account(gc));
 	status = purple_presence_get_active_status(gpresence);
 
 	purple_status_to_jabber(status, &state, &msg, &priority);
@@ -393,7 +393,7 @@ static void jabber_chat_room_configure_c
 	} else if(!strcmp(type, "error")) {
 		char *msg = jabber_parse_error(js, packet, NULL);
 
-		purple_notify_error(js->gc, _("Configuration error"), _("Configuration error"), msg);
+		purple_notify_error(purple_account_get_connection(js), _("Configuration error"), _("Configuration error"), msg);
 
 		if(msg)
 			g_free(msg);
@@ -402,7 +402,7 @@ static void jabber_chat_room_configure_c
 
 	msg = g_strdup_printf("Unable to configure room %s", from);
 
-	purple_notify_info(js->gc, _("Unable to configure"), _("Unable to configure"), msg);
+	purple_notify_info(purple_account_get_connection(js), _("Unable to configure"), _("Unable to configure"), msg);
 	g_free(msg);
 
 }
@@ -417,7 +417,7 @@ void jabber_chat_request_room_configure(
 	chat->config_dialog_handle = NULL;
 
 	if(!chat->muc) {
-		purple_notify_error(chat->js->gc, _("Room Configuration Error"), _("Room Configuration Error"),
+		purple_notify_error(purple_account_get_connection(chat->js), _("Room Configuration Error"), _("Room Configuration Error"),
 				_("This room is not capable of being configured"));
 		return;
 	}
@@ -467,7 +467,7 @@ static void jabber_chat_register_x_data_
 	if(type && !strcmp(type, "error")) {
 		char *msg = jabber_parse_error(js, packet, NULL);
 
-		purple_notify_error(js->gc, _("Registration error"), _("Registration error"), msg);
+		purple_notify_error(purple_account_get_connection(js), _("Registration error"), _("Registration error"), msg);
 
 		if(msg)
 			g_free(msg);
@@ -536,7 +536,7 @@ static void jabber_chat_register_cb(Jabb
 	} else if(!strcmp(type, "error")) {
 		char *msg = jabber_parse_error(js, packet, NULL);
 
-		purple_notify_error(js->gc, _("Registration error"), _("Registration error"), msg);
+		purple_notify_error(purple_account_get_connection(js), _("Registration error"), _("Registration error"), msg);
 
 		if(msg)
 			g_free(msg);
@@ -545,7 +545,7 @@ static void jabber_chat_register_cb(Jabb
 
 	msg = g_strdup_printf("Unable to configure room %s", from);
 
-	purple_notify_info(js->gc, _("Unable to configure"), _("Unable to configure"), msg);
+	purple_notify_info(purple_account_get_connection(js), _("Unable to configure"), _("Unable to configure"), msg);
 	g_free(msg);
 
 }
@@ -629,7 +629,7 @@ void jabber_chat_change_nick(JabberChat 
 		return;
 	}
 
-	gpresence = purple_account_get_presence(chat->js->gc->account);
+	gpresence = purple_account_get_presence(purple_account_get_connection(chat->js)->account);
 	status = purple_presence_get_active_status(gpresence);
 
 	purple_status_to_jabber(status, &state, &msg, &priority);
@@ -674,7 +674,7 @@ static void roomlist_disco_result_cb(Jab
 
 	if(!(type = xmlnode_get_attrib(packet, "type")) || strcmp(type, "result")) {
 		char *err = jabber_parse_error(js, packet, NULL);
-		purple_notify_error(js->gc, _("Error"),
+		purple_notify_error(purple_account_get_connection(js), _("Error"),
 				_("Error retrieving room list"), err);
 		purple_roomlist_set_in_progress(js->roomlist, FALSE);
 		purple_roomlist_unref(js->roomlist);
@@ -685,7 +685,7 @@ static void roomlist_disco_result_cb(Jab
 
 	if(!(query = xmlnode_get_child(packet, "query"))) {
 		char *err = jabber_parse_error(js, packet, NULL);
-		purple_notify_error(js->gc, _("Error"),
+		purple_notify_error(purple_account_get_connection(js), _("Error"),
 				_("Error retrieving room list"), err);
 		purple_roomlist_set_in_progress(js->roomlist, FALSE);
 		purple_roomlist_unref(js->roomlist);
@@ -734,7 +734,7 @@ static void roomlist_ok_cb(JabberStream 
 		return;
 
 	if(!server || !*server) {
-		purple_notify_error(js->gc, _("Invalid Server"), _("Invalid Server"), NULL);
+		purple_notify_error(purple_account_get_connection(js), _("Invalid Server"), _("Invalid Server"), NULL);
 		return;
 	}
 
@@ -764,7 +764,7 @@ PurpleRoomlist *jabber_roomlist_get_list
 	if(js->roomlist)
 		purple_roomlist_unref(js->roomlist);
 
-	js->roomlist = purple_roomlist_new(purple_connection_get_account(js->gc));
+	js->roomlist = purple_roomlist_new(purple_connection_get_account(purple_account_get_connection(js)));
 
 	f = purple_roomlist_field_new(PURPLE_ROOMLIST_FIELD_STRING, "", "room", TRUE);
 	fields = g_list_append(fields, f);
============================================================
--- libpurple/protocols/jabber/disco.c	091b432ce26cf0eeed08aa0b0198e38098df1765
+++ libpurple/protocols/jabber/disco.c	8d626a775ccbbd50e960044217d7ed71eee00ae2
@@ -338,7 +338,7 @@ jabber_disco_finish_server_info_result_c
 	}
 
 	/* Send initial presence; this will trigger receipt of presence for contacts on the roster */
-	jabber_presence_send(js->gc->account, NULL);
+	jabber_presence_send(purple_account_get_connection(js)->account, NULL);
 	
 	if (js->server_caps & JABBER_CAP_ADHOC) {
 		/* The server supports ad-hoc commands, so let's request the list */
============================================================
--- libpurple/protocols/jabber/google.c	a0d13b8f6207182f5fc8f10066881688229d698c
+++ libpurple/protocols/jabber/google.c	f5df5626884347c2b925b83b5fc15c9751c83132
@@ -65,7 +65,7 @@ jabber_gmail_parse(JabberStream *js, xml
 
 	if (count == 0 || !message) {
 		if (count > 0)
-			purple_notify_emails(js->gc, count, FALSE, NULL, NULL, (const char**) default_tos, NULL, NULL, NULL);
+			purple_notify_emails(purple_account_get_connection(js), count, FALSE, NULL, NULL, (const char**) default_tos, NULL, NULL, NULL);
 		g_free(default_tos[0]);
 		return;
 	}
@@ -121,10 +121,10 @@ jabber_gmail_parse(JabberStream *js, xml
 	}
 
 	if (i>0)
-		purple_notify_emails(js->gc, count, count == i, (const char**) subjects, froms, tos,
+		purple_notify_emails(purple_account_get_connection(js), count, count == i, (const char**) subjects, froms, tos,
 				urls, NULL, NULL);
 	else
-		purple_notify_emails(js->gc, count, FALSE, NULL, NULL, (const char**) default_tos, NULL, NULL, NULL);
+		purple_notify_emails(purple_account_get_connection(js), count, FALSE, NULL, NULL, (const char**) default_tos, NULL, NULL, NULL);
 
 
 	g_free(to_name);
@@ -151,7 +151,7 @@ jabber_gmail_poke(JabberStream *js, xmln
 	JabberIq *iq;
 
 	/* bail if the user isn't interested */
-	if (!purple_account_get_check_mail(js->gc->account))
+	if (!purple_account_get_check_mail(purple_account_get_connection(js)->account))
 		return;
 
 	type = xmlnode_get_attrib(packet, "type");
@@ -180,7 +180,7 @@ void jabber_gmail_init(JabberStream *js)
 void jabber_gmail_init(JabberStream *js) {
 	JabberIq *iq;
 
-	if (!purple_account_get_check_mail(js->gc->account))
+	if (!purple_account_get_check_mail(purple_account_get_connection(js)->account))
 		return;
 
 	iq = jabber_iq_new_query(js, JABBER_IQ_GET, "google:mail:notify");
@@ -204,7 +204,7 @@ void jabber_google_roster_outgoing(Jabbe
 
 void jabber_google_roster_outgoing(JabberStream *js, xmlnode *query, xmlnode *item)
 {
-	PurpleAccount *account = purple_connection_get_account(js->gc);
+	PurpleAccount *account = purple_connection_get_account(purple_account_get_connection(js));
 	GSList *list = account->deny;
 	const char *jid = xmlnode_get_attrib(item, "jid");
 	char *jid_norm = g_strdup(jabber_normalize(account, jid));
@@ -226,7 +226,7 @@ gboolean jabber_google_roster_incoming(J
 
 gboolean jabber_google_roster_incoming(JabberStream *js, xmlnode *item)
 {
-	PurpleAccount *account = purple_connection_get_account(js->gc);
+	PurpleAccount *account = purple_connection_get_account(purple_account_get_connection(js));
 	GSList *list = account->deny;
 	const char *jid = xmlnode_get_attrib(item, "jid");
 	gboolean on_block_list = FALSE;
@@ -291,7 +291,7 @@ void jabber_google_roster_add_deny(Purpl
 
 	jb = jabber_buddy_find(js, who, TRUE);
 
-	buddies = purple_find_buddies(js->gc->account, who);
+	buddies = purple_find_buddies(purple_account_get_connection(js)->account, who);
 	if(!buddies)
 		return;
 
@@ -362,7 +362,7 @@ void jabber_google_roster_rem_deny(Purpl
 	if (!js || !js->server_caps & JABBER_CAP_GOOGLE_ROSTER)
 		return;
 
-	buddies = purple_find_buddies(js->gc->account, who);
+	buddies = purple_find_buddies(purple_account_get_connection(js)->account, who);
 	if(!buddies)
 		return;
 
@@ -522,11 +522,11 @@ void jabber_google_presence_incoming(Jab
 	if (!js->googletalk)
 		return;
 	if (jbr->status && !strncmp(jbr->status, "♫ ", strlen("♫ "))) {
-		purple_prpl_got_user_status(js->gc->account, user, "tune",
+		purple_prpl_got_user_status(purple_account_get_connection(js)->account, user, "tune",
 					    PURPLE_TUNE_TITLE, jbr->status + strlen("♫ "), NULL);
 		jbr->status = NULL;
 	} else {
-		purple_prpl_got_user_status_deactive(js->gc->account, user, "tune");
+		purple_prpl_got_user_status_deactive(purple_account_get_connection(js)->account, user, "tune");
 	}
 }
 
============================================================
--- libpurple/protocols/jabber/jabber.c	987be3a39eb1ec8f0abd966ad6a31b37a6928a13
+++ libpurple/protocols/jabber/jabber.c	cbb85fe8b77dd24886c8100d8c84fe2a6991caac
@@ -89,7 +89,7 @@ jabber_session_initialized_cb(JabberStre
 		if(js->unregistration)
 			jabber_unregister_account_cb(js);
 	} else {
-		purple_connection_error_reason (js->gc,
+		purple_connection_error_reason (purple_account_get_connection(js),
 			PURPLE_CONNECTION_ERROR_NETWORK_ERROR,
 			("Error initializing session"));
 	}
@@ -122,7 +122,7 @@ static void jabber_bind_result_cb(Jabber
 			JabberBuddy *my_jb = NULL;
 			jabber_id_free(js->user);
 			if(!(js->user = jabber_id_new(full_jid))) {
-				purple_connection_error_reason (js->gc,
+				purple_connection_error_reason (purple_account_get_connection(js),
 					PURPLE_CONNECTION_ERROR_NETWORK_ERROR,
 					_("Invalid response from server."));
 			}
@@ -133,7 +133,7 @@ static void jabber_bind_result_cb(Jabber
 	} else {
 		PurpleConnectionError reason = PURPLE_CONNECTION_ERROR_NETWORK_ERROR;
 		char *msg = jabber_parse_error(js, packet, &reason);
-		purple_connection_error_reason (js->gc, reason, msg);
+		purple_connection_error_reason (purple_account_get_connection(js), reason, msg);
 		g_free(msg);
 	}
 
@@ -145,8 +145,8 @@ static void jabber_stream_features_parse
 	if(xmlnode_get_child(packet, "starttls")) {
 		if(jabber_process_starttls(js, packet))
 			return;
-	} else if(purple_account_get_bool(js->gc->account, "require_tls", FALSE) && !js->gsc) {
-		purple_connection_error_reason (js->gc,
+	} else if(purple_account_get_bool(purple_account_get_connection(js)->account, "require_tls", FALSE) && !js->gsc) {
+		purple_connection_error_reason (purple_account_get_connection(js),
 			 PURPLE_CONNECTION_ERROR_ENCRYPTION_ERROR,
 			_("You require encryption, but it is not available on this server."));
 		return;
@@ -182,7 +182,7 @@ static void jabber_stream_handle_error(J
 	PurpleConnectionError reason = PURPLE_CONNECTION_ERROR_NETWORK_ERROR;
 	char *msg = jabber_parse_error(js, packet, &reason);
 
-	purple_connection_error_reason (js->gc, reason, msg);
+	purple_connection_error_reason (purple_account_get_connection(js), reason, msg);
 
 	g_free(msg);
 }
@@ -193,7 +193,7 @@ void jabber_process_packet(JabberStream 
 {
 	const char *xmlns;
 
-	purple_signal_emit(my_protocol, "jabber-receiving-xmlnode", js->gc, packet);
+	purple_signal_emit(my_protocol, "jabber-receiving-xmlnode", purple_account_get_connection(js), packet);
 
 	/* if the signal leaves us with a null packet, we're done */
 	if(NULL == *packet)
@@ -264,7 +264,7 @@ static void jabber_send_cb(gpointer data
 	if (ret < 0 && errno == EAGAIN)
 		return;
 	else if (ret <= 0) {
-		purple_connection_error_reason (js->gc,
+		purple_connection_error_reason (purple_account_get_connection(js),
 			PURPLE_CONNECTION_ERROR_NETWORK_ERROR,
 			_("Write error"));
 		return;
@@ -285,7 +285,7 @@ void jabber_send_raw(JabberStream *js, c
 	/* If we've got a security layer, we need to encode the data,
 	 * splitting it on the maximum buffer length negotiated */
 	
-	purple_signal_emit(my_protocol, "jabber-sending-text", js->gc, &data);
+	purple_signal_emit(my_protocol, "jabber-sending-text", purple_account_get_connection(js), &data);
 	if (data == NULL)
 		return;
 	
@@ -319,7 +319,7 @@ void jabber_send_raw(JabberStream *js, c
 			}
 
 			if (ret < 0 && errno != EAGAIN)
-				purple_connection_error_reason (js->gc,
+				purple_connection_error_reason (purple_account_get_connection(js),
 					PURPLE_CONNECTION_ERROR_NETWORK_ERROR,
 					_("Write error"));
 			else if (ret < olen) {
@@ -349,7 +349,7 @@ void jabber_send_raw(JabberStream *js, c
 	}
 
 	if (ret < 0 && errno != EAGAIN)
-		purple_connection_error_reason (js->gc,
+		purple_connection_error_reason (purple_account_get_connection(js),
 			PURPLE_CONNECTION_ERROR_NETWORK_ERROR,
 			_("Write error"));
 	else if (ret < len) {
@@ -377,7 +377,7 @@ void jabber_send(JabberStream *js, xmlno
 	char *txt;
 	int len;
 
-	purple_signal_emit(my_protocol, "jabber-sending-xmlnode", js->gc, &packet);
+	purple_signal_emit(my_protocol, "jabber-sending-xmlnode", purple_account_get_connection(js), &packet);
 
 	/* if we get NULL back, we're done processing */
 	if(NULL == packet)
@@ -443,7 +443,7 @@ jabber_recv_cb_ssl(gpointer data, Purple
 	if(errno == EAGAIN)
 		return;
 	else
-		purple_connection_error_reason (js->gc,
+		purple_connection_error_reason (purple_account_get_connection(js),
 			PURPLE_CONNECTION_ERROR_NETWORK_ERROR,
 			_("Read Error"));
 }
@@ -483,7 +483,7 @@ jabber_recv_cb(gpointer data, gint sourc
 	} else if(errno == EAGAIN) {
 		return;
 	} else {
-		purple_connection_error_reason (js->gc,
+		purple_connection_error_reason (purple_account_get_connection(js),
 			PURPLE_CONNECTION_ERROR_NETWORK_ERROR,
 			_("Read Error"));
 	}
@@ -558,10 +558,10 @@ static void tls_init(JabberStream *js)
 
 static void tls_init(JabberStream *js)
 {
-	purple_input_remove(js->gc->inpa);
-	js->gc->inpa = 0;
-	js->gsc = purple_ssl_connect_with_host_fd(js->gc->account, js->fd,
-			jabber_login_callback_ssl, jabber_ssl_connect_failure, js->certificate_CN, js->gc);
+	purple_input_remove(purple_account_get_connection(js)->inpa);
+	purple_account_get_connection(js)->inpa = 0;
+	js->gsc = purple_ssl_connect_with_host_fd(purple_account_get_connection(js)->account, js->fd,
+			jabber_login_callback_ssl, jabber_ssl_connect_failure, js->certificate_CN, purple_account_get_connection(js));
 }
 
 static void jabber_login_connect(JabberStream *js, const char *domain, const char *host, int port)
@@ -575,9 +575,9 @@ static void jabber_login_connect(JabberS
 	else
 		js->serverFQDN = g_strdup(host);
 
-	if (purple_proxy_connect(js->gc, js->gc->account, host,
-			port, jabber_login_callback, js->gc) == NULL)
-		purple_connection_error_reason (js->gc,
+	if (purple_proxy_connect(purple_account_get_connection(js), purple_account_get_connection(js)->account, host,
+			port, jabber_login_callback, purple_account_get_connection(js)) == NULL)
+		purple_connection_error_reason (purple_account_get_connection(js),
 			PURPLE_CONNECTION_ERROR_NETWORK_ERROR,
 			_("Unable to create socket"));
 }
@@ -594,7 +594,7 @@ static void srv_resolved_cb(PurpleSrvRes
 		g_free(resp);
 	} else {
 		jabber_login_connect(js, js->user->domain, js->user->domain,
-			purple_account_get_int(js->gc->account, "port", 5222));
+			purple_account_get_int(purple_account_get_connection(js)->account, "port", 5222));
 	}
 }
 
@@ -607,9 +607,9 @@ jabber_login(PurpleAccount *account)
 	JabberStream *js;
 	JabberBuddy *my_jb = NULL;
 
-	gc->flags |= PURPLE_CONNECTION_HTML;
+	gc->flags |= PURPLE_CONNECTION_FLAGS_HTML;
 	js = gc->proto_data = g_new0(JabberStream, 1);
-	js->gc = gc;
+	purple_account_get_connection(js) = gc;
 	js->fd = -1;
 	js->iq_callbacks = g_hash_table_new_full(g_str_hash, g_str_equal,
 			g_free, g_free);
@@ -659,14 +659,14 @@ jabber_login(PurpleAccount *account)
 	jabber_stream_set_state(js, JABBER_STREAM_CONNECTING);
 
 	/* if they've got old-ssl mode going, we probably want to ignore SRV lookups */
-	if(purple_account_get_bool(js->gc->account, "old_ssl", FALSE)) {
+	if(purple_account_get_bool(purple_account_get_connection(js)->account, "old_ssl", FALSE)) {
 		if(purple_ssl_is_supported()) {
-			js->gsc = purple_ssl_connect(js->gc->account,
+			js->gsc = purple_ssl_connect(purple_account_get_connection(js)->account,
 					js->certificate_CN,
 					purple_account_get_int(account, "port", 5223), jabber_login_callback_ssl,
-					jabber_ssl_connect_failure, js->gc);
+					jabber_ssl_connect_failure, purple_account_get_connection(js));
 		} else {
-			purple_connection_error_reason (js->gc,
+			purple_connection_error_reason (purple_account_get_connection(js),
 				PURPLE_CONNECTION_ERROR_NO_SSL_SUPPORT,
 				_("SSL support unavailable"));
 		}
@@ -689,7 +689,7 @@ conn_close_cb(gpointer data)
 conn_close_cb(gpointer data)
 {
 	JabberStream *js = data;
-	PurpleAccount *account = purple_connection_get_account(js->gc);
+	PurpleAccount *account = purple_connection_get_account(purple_account_get_connection(js));
 
 	jabber_parser_free(js);
 
@@ -707,7 +707,7 @@ jabber_registration_result_cb(JabberStre
 static void
 jabber_registration_result_cb(JabberStream *js, xmlnode *packet, gpointer data)
 {
-	PurpleAccount *account = purple_connection_get_account(js->gc);
+	PurpleAccount *account = purple_connection_get_account(purple_account_get_connection(js));
 	const char *type = xmlnode_get_attrib(packet, "type");
 	char *buf;
 	char *to = data;
@@ -849,7 +849,7 @@ jabber_register_cb(JabberRegisterCBData 
 					cbdata->js->user->node = g_strdup(value);
 			}
 				if(cbdata->js->registration && !strcmp(id, "password"))
-					purple_account_set_password(cbdata->js->gc->account, value);
+					purple_account_set_password(purple_account_get_connection(cbdata->js)->account, value);
 		}
 	}
 	}
@@ -857,7 +857,7 @@ jabber_register_cb(JabberRegisterCBData 
 	if(cbdata->js->registration) {
 		username = g_strdup_printf("%s@%s/%s", cbdata->js->user->node, cbdata->js->user->domain,
 				cbdata->js->user->resource);
-		purple_account_set_username(cbdata->js->gc->account, username);
+		purple_account_set_username(purple_account_get_connection(cbdata->js)->account, username);
 		g_free(username);
 	}
 
@@ -870,7 +870,7 @@ jabber_register_cancel_cb(JabberRegister
 static void
 jabber_register_cancel_cb(JabberRegisterCBData *cbdata, PurpleRequestFields *fields)
 {
-	PurpleAccount *account = purple_connection_get_account(cbdata->js->gc);
+	PurpleAccount *account = purple_connection_get_account(purple_account_get_connection(cbdata->js));
 	if(account && cbdata->js->registration) {
 		if(account->registration_cb)
 			(account->registration_cb)(account, FALSE, account->registration_cb_user_data);
@@ -898,7 +898,7 @@ void jabber_register_parse(JabberStream 
 
 void jabber_register_parse(JabberStream *js, xmlnode *packet)
 {
-	PurpleAccount *account = purple_connection_get_account(js->gc);
+	PurpleAccount *account = purple_connection_get_account(purple_account_get_connection(js));
 	const char *type;
 	const char *from;
 	PurpleRequestFields *fields;
@@ -919,7 +919,7 @@ void jabber_register_parse(JabberStream 
 	
 	if(js->registration) {
 		/* get rid of the login thingy */
-		purple_connection_set_state(js->gc, PURPLE_CONNECTED);
+		purple_connection_set_state(purple_account_get_connection(js), PURPLE_CONNECTION_STATE_CONNECTED);
 	}
 
 	query = xmlnode_get_child(packet, "query");
@@ -951,7 +951,7 @@ void jabber_register_parse(JabberStream 
 				g_free(href);
 
 				if(js->registration) {
-					js->gc->wants_to_die = TRUE;
+					purple_account_get_connection(js)->wants_to_die = TRUE;
 					if(account->registration_cb) /* succeeded, but we have no login info */
 						(account->registration_cb)(account, TRUE, account->registration_cb_user_data);
 					jabber_connection_schedule_close(js);
@@ -976,7 +976,7 @@ void jabber_register_parse(JabberStream 
 
 	if(js->registration)
 		field = purple_request_field_string_new("password", _("Password"),
-									purple_connection_get_password(js->gc), FALSE);
+									purple_connection_get_password(purple_account_get_connection(js)), FALSE);
 	else
 		field = purple_request_field_string_new("password", _("Password"), NULL, FALSE);
 
@@ -986,7 +986,7 @@ void jabber_register_parse(JabberStream 
 	if(xmlnode_get_child(query, "name")) {
 		if(js->registration)
 			field = purple_request_field_string_new("name", _("Name"),
-													purple_account_get_alias(js->gc->account), FALSE);
+													purple_account_get_alias(purple_account_get_connection(js)->account), FALSE);
 		else
 			field = purple_request_field_string_new("name", _("Name"), NULL, FALSE);
 		purple_request_field_group_add_field(group, field);
@@ -1054,20 +1054,20 @@ void jabber_register_parse(JabberStream 
 	cbdata->who = g_strdup(from);
 
 	if(js->registration)
-		purple_request_fields(js->gc, _("Register New XMPP Account"),
+		purple_request_fields(purple_account_get_connection(js), _("Register New XMPP Account"),
 				_("Register New XMPP Account"), instructions, fields,
 				_("Register"), G_CALLBACK(jabber_register_cb),
 				_("Cancel"), G_CALLBACK(jabber_register_cancel_cb),
-				purple_connection_get_account(js->gc), NULL, NULL,
+				purple_connection_get_account(purple_account_get_connection(js)), NULL, NULL,
 				cbdata);
 	else {
 		char *title = registered?g_strdup_printf(_("Change Account Registration at %s"), from)
 								:g_strdup_printf(_("Register New Account at %s"), from);
-		purple_request_fields(js->gc, title,
+		purple_request_fields(purple_account_get_connection(js), title,
 			  title, instructions, fields,
 			  (registered ? _("Change Registration") : _("Register")), G_CALLBACK(jabber_register_cb),
 			  _("Cancel"), G_CALLBACK(jabber_register_cancel_cb),
-			  purple_connection_get_account(js->gc), NULL, NULL,
+			  purple_connection_get_account(purple_account_get_connection(js)), NULL, NULL,
 			  cbdata);
 		g_free(title);
 	}
@@ -1101,7 +1101,7 @@ void jabber_register_account(PurpleAccou
 	const char *server;
 
 	js = gc->proto_data = g_new0(JabberStream, 1);
-	js->gc = gc;
+	purple_account_get_connection(js) = gc;
 	js->registration = TRUE;
 	js->iq_callbacks = g_hash_table_new_full(g_str_hash, g_str_equal,
 			g_free, g_free);
@@ -1169,18 +1169,18 @@ static void jabber_unregister_account_iq
 }
 
 static void jabber_unregister_account_iq_cb(JabberStream *js, xmlnode *packet, gpointer data) {
-	PurpleAccount *account = purple_connection_get_account(js->gc);
+	PurpleAccount *account = purple_connection_get_account(purple_account_get_connection(js));
 	const char *type = xmlnode_get_attrib(packet,"type");
 	if(!strcmp(type,"error")) {
 		char *msg = jabber_parse_error(js, packet, NULL);
 		
-		purple_notify_error(js->gc, _("Error unregistering account"),
+		purple_notify_error(purple_account_get_connection(js), _("Error unregistering account"),
 							_("Error unregistering account"), msg);
 		g_free(msg);
 		if(js->unregistration_cb)
 			js->unregistration_cb(account, FALSE, js->unregistration_user_data);
 	} else if(!strcmp(type,"result")) {
-		purple_notify_info(js->gc, _("Account successfully unregistered"),
+		purple_notify_info(purple_account_get_connection(js), _("Account successfully unregistered"),
 						   _("Account successfully unregistered"), NULL);
 		if(js->unregistration_cb)
 			js->unregistration_cb(account, TRUE, js->unregistration_user_data);
@@ -1208,8 +1208,8 @@ void jabber_unregister_account(PurpleAcc
 	PurpleConnection *gc = purple_account_get_connection(account);
 	JabberStream *js;
 	
-	if(gc->state != PURPLE_CONNECTED) {
-		if(gc->state != PURPLE_CONNECTING)
+	if(gc->state != PURPLE_CONNECTION_STATE_CONNECTED) {
+		if(gc->state != PURPLE_CONNECTION_STATE_CONNECTING)
 			jabber_login(account);
 		js = gc->proto_data;
 		js->unregistration = TRUE;
@@ -1252,8 +1252,8 @@ void jabber_close(PurpleConnection *gc)
 #endif
 			purple_ssl_close(js->gsc);
 	} else if (js->fd > 0) {
-		if(js->gc->inpa)
-			purple_input_remove(js->gc->inpa);
+		if(purple_account_get_connection(js)->inpa)
+			purple_input_remove(purple_account_get_connection(js)->inpa);
 		close(js->fd);
 	}
 
@@ -1340,20 +1340,20 @@ void jabber_stream_set_state(JabberStrea
 		case JABBER_STREAM_OFFLINE:
 			break;
 		case JABBER_STREAM_CONNECTING:
-			purple_connection_update_progress(js->gc, _("Connecting"), 1,
+			purple_connection_update_progress(purple_account_get_connection(js), _("Connecting"), 1,
 					JABBER_CONNECT_STEPS);
 			break;
 		case JABBER_STREAM_INITIALIZING:
-			purple_connection_update_progress(js->gc, _("Initializing Stream"),
+			purple_connection_update_progress(purple_account_get_connection(js), _("Initializing Stream"),
 					js->gsc ? 5 : 2, JABBER_CONNECT_STEPS);
 			jabber_stream_init(js);
 			break;
 		case JABBER_STREAM_INITIALIZING_ENCRYPTION:
-			purple_connection_update_progress(js->gc, _("Initializing SSL/TLS"),
+			purple_connection_update_progress(purple_account_get_connection(js), _("Initializing SSL/TLS"),
 											  6, JABBER_CONNECT_STEPS);
 			break;
 		case JABBER_STREAM_AUTHENTICATING:
-			purple_connection_update_progress(js->gc, _("Authenticating"),
+			purple_connection_update_progress(purple_account_get_connection(js), _("Authenticating"),
 					js->gsc ? 7 : 3, JABBER_CONNECT_STEPS);
 			if(js->protocol_version == JABBER_PROTO_0_9 && js->registration) {
 				jabber_register_start(js);
@@ -1362,7 +1362,7 @@ void jabber_stream_set_state(JabberStrea
 			}
 			break;
 		case JABBER_STREAM_REINITIALIZING:
-			purple_connection_update_progress(js->gc, _("Re-initializing Stream"),
+			purple_connection_update_progress(purple_account_get_connection(js), _("Re-initializing Stream"),
 					(js->gsc ? 8 : 4), JABBER_CONNECT_STEPS);
 
 			/* The stream will be reinitialized later, in jabber_recv_cb_ssl() */
@@ -1371,7 +1371,7 @@ void jabber_stream_set_state(JabberStrea
 			break;
 		case JABBER_STREAM_CONNECTED:
 			/* now we can alert the core that we're ready to send status */
-			purple_connection_set_state(js->gc, PURPLE_CONNECTED);
+			purple_connection_set_state(purple_account_get_connection(js), PURPLE_CONNECTION_STATE_CONNECTED);
 			jabber_disco_items_server(js);
 			break;
 	}
@@ -1432,10 +1432,10 @@ const char* jabber_list_emblem(PurpleBud
 	JabberStream *js;
 	JabberBuddy *jb = NULL;
 
-	if(!b->account->gc)
+	if(!purple_account_get_connection(b->account))
 		return NULL;
 
-	js = b->account->gc->proto_data;
+	js = purple_account_get_connection(b->account)->proto_data;
 	if(js)
 		jb = jabber_buddy_find(js, b->name, FALSE);
 
@@ -1452,8 +1452,8 @@ char *jabber_status_text(PurpleBuddy *b)
 	char *ret = NULL;
 	JabberBuddy *jb = NULL;
 	
-	if (b->account->gc && b->account->gc->proto_data)
-		jb = jabber_buddy_find(b->account->gc->proto_data, b->name, FALSE);
+	if (purple_account_get_connection(b->account) && purple_account_get_connection(b->account)->proto_data)
+		jb = jabber_buddy_find(purple_account_get_connection(b->account)->proto_data, b->name, FALSE);
 
 	if(jb && !PURPLE_BUDDY_IS_ONLINE(b) && (jb->subscription & JABBER_SUB_PENDING || !(jb->subscription & JABBER_SUB_TO))) {
 		ret = g_strdup(_("Not Authorized"));
@@ -1485,10 +1485,10 @@ void jabber_tooltip_text(PurpleBuddy *b,
 
 	g_return_if_fail(b != NULL);
 	g_return_if_fail(b->account != NULL);
-	g_return_if_fail(b->account->gc != NULL);
-	g_return_if_fail(b->account->gc->proto_data != NULL);
+	g_return_if_fail(purple_account_get_connection(b->account) != NULL);
+	g_return_if_fail(purple_account_get_connection(b->account)->proto_data != NULL);
 
-	jb = jabber_buddy_find(b->account->gc->proto_data, b->name,
+	jb = jabber_buddy_find(purple_account_get_connection(b->account)->proto_data, b->name,
 			FALSE);
 
 	if(jb) {
@@ -1707,14 +1707,14 @@ jabber_password_change_result_cb(JabberS
 	type = xmlnode_get_attrib(packet, "type");
 
 	if(type && !strcmp(type, "result")) {
-		purple_notify_info(js->gc, _("Password Changed"), _("Password Changed"),
+		purple_notify_info(purple_account_get_connection(js), _("Password Changed"), _("Password Changed"),
 				_("Your password has been changed."));
 
-		purple_account_set_password(js->gc->account, (char *)data);
+		purple_account_set_password(purple_account_get_connection(js)->account, (char *)data);
 	} else {
 		char *msg = jabber_parse_error(js, packet, NULL);
 
-		purple_notify_error(js->gc, _("Error changing password"),
+		purple_notify_error(purple_account_get_connection(js), _("Error changing password"),
 				_("Error changing password"), msg);
 		g_free(msg);
 	}
@@ -1733,7 +1733,7 @@ static void jabber_password_change_cb(Ja
 	p2 = purple_request_fields_get_string(fields, "password2");
 
 	if(strcmp(p1, p2)) {
-		purple_notify_error(js->gc, NULL, _("New passwords do not match."), NULL);
+		purple_notify_error(purple_account_get_connection(js), NULL, _("New passwords do not match."), NULL);
 		return;
 	}
 
@@ -1778,7 +1778,7 @@ static void jabber_password_change(Purpl
 	purple_request_field_set_required(field, TRUE);
 	purple_request_field_group_add_field(group, field);
 
-	purple_request_fields(js->gc, _("Change XMPP Password"),
+	purple_request_fields(purple_account_get_connection(js), _("Change XMPP Password"),
 			_("Change XMPP Password"), _("Please enter your new password"),
 			fields, _("OK"), G_CALLBACK(jabber_password_change_cb),
 			_("Cancel"), NULL,
@@ -1955,8 +1955,8 @@ char *jabber_parse_error(JabberStream *j
 		} else if(xmlnode_get_child(packet, "not-authorized")) {
 			SET_REASON(PURPLE_CONNECTION_ERROR_AUTHENTICATION_FAILED);
 			/* Clear the pasword if it isn't being saved */
-			if (!purple_account_get_remember_password(js->gc->account))
-				purple_account_set_password(js->gc->account, NULL);
+			if (!purple_account_get_remember_password(purple_account_get_connection(js)->account))
+				purple_account_set_password(purple_account_get_connection(js)->account, NULL);
 			text = _("Not Authorized");
 		} else if(xmlnode_get_child(packet, "temporary-auth-failure")) {
 			text = _("Temporary Authentication Failure");
@@ -2299,7 +2299,7 @@ static PurpleCmdRet jabber_cmd_buzz(Purp
 static PurpleCmdRet jabber_cmd_buzz(PurpleConversation *conv,
 		const char *cmd, char **args, char **error, void *data)
 {
-	JabberStream *js = conv->account->gc->proto_data;
+	JabberStream *js = purple_account_get_connection(conv->account)->proto_data;
 
 	if(!args || !args[0])
 		return PURPLE_CMD_RET_FAILED;
============================================================
--- libpurple/protocols/jabber/jutil.c	59fdee9620caa6845b0d9e8c206f328eb34e6136
+++ libpurple/protocols/jabber/jutil.c	e763263b267ff42399809bfd5cf34e43d9890605
@@ -187,7 +187,7 @@ const char *jabber_normalize(const Purpl
 
 const char *jabber_normalize(const PurpleAccount *account, const char *in)
 {
-	PurpleConnection *gc = account ? account->gc : NULL;
+	PurpleConnection *gc = account ? purple_account_get_connection(account) : NULL;
 	JabberStream *js = gc ? gc->proto_data : NULL;
 	static char buf[3072]; /* maximum legal length of a jabber jid */
 	JabberID *jid;
============================================================
--- libpurple/protocols/jabber/message.c	3ceab074f381af5ba3b818d7b08a14c864708c76
+++ libpurple/protocols/jabber/message.c	9fb3b0e0f9754acaba859540bf6f7b11cefbef00
@@ -40,7 +40,7 @@ void jabber_message_free(JabberMessage *
 	g_free(jm->subject);
 	g_free(jm->body);
 	g_free(jm->xhtml);
-	g_free(jm->password);
+	g_free(purple_account_get_password(jm));
 	g_free(jm->error);
 	g_free(jm->thread_id);
 	g_list_free(jm->etc);
@@ -63,14 +63,14 @@ static void handle_chat(JabberMessage *j
 	jb = jabber_buddy_find(jm->js, jm->from, TRUE);
 	jbr = jabber_buddy_find_resource(jb, jid->resource);
 
-	if(jabber_find_unnormalized_conv(jm->from, jm->js->gc->account)) {
+	if(jabber_find_unnormalized_conv(jm->from, purple_account_get_connection(jm->js)->account)) {
 		from = g_strdup(jm->from);
 	} else  if(jid->node) {
 		if(jid->resource) {
 			PurpleConversation *conv;
 
 			from = g_strdup_printf("%s@%s", jid->node, jid->domain);
-			conv = purple_find_conversation_with_account(PURPLE_CONV_TYPE_IM, from, jm->js->gc->account);
+			conv = purple_find_conversation_with_account(PURPLE_CONV_TYPE_IM, from, purple_account_get_connection(jm->js)->account);
 			if(conv) {
 				purple_conversation_set_name(conv, jm->from);
 				}
@@ -83,19 +83,19 @@ static void handle_chat(JabberMessage *j
 
 	if(!jm->xhtml && !jm->body) {
 		if(JM_STATE_COMPOSING == jm->chat_state) {
-			serv_got_typing(jm->js->gc, from, 0, PURPLE_TYPING);
+			serv_got_typing(purple_account_get_connection(jm->js), from, 0, PURPLE_TYPING);
 		} else if(JM_STATE_PAUSED == jm->chat_state) {
-			serv_got_typing(jm->js->gc, from, 0, PURPLE_TYPED);
+			serv_got_typing(purple_account_get_connection(jm->js), from, 0, PURPLE_TYPED);
 		} else if(JM_STATE_GONE == jm->chat_state) {
 			PurpleConversation *conv = purple_find_conversation_with_account(PURPLE_CONV_TYPE_IM,
-					from, jm->js->gc->account);
+					from, purple_account_get_connection(jm->js)->account);
 			if (conv && jid->node && jid->domain) {
 				char buf[256];
 				PurpleBuddy *buddy;
 
 				g_snprintf(buf, sizeof(buf), "%s@%s", jid->node, jid->domain);
 
-				if ((buddy = purple_find_buddy(jm->js->gc->account, buf))) {
+				if ((buddy = purple_find_buddy(purple_account_get_connection(jm->js)->account, buf))) {
 					const char *who;
 					char *escaped;
 
@@ -113,10 +113,10 @@ static void handle_chat(JabberMessage *j
 					                        PURPLE_MESSAGE_SYSTEM, time(NULL));
 				}
 			}
-			serv_got_typing_stopped(jm->js->gc, from);
+			serv_got_typing_stopped(purple_account_get_connection(jm->js), from);
 			
 		} else {
-			serv_got_typing_stopped(jm->js->gc, from);
+			serv_got_typing_stopped(purple_account_get_connection(jm->js), from);
 		}
 	} else {
 		if(jbr) {
@@ -140,7 +140,7 @@ static void handle_chat(JabberMessage *j
 			jm->body = jabber_google_format_to_html(jm->body);
 			g_free(tmp);
 		}
-		serv_got_im(jm->js->gc, from, jm->xhtml ? jm->xhtml : jm->body, 0,
+		serv_got_im(purple_account_get_connection(jm->js), from, jm->xhtml ? jm->xhtml : jm->body, 0,
 				jm->sent);
 	}
 
@@ -195,7 +195,7 @@ static void handle_headline(JabberMessag
 		}
 	}
 
-	purple_notify_formatted(jm->js->gc, title, jm->subject ? jm->subject : title,
+	purple_notify_formatted(purple_account_get_connection(jm->js), title, jm->subject ? jm->subject : title,
 			NULL, body->str, NULL, NULL);
 
 	g_free(title);
@@ -235,7 +235,7 @@ static void handle_groupchat(JabberMessa
 
 	if(jm->xhtml || jm->body) {
 		if(jid->resource)
-			serv_got_chat_in(jm->js->gc, chat->id, jid->resource,
+			serv_got_chat_in(purple_account_get_connection(jm->js), chat->id, jid->resource,
 							jm->delayed ? PURPLE_MESSAGE_DELAYED : 0,
 							jm->xhtml ? jm->xhtml : jm->body, jm->sent);
 		else if(chat->muc)
@@ -260,10 +260,10 @@ static void handle_groupchat_invite(Jabb
 	g_hash_table_replace(components, "room", g_strdup(jid->node));
 	g_hash_table_replace(components, "server", g_strdup(jid->domain));
 	g_hash_table_replace(components, "handle", g_strdup(jm->js->user->node));
-	g_hash_table_replace(components, "password", g_strdup(jm->password));
+	g_hash_table_replace(components, "password", g_strdup(purple_account_get_password(jm)));
 
 	jabber_id_free(jid);
-	serv_got_chat_invite(jm->js->gc, jm->to, jm->from, jm->body, components);
+	serv_got_chat_invite(purple_account_get_connection(jm->js), jm->to, jm->from, jm->body, components);
 }
 
 static void handle_error(JabberMessage *jm)
@@ -276,7 +276,7 @@ static void handle_error(JabberMessage *
 	buf = g_strdup_printf(_("Message delivery to %s failed: %s"),
 			jm->from, jm->error ? jm->error : "");
 
-	purple_notify_formatted(jm->js->gc, _("XMPP Message Error"), _("XMPP Message Error"), buf,
+	purple_notify_formatted(purple_account_get_connection(jm->js), _("XMPP Message Error"), _("XMPP Message Error"), buf,
 			jm->xhtml ? jm->xhtml : jm->body, NULL, NULL);
 
 	g_free(buf);
@@ -296,7 +296,7 @@ static void handle_buzz(JabberMessage *j
 	if(!jm->js->allowBuzz)
 		return;
 	
-	account = purple_connection_get_account(jm->js->gc);
+	account = purple_connection_get_account(purple_account_get_connection(jm->js));
 	
 	if ((buddy = purple_find_buddy(account, jm->from)) != NULL)
 		username = g_markup_escape_text(purple_buddy_get_alias(buddy), -1);
@@ -454,7 +454,7 @@ void jabber_message_parse(JabberStream *
 						jm->body = xmlnode_get_data(reason);
 					}
 					if((password = xmlnode_get_child(child, "password")))
-						jm->password = xmlnode_get_data(password);
+						purple_account_get_password(jm) = xmlnode_get_data(password);
 
 					jm->type = JABBER_MESSAGE_GROUPCHAT_INVITE;
 				}
============================================================
--- libpurple/protocols/jabber/oob.c	cb310fdba1498e02094662c003a340c42424a5bc
+++ libpurple/protocols/jabber/oob.c	815bbce82c941f98eb4121b36131f45b77f3b8b9
@@ -213,7 +213,7 @@ void jabber_oob_parse(JabberStream *js, 
 	jox->headers = g_string_new("");
 	jox->iq_id = g_strdup(xmlnode_get_attrib(packet, "id"));
 
-	xfer = purple_xfer_new(js->gc->account, PURPLE_XFER_RECEIVE,
+	xfer = purple_xfer_new(purple_account_get_connection(js)->account, PURPLE_XFER_RECEIVE,
 			xmlnode_get_attrib(packet, "from"));
 	if (xfer)
 	{
============================================================
--- libpurple/protocols/jabber/parser.c	6cecb079972daf216504b3dce358ca781c92c3d9
+++ libpurple/protocols/jabber/parser.c	524c4187294ed4449a76954cac3d63cb74a64209
@@ -193,7 +193,7 @@ void jabber_parser_process(JabberStream 
 		js->context = xmlCreatePushParserCtxt(&jabber_parser_libxml, js, buf, len, NULL);
 		xmlParseChunk(js->context, "", 0, 0);
 	} else if (xmlParseChunk(js->context, buf, len, 0) < 0) {
-		purple_connection_error_reason (js->gc,
+		purple_connection_error_reason (purple_account_get_connection(js),
 			PURPLE_CONNECTION_ERROR_NETWORK_ERROR,
 			_("XML Parse error"));
 	}
============================================================
--- libpurple/protocols/jabber/ping.c	4815c966a6e9665f6fef0da7c235ed20c310a90d
+++ libpurple/protocols/jabber/ping.c	0fb1c1127cb5963ad1791af80d8208e8be5e8443
@@ -65,7 +65,7 @@ gboolean jabber_ping_jid(PurpleConversat
 
 	purple_debug_info("jabber", "jabber_ping_jid\n");
 
-	iq = jabber_iq_new(conv->account->gc->proto_data, JABBER_IQ_GET);
+	iq = jabber_iq_new(purple_account_get_connection(conv->account)->proto_data, JABBER_IQ_GET);
 	xmlnode_set_attrib(iq->node, "to", jid);
 
 	ping = xmlnode_new_child(iq->node, "ping");
============================================================
--- libpurple/protocols/jabber/presence.c	f40a77661af6039110e5d8d8f5c9cf4d03469e88
+++ libpurple/protocols/jabber/presence.c	1487e246f6d84a92ebb68bbd5124f1f4aa45028a
@@ -67,7 +67,7 @@ void jabber_presence_fake_to_self(Jabber
 		return;
 
 	my_base_jid = g_strdup_printf("%s@%s", js->user->node, js->user->domain);
-	if(purple_find_buddy(js->gc->account, my_base_jid)) {
+	if(purple_find_buddy(purple_account_get_connection(js)->account, my_base_jid)) {
 		JabberBuddy *jb;
 		JabberBuddyResource *jbr;
 		if((jb = jabber_buddy_find(js, my_base_jid, TRUE))) {
@@ -83,9 +83,9 @@ void jabber_presence_fake_to_self(Jabber
 				jabber_buddy_track_resource(jb, js->user->resource, priority, state, msg);
 			}
 			if((jbr = jabber_buddy_find_resource(jb, NULL))) {
-				purple_prpl_got_user_status(js->gc->account, my_base_jid, jabber_buddy_state_get_status_id(jbr->state), "priority", jbr->priority, jbr->status ? "message" : NULL, jbr->status, NULL);
+				purple_prpl_got_user_status(purple_account_get_connection(js)->account, my_base_jid, jabber_buddy_state_get_status_id(jbr->state), "priority", jbr->priority, jbr->status ? "message" : NULL, jbr->status, NULL);
 			} else {
-				purple_prpl_got_user_status(js->gc->account, my_base_jid, "offline", msg ? "message" : NULL, msg, NULL);
+				purple_prpl_got_user_status(purple_account_get_connection(js)->account, my_base_jid, "offline", msg ? "message" : NULL, msg, NULL);
 			}
 
 			g_free(msg);
@@ -203,7 +203,7 @@ void jabber_presence_send(PurpleAccount 
 			length,
 			(char*)uri
 		};
-		jabber_tune_set(js->gc, &tuneinfo);
+		jabber_tune_set(purple_account_get_connection(js), &tuneinfo);
 		
 		/* update old values */
 		g_free(js->old_artist);
@@ -310,8 +310,8 @@ static void authorize_add_cb(gpointer da
 static void authorize_add_cb(gpointer data)
 {
 	struct _jabber_add_permit *jap = data;
-	if(PURPLE_CONNECTION_IS_VALID(jap->gc))
-		jabber_presence_subscription_set(jap->gc->proto_data,
+	if(PURPLE_CONNECTION_IS_VALID(purple_account_get_connection(jap)))
+		jabber_presence_subscription_set(purple_account_get_connection(jap)->proto_data,
 			jap->who, "subscribed");
 	g_free(jap->who);
 	g_free(jap);
@@ -320,8 +320,8 @@ static void deny_add_cb(gpointer data)
 static void deny_add_cb(gpointer data)
 {
 	struct _jabber_add_permit *jap = data;
-	if(PURPLE_CONNECTION_IS_VALID(jap->gc))
-		jabber_presence_subscription_set(jap->gc->proto_data,
+	if(PURPLE_CONNECTION_IS_VALID(purple_account_get_connection(jap)))
+		jabber_presence_subscription_set(purple_account_get_connection(jap)->proto_data,
 			jap->who, "unsubscribed");
 	g_free(jap->who);
 	g_free(jap);
@@ -365,7 +365,7 @@ static void jabber_vcard_parse_avatar(Ja
 			for(i=0; i<20; i++, p+=2)
 				snprintf(p, 3, "%02x", hashval[i]);
 
-			purple_buddy_icons_set_for_user(js->gc->account, from, data, size, hash);
+			purple_buddy_icons_set_for_user(purple_account_get_connection(js)->account, from, data, size, hash);
 			g_free(text);
 		}
 	}
@@ -446,7 +446,7 @@ void jabber_presence_parse(JabberStream 
 	} else if(type && !strcmp(type, "subscribe")) {
 		struct _jabber_add_permit *jap = g_new0(struct _jabber_add_permit, 1);
 		gboolean onlist = FALSE;
-		PurpleBuddy *buddy = purple_find_buddy(purple_connection_get_account(js->gc), from);
+		PurpleBuddy *buddy = purple_find_buddy(purple_connection_get_account(purple_account_get_connection(js)), from);
 		JabberBuddy *jb = NULL;
 
 		if (buddy) {
@@ -455,11 +455,11 @@ void jabber_presence_parse(JabberStream 
 				onlist = TRUE;
 		}
 
-		jap->gc = js->gc;
+		purple_account_get_connection(jap) = purple_account_get_connection(js);
 		jap->who = g_strdup(from);
 		jap->js = js;
 
-		purple_account_request_authorization(purple_connection_get_account(js->gc), from, NULL, NULL, NULL, onlist,
+		purple_account_request_authorization(purple_connection_get_account(purple_account_get_connection(js)), from, NULL, NULL, NULL, onlist,
 				authorize_add_cb, deny_add_cb, jap);
 		jabber_id_free(jid);
 		return;
@@ -522,14 +522,14 @@ void jabber_presence_parse(JabberStream 
 						if((chat = jabber_chat_find(js, jid->node, jid->domain))) {
 							chat->config_dialog_type = PURPLE_REQUEST_ACTION;
 							chat->config_dialog_handle =
-								purple_request_action(js->gc,
+								purple_request_action(purple_account_get_connection(js),
 										_("Create New Room"),
 										_("Create New Room"),
 										_("You are creating a new room.  Would"
 											" you like to configure it, or"
 											" accept the default settings?"),
 										/* Default Action */ 1,
-										purple_connection_get_account(js->gc), NULL, chat->conv,
+										purple_connection_get_account(purple_account_get_connection(js)), NULL, chat->conv,
 										chat, 2,
 										_("_Configure Room"), G_CALLBACK(jabber_chat_request_room_configure),
 										_("_Accept Defaults"), G_CALLBACK(jabber_chat_create_instant_room));
@@ -576,11 +576,11 @@ void jabber_presence_parse(JabberStream 
 			if(chat->conv) {
 				title = g_strdup_printf(_("Error in chat %s"), from);
 				if (g_hash_table_size(chat->members) == 0)
-					serv_got_chat_left(js->gc, chat->id);
+					serv_got_chat_left(purple_account_get_connection(js), chat->id);
 			} else {
 				title = g_strdup_printf(_("Error joining chat %s"), from);
 			}
-			purple_notify_error(js->gc, title, title, msg);
+			purple_notify_error(purple_account_get_connection(js), title, title, msg);
 			g_free(title);
 			g_free(msg);
 
@@ -651,7 +651,7 @@ void jabber_presence_parse(JabberStream 
 			}
 			if(!nick_change) {
 				if(!g_utf8_collate(jid->resource, chat->handle)) {
-					serv_got_chat_left(js->gc, chat->id);
+					serv_got_chat_left(purple_account_get_connection(js), chat->id);
 					jabber_chat_destroy(chat);
 				} else {
 					purple_conv_chat_remove_user(PURPLE_CONV_CHAT(chat->conv), jid->resource,
@@ -663,7 +663,7 @@ void jabber_presence_parse(JabberStream 
 			if(!chat->conv) {
 				chat->id = i++;
 				chat->muc = muc;
-				chat->conv = serv_got_joined_chat(js->gc, chat->id, room_jid);
+				chat->conv = serv_got_joined_chat(purple_account_get_connection(js), chat->id, room_jid);
 				purple_conv_chat_set_nick(PURPLE_CONV_CHAT(chat->conv), chat->handle);
 
 				jabber_chat_disco_traffic(chat);
@@ -685,10 +685,10 @@ void jabber_presence_parse(JabberStream 
 	} else {
 		buddy_name = g_strdup_printf("%s%s%s", jid->node ? jid->node : "",
 									 jid->node ? "@" : "", jid->domain);
-		if((b = purple_find_buddy(js->gc->account, buddy_name)) == NULL) {
+		if((b = purple_find_buddy(purple_account_get_connection(js)->account, buddy_name)) == NULL) {
 			if(!jid->node || strcmp(jid->node,js->user->node) || strcmp(jid->domain,js->user->domain)) {
 				purple_debug_warning("jabber", "Got presence for unknown buddy %s on account %s (%x)\n",
-									 buddy_name, purple_account_get_username(js->gc->account), js->gc->account);
+									 buddy_name, purple_account_get_username(purple_account_get_connection(js)->account), purple_account_get_connection(js)->account);
 				jabber_id_free(jid);
 				g_free(avatar_hash);
 				g_free(buddy_name);
@@ -731,7 +731,7 @@ void jabber_presence_parse(JabberStream 
 			PurpleConversation *conv;
 
 			jabber_buddy_remove_resource(jb, jid->resource);
-			if((conv = jabber_find_unnormalized_conv(from, js->gc->account)))
+			if((conv = jabber_find_unnormalized_conv(from, purple_account_get_connection(js)->account)))
 				purple_conversation_set_name(conv, buddy_name);
 
 		} else {
@@ -754,9 +754,9 @@ void jabber_presence_parse(JabberStream 
 
 		if((found_jbr = jabber_buddy_find_resource(jb, NULL))) {
 			jabber_google_presence_incoming(js, buddy_name, found_jbr);
-			purple_prpl_got_user_status(js->gc->account, buddy_name, jabber_buddy_state_get_status_id(found_jbr->state), "priority", found_jbr->priority, "message", found_jbr->status, NULL);
+			purple_prpl_got_user_status(purple_account_get_connection(js)->account, buddy_name, jabber_buddy_state_get_status_id(found_jbr->state), "priority", found_jbr->priority, "message", found_jbr->status, NULL);
 		} else {
-			purple_prpl_got_user_status(js->gc->account, buddy_name, "offline", status ? "message" : NULL, status, NULL);
+			purple_prpl_got_user_status(purple_account_get_connection(js)->account, buddy_name, "offline", status ? "message" : NULL, status, NULL);
 		}
 		g_free(buddy_name);
 	}
============================================================
--- libpurple/protocols/jabber/roster.c	f9eb1e8c18fbec6fbbae94a91fb88d6b7f647216
+++ libpurple/protocols/jabber/roster.c	0f8a4f252fd169f7ddcf6708db37bb3d7165e709
@@ -45,7 +45,7 @@ static void remove_purple_buddies(Jabber
 {
 	GSList *buddies, *l;
 
-	buddies = purple_find_buddies(js->gc->account, jid);
+	buddies = purple_find_buddies(purple_account_get_connection(js)->account, jid);
 
 	for(l = buddies; l; l = l->next)
 		purple_blist_remove_buddy(l->data);
@@ -60,7 +60,7 @@ static void add_purple_buddies_to_groups
 	gchar *my_bare_jid;
 	GList *pool = NULL;
 
-	buddies = purple_find_buddies(js->gc->account, jid);
+	buddies = purple_find_buddies(purple_account_get_connection(js)->account, jid);
 
 	g2 = groups;
 
@@ -85,7 +85,7 @@ static void add_purple_buddies_to_groups
 			const char *servernick;
 
 			if((servernick = purple_blist_node_get_string((PurpleBlistNode*)b, "servernick")))
-				serv_got_alias(js->gc, jid, servernick);
+				serv_got_alias(purple_account_get_connection(js), jid, servernick);
 
 			if(alias && (!b->alias || strcmp(b->alias, alias)))
 				purple_blist_alias_buddy(b, alias);
@@ -104,7 +104,7 @@ static void add_purple_buddies_to_groups
 			b = pool->data;
 			pool = g_list_delete_link(pool, pool);
 		} else {			
-			b = purple_buddy_new(js->gc->account, jid, alias);
+			b = purple_buddy_new(purple_account_get_connection(js)->account, jid, alias);
 		}
 
 		if(!g) {
@@ -122,7 +122,7 @@ static void add_purple_buddies_to_groups
 			PurplePresence *gpresence;
 			PurpleStatus *status;
 
-			gpresence = purple_account_get_presence(js->gc->account);
+			gpresence = purple_account_get_presence(purple_account_get_connection(js)->account);
 			status = purple_presence_get_active_status(gpresence);
 			jabber_presence_fake_to_self(js, status);
 		}
@@ -150,14 +150,14 @@ void jabber_roster_parse(JabberStream *j
 		char *from_norm;
 		gboolean invalid;
 
-		from_norm = g_strdup(jabber_normalize(js->gc->account, from));
+		from_norm = g_strdup(jabber_normalize(purple_account_get_connection(js)->account, from));
 
 		if(!from_norm)
 			return;
 
 		invalid = g_utf8_collate(from_norm,
-				jabber_normalize(js->gc->account,
-					purple_account_get_username(js->gc->account)));
+				jabber_normalize(purple_account_get_connection(js)->account,
+					purple_account_get_username(purple_account_get_connection(js)->account)));
 
 		g_free(from_norm);
 
@@ -190,10 +190,10 @@ void jabber_roster_parse(JabberStream *j
 			char *jid_norm;
 			const char *username;
 
-			jid_norm = g_strdup(jabber_normalize(js->gc->account, jid));
-			username = purple_account_get_username(js->gc->account);
+			jid_norm = g_strdup(jabber_normalize(purple_account_get_connection(js)->account, jid));
+			username = purple_account_get_username(purple_account_get_connection(js)->account);
 			me = g_utf8_collate(jid_norm,
-			                    jabber_normalize(js->gc->account,
+			                    jabber_normalize(purple_account_get_connection(js)->account,
 			                                     username));
 			g_free(jid_norm);
 
@@ -217,7 +217,7 @@ void jabber_roster_parse(JabberStream *j
 			/*
 			if ((jb->subscription & JABBER_SUB_FROM) ||
 					(jb->subscription & JABBER_SUB_NONE)) {
-				purple_prpl_got_user_status(js->gc->account, jid, "offline", NULL);
+				purple_prpl_got_user_status(purple_account_get_connection(js)->account, jid, "offline", NULL);
 			}
 			*/
 		}
@@ -256,7 +256,7 @@ void jabber_roster_parse(JabberStream *j
 	if(!js->roster_parsed) {
 		js->roster_parsed = TRUE;
 
-		jabber_presence_send(js->gc->account, NULL);
+		jabber_presence_send(purple_account_get_connection(js)->account, NULL);
 	}
 }
 
@@ -269,13 +269,13 @@ static void jabber_roster_update(JabberS
 	JabberIq *iq;
 	xmlnode *query, *item, *group;
 
-	if(!(b = purple_find_buddy(js->gc->account, name)))
+	if(!(b = purple_find_buddy(purple_account_get_connection(js)->account, name)))
 		return;
 
 	if(grps) {
 		groups = grps;
 	} else {
-		GSList *buddies = purple_find_buddies(js->gc->account, name);
+		GSList *buddies = purple_find_buddies(purple_account_get_connection(js)->account, name);
 		if(!buddies)
 			return;
 		while(buddies) {
@@ -340,13 +340,13 @@ void jabber_roster_add_buddy(PurpleConne
 		PurplePresence *gpresence;
 		PurpleStatus *status;
 
-		gpresence = purple_account_get_presence(js->gc->account);
+		gpresence = purple_account_get_presence(purple_account_get_connection(js)->account);
 		status = purple_presence_get_active_status(gpresence);
 		jabber_presence_fake_to_self(js, status);
 	} else if(!jb || !(jb->subscription & JABBER_SUB_TO)) {
 		jabber_presence_subscription_set(js, who, "subscribe");
 	} else if((jbr =jabber_buddy_find_resource(jb, NULL))) {
-		purple_prpl_got_user_status(gc->account, who,
+		purple_prpl_got_user_status(purple_connection_get_account(gc), who,
 				jabber_buddy_state_get_status_id(jbr->state),
 				"priority", jbr->priority, jbr->status ? "message" : NULL, jbr->status, NULL);
 	}
@@ -357,7 +357,7 @@ void jabber_roster_alias_change(PurpleCo
 
 void jabber_roster_alias_change(PurpleConnection *gc, const char *name, const char *alias)
 {
-	PurpleBuddy *b = purple_find_buddy(gc->account, name);
+	PurpleBuddy *b = purple_find_buddy(purple_connection_get_account(gc), name);
 
 	if(b != NULL) {
 		purple_blist_alias_buddy(b, alias);
@@ -376,7 +376,7 @@ void jabber_roster_group_change(PurpleCo
 	if(!old_group || !new_group || !strcmp(old_group, new_group))
 		return;
 
-	buddies = purple_find_buddies(gc->account, name);
+	buddies = purple_find_buddies(purple_connection_get_account(gc), name);
 	while(buddies) {
 		b = buddies->data;
 		g = purple_buddy_get_group(b);
@@ -402,7 +402,7 @@ void jabber_roster_remove_buddy(PurpleCo
 
 void jabber_roster_remove_buddy(PurpleConnection *gc, PurpleBuddy *buddy,
 		PurpleGroup *group) {
-	GSList *buddies = purple_find_buddies(gc->account, buddy->name);
+	GSList *buddies = purple_find_buddies(purple_connection_get_account(gc), buddy->name);
 
 	buddies = g_slist_remove(buddies, buddy);
 	if(buddies != NULL) {
============================================================
--- libpurple/protocols/jabber/si.c	3f14aaa44a6d25661d49d5254e23d451da128673
+++ libpurple/protocols/jabber/si.c	5db4e23fbc5814a8d4829b2db56daec04a2ca247
@@ -1016,7 +1016,7 @@ static void jabber_si_xfer_send_disco_cb
 		jabber_si_xfer_send_request(xfer);
 	} else {
 		char *msg = g_strdup_printf(_("Unable to send file to %s, user does not support file transfers"), who);
-		purple_notify_error(js->gc, _("File Send Failed"),
+		purple_notify_error(purple_account_get_connection(js), _("File Send Failed"),
 				_("File Send Failed"), msg);
 		g_free(msg);
 	}
@@ -1086,7 +1086,7 @@ static void jabber_si_xfer_init(PurpleXf
 				msg = g_strdup_printf(_("Unable to send file to %s, not subscribed to user presence"), xfer->who);
 			}
 
-			purple_notify_error(jsx->js->gc, _("File Send Failed"), _("File Send Failed"), msg);
+			purple_notify_error(purple_account_get_connection(jsx->js), _("File Send Failed"), _("File Send Failed"), msg);
 			g_free(msg);
 		} else if(g_list_length(jb->resources) == 1) {
 			/* only 1 resource online (probably our most common case)
@@ -1114,9 +1114,9 @@ static void jabber_si_xfer_init(PurpleXf
 
 			purple_request_fields_add_group(fields, group);
 
-			purple_request_fields(jsx->js->gc, _("Select a Resource"), msg, NULL, fields,
+			purple_request_fields(purple_account_get_connection(jsx->js), _("Select a Resource"), msg, NULL, fields,
 					_("Send File"), G_CALLBACK(resource_select_ok_cb), _("Cancel"), G_CALLBACK(resource_select_cancel_cb),
-					jsx->js->gc->account, xfer->who, NULL, xfer);
+					purple_account_get_connection(jsx->js)->account, xfer->who, NULL, xfer);
 
 			g_free(msg);
 		}
@@ -1164,7 +1164,7 @@ PurpleXfer *jabber_si_new_xfer(PurpleCon
 
 	js = gc->proto_data;
 
-	xfer = purple_xfer_new(gc->account, PURPLE_XFER_SEND, who);
+	xfer = purple_xfer_new(purple_connection_get_account(gc), PURPLE_XFER_SEND, who);
 	if (xfer)
 	{
 		xfer->data = jsx = g_new0(JabberSIXfer, 1);
@@ -1188,7 +1188,7 @@ void jabber_si_xfer_send(PurpleConnectio
 
 	js = gc->proto_data;
 
-	if(!purple_find_buddy(gc->account, who) || !jabber_buddy_find(js, who, FALSE))
+	if(!purple_find_buddy(purple_connection_get_account(gc), who) || !jabber_buddy_find(js, who, FALSE))
 		return;
 
 	xfer = jabber_si_new_xfer(gc, who);
@@ -1274,7 +1274,7 @@ void jabber_si_parse(JabberStream *js, x
 	jsx->stream_id = g_strdup(stream_id);
 	jsx->iq_id = g_strdup(xmlnode_get_attrib(packet, "id"));
 
-	xfer = purple_xfer_new(js->gc->account, PURPLE_XFER_RECEIVE, from);
+	xfer = purple_xfer_new(purple_account_get_connection(js)->account, PURPLE_XFER_RECEIVE, from);
 	if (xfer)
 	{
 		xfer->data = jsx;
============================================================
--- libpurple/protocols/jabber/usermood.c	edfc1e040b5419291c7ad4d30df3a47f046b2cd0
+++ libpurple/protocols/jabber/usermood.c	eb75680ef276422ace50eecfa46107b17c55e5a3
@@ -135,7 +135,7 @@ static void jabber_mood_cb(JabberStream 
 		}
 		status_id = jabber_buddy_state_get_status_id(resource->state);
 
-		purple_prpl_got_user_status(js->gc->account, from, status_id, "mood", _(newmood), "moodtext", moodtext?moodtext:"", NULL);
+		purple_prpl_got_user_status(purple_account_get_connection(js)->account, from, status_id, "mood", _(newmood), "moodtext", moodtext?moodtext:"", NULL);
 	}
 	g_free(moodtext);
 }
============================================================
--- libpurple/protocols/jabber/usernick.c	e0e09357277521664d7f14ecf84033d6e84aa564
+++ libpurple/protocols/jabber/usernick.c	fd46fa2bc6907ddb5bb6dd0bd9ca2ce91a987dc1
@@ -43,7 +43,7 @@ static void jabber_nick_cb(JabberStream 
 	if (!nick)
 		return;
 	nickname = xmlnode_get_data(nick);
-	serv_got_alias(js->gc, from, nickname);
+	serv_got_alias(purple_account_get_connection(js), from, nickname);
 	g_free(nickname);
 }
 
@@ -73,10 +73,10 @@ static void do_nick_got_own_nick_cb(Jabb
 			oldnickname = xmlnode_get_data(nick);
 	}
 	
-	purple_request_input(js->gc, _("Set User Nickname"), _("Please specify a new nickname for you."),
+	purple_request_input(purple_account_get_connection(js), _("Set User Nickname"), _("Please specify a new nickname for you."),
 		_("This information is visible to all contacts on your contact list, so choose something appropriate."),
 		oldnickname, FALSE, FALSE, NULL, _("Set"), PURPLE_CALLBACK(do_nick_set), _("Cancel"), NULL,
-		purple_connection_get_account(js->gc), NULL, NULL, js);
+		purple_connection_get_account(purple_account_get_connection(js)), NULL, NULL, js);
 	g_free(oldnickname);
 }
 
============================================================
--- libpurple/protocols/jabber/usertune.c	93238d3049ccd7895d225f13dfb808b8d6c0f2f6
+++ libpurple/protocols/jabber/usertune.c	23c344f688b0f853fc959fc13408b296ed48138d
@@ -90,7 +90,7 @@ static void jabber_tune_cb(JabberStream 
 	}
 
 	if (valid) {
-		purple_prpl_got_user_status(js->gc->account, from, "tune",
+		purple_prpl_got_user_status(purple_account_get_connection(js)->account, from, "tune",
 				PURPLE_TUNE_ARTIST, tuneinfodata.artist,
 				PURPLE_TUNE_TITLE, tuneinfodata.title,
 				PURPLE_TUNE_ALBUM, tuneinfodata.album,
@@ -98,7 +98,7 @@ static void jabber_tune_cb(JabberStream 
 				PURPLE_TUNE_TIME, tuneinfodata.time,
 				PURPLE_TUNE_URL, tuneinfodata.url, NULL);
 	} else {
-		purple_prpl_got_user_status_deactive(js->gc->account, from, "tune");
+		purple_prpl_got_user_status_deactive(purple_account_get_connection(js)->account, from, "tune");
 	}
 
 	g_free(tuneinfodata.artist);
============================================================
--- libpurple/protocols/jabber/xdata.c	a5bb60f9c19aeee1e75bf8c583b70f7956483f14
+++ libpurple/protocols/jabber/xdata.c	ba80c09e3e8b9118b8a51805a23347a6e0d3469a
@@ -395,10 +395,10 @@ void *jabber_x_data_request_with_actions
 	if((x = xmlnode_get_child(packet, "instructions")))
 		instructions = xmlnode_get_data(x);
 
-	handle = purple_request_fields(js->gc, title, title, instructions, fields,
+	handle = purple_request_fields(purple_account_get_connection(js), title, title, instructions, fields,
 			_("OK"), G_CALLBACK(jabber_x_data_ok_cb),
 			_("Cancel"), G_CALLBACK(jabber_x_data_cancel_cb),
-			purple_connection_get_account(js->gc), /* XXX Do we have a who here? */ NULL, NULL,
+			purple_connection_get_account(purple_account_get_connection(js)), /* XXX Do we have a who here? */ NULL, NULL,
 			data);
 
 	g_free(title);
============================================================
--- libpurple/protocols/msn/contact.c	2e49ff88c5f1633912487a21cbf0df32a341d617
+++ libpurple/protocols/msn/contact.c	37855d18bab9291c62aae6f2d8cad2aaf71c4451
@@ -496,7 +496,7 @@ msn_parse_addressbook_contacts(MsnContac
 			char *friendly = NULL;
 			if ((displayName = xmlnode_get_child(contactInfo, "displayName")))
 				friendly = xmlnode_get_data(displayName);
-			purple_connection_set_display_name(session->account->gc, friendly ? purple_url_decode(friendly) : NULL);
+			purple_connection_set_display_name(purple_account_get_connection(session->account), friendly ? purple_url_decode(friendly) : NULL);
 			g_free(friendly);
 			continue; /* Not adding own account as buddy to buddylist */
 		}
@@ -697,7 +697,7 @@ msn_get_address_cb(MsnSoapMessage *req, 
 
 	if (msn_parse_addressbook(contact, resp->xml)) {
 		if (!session->logged_in) {
-			msn_send_privacy(session->account->gc);
+			msn_send_privacy(purple_account_get_connection(session->account));
 			msn_notification_dump_contact(session);
 		}
 	} else {
@@ -709,7 +709,7 @@ msn_get_address_cb(MsnSoapMessage *req, 
 		msn_get_address_book(contact, NULL, NULL);
 		*/
 		msn_session_disconnect(session);
-		purple_connection_error_reason(session->account->gc, PURPLE_CONNECTION_ERROR_NETWORK_ERROR, _("Unable to retrieve MSN Address Book"));
+		purple_connection_error_reason(purple_account_get_connection(session->account), PURPLE_CONNECTION_ERROR_NETWORK_ERROR, _("Unable to retrieve MSN Address Book"));
 	}
 }
 
============================================================
--- libpurple/protocols/msn/dialog.c	85136580a20d10914756e9156e086d7b1087eaf4
+++ libpurple/protocols/msn/dialog.c	319b97eb42339cf9218932c36f850a64fd33c18c
@@ -47,9 +47,9 @@ msn_complete_sync_issue(MsnAddRemData *d
 		group = purple_find_group(data->group);
 
 	if (group != NULL)
-		buddy = purple_find_buddy_in_group(purple_connection_get_account(data->gc), data->who, group);
+		buddy = purple_find_buddy_in_group(purple_connection_get_account(purple_account_get_connection(data)), data->who, group);
 	else
-		buddy = purple_find_buddy(purple_connection_get_account(data->gc), data->who);
+		buddy = purple_find_buddy(purple_connection_get_account(purple_account_get_connection(data)), data->who);
 
 	if (buddy != NULL)
 		purple_blist_remove_buddy(buddy);
@@ -64,9 +64,9 @@ msn_add_cb(MsnAddRemData *data)
 	msn_complete_sync_issue(data);
 #endif
 
-	if (g_list_find(purple_connections_get_all(), data->gc) != NULL)
+	if (g_list_find(purple_connections_get_all(), purple_account_get_connection(data)) != NULL)
 	{
-		MsnSession *session = data->gc->proto_data;
+		MsnSession *session = purple_account_get_connection(data)->proto_data;
 		MsnUserList *userlist = session->userlist;
 
 		msn_userlist_add_buddy(userlist, data->who, data->group);
@@ -82,9 +82,9 @@ msn_rem_cb(MsnAddRemData *data)
 {
 	msn_complete_sync_issue(data);
 
-	if (g_list_find(purple_connections_get_all(), data->gc) != NULL)
+	if (g_list_find(purple_connections_get_all(), purple_account_get_connection(data)) != NULL)
 	{
-		MsnSession *session = data->gc->proto_data;
+		MsnSession *session = purple_account_get_connection(data)->proto_data;
 		MsnUserList *userlist = session->userlist;
 
 		if (data->group == NULL) {
@@ -113,7 +113,7 @@ msn_show_sync_issue(MsnSession *session,
 	data        = g_new0(MsnAddRemData, 1);
 	data->who   = g_strdup(passport);
 	data->group = group_name != NULL ? g_strdup(group_name) : NULL;
-	data->gc    = gc;
+	purple_account_get_connection(data)    = gc;
 
 	msg = g_strdup_printf(_("Buddy list synchronization issue in %s (%s)"),
 						  purple_account_get_username(account),
============================================================
--- libpurple/protocols/msn/error.c	8aea775766e6ab7bb9f6f45a75da2af996b13712
+++ libpurple/protocols/msn/error.c	f77030f9615a77eb923a3bca8ee665c8d0ee802c
@@ -265,5 +265,5 @@ msn_error_handle(MsnSession *session, un
 	if (debug)
 		purple_debug_warning("msn", "error %d: %s\n", type, buf);
 	else
-		purple_notify_error(session->account->gc, NULL, buf, NULL);
+		purple_notify_error(purple_account_get_connection(session->account), NULL, buf, NULL);
 }
============================================================
--- libpurple/protocols/msn/msn.c	71e1d8ffc4ae2d0cfd3016632bb534b8ef18ecd9
+++ libpurple/protocols/msn/msn.c	4a35b5803c1a1a2c9bc9e89d023ec56d90b8cfa7
@@ -260,7 +260,7 @@ send_to_mobile_cb(MsnMobileData *data, c
 static void
 send_to_mobile_cb(MsnMobileData *data, const char *entry)
 {
-	send_to_mobile(data->gc, data->passport, entry);
+	send_to_mobile(purple_account_get_connection(data), data->passport, entry);
 	g_free(data);
 }
 
@@ -394,7 +394,7 @@ show_send_to_mobile_cb(PurpleBlistNode *
 	session = gc->proto_data;
 
 	data = g_new0(MsnMobileData, 1);
-	data->gc = gc;
+	purple_account_get_connection(data) = gc;
 	data->passport = buddy->name;
 
 	purple_request_input(gc, NULL, _("Send a mobile message."), NULL,
@@ -481,7 +481,7 @@ msn_new_xfer(PurpleConnection *gc, const
 
 	session = gc->proto_data;
 
-	xfer = purple_xfer_new(gc->account, PURPLE_XFER_SEND, who);
+	xfer = purple_xfer_new(purple_connection_get_account(gc), PURPLE_XFER_SEND, who);
 
 	if (xfer)
 	{
@@ -870,7 +870,7 @@ msn_login(PurpleAccount *account)
 	session = msn_session_new(account);
 
 	gc->proto_data = session;
-	gc->flags |= PURPLE_CONNECTION_HTML | PURPLE_CONNECTION_FORMATTING_WBFO | PURPLE_CONNECTION_NO_BGCOLOR | PURPLE_CONNECTION_NO_FONTSIZE | PURPLE_CONNECTION_NO_URLDESC;
+	gc->flags |= PURPLE_CONNECTION_FLAGS_HTML | PURPLE_CONNECTION_FLAGS_FORMATTING_WBFO | PURPLE_CONNECTION_FLAGS_NO_BGCOLOR | PURPLE_CONNECTION_FLAGS_NO_FONTSIZE | PURPLE_CONNECTION_FLAGS_NO_URLDESC;
 
 	msn_session_set_login_step(session, MSN_LOGIN_STEP_START);
 
@@ -905,7 +905,7 @@ msn_send_me_im(gpointer data)
 msn_send_me_im(gpointer data)
 {
 	MsnIMData *imdata = data;
-	serv_got_im(imdata->gc, imdata->who, imdata->msg, imdata->flags, imdata->when);
+	serv_got_im(purple_account_get_connection(imdata), imdata->who, imdata->msg, imdata->flags, imdata->when);
 	g_free(imdata->msg);
 	g_free(imdata);
 	return FALSE;
@@ -916,7 +916,7 @@ msn_send_im(PurpleConnection *gc, const 
 			PurpleMessageFlags flags)
 {
 	PurpleAccount *account;
-	PurpleBuddy *buddy = purple_find_buddy(gc->account, who);
+	PurpleBuddy *buddy = purple_find_buddy(purple_connection_get_account(gc), who);
 	MsnMessage *msg;
 	char *msgformat;
 	char *msgtext;
@@ -993,7 +993,7 @@ msn_send_im(PurpleConnection *gc, const 
 			g_free(post);
 
 			serv_got_typing_stopped(gc, who);
-			imdata->gc = gc;
+			purple_account_get_connection(imdata) = gc;
 			imdata->who = who;
 			imdata->msg = body_str;
 			imdata->flags = flags;
@@ -1010,7 +1010,7 @@ msn_send_im(PurpleConnection *gc, const 
 		purple_debug_info("MSNP14","prepare to send offline Message\n");
 		session = gc->proto_data;
 
-		friendname = msn_encode_mime(account->username);
+		friendname = msn_encode_mime(purple_account_get_username(account));
 		msn_oim_prep_send_msg_info(session->oim,
 			purple_account_get_username(account),
 			friendname, who,	message);
@@ -1153,7 +1153,7 @@ msn_add_buddy(PurpleConnection *gc, Purp
 
 	session = gc->proto_data;
 	userlist = session->userlist;
-	who = msn_normalize(gc->account, buddy->name);
+	who = msn_normalize(purple_connection_get_account(gc), buddy->name);
 
 	purple_debug_info("MSN","Add user:%s to group:%s\n", who, (group && group->name) ? group->name : "(null)");
 	if (!session->logged_in)
@@ -1546,7 +1546,7 @@ msn_tooltip_extract_info_text(PurpleNoti
 {
 	PurpleBuddy *b;
 
-	b = purple_find_buddy(purple_connection_get_account(info_data->gc),
+	b = purple_find_buddy(purple_connection_get_account(info_purple_account_get_connection(data)),
 						info_data->name);
 
 	if (b)
@@ -1560,9 +1560,9 @@ msn_tooltip_extract_info_text(PurpleNoti
 			g_free(aliastext);
 		}
 
-		if (b->server_alias)
+		if (purple_buddy_get_server_alias(b))
 		{
-			char *nicktext = g_markup_escape_text(b->server_alias, -1);
+			char *nicktext = g_markup_escape_text(purple_buddy_get_server_alias(b), -1);
 			tmp = g_strdup_printf("<font sml=\"msn\">%s</font><br>", nicktext);
 			purple_notify_user_info_add_pair(user_info, _("Nickname"), tmp);
 			g_free(tmp);
@@ -1655,7 +1655,7 @@ msn_got_info(PurpleUtilFetchUrlData *url
 	purple_debug_info("msn", "In msn_got_info,url_text:{%s}\n",url_text);
 
 	/* Make sure the connection is still valid */
-	if (g_list_find(purple_connections_get_all(), info_data->gc) == NULL)
+	if (g_list_find(purple_connections_get_all(), info_purple_account_get_connection(data)) == NULL)
 	{
 		purple_debug_warning("msn", "invalid connection. ignoring buddy info.\n");
 		g_free(info_data->name);
@@ -1672,7 +1672,7 @@ msn_got_info(PurpleUtilFetchUrlData *url
 		purple_notify_user_info_add_pair(user_info, NULL, tmp);
 		g_free(tmp);
 
-		purple_notify_userinfo(info_data->gc, info_data->name, user_info, NULL, NULL);
+		purple_notify_userinfo(info_purple_account_get_connection(data), info_data->name, user_info, NULL, NULL);
 		purple_notify_user_info_destroy(user_info);
 
 		g_free(info_data->name);
@@ -2010,7 +2010,7 @@ msn_got_info(PurpleUtilFetchUrlData *url
 		 * Let's see how long this one holds out for ... */
 		char *p = strstr(url_buffer, "<form id=\"profile_form\" name=\"profile_form\" action=\"http&#58;&#47;&#47;spaces.live.com&#47;profile.aspx&#63;cid&#61;0\"");
 		PurpleBuddy *b = purple_find_buddy
-				(purple_connection_get_account(info_data->gc), info_data->name);
+				(purple_connection_get_account(info_purple_account_get_connection(data)), info_data->name);
 		purple_notify_user_info_add_pair(user_info, _("Error retrieving profile"),
 									   ((p && b) ? _("The user has not created a public profile.") :
 										(p ? _("MSN reported not being able to find the user's profile. "
@@ -2071,7 +2071,7 @@ msn_got_photo(PurpleUtilFetchUrlData *ur
 
 	/* Make sure the connection is still valid if we got here by fetching a photo url */
 	if (url_text && (error_message != NULL ||
-					 g_list_find(purple_connections_get_all(), info_data->gc) == NULL))
+					 g_list_find(purple_connections_get_all(), info_purple_account_get_connection(data)) == NULL))
 	{
 		purple_debug_warning("msn", "invalid connection. ignoring buddy photo info.\n");
 		g_free(stripped);
@@ -2108,7 +2108,7 @@ msn_got_photo(PurpleUtilFetchUrlData *ur
 
 	/* We continue here from msn_got_info, as if nothing has happened */
 #endif
-	purple_notify_userinfo(info_data->gc, info_data->name, user_info, NULL, NULL);
+	purple_notify_userinfo(info_purple_account_get_connection(data), info_data->name, user_info, NULL, NULL);
 
 	g_free(stripped);
 	g_free(url_buffer);
@@ -2130,7 +2130,7 @@ msn_get_info(PurpleConnection *gc, const
 	char *url;
 
 	data       = g_new0(MsnGetInfoData, 1);
-	data->gc   = gc;
+	purple_account_get_connection(data)   = gc;
 	data->name = g_strdup(name);
 
 	url = g_strdup_printf("%s%s", PROFILE_URL, name);
============================================================
--- libpurple/protocols/msn/nexus.c	2a84e972ed3df60af3b4a0f0106b750c1f1ee56f
+++ libpurple/protocols/msn/nexus.c	dba2db9023829bea2e83a8e49a67ce04a3ab26ac
@@ -148,7 +148,7 @@ msn_nexus_connect(MsnNexus *nexus)
 
 	/*prepare the Windows Live ID authentication token*/
 	username = g_strdup(purple_account_get_username(session->account));
-	password = g_strndup(purple_connection_get_password(session->account->gc), 16);
+	password = g_strndup(purple_connection_get_password(purple_account_get_connection(session->account)), 16);
 
 	lc =	(char *)g_hash_table_lookup(nexus->challenge_data, "lc");
 	id =	(char *)g_hash_table_lookup(nexus->challenge_data, "id");
============================================================
--- libpurple/protocols/msn/notification.c	41578c064ac4515a6a7df0a851b6074b3eebd217
+++ libpurple/protocols/msn/notification.c	99cb3d5c8ad95a0140a878cb2340e2aab7d33233
@@ -457,7 +457,7 @@ ubm_cmd_post(MsnCmdProc *cmdproc, MsnCom
 	msn_message_show_readable(msg, "Notification", TRUE);
 #endif
 
-	gc = cmdproc->session->account->gc;
+	gc = purple_account_get_connection(cmdproc->session->account);
 	passport = msg->remote_user;
 
 	content_type = msn_message_get_content_type(msg);
@@ -704,11 +704,11 @@ msn_notification_dump_contact(MsnSession
 		xmlnode_free(adl_node);
 	}
 
-	display_name = purple_connection_get_display_name(session->account->gc);
+	display_name = purple_connection_get_display_name(purple_account_get_connection(session->account));
 	if (display_name 
 	    && strcmp(display_name, 
 		      purple_account_get_username(session->account))) {
-		msn_act_id(session->account->gc, display_name);
+		msn_act_id(purple_account_get_connection(session->account), display_name);
 	}
 
 }
@@ -786,7 +786,7 @@ adl_cmd_parse(MsnCmdProc *cmdproc, MsnCo
 
 			if (list_op & MSN_LIST_RL_OP) {
 				/* someone is adding us */
-//				got_new_entry(cmdproc->session->account->gc, passport, decoded_friendly_name);
+//				got_new_entry(purple_account_get_connection(cmdproc->session->account), passport, decoded_friendly_name);
 				msn_get_contact_list(cmdproc->session->contact, MSN_PS_PENDING_LIST, NULL);
 			}
 
@@ -1201,7 +1201,7 @@ rea_cmd(MsnCmdProc *cmdproc, MsnCommand 
 
 	g_free(username);
 
-	gc = account->gc;
+	gc = purple_account_get_connection(account);
 	friendly = purple_url_decode(cmd->params[3]);
 
 	purple_connection_set_display_name(gc, friendly);
@@ -1394,7 +1394,7 @@ url_cmd(MsnCmdProc *cmdproc, MsnCommand 
 	buf = g_strdup_printf("%s%lu%s",
 			   session->passport_info.mspauth ? session->passport_info.mspauth : "BOGUS",
 			   time(NULL) - session->passport_info.sl,
-			   purple_connection_get_password(account->gc));
+			   purple_connection_get_password(purple_account_get_connection(account)));
 
 	cipher = purple_md5_cipher_new();
 	purple_cipher_append(cipher, (const guchar *)buf, strlen(buf));
@@ -1739,7 +1739,7 @@ initial_email_msg(MsnCmdProc *cmdproc, M
 	const char *unread;
 
 	session = cmdproc->session;
-	gc = session->account->gc;
+	gc = purple_account_get_connection(session->account);
 
 	if (strcmp(msg->remote_user, "Hotmail"))
 		/* This isn't an official message. */
@@ -1793,7 +1793,7 @@ initial_mdata_msg(MsnCmdProc *cmdproc, M
 	const char *mdata, *unread;
 
 	session = cmdproc->session;
-	gc = session->account->gc;
+	gc = purple_account_get_connection(session->account);
 
 	if (strcmp(msg->remote_user, "Hotmail"))
 		/* This isn't an official message. */
@@ -1872,7 +1872,7 @@ email_msg(MsnCmdProc *cmdproc, MsnMessag
 	char *from, *subject, *tmp;
 
 	session = cmdproc->session;
-	gc = session->account->gc;
+	gc = purple_account_get_connection(session->account);
 
 	if (strcmp(msg->remote_user, "Hotmail"))
 		/* This isn't an official message. */
@@ -1957,7 +1957,7 @@ system_msg(MsnCmdProc *cmdproc, MsnMessa
 		}
 
 		if (*buf != '\0')
-			purple_notify_info(cmdproc->session->account->gc, NULL, buf, NULL);
+			purple_notify_info(purple_account_get_connection(cmdproc->session->account), NULL, buf, NULL);
 	}
 
 	g_hash_table_destroy(table);
============================================================
--- libpurple/protocols/msn/oim.c	4ff5b0d2e4a50e78154b347eb6f8f72b3db795b1
+++ libpurple/protocols/msn/oim.c	7ff60e90c73e5bfd9fac485b1242d98af4dd1b0c
@@ -423,7 +423,7 @@ msn_oim_report_to_user(MsnOimRecvData *r
 
 	stamp = msn_oim_parse_timestamp(date);
 
-	serv_got_im(rdata->oim->session->account->gc, passport, decode_msg, 0,
+	serv_got_im(purple_account_get_connection(rdata->oim->session->account), passport, decode_msg, 0,
 		stamp);
 
 	/*Now get the oim message ID from the oim_list.
@@ -492,7 +492,7 @@ msn_parse_oim_msg(MsnOim *oim,const char
 
 		/* XXX/khc: pretty sure this is wrong */
 		if (count > 0)
-			purple_notify_emails(session->account->gc, count, FALSE, NULL,
+			purple_notify_emails(purple_account_get_connection(session->account), count, FALSE, NULL,
 				NULL, &passport, &url, NULL, NULL);
 		g_free(unread);
 	}
============================================================
--- libpurple/protocols/msn/servconn.c	1f28b0ee395cb9f54d4dba2507d03d7b4846a49f
+++ libpurple/protocols/msn/servconn.c	c1e42db95c5a658f574057b223ea84fa7fefe46e
@@ -391,7 +391,7 @@ read_cb(gpointer data, gint source, Purp
 	session = servconn->session;
 
 	len = read(servconn->fd, buf, sizeof(buf) - 1);
-	servconn->session->account->gc->last_received = time(NULL);
+	purple_account_get_connection(servconn->session->account)->last_received = time(NULL);
 
 	if (len <= 0) {
 		switch (errno) {
============================================================
--- libpurple/protocols/msn/session.c	76ab4406cd30437a247d39d760384b8a1a6c2dfe
+++ libpurple/protocols/msn/session.c	53bd4e1b26d9ab01819f0cbb68c1bd966e9630d1
@@ -429,7 +429,7 @@ msn_session_set_login_step(MsnSession *s
 	if (session->logged_in)
 		return;
 
-	gc = session->account->gc;
+	gc = purple_account_get_connection(session->account);
 
 	session->login_step = step;
 
@@ -459,7 +459,7 @@ msn_session_finish_login(MsnSession *ses
 
 	msn_change_status(session);
 
-	purple_connection_set_state(gc, PURPLE_CONNECTED);
+	purple_connection_set_state(gc, PURPLE_CONNECTION_STATE_CONNECTED);
 
 	/* Sync users */
 	msn_session_sync_users(session);
============================================================
--- libpurple/protocols/msn/slp.c	9788bb47d805a16af5afecacc52be74af1c37bb9
+++ libpurple/protocols/msn/slp.c	0d9b01b2208bc0949f1d448fd41744f37c632d34
@@ -773,10 +773,10 @@ got_emoticon(MsnSlpCall *slpcall,
 	PurpleConnection *gc;
 	const char *who;
 
-	gc = slpcall->slplink->session->account->gc;
+	gc = purple_account_get_connection(slpcall->slplink->session->account);
 	who = slpcall->slplink->remote_user;
 
-	if ((conv = purple_find_conversation_with_account(PURPLE_CONV_TYPE_ANY, who, gc->account))) {
+	if ((conv = purple_find_conversation_with_account(PURPLE_CONV_TYPE_ANY, who, purple_connection_get_account(gc)))) {
 
 		/* FIXME: it would be better if we wrote the data as we received it
 		   instead of all at once, calling write multiple times and
@@ -965,7 +965,7 @@ msn_queue_buddy_icon_request(MsnUser *us
 		return;
 	}
 
-	if (!buddy_icon_cached(account->gc, obj))
+	if (!buddy_icon_cached(purple_account_get_connection(account), obj))
 	{
 		MsnUserList *userlist;
 
============================================================
--- libpurple/protocols/msn/switchboard.c	543cea9bdcf761eb30a64dd16e4f387120b2273c
+++ libpurple/protocols/msn/switchboard.c	6e8edb8995ad976e7e58870d1a347f2e965093b1
@@ -260,7 +260,7 @@ msn_switchboard_add_user(MsnSwitchBoard 
 
 			swboard->chat_id = msn_switchboard_get_chat_id();
 			swboard->flag |= MSN_SB_FLAG_IM;
-			swboard->conv = serv_got_joined_chat(account->gc,
+			swboard->conv = serv_got_joined_chat(purple_account_get_connection(account),
 												 swboard->chat_id,
 												 "MSN Chat");
 
@@ -693,7 +693,7 @@ iro_cmd(MsnCmdProc *cmdproc, MsnCommand 
 	MsnSwitchBoard *swboard;
 
 	account = cmdproc->session->account;
-	gc = account->gc;
+	gc = purple_account_get_connection(account);
 	swboard = cmdproc->data;
 
 	swboard->total_users = atoi(cmd->params[2]);
@@ -714,7 +714,7 @@ joi_cmd(MsnCmdProc *cmdproc, MsnCommand 
 
 	session = cmdproc->session;
 	account = session->account;
-	gc = account->gc;
+	gc = purple_account_get_connection(account);
 	swboard = cmdproc->data;
 
 	msn_switchboard_add_user(swboard, passport);
@@ -798,7 +798,7 @@ out_cmd(MsnCmdProc *cmdproc, MsnCommand 
 	PurpleConnection *gc;
 	MsnSwitchBoard *swboard;
 
-	gc = cmdproc->session->account->gc;
+	gc = purple_account_get_connection(cmdproc->session->account);
 	swboard = cmdproc->data;
 
 	if (swboard->current_users > 1)
@@ -846,7 +846,7 @@ plain_msg(MsnCmdProc *cmdproc, MsnMessag
 	const char *passport;
 	const char *value;
 
-	gc = cmdproc->session->account->gc;
+	gc = purple_account_get_connection(cmdproc->session->account);
 	swboard = cmdproc->data;
 
 	body = msn_message_get_bin_data(msg, &body_len);
@@ -928,7 +928,7 @@ control_msg(MsnCmdProc *cmdproc, MsnMess
 	MsnSwitchBoard *swboard;
 	char *passport;
 
-	gc = cmdproc->session->account->gc;
+	gc = purple_account_get_connection(cmdproc->session->account);
 	swboard = cmdproc->data;
 	passport = msg->remote_user;
 
@@ -970,7 +970,7 @@ nudge_msg(MsnCmdProc *cmdproc, MsnMessag
 	account = cmdproc->session->account;
 	user = msg->remote_user;
 
-	serv_got_attention(account->gc, user, MSN_NUDGE);
+	serv_got_attention(purple_account_get_connection(account), user, MSN_NUDGE);
 }
 
 /**************************************************************************
============================================================
--- libpurple/protocols/msn/sync.c	85a72d9061e53e69ee27083a796bdb08e5cec907
+++ libpurple/protocols/msn/sync.c	844fc15ebcc0503f987da67831a8cea81bde35a0
@@ -30,7 +30,7 @@ blp_cmd(MsnCmdProc *cmdproc, MsnCommand 
 static void
 blp_cmd(MsnCmdProc *cmdproc, MsnCommand *cmd)
 {
-	PurpleConnection *gc = cmdproc->session->account->gc;
+	PurpleConnection *gc = purple_account_get_connection(cmdproc->session->account);
 	const char *list_name;
 
 	list_name = cmd->params[0];
@@ -43,7 +43,7 @@ blp_cmd(MsnCmdProc *cmdproc, MsnCommand 
 		 *
 		 * In other words, deny some.
 		 */
-		gc->account->perm_deny = PURPLE_PRIVACY_DENY_USERS;
+		purple_connection_get_account(gc)->perm_deny = PURPLE_PRIVACY_DENY_USERS;
 	}
 	else
 	{
@@ -52,7 +52,7 @@ blp_cmd(MsnCmdProc *cmdproc, MsnCommand 
 		 *
 		 * In other words, permit some.
 		 */
-		gc->account->perm_deny = PURPLE_PRIVACY_ALLOW_USERS;
+		purple_connection_get_account(gc)->perm_deny = PURPLE_PRIVACY_ALLOW_USERS;
 	}
 }
 
============================================================
--- libpurple/protocols/msn/userlist.c	1e3596b48bf1a9a10d0f469d835c49e85e6627ba
+++ libpurple/protocols/msn/userlist.c	7ff926c6a4660804c93f4f6e1ef4123ff9405876
@@ -44,9 +44,9 @@ msn_accept_add_cb(gpointer data)
 
 	purple_debug_misc("MSN Userlist", "Accepted the new buddy: %s\n", pa->who);
 
-	if (PURPLE_CONNECTION_IS_VALID(pa->gc))
+	if (PURPLE_CONNECTION_IS_VALID(purple_account_get_connection(pa)))
 	{
-		MsnSession *session = pa->gc->proto_data;
+		MsnSession *session = purple_account_get_connection(pa)->proto_data;
 		MsnUserList *userlist = session->userlist;
 		
 		msn_userlist_add_buddy_to_list(userlist, pa->who, MSN_LIST_AL);
@@ -66,9 +66,9 @@ msn_cancel_add_cb(gpointer data)
 
 	purple_debug_misc("MSN Userlist", "Denied the new buddy: %s\n", pa->who);
 
-	if (PURPLE_CONNECTION_IS_VALID(pa->gc))
+	if (PURPLE_CONNECTION_IS_VALID(purple_account_get_connection(pa)))
 	{
-		MsnSession *session = pa->gc->proto_data;
+		MsnSession *session = purple_account_get_connection(pa)->proto_data;
 		MsnUserList *userlist = session->userlist;
 		MsnCallbackState *state = msn_callback_state_new(session);
 
@@ -92,7 +92,7 @@ got_new_entry(PurpleConnection *gc, cons
 	pa = g_new0(MsnPermitAdd, 1);
 	pa->who = g_strdup(passport);
 	pa->friendly = g_strdup(friendly);
-	pa->gc = gc;
+	purple_account_get_connection(pa) = gc;
 
 	acct = purple_connection_get_account(gc);
 	purple_account_request_authorization(acct, passport, NULL, friendly, NULL,
@@ -886,7 +886,7 @@ msn_userlist_load(MsnSession *session)
 				if (!PURPLE_BLIST_NODE_IS_BUDDY(bnode))
 					continue;
 				b = (PurpleBuddy *)bnode;
-				if (b->account == gc->account)
+				if (b->account == purple_connection_get_account(gc))
 				{
 					user = msn_userlist_find_add_user(session->userlist,
 						b->name,NULL);
============================================================
--- libpurple/protocols/msnp9/dialog.c	57b42e3a8d2639980d44ced5bf0af756eb944a14
+++ libpurple/protocols/msnp9/dialog.c	26fd6b6007228333c69f0d8e558d95a56b582a0f
@@ -46,9 +46,9 @@ msn_complete_sync_issue(MsnAddRemData *d
 		group = purple_find_group(data->group);
 	
 	if (group != NULL)
-		buddy = purple_find_buddy_in_group(purple_connection_get_account(data->gc), data->who, group);
+		buddy = purple_find_buddy_in_group(purple_connection_get_account(purple_account_get_connection(data)), data->who, group);
 	else
-		buddy = purple_find_buddy(purple_connection_get_account(data->gc), data->who);
+		buddy = purple_find_buddy(purple_connection_get_account(purple_account_get_connection(data)), data->who);
 	
 	if (buddy != NULL)
 		purple_blist_remove_buddy(buddy);
@@ -62,7 +62,7 @@ msn_add_cb(MsnAddRemData *data)
 
 	msn_complete_sync_issue(data);
 
-	session = data->gc->proto_data;
+	session = purple_account_get_connection(data)->proto_data;
 	userlist = session->userlist;
 
 	msn_userlist_add_buddy(userlist, data->who, MSN_LIST_FL, data->group);
@@ -80,7 +80,7 @@ msn_rem_cb(MsnAddRemData *data)
 
 	msn_complete_sync_issue(data);
 
-	session = data->gc->proto_data;
+	session = purple_account_get_connection(data)->proto_data;
 	userlist = session->userlist;
 
 	msn_userlist_rem_buddy(userlist, data->who, MSN_LIST_FL, data->group);
@@ -105,7 +105,7 @@ msn_show_sync_issue(MsnSession *session,
 	data        = g_new0(MsnAddRemData, 1);
 	data->who   = g_strdup(passport);
 	data->group = g_strdup(group_name);
-	data->gc    = gc;
+	purple_account_get_connection(data)    = gc;
 
 	msg = g_strdup_printf(_("Buddy list synchronization issue in %s (%s)"),
 						  purple_account_get_username(account),
============================================================
--- libpurple/protocols/msnp9/error.c	8aea775766e6ab7bb9f6f45a75da2af996b13712
+++ libpurple/protocols/msnp9/error.c	f77030f9615a77eb923a3bca8ee665c8d0ee802c
@@ -265,5 +265,5 @@ msn_error_handle(MsnSession *session, un
 	if (debug)
 		purple_debug_warning("msn", "error %d: %s\n", type, buf);
 	else
-		purple_notify_error(session->account->gc, NULL, buf, NULL);
+		purple_notify_error(purple_account_get_connection(session->account), NULL, buf, NULL);
 }
============================================================
--- libpurple/protocols/msnp9/msn.c	1daf6dbd4257855685b39a4c731478e11f74a869
+++ libpurple/protocols/msnp9/msn.c	98788274d6fb36235707153691a46d71e94b3f5a
@@ -257,7 +257,7 @@ send_to_mobile_cb(MsnMobileData *data, c
 static void
 send_to_mobile_cb(MsnMobileData *data, const char *entry)
 {
-	send_to_mobile(data->gc, data->passport, entry);
+	send_to_mobile(purple_account_get_connection(data), data->passport, entry);
 	g_free(data);
 }
 
@@ -391,7 +391,7 @@ show_send_to_mobile_cb(PurpleBlistNode *
 	session = gc->proto_data;
 
 	data = g_new0(MsnMobileData, 1);
-	data->gc = gc;
+	purple_account_get_connection(data) = gc;
 	data->passport = buddy->name;
 
 	purple_request_input(gc, NULL, _("Send a mobile message."), NULL,
@@ -456,7 +456,7 @@ msn_new_xfer(PurpleConnection *gc, const
 
 	session = gc->proto_data;
 
-	xfer = purple_xfer_new(gc->account, PURPLE_XFER_SEND, who);
+	xfer = purple_xfer_new(purple_connection_get_account(gc), PURPLE_XFER_SEND, who);
 	if (xfer)
 	{
 		slplink = msn_session_get_slplink(session, who);
@@ -755,7 +755,7 @@ msn_login(PurpleAccount *account)
 	session = msn_session_new(account);
 
 	gc->proto_data = session;
-	gc->flags |= PURPLE_CONNECTION_HTML | PURPLE_CONNECTION_FORMATTING_WBFO | PURPLE_CONNECTION_NO_BGCOLOR | PURPLE_CONNECTION_NO_FONTSIZE | PURPLE_CONNECTION_NO_URLDESC;
+	gc->flags |= PURPLE_CONNECTION_FLAGS_HTML | PURPLE_CONNECTION_FLAGS_FORMATTING_WBFO | PURPLE_CONNECTION_FLAGS_NO_BGCOLOR | PURPLE_CONNECTION_FLAGS_NO_FONTSIZE | PURPLE_CONNECTION_FLAGS_NO_URLDESC;
 
 	msn_session_set_login_step(session, MSN_LOGIN_STEP_START);
 
@@ -790,7 +790,7 @@ msn_send_me_im(gpointer data)
 msn_send_me_im(gpointer data)
 {
 	MsnIMData *imdata = data;
-	serv_got_im(imdata->gc, imdata->who, imdata->msg, imdata->flags, imdata->when);
+	serv_got_im(purple_account_get_connection(imdata), imdata->who, imdata->msg, imdata->flags, imdata->when);
 	g_free(imdata->msg);
 	g_free(imdata);
 	return FALSE;
@@ -801,7 +801,7 @@ msn_send_im(PurpleConnection *gc, const 
 			PurpleMessageFlags flags)
 {
 	PurpleAccount *account;
-	PurpleBuddy *buddy = purple_find_buddy(gc->account, who);
+	PurpleBuddy *buddy = purple_find_buddy(purple_connection_get_account(gc), who);
 	MsnMessage *msg;
 	char *msgformat;
 	char *msgtext;
@@ -866,7 +866,7 @@ msn_send_im(PurpleConnection *gc, const 
 		g_free(post);
 
 		serv_got_typing_stopped(gc, who);
-		imdata->gc = gc;
+		purple_account_get_connection(imdata) = gc;
 		imdata->who = who;
 		imdata->msg = body_str;
 		imdata->flags = flags;
@@ -1011,7 +1011,7 @@ msn_add_buddy(PurpleConnection *gc, Purp
 
 	session = gc->proto_data;
 	userlist = session->userlist;
-	who = msn_normalize(gc->account, buddy->name);
+	who = msn_normalize(purple_connection_get_account(gc), buddy->name);
 
 	if (!session->logged_in)
 	{
@@ -1400,7 +1400,7 @@ msn_tooltip_extract_info_text(PurpleNoti
 {
 	PurpleBuddy *b;
 
-	b = purple_find_buddy(purple_connection_get_account(info_data->gc),
+	b = purple_find_buddy(purple_connection_get_account(info_purple_account_get_connection(data)),
 						info_data->name);
 
 	if (b)
@@ -1414,9 +1414,9 @@ msn_tooltip_extract_info_text(PurpleNoti
 			g_free(aliastext);
 		}
 
-		if (b->server_alias)
+		if (purple_buddy_get_server_alias(b))
 		{
-			char *nicktext = g_markup_escape_text(b->server_alias, -1);
+			char *nicktext = g_markup_escape_text(purple_buddy_get_server_alias(b), -1);
 			tmp = g_strdup_printf("<font sml=\"msn\">%s</font><br>", nicktext);
 			purple_notify_user_info_add_pair(user_info, _("Nickname"), tmp);
 			g_free(tmp);
@@ -1511,7 +1511,7 @@ msn_got_info(PurpleUtilFetchUrlData *url
 	purple_debug_info("msn", "In msn_got_info\n");
 
 	/* Make sure the connection is still valid */
-	if (g_list_find(purple_connections_get_all(), info_data->gc) == NULL)
+	if (g_list_find(purple_connections_get_all(), info_purple_account_get_connection(data)) == NULL)
 	{
 		purple_debug_warning("msn", "invalid connection. ignoring buddy info.\n");
 		g_free(info_data->name);
@@ -1528,7 +1528,7 @@ msn_got_info(PurpleUtilFetchUrlData *url
 		purple_notify_user_info_add_pair(user_info, NULL, tmp);
 		g_free(tmp);
 
-		purple_notify_userinfo(info_data->gc, info_data->name, user_info, NULL, NULL);
+		purple_notify_userinfo(info_purple_account_get_connection(data), info_data->name, user_info, NULL, NULL);
 		purple_notify_user_info_destroy(user_info);
 
 		g_free(info_data->name);
@@ -1866,7 +1866,7 @@ msn_got_info(PurpleUtilFetchUrlData *url
 		 * Let's see how long this one holds out for ... */
 		char *p = strstr(url_buffer, "<form id=\"profile_form\" name=\"profile_form\" action=\"http&#58;&#47;&#47;spaces.live.com&#47;profile.aspx&#63;cid&#61;0\"");
 		PurpleBuddy *b = purple_find_buddy
-				(purple_connection_get_account(info_data->gc), info_data->name);
+				(purple_connection_get_account(info_purple_account_get_connection(data)), info_data->name);
 		purple_notify_user_info_add_pair(user_info, _("Error retrieving profile"),
 									   ((p && b) ? _("The user has not created a public profile.") :
 										(p ? _("MSN reported not being able to find the user's profile. "
@@ -1926,7 +1926,7 @@ msn_got_photo(PurpleUtilFetchUrlData *ur
 
 	/* Make sure the connection is still valid if we got here by fetching a photo url */
 	if (url_text && (error_message != NULL ||
-					 g_list_find(purple_connections_get_all(), info_data->gc) == NULL))
+					 g_list_find(purple_connections_get_all(), info_purple_account_get_connection(data)) == NULL))
 	{
 		purple_debug_warning("msn", "invalid connection. ignoring buddy photo info.\n");
 		g_free(stripped);
@@ -1963,7 +1963,7 @@ msn_got_photo(PurpleUtilFetchUrlData *ur
 
 	/* We continue here from msn_got_info, as if nothing has happened */
 #endif
-	purple_notify_userinfo(info_data->gc, info_data->name, user_info, NULL, NULL);
+	purple_notify_userinfo(info_purple_account_get_connection(data), info_data->name, user_info, NULL, NULL);
 
 	g_free(stripped);
 	g_free(url_buffer);
@@ -1985,7 +1985,7 @@ msn_get_info(PurpleConnection *gc, const
 	char *url;
 
 	data       = g_new0(MsnGetInfoData, 1);
-	data->gc   = gc;
+	purple_account_get_connection(data)   = gc;
 	data->name = g_strdup(name);
 
 	url = g_strdup_printf("%s%s", PROFILE_URL, name);
============================================================
--- libpurple/protocols/msnp9/nexus.c	80d89e3a24685afd7230a16037123b06d483c694
+++ libpurple/protocols/msnp9/nexus.c	9683c89c33901684a0cd1a62d50a1fbfb328a6e9
@@ -337,7 +337,7 @@ login_connect_cb(gpointer data, PurpleSs
 	username =
 		g_strdup(purple_url_encode(purple_account_get_username(session->account)));
 
-	password = g_strndup(purple_connection_get_password(session->account->gc), 16);
+	password = g_strndup(purple_connection_get_password(purple_account_get_connection(session->account)), 16);
 	encpass = g_strdup(purple_url_encode(password));
 	g_free(password);
 
============================================================
--- libpurple/protocols/msnp9/notification.c	0d38714b886b5d38659f34cb76fafb68cf40d6b6
+++ libpurple/protocols/msnp9/notification.c	4adc927082bf3ac0aa6cdfb7fc4b1cf867d3684e
@@ -800,7 +800,7 @@ rea_cmd(MsnCmdProc *cmdproc, MsnCommand 
 
 	g_free(username);
 
-	gc = account->gc;
+	gc = purple_account_get_connection(account);
 	friendly = purple_url_decode(cmd->params[3]);
 
 	purple_connection_set_display_name(gc, friendly);
@@ -1012,7 +1012,7 @@ url_cmd(MsnCmdProc *cmdproc, MsnCommand 
 	buf = g_strdup_printf("%s%lu%s",
 			   session->passport_info.mspauth ? session->passport_info.mspauth : "BOGUS",
 			   time(NULL) - session->passport_info.sl,
-			   purple_connection_get_password(account->gc));
+			   purple_connection_get_password(purple_account_get_connection(account)));
 
 	cipher = purple_md5_cipher_new();
 	purple_cipher_append(cipher, (const guchar *)buf, strlen(buf));
@@ -1244,7 +1244,7 @@ initial_email_msg(MsnCmdProc *cmdproc, M
 	const char *unread;
 
 	session = cmdproc->session;
-	gc = session->account->gc;
+	gc = purple_account_get_connection(session->account);
 
 	if (strcmp(msg->remote_user, "Hotmail"))
 		/* This isn't an official message. */
@@ -1297,7 +1297,7 @@ email_msg(MsnCmdProc *cmdproc, MsnMessag
 	char *from, *subject, *tmp;
 
 	session = cmdproc->session;
-	gc = session->account->gc;
+	gc = purple_account_get_connection(session->account);
 
 	if (strcmp(msg->remote_user, "Hotmail"))
 		/* This isn't an official message. */
@@ -1382,7 +1382,7 @@ system_msg(MsnCmdProc *cmdproc, MsnMessa
 		}
 
 		if (*buf != '\0')
-			purple_notify_info(cmdproc->session->account->gc, NULL, buf, NULL);
+			purple_notify_info(purple_account_get_connection(cmdproc->session->account), NULL, buf, NULL);
 	}
 
 	g_hash_table_destroy(table);
============================================================
--- libpurple/protocols/msnp9/servconn.c	b9f1ecd45bd42e69acf0a9b576c6befe445dee66
+++ libpurple/protocols/msnp9/servconn.c	e18d80f139fc60b4cfea7ec17cd785d148f952fc
@@ -387,7 +387,7 @@ read_cb(gpointer data, gint source, Purp
 	session = servconn->session;
 
 	len = read(servconn->fd, buf, sizeof(buf) - 1);
-	servconn->session->account->gc->last_received = time(NULL);
+	purple_account_get_connection(servconn->session->account)->last_received = time(NULL);
 
 	if (len < 0 && errno == EAGAIN)
 		return;
============================================================
--- libpurple/protocols/msnp9/session.c	a9baf3c5fd8f14a419e50e988375cef3db20bd93
+++ libpurple/protocols/msnp9/session.c	439ef0acb6dce3cd4f7f4722c6005e73ae4c6bc6
@@ -381,7 +381,7 @@ msn_session_set_login_step(MsnSession *s
 	if (session->logged_in)
 		return;
 
-	gc = session->account->gc;
+	gc = purple_account_get_connection(session->account);
 
 	session->login_step = step;
 
@@ -416,7 +416,7 @@ msn_session_finish_login(MsnSession *ses
 
 	msn_change_status(session);
 
-	purple_connection_set_state(gc, PURPLE_CONNECTED);
+	purple_connection_set_state(gc, PURPLE_CONNECTION_STATE_CONNECTED);
 
 	/* Sync users */
 	msn_session_sync_users(session);
============================================================
--- libpurple/protocols/msnp9/slp.c	4c5fa0bb627bb1a0d5c81ea293cca2f605cdae90
+++ libpurple/protocols/msnp9/slp.c	d67ddc87415ec285a63dbb06578ec8be3776b969
@@ -771,10 +771,10 @@ got_emoticon(MsnSlpCall *slpcall,
 	PurpleConnection *gc;
 	const char *who;
 
-	gc = slpcall->slplink->session->account->gc;
+	gc = purple_account_get_connection(slpcall->slplink->session->account);
 	who = slpcall->slplink->remote_user;
 
-	if ((conv = purple_find_conversation_with_account(PURPLE_CONV_TYPE_ANY, who, gc->account))) {
+	if ((conv = purple_find_conversation_with_account(PURPLE_CONV_TYPE_ANY, who, purple_connection_get_account(gc)))) {
 
 		/* FIXME: it would be better if we wrote the data as we received it
 		          instead of all at once, calling write multiple times and
@@ -963,7 +963,7 @@ msn_queue_buddy_icon_request(MsnUser *us
 		return;
 	}
 
-	if (!buddy_icon_cached(account->gc, obj))
+	if (!buddy_icon_cached(purple_account_get_connection(account), obj))
 	{
 		MsnUserList *userlist;
 
============================================================
--- libpurple/protocols/msnp9/switchboard.c	ceaf6990e754b92635d8e5559629d62e74f12936
+++ libpurple/protocols/msnp9/switchboard.c	23de690a44e4949fa62e028ce0a0427c01eee609
@@ -262,7 +262,7 @@ msn_switchboard_add_user(MsnSwitchBoard 
 
 			swboard->chat_id = msn_switchboard_get_chat_id();
 			swboard->flag |= MSN_SB_FLAG_IM;
-			swboard->conv = serv_got_joined_chat(account->gc,
+			swboard->conv = serv_got_joined_chat(purple_account_get_connection(account),
 												 swboard->chat_id,
 												 "MSN Chat");
 
@@ -693,7 +693,7 @@ iro_cmd(MsnCmdProc *cmdproc, MsnCommand 
 	MsnSwitchBoard *swboard;
 
 	account = cmdproc->session->account;
-	gc = account->gc;
+	gc = purple_account_get_connection(account);
 	swboard = cmdproc->data;
 
 	swboard->total_users = atoi(cmd->params[2]);
@@ -714,7 +714,7 @@ joi_cmd(MsnCmdProc *cmdproc, MsnCommand 
 
 	session = cmdproc->session;
 	account = session->account;
-	gc = account->gc;
+	gc = purple_account_get_connection(account);
 	swboard = cmdproc->data;
 
 	msn_switchboard_add_user(swboard, passport);
@@ -790,7 +790,7 @@ out_cmd(MsnCmdProc *cmdproc, MsnCommand 
 	PurpleConnection *gc;
 	MsnSwitchBoard *swboard;
 
-	gc = cmdproc->session->account->gc;
+	gc = purple_account_get_connection(cmdproc->session->account);
 	swboard = cmdproc->data;
 
 	if (swboard->current_users > 1)
@@ -838,7 +838,7 @@ plain_msg(MsnCmdProc *cmdproc, MsnMessag
 	const char *passport;
 	const char *value;
 
-	gc = cmdproc->session->account->gc;
+	gc = purple_account_get_connection(cmdproc->session->account);
 	swboard = cmdproc->data;
 
 	body = msn_message_get_bin_data(msg, &body_len);
@@ -920,7 +920,7 @@ control_msg(MsnCmdProc *cmdproc, MsnMess
 	MsnSwitchBoard *swboard;
 	char *passport;
 
-	gc = cmdproc->session->account->gc;
+	gc = purple_account_get_connection(cmdproc->session->account);
 	swboard = cmdproc->data;
 	passport = msg->remote_user;
 
@@ -962,7 +962,7 @@ nudge_msg(MsnCmdProc *cmdproc, MsnMessag
 	account = cmdproc->session->account;
 	user = msg->remote_user;
 
-	serv_got_attention(account->gc, user, MSN_NUDGE);
+	serv_got_attention(purple_account_get_connection(account), user, MSN_NUDGE);
 }
 
 /**************************************************************************
============================================================
--- libpurple/protocols/msnp9/sync.c	60641c1af8c34401f9a686046b80491bbb4e311c
+++ libpurple/protocols/msnp9/sync.c	69585f765f0cf79fa1958d7e30e5d817c0b6bd21
@@ -30,7 +30,7 @@ blp_cmd(MsnCmdProc *cmdproc, MsnCommand 
 static void
 blp_cmd(MsnCmdProc *cmdproc, MsnCommand *cmd)
 {
-	PurpleConnection *gc = cmdproc->session->account->gc;
+	PurpleConnection *gc = purple_account_get_connection(cmdproc->session->account);
 	const char *list_name;
 
 	list_name = cmd->params[0];
@@ -43,7 +43,7 @@ blp_cmd(MsnCmdProc *cmdproc, MsnCommand 
 		 *
 		 * In other words, deny some.
 		 */
-		gc->account->perm_deny = PURPLE_PRIVACY_DENY_USERS;
+		purple_connection_get_account(gc)->perm_deny = PURPLE_PRIVACY_DENY_USERS;
 	}
 	else
 	{
@@ -52,7 +52,7 @@ blp_cmd(MsnCmdProc *cmdproc, MsnCommand 
 		 *
 		 * In other words, permit some.
 		 */
-		gc->account->perm_deny = PURPLE_PRIVACY_ALLOW_USERS;
+		purple_connection_get_account(gc)->perm_deny = PURPLE_PRIVACY_ALLOW_USERS;
 	}
 }
 
============================================================
--- libpurple/protocols/msnp9/userlist.c	002c944871d49e9117c2bd4d9f970a9a907aba37
+++ libpurple/protocols/msnp9/userlist.c	c464bf6cc35b5ba53026f14082a0e02d978981a2
@@ -44,8 +44,8 @@ msn_accept_add_cb(gpointer data)
 	MsnSession *session;
 	MsnUserList *userlist;
 
-	if (PURPLE_CONNECTION_IS_VALID(pa->gc)) {
-		session = pa->gc->proto_data;
+	if (PURPLE_CONNECTION_IS_VALID(purple_account_get_connection(pa))) {
+		session = purple_account_get_connection(pa)->proto_data;
 		userlist = session->userlist;
 
 		msn_userlist_add_buddy(userlist, pa->who, MSN_LIST_AL, NULL);
@@ -63,8 +63,8 @@ msn_cancel_add_cb(gpointer data)
 	MsnSession *session;
 	MsnUserList *userlist;
 
-	if (PURPLE_CONNECTION_IS_VALID(pa->gc)) {
-		session = pa->gc->proto_data;
+	if (PURPLE_CONNECTION_IS_VALID(purple_account_get_connection(pa))) {
+		session = purple_account_get_connection(pa)->proto_data;
 		userlist = session->userlist;
 
 		msn_userlist_add_buddy(userlist, pa->who, MSN_LIST_BL, NULL);
@@ -83,7 +83,7 @@ got_new_entry(PurpleConnection *gc, cons
 	pa = g_new0(MsnPermitAdd, 1);
 	pa->who = g_strdup(passport);
 	pa->friendly = g_strdup(friendly);
-	pa->gc = gc;
+	purple_account_get_connection(pa) = gc;
 	
 	purple_account_request_authorization(purple_connection_get_account(gc), passport, NULL, friendly, NULL,
 					   purple_find_buddy(purple_connection_get_account(gc), passport) != NULL,
============================================================
--- libpurple/protocols/myspace/myspace.c	067d3a24c33f94098631120cce3aa602d9ccf804
+++ libpurple/protocols/myspace/myspace.c	2c3c9a0249091233aab5333c75226e613186f252
@@ -209,7 +209,7 @@ msim_send_raw(MsimSession *session, cons
 	
 	purple_debug_info("msim", "msim_send_raw: writing <%s>\n", msg);
 
-	return msim_send_really_raw(session->gc, msg, strlen(msg)) ==
+	return msim_send_really_raw(purple_account_get_connection(session), msg, strlen(msg)) ==
 		strlen(msg);
 }
 
@@ -273,13 +273,13 @@ msim_login(PurpleAccount *acct)
 	int port;
 
 	g_return_if_fail(acct != NULL);
-	g_return_if_fail(acct->username != NULL);
+	g_return_if_fail(purple_account_get_username(acct) != NULL);
 
-	purple_debug_info("msim", "logging in %s\n", acct->username);
+	purple_debug_info("msim", "logging in %s\n", purple_account_get_username(acct));
 
 	gc = purple_account_get_connection(acct);
 	gc->proto_data = msim_session_new(acct);
-	gc->flags |= PURPLE_CONNECTION_HTML | PURPLE_CONNECTION_NO_URLDESC;
+	gc->flags |= PURPLE_CONNECTION_FLAGS_HTML | PURPLE_CONNECTION_FLAGS_NO_URLDESC;
 
 	/* 1. connect to server */
 	purple_connection_update_progress(gc, _("Connecting"),
@@ -332,29 +332,29 @@ msim_login_challenge(MsimSession *sessio
 
 	g_return_val_if_fail(account != NULL, FALSE);
 
-	purple_connection_update_progress(session->gc, _("Reading challenge"), 1, 4);
+	purple_connection_update_progress(purple_account_get_connection(session), _("Reading challenge"), 1, 4);
 
 	purple_debug_info("msim", "nc is %d bytes, decoded\n", nc_len);
 
 	if (nc_len != MSIM_AUTH_CHALLENGE_LENGTH) {
 		purple_debug_info("msim", "bad nc length: %x != 0x%x\n", nc_len, MSIM_AUTH_CHALLENGE_LENGTH);
-		purple_connection_error_reason (session->gc,
+		purple_connection_error_reason (purple_account_get_connection(session),
 			PURPLE_CONNECTION_ERROR_NETWORK_ERROR,
 			_("Unexpected challenge length from server"));
 		return FALSE;
 	}
 
-	purple_connection_update_progress(session->gc, _("Logging in"), 2, 4);
+	purple_connection_update_progress(purple_account_get_connection(session), _("Logging in"), 2, 4);
 
 	response_len = 0;
-	response = msim_compute_login_response(nc, account->username, account->password, &response_len);
+	response = msim_compute_login_response(nc, purple_account_get_username(account), purple_account_get_password(account), &response_len);
 
 	g_free(nc);
 
 	ret = msim_send(session,
 			"login2", MSIM_TYPE_INTEGER, MSIM_AUTH_ALGORITHM,
 			/* This is actually user's email address. */
-			"username", MSIM_TYPE_STRING, g_strdup(account->username),
+			"username", MSIM_TYPE_STRING, g_strdup(purple_account_get_username(account)),
 			/* GString will be freed in msim_msg_free() in msim_send(). */
 			"response", MSIM_TYPE_BINARY, g_string_new_len(response, response_len),
 			"clientver", MSIM_TYPE_INTEGER, MSIM_CLIENT_VERSION,
@@ -571,7 +571,7 @@ msim_send_bm(MsimSession *session, const
 	g_return_val_if_fail(who != NULL, FALSE);
 	g_return_val_if_fail(text != NULL, FALSE);
 
-	from_username = session->account->username;
+	from_username = purple_account_get_username(session->account);
 
 	g_return_val_if_fail(from_username != NULL, FALSE);
 
@@ -687,7 +687,7 @@ msim_incoming_im(MsimSession *session, M
 		time_received = time(NULL);
 	}
 
-	serv_got_im(session->gc, username, msg_purple_markup, PURPLE_MESSAGE_RECV, time_received);
+	serv_got_im(purple_account_get_connection(session), username, msg_purple_markup, PURPLE_MESSAGE_RECV, time_received);
 
 	g_free(username);
 	g_free(msg_purple_markup);
@@ -719,8 +719,8 @@ msim_unrecognized(MsimSession *session, 
 	 */
 
 	purple_debug_info("msim", "Unrecognized data on account for %s\n", 
-			(session && session->account && session->account->username) ? 
-			session->account->username : "(NULL)");
+			(session && session->account && purple_account_get_username(session->account)) ? 
+			purple_account_get_username(session->account) : "(NULL)");
 	if (note) {
 		purple_debug_info("msim", "(Note: %s)\n", note);
 	}
@@ -758,10 +758,10 @@ msim_incoming_action(MsimSession *sessio
 			msg_text, username);
 
 	if (g_str_equal(msg_text, "%typing%")) {
-		serv_got_typing(session->gc, username, 0, PURPLE_TYPING);
+		serv_got_typing(purple_account_get_connection(session), username, 0, PURPLE_TYPING);
 		rc = TRUE;
 	} else if (g_str_equal(msg_text, "%stoptyping%")) {
-		serv_got_typing_stopped(session->gc, username);
+		serv_got_typing_stopped(purple_account_get_connection(session), username);
 		rc = TRUE;
 	} else if (strstr(msg_text, "!!!ZAP_SEND!!!=RTE_BTN_ZAPS_")) {
 		rc = msim_incoming_zap(session, msg);
@@ -813,8 +813,8 @@ msim_incoming_media(MsimSession *session
 	/* Media messages are sent when the user opens a window to someone.
 	 * Tell libpurple they started typing and stopped typing, to inform the Psychic
 	 * Mode plugin so it too can open a window to the user. */
-	serv_got_typing(session->gc, username, 0, PURPLE_TYPING);
-	serv_got_typing_stopped(session->gc, username);
+	serv_got_typing(purple_account_get_connection(session), username, 0, PURPLE_TYPING);
+	serv_got_typing_stopped(purple_account_get_connection(session), username);
 
 	g_free(username);
 
@@ -965,7 +965,7 @@ msim_get_info_cb(MsimSession *session, M
 	/* Append data from MsimUser to PurpleNotifyUserInfo for display, full */
 	msim_append_user_info(session, user_info, user, TRUE);
 
-	purple_notify_userinfo(session->gc, username, user_info, NULL, NULL);
+	purple_notify_userinfo(purple_account_get_connection(session), username, user_info, NULL, NULL);
 	purple_debug_info("msim", "msim_get_info_cb: username=%s\n", username);
 
 	purple_notify_user_info_destroy(user_info);
@@ -977,7 +977,7 @@ msim_get_info_cb(MsimSession *session, M
 		g_free(user->location);
 		g_free(user->headline);
 		g_free(user->display_name);
-		g_free(user->username);
+		g_free(purple_account_get_username(user));
 		g_free(user->image_url);
 		g_free(user);
 	}
@@ -1040,7 +1040,7 @@ msim_set_status(PurpleAccount *account, 
 	gchar *stripped;
 	gchar *unrecognized_msg;
 
-	session = (MsimSession *)account->gc->proto_data;
+	session = (MsimSession *)purple_account_get_connection(account)->proto_data;
 
 	g_return_if_fail(MSIM_SESSION_VALID(session));
 
@@ -1091,7 +1091,7 @@ msim_set_status(PurpleAccount *account, 
 
 	/* If we should be idle, set that status. Time is irrelevant here. */
 	if (purple_presence_is_idle(pres) && status_code != MSIM_STATUS_CODE_OFFLINE_OR_HIDDEN)
-		msim_set_idle(account->gc, 1);
+		msim_set_idle(purple_account_get_connection(account), 1);
 
 }
 
@@ -1313,10 +1313,10 @@ msim_check_alive(gpointer data)
 
 		purple_debug_info("msim", "msim_check_alive: %s > interval of %d, presumed dead\n",
 				errmsg, MSIM_KEEPALIVE_INTERVAL);
-		purple_connection_error_reason(session->gc,
+		purple_connection_error_reason(purple_account_get_connection(session),
 				PURPLE_CONNECTION_ERROR_NETWORK_ERROR, errmsg);
 
-		purple_notify_error(session->gc, NULL, errmsg, NULL);
+		purple_notify_error(purple_account_get_connection(session), NULL, errmsg, NULL);
 
 		g_free(errmsg);
 
@@ -1387,7 +1387,7 @@ msim_check_inbox_cb(MsimSession *session
 
 				subjects[n] = message_types[i].text;
 				froms[n] = _("MySpace");
-				tos[n] = session->username;
+				tos[n] = purple_account_get_username(session);
 				/* TODO: append token, web challenge, so automatically logs in.
 				 * Would also need to free strings because they won't be static
 				 */
@@ -1409,7 +1409,7 @@ msim_check_inbox_cb(MsimSession *session
 				"msim_check_inbox_cb: notifying of %d\n", n);
 
 		/* TODO: free strings with callback _if_ change to dynamic (w/ token) */
-		purple_notify_emails(session->gc,         /* handle */
+		purple_notify_emails(purple_account_get_connection(session),         /* handle */
 				n,                        /* count */
 				TRUE,                     /* detailed */
 				subjects, froms, tos, urls, 
@@ -1543,7 +1543,7 @@ msim_is_username_set(MsimSession *sessio
 {
 	g_return_val_if_fail(MSIM_SESSION_VALID(session), FALSE);
 	g_return_val_if_fail(msg != NULL, FALSE);
-	g_return_val_if_fail(session->gc != NULL, FALSE);
+	g_return_val_if_fail(purple_account_get_connection(session) != NULL, FALSE);
 
 	session->sesskey = msim_msg_get_integer(msg, "sesskey");
 	purple_debug_info("msim", "SESSKEY=<%d>\n", session->sesskey);
@@ -1566,12 +1566,12 @@ msim_is_username_set(MsimSession *sessio
 	/* We now know are our own username, only after we're logged in..
 	 * which is weird, but happens because you login with your email
 	 * address and not username. Will be freed in msim_session_destroy(). */
-	session->username = msim_msg_get_string(msg, "uniquenick");
+	purple_account_get_username(session) = msim_msg_get_string(msg, "uniquenick");
 
 	/* If user lacks a username, help them get one. */
 	if (msim_msg_get_integer(msg, "uniquenick") == session->userid) {
 		purple_debug_info("msim_is_username_set", "no username is set\n");
-		purple_request_yes_no(session->gc,
+		purple_request_yes_no(purple_account_get_connection(session),
 			_("MySpaceIM - No Username Set"),
 			_("You appear to have no MySpace username."),
 			_("Would you like to set one now? (Note: THIS CANNOT BE CHANGED!)"),
@@ -1579,7 +1579,7 @@ msim_is_username_set(MsimSession *sessio
 			session->account,
 			NULL,
 			NULL,
-			session->gc, 
+			purple_account_get_connection(session), 
 			G_CALLBACK(msim_set_username_cb), 
 			G_CALLBACK(msim_do_not_set_username_cb));
 		purple_debug_info("msim_is_username_set","'username not set' alert prompted\n");
@@ -1598,11 +1598,11 @@ gboolean msim_we_are_logged_on(MsimSessi
 	/* The session is now set up, ready to be connected. This emits the
 	 * signedOn signal, so clients can now do anything with msimprpl, and
 	 * we're ready for it (session key, userid, username all setup). */
-	purple_connection_update_progress(session->gc, _("Connected"), 3, 4);
-	purple_connection_set_state(session->gc, PURPLE_CONNECTED);
+	purple_connection_update_progress(purple_account_get_connection(session), _("Connected"), 3, 4);
+	purple_connection_set_state(purple_account_get_connection(session), PURPLE_CONNECTION_STATE_CONNECTED);
 
 	/* Set display name to username (otherwise will show email address) */
-	purple_connection_set_display_name(session->gc, session->username);
+	purple_connection_set_display_name(purple_account_get_connection(session), purple_account_get_username(session));
 
 	body = msim_msg_new(
 			"UserID", MSIM_TYPE_INTEGER, session->userid,
@@ -1852,7 +1852,7 @@ msim_error(MsimSession *session, MsimMes
 				if (!purple_account_get_remember_password(session->account))
 					purple_account_set_password(session->account, NULL);
 #ifdef MSIM_MAX_PASSWORD_LENGTH
-				if (strlen(session->account->password) > MSIM_MAX_PASSWORD_LENGTH) {
+				if (strlen(purple_account_get_password(session->account)) > MSIM_MAX_PASSWORD_LENGTH) {
 					gchar *suggestion;
 
 					suggestion = g_strdup_printf(_("%s Your password is "
@@ -1861,7 +1861,7 @@ msim_error(MsimSession *session, MsimMes
 							"MySpaceIM. Please shorten your "
 							"password at http://profileedit.myspace.com/index.cfm?fuseaction=accountSettings.changePassword and try again."),
 							full_errmsg, (int)
-							strlen(session->account->password),
+							strlen(purple_account_get_password(session->account)),
 							MSIM_MAX_PASSWORD_LENGTH);
 
 					/* Replace full_errmsg. */
@@ -1876,7 +1876,7 @@ msim_error(MsimSession *session, MsimMes
 					purple_account_set_password(session->account, NULL);
 				break;
 		}
-		purple_connection_error_reason (session->gc, reason, full_errmsg);
+		purple_connection_error_reason (purple_account_get_connection(session), reason, full_errmsg);
 	} else {
 		purple_notify_error(session->account, _("MySpaceIM Error"), full_errmsg, NULL);
 	}
@@ -2676,8 +2676,8 @@ msim_close(PurpleConnection *gc)
 		return;
 	}
 
-	if (session->gc->inpa) {
-		purple_input_remove(session->gc->inpa);
+	if (purple_account_get_connection(session)->inpa) {
+		purple_input_remove(purple_account_get_connection(session)->inpa);
 	}
 
 	msim_session_destroy(session);
@@ -2703,7 +2703,7 @@ msim_status_text(PurpleBuddy *buddy)
 
 	user = msim_get_user_from_buddy(buddy);
 
-	session = (MsimSession *)buddy->account->gc->proto_data;
+	session = (MsimSession *)purple_account_get_connection(buddy->account)->proto_data;
 	g_return_val_if_fail(MSIM_SESSION_VALID(session), NULL);
 
 	display_name = headline = NULL;
@@ -2752,7 +2752,7 @@ msim_tooltip_text(PurpleBuddy *buddy, Pu
 	if (PURPLE_BUDDY_IS_ONLINE(buddy)) {
 		MsimSession *session;
 
-		session = (MsimSession *)buddy->account->gc->proto_data;
+		session = (MsimSession *)purple_account_get_connection(buddy->account)->proto_data;
 
 		g_return_if_fail(MSIM_SESSION_VALID(session));
 
@@ -3339,7 +3339,7 @@ msim_uri_handler(const gchar *proto, con
 		return FALSE;
 	}
 
-	session = (MsimSession *)account->gc->proto_data;
+	session = (MsimSession *)purple_account_get_connection(account)->proto_data;
 	g_return_val_if_fail(session != NULL, FALSE);
 
 	/* Lookup userid to username. TODO: push this down, to IM sending/contact 
@@ -3361,7 +3361,7 @@ msim_uri_handler(const gchar *proto, con
 	return FALSE;
 }
 
-/* TODO: move uid->username resolving to IM sending and buddy adding functions,
+/* TODO: move purple_account_get_username(uid) resolving to IM sending and buddy adding functions,
  * so that user can manually add or IM by userid and username automatically
  * looked up if possible? */
  
============================================================
--- libpurple/protocols/myspace/session.c	b04c86f6f2cce01380766179288ea45db239ff24
+++ libpurple/protocols/myspace/session.c	7e4d775c52512f0d5d08d33ccad9337116e0748d
@@ -40,10 +40,10 @@ msim_session_new(PurpleAccount *acct)
 
 	session->magic = MSIM_SESSION_STRUCT_MAGIC;
 	session->account = acct;
-	session->gc = purple_account_get_connection(acct);
+	purple_account_get_connection(session) = purple_account_get_connection(acct);
 	session->sesskey = 0;
 	session->userid = 0;
-	session->username = NULL;
+	purple_account_get_username(session) = NULL;
 	session->fd = -1;
 
 	/* TODO: Remove. */
@@ -82,7 +82,7 @@ msim_session_destroy(MsimSession *sessio
 	session->magic = -1;
 
 	g_free(session->rxbuf);
-	g_free(session->username);
+	g_free(purple_account_get_username(session));
 
 	/* TODO: Remove. */
 	g_hash_table_destroy(session->user_lookup_cb);
============================================================
--- libpurple/protocols/myspace/user.c	2d3226fb37480df5657d5a9fa564c58a22bcd5b3
+++ libpurple/protocols/myspace/user.c	c53bedda9387d810a9a16df4b6e096cec46a053b
@@ -101,8 +101,8 @@ msim_append_user_info(MsimSession *sessi
 
 	/* Useful to identify the account the tooltip refers to. 
 	 *  Other prpls show this. */
-	if (user->username) {
-		purple_notify_user_info_add_pair(user_info, _("User"), user->username);
+	if (purple_account_get_username(user)) {
+		purple_notify_user_info_add_pair(user_info, _("User"), purple_account_get_username(user));
 	}
 
 	uid = purple_blist_node_get_int(&user->buddy->node, "UserID");
@@ -634,7 +634,7 @@ static void msim_username_is_available_c
 
 	if (!body) {
 		purple_debug_info("msim_username_is_available_cb", "No body for %s?!\n", username);
-		purple_connection_error_reason(session->gc, PURPLE_CONNECTION_ERROR_OTHER_ERROR, 
+		purple_connection_error_reason(purple_account_get_connection(session), PURPLE_CONNECTION_ERROR_OTHER_ERROR, 
 				"An error occured while trying to set the username.\n"
 				"Please try again, or visit http://editprofile.myspace.com/index.cfm?"
 				"fuseaction=profile.username to set your username.");
@@ -654,7 +654,7 @@ static void msim_username_is_available_c
 		purple_debug_info("msim_username_is_available_cb", "Username available. Prompting to Confirm.\n");
 		msim_username_to_set = g_strdup(username);
 		g_free(username);
-		purple_request_yes_no(session->gc,
+		purple_request_yes_no(purple_account_get_connection(session),
 			_("MySpaceIM - Username Available"),
 			_("This username is available. Would you like to set it?"),
 			_("ONCE SET, THIS CANNOT BE CHANGED!"),
@@ -662,13 +662,13 @@ static void msim_username_is_available_c
 			session->account,
 			NULL,
 			NULL,
-			session->gc, 
+			purple_account_get_connection(session), 
 			G_CALLBACK(msim_set_username_confirmed_cb), 
 			G_CALLBACK(msim_do_not_set_username_cb));
 	} else {
 		/* Looks like its in use or we have an invalid response */
 		purple_debug_info("msim_username_is_available_cb", "Username unavaiable. Prompting for new entry.\n");
-		purple_request_input(session->gc, _("MySpaceIM - Please Set a Username"),
+		purple_request_input(purple_account_get_connection(session), _("MySpaceIM - Please Set a Username"),
 			_("This username is unavailable."),
 				_("Please try another username:"),
 				"", FALSE, FALSE, NULL,
@@ -677,7 +677,7 @@ static void msim_username_is_available_c
 				session->account,
 				NULL,
 				NULL,
-				session->gc);
+				purple_account_get_connection(session));
 	}
 }
 
@@ -785,7 +785,7 @@ static void msim_username_is_set_cb(Msim
 	if (!body) {
 		purple_debug_info("msim_username_is_set_cb", "No body");
 		/* Error: No body! */
-		purple_connection_error_reason(session->gc, PURPLE_CONNECTION_ERROR_OTHER_ERROR, errmsg);
+		purple_connection_error_reason(purple_account_get_connection(session), PURPLE_CONNECTION_ERROR_OTHER_ERROR, errmsg);
 	}
 	username = msim_msg_get_string(body, "UserName");
 	code = msim_msg_get_integer(body,"Code");
@@ -803,7 +803,7 @@ static void msim_username_is_set_cb(Msim
 		purple_debug_info("msim_username_is_set_cb", "Username Set with return code %d\n",code);
 		if (code == 0) {
 			/* Good! */
-			session->username = username;
+			purple_account_get_username(session) = username;
 			msim_we_are_logged_on(session);
 		} else {
 			purple_debug_info("msim_username_is_set", "code is %d",code);
@@ -826,13 +826,13 @@ static void msim_username_is_set_cb(Msim
 					NULL)) {
 			/* Error! */
 			/* Can't set... Disconnect */
-			purple_connection_error_reason(session->gc, PURPLE_CONNECTION_ERROR_OTHER_ERROR, errmsg);
+			purple_connection_error_reason(purple_account_get_connection(session), PURPLE_CONNECTION_ERROR_OTHER_ERROR, errmsg);
 		}
 			
 	} else {
 		/* Error! */
 		purple_debug_info("msim","username_is_set Error: Invalid cmd/dsn/lid combination");
-		purple_connection_error_reason(session->gc, PURPLE_CONNECTION_ERROR_OTHER_ERROR, errmsg);
+		purple_connection_error_reason(purple_account_get_connection(session), PURPLE_CONNECTION_ERROR_OTHER_ERROR, errmsg);
 	}
 	g_free(errmsg);
 }
============================================================
--- libpurple/protocols/myspace/zap.c	1387248065b45d0c165c387238348c6e444bcaa9
+++ libpurple/protocols/myspace/zap.c	d03ee171710d2880ad50e9a429b95ba3f2bf8c55
@@ -112,7 +112,7 @@ msim_send_attention(PurpleConnection *gc
 	session = (MsimSession *)gc->proto_data;
 
 	/* Look for this attention type, by the code index given. */
-	types = msim_attention_types(gc->account);
+	types = msim_attention_types(purple_connection_get_account(gc));
 	attn = (PurpleAttentionType *)g_list_nth_data(types, code);
 
 	if (!attn) {
@@ -183,7 +183,7 @@ msim_send_zap_from_menu(PurpleBlistNode 
 
 	zap = GPOINTER_TO_INT(zap_num_ptr);
 
-	serv_send_attention(session->gc, buddy->name, zap);
+	serv_send_attention(purple_account_get_connection(session), buddy->name, zap);
 }
 
 /** Return menu, if any, for a buddy list node. */
@@ -241,7 +241,7 @@ msim_incoming_zap(MsimSession *session, 
 
 	zap = CLAMP(zap, 0, 9);
 
-	serv_got_attention(session->gc, username, zap);
+	serv_got_attention(purple_account_get_connection(session), username, zap);
 
 	g_free(msg_text);
 	g_free(username);
============================================================
--- libpurple/protocols/novell/novell.c	be1a5a1a8c2aa8c6ab17efbeed0bfd3cf6f61025
+++ libpurple/protocols/novell/novell.c	034fe2d8dabae8e6a46a0714de1317e353e3b760
@@ -111,7 +111,7 @@ _login_resp_cb(NMUser * user, NMERR_T re
 		}
 
 		/* Tell Purple that we are connected */
-		purple_connection_set_state(gc, PURPLE_CONNECTED);
+		purple_connection_set_state(gc, PURPLE_CONNECTION_STATE_CONNECTED);
 
 		_sync_contact_list(user);
 
@@ -131,8 +131,8 @@ _login_resp_cb(NMUser * user, NMERR_T re
 				/* Don't attempt to auto-reconnect if our
 				 * password was invalid.
 				 */
-				if (!purple_account_get_remember_password(gc->account))
-					purple_account_set_password(gc->account, NULL);
+				if (!purple_account_get_remember_password(purple_connection_get_account(gc)))
+					purple_account_set_password(purple_connection_get_account(gc), NULL);
 				reason = PURPLE_CONNECTION_ERROR_AUTHENTICATION_FAILED;
 				break;
 			default:
@@ -741,16 +741,16 @@ _get_details_resp_add_privacy_item(NMUse
 
 		if (allowed) {
 
-			if (!g_slist_find_custom(gc->account->permit,
+			if (!g_slist_find_custom(purple_connection_get_account(gc)->permit,
 									 display_id, (GCompareFunc)purple_utf8_strcasecmp)) {
-				purple_privacy_permit_add(gc->account, display_id, TRUE);
+				purple_privacy_permit_add(purple_connection_get_account(gc), display_id, TRUE);
 			}
 
 		} else {
 
-			if (!g_slist_find_custom(gc->account->permit,
+			if (!g_slist_find_custom(purple_connection_get_account(gc)->permit,
 									 display_id, (GCompareFunc)purple_utf8_strcasecmp)) {
-				purple_privacy_deny_add(gc->account, display_id, TRUE);
+				purple_privacy_deny_add(purple_connection_get_account(gc), display_id, TRUE);
 			}
 		}
 
@@ -789,10 +789,10 @@ _create_privacy_item_deny_resp_cb(NMUser
 
 		if (display_id) {
 
-			if (!g_slist_find_custom(gc->account->deny,
+			if (!g_slist_find_custom(purple_connection_get_account(gc)->deny,
 									 display_id, (GCompareFunc)purple_utf8_strcasecmp)) {
 
-				purple_privacy_deny_add(gc->account, display_id, TRUE);
+				purple_privacy_deny_add(purple_connection_get_account(gc), display_id, TRUE);
 			}
 
 		} else {
@@ -840,11 +840,11 @@ _create_privacy_item_permit_resp_cb(NMUs
 
 		if (display_id) {
 
-			if (!g_slist_find_custom(gc->account->permit,
+			if (!g_slist_find_custom(purple_connection_get_account(gc)->permit,
 									 display_id,
 									 (GCompareFunc)purple_utf8_strcasecmp)) {
 
-				purple_privacy_permit_add(gc->account, display_id, TRUE);
+				purple_privacy_permit_add(purple_connection_get_account(gc), display_id, TRUE);
 			}
 
 		} else {
@@ -1400,15 +1400,15 @@ _sync_privacy_lists(NMUser *user)
 	/* Set the Purple privacy setting */
 	if (user->default_deny) {
 		if (user->allow_list == NULL) {
-			gc->account->perm_deny = PURPLE_PRIVACY_DENY_ALL;
+			purple_connection_get_account(gc)->perm_deny = PURPLE_PRIVACY_DENY_ALL;
 		} else {
-			gc->account->perm_deny = PURPLE_PRIVACY_ALLOW_USERS;
+			purple_connection_get_account(gc)->perm_deny = PURPLE_PRIVACY_ALLOW_USERS;
 		}
 	} else {
 		if (user->deny_list == NULL) {
-			gc->account->perm_deny = PURPLE_PRIVACY_ALLOW_ALL;
+			purple_connection_get_account(gc)->perm_deny = PURPLE_PRIVACY_ALLOW_ALL;
 		} else {
-			gc->account->perm_deny = PURPLE_PRIVACY_DENY_USERS;
+			purple_connection_get_account(gc)->perm_deny = PURPLE_PRIVACY_DENY_USERS;
 		}
 	}
 
@@ -1420,9 +1420,9 @@ _sync_privacy_lists(NMUser *user)
 		else
 			name =(char *)node->data;
 
-		if (!g_slist_find_custom(gc->account->permit,
+		if (!g_slist_find_custom(purple_connection_get_account(gc)->permit,
 								 name, (GCompareFunc)purple_utf8_strcasecmp)) {
-			purple_privacy_permit_add(gc->account, name , TRUE);
+			purple_privacy_permit_add(purple_connection_get_account(gc), name , TRUE);
 		}
 	}
 
@@ -1433,15 +1433,15 @@ _sync_privacy_lists(NMUser *user)
 		else
 			name =(char *)node->data;
 
-		if (!g_slist_find_custom(gc->account->deny,
+		if (!g_slist_find_custom(purple_connection_get_account(gc)->deny,
 								 name, (GCompareFunc)purple_utf8_strcasecmp)) {
-			purple_privacy_deny_add(gc->account, name, TRUE);
+			purple_privacy_deny_add(purple_connection_get_account(gc), name, TRUE);
 		}
 	}
 
 
 	/*  Remove stuff */
-	for (node = gc->account->permit; node; node = node->next) {
+	for (node = purple_connection_get_account(gc)->permit; node; node = node->next) {
 		dn = nm_lookup_dn(user, (char *)node->data);
 		if (dn != NULL &&
 			!g_slist_find_custom(user->allow_list,
@@ -1452,13 +1452,13 @@ _sync_privacy_lists(NMUser *user)
 
 	if (rem_list) {
 		for (node = rem_list; node; node = node->next) {
-			purple_privacy_permit_remove(gc->account, (char *)node->data, TRUE);
+			purple_privacy_permit_remove(purple_connection_get_account(gc), (char *)node->data, TRUE);
 		}
 		g_free(rem_list);
 		rem_list = NULL;
 	}
 
-	for (node = gc->account->deny; node; node = node->next) {
+	for (node = purple_connection_get_account(gc)->deny; node; node = node->next) {
 		dn = nm_lookup_dn(user, (char *)node->data);
 		if (dn != NULL &&
 			!g_slist_find_custom(user->deny_list,
@@ -1469,7 +1469,7 @@ _sync_privacy_lists(NMUser *user)
 
 	if (rem_list) {
 		for (node = rem_list; node; node = node->next) {
-			purple_privacy_deny_remove(gc->account, (char *)node->data, TRUE);
+			purple_privacy_deny_remove(purple_connection_get_account(gc), (char *)node->data, TRUE);
 		}
 		g_slist_free(rem_list);
 	}
@@ -3067,7 +3067,7 @@ novell_add_permit(PurpleConnection *gc, 
 	/* Remove first -- we will add it back in when we get
 	 * the okay from the server
 	 */
-	purple_privacy_permit_remove(gc->account, who, TRUE);
+	purple_privacy_permit_remove(purple_connection_get_account(gc), who, TRUE);
 
 	if (nm_user_is_privacy_locked(user)) {
 		_show_privacy_locked_error(gc, user);
@@ -3111,7 +3111,7 @@ novell_add_deny(PurpleConnection *gc, co
 	/* Remove first -- we will add it back in when we get
 	 * the okay from the server
 	 */
-	purple_privacy_deny_remove(gc->account, who, TRUE);
+	purple_privacy_deny_remove(purple_connection_get_account(gc), who, TRUE);
 
 	if (nm_user_is_privacy_locked(user)) {
 		_show_privacy_locked_error(gc, user);
@@ -3229,7 +3229,7 @@ novell_set_permit_deny(PurpleConnection 
 		return;
 	}
 
-	switch (gc->account->perm_deny) {
+	switch (purple_connection_get_account(gc)->perm_deny) {
 
 		case PURPLE_PRIVACY_ALLOW_ALL:
 			rc = nm_send_set_privacy_default(user, FALSE,
@@ -3285,14 +3285,14 @@ novell_set_permit_deny(PurpleConnection 
 					if (user_record) {
 						name = nm_user_record_get_display_id(user_record);
 
-						if (!g_slist_find_custom(gc->account->permit,
+						if (!g_slist_find_custom(purple_connection_get_account(gc)->permit,
 												 name, (GCompareFunc)purple_utf8_strcasecmp)) {
-							purple_privacy_permit_add(gc->account, name , TRUE);
+							purple_privacy_permit_add(purple_connection_get_account(gc), name , TRUE);
 						}
 					}
 				}
 
-				for (node = gc->account->permit; node; node = node->next) {
+				for (node = purple_connection_get_account(gc)->permit; node; node = node->next) {
 					name = NULL;
 					dn = nm_lookup_dn(user, (char *)node->data);
 					if (dn) {
@@ -3306,7 +3306,7 @@ novell_set_permit_deny(PurpleConnection 
 															 g_strdup(dn));
 						}
 					} else {
-						purple_privacy_permit_remove(gc->account, (char *)node->data, TRUE);
+						purple_privacy_permit_remove(purple_connection_get_account(gc), (char *)node->data, TRUE);
 					}
 				}
 			}
@@ -3327,14 +3327,14 @@ novell_set_permit_deny(PurpleConnection 
 					if (user_record) {
 						name = nm_user_record_get_display_id(user_record);
 
-						if (!g_slist_find_custom(gc->account->deny,
+						if (!g_slist_find_custom(purple_connection_get_account(gc)->deny,
 												 name, (GCompareFunc)purple_utf8_strcasecmp)) {
-							purple_privacy_deny_add(gc->account, name , TRUE);
+							purple_privacy_deny_add(purple_connection_get_account(gc), name , TRUE);
 						}
 					}
 				}
 
-				for (node = gc->account->deny; node; node = node->next) {
+				for (node = purple_connection_get_account(gc)->deny; node; node = node->next) {
 
 					name = NULL;
 					dn = nm_lookup_dn(user, (char *)node->data);
@@ -3349,7 +3349,7 @@ novell_set_permit_deny(PurpleConnection 
 															 g_strdup(name));
 						}
 					} else {
-						purple_privacy_deny_remove(gc->account, (char *)node->data, TRUE);
+						purple_privacy_deny_remove(purple_connection_get_account(gc), (char *)node->data, TRUE);
 					}
 				}
 
============================================================
--- libpurple/protocols/null/nullprpl.c	df1c68bccb75696b84e30babf629cc0df6a2899b
+++ libpurple/protocols/null/nullprpl.c	4dc1ac8eab810b29c5d89e0780f3dd2310f38c80
@@ -100,7 +100,7 @@ static PurpleConnection *get_nullprpl_gc
 static PurpleConnection *get_nullprpl_gc(const char *username) {
   PurpleAccount *acct = purple_accounts_find(username, NULLPRPL_ID);
   if (acct && purple_account_is_connected(acct))
-    return acct->gc;
+    return purple_account_get_connection(acct);
   else
     return NULL;
 }
@@ -109,7 +109,7 @@ static void call_if_nullprpl(gpointer da
   PurpleConnection *gc = (PurpleConnection *)(data);
   GcFuncData *gcfdata = (GcFuncData *)userdata;
 
-  if (!strcmp(gc->account->protocol_id, NULLPRPL_ID))
+  if (!strcmp(purple_account_get_protocol_id(purple_connection_get_account(gc)), NULLPRPL_ID))
     gcfdata->fn(gcfdata->from, gc, gcfdata->userdata);
 }
 
@@ -156,8 +156,8 @@ static void discover_status(PurpleConnec
 
 static void discover_status(PurpleConnection *from, PurpleConnection *to,
                             gpointer userdata) {
-  char *from_username = from->account->username;
-  char *to_username = to->account->username;
+  char *from_username = purple_account_get_username(from->account);
+  char *to_username = purple_account_get_username(to->account);
 
   if (purple_find_buddy(from->account, to_username)) {
     PurpleStatus *status = purple_account_get_active_status(to->account);
@@ -182,7 +182,7 @@ static void report_status_change(PurpleC
 static void report_status_change(PurpleConnection *from, PurpleConnection *to,
                                  gpointer userdata) {
   purple_debug_info("nullprpl", "notifying %s that %s changed status\n",
-                    to->account->username, from->account->username);
+                    purple_account_get_username(to->account), purple_account_get_username(from->account));
   discover_status(to, from, NULL);
 }
 
@@ -195,7 +195,7 @@ static void nullprpl_input_user_info(Pur
   PurpleConnection *gc = (PurpleConnection *)action->context;
   PurpleAccount *acct = purple_connection_get_account(gc);
   purple_debug_info("nullprpl", "showing 'Set User Info' dialog for %s\n",
-                    acct->username);
+                    purple_account_get_username(acct));
 
   purple_account_request_change_user_info(acct);
 }
@@ -233,13 +233,13 @@ static const char *nullprpl_list_emblem(
   }
 
   purple_debug_info("nullprpl", "using emblem %s for %s's buddy %s\n",
-                    emblem, buddy->account->username, buddy->name);
+                    emblem, purple_account_get_username(buddy->account), buddy->name);
   return emblem;
 }
 
 static char *nullprpl_status_text(PurpleBuddy *buddy) {
   purple_debug_info("nullprpl", "getting %s's status text for %s\n",
-                    buddy->name, buddy->account->username);
+                    buddy->name, purple_account_get_username(buddy->account));
 
   if (purple_find_buddy(buddy->account, buddy->name)) {
     PurplePresence *presence = purple_buddy_get_presence(buddy);
@@ -276,7 +276,7 @@ static void nullprpl_tooltip_text(Purple
                                      msg);
 
     if (full) {
-      const char *user_info = purple_account_get_user_info(gc->account);
+      const char *user_info = purple_account_get_user_info(purple_connection_get_account(gc));
       if (user_info)
         purple_notify_user_info_add_pair(info, _("User info"), user_info);
     }
@@ -296,7 +296,7 @@ static GList *nullprpl_status_types(Purp
   PurpleStatusType *type;
 
   purple_debug_info("nullprpl", "returning status types for %s: %s, %s, %s\n",
-                    acct->username,
+                    purple_account_get_username(acct),
                     NULL_STATUS_ONLINE, NULL_STATUS_AWAY, NULL_STATUS_OFFLINE);
 
   type = purple_status_type_new(PURPLE_STATUS_AVAILABLE, NULL_STATUS_ONLINE,
@@ -375,7 +375,7 @@ static void nullprpl_login(PurpleAccount
   PurpleConnection *gc = purple_account_get_connection(acct);
   GList *offline_messages;
 
-  purple_debug_info("nullprpl", "logging in %s\n", acct->username);
+  purple_debug_info("nullprpl", "logging in %s\n", purple_account_get_username(acct));
 
   purple_connection_update_progress(gc, _("Connecting"),
                                     0,   /* which connection step this is */
@@ -384,7 +384,7 @@ static void nullprpl_login(PurpleAccount
   purple_connection_update_progress(gc, _("Connected"),
                                     1,   /* which connection step this is */
                                     2);  /* total number of steps */
-  purple_connection_set_state(gc, PURPLE_CONNECTED);
+  purple_connection_set_state(gc, PURPLE_CONNECTION_STATE_CONNECTED);
 
   /* tell purple about everyone on our buddy list who's connected */
   foreach_nullprpl_gc(discover_status, gc, NULL);
@@ -394,12 +394,12 @@ static void nullprpl_login(PurpleAccount
 
   /* fetch stored offline messages */
   purple_debug_info("nullprpl", "checking for offline messages for %s\n",
-                    acct->username);
-  offline_messages = g_hash_table_lookup(goffline_messages, acct->username); 
+                    purple_account_get_username(acct));
+  offline_messages = g_hash_table_lookup(goffline_messages, purple_account_get_username(acct)); 
   while (offline_messages) {
     GOfflineMessage *message = (GOfflineMessage *)offline_messages->data;
     purple_debug_info("nullprpl", "delivering offline message to %s: %s\n",
-                      acct->username, message->message);
+                      purple_account_get_username(acct), message->message);
     serv_got_im(gc, message->from, message->message, message->flags,
                 message->mtime);
     offline_messages = g_list_next(offline_messages);
@@ -410,7 +410,7 @@ static void nullprpl_login(PurpleAccount
   }
 
   g_list_free(offline_messages);
-  g_hash_table_remove(goffline_messages, &acct->username);
+  g_hash_table_remove(goffline_messages, &purple_account_get_username(acct));
 }
 
 static void nullprpl_close(PurpleConnection *gc)
@@ -422,7 +422,7 @@ static int nullprpl_send_im(PurpleConnec
 static int nullprpl_send_im(PurpleConnection *gc, const char *who,
                             const char *message, PurpleMessageFlags flags)
 {
-  const char *from_username = gc->account->username;
+  const char *from_username = purple_account_get_username(purple_connection_get_account(gc));
   PurpleMessageFlags receive_flags = ((flags & ~PURPLE_MESSAGE_SEND)
                                       | PURPLE_MESSAGE_RECV);
   PurpleAccount *to_acct = purple_accounts_find(who, NULLPRPL_ID);
@@ -432,13 +432,13 @@ static int nullprpl_send_im(PurpleConnec
                     from_username, who, message);
 
   /* is the sender blocked by the recipient's privacy settings? */
-  if (to_acct && !purple_privacy_check(to_acct, gc->account->username)) {
+  if (to_acct && !purple_privacy_check(to_acct, purple_account_get_username(purple_connection_get_account(gc)))) {
     char *msg = g_strdup_printf(
       _("Your message was blocked by %s's privacy settings."), who);
     purple_debug_info("nullprpl",
                       "discarding; %s is blocked by %s's privacy settings\n",
                       from_username, who);
-    purple_conv_present_error(who, gc->account, msg);
+    purple_conv_present_error(who, purple_connection_get_account(gc), msg);
     g_free(msg);
     return 0;
   }
@@ -470,7 +470,7 @@ static void nullprpl_set_info(PurpleConn
 
 static void nullprpl_set_info(PurpleConnection *gc, const char *info) {
   purple_debug_info("nullprpl", "setting %s's user info to %s\n",
-                    gc->account->username, info);
+                    purple_account_get_username(purple_connection_get_account(gc)), info);
 }
 
 static char *typing_state_to_string(PurpleTypingState typing) {
@@ -484,10 +484,10 @@ static void notify_typing(PurpleConnecti
 
 static void notify_typing(PurpleConnection *from, PurpleConnection *to,
                           gpointer typing) {
-  char *from_username = from->account->username;
+  char *from_username = purple_account_get_username(from->account);
   char *action = typing_state_to_string((PurpleTypingState)typing);
   purple_debug_info("nullprpl", "notifying %s that %s %s\n",
-                    to->account->username, from_username, action);
+                    purple_account_get_username(to->account), from_username, action);
 
   serv_got_typing(to,
                   from_username,
@@ -498,7 +498,7 @@ static unsigned int nullprpl_send_typing
 
 static unsigned int nullprpl_send_typing(PurpleConnection *gc, const char *name,
                                          PurpleTypingState typing) {
-  purple_debug_info("nullprpl", "%s %s\n", gc->account->username,
+  purple_debug_info("nullprpl", "%s %s\n", purple_account_get_username(purple_connection_get_account(gc)),
                     typing_state_to_string(typing));
   foreach_nullprpl_gc(notify_typing, gc, (gpointer)typing);
   return 0;
@@ -510,7 +510,7 @@ static void nullprpl_get_info(PurpleConn
   PurpleAccount *acct;
 
   purple_debug_info("nullprpl", "Fetching %s's user info for %s\n", username,
-                    gc->account->username);
+                    purple_account_get_username(purple_connection_get_account(gc)));
 
   if (!get_nullprpl_gc(username)) {
     char *msg = g_strdup_printf(_("%s is not logged in."), username);
@@ -536,35 +536,35 @@ static void nullprpl_set_status(PurpleAc
 static void nullprpl_set_status(PurpleAccount *acct, PurpleStatus *status) {
   const char *msg = purple_status_get_attr_string(status, "message");
   purple_debug_info("nullprpl", "setting %s's status to %s: %s\n",
-                    acct->username, purple_status_get_name(status), msg);
+                    purple_account_get_username(acct), purple_status_get_name(status), msg);
 
-  foreach_nullprpl_gc(report_status_change, get_nullprpl_gc(acct->username),
+  foreach_nullprpl_gc(report_status_change, get_nullprpl_gc(purple_account_get_username(acct)),
                       NULL);
 }
 
 static void nullprpl_set_idle(PurpleConnection *gc, int idletime) {
   purple_debug_info("nullprpl",
                     "purple reports that %s has been idle for %d seconds\n",
-                    gc->account->username, idletime);
+                    purple_account_get_username(purple_connection_get_account(gc)), idletime);
 }
 
 static void nullprpl_change_passwd(PurpleConnection *gc, const char *old_pass,
                                    const char *new_pass) {
   purple_debug_info("nullprpl", "%s wants to change their password\n",
-                    gc->account->username);
+                    purple_account_get_username(purple_connection_get_account(gc)));
 }
 
 static void nullprpl_add_buddy(PurpleConnection *gc, PurpleBuddy *buddy,
                                PurpleGroup *group)
 {
-  char *username = gc->account->username;
+  char *username = purple_account_get_username(purple_connection_get_account(gc));
   PurpleConnection *buddy_gc = get_nullprpl_gc(buddy->name);
 
   purple_debug_info("nullprpl", "adding %s to %s's buddy list\n", buddy->name,
                     username);
 
   if (buddy_gc) {
-    PurpleAccount *buddy_acct = buddy_gc->account;
+    PurpleAccount *buddy_acct = buddy_purple_connection_get_account(gc);
 
     discover_status(gc, buddy_gc, NULL);
 
@@ -601,7 +601,7 @@ static void nullprpl_remove_buddy(Purple
                                   PurpleGroup *group)
 {
   purple_debug_info("nullprpl", "removing %s from %s's buddy list\n",
-                    buddy->name, gc->account->username);
+                    buddy->name, purple_account_get_username(purple_connection_get_account(gc)));
 }
 
 static void nullprpl_remove_buddies(PurpleConnection *gc, GList *buddies,
@@ -627,22 +627,22 @@ static void nullprpl_add_permit(PurpleCo
  */
 static void nullprpl_add_permit(PurpleConnection *gc, const char *name) {
   purple_debug_info("nullprpl", "%s adds %s to their allowed list\n",
-                    gc->account->username, name);
+                    purple_account_get_username(purple_connection_get_account(gc)), name);
 }
 
 static void nullprpl_add_deny(PurpleConnection *gc, const char *name) {
   purple_debug_info("nullprpl", "%s adds %s to their blocked list\n",
-                    gc->account->username, name);
+                    purple_account_get_username(purple_connection_get_account(gc)), name);
 }
 
 static void nullprpl_rem_permit(PurpleConnection *gc, const char *name) {
   purple_debug_info("nullprpl", "%s removes %s from their allowed list\n",
-                    gc->account->username, name);
+                    purple_account_get_username(purple_connection_get_account(gc)), name);
 }
 
 static void nullprpl_rem_deny(PurpleConnection *gc, const char *name) {
   purple_debug_info("nullprpl", "%s removes %s from their blocked list\n",
-                    gc->account->username, name);
+                    purple_account_get_username(purple_connection_get_account(gc)), name);
 }
 
 static void nullprpl_set_permit_deny(PurpleConnection *gc) {
@@ -675,7 +675,7 @@ static void nullprpl_join_chat(PurpleCon
 }
 
 static void nullprpl_join_chat(PurpleConnection *gc, GHashTable *components) {
-  char *username = gc->account->username;
+  char *username = purple_account_get_username(purple_connection_get_account(gc));
   char *room = g_hash_table_lookup(components, "room");
   int chat_id = g_str_hash(room);
   purple_debug_info("nullprpl", "%s is joining chat room %s\n", username, room);
@@ -699,7 +699,7 @@ static void nullprpl_reject_chat(PurpleC
 static void nullprpl_reject_chat(PurpleConnection *gc, GHashTable *components) {
   char *invited_by = g_hash_table_lookup(components, "invited_by");
   char *room = g_hash_table_lookup(components, "room");
-  char *username = gc->account->username;
+  char *username = purple_account_get_username(purple_connection_get_account(gc));
   PurpleConnection *invited_by_gc = get_nullprpl_gc(invited_by);
   char *message = g_strdup_printf(
     "%s %s %s.",
@@ -725,7 +725,7 @@ static void nullprpl_chat_invite(PurpleC
 
 static void nullprpl_chat_invite(PurpleConnection *gc, int id,
                                  const char *message, const char *who) {
-  char *username = gc->account->username;
+  char *username = purple_account_get_username(purple_connection_get_account(gc));
   PurpleConversation *conv = purple_find_chat(gc, id);
   char *room = conv->name;
   PurpleAccount *to_acct = purple_accounts_find(who, NULLPRPL_ID);
@@ -734,7 +734,7 @@ static void nullprpl_chat_invite(PurpleC
                     username, who, room);
 
   if (to_acct) {
-    PurpleConversation *to_conv = purple_find_chat(to_acct->gc, id);
+    PurpleConversation *to_conv = purple_find_chat(to_purple_account_get_connection(acct), id);
     if (to_conv) {
       purple_debug_info("nullprpl",
                         "%s is already in chat room %s; "
@@ -750,7 +750,7 @@ static void nullprpl_chat_invite(PurpleC
       components = g_hash_table_new_full(g_str_hash, g_str_equal, NULL, free);
       g_hash_table_replace(components, "room", g_strdup(room));
       g_hash_table_replace(components, "invited_by", g_strdup(username));
-      serv_got_chat_invite(to_acct->gc, room, username, message, components);
+      serv_got_chat_invite(to_purple_account_get_connection(acct), room, username, message, components);
     }
   }
 }
@@ -770,7 +770,7 @@ static void nullprpl_chat_leave(PurpleCo
 static void nullprpl_chat_leave(PurpleConnection *gc, int id) {
   PurpleConversation *conv = purple_find_chat(gc, id);
   purple_debug_info("nullprpl", "%s is leaving chat room %s\n",
-                    gc->account->username, conv->name);
+                    purple_account_get_username(purple_connection_get_account(gc)), conv->name);
 
   /* tell everyone that we left */
   foreach_gc_in_chat(left_chat_room, gc, id, NULL);
@@ -797,7 +797,7 @@ static PurpleCmdRet send_whisper(PurpleC
     return PURPLE_CMD_RET_FAILED;
   }
 
-  from_username = conv->account->username;
+  from_username = purple_account_get_username(conv->account);
   purple_debug_info("nullprpl", "%s whispers to %s in chat room %s: %s\n",
                     from_username, to_username, conv->name, message);
 
@@ -829,7 +829,7 @@ static void nullprpl_chat_whisper(Purple
 
 static void nullprpl_chat_whisper(PurpleConnection *gc, int id, const char *who,
                                   const char *message) {
-  char *username = gc->account->username;
+  char *username = purple_account_get_username(purple_connection_get_account(gc));
   PurpleConversation *conv = purple_find_chat(gc, id);
   purple_debug_info("nullprpl",
                     "%s receives whisper from %s in chat room %s: %s\n",
@@ -854,7 +854,7 @@ static int nullprpl_chat_send(PurpleConn
 
 static int nullprpl_chat_send(PurpleConnection *gc, int id, const char *message,
                               PurpleMessageFlags flags) {
-  char *username = gc->account->username;
+  char *username = purple_account_get_username(purple_connection_get_account(gc));
   PurpleConversation *conv = purple_find_chat(gc, id);
 
   if (conv) {
@@ -876,14 +876,14 @@ static void nullprpl_register_user(Purpl
 
 static void nullprpl_register_user(PurpleAccount *acct) {
  purple_debug_info("nullprpl", "registering account for %s\n",
-                   acct->username);
+                   purple_account_get_username(acct));
 }
 
 static void nullprpl_get_cb_info(PurpleConnection *gc, int id, const char *who) {
   PurpleConversation *conv = purple_find_chat(gc, id);
   purple_debug_info("nullprpl",
                     "retrieving %s's info for %s in chat room %s\n", who,
-                    gc->account->username, conv->name);
+                    purple_account_get_username(purple_connection_get_account(gc)), conv->name);
 
   nullprpl_get_info(gc, who);
 }
@@ -891,7 +891,7 @@ static void nullprpl_alias_buddy(PurpleC
 static void nullprpl_alias_buddy(PurpleConnection *gc, const char *who,
                                  const char *alias) {
  purple_debug_info("nullprpl", "%s sets %'s alias to %s\n",
-                   gc->account->username, who, alias);
+                   purple_account_get_username(purple_connection_get_account(gc)), who, alias);
 }
 
 static void nullprpl_group_buddy(PurpleConnection *gc, const char *who,
@@ -904,12 +904,12 @@ static void nullprpl_rename_group(Purple
 static void nullprpl_rename_group(PurpleConnection *gc, const char *old_name,
                                   PurpleGroup *group, GList *moved_buddies) {
   purple_debug_info("nullprpl", "%s has renamed group %s to %s\n",
-                    gc->account->username, old_name, group->name);
+                    purple_account_get_username(purple_connection_get_account(gc)), old_name, group->name);
 }
 
 static void nullprpl_convo_closed(PurpleConnection *gc, const char *who) {
   purple_debug_info("nullprpl", "%s's conversation with %s was closed\n",
-                    gc->account->username, who);
+                    purple_account_get_username(purple_connection_get_account(gc)), who);
 }
 
 /* normalize a username (e.g. remove whitespace, add default domain, etc.)
@@ -923,19 +923,19 @@ static void nullprpl_set_buddy_icon(Purp
 static void nullprpl_set_buddy_icon(PurpleConnection *gc,
                                     PurpleStoredImage *img) {
  purple_debug_info("nullprpl", "setting %s's buddy icon to %s\n",
-                   gc->account->username, purple_imgstore_get_filename(img));
+                   purple_account_get_username(purple_connection_get_account(gc)), purple_imgstore_get_filename(img));
 }
 
 static void nullprpl_remove_group(PurpleConnection *gc, PurpleGroup *group) {
   purple_debug_info("nullprpl", "%s has removed group %s\n",
-                    gc->account->username, group->name);
+                    purple_account_get_username(purple_connection_get_account(gc)), group->name);
 }
 
 
 static void set_chat_topic_fn(PurpleConvChat *from, PurpleConvChat *to,
                               int id, const char *room, gpointer userdata) {
   const char *topic = (const char *)userdata;
-  const char *username = from->conv->account->username;
+  const char *username = purple_account_get_username(from->conv->account);
   char *msg;
 
   purple_conv_chat_set_topic(to, username, topic);
@@ -961,7 +961,7 @@ static void nullprpl_set_chat_topic(Purp
     return;
 
   purple_debug_info("nullprpl", "%s sets topic of chat room '%s' to '%s'\n",
-                    gc->account->username, conv->name, topic);
+                    purple_account_get_username(purple_connection_get_account(gc)), conv->name, topic);
 
   last_topic = purple_conv_chat_get_topic(chat);
   if ((!topic && !last_topic) ||
@@ -977,8 +977,8 @@ static PurpleRoomlist *nullprpl_roomlist
 }
 
 static PurpleRoomlist *nullprpl_roomlist_get_list(PurpleConnection *gc) {
-  char *username = gc->account->username;
-  PurpleRoomlist *roomlist = purple_roomlist_new(gc->account);
+  char *username = purple_account_get_username(purple_connection_get_account(gc));
+  PurpleRoomlist *roomlist = purple_roomlist_new(purple_connection_get_account(gc));
   GList *fields = NULL;
   PurpleRoomlistField *field;
   GList *chats;
@@ -1023,13 +1023,13 @@ static void nullprpl_roomlist_cancel(Pur
 
 static void nullprpl_roomlist_cancel(PurpleRoomlist *list) {
  purple_debug_info("nullprpl", "%s asked to cancel room list request\n",
-                   list->account->username);
+                   purple_account_get_username(list->account));
 }
 
 static void nullprpl_roomlist_expand_category(PurpleRoomlist *list,
                                               PurpleRoomlistRoom *category) {
  purple_debug_info("nullprpl", "%s asked to expand room list category %s\n",
-                   list->account->username, category->name);
+                   purple_account_get_username(list->account), category->name);
 }
 
 /* nullprpl doesn't support file transfer...yet... */
============================================================
--- libpurple/protocols/oscar/family_chatnav.c	1570a3a72f707fc111b7aac97e4635b5d46ddef1
+++ libpurple/protocols/oscar/family_chatnav.c	de093a26684f3a8bd84bdf43534990c86d1efff0
@@ -59,7 +59,7 @@ error(OscarData *od, FlapConnection *con
 		purple_debug_warning("oscar",
 				"Could not join room, error=0x%04hx, chatnav_error=0x%04hx\n",
 				error, chatnav_error);
-		purple_notify_error(od->gc, NULL, _("Could not join chat room"),
+		purple_notify_error(purple_account_get_connection(od), NULL, _("Could not join chat room"),
 				chatnav_error == 0x0033 ? _("Invalid chat room name") : _("Unknown error"));
 
 		ret = 1;
============================================================
--- libpurple/protocols/oscar/family_icbm.c	8fdd7bd0305cdda828beb1281eab65a19d22acf1
+++ libpurple/protocols/oscar/family_icbm.c	474ddb39f1ec880705dc5d65299e6788a1db097b
@@ -2468,7 +2468,7 @@ static void parse_status_note_text(Oscar
 
 	encoding = byte_stream_getstr(bs, encoding_length);
 
-	account = purple_connection_get_account(od->gc);
+	account = purple_connection_get_account(purple_account_get_connection(od));
 
 	stripped_encoding = oscar_encoding_extract(encoding);
 	status_note_text = oscar_encoding_to_utf8(account, stripped_encoding, response, response_length);
============================================================
--- libpurple/protocols/oscar/family_icq.c	36960db6d17bdb9549b1eae60bc955af110c074f
+++ libpurple/protocols/oscar/family_icq.c	df205e4899608ee6d029a6c45dbabb248ba0a9de
@@ -754,7 +754,7 @@ icqresponse(OscarData *od, FlapConnectio
 				PurplePresence *presence;
 				PurpleStatus *status;
 
-				account = purple_connection_get_account(od->gc);
+				account = purple_connection_get_account(purple_account_get_connection(od));
 				buddy = purple_find_buddy(account, uin);
 				presence = purple_buddy_get_presence(buddy);
 				status = purple_presence_get_active_status(presence);
============================================================
--- libpurple/protocols/oscar/flap_connection.c	215d71c37bda1cba2f2bdc2c2904a4606d437fd7
+++ libpurple/protocols/oscar/flap_connection.c	d6672c6a4a5203ad1c64c6f8cd1c12472ae40dff
@@ -360,7 +360,7 @@ flap_connection_destroy_cb(gpointer data
 
 	conn = data;
 	od = conn->od;
-	account = purple_connection_get_account(od->gc);
+	account = purple_connection_get_account(purple_account_get_connection(od));
 
 	purple_debug_info("oscar", "Destroying oscar connection of "
 			"type 0x%04hx.  Disconnect reason is %d\n",
@@ -406,7 +406,7 @@ flap_connection_destroy_cb(gpointer data
 
 		if (tmp != NULL)
 		{
-			purple_connection_error_reason(od->gc, reason, tmp);
+			purple_connection_error_reason(purple_account_get_connection(od), reason, tmp);
 			g_free(tmp);
 		}
 	}
@@ -817,7 +817,7 @@ flap_connection_recv_cb(gpointer data, g
 						OSCAR_DISCONNECT_LOST_CONNECTION, g_strerror(errno));
 				break;
 			}
-			conn->od->gc->last_received = time(NULL);
+			purple_account_get_connection(conn->od)->last_received = time(NULL);
 
 			/* If we don't even have a complete FLAP header then do nothing */
 			conn->header_received += read;
============================================================
--- libpurple/protocols/oscar/odc.c	aa42e3ea45bae590ba7ad6fa6a70e8208c87a05d
+++ libpurple/protocols/oscar/odc.c	8fc8d64c311c9823a2c0ac86e30231e1e5747cbd
@@ -61,7 +61,7 @@ peer_odc_close(PeerConnection *conn)
 		PurpleAccount *account;
 		PurpleConversation *conv;
 
-		account = purple_connection_get_account(conn->od->gc);
+		account = purple_connection_get_account(purple_account_get_connection(conn->od));
 		conv = purple_conversation_new(PURPLE_CONV_TYPE_IM, account, conn->sn);
 		purple_conversation_write(conv, NULL, tmp, PURPLE_MESSAGE_SYSTEM, time(NULL));
 		g_free(tmp);
@@ -92,7 +92,7 @@ peer_odc_send(PeerConnection *conn, OdcF
 		"type=0x%04x, flags=0x%04x, payload length=%u\n",
 		conn->sn, frame->type, frame->flags, frame->payload.len);
 
-	account = purple_connection_get_account(conn->od->gc);
+	account = purple_connection_get_account(purple_account_get_connection(conn->od));
 	username = purple_account_get_username(account);
 	memcpy(frame->sn, username, strlen(username));
 	memcpy(frame->cookie, conn->cookie, 8);
@@ -247,7 +247,7 @@ peer_odc_handle_payload(PeerConnection *
 	GString *newmsg;
 	PurpleMessageFlags imflags;
 
-	gc = conn->od->gc;
+	gc = purple_account_get_connection(conn->od);
 	account = purple_connection_get_account(gc);
 
 	dataend = msg + len;
@@ -490,7 +490,7 @@ peer_odc_recv_frame(PeerConnection *conn
 	PurpleConnection *gc;
 	OdcFrame *frame;
 
-	gc = conn->od->gc;
+	gc = purple_account_get_connection(conn->od);
 
 	frame = g_new0(OdcFrame, 1);
 	frame->type = byte_stream_get16(bs);
@@ -601,7 +601,7 @@ peer_odc_recv_frame(PeerConnection *conn
 			g_free(size1);
 			g_free(size2);
 
-			account = purple_connection_get_account(conn->od->gc);
+			account = purple_connection_get_account(purple_account_get_connection(conn->od));
 			conv = purple_conversation_new(PURPLE_CONV_TYPE_IM, account, conn->sn);
 			purple_conversation_write(conv, NULL, tmp, PURPLE_MESSAGE_SYSTEM, time(NULL));
 			g_free(tmp);
============================================================
--- libpurple/protocols/oscar/oscar.c	6512c79ac5fb168dc0132ef910bf9543c353c8e7
+++ libpurple/protocols/oscar/oscar.c	8cf33a36f415a8e333eb8f53ee5530b254f69299
@@ -980,7 +980,7 @@ connection_established_cb(gpointer data,
 
 	conn = data;
 	od = conn->od;
-	gc = od->gc;
+	gc = purple_account_get_connection(od);
 	account = purple_connection_get_account(gc);
 
 	conn->connect_data = NULL;
@@ -1059,7 +1059,7 @@ flap_connection_established_bos(OscarDat
 static void
 flap_connection_established_bos(OscarData *od, FlapConnection *conn)
 {
-	PurpleConnection *gc = od->gc;
+	PurpleConnection *gc = purple_account_get_connection(od);
 
 	aim_srv_reqpersonalinfo(od, conn);
 
@@ -1122,7 +1122,7 @@ flap_connection_established_chat(OscarDa
 static void
 flap_connection_established_chat(OscarData *od, FlapConnection *conn)
 {
-	PurpleConnection *gc = od->gc;
+	PurpleConnection *gc = purple_account_get_connection(od);
 	struct chat_connection *chatcon;
 	static int id = 1;
 
@@ -1153,7 +1153,7 @@ flap_connection_established_bart(OscarDa
 static void
 flap_connection_established_bart(OscarData *od, FlapConnection *conn)
 {
-	PurpleConnection *gc = od->gc;
+	PurpleConnection *gc = purple_account_get_connection(od);
 
 	aim_clientready(od, conn);
 
@@ -1234,7 +1234,7 @@ oscar_login(PurpleAccount *account)
 
 	gc = purple_account_get_connection(account);
 	od = gc->proto_data = oscar_data_new();
-	od->gc = gc;
+	purple_account_get_connection(od) = gc;
 
 	oscar_data_addhandler(od, AIM_CB_FAM_SPECIAL, AIM_CB_SPECIAL_CONNERR, purple_connerr, 0);
 	oscar_data_addhandler(od, AIM_CB_FAM_SPECIAL, AIM_CB_SPECIAL_CONNINITDONE, flap_connection_established, 0);
@@ -1312,8 +1312,8 @@ oscar_login(PurpleAccount *account)
 	if (aim_snvalid_icq((purple_account_get_username(account)))) {
 		od->icq = TRUE;
 	} else {
-		gc->flags |= PURPLE_CONNECTION_HTML;
-		gc->flags |= PURPLE_CONNECTION_AUTO_RESP;
+		gc->flags |= PURPLE_CONNECTION_FLAGS_HTML;
+		gc->flags |= PURPLE_CONNECTION_FLAGS_AUTO_RESP;
 	}
 
 	/* Connect to core Purple signals */
@@ -1367,8 +1367,8 @@ purple_parse_auth_resp(OscarData *od, Fl
 static int
 purple_parse_auth_resp(OscarData *od, FlapConnection *conn, FlapFrame *fr, ...)
 {
-	PurpleConnection *gc = od->gc;
-	PurpleAccount *account = gc->account;
+	PurpleConnection *gc = purple_account_get_connection(od);
+	PurpleAccount *account = purple_connection_get_account(gc);
 	char *host; int port;
 	int i;
 	FlapConnection *newconn;
@@ -1482,7 +1482,7 @@ purple_parse_auth_securid_request(OscarD
 static int
 purple_parse_auth_securid_request(OscarData *od, FlapConnection *conn, FlapFrame *fr, ...)
 {
-	PurpleConnection *gc = od->gc;
+	PurpleConnection *gc = purple_account_get_connection(od);
 	PurpleAccount *account = purple_connection_get_account(gc);
 	gchar *primary;
 
@@ -1515,7 +1515,7 @@ static void damn_you(gpointer data, gint
 static void damn_you(gpointer data, gint source, PurpleInputCondition c)
 {
 	struct pieceofcrap *pos = data;
-	OscarData *od = pos->gc->proto_data;
+	OscarData *od = purple_account_get_connection(pos)->proto_data;
 	char in = '\0';
 	int x = 0;
 	unsigned char m[17];
@@ -1533,7 +1533,7 @@ static void damn_you(gpointer data, gint
 		char buf[256];
 		g_snprintf(buf, sizeof(buf), _("You may be disconnected shortly.  You may want to use TOC until "
 			"this is fixed.  Check %s for updates."), PURPLE_WEBSITE);
-		purple_notify_warning(pos->gc, NULL,
+		purple_notify_warning(purple_account_get_connection(pos), NULL,
 							_("Unable to get a valid AIM login hash."),
 							buf);
 		purple_input_remove(pos->inpa);
@@ -1565,7 +1565,7 @@ straight_to_hell(gpointer data, gint sou
 	gchar *buf;
 	ssize_t result;
 
-	if (!PURPLE_CONNECTION_IS_VALID(pos->gc))
+	if (!PURPLE_CONNECTION_IS_VALID(purple_account_get_connection(pos)))
 	{
 		g_free(pos->modname);
 		g_free(pos);
@@ -1577,7 +1577,7 @@ straight_to_hell(gpointer data, gint sou
 	if (source < 0) {
 		buf = g_strdup_printf(_("You may be disconnected shortly.  "
 				"Check %s for updates."), PURPLE_WEBSITE);
-		purple_notify_warning(pos->gc, NULL,
+		purple_notify_warning(purple_account_get_connection(pos), NULL,
 							_("Unable to get a valid AIM login hash."),
 							buf);
 		g_free(buf);
@@ -1660,7 +1660,7 @@ int purple_memrequest(OscarData *od, Fla
 #endif
 
 	pos = g_new0(struct pieceofcrap, 1);
-	pos->gc = od->gc;
+	purple_account_get_connection(pos) = purple_account_get_connection(od);
 	pos->conn = conn;
 
 	pos->offset = offset;
@@ -1668,7 +1668,7 @@ int purple_memrequest(OscarData *od, Fla
 	pos->modname = g_strdup(modname);
 
 	/* TODO: Keep track of this return value. */
-	if (purple_proxy_connect(NULL, pos->gc->account, "pidgin.im", 80,
+	if (purple_proxy_connect(NULL, purple_account_get_connection(pos)->account, "pidgin.im", 80,
 			straight_to_hell, pos) == NULL)
 	{
 		char buf[256];
@@ -1676,7 +1676,7 @@ int purple_memrequest(OscarData *od, Fla
 		g_free(pos);
 		g_snprintf(buf, sizeof(buf), _("You may be disconnected shortly.  "
 			"Check %s for updates."), PURPLE_WEBSITE);
-		purple_notify_warning(pos->gc, NULL,
+		purple_notify_warning(purple_account_get_connection(pos), NULL,
 							_("Unable to get a valid login hash."),
 							buf);
 	}
@@ -1695,7 +1695,7 @@ purple_parse_login(OscarData *od, FlapCo
 	char *key;
 	gboolean truncate_pass;
 
-	gc = od->gc;
+	gc = purple_account_get_connection(od);
 	account = purple_connection_get_account(gc);
 
 	va_start(ap, fr);
@@ -1716,7 +1716,7 @@ purple_handle_redirect(OscarData *od, Fl
 static int
 purple_handle_redirect(OscarData *od, FlapConnection *conn, FlapFrame *fr, ...)
 {
-	PurpleConnection *gc = od->gc;
+	PurpleConnection *gc = purple_account_get_connection(od);
 	PurpleAccount *account = purple_connection_get_account(gc);
 	char *host, *separator;
 	int port;
@@ -1748,7 +1748,7 @@ purple_handle_redirect(OscarData *od, Fl
 		struct chat_connection *cc;
 		cc = g_new0(struct chat_connection, 1);
 		cc->conn = newconn;
-		cc->gc = gc;
+		purple_account_get_connection(cc) = gc;
 		cc->name = g_strdup(redir->chat.room);
 		cc->exchange = redir->chat.exchange;
 		cc->instance = redir->chat.instance;
@@ -1784,7 +1784,7 @@ static int purple_parse_oncoming(OscarDa
 	va_list ap;
 	aim_userinfo_t *info;
 
-	gc = od->gc;
+	gc = purple_account_get_connection(od);
 	account = purple_connection_get_account(gc);
 
 	va_start(ap, fr);
@@ -1950,7 +1950,7 @@ static int purple_parse_offgoing(OscarDa
 }
 
 static int purple_parse_offgoing(OscarData *od, FlapConnection *conn, FlapFrame *fr, ...) {
-	PurpleConnection *gc = od->gc;
+	PurpleConnection *gc = purple_account_get_connection(od);
 	PurpleAccount *account = purple_connection_get_account(gc);
 	va_list ap;
 	aim_userinfo_t *info;
@@ -1961,13 +1961,13 @@ static int purple_parse_offgoing(OscarDa
 
 	purple_prpl_got_user_status(account, info->sn, OSCAR_STATUS_ID_OFFLINE, NULL);
 	purple_prpl_got_user_status_deactive(account, info->sn, OSCAR_STATUS_ID_MOBILE);
-	g_hash_table_remove(od->buddyinfo, purple_normalize(gc->account, info->sn));
+	g_hash_table_remove(od->buddyinfo, purple_normalize(purple_connection_get_account(gc), info->sn));
 
 	return 1;
 }
 
 static int incomingim_chan1(OscarData *od, FlapConnection *conn, aim_userinfo_t *userinfo, struct aim_incomingim_ch1_args *args) {
-	PurpleConnection *gc = od->gc;
+	PurpleConnection *gc = purple_account_get_connection(od);
 	PurpleAccount *account = purple_connection_get_account(gc);
 	PurpleMessageFlags flags = 0;
 	struct buddyinfo *bi;
@@ -2098,9 +2098,9 @@ incomingim_chan2(OscarData *od, FlapConn
 	char *message = NULL;
 
 	g_return_val_if_fail(od != NULL, 0);
-	g_return_val_if_fail(od->gc != NULL, 0);
+	g_return_val_if_fail(purple_account_get_connection(od) != NULL, 0);
 
-	gc = od->gc;
+	gc = purple_account_get_connection(od);
 	account = purple_connection_get_account(gc);
 	od = gc->proto_data;
 
@@ -2240,7 +2240,7 @@ purple_auth_request(struct name_data *da
 	PurpleBuddy *buddy;
 	PurpleGroup *group;
 
-	gc = data->gc;
+	gc = purple_account_get_connection(data);
 	od = gc->proto_data;
 	account = purple_connection_get_account(gc);
 	buddy = purple_find_buddy(account, data->name);
@@ -2276,7 +2276,7 @@ purple_auth_dontrequest(struct name_data
 static void
 purple_auth_dontrequest(struct name_data *data)
 {
-	PurpleConnection *gc = data->gc;
+	PurpleConnection *gc = purple_account_get_connection(data);
 	PurpleBuddy *b = purple_find_buddy(purple_connection_get_account(gc), data->name);
 
 	/* Remove from local list */
@@ -2292,10 +2292,10 @@ purple_auth_sendrequest(PurpleConnection
 	struct name_data *data;
 
 	data = g_new0(struct name_data, 1);
-	data->gc = gc;
+	purple_account_get_connection(data) = gc;
 	data->name = g_strdup(name);
 
-	purple_request_input(data->gc, NULL, _("Authorization Request Message:"),
+	purple_request_input(purple_account_get_connection(data), NULL, _("Authorization Request Message:"),
 					   NULL, _("Please authorize me!"), TRUE, FALSE, NULL,
 					   _("_OK"), G_CALLBACK(purple_auth_request),
 					   _("_Cancel"), G_CALLBACK(purple_auth_dontrequest),
@@ -2322,7 +2322,7 @@ purple_auth_grant(gpointer cbdata)
 purple_auth_grant(gpointer cbdata)
 {
 	struct name_data *data = cbdata;
-	PurpleConnection *gc = data->gc;
+	PurpleConnection *gc = purple_account_get_connection(data);
 	OscarData *od = gc->proto_data;
 
 	aim_ssi_sendauthreply(od, data->name, 0x01, NULL);
@@ -2334,7 +2334,7 @@ purple_auth_dontgrant(struct name_data *
 static void
 purple_auth_dontgrant(struct name_data *data, char *msg)
 {
-	PurpleConnection *gc = data->gc;
+	PurpleConnection *gc = purple_account_get_connection(data);
 	OscarData *od = gc->proto_data;
 
 	aim_ssi_sendauthreply(od, data->name, 0x00, msg ? msg : _("No reason given."));
@@ -2344,11 +2344,11 @@ purple_auth_dontgrant_msgprompt(gpointer
 purple_auth_dontgrant_msgprompt(gpointer cbdata)
 {
 	struct name_data *data = cbdata;
-	purple_request_input(data->gc, NULL, _("Authorization Denied Message:"),
+	purple_request_input(purple_account_get_connection(data), NULL, _("Authorization Denied Message:"),
 					   NULL, _("No reason given."), TRUE, FALSE, NULL,
 					   _("_OK"), G_CALLBACK(purple_auth_dontgrant),
 					   _("_Cancel"), G_CALLBACK(oscar_free_name_data),
-					   purple_connection_get_account(data->gc), data->name, NULL,
+					   purple_connection_get_account(purple_account_get_connection(data)), data->name, NULL,
 					   data);
 }
 
@@ -2356,7 +2356,7 @@ purple_icq_buddyadd(struct name_data *da
 static void
 purple_icq_buddyadd(struct name_data *data)
 {
-	PurpleConnection *gc = data->gc;
+	PurpleConnection *gc = purple_account_get_connection(data);
 
 	purple_blist_request_add_buddy(purple_connection_get_account(gc), data->name, NULL, data->nick);
 
@@ -2366,7 +2366,7 @@ incomingim_chan4(OscarData *od, FlapConn
 static int
 incomingim_chan4(OscarData *od, FlapConnection *conn, aim_userinfo_t *userinfo, struct aim_incomingim_ch4_args *args, time_t t)
 {
-	PurpleConnection *gc = od->gc;
+	PurpleConnection *gc = purple_account_get_connection(od);
 	PurpleAccount *account = purple_connection_get_account(gc);
 	gchar **msg1, **msg2;
 	int i, numtoks;
@@ -2458,7 +2458,7 @@ incomingim_chan4(OscarData *od, FlapConn
 				purple_debug_info("oscar",
 						   "Received an authorization request from UIN %u\n",
 						   args->uin);
-				data->gc = gc;
+				purple_account_get_connection(data) = gc;
 				data->name = sn;
 				data->nick = NULL;
 
@@ -2526,7 +2526,7 @@ incomingim_chan4(OscarData *od, FlapConn
 				for (i=0; i<num; i++) {
 					struct name_data *data = g_new(struct name_data, 1);
 					gchar *message = g_strdup_printf(_("ICQ user %u has sent you a buddy: %s (%s)"), args->uin, text[i*2+2], text[i*2+1]);
-					data->gc = gc;
+					purple_account_get_connection(data) = gc;
 					data->name = g_strdup(text[i*2+1]);
 					data->nick = g_strdup(text[i*2+2]);
 
@@ -2643,7 +2643,7 @@ static int purple_parse_misses(OscarData
 }
 
 static int purple_parse_misses(OscarData *od, FlapConnection *conn, FlapFrame *fr, ...) {
-	PurpleConnection *gc = od->gc;
+	PurpleConnection *gc = purple_account_get_connection(od);
 	PurpleAccount *account = purple_connection_get_account(gc);
 	char *buf;
 	va_list ap;
@@ -2715,7 +2715,7 @@ static int purple_parse_misses(OscarData
 	}
 
 	if (!purple_conv_present_error(userinfo->sn, account, buf))
-		purple_notify_error(od->gc, NULL, buf, NULL);
+		purple_notify_error(purple_account_get_connection(od), NULL, buf, NULL);
 	g_free(buf);
 
 	return 1;
@@ -2751,7 +2751,7 @@ static int purple_parse_clientauto_ch4(O
 }
 
 static int purple_parse_clientauto_ch4(OscarData *od, char *who, guint16 reason, guint32 state, char *msg) {
-	PurpleConnection *gc = od->gc;
+	PurpleConnection *gc = purple_account_get_connection(od);
 
 	switch(reason) {
 		case 0x0003: { /* Reply from an ICQ status message request */
@@ -2830,7 +2830,7 @@ static int purple_parse_msgerr(OscarData
 }
 
 static int purple_parse_msgerr(OscarData *od, FlapConnection *conn, FlapFrame *fr, ...) {
-	PurpleConnection *gc = od->gc;
+	PurpleConnection *gc = purple_account_get_connection(od);
 #ifdef TODOFT
 	OscarData *od = gc->proto_data;
 	PurpleXfer *xfer;
@@ -2865,7 +2865,7 @@ static int purple_parse_msgerr(OscarData
 	if (!purple_conv_present_error(data, purple_connection_get_account(gc), buf)) {
 		g_free(buf);
 		buf = g_strdup_printf(_("Unable to send message to %s:"), data ? data : "(unknown)");
-		purple_notify_error(od->gc, NULL, buf,
+		purple_notify_error(purple_account_get_connection(od), NULL, buf,
 				  (reason < msgerrreasonlen) ? _(msgerrreason[reason]) : _("Unknown reason."));
 	}
 	g_free(buf);
@@ -2874,7 +2874,7 @@ static int purple_parse_mtn(OscarData *o
 }
 
 static int purple_parse_mtn(OscarData *od, FlapConnection *conn, FlapFrame *fr, ...) {
-	PurpleConnection *gc = od->gc;
+	PurpleConnection *gc = purple_account_get_connection(od);
 	va_list ap;
 	guint16 type1, type2;
 	char *sn;
@@ -2932,16 +2932,16 @@ static int purple_parse_locerr(OscarData
 	user_info = purple_notify_user_info_new();
 	buf = g_strdup_printf(_("User information not available: %s"), (reason < msgerrreasonlen) ? _(msgerrreason[reason]) : _("Unknown reason."));
 	purple_notify_user_info_add_pair(user_info, NULL, buf);
-	purple_notify_userinfo(od->gc, destn, user_info, NULL, NULL);
+	purple_notify_userinfo(purple_account_get_connection(od), destn, user_info, NULL, NULL);
 	purple_notify_user_info_destroy(user_info);
-	purple_conv_present_error(destn, purple_connection_get_account(od->gc), buf);
+	purple_conv_present_error(destn, purple_connection_get_account(purple_account_get_connection(od)), buf);
 	g_free(buf);
 
 	return 1;
 }
 
 static int purple_parse_userinfo(OscarData *od, FlapConnection *conn, FlapFrame *fr, ...) {
-	PurpleConnection *gc = od->gc;
+	PurpleConnection *gc = purple_account_get_connection(od);
 	PurpleAccount *account = purple_connection_get_account(gc);
 	PurpleNotifyUserInfo *user_info;
 	gchar *tmp = NULL, *info_utf8 = NULL, *away_utf8 = NULL;
@@ -3043,7 +3043,7 @@ static int purple_got_infoblock(OscarDat
 
 static int purple_got_infoblock(OscarData *od, FlapConnection *conn, FlapFrame *fr, ...)
 {
-	PurpleConnection *gc = od->gc;
+	PurpleConnection *gc = purple_account_get_connection(od);
 	PurpleAccount *account = purple_connection_get_account(gc);
 	PurpleBuddy *b;
 	PurplePresence *presence;
@@ -3104,7 +3104,7 @@ static int purple_parse_motd(OscarData *
 	purple_debug_misc("oscar",
 			   "MOTD: %s (%hu)\n", msg ? msg : "Unknown", id);
 	if (id < 4)
-		purple_notify_warning(od->gc, NULL,
+		purple_notify_warning(purple_account_get_connection(od), NULL,
 							_("Your AIM connection may be lost."), NULL);
 
 	return 1;
@@ -3188,7 +3188,7 @@ static int purple_conv_chat_join(OscarDa
 	va_list ap;
 	int count, i;
 	aim_userinfo_t *info;
-	PurpleConnection *gc = od->gc;
+	PurpleConnection *gc = purple_account_get_connection(od);
 
 	struct chat_connection *c = NULL;
 
@@ -3211,7 +3211,7 @@ static int purple_conv_chat_leave(OscarD
 	va_list ap;
 	int count, i;
 	aim_userinfo_t *info;
-	PurpleConnection *gc = od->gc;
+	PurpleConnection *gc = purple_account_get_connection(od);
 
 	struct chat_connection *c = NULL;
 
@@ -3239,7 +3239,7 @@ static int purple_conv_chat_info_update(
 	char *roomdesc;
 	guint16 unknown_c9, unknown_d2, unknown_d5, maxmsglen, maxvisiblemsglen;
 	guint32 creationtime;
-	PurpleConnection *gc = od->gc;
+	PurpleConnection *gc = purple_account_get_connection(od);
 	struct chat_connection *ccon = find_oscar_chat_by_conn(gc, conn);
 
 	if (!ccon)
@@ -3270,7 +3270,7 @@ static int purple_conv_chat_incoming_msg
 }
 
 static int purple_conv_chat_incoming_msg(OscarData *od, FlapConnection *conn, FlapFrame *fr, ...) {
-	PurpleConnection *gc = od->gc;
+	PurpleConnection *gc = purple_account_get_connection(od);
 	PurpleAccount *account = purple_connection_get_account(gc);
 	struct chat_connection *ccon = find_oscar_chat_by_conn(gc, conn);
 	gchar *utf8;
@@ -3302,7 +3302,7 @@ static int purple_email_parseupdate(Osca
 
 static int purple_email_parseupdate(OscarData *od, FlapConnection *conn, FlapFrame *fr, ...) {
 	va_list ap;
-	PurpleConnection *gc = od->gc;
+	PurpleConnection *gc = purple_account_get_connection(od);
 	struct aim_emailinfo *emailinfo;
 	int havenewmail;
 	char *alertitle, *alerturl;
@@ -3314,7 +3314,7 @@ static int purple_email_parseupdate(Osca
 	alerturl  = va_arg(ap, char *);
 	va_end(ap);
 
-	if ((emailinfo != NULL) && purple_account_get_check_mail(gc->account)) {
+	if ((emailinfo != NULL) && purple_account_get_check_mail(purple_connection_get_account(gc))) {
 		gchar *to = g_strdup_printf("%s%s%s", purple_account_get_username(purple_connection_get_account(gc)),
 									emailinfo->domain ? "@" : "",
 									emailinfo->domain ? emailinfo->domain : "");
@@ -3330,7 +3330,7 @@ static int purple_icon_parseicon(OscarDa
 }
 
 static int purple_icon_parseicon(OscarData *od, FlapConnection *conn, FlapFrame *fr, ...) {
-	PurpleConnection *gc = od->gc;
+	PurpleConnection *gc = purple_account_get_connection(od);
 	va_list ap;
 	char *sn;
 	guint8 iconcsumtype, *iconcsum, *icon;
@@ -3491,7 +3491,7 @@ static int purple_selfinfo(OscarData *od
 	info = va_arg(ap, aim_userinfo_t *);
 	va_end(ap);
 
-	purple_connection_set_display_name(od->gc, info->sn);
+	purple_connection_set_display_name(purple_account_get_connection(od), info->sn);
 
 	/*
 	 * What's with the + 0.5?
@@ -3510,7 +3510,7 @@ static int purple_connerr(OscarData *od,
 }
 
 static int purple_connerr(OscarData *od, FlapConnection *conn, FlapFrame *fr, ...) {
-	PurpleConnection *gc = od->gc;
+	PurpleConnection *gc = purple_account_get_connection(od);
 	va_list ap;
 	guint16 code;
 	char *msg;
@@ -3556,7 +3556,7 @@ static int purple_parse_locaterights(Osc
 
 static int purple_parse_locaterights(OscarData *od, FlapConnection *conn, FlapFrame *fr, ...)
 {
-	PurpleConnection *gc = od->gc;
+	PurpleConnection *gc = purple_account_get_connection(od);
 	PurpleAccount *account = purple_connection_get_account(gc);
 	va_list ap;
 	guint16 maxsiglen;
@@ -3605,7 +3605,7 @@ static int purple_bosrights(OscarData *o
 	va_list ap;
 	guint16 maxpermits, maxdenies;
 
-	gc = od->gc;
+	gc = purple_account_get_connection(od);
 	od = (OscarData *)gc->proto_data;
 	account = purple_connection_get_account(gc);
 
@@ -3620,7 +3620,7 @@ static int purple_bosrights(OscarData *o
 	od->rights.maxpermits = (guint)maxpermits;
 	od->rights.maxdenies = (guint)maxdenies;
 
-	purple_connection_set_state(gc, PURPLE_CONNECTED);
+	purple_connection_set_state(gc, PURPLE_CONNECTION_STATE_CONNECTED);
 
 	purple_debug_info("oscar", "buddy list loaded\n");
 
@@ -3630,7 +3630,7 @@ static int purple_bosrights(OscarData *o
 		serv_set_info(gc, purple_account_get_user_info(account));
 
 	if (!od->icq)
-		oscar_format_screenname(gc, account->username);
+		oscar_format_screenname(gc, purple_account_get_username(account));
 
 	/* Set our available message based on the current status */
 	status = purple_account_get_active_status(account);
@@ -3670,7 +3670,7 @@ static int purple_bosrights(OscarData *o
 	 * breaks mail notification for @mac.com accounts, but it gets rid
 	 * of an annoying error at signon for @anythingelse.com accounts.
 	 */
-	if ((od->authinfo->email != NULL) && ((strchr(gc->account->username, '@') == NULL)))
+	if ((od->authinfo->email != NULL) && ((strchr(purple_account_get_username(purple_connection_get_account(gc)), '@') == NULL)))
 		aim_srv_requestnew(od, SNAC_FAMILY_ALERT);
 
 	return 1;
@@ -3724,7 +3724,7 @@ static int purple_icqinfo(OscarData *od,
 	va_list ap;
 	struct aim_icq_info *info;
 
-	gc = od->gc;
+	gc = purple_account_get_connection(od);
 	account = purple_connection_get_account(gc);
 
 	va_start(ap, fr);
@@ -3756,7 +3756,7 @@ static int purple_icqinfo(OscarData *od,
 	}
 	oscar_user_info_convert_and_add(account, user_info, _("First Name"), info->first);
 	oscar_user_info_convert_and_add(account, user_info, _("Last Name"), info->last);
-	if (info->email && info->email[0] && (utf8 = oscar_utf8_try_convert(gc->account, info->email))) {
+	if (info->email && info->email[0] && (utf8 = oscar_utf8_try_convert(purple_connection_get_account(gc), info->email))) {
 		buf = g_strdup_printf("<a href=\"mailto:%s\">%s</a>", utf8, utf8);
 		purple_notify_user_info_add_pair(user_info, _("E-Mail Address"), buf);
 		g_free(buf);
@@ -3765,7 +3765,7 @@ static int purple_icqinfo(OscarData *od,
 	if (info->numaddresses && info->email2) {
 		int i;
 		for (i = 0; i < info->numaddresses; i++) {
-			if (info->email2[i] && info->email2[i][0] && (utf8 = oscar_utf8_try_convert(gc->account, info->email2[i]))) {
+			if (info->email2[i] && info->email2[i][0] && (utf8 = oscar_utf8_try_convert(purple_connection_get_account(gc), info->email2[i]))) {
 				buf = g_strdup_printf("<a href=\"mailto:%s\">%s</a>", utf8, utf8);
 				purple_notify_user_info_add_pair(user_info, _("E-Mail Address"), buf);
 				g_free(buf);
@@ -3801,7 +3801,7 @@ static int purple_icqinfo(OscarData *od,
 		purple_notify_user_info_add_pair(user_info,
 													_("Age"), age);
 	}
-	if (info->personalwebpage && info->personalwebpage[0] && (utf8 = oscar_utf8_try_convert(gc->account, info->personalwebpage))) {
+	if (info->personalwebpage && info->personalwebpage[0] && (utf8 = oscar_utf8_try_convert(purple_connection_get_account(gc), info->personalwebpage))) {
 		buf = g_strdup_printf("<a href=\"%s\">%s</a>", utf8, utf8);
 		purple_notify_user_info_add_pair(user_info, _("Personal Web Page"), buf);
 		g_free(buf);
@@ -3861,7 +3861,7 @@ static int purple_icqinfo(OscarData *od,
 		oscar_string_convert_and_append(account, tmp, "\n<br>", _("Company"), info->workcompany);
 		oscar_string_convert_and_append(account, tmp, "\n<br>", _("Division"), info->workdivision);
 		oscar_string_convert_and_append(account, tmp, "\n<br>", _("Position"), info->workposition);
-		if (info->workwebpage && info->workwebpage[0] && (utf8 = oscar_utf8_try_convert(gc->account, info->workwebpage))) {
+		if (info->workwebpage && info->workwebpage[0] && (utf8 = oscar_utf8_try_convert(purple_connection_get_account(gc), info->workwebpage))) {
 			g_string_append_printf(tmp, "\n<br><b>%s:</b> <a href=\"%s\">%s</a>", _("Web Page"), utf8, utf8);
 			g_free(utf8);
 		}
@@ -3881,7 +3881,7 @@ static int purple_icqalias(OscarData *od
 
 static int purple_icqalias(OscarData *od, FlapConnection *conn, FlapFrame *fr, ...)
 {
-	PurpleConnection *gc = od->gc;
+	PurpleConnection *gc = purple_account_get_connection(od);
 	PurpleAccount *account = purple_connection_get_account(gc);
 	gchar who[16], *utf8;
 	PurpleBuddy *b;
@@ -3895,7 +3895,7 @@ static int purple_icqalias(OscarData *od
 	if (info->uin && info->nick && info->nick[0] && (utf8 = oscar_utf8_try_convert(account, info->nick))) {
 		g_snprintf(who, sizeof(who), "%u", info->uin);
 		serv_got_alias(gc, who, utf8);
-		if ((b = purple_find_buddy(gc->account, who))) {
+		if ((b = purple_find_buddy(purple_connection_get_account(gc), who))) {
 			purple_blist_node_set_string((PurpleBlistNode*)b, "servernick", utf8);
 		}
 		g_free(utf8);
@@ -3906,7 +3906,7 @@ static int purple_popup(OscarData *od, F
 
 static int purple_popup(OscarData *od, FlapConnection *conn, FlapFrame *fr, ...)
 {
-	PurpleConnection *gc = od->gc;
+	PurpleConnection *gc = purple_account_get_connection(od);
 	gchar *text;
 	va_list ap;
 	char *msg, *url;
@@ -3935,7 +3935,7 @@ static int purple_parse_searchreply(Osca
 
 static int purple_parse_searchreply(OscarData *od, FlapConnection *conn, FlapFrame *fr, ...)
 {
-	PurpleConnection *gc = od->gc;
+	PurpleConnection *gc = purple_account_get_connection(od);
 	PurpleNotifySearchResults *results;
 	PurpleNotifySearchColumn *column;
 	gchar *secondary;
@@ -3993,14 +3993,14 @@ static int purple_parse_searcherror(Osca
 	va_end(ap);
 
 	buf = g_strdup_printf(_("No results found for e-mail address %s"), email);
-	purple_notify_error(od->gc, NULL, buf, NULL);
+	purple_notify_error(purple_account_get_connection(od), NULL, buf, NULL);
 	g_free(buf);
 
 	return 1;
 }
 
 static int purple_account_confirm(OscarData *od, FlapConnection *conn, FlapFrame *fr, ...) {
-	PurpleConnection *gc = od->gc;
+	PurpleConnection *gc = purple_account_get_connection(od);
 	guint16 status;
 	va_list ap;
 	char msg[256];
@@ -4022,7 +4022,7 @@ static int purple_info_change(OscarData 
 }
 
 static int purple_info_change(OscarData *od, FlapConnection *conn, FlapFrame *fr, ...) {
-	PurpleConnection *gc = od->gc;
+	PurpleConnection *gc = purple_account_get_connection(od);
 	va_list ap;
 	guint16 perms, err;
 	char *url, *sn, *email;
@@ -4105,9 +4105,9 @@ oscar_send_typing(PurpleConnection *gc, 
 	else {
 		/* Don't send if this turkey is in our deny list */
 		GSList *list;
-		for (list=gc->account->deny; (list && aim_sncmp(name, list->data)); list=list->next);
+		for (list=purple_connection_get_account(gc)->deny; (list && aim_sncmp(name, list->data)); list=list->next);
 		if (!list) {
-			struct buddyinfo *bi = g_hash_table_lookup(od->buddyinfo, purple_normalize(gc->account, name));
+			struct buddyinfo *bi = g_hash_table_lookup(od->buddyinfo, purple_normalize(purple_connection_get_account(gc), name));
 			if (bi && bi->typingnot) {
 				if (state == PURPLE_TYPING)
 					aim_im_sendmtn(od, 0x0001, name, 0x0002);
@@ -4190,7 +4190,7 @@ purple_odc_send_im(PeerConnection *conn,
 	g_string_append(msg, "</BODY></HTML>");
 
 	/* Convert the message to a good encoding */
-	purple_plugin_oscar_convert_to_best_encoding(conn->od->gc,
+	purple_plugin_oscar_convert_to_best_encoding(purple_account_get_connection(conn->od),
 			conn->sn, msg->str, &tmp, &tmplen, &charset, &charsubset);
 	g_string_free(msg, TRUE);
 	msg = g_string_new_len(tmp, tmplen);
@@ -4260,7 +4260,7 @@ oscar_send_im(PurpleConnection *gc, cons
 			                        "You must be Direct Connected to send IM Images."),
 			                        PURPLE_MESSAGE_ERROR, time(NULL));
 
-		buddy = purple_find_buddy(gc->account, name);
+		buddy = purple_find_buddy(purple_connection_get_account(gc), name);
 
 		bi = g_hash_table_lookup(od->buddyinfo, purple_normalize(account, name));
 		if (!bi) {
@@ -4779,7 +4779,7 @@ static int purple_ssi_parseerr(OscarData
 }
 
 static int purple_ssi_parseerr(OscarData *od, FlapConnection *conn, FlapFrame *fr, ...) {
-	PurpleConnection *gc = od->gc;
+	PurpleConnection *gc = purple_account_get_connection(od);
 	va_list ap;
 	guint16 reason;
 
@@ -4853,7 +4853,7 @@ static int purple_ssi_parselist(OscarDat
 	guint16 fmtver, numitems;
 	guint32 timestamp;
 
-	gc = od->gc;
+	gc = purple_account_get_connection(od);
 	od = gc->proto_data;
 	account = purple_connection_get_account(gc);
 
@@ -4898,7 +4898,7 @@ static int purple_ssi_parselist(OscarDat
 						if(!PURPLE_BLIST_NODE_IS_BUDDY(bnode))
 							continue;
 						b = (PurpleBuddy *)bnode;
-						if (b->account == gc->account) {
+						if (b->account == purple_connection_get_account(gc)) {
 							if (aim_ssi_itemlist_exists(od->ssi.local, b->name)) {
 								/* If the buddy is an ICQ user then load his nickname */
 								const char *servernick = purple_blist_node_get_string((PurpleBlistNode*)b, "servernick");
@@ -4930,8 +4930,8 @@ static int purple_ssi_parselist(OscarDat
 		}
 
 		/* Permit list */
-		if (gc->account->permit) {
-			next = gc->account->permit;
+		if (purple_connection_get_account(gc)->permit) {
+			next = purple_connection_get_account(gc)->permit;
 			while (next != NULL) {
 				cur = next;
 				next = next->next;
@@ -4944,8 +4944,8 @@ static int purple_ssi_parselist(OscarDat
 		}
 
 		/* Deny list */
-		if (gc->account->deny) {
-			next = gc->account->deny;
+		if (purple_connection_get_account(gc)->deny) {
+			next = purple_connection_get_account(gc)->deny;
 			while (next != NULL) {
 				cur = next;
 				next = next->next;
@@ -4989,7 +4989,7 @@ static int purple_ssi_parselist(OscarDat
 						if (g_utf8_validate(gname, -1, NULL))
 							gname_utf8 = g_strdup(gname);
 						else
-							gname_utf8 = oscar_utf8_try_convert(gc->account, gname);
+							gname_utf8 = oscar_utf8_try_convert(purple_connection_get_account(gc), gname);
 					} else
 						gname_utf8 = NULL;
 
@@ -5009,18 +5009,18 @@ static int purple_ssi_parselist(OscarDat
 					} else
 						alias_utf8 = NULL;
 
-					b = purple_find_buddy_in_group(gc->account, curitem->name, g);
+					b = purple_find_buddy_in_group(purple_connection_get_account(gc), curitem->name, g);
 					if (b) {
 						/* Get server stored alias */
 						purple_blist_alias_buddy(b, alias_utf8);
 					} else {
-						b = purple_buddy_new(gc->account, curitem->name, alias_utf8);
+						b = purple_buddy_new(purple_connection_get_account(gc), curitem->name, alias_utf8);
 
 						purple_debug_info("oscar",
 								   "ssi: adding buddy %s to group %s to local list\n", curitem->name, g->name);
 						purple_blist_add_buddy(b, NULL, g, NULL);
 					}
-					if (!aim_sncmp(curitem->name, account->username)) {
+					if (!aim_sncmp(curitem->name, purple_account_get_username(account))) {
 						char *comment = aim_ssi_getcomment(od->ssi.local, gname, curitem->name);
 						if (comment != NULL)
 						{
@@ -5053,7 +5053,7 @@ static int purple_ssi_parselist(OscarDat
 					if (g_utf8_validate(gname, -1, NULL))
 						gname_utf8 = g_strdup(gname);
 					else
-						gname_utf8 = oscar_utf8_try_convert(gc->account, gname);
+						gname_utf8 = oscar_utf8_try_convert(purple_connection_get_account(gc), gname);
 				} else
 					gname_utf8 = NULL;
 
@@ -5131,7 +5131,7 @@ static int purple_ssi_parseack(OscarData
 }
 
 static int purple_ssi_parseack(OscarData *od, FlapConnection *conn, FlapFrame *fr, ...) {
-	PurpleConnection *gc = od->gc;
+	PurpleConnection *gc = purple_account_get_connection(od);
 	va_list ap;
 	struct aim_ssi_tmp *retval;
 
@@ -5192,7 +5192,7 @@ purple_ssi_parseaddmod(OscarData *od, Fl
 	guint16 snac_subtype, type;
 	const char *name;
 
-	gc = od->gc;
+	gc = purple_account_get_connection(od);
 	account = purple_connection_get_account(gc);
 
 	va_start(ap, fr);
@@ -5277,7 +5277,7 @@ static int purple_ssi_authgiven(OscarDat
 }
 
 static int purple_ssi_authgiven(OscarData *od, FlapConnection *conn, FlapFrame *fr, ...) {
-	PurpleConnection *gc = od->gc;
+	PurpleConnection *gc = purple_account_get_connection(od);
 	va_list ap;
 	char *sn, *msg;
 	gchar *dialog_msg, *nombre;
@@ -5292,7 +5292,7 @@ static int purple_ssi_authgiven(OscarDat
 	purple_debug_info("oscar",
 			   "ssi: %s has given you permission to add him to your buddy list\n", sn);
 
-	buddy = purple_find_buddy(gc->account, sn);
+	buddy = purple_find_buddy(purple_connection_get_account(gc), sn);
 	if (buddy && (purple_buddy_get_alias_only(buddy)))
 		nombre = g_strdup_printf("%s (%s)", sn, purple_buddy_get_alias_only(buddy));
 	else
@@ -5302,7 +5302,7 @@ static int purple_ssi_authgiven(OscarDat
 	g_free(nombre);
 
 	data = g_new(struct name_data, 1);
-	data->gc = gc;
+	purple_account_get_connection(data) = gc;
 	data->name = g_strdup(sn);
 	data->nick = (buddy ? g_strdup(purple_buddy_get_alias_only(buddy)) : NULL);
 
@@ -5318,7 +5318,7 @@ static int purple_ssi_authrequest(OscarD
 }
 
 static int purple_ssi_authrequest(OscarData *od, FlapConnection *conn, FlapFrame *fr, ...) {
-	PurpleConnection *gc = od->gc;
+	PurpleConnection *gc = purple_account_get_connection(od);
 	va_list ap;
 	char *sn;
 	char *msg;
@@ -5341,7 +5341,7 @@ static int purple_ssi_authrequest(OscarD
 		reason = purple_plugin_oscar_decode_im_part(account, sn, AIM_CHARSET_CUSTOM, 0x0000, msg, strlen(msg));
 
 	data = g_new(struct name_data, 1);
-	data->gc = gc;
+	purple_account_get_connection(data) = gc;
 	data->name = g_strdup(sn);
 	data->nick = (buddy ? g_strdup(purple_buddy_get_alias_only(buddy)) : NULL);
 
@@ -5355,7 +5355,7 @@ static int purple_ssi_authreply(OscarDat
 }
 
 static int purple_ssi_authreply(OscarData *od, FlapConnection *conn, FlapFrame *fr, ...) {
-	PurpleConnection *gc = od->gc;
+	PurpleConnection *gc = purple_account_get_connection(od);
 	va_list ap;
 	char *sn, *msg;
 	gchar *dialog_msg, *nombre;
@@ -5371,7 +5371,7 @@ static int purple_ssi_authreply(OscarDat
 	purple_debug_info("oscar",
 			   "ssi: received authorization reply from %s.  Reply is 0x%04hhx\n", sn, reply);
 
-	buddy = purple_find_buddy(gc->account, sn);
+	buddy = purple_find_buddy(purple_connection_get_account(gc), sn);
 	if (buddy && (purple_buddy_get_alias_only(buddy)))
 		nombre = g_strdup_printf("%s (%s)", sn, purple_buddy_get_alias_only(buddy));
 	else
@@ -5393,7 +5393,7 @@ static int purple_ssi_gotadded(OscarData
 }
 
 static int purple_ssi_gotadded(OscarData *od, FlapConnection *conn, FlapFrame *fr, ...) {
-	PurpleConnection *gc = od->gc;
+	PurpleConnection *gc = purple_account_get_connection(od);
 	va_list ap;
 	char *sn;
 	PurpleBuddy *buddy;
@@ -5402,9 +5402,9 @@ static int purple_ssi_gotadded(OscarData
 	sn = va_arg(ap, char *);
 	va_end(ap);
 
-	buddy = purple_find_buddy(gc->account, sn);
+	buddy = purple_find_buddy(purple_connection_get_account(gc), sn);
 	purple_debug_info("oscar", "ssi: %s added you to their buddy list\n", sn);
-	purple_account_notify_added(gc->account, sn, NULL, (buddy ? purple_buddy_get_alias_only(buddy) : NULL), NULL);
+	purple_account_notify_added(purple_connection_get_account(gc), sn, NULL, (buddy ? purple_buddy_get_alias_only(buddy) : NULL), NULL);
 
 	return 1;
 }
@@ -5622,7 +5622,7 @@ const char* oscar_list_emblem(PurpleBudd
 
 	account = b->account;
 	if (account != NULL)
-		gc = account->gc;
+		gc = purple_account_get_connection(account);
 	if (gc != NULL)
 		od = gc->proto_data;
 	if (od != NULL)
@@ -5657,7 +5657,7 @@ void oscar_tooltip_text(PurpleBuddy *b, 
 }
 
 void oscar_tooltip_text(PurpleBuddy *b, PurpleNotifyUserInfo *user_info, gboolean full) {
-	PurpleConnection *gc = b->account->gc;
+	PurpleConnection *gc = purple_account_get_connection(b->account);
 	OscarData *od = gc->proto_data;
 	aim_userinfo_t *userinfo = aim_locate_finduserinfo(od, b->name);
 
@@ -5769,7 +5769,7 @@ static int oscar_icon_req(OscarData *od,
 
 
 static int oscar_icon_req(OscarData *od, FlapConnection *conn, FlapFrame *fr, ...) {
-	PurpleConnection *gc = od->gc;
+	PurpleConnection *gc = purple_account_get_connection(od);
 	va_list ap;
 	guint16 type;
 	guint8 flags = 0, length = 0;
@@ -5957,12 +5957,12 @@ static void oscar_ssi_editcomment(struct
 }
 
 static void oscar_ssi_editcomment(struct name_data *data, const char *text) {
-	PurpleConnection *gc = data->gc;
+	PurpleConnection *gc = purple_account_get_connection(data);
 	OscarData *od = gc->proto_data;
 	PurpleBuddy *b;
 	PurpleGroup *g;
 
-	if (!(b = purple_find_buddy(purple_connection_get_account(data->gc), data->name))) {
+	if (!(b = purple_find_buddy(purple_connection_get_account(purple_account_get_connection(data)), data->name))) {
 		oscar_free_name_data(data);
 		return;
 	}
@@ -5974,7 +5974,7 @@ static void oscar_ssi_editcomment(struct
 
 	aim_ssi_editcomment(od, g->name, data->name, text);
 
-	if (!aim_sncmp(data->name, gc->account->username))
+	if (!aim_sncmp(data->name, purple_account_get_username(purple_connection_get_account(gc))))
 		purple_check_comment(od, text);
 
 	oscar_free_name_data(data);
@@ -6002,9 +6002,9 @@ static void oscar_buddycb_edit_comment(P
 	if (!(g = purple_buddy_get_group(buddy)))
 		return;
 	comment = aim_ssi_getcomment(od->ssi.local, g->name, buddy->name);
-	comment_utf8 = comment ? oscar_utf8_try_convert(gc->account, comment) : NULL;
+	comment_utf8 = comment ? oscar_utf8_try_convert(purple_connection_get_account(gc), comment) : NULL;
 
-	data->gc = gc;
+	purple_account_get_connection(data) = gc;
 	data->name = g_strdup(purple_buddy_get_name(buddy));
 	data->nick = g_strdup(purple_buddy_get_alias_only(buddy));
 
@@ -6319,7 +6319,7 @@ static void oscar_show_awaitingauth(Purp
 				PurpleBuddy *buddy = (PurpleBuddy *)bnode;
 				if(!PURPLE_BLIST_NODE_IS_BUDDY(bnode))
 					continue;
-				if (buddy->account == gc->account && aim_ssi_waitingforauth(od->ssi.local, group->name, buddy->name)) {
+				if (buddy->account == purple_connection_get_account(gc) && aim_ssi_waitingforauth(od->ssi.local, group->name, buddy->name)) {
 					if (purple_buddy_get_alias_only(buddy))
 						nombre = g_strdup_printf(" %s (%s)", buddy->name, purple_buddy_get_alias_only(buddy));
 					else
============================================================
--- libpurple/protocols/oscar/peer.c	92d04a1c873ef5c63bc8e78eb98bb11849f03ca6
+++ libpurple/protocols/oscar/peer.c	fea543f9c94f3901554bf1f4d8d62571c469d817
@@ -109,7 +109,7 @@ peer_connection_new(OscarData *od, Oscar
 	PeerConnection *conn;
 	PurpleAccount *account;
 
-	account = purple_connection_get_account(od->gc);
+	account = purple_connection_get_account(purple_account_get_connection(od));
 
 	conn = g_new0(PeerConnection, 1);
 	conn->od = od;
@@ -611,7 +611,7 @@ peer_connection_listen_cb(gpointer data,
 
 	conn = data;
 	od = conn->od;
-	gc = od->gc;
+	gc = purple_account_get_connection(od);
 
 	purple_debug_info("oscar", "Accepting connection on listener socket.\n");
 
@@ -669,7 +669,7 @@ peer_connection_establish_listener_cb(in
 	}
 
 	od = conn->od;
-	gc = od->gc;
+	gc = purple_account_get_connection(od);
 	account = purple_connection_get_account(gc);
 	conn->listenerfd = listenerfd;
 
@@ -760,7 +760,7 @@ peer_connection_trynext(PeerConnection *
 {
 	PurpleAccount *account;
 
-	account = purple_connection_get_account(conn->od->gc);
+	account = purple_connection_get_account(purple_account_get_connection(conn->od));
 
 	/*
 	 * Close any remnants of a previous failed connection attempt.
@@ -897,7 +897,7 @@ peer_connection_propose(OscarData *od, O
 
 				purple_debug_info("oscar", "Already have a direct IM "
 						"session with %s.\n", sn);
-				account = purple_connection_get_account(od->gc);
+				account = purple_connection_get_account(purple_account_get_connection(od));
 				conv = purple_find_conversation_with_account(PURPLE_CONV_TYPE_IM,
 						sn, account);
 				if (conv != NULL)
@@ -963,7 +963,7 @@ peer_connection_got_proposition(OscarDat
 	PeerConnection *conn;
 	gchar *buf;
 
-	gc = od->gc;
+	gc = purple_account_get_connection(od);
 	account = purple_connection_get_account(gc);
 
 	/*
============================================================
--- libpurple/protocols/oscar/peer_proxy.c	1acafcdb0e0c75effb55d99e116903f4ac70bb0b
+++ libpurple/protocols/oscar/peer_proxy.c	727cf44edf0f9bd25c2de09819a5fc5afb1e9b4a
@@ -70,7 +70,7 @@ peer_proxy_send_create_new_conn(PeerConn
 	frame.type = PEER_PROXY_TYPE_CREATE;
 	frame.flags = 0x0000;
 
-	account = purple_connection_get_account(conn->od->gc);
+	account = purple_connection_get_account(purple_account_get_connection(conn->od));
 	sn = purple_account_get_username(account);
 	sn_length = strlen(sn);
 	byte_stream_new(&frame.payload, 1 + sn_length + 8 + 20);
@@ -106,7 +106,7 @@ peer_proxy_send_join_existing_conn(PeerC
 	frame.type = PEER_PROXY_TYPE_JOIN;
 	frame.flags = 0x0000;
 
-	account = purple_connection_get_account(conn->od->gc);
+	account = purple_connection_get_account(purple_account_get_connection(conn->od));
 	sn = purple_account_get_username(account);
 	sn_length = strlen(sn);
 	byte_stream_new(&frame.payload, 1 + sn_length + 2 + 8 + 20);
============================================================
--- libpurple/protocols/qq/buddy_info.c	2d7a65e45a4de016930d039a2644b33d0395b8b3
+++ libpurple/protocols/qq/buddy_info.c	9f1420fa4ba7c283e5d6cd4026935742463ef4fe
@@ -299,7 +299,7 @@ static void modify_info_cancel_cb(modify
 {
 	qq_data *qd;
 
-	qd = (qq_data *) mid->gc->proto_data;
+	qd = (qq_data *) purple_account_get_connection(mid)->proto_data;
 	qd->modifying_info = FALSE;
 
 	g_strfreev((gchar **) mid->info);
@@ -331,7 +331,7 @@ static void modify_info_ok_cb(modify_inf
 	GList *groups;
 	contact_info *info;
 
-	gc = mid->gc;
+	gc = purple_account_get_connection(mid);
 	qd = (qq_data *) gc->proto_data;
 	qd->modifying_info = FALSE;
 
@@ -497,7 +497,7 @@ static void create_modify_info_dialogue(
 
 		/* prepare unmodifiable info */
 		mid = g_new0(modify_info_data, 1);
-		mid->gc = gc;
+		purple_account_get_connection(mid) = gc;
 		/* QQ_CONTACT_FIELDS+1 so that the array is NULL-terminated and can be g_strfreev()'ed later */
 		mid->info = (contact_info *) g_new0(gchar *, QQ_CONTACT_FIELDS+1);
 		mid->info->pager_sn = g_strdup(info->pager_sn);
@@ -599,7 +599,7 @@ void qq_set_my_buddy_icon(PurpleConnecti
 	gint suffix_len = strlen(QQ_ICON_SUFFIX);
 	gint dir_len = strlen(buddy_icon_dir);
 	gchar *errmsg = g_strdup_printf(_("Setting custom faces is not currently supported. Please choose an image from %s."), buddy_icon_dir);
-	gboolean icon_global = purple_account_get_bool(gc->account, "use-global-buddyicon", TRUE);
+	gboolean icon_global = purple_account_get_bool(purple_connection_get_account(gc), "use-global-buddyicon", TRUE);
 
 	if (!icon_path)
 		icon_path = "";
@@ -636,7 +636,7 @@ void qq_set_my_buddy_icon(PurpleConnecti
 	/* tell server my icon changed */
 	_qq_send_packet_modify_face(gc, icon_num);
 	/* display in blist */
-	qq_set_buddy_icon_for_user(account, account->username, icon, icon_path);
+	qq_set_buddy_icon_for_user(account, purple_account_get_username(account), icon, icon_path);
 }
 
 
@@ -683,7 +683,7 @@ void qq_refresh_buddy_and_myself(contact
 			purple_account_set_alias(account, alias_utf8);
 	}
 	/* update buddy list (including myself, if myself is the buddy) */
-	b = purple_find_buddy(gc->account, purple_name);
+	b = purple_find_buddy(purple_connection_get_account(gc), purple_name);
 	q_bud = (b == NULL) ? NULL : (qq_buddy *) b->proto_data;
 	if (q_bud != NULL) {	/* I have this buddy */
 		q_bud->age = strtol(info->age, NULL, 10);
@@ -692,7 +692,7 @@ void qq_refresh_buddy_and_myself(contact
 		if (alias_utf8 != NULL)
 			q_bud->nickname = g_strdup(alias_utf8);
 		qq_update_buddy_contact(gc, q_bud);
-		_qq_update_buddy_icon(gc->account, purple_name, q_bud->face);
+		_qq_update_buddy_icon(purple_connection_get_account(gc), purple_name, q_bud->face);
 	}
 	g_free(purple_name);
 	g_free(alias_utf8);
============================================================
--- libpurple/protocols/qq/buddy_list.c	e75ee5822361713c3fc476da02c788fea6810e40
+++ libpurple/protocols/qq/buddy_list.c	7cabf5d51de96f49825ccdc20f3f8a2916a013a9
@@ -312,7 +312,7 @@ void qq_process_get_buddies_list_reply(g
 			}
 
 			name = uid_to_purple_name(q_bud->uid);
-			b = purple_find_buddy(gc->account, name);
+			b = purple_find_buddy(purple_connection_get_account(gc), name);
 			g_free(name);
 
 			if (b == NULL)
============================================================
--- libpurple/protocols/qq/buddy_opt.c	b2c9154a9107d0c574dd7b226d296c6a5ba64eb4
+++ libpurple/protocols/qq/buddy_opt.c	da35eb57f7cd150d9bbeb48a5aef3cddfa97a822
@@ -139,7 +139,7 @@ static void _qq_send_packet_add_buddy_au
 	guint32 uid;
 	g_return_if_fail(g != NULL);
 
-	gc = g->gc;
+	gc = purple_account_get_connection(g);
 	uid = g->uid;
 	g_return_if_fail(uid != 0);
 
@@ -155,7 +155,7 @@ static void _qq_reject_add_request_real(
 
 	g_return_if_fail(g != NULL);
 
-	gc = g->gc;
+	gc = purple_account_get_connection(g);
 	uid = g->uid;
 	g_return_if_fail(uid != 0);
 
@@ -171,7 +171,7 @@ void qq_approve_add_request_with_gc_and_
 
 	g_return_if_fail(g != NULL);
 
-	gc = g->gc;
+	gc = purple_account_get_connection(g);
 	uid = g->uid;
 	g_return_if_fail(uid != 0);
 
@@ -195,14 +195,14 @@ void qq_reject_add_request_with_gc_and_u
 
 	g_return_if_fail(g != NULL);
 
-	gc = g->gc;
+	gc = purple_account_get_connection(g);
 	uid = g->uid;
 	g_return_if_fail(uid != 0);
 
 	g_free(g);
 
 	g2 = g_new0(gc_and_uid, 1);
-	g2->gc = gc;
+	g2purple_account_get_connection() = gc;
 	g2->uid = uid;
 
 	msg1 = g_strdup_printf(_("You rejected %d's request"), uid);
@@ -224,7 +224,7 @@ void qq_add_buddy_with_gc_and_uid(gc_and
 
 	g_return_if_fail(g != NULL);
 
-	gc = g->gc;
+	gc = purple_account_get_connection(g);
 	uid = g->uid;
 	g_return_if_fail(uid != 0);
 
@@ -241,7 +241,7 @@ void qq_block_buddy_with_gc_and_uid(gc_a
 
 	g_return_if_fail(g != NULL);
 
-	gc = g->gc;
+	gc = purple_account_get_connection(g);
 	uid = g->uid;
 	g_return_if_fail(uid > 0);
 
@@ -395,11 +395,11 @@ void qq_process_add_buddy_reply(guint8 *
 		if (strtol(reply, NULL, 10) > 0) {	/* need auth */
 			purple_debug(PURPLE_DEBUG_WARNING, "QQ", "Add buddy attempt fails, need authentication\n");
 			nombre = uid_to_purple_name(for_uid);
-			b = purple_find_buddy(gc->account, nombre);
+			b = purple_find_buddy(purple_connection_get_account(gc), nombre);
 			if (b != NULL)
 				purple_blist_remove_buddy(b);
 			g = g_new0(gc_and_uid, 1);
-			g->gc = gc;
+			purple_account_get_connection(g) = gc;
 			g->uid = for_uid;
 			msg = g_strdup_printf(_("User %d needs authentication"), for_uid);
 			purple_request_input(gc, NULL, msg,
@@ -452,7 +452,7 @@ PurpleBuddy *qq_add_buddy_by_recv_packet
 	qq_buddy *q_bud;
 	gchar *name, *group_name;
 
-	a = gc->account;
+	a = purple_connection_get_account(gc);
 	qd = (qq_data *) gc->proto_data;
 	g_return_val_if_fail(a != NULL && uid != 0, NULL);
 
@@ -462,7 +462,7 @@ PurpleBuddy *qq_add_buddy_by_recv_packet
 	g = qq_get_purple_group(group_name);
 
 	name = uid_to_purple_name(uid);
-	b = purple_find_buddy(gc->account, name);
+	b = purple_find_buddy(purple_connection_get_account(gc), name);
 	/* remove old, we can not simply return here
 	 * because there might be old local copy of this buddy */
 	if (b != NULL)
@@ -508,7 +508,7 @@ void qq_add_buddy(PurpleConnection *gc, 
 	if (uid > 0)
 		_qq_send_packet_add_buddy(gc, uid);
 	else {
-		b = purple_find_buddy(gc->account, buddy->name);
+		b = purple_find_buddy(purple_connection_get_account(gc), buddy->name);
 		if (b != NULL)
 			purple_blist_remove_buddy(b);
 		purple_notify_error(gc, NULL,
@@ -534,7 +534,7 @@ void qq_remove_buddy(PurpleConnection *g
 	if (uid > 0)
 		_qq_send_packet_remove_buddy(gc, uid);
 
-	b = purple_find_buddy(gc->account, buddy->name);
+	b = purple_find_buddy(purple_connection_get_account(gc), buddy->name);
 	if (b != NULL) {
 		q_bud = (qq_buddy *) b->proto_data;
 		if (q_bud != NULL)
============================================================
--- libpurple/protocols/qq/buddy_status.c	887e959eba68a8276fbac096374ca1904dbe55a2
+++ libpurple/protocols/qq/buddy_status.c	563fcbf689e40fee9e830ceb38f025dd32298166
@@ -203,7 +203,7 @@ void qq_process_change_status_reply(guin
 		} else {
 			purple_debug(PURPLE_DEBUG_INFO, "QQ", "Change status OK\n");
 			name = uid_to_purple_name(qd->uid);
-			b = purple_find_buddy(gc->account, name);
+			b = purple_find_buddy(purple_connection_get_account(gc), name);
 			g_free(name);
 			q_bud = (b == NULL) ? NULL : (qq_buddy *) b->proto_data;
 			qq_update_buddy_contact(gc, q_bud);
@@ -251,7 +251,7 @@ void qq_process_friend_change_status(gui
 		}
 
 		name = uid_to_purple_name(s->uid);
-		b = purple_find_buddy(gc->account, name);
+		b = purple_find_buddy(purple_connection_get_account(gc), name);
 		g_free(name);
 		q_bud = (b == NULL) ? NULL : (qq_buddy *) b->proto_data;
 		if (q_bud) {
============================================================
--- libpurple/protocols/qq/group_im.c	cdb413a9efd8140bfdb485edac0754bc405350a6
+++ libpurple/protocols/qq/group_im.c	d97f7f3b833d4d553dada4443b323978eb52839c
@@ -127,7 +127,7 @@ void qq_process_recv_group_im_apply_join
 	reason = g_strdup_printf(_("Reason: %s"), reason_utf8);
 
 	g = g_new0(group_member_opt, 1);
-	g->gc = gc;
+	purple_account_get_connection(g) = gc;
 	g->internal_group_id = internal_group_id;
 	g->member = user_uid;
 
============================================================
--- libpurple/protocols/qq/group_join.c	31e702f829248ea6eb02b5c5e4bc344206041387
+++ libpurple/protocols/qq/group_join.c	c613bda8b0804154d337918ad301759da5983314
@@ -52,7 +52,7 @@ static void _qq_group_exit_with_gc_and_i
 	guint32 internal_group_id;
 	qq_group *group;
 
-	gc = g->gc;
+	gc = purple_account_get_connection(g);
 	internal_group_id = g->uid;
 
 	group = qq_group_find_by_id(gc, internal_group_id, QQ_INTERNAL_ID);
@@ -107,7 +107,7 @@ static void _qq_group_join_auth_with_gc_
 	qq_group *group;
 	guint32 internal_group_id;
 
-	gc = g->gc;
+	gc = purple_account_get_connection(g);
 	internal_group_id = g->uid;
 
 	group = qq_group_find_by_id(gc, internal_group_id, QQ_INTERNAL_ID);
@@ -130,7 +130,7 @@ static void _qq_group_join_auth(PurpleCo
 
 	msg = g_strdup_printf("Group \"%s\" needs authentication\n", group->group_name_utf8);
 	g = g_new0(gc_and_uid, 1);
-	g->gc = gc;
+	purple_account_get_connection(g) = gc;
 	g->uid = group->internal_group_id;
 	purple_request_input(gc, NULL, msg,
 			   _("Input request here"),
@@ -353,7 +353,7 @@ void qq_group_exit(PurpleConnection *gc,
 	g_return_if_fail(internal_group_id > 0);
 
 	g = g_new0(gc_and_uid, 1);
-	g->gc = gc;
+	purple_account_get_connection(g) = gc;
 	g->uid = internal_group_id;
 
 	purple_request_action(gc, _("QQ Qun Operation"),
============================================================
--- libpurple/protocols/qq/group_opt.c	2c14e9f95ef3fa0f15345764a1fb3697fa825f10
+++ libpurple/protocols/qq/group_opt.c	e3e9557b9c936e98772823ea84f58af34e8d5dbf
@@ -84,21 +84,21 @@ static void _qq_group_reject_application
 static void _qq_group_reject_application_real(group_member_opt *g, gchar *msg_utf8)
 {
 	qq_group *group;
-	g_return_if_fail(g != NULL && g->gc != NULL && g->internal_group_id > 0 && g->member > 0);
-	group = qq_group_find_by_id(g->gc, g->internal_group_id, QQ_INTERNAL_ID);
+	g_return_if_fail(g != NULL && purple_account_get_connection(g) != NULL && g->internal_group_id > 0 && g->member > 0);
+	group = qq_group_find_by_id(purple_account_get_connection(g), g->internal_group_id, QQ_INTERNAL_ID);
 	g_return_if_fail(group != NULL);
-	qq_send_cmd_group_auth(g->gc, group, QQ_GROUP_AUTH_REQUEST_REJECT, g->member, msg_utf8);
+	qq_send_cmd_group_auth(purple_account_get_connection(g), group, QQ_GROUP_AUTH_REQUEST_REJECT, g->member, msg_utf8);
 	g_free(g);
 }
 
 void qq_group_search_application_with_struct(group_member_opt *g)
 {
-	g_return_if_fail(g != NULL && g->gc != NULL && g->member > 0);
+	g_return_if_fail(g != NULL && purple_account_get_connection(g) != NULL && g->member > 0);
 
-	qq_send_packet_get_info(g->gc, g->member, TRUE);	/* we want to see window */
-	purple_request_action(g->gc, NULL, _("Do you want to approve the request?"), "",
+	qq_send_packet_get_info(purple_account_get_connection(g), g->member, TRUE);	/* we want to see window */
+	purple_request_action(purple_account_get_connection(g), NULL, _("Do you want to approve the request?"), "",
 					PURPLE_DEFAULT_ACTION_NONE,
-					purple_connection_get_account(g->gc), NULL, NULL,
+					purple_connection_get_account(purple_account_get_connection(g)), NULL, NULL,
 					g, 2,
 					_("Reject"), G_CALLBACK(qq_group_reject_application_with_struct),
 					_("Approve"), G_CALLBACK(qq_group_approve_application_with_struct));
@@ -107,18 +107,18 @@ void qq_group_reject_application_with_st
 void qq_group_reject_application_with_struct(group_member_opt *g)
 {
 	gchar *msg1, *msg2, *nombre;
-	g_return_if_fail(g != NULL && g->gc != NULL && g->member > 0);
+	g_return_if_fail(g != NULL && purple_account_get_connection(g) != NULL && g->member > 0);
 
 	msg1 = g_strdup_printf(_("You rejected %d's request"), g->member);
 	msg2 = g_strdup(_("Enter your reason:"));
 
 	nombre = uid_to_purple_name(g->member);
-	purple_request_input(g->gc, /* title */ NULL, msg1, msg2,
+	purple_request_input(purple_account_get_connection(g), /* title */ NULL, msg1, msg2,
 			   _("Sorry, you are not my type..."), /* multiline */ TRUE, /* masked */ FALSE,
 			   /* hint */ NULL,
 			   _("Send"), G_CALLBACK(_qq_group_reject_application_real),
 			   _("Cancel"), G_CALLBACK(_qq_group_do_nothing_with_struct),
-			   purple_connection_get_account(g->gc), nombre, NULL,
+			   purple_connection_get_account(purple_account_get_connection(g)), nombre, NULL,
 			   g);
 
 	g_free(msg1);
@@ -129,11 +129,11 @@ void qq_group_approve_application_with_s
 void qq_group_approve_application_with_struct(group_member_opt *g)
 {
 	qq_group *group;
-	g_return_if_fail(g != NULL && g->gc != NULL && g->internal_group_id > 0 && g->member > 0);
-	group = qq_group_find_by_id(g->gc, g->internal_group_id, QQ_INTERNAL_ID);
+	g_return_if_fail(g != NULL && purple_account_get_connection(g) != NULL && g->internal_group_id > 0 && g->member > 0);
+	group = qq_group_find_by_id(purple_account_get_connection(g), g->internal_group_id, QQ_INTERNAL_ID);
 	g_return_if_fail(group != NULL);
-	qq_send_cmd_group_auth(g->gc, group, QQ_GROUP_AUTH_REQUEST_APPROVE, g->member, "");
-	qq_group_find_or_add_member(g->gc, group, g->member);
+	qq_send_cmd_group_auth(purple_account_get_connection(g), group, QQ_GROUP_AUTH_REQUEST_APPROVE, g->member, "");
+	qq_group_find_or_add_member(purple_account_get_connection(g), group, g->member);
 	g_free(g);
 }
 
@@ -325,13 +325,13 @@ static void qq_group_setup_with_gc_and_u
 static void qq_group_setup_with_gc_and_uid(gc_and_uid *g)
 {
 	qq_group *group;
-	g_return_if_fail(g != NULL && g->gc != NULL && g->uid > 0);
+	g_return_if_fail(g != NULL && purple_account_get_connection(g) != NULL && g->uid > 0);
 
-	group = qq_group_find_by_id(g->gc, g->uid, QQ_INTERNAL_ID);
+	group = qq_group_find_by_id(purple_account_get_connection(g), g->uid, QQ_INTERNAL_ID);
 	g_return_if_fail(group != NULL);
 
 	/* TODO insert UI code here */
-	/* qq_group_detail_window_show(g->gc, group); */
+	/* qq_group_detail_window_show(purple_account_get_connection(g), group); */
 	g_free(g);
 }
 
@@ -361,7 +361,7 @@ void qq_group_process_create_group_reply
 	purple_debug(PURPLE_DEBUG_INFO, "QQ", "Succeed in create Qun, external ID %d\n", group->external_group_id);
 
 	g = g_new0(gc_and_uid, 1);
-	g->gc = gc;
+	purple_account_get_connection(g) = gc;
 	g->uid = internal_group_id;
 
 	purple_request_action(gc, _("QQ Qun Operation"),
============================================================
--- libpurple/protocols/qq/im.c	fe965a9243bb9c01da7d7e6fcff1f49f86337b24
+++ libpurple/protocols/qq/im.c	f3172af9eec258873d3a0bf9e7f2d36bbd742003
@@ -308,7 +308,7 @@ static void _qq_process_recv_normal_im_t
 	_qq_show_packet("QQ_MESG recv", data, *cursor - data);
 
 	name = uid_to_purple_name(common->sender_uid);
-	if (purple_find_buddy(gc->account, name) == NULL)
+	if (purple_find_buddy(purple_connection_get_account(gc), name) == NULL)
 		qq_add_buddy_by_recv_packet(gc, common->sender_uid, FALSE, TRUE);
 
 	purple_msg_type = (im_text->msg_type == QQ_IM_AUTO_REPLY) ? PURPLE_MESSAGE_AUTO_RESP : 0;
============================================================
--- libpurple/protocols/qq/keep_alive.c	028329a307b727053d5dbdb45518c183d71dff4b
+++ libpurple/protocols/qq/keep_alive.c	55d0b97bac55292da89f3d61fcce5bf9077144a1
@@ -133,7 +133,7 @@ void qq_update_buddy_contact(PurpleConne
 	g_return_if_fail(q_bud != NULL);
 
 	name = uid_to_purple_name(q_bud->uid);
-	bud = purple_find_buddy(gc->account, name);
+	bud = purple_find_buddy(purple_connection_get_account(gc), name);
 	g_return_if_fail(bud != NULL);
 
 	if (bud != NULL) {
@@ -166,12 +166,12 @@ void qq_update_buddy_contact(PurpleConne
 			break;
 		}
 		purple_debug(PURPLE_DEBUG_INFO, "QQ", "set buddy %d to %s\n", q_bud->uid, status_id);
-		purple_prpl_got_user_status(gc->account, name, status_id, NULL);
+		purple_prpl_got_user_status(purple_connection_get_account(gc), name, status_id, NULL);
 
 		if (q_bud->comm_flag & QQ_COMM_FLAG_BIND_MOBILE && q_bud->status != QQ_BUDDY_OFFLINE)
-			purple_prpl_got_user_status(gc->account, name, "mobile", NULL);
+			purple_prpl_got_user_status(purple_connection_get_account(gc), name, "mobile", NULL);
 		else
-			purple_prpl_got_user_status_deactive(gc->account, name, "mobile");
+			purple_prpl_got_user_status_deactive(purple_connection_get_account(gc), name, "mobile");
 	} else {
 		purple_debug(PURPLE_DEBUG_ERROR, "QQ", "unknown buddy: %d\n", q_bud->uid);
 	}
============================================================
--- libpurple/protocols/qq/login_logout.c	a7117c16ea36489378b3cc0a1248dc2b2ae308d5
+++ libpurple/protocols/qq/login_logout.c	7ec25bb30f5ef7d1e393e506b3ac2d5491542186
@@ -221,7 +221,7 @@ static gint _qq_process_login_ok(PurpleC
 	qd->last_login_time = lrop.last_login_time;
 	qd->last_login_ip = gen_ip_str(lrop.last_client_ip);
 
-	purple_connection_set_state(gc, PURPLE_CONNECTED);
+	purple_connection_set_state(gc, PURPLE_CONNECTION_STATE_CONNECTED);
 	qd->logged_in = TRUE;	/* must be defined after sev_finish_login */
 
 	/* now initiate QQ Qun, do it first as it may take longer to finish */
@@ -273,7 +273,7 @@ static gint _qq_process_login_redirect(P
 		new_server_str = gen_ip_str(lrrp.new_server_ip);
 		purple_debug(PURPLE_DEBUG_WARNING, "QQ",
 			   "Redirected to new server: %s:%d\n", new_server_str, lrrp.new_server_port);
-		qq_connect(gc->account, new_server_str, lrrp.new_server_port, qd->use_tcp, TRUE);
+		qq_connect(purple_connection_get_account(gc), new_server_str, lrrp.new_server_port, qd->use_tcp, TRUE);
 		g_free(new_server_str);
 		ret = QQ_LOGIN_REPLY_REDIRECT;
 	}
@@ -479,8 +479,8 @@ void qq_process_login_reply(guint8 *buf,
 
 	switch (ret) {
 	case QQ_LOGIN_REPLY_PWD_ERROR:
-		if (!purple_account_get_remember_password(gc->account))
-			purple_account_set_password(gc->account, NULL);
+		if (!purple_account_get_remember_password(purple_connection_get_account(gc)))
+			purple_account_set_password(purple_connection_get_account(gc), NULL);
 		purple_connection_error_reason(gc,
 			PURPLE_CONNECTION_ERROR_AUTHENTICATION_FAILED, _("Incorrect password."));
 		break;
============================================================
--- libpurple/protocols/qq/qq.c	3242aa1932271ecf9adc3daa35993f6d8d1ad1df
+++ libpurple/protocols/qq/qq.c	0b0c5521a1c05602359616a6eda43dfa817cbb99
@@ -103,10 +103,10 @@ static void _qq_login(PurpleAccount *acc
 	gc = purple_account_get_connection(account);
 	g_return_if_fail(gc != NULL);
 
-	gc->flags |= PURPLE_CONNECTION_HTML | PURPLE_CONNECTION_NO_BGCOLOR | PURPLE_CONNECTION_AUTO_RESP;
+	gc->flags |= PURPLE_CONNECTION_FLAGS_HTML | PURPLE_CONNECTION_FLAGS_NO_BGCOLOR | PURPLE_CONNECTION_FLAGS_AUTO_RESP;
 
 	qd = g_new0(qq_data, 1);
-	qd->gc = gc;
+	purple_account_get_connection(qd) = gc;
 	gc->proto_data = qd;
 
 	qq_server = purple_account_get_string(account, "server", NULL);
@@ -415,7 +415,7 @@ static void _qq_menu_block_buddy(PurpleB
 	g_return_if_fail(uid > 0);
 
 	g = g_new0(gc_and_uid, 1);
-	g->gc = gc;
+	purple_account_get_connection(g) = gc;
 	g->uid = uid;
 
 	purple_request_action(gc, _("Block Buddy"),
============================================================
--- libpurple/protocols/qq/qq_proxy.c	585d9b3b6549c2deaad7660849a232e6eeff903b
+++ libpurple/protocols/qq/qq_proxy.c	9f001b7aa0fb8a51d4921131fc2800cde744b216
@@ -202,7 +202,7 @@ static void _qq_common_clean(PurpleConne
 	qq_group_free_all(qd);
 	qq_add_buddy_request_free(qd);
 	qq_info_query_free(qd);
-	qq_buddies_list_free(gc->account, qd);
+	qq_buddies_list_free(purple_connection_get_account(gc), qd);
 }
 
 static void no_one_calls(gpointer data, gint source, PurpleInputCondition cond)
@@ -495,7 +495,7 @@ gint qq_proxy_write(qq_data *qd, guint8 
 		ret = send(qd->fd, data, len, 0);
 	}
 	if (ret == -1)
-		purple_connection_error_reason(qd->gc, PURPLE_CONNECTION_ERROR_NETWORK_ERROR, g_strerror(errno));
+		purple_connection_error_reason(purple_account_get_connection(qd), PURPLE_CONNECTION_ERROR_NETWORK_ERROR, g_strerror(errno));
 
 	return ret;
 }
============================================================
--- libpurple/protocols/qq/send_file.c	eaace369ae80103dc17967d6cf0947b3a405992e
+++ libpurple/protocols/qq/send_file.c	295a7ac1310e9a996e8e413d9cf140cb8de5ad65
@@ -811,7 +811,7 @@ void qq_process_recv_file_request(guint8
 		purple_debug(PURPLE_DEBUG_WARNING, "QQ",
 			    "Received a FACE ip detect from qq-%d, so he/she must be online :)\n", sender_uid);
 
-		b = purple_find_buddy(gc->account, sender_name);
+		b = purple_find_buddy(purple_connection_get_account(gc), sender_name);
 		q_bud = (b == NULL) ? NULL : (qq_buddy *) b->proto_data;
 		if (q_bud) {
 			if(0 != info->remote_real_ip) {
@@ -922,7 +922,7 @@ void qq_send_file(PurpleConnection *gc, 
 
 	qd = (qq_data *) gc->proto_data;
 
-	xfer = purple_xfer_new (gc->account, PURPLE_XFER_SEND,
+	xfer = purple_xfer_new (purple_connection_get_account(gc), PURPLE_XFER_SEND,
 			      who);
 	if (xfer)
 	{
============================================================
--- libpurple/protocols/qq/sys_msg.c	ddb215c4828f1b0438eed0b3701cce631a3549b7
+++ libpurple/protocols/qq/sys_msg.c	5e5a6c4c4f69d3ea3f2e6941bec6d2fd2b15a382
@@ -76,7 +76,7 @@ static void _qq_search_before_auth_with_
 
 	g_return_if_fail(g != NULL);
 
-	gc = g->gc;
+	gc = purple_account_get_connection(g);
 	uid = g->uid;
 	g_return_if_fail(gc != 0 && uid != 0);
 
@@ -101,7 +101,7 @@ static void _qq_search_before_add_with_g
 
 	g_return_if_fail(g != NULL);
 
-	gc = g->gc;
+	gc = purple_account_get_connection(g);
 	uid = g->uid;
 	g_return_if_fail(gc != 0 && uid != 0);
 
@@ -159,11 +159,11 @@ static void _qq_process_msg_sys_being_ad
 
 	uid = strtol(from, NULL, 10);
 	name = uid_to_purple_name(uid);
-	b = purple_find_buddy(gc->account, name);
+	b = purple_find_buddy(purple_connection_get_account(gc), name);
 
 	if (b == NULL) {	/* the person is not in my list */
 		g = g_new0(gc_and_uid, 1);
-		g->gc = gc;
+		purple_account_get_connection(g) = gc;
 		g->uid = uid;	/* only need to get value */
 		message = g_strdup_printf(_("You have been added by %s"), from);
 		_qq_sys_msg_log_write(gc, message, from);
@@ -232,7 +232,7 @@ static void _qq_process_msg_sys_add_cont
 
 	uid = strtol(from, NULL, 10);
 	g = g_new0(gc_and_uid, 1);
-	g->gc = gc;
+	purple_account_get_connection(g) = gc;
 	g->uid = uid;
 
 	name = uid_to_purple_name(uid);
@@ -256,10 +256,10 @@ static void _qq_process_msg_sys_add_cont
 	g_free(reason);
 
 	/* XXX: Is this needed once the above goes through purple_account_request_authorization()? */
-	b = purple_find_buddy(gc->account, name);
+	b = purple_find_buddy(purple_connection_get_account(gc), name);
 	if (b == NULL) {	/* the person is not in my list  */
 		g2 = g_new0(gc_and_uid, 1);
-		g2->gc = gc;
+		g2purple_account_get_connection() = gc;
 		g2->uid = strtol(from, NULL, 10);
 		message = g_strdup_printf(_("%s is not in your buddy list"), from);
 		purple_request_action(gc, NULL, message,
============================================================
--- libpurple/protocols/sametime/sametime.c	a7cc50e00c6137944213bdf41474ec8e5ac494f4
+++ libpurple/protocols/sametime/sametime.c	f2931538a486819e39fcf8c76f7a46890a20b017
@@ -340,7 +340,7 @@ static PurpleConnection *session_to_gc(s
   pd = mwSession_getClientData(session);
   g_return_val_if_fail(pd != NULL, NULL);
 
-  return pd->gc;
+  return purple_account_get_connection(pd);
 }
 
 
@@ -414,7 +414,7 @@ static int mw_session_io_write(struct mw
 
   } else if(len > 0) {
     DEBUG_ERROR("write returned %i, %i bytes left unwritten\n", ret, len);
-    purple_connection_error_reason(pd->gc,
+    purple_connection_error_reason(purple_account_get_connection(pd),
                                    PURPLE_CONNECTION_ERROR_NETWORK_ERROR,
                                    _("Connection closed (writing)"));
 
@@ -437,7 +437,7 @@ static void mw_session_io_close(struct m
   pd = mwSession_getClientData(session);
   g_return_if_fail(pd != NULL);
 
-  gc = pd->gc;
+  gc = purple_account_get_connection(pd);
   
   if(pd->outpa) {
     purple_input_remove(pd->outpa);
@@ -632,7 +632,7 @@ list_ensure(struct mwPurplePluginData *p
   list = g_hash_table_lookup(pd->group_list_map, group);
   if(! list) {
     list = mwAwareList_new(pd->srvc_aware, &mw_aware_list_handler);
-    mwAwareList_setClientData(list, pd->gc, NULL);
+    mwAwareList_setClientData(list, purple_account_get_connection(pd), NULL);
     
     mwAwareList_watchAttributes(list,
 				mwAttribute_AV_PREFS_SET,
@@ -729,7 +729,7 @@ static void blist_export(PurpleConnectio
 	  if(! utype) utype = mwSametimeUser_NORMAL;
 
 	  stu = mwSametimeUser_new(stg, utype, &idb);
-	  mwSametimeUser_setShortName(stu, bdy->server_alias);
+	  mwSametimeUser_setShortName(stu, purple_buddy_get_server_alias(bdy));
 	  mwSametimeUser_setAlias(stu, bdy->alias);
 	}
       }
@@ -754,7 +754,7 @@ static void blist_store(struct mwPurpleP
   srvc = pd->srvc_store;
   g_return_if_fail(srvc != NULL);
 
-  gc = pd->gc;
+  gc = purple_account_get_connection(pd);
 
   if(BLIST_PREF_IS_LOCAL() || BLIST_PREF_IS_MERGE()) {
     DEBUG_INFO("preferences indicate not to save remote blist\n");
@@ -1225,10 +1225,10 @@ static void fetch_blist_cb(struct mwServ
 
   /* merge or synch depending on preferences */
   if(BLIST_PREF_IS_MERGE() || BLIST_PREF_IS_STORE()) {
-    blist_merge(pd->gc, stlist);
+    blist_merge(purple_account_get_connection(pd), stlist);
 
   } else if(BLIST_PREF_IS_SYNCH()) {
-    blist_sync(pd->gc, stlist);
+    blist_sync(purple_account_get_connection(pd), stlist);
   }
 
   mwSametimeList_free(stlist);
@@ -1253,7 +1253,7 @@ static void conversation_created_cb(Purp
   struct mwConversation *conv;
 
   gc = purple_conversation_get_gc(g_conv);
-  if(pd->gc != gc)
+  if(purple_account_get_connection(pd) != gc)
     return; /* not ours */
 
   if(purple_conversation_get_type(g_conv) != PURPLE_CONV_TYPE_IM)
@@ -1280,7 +1280,7 @@ static void blist_menu_nab(PurpleBlistNo
 
   g_return_if_fail(pd != NULL);
 
-  gc = pd->gc;
+  gc = purple_account_get_connection(pd);
   g_return_if_fail(gc != NULL);
 
   g_return_if_fail(PURPLE_BLIST_NODE_IS_GROUP(node));
@@ -1316,7 +1316,7 @@ static void blist_node_menu_cb(PurpleBli
   if(! PURPLE_BLIST_NODE_IS_GROUP(node)) return;
   group = (PurpleGroup *) node;
 
-  acct = purple_connection_get_account(pd->gc);
+  acct = purple_connection_get_account(purple_account_get_connection(pd));
   g_return_if_fail(acct != NULL);
 
   /* better make sure we're connected */
@@ -1384,7 +1384,7 @@ static void services_starting(struct mwP
   PurpleBuddyList *blist;
   PurpleBlistNode *l;
 
-  gc = pd->gc;
+  gc = purple_account_get_connection(pd);
   acct = purple_connection_get_account(gc);
 
   /* grab the buddy list from the server */
@@ -1436,7 +1436,7 @@ static void session_loginRedirect(struct
   const char *current_host;
 
   pd = mwSession_getClientData(session);
-  gc = pd->gc;
+  gc = purple_account_get_connection(pd);
   account = purple_connection_get_account(gc);
   port = purple_account_get_int(account, MW_KEY_PORT, MW_PLUGIN_DEFAULT_PORT);
   current_host = purple_account_get_string(account, MW_KEY_HOST,
@@ -1466,7 +1466,7 @@ static void session_started(struct mwPur
   PurpleAccount *acct;
 
   /* set out initial status */
-  acct = purple_connection_get_account(pd->gc);
+  acct = purple_connection_get_account(purple_account_get_connection(pd));
   status = purple_account_get_active_status(acct);
   mw_prpl_set_status(acct, status);
   
@@ -1499,7 +1499,7 @@ static void mw_session_stateChange(struc
   const char *msg = NULL;
 
   pd = mwSession_getClientData(session);
-  gc = pd->gc;
+  gc = purple_account_get_connection(pd);
 
   switch(state) {
   case mwSession_STARTING:
@@ -1545,7 +1545,7 @@ static void mw_session_stateChange(struc
 
     msg = _("Connected");
     purple_connection_update_progress(gc, msg, 10, MW_CONNECT_STEPS);
-    purple_connection_set_state(gc, PURPLE_CONNECTED);
+    purple_connection_set_state(gc, PURPLE_CONNECTION_STATE_CONNECTED);
     break;
 
   case mwSession_STOPPING:
@@ -1615,7 +1615,7 @@ static void mw_session_setPrivacyInfo(st
   pd = mwSession_getClientData(session);
   g_return_if_fail(pd != NULL);
 
-  gc = pd->gc;
+  gc = purple_account_get_connection(pd);
   g_return_if_fail(gc != NULL);
 
   acct = purple_connection_get_account(gc);
@@ -1648,7 +1648,7 @@ static void mw_session_setUserStatus(str
   pd = mwSession_getClientData(session);
   g_return_if_fail(pd != NULL);
 
-  gc = pd->gc;
+  gc = purple_account_get_connection(pd);
   g_return_if_fail(gc != NULL);
 
   idb.user = mwSession_getProperty(session, mwSession_AUTH_USER_ID);
@@ -1727,15 +1727,15 @@ static void read_cb(gpointer data, gint 
     pd->socket = 0;
   }
 
-  if(pd->gc->inpa) {
-    purple_input_remove(pd->gc->inpa);
-    pd->gc->inpa = 0;
+  if(purple_account_get_connection(pd)->inpa) {
+    purple_input_remove(purple_account_get_connection(pd)->inpa);
+    purple_account_get_connection(pd)->inpa = 0;
   }
 
   if(! ret) {
     const char *msg = _("Connection reset");
     DEBUG_INFO("connection reset\n");
-    purple_connection_error_reason(pd->gc,
+    purple_connection_error_reason(purple_account_get_connection(pd),
                                    PURPLE_CONNECTION_ERROR_NETWORK_ERROR,
                                    msg);
 
@@ -1746,7 +1746,7 @@ static void read_cb(gpointer data, gint 
     DEBUG_INFO("error in read callback: %s\n", err_str);
 
     msg = g_strdup_printf(_("Error reading from socket: %s"), err_str);
-    purple_connection_error_reason(pd->gc,
+    purple_connection_error_reason(purple_account_get_connection(pd),
                                    PURPLE_CONNECTION_ERROR_NETWORK_ERROR,
                                    msg);
     g_free(msg);
@@ -1759,7 +1759,7 @@ static void connect_cb(gpointer data, gi
 static void connect_cb(gpointer data, gint source, const gchar *error_message) {
 
   struct mwPurplePluginData *pd = data;
-  PurpleConnection *gc = pd->gc;
+  PurpleConnection *gc = purple_account_get_connection(pd);
 
   if(source < 0) {
     /* connection failed */
@@ -1771,7 +1771,7 @@ static void connect_cb(gpointer data, gi
     } else {
       /* this is a regular connect, error out */
       const char *msg = _("Unable to connect to host");
-      purple_connection_error_reason(pd->gc,
+      purple_connection_error_reason(purple_account_get_connection(pd),
                                      PURPLE_CONNECTION_ERROR_NETWORK_ERROR,
                                      msg);
     }
@@ -1804,7 +1804,7 @@ static void mw_session_announce(struct m
   char *msg;
   
   pd = mwSession_getClientData(s);
-  acct = purple_connection_get_account(pd->gc);
+  acct = purple_connection_get_account(purple_account_get_connection(pd));
   conv = purple_find_conversation_with_account(PURPLE_CONV_TYPE_IM, who, acct);
   if(! conv) conv = purple_conversation_new(PURPLE_CONV_TYPE_IM, acct, who);
 
@@ -1874,7 +1874,7 @@ static void mw_conf_invited(struct mwCon
   srvc = mwConference_getService(conf);
   session = mwService_getSession(MW_SERVICE(srvc));
   pd = mwSession_getClientData(session);
-  gc = pd->gc;
+  gc = purple_account_get_connection(pd);
 
   ht = g_hash_table_new_full(g_str_hash, g_str_equal, NULL, g_free);
 
@@ -1952,7 +1952,7 @@ static void mw_conf_opened(struct mwConf
   srvc = mwConference_getService(conf);
   session = mwService_getSession(MW_SERVICE(srvc));
   pd = mwSession_getClientData(session);
-  gc = pd->gc;
+  gc = purple_account_get_connection(pd);
 
   if(! t) t = "(no title)";
   g_conf = serv_got_joined_chat(gc, CONF_TO_ID(conf), t);
@@ -1981,7 +1981,7 @@ static void mw_conf_closed(struct mwConf
   srvc = mwConference_getService(conf);
   session = mwService_getSession(MW_SERVICE(srvc));
   pd = mwSession_getClientData(session);
-  gc = pd->gc;
+  gc = purple_account_get_connection(pd);
 
   serv_got_chat_left(gc, CONF_TO_ID(conf));
 
@@ -2006,7 +2006,7 @@ static void mw_conf_peer_joined(struct m
   srvc = mwConference_getService(conf);
   session = mwService_getSession(MW_SERVICE(srvc));
   pd = mwSession_getClientData(session);
-  gc = pd->gc;
+  gc = purple_account_get_connection(pd);
 
   g_conf = mwConference_getClientData(conf);
   g_return_if_fail(g_conf != NULL);
@@ -2032,7 +2032,7 @@ static void mw_conf_peer_parted(struct m
   srvc = mwConference_getService(conf);
   session = mwService_getSession(MW_SERVICE(srvc));
   pd = mwSession_getClientData(session);
-  gc = pd->gc;
+  gc = purple_account_get_connection(pd);
 
   g_conf = mwConference_getClientData(conf);
   g_return_if_fail(g_conf != NULL);
@@ -2055,7 +2055,7 @@ static void mw_conf_text(struct mwConfer
   srvc = mwConference_getService(conf);
   session = mwService_getSession(MW_SERVICE(srvc));
   pd = mwSession_getClientData(session);
-  gc = pd->gc;
+  gc = purple_account_get_connection(pd);
 
   esc = g_markup_escape_text(text, -1);
   serv_got_chat_in(gc, CONF_TO_ID(conf), who->user_id, 0, esc, time(NULL));
@@ -2157,7 +2157,7 @@ static void mw_ft_offered(struct mwFileT
   srvc = mwFileTransfer_getService(ft);
   session = mwService_getSession(MW_SERVICE(srvc));
   pd = mwSession_getClientData(session);
-  gc = pd->gc;
+  gc = purple_account_get_connection(pd);
   acct = purple_connection_get_account(gc);
 
   who = mwFileTransfer_getUser(ft)->user;
@@ -2403,7 +2403,7 @@ static PurpleConversation *convo_get_gco
   srvc = mwConversation_getService(conv);
   session = mwService_getSession(MW_SERVICE(srvc));
   pd = mwSession_getClientData(session);
-  gc = pd->gc;
+  gc = purple_account_get_connection(pd);
   acct = purple_connection_get_account(gc);
 
   idb = mwConversation_getTarget(conv);
@@ -2517,15 +2517,15 @@ static void convo_features(struct mwConv
 
   if(mwConversation_isOpen(conv)) {
     if(mwConversation_supports(conv, mwImSend_HTML)) {
-      feat |= PURPLE_CONNECTION_HTML;
+      feat |= PURPLE_CONNECTION_FLAGS_HTML;
     } else {
-      feat &= ~PURPLE_CONNECTION_HTML;
+      feat &= ~PURPLE_CONNECTION_FLAGS_HTML;
     }
 
     if(mwConversation_supports(conv, mwImSend_MIME)) {
-      feat &= ~PURPLE_CONNECTION_NO_IMAGES;
+      feat &= ~PURPLE_CONNECTION_FLAGS_NO_IMAGES;
     } else {
-      feat |= PURPLE_CONNECTION_NO_IMAGES;
+      feat |= PURPLE_CONNECTION_FLAGS_NO_IMAGES;
     }
 
     DEBUG_INFO("conversation features set to 0x%04x\n", feat);
@@ -2549,7 +2549,7 @@ static void mw_conversation_opened(struc
   srvc = mwConversation_getService(conv);
   session = mwService_getSession(MW_SERVICE(srvc));
   pd = mwSession_getClientData(session);
-  gc = pd->gc;
+  gc = purple_account_get_connection(pd);
   acct = purple_connection_get_account(gc);
 
   /* set up the queue */
@@ -2628,7 +2628,7 @@ static void im_recv_text(struct mwConver
   t = txt? txt: msg;
 
   esc = g_markup_escape_text(t, -1);
-  serv_got_im(pd->gc, idb->user, esc, 0, time(NULL));
+  serv_got_im(purple_account_get_connection(pd), idb->user, esc, 0, time(NULL));
   g_free(esc);
 
   g_free(txt);
@@ -2642,7 +2642,7 @@ static void im_recv_typing(struct mwConv
   struct mwIdBlock *idb;
   idb = mwConversation_getTarget(conv);
 
-  serv_got_typing(pd->gc, idb->user, 0,
+  serv_got_typing(purple_account_get_connection(pd), idb->user, 0,
 		  typing? PURPLE_TYPING: PURPLE_NOT_TYPING);
 }
 
@@ -2664,7 +2664,7 @@ static void im_recv_html(struct mwConver
   t2 = purple_utf8_ncr_decode(t);
   t = t2? t2: t;
 
-  serv_got_im(pd->gc, idb->user, t, 0, time(NULL));
+  serv_got_im(purple_account_get_connection(pd), idb->user, t, 0, time(NULL));
 
   g_free(t1);
   g_free(t2);
@@ -2891,7 +2891,7 @@ static void mw_place_invite(struct mwCon
 
   if(! title) title = "(no title)";
   if(! message) message = "(no message)";
-  serv_got_chat_invite(pd->gc, title, idb->user, message, ht);
+  serv_got_chat_invite(purple_account_get_connection(pd), title, idb->user, message, ht);
 
   mwConversation_close(conv, ERR_SUCCESS);
   mwConversation_free(conv);
@@ -2967,7 +2967,7 @@ static void mw_place_opened(struct mwPla
   srvc = mwPlace_getService(place);
   session = mwService_getSession(MW_SERVICE(srvc));
   pd = mwSession_getClientData(session);
-  gc = pd->gc;
+  gc = purple_account_get_connection(pd);
 
   members = mwPlace_getMembers(place);
 
@@ -3002,7 +3002,7 @@ static void mw_place_closed(struct mwPla
   srvc = mwPlace_getService(place);
   session = mwService_getSession(MW_SERVICE(srvc));
   pd = mwSession_getClientData(session);
-  gc = pd->gc;
+  gc = purple_account_get_connection(pd);
 
   serv_got_chat_left(gc, PLACE_TO_ID(place));
 
@@ -3026,7 +3026,7 @@ static void mw_place_peerJoined(struct m
   srvc = mwPlace_getService(place);
   session = mwService_getSession(MW_SERVICE(srvc));
   pd = mwSession_getClientData(session);
-  gc = pd->gc;
+  gc = purple_account_get_connection(pd);
 
   gconf = mwPlace_getClientData(place);
   g_return_if_fail(gconf != NULL);
@@ -3051,7 +3051,7 @@ static void mw_place_peerParted(struct m
   srvc = mwPlace_getService(place);
   session = mwService_getSession(MW_SERVICE(srvc));
   pd = mwSession_getClientData(session);
-  gc = pd->gc;
+  gc = purple_account_get_connection(pd);
 
   gconf = mwPlace_getClientData(place);
   g_return_if_fail(gconf != NULL);
@@ -3088,7 +3088,7 @@ static void mw_place_message(struct mwPl
   srvc = mwPlace_getService(place);
   session = mwService_getSession(MW_SERVICE(srvc));
   pd = mwSession_getClientData(session);
-  gc = pd->gc;
+  gc = purple_account_get_connection(pd);
 
   esc = g_markup_escape_text(msg, -1);
   serv_got_chat_in(gc, PLACE_TO_ID(place), who->user, 0, esc, time(NULL));
@@ -3141,7 +3141,7 @@ static struct mwPurplePluginData *mwPurp
   g_return_val_if_fail(gc != NULL, NULL);
 
   pd = g_new0(struct mwPurplePluginData, 1);
-  pd->gc = gc;
+  purple_account_get_connection(pd) = gc;
   pd->session = mwSession_new(&mw_session_handler);
   pd->srvc_aware = mw_srvc_aware_new(pd->session);
   pd->srvc_conf = mw_srvc_conf_new(pd->session);
@@ -3174,7 +3174,7 @@ static void mwPurplePluginData_free(stru
 static void mwPurplePluginData_free(struct mwPurplePluginData *pd) {
   g_return_if_fail(pd != NULL);
 
-  pd->gc->proto_data = NULL;
+  purple_account_get_connection(pd)->proto_data = NULL;
 
   mwSession_removeService(pd->session, mwService_AWARE);
   mwSession_removeService(pd->session, mwService_CONFERENCE);
@@ -3714,7 +3714,7 @@ static void mw_prpl_login(PurpleAccount 
   pd = mwPurplePluginData_new(gc);
 
   /* while we do support images, the default is to not offer it */
-  gc->flags |= PURPLE_CONNECTION_NO_IMAGES;
+  gc->flags |= PURPLE_CONNECTION_FLAGS_NO_IMAGES;
 
   user = g_strdup(purple_account_get_username(account));
   pass = g_strdup(purple_account_get_password(account));
@@ -4178,8 +4178,8 @@ static void mw_prpl_get_info(PurpleConne
   if(b) {
     guint32 type;
 
-    if(b->server_alias) {
-		purple_notify_user_info_add_pair(user_info, _("Full Name"), b->server_alias);
+    if(purple_buddy_get_server_alias(b)) {
+		purple_notify_user_info_add_pair(user_info, _("Full Name"), purple_buddy_get_server_alias(b));
     }
 
     type = purple_blist_node_get_int((PurpleBlistNode *) b, BUDDY_KEY_CLIENT);
@@ -5350,7 +5350,7 @@ static void remote_group_done(struct mwP
 
   g_return_if_fail(pd != NULL);
 
-  gc = pd->gc;
+  gc = purple_account_get_connection(pd);
   acct = purple_connection_get_account(gc);
   
   /* collision checking */
@@ -5416,7 +5416,7 @@ static void remote_group_multi(struct mw
   const char *msgB;
   char *msg;
 
-  PurpleConnection *gc = pd->gc;
+  PurpleConnection *gc = purple_account_get_connection(pd);
 
   fields = purple_request_fields_new();
 
@@ -5471,7 +5471,7 @@ static void remote_group_resolved(struct
   pd = mwSession_getClientData(session);
   g_return_if_fail(pd != NULL);
 
-  gc = pd->gc;
+  gc = purple_account_get_connection(pd);
   g_return_if_fail(gc != NULL);
   
   if(!code && results) {
============================================================
--- libpurple/protocols/silc/buddy.c	64cd6b56d67dab2995b54587f6ecb605fb431a55
+++ libpurple/protocols/silc/buddy.c	d752e276e3463444bd0882665bf2a43fe1ae004f
@@ -165,7 +165,7 @@ silcpurple_buddy_keyagr_do(PurpleConnect
 		if (!r)
 			return;
 		r->nick = g_strdup(name);
-		r->gc = gc;
+		purple_account_get_connection(r) = gc;
 		silc_client_get_clients(sg->client, sg->conn, name, NULL,
 					silcpurple_buddy_keyagr_resolved, r);
 		return;
@@ -313,7 +313,7 @@ void silcpurple_buddy_keyagr_request(Sil
 	a->port = port;
 
 	purple_request_action(client->application, _("Key Agreement Request"), tmp,
-			      hostname ? tmp2 : NULL, 1, gc->account, client_entry->nickname,
+			      hostname ? tmp2 : NULL, 1, purple_connection_get_account(gc), client_entry->nickname,
 			      NULL, a, 2, _("Yes"), G_CALLBACK(silcpurple_buddy_keyagr_request_cb),
 			      _("No"), G_CALLBACK(silcpurple_buddy_keyagr_request_cb));
 }
@@ -324,7 +324,7 @@ silcpurple_buddy_keyagr(PurpleBlistNode 
 	PurpleBuddy *buddy;
 
 	buddy = (PurpleBuddy *)node;
-	silcpurple_buddy_keyagr_do(buddy->account->gc, buddy->name, FALSE);
+	silcpurple_buddy_keyagr_do(purple_account_get_connection(buddy->account), buddy->name, FALSE);
 }
 
 
@@ -453,7 +453,7 @@ silcpurple_buddy_privkey(PurpleConnectio
 	                     _("Set IM Password"), NULL, FALSE, TRUE, NULL,
 	                     _("OK"), G_CALLBACK(silcpurple_buddy_privkey_cb),
 	                     _("Cancel"), G_CALLBACK(silcpurple_buddy_privkey_cb),
-	                     gc->account, NULL, NULL, p);
+	                     purple_connection_get_account(gc), NULL, NULL, p);
 
 	silc_client_list_free(sg->client, sg->conn, clients);
 }
@@ -682,7 +682,7 @@ void silcpurple_get_info(PurpleConnectio
 	if (strlen(who) > 2 && who[0] == '*' && who[1] == '@')
 		nick = who + 2;
 
-	b = purple_find_buddy(gc->account, nick);
+	b = purple_find_buddy(purple_connection_get_account(gc), nick);
 	if (b) {
 		/* See if we have this buddy's public key.  If we do use that
 		   to search the details. */
@@ -1175,7 +1175,7 @@ silcpurple_add_buddy_select(SilcPurpleBu
 		}
 		g_snprintf(tmp, sizeof(tmp), "%s - %s (%s@%s)%s",
 			   client_entry->realname, client_entry->nickname,
-			   client_entry->username, *client_entry->hostname ?
+			   client_purple_account_get_username(entry), *client_entry->hostname ?
 			   client_entry->hostname : "",
 			   fingerprint ? tmp2 : "");
 		purple_request_field_list_add(f, tmp, client_entry);
@@ -1457,7 +1457,7 @@ char *silcpurple_status_text(PurpleBuddy
 
 char *silcpurple_status_text(PurpleBuddy *b)
 {
-	SilcPurple sg = b->account->gc->proto_data;
+	SilcPurple sg = purple_account_get_connection(b->account)->proto_data;
 	SilcClient client = sg->client;
 	SilcClientConnection conn = sg->conn;
 	SilcClientID *client_id = b->proto_data;
@@ -1521,7 +1521,7 @@ void silcpurple_tooltip_text(PurpleBuddy
 
 void silcpurple_tooltip_text(PurpleBuddy *b, PurpleNotifyUserInfo *user_info, gboolean full)
 {
-	SilcPurple sg = b->account->gc->proto_data;
+	SilcPurple sg = purple_account_get_connection(b->account)->proto_data;
 	SilcClient client = sg->client;
 	SilcClientConnection conn = sg->conn;
 	SilcClientID *client_id = b->proto_data;
@@ -1537,8 +1537,8 @@ void silcpurple_tooltip_text(PurpleBuddy
 	if (client_entry->nickname)
 		purple_notify_user_info_add_pair(user_info, _("Nickname"),
 					       client_entry->nickname);
-	if (client_entry->username && client_entry->hostname) {
-		g_snprintf(tmp, sizeof(tmp), "%s@%s", client_entry->username, client_entry->hostname);
+	if (client_purple_account_get_username(entry) && client_entry->hostname) {
+		g_snprintf(tmp, sizeof(tmp), "%s@%s", client_purple_account_get_username(entry), client_entry->hostname);
 		purple_notify_user_info_add_pair(user_info, _("Username"), tmp);
 	}
 	if (client_entry->mode) {
============================================================
--- libpurple/protocols/silc/chat.c	0146868e917dfab3a6b6792ae57b00381ef8a94e
+++ libpurple/protocols/silc/chat.c	29f23eb2374c1d779ab525853311fe84aa662234
@@ -183,7 +183,7 @@ silcpurple_chat_getinfo_menu(PurpleBlist
 silcpurple_chat_getinfo_menu(PurpleBlistNode *node, gpointer data)
 {
 	PurpleChat *chat = (PurpleChat *)node;
-	silcpurple_chat_getinfo(chat->account->gc, chat->components);
+	silcpurple_chat_getinfo(purple_account_get_connection(chat->account), chat->components);
 }
 
 
@@ -303,10 +303,10 @@ silcpurple_chat_chpk_cb(SilcPurpleChauth
 	f = purple_request_fields_get_field(fields, "list");
 	if (!purple_request_field_list_get_selected(f)) {
 		/* Add new public key */
-		purple_request_file(sg->gc, _("Open Public Key..."), NULL, FALSE,
+		purple_request_file(purple_account_get_connection(sg), _("Open Public Key..."), NULL, FALSE,
 				    G_CALLBACK(silcpurple_chat_chpk_add),
 				    G_CALLBACK(silcpurple_chat_chpk_cancel),
-				    purple_connection_get_account(sg->gc), NULL, NULL, sgc);
+				    purple_connection_get_account(purple_account_get_connection(sg)), NULL, NULL, sgc);
 		return;
 	}
 
@@ -443,11 +443,11 @@ void silcpurple_chat_chauth_show(SilcPur
 	if (!channel_pubkeys || !silc_dlist_count(channel_pubkeys)) {
 		f = purple_request_field_list_new("list", NULL);
 		purple_request_field_group_add_field(g, f);
-		purple_request_fields(sg->gc, _("Channel Authentication"),
+		purple_request_fields(purple_account_get_connection(sg), _("Channel Authentication"),
 				      _("Channel Authentication"), t, fields,
 				      _("Add / Remove"), G_CALLBACK(silcpurple_chat_chpk_cb),
 				      _("OK"), G_CALLBACK(silcpurple_chat_chauth_ok),
-				      purple_connection_get_account(sg->gc), NULL, NULL, sgc);
+				      purple_connection_get_account(purple_account_get_connection(sg)), NULL, NULL, sgc);
 		if (channel_pubkeys)
 		  silc_dlist_uninit(channel_pubkeys);
 		return;
@@ -471,8 +471,8 @@ void silcpurple_chat_chauth_show(SilcPur
 		ident = &silc_pubkey->identifier;
 
 		g_snprintf(tmp2, sizeof(tmp2), "%s\n  %s\n  %s",
-			   ident->realname ? ident->realname : ident->username ?
-			   ident->username : "", fingerprint, babbleprint);
+			   ident->realname ? ident->realname : purple_account_get_username(ident) ?
+			   purple_account_get_username(ident) : "", fingerprint, babbleprint);
 		purple_request_field_list_add(f, tmp2, public_key);
 
 		silc_free(fingerprint);
@@ -480,11 +480,11 @@ void silcpurple_chat_chauth_show(SilcPur
 	}
 
 	purple_request_field_list_set_multi_select(f, FALSE);
-	purple_request_fields(sg->gc, _("Channel Authentication"),
+	purple_request_fields(purple_account_get_connection(sg), _("Channel Authentication"),
 			      _("Channel Authentication"), t, fields,
 			      _("Add / Remove"), G_CALLBACK(silcpurple_chat_chpk_cb),
 			      _("OK"), G_CALLBACK(silcpurple_chat_chauth_ok),
-			      purple_connection_get_account(sg->gc), NULL, NULL, sgc);
+			      purple_connection_get_account(purple_account_get_connection(sg)), NULL, NULL, sgc);
 }
 
 static void
@@ -557,7 +557,7 @@ silcpurple_chat_prv_add(SilcPurpleCharPr
 	purple_blist_node_set_string((PurpleBlistNode *)cn, "parentch", p->channel);
 
 	/* Join the group */
-	silcpurple_chat_join(sg->gc, comp);
+	silcpurple_chat_join(purple_account_get_connection(sg), comp);
 
 	silc_free(p);
 }
============================================================
--- libpurple/protocols/silc/ft.c	b36bcbd1f726e2c0906f62d8975b8a0299874302
+++ libpurple/protocols/silc/ft.c	6e8ef4bc6b7e061720808b53fd66e9b19c86de4f
@@ -70,7 +70,7 @@ silcpurple_ftp_monitor(SilcClient client
 		     void *context)
 {
 	SilcPurpleXfer xfer = context;
-	PurpleConnection *gc = xfer->sg->gc;
+	PurpleConnection *gc = purple_account_get_connection(xfer->sg);
 	char tmp[256];
 
 	if (status == SILC_CLIENT_FILE_MONITOR_CLOSED) {
@@ -213,7 +213,7 @@ silcpurple_ftp_request_result(PurpleXfer
 {
 	SilcPurpleXfer xfer = x->data;
 	SilcClientFileError status;
-	PurpleConnection *gc = xfer->sg->gc;
+	PurpleConnection *gc = purple_account_get_connection(xfer->sg);
 	SilcClientConnectionParams params;
 	gboolean local = xfer->hostname ? FALSE : TRUE;
 	char *local_ip = NULL, *remote_ip = NULL;
============================================================
--- libpurple/protocols/silc/ops.c	19f5e64698139b4a8b9fa8b2dc43b606b41799ff
+++ libpurple/protocols/silc/ops.c	cf8123ad6eb20c5c9e22a60c8405b8a2012edadf
@@ -467,7 +467,7 @@ silc_notify(SilcClient client, SilcClien
 
 		/* Join user to channel */
 		g_snprintf(buf, sizeof(buf), "%s@%s",
-			   client_entry->username, client_entry->hostname);
+			   client_purple_account_get_username(entry), client_entry->hostname);
 		purple_conv_chat_add_user(PURPLE_CONV_CHAT(convo),
 					  g_strdup(client_entry->nickname), buf, PURPLE_CBFLAGS_NONE, TRUE);
 
@@ -853,7 +853,7 @@ silc_notify(SilcClient client, SilcClien
 							if (!PURPLE_BLIST_NODE_IS_BUDDY(bnode))
 								continue;
 							b = (PurpleBuddy *)bnode;
-							if (b->account != gc->account)
+							if (b->account != purple_connection_get_account(gc))
 								continue;
 							f = purple_blist_node_get_string(bnode, "public-key");
 							if (f && !strcmp(f, buf))
@@ -1190,7 +1190,7 @@ silc_command_reply(SilcClient client, Si
 				purple_notify_user_info_add_pair(user_info, _("Real Name"), tmp2);
 				g_free(tmp2);
 			}
-			tmp2 = g_markup_escape_text(client_entry->username, -1);
+			tmp2 = g_markup_escape_text(client_purple_account_get_username(entry), -1);
 			if (*client_entry->hostname) {
 				gchar *tmp3;
 				tmp3 = g_strdup_printf("%s@%s", tmp2, client_entry->hostname);
@@ -1291,7 +1291,7 @@ silc_command_reply(SilcClient client, Si
 						_("User Information"),
 						buf, 1, client_entry, 2,
 						_("OK"), G_CALLBACK(silcpurple_whois_more),
-						_("_More..."), G_CALLBACK(silcpurple_whois_more), gc->account, NULL, NULL);
+						_("_More..."), G_CALLBACK(silcpurple_whois_more), purple_connection_get_account(gc), NULL, NULL);
 			else
 #endif /* 0 */
 			purple_notify_userinfo(gc, client_entry->nickname, user_info, NULL, NULL);
============================================================
--- libpurple/protocols/silc/silc.c	4cb66f395a6bdf6182066e20e242c18165b06ade
+++ libpurple/protocols/silc/silc.c	355db4c285596589295f6cc872721f8baff2be89
@@ -258,7 +258,7 @@ silcpurple_connect_cb(SilcClient client,
 		sg->conn = conn;
 
 		/* Connection created successfully */
-		purple_connection_set_state(gc, PURPLE_CONNECTED);
+		purple_connection_set_state(gc, PURPLE_CONNECTION_STATE_CONNECTED);
 
 		/* Send the server our buddy list */
 		silcpurple_send_buddylist(gc);
@@ -436,7 +436,7 @@ static void silcpurple_running(SilcClien
 static void silcpurple_running(SilcClient client, void *context)
 {
 	SilcPurple sg = context;
-	PurpleConnection *gc = sg->gc;
+	PurpleConnection *gc = purple_account_get_connection(sg);
 	PurpleAccount *account = purple_connection_get_account(gc);
 	char pkd[256], prd[256];
 
@@ -449,7 +449,7 @@ static void silcpurple_running(SilcClien
 	g_snprintf(prd, sizeof(prd), "%s" G_DIR_SEPARATOR_S "private_key.prv", silcpurple_silcdir());
 	if (!silc_load_key_pair((char *)purple_account_get_string(account, "public-key", pkd),
 				(char *)purple_account_get_string(account, "private-key", prd),
-				(gc->password == NULL) ? "" : gc->password,
+				(purple_connection_get_password(gc) == NULL) ? "" : purple_connection_get_password(gc),
 				&sg->public_key, &sg->private_key)) {
 		purple_connection_error_reason(gc, PURPLE_CONNECTION_ERROR_OTHER_ERROR,
 		                             _("Could not load SILC key pair"));
@@ -484,7 +484,7 @@ silcpurple_login(PurpleAccount *account)
 	char *username, *hostname, *realname, **up;
 	int i;
 
-	gc = account->gc;
+	gc = purple_account_get_connection(account);
 	if (!gc)
 		return;
 	gc->proto_data = NULL;
@@ -539,7 +539,7 @@ silcpurple_login(PurpleAccount *account)
 	if (!sg)
 		return;
 	sg->client = client;
-	sg->gc = gc;
+	purple_account_get_connection(sg) = gc;
 	sg->account = account;
 	gc->proto_data = sg;
 
@@ -964,7 +964,7 @@ silcpurple_attrs(PurplePluginAction *act
 			    fields,
 			    _("OK"), G_CALLBACK(silcpurple_attrs_cb),
 			    _("Cancel"), G_CALLBACK(silcpurple_attrs_cancel),
-				gc->account, NULL, NULL, gc);
+				purple_connection_get_account(gc), NULL, NULL, gc);
 }
 
 static void
@@ -1129,9 +1129,9 @@ silcpurple_create_keypair(PurplePluginAc
 	g_snprintf(pkd2, sizeof(pkd2), "%s" G_DIR_SEPARATOR_S"public_key.pub", silcpurple_silcdir());
 	g_snprintf(prd2, sizeof(prd2), "%s" G_DIR_SEPARATOR_S"private_key.prv", silcpurple_silcdir());
 	g_snprintf(pkd, sizeof(pkd) - 1, "%s",
-		   purple_account_get_string(gc->account, "public-key", pkd2));
+		   purple_account_get_string(purple_connection_get_account(gc), "public-key", pkd2));
 	g_snprintf(prd, sizeof(prd) - 1, "%s",
-		   purple_account_get_string(gc->account, "private-key", prd2));
+		   purple_account_get_string(purple_connection_get_account(gc), "private-key", prd2));
 
 	fields = purple_request_fields_new();
 
@@ -1172,7 +1172,7 @@ silcpurple_create_keypair(PurplePluginAc
 			      _("Create New SILC Key Pair"), NULL, fields,
 			      _("Generate Key Pair"), G_CALLBACK(silcpurple_create_keypair_cb),
 			      _("Cancel"), G_CALLBACK(silcpurple_create_keypair_cancel),
-			      gc->account, NULL, NULL, gc);
+			      purple_connection_get_account(gc), NULL, NULL, gc);
 
 	g_strfreev(u);
 	silc_free(hostname);
@@ -1190,7 +1190,7 @@ silcpurple_change_passwd(PurpleConnectio
 {
         char prd[256];
 	g_snprintf(prd, sizeof(prd), "%s" G_DIR_SEPARATOR_S "private_key.pub", silcpurple_silcdir());
-	silc_change_private_key_passphrase(purple_account_get_string(gc->account,
+	silc_change_private_key_passphrase(purple_account_get_string(purple_connection_get_account(gc),
 								     "private-key",
 								     prd), old, new);
 }
@@ -1452,7 +1452,7 @@ static PurpleCmdRet silcpurple_cmd_chat_
 
 	if(args && args[0])
 		convo = purple_find_conversation_with_account(PURPLE_CONV_TYPE_CHAT, args[0],
-									gc->account);
+									purple_connection_get_account(gc));
 
 	if (convo != NULL)
 		id = purple_conv_chat_get_id(PURPLE_CONV_CHAT(convo));
@@ -1490,7 +1490,7 @@ static PurpleCmdRet silcpurple_cmd_chat_
 			g_free(tmp2);
 		} else
 			buf = g_strdup(_("No topic is set"));
-		purple_conv_chat_write(PURPLE_CONV_CHAT(conv), gc->account->username, buf,
+		purple_conv_chat_write(PURPLE_CONV_CHAT(conv), purple_account_get_username(purple_connection_get_account(gc)), buf,
 							 PURPLE_MESSAGE_SYSTEM|PURPLE_MESSAGE_NO_LOG, time(NULL));
 		g_free(buf);
 
============================================================
--- libpurple/protocols/silc/util.c	39d4c4b22ea5b41e7a18205370089578a759bb16
+++ libpurple/protocols/silc/util.c	43a790736e6e800bd3aefbaa4415a83bac35293c
@@ -197,9 +197,9 @@ gboolean silcpurple_check_silc_dir(Purpl
 	g_snprintf(pkd, sizeof(pkd), "%s" G_DIR_SEPARATOR_S "public_key.pub", silcpurple_silcdir());
 	g_snprintf(prd, sizeof(prd), "%s" G_DIR_SEPARATOR_S "private_key.prv", silcpurple_silcdir());
 	g_snprintf(file_public_key, sizeof(file_public_key) - 1, "%s",
-		   purple_account_get_string(gc->account, "public-key", pkd));
+		   purple_account_get_string(purple_connection_get_account(gc), "public-key", pkd));
 	g_snprintf(file_private_key, sizeof(file_public_key) - 1, "%s",
-		   purple_account_get_string(gc->account, "private-key", prd));
+		   purple_account_get_string(purple_connection_get_account(gc), "private-key", prd));
 
 	if ((g_stat(file_public_key, &st)) == -1) {
 		/* If file doesn't exist */
@@ -209,8 +209,8 @@ gboolean silcpurple_check_silc_dir(Purpl
 						  SILCPURPLE_DEF_PKCS_LEN,
 						  file_public_key,
 						  file_private_key, NULL,
-						  (gc->password == NULL)
-						  ? "" : gc->password,
+						  (purple_connection_get_password(gc) == NULL)
+						  ? "" : purple_connection_get_password(gc),
 						  NULL, NULL, FALSE)) {
 				purple_connection_error_reason(gc, PURPLE_CONNECTION_ERROR_OTHER_ERROR,
 				                             _("Cannot create SILC key pair\n"));
@@ -252,8 +252,8 @@ gboolean silcpurple_check_silc_dir(Purpl
 						  SILCPURPLE_DEF_PKCS_LEN,
 						  file_public_key,
 						  file_private_key, NULL,
-						  (gc->password == NULL)
-						  ? "" : gc->password,
+						  (purple_connection_get_password(gc) == NULL)
+						  ? "" : purple_connection_get_password(gc),
 						  NULL, NULL, FALSE)) {
 				purple_connection_error_reason(gc, PURPLE_CONNECTION_ERROR_OTHER_ERROR,
 				                             _("Cannot create SILC key pair\n"));
@@ -362,8 +362,8 @@ void silcpurple_show_public_key(SilcPurp
 		   the next strings (short strings: 2 tabs, longer strings 1 tab,
 		   sum: 3 tabs or 24 characters) */
 		g_string_append_printf(s, _("Real Name: \t%s\n"), ident->realname);
-	if (ident->username)
-		g_string_append_printf(s, _("User Name: \t%s\n"), ident->username);
+	if (purple_account_get_username(ident))
+		g_string_append_printf(s, _("User Name: \t%s\n"), purple_account_get_username(ident));
 	if (ident->email)
 		g_string_append_printf(s, _("E-Mail: \t\t%s\n"), ident->email);
 	if (ident->host)
@@ -382,9 +382,9 @@ void silcpurple_show_public_key(SilcPurp
 
 	buf = g_string_free(s, FALSE);
 
-	purple_request_action(sg->gc, _("Public Key Information"),
+	purple_request_action(purple_account_get_connection(sg), _("Public Key Information"),
 			      _("Public Key Information"),
-			      buf, 0, purple_connection_get_account(sg->gc),
+			      buf, 0, purple_connection_get_account(purple_account_get_connection(sg)),
 			      NULL, NULL, context, 1, _("Close"), callback);
 
 	g_free(buf);
============================================================
--- libpurple/protocols/silc10/buddy.c	9efd8b9cc41ff4a4518bd195204a2d6bf9882fa5
+++ libpurple/protocols/silc10/buddy.c	22fa60197b7175f6b88dc61d5caeae2f941dbc59
@@ -175,7 +175,7 @@ silcpurple_buddy_keyagr_do(PurpleConnect
 		if (!r)
 			return;
 		r->nick = g_strdup(name);
-		r->gc = gc;
+		purple_account_get_connection(r) = gc;
 		silc_client_get_clients(sg->client, sg->conn, nickname, NULL,
 					silcpurple_buddy_keyagr_resolved, r);
 		silc_free(nickname);
@@ -310,7 +310,7 @@ void silcpurple_buddy_keyagr_request(Sil
 	a->port = port;
 
 	purple_request_action(client->application, _("Key Agreement Request"), tmp,
-			    hostname ? tmp2 : NULL, 1, gc->account, client_entry->nickname,
+			    hostname ? tmp2 : NULL, 1, purple_connection_get_account(gc), client_entry->nickname,
 				NULL, a, 2, _("Yes"), G_CALLBACK(silcpurple_buddy_keyagr_request_cb),
 			    _("No"), G_CALLBACK(silcpurple_buddy_keyagr_request_cb));
 }
@@ -321,7 +321,7 @@ silcpurple_buddy_keyagr(PurpleBlistNode 
 	PurpleBuddy *buddy;
 
 	buddy = (PurpleBuddy *)node;
-	silcpurple_buddy_keyagr_do(buddy->account->gc, buddy->name, FALSE);
+	silcpurple_buddy_keyagr_do(purple_account_get_connection(buddy->account), buddy->name, FALSE);
 }
 
 
@@ -466,7 +466,7 @@ silcpurple_buddy_privkey(PurpleConnectio
 	                     _("Set IM Password"), NULL, FALSE, TRUE, NULL,
 	                     _("OK"), G_CALLBACK(silcpurple_buddy_privkey_cb),
 	                     _("Cancel"), G_CALLBACK(silcpurple_buddy_privkey_cb),
-	                     gc->account, NULL, NULL, p);
+	                     purple_connection_get_account(gc), NULL, NULL, p);
 
 	silc_free(clients);
 	silc_free(nickname);
@@ -694,7 +694,7 @@ void silcpurple_get_info(PurpleConnectio
 	if (strlen(who) > 2 && who[0] == '*' && who[1] == '@')
 		nick = who + 2;
 
-	b = purple_find_buddy(gc->account, nick);
+	b = purple_find_buddy(purple_connection_get_account(gc), nick);
 	if (b) {
 		/* See if we have this buddy's public key.  If we do use that
 		   to search the details. */
@@ -1173,7 +1173,7 @@ silcpurple_add_buddy_select(SilcPurpleBu
 		}
 		g_snprintf(tmp, sizeof(tmp), "%s - %s (%s@%s)%s",
 			   clients[i]->realname, clients[i]->nickname,
-			   clients[i]->username, clients[i]->hostname ?
+			   clients[i]purple_account_get_username(), clients[i]->hostname ?
 			   clients[i]->hostname : "",
 			   fingerprint ? tmp2 : "");
 		purple_request_field_list_add(f, tmp, clients[i]);
@@ -1457,7 +1457,7 @@ char *silcpurple_status_text(PurpleBuddy
 
 char *silcpurple_status_text(PurpleBuddy *b)
 {
-	SilcPurple sg = b->account->gc->proto_data;
+	SilcPurple sg = purple_account_get_connection(b->account)->proto_data;
 	SilcClient client = sg->client;
 	SilcClientConnection conn = sg->conn;
 	SilcClientID *client_id = b->proto_data;
@@ -1521,7 +1521,7 @@ void silcpurple_tooltip_text(PurpleBuddy
 
 void silcpurple_tooltip_text(PurpleBuddy *b, PurpleNotifyUserInfo *user_info, gboolean full)
 {
-	SilcPurple sg = b->account->gc->proto_data;
+	SilcPurple sg = purple_account_get_connection(b->account)->proto_data;
 	SilcClient client = sg->client;
 	SilcClientConnection conn = sg->conn;
 	SilcClientID *client_id = b->proto_data;
@@ -1537,8 +1537,8 @@ void silcpurple_tooltip_text(PurpleBuddy
 	if (client_entry->nickname)
 		purple_notify_user_info_add_pair(user_info, _("Nickname"),
 					       client_entry->nickname);
-	if (client_entry->username && client_entry->hostname) {
-		g_snprintf(tmp, sizeof(tmp), "%s@%s", client_entry->username, client_entry->hostname);
+	if (client_purple_account_get_username(entry) && client_entry->hostname) {
+		g_snprintf(tmp, sizeof(tmp), "%s@%s", client_purple_account_get_username(entry), client_entry->hostname);
 		purple_notify_user_info_add_pair(user_info, _("Username"), tmp);
 	}
 	if (client_entry->mode) {
============================================================
--- libpurple/protocols/silc10/chat.c	d202a75104c8ded93e99f373753b6cb6727b906a
+++ libpurple/protocols/silc10/chat.c	7883f78b9d446f3495d196522fa44f9c646bf6e5
@@ -180,7 +180,7 @@ silcpurple_chat_getinfo_menu(PurpleBlist
 silcpurple_chat_getinfo_menu(PurpleBlistNode *node, gpointer data)
 {
 	PurpleChat *chat = (PurpleChat *)node;
-	silcpurple_chat_getinfo(chat->account->gc, chat->components);
+	silcpurple_chat_getinfo(purple_account_get_connection(chat->account), chat->components);
 }
 
 
@@ -288,10 +288,10 @@ silcpurple_chat_chpk_cb(SilcPurpleChauth
 	f = purple_request_fields_get_field(fields, "list");
 	if (!purple_request_field_list_get_selected(f)) {
 		/* Add new public key */
-		purple_request_file(sg->gc, _("Open Public Key..."), NULL, FALSE,
+		purple_request_file(purple_account_get_connection(sg), _("Open Public Key..."), NULL, FALSE,
 				  G_CALLBACK(silcpurple_chat_chpk_add),
 				  G_CALLBACK(silcpurple_chat_chpk_cancel),
-				  purple_connection_get_account(sg->gc), NULL, NULL, sgc);
+				  purple_connection_get_account(purple_account_get_connection(sg)), NULL, NULL, sgc);
 		return;
 	}
 
@@ -419,11 +419,11 @@ void silcpurple_chat_chauth_show(SilcPur
 	if (!channel_pubkeys) {
 		f = purple_request_field_list_new("list", NULL);
 		purple_request_field_group_add_field(g, f);
-		purple_request_fields(sg->gc, _("Channel Authentication"),
+		purple_request_fields(purple_account_get_connection(sg), _("Channel Authentication"),
 				    _("Channel Authentication"), t, fields,
 				    _("Add / Remove"), G_CALLBACK(silcpurple_chat_chpk_cb),
 				    _("OK"), G_CALLBACK(silcpurple_chat_chauth_ok),
-					purple_connection_get_account(sg->gc), NULL, NULL, sgc);
+					purple_connection_get_account(purple_account_get_connection(sg)), NULL, NULL, sgc);
 		return;
 	}
 	sgc->pubkeys = silc_buffer_copy(channel_pubkeys);
@@ -447,8 +447,8 @@ void silcpurple_chat_chauth_show(SilcPur
 		ident = silc_pkcs_decode_identifier(pubkey->identifier);
 
 		g_snprintf(tmp2, sizeof(tmp2), "%s\n  %s\n  %s",
-			   ident->realname ? ident->realname : ident->username ?
-			   ident->username : "", fingerprint, babbleprint);
+			   ident->realname ? ident->realname : purple_account_get_username(ident) ?
+			   purple_account_get_username(ident) : "", fingerprint, babbleprint);
 		purple_request_field_list_add(f, tmp2, pubkey);
 
 		silc_free(fingerprint);
@@ -458,11 +458,11 @@ void silcpurple_chat_chauth_show(SilcPur
 	}
 
 	purple_request_field_list_set_multi_select(f, FALSE);
-	purple_request_fields(sg->gc, _("Channel Authentication"),
+	purple_request_fields(purple_account_get_connection(sg), _("Channel Authentication"),
 			    _("Channel Authentication"), t, fields,
 			    _("Add / Remove"), G_CALLBACK(silcpurple_chat_chpk_cb),
 			    _("OK"), G_CALLBACK(silcpurple_chat_chauth_ok),
-				purple_connection_get_account(sg->gc), NULL, NULL, sgc);
+				purple_connection_get_account(purple_account_get_connection(sg)), NULL, NULL, sgc);
 
 	silc_argument_payload_free(chpks);
 }
@@ -537,7 +537,7 @@ silcpurple_chat_prv_add(SilcPurpleCharPr
 	purple_blist_node_set_string((PurpleBlistNode *)cn, "parentch", p->channel);
 
 	/* Join the group */
-	silcpurple_chat_join(sg->gc, comp);
+	silcpurple_chat_join(purple_account_get_connection(sg), comp);
 
 	silc_free(p);
 }
============================================================
--- libpurple/protocols/silc10/ft.c	3b328ce851a002a35c3557253091202558a6fb94
+++ libpurple/protocols/silc10/ft.c	3eb261bc28c53d2af87b6bd54fe77f1eed3d0b50
@@ -70,7 +70,7 @@ silcpurple_ftp_monitor(SilcClient client
 		     void *context)
 {
 	SilcPurpleXfer xfer = context;
-	PurpleConnection *gc = xfer->sg->gc;
+	PurpleConnection *gc = purple_account_get_connection(xfer->sg);
 	char tmp[256];
 
 	if (status == SILC_CLIENT_FILE_MONITOR_CLOSED) {
@@ -186,7 +186,7 @@ silcpurple_ftp_request_result(PurpleXfer
 {
 	SilcPurpleXfer xfer = x->data;
 	SilcClientFileError status;
-	PurpleConnection *gc = xfer->sg->gc;
+	PurpleConnection *gc = purple_account_get_connection(xfer->sg);
 
 	if (purple_xfer_get_status(x) != PURPLE_XFER_STATUS_ACCEPTED)
 		return;
============================================================
--- libpurple/protocols/silc10/ops.c	b78f2b937f35a46d64d787623d8114094d119b95
+++ libpurple/protocols/silc10/ops.c	374fee8b0d6fa3e88cfa1aa5b5574514c2244f9c
@@ -485,7 +485,7 @@ silc_notify(SilcClient client, SilcClien
 
 		/* Join user to channel */
 		g_snprintf(buf, sizeof(buf), "%s@%s",
-			   client_entry->username, client_entry->hostname);
+			   client_purple_account_get_username(entry), client_entry->hostname);
 		purple_conv_chat_add_user(PURPLE_CONV_CHAT(convo),
 					g_strdup(client_entry->nickname), buf, PURPLE_CBFLAGS_NONE, TRUE);
 
@@ -887,7 +887,7 @@ silc_notify(SilcClient client, SilcClien
 							if (!PURPLE_BLIST_NODE_IS_BUDDY(bnode))
 								continue;
 							b = (PurpleBuddy *)bnode;
-							if (b->account != gc->account)
+							if (b->account != purple_connection_get_account(gc))
 								continue;
 							f = purple_blist_node_get_string(bnode, "public-key");
 							if (f && !strcmp(f, buf))
@@ -1183,8 +1183,8 @@ silc_command_reply(SilcClient client, Si
 				purple_notify_user_info_add_pair(user_info, _("Real Name"), tmp2);
 				g_free(tmp2);
 			}
-			if (client_entry->username) {
-				tmp2 = g_markup_escape_text(client_entry->username, -1);
+			if (client_purple_account_get_username(entry)) {
+				tmp2 = g_markup_escape_text(client_purple_account_get_username(entry), -1);
 				if (client_entry->hostname) {
 					gchar *tmp3;
 					tmp3 = g_strdup_printf("%s@%s", tmp2, client_entry->hostname);
@@ -1295,7 +1295,7 @@ silc_command_reply(SilcClient client, Si
 						_("User Information"),
 						buf, 1, client_entry, 2,
 						_("OK"), G_CALLBACK(silcpurple_whois_more),
-						_("_More..."), G_CALLBACK(silcpurple_whois_more), gc->account, NULL, NULL);
+						_("_More..."), G_CALLBACK(silcpurple_whois_more), purple_connection_get_account(gc), NULL, NULL);
 			else
 #endif
 			purple_notify_userinfo(gc, client_entry->nickname, user_info, NULL, NULL);
@@ -1681,7 +1681,7 @@ silc_connected(SilcClient client, SilcCl
 	switch (status) {
 	case SILC_CLIENT_CONN_SUCCESS:
 	case SILC_CLIENT_CONN_SUCCESS_RESUME:
-		purple_connection_set_state(gc, PURPLE_CONNECTED);
+		purple_connection_set_state(gc, PURPLE_CONNECTION_STATE_CONNECTED);
 
 		/* Send the server our buddy list */
 		silcpurple_send_buddylist(gc);
============================================================
--- libpurple/protocols/silc10/silc.c	e355589dff37f1cc90e67cbcaaf957b4a18c2851
+++ libpurple/protocols/silc10/silc.c	fe62966a83aaa9c521f546292756c06254d4847f
@@ -254,7 +254,7 @@ silcpurple_login(PurpleAccount *account)
 	char *realname;
 	int i;
 
-	gc = account->gc;
+	gc = purple_account_get_connection(account);
 	if (!gc)
 		return;
 	gc->proto_data = NULL;
@@ -276,11 +276,11 @@ silcpurple_login(PurpleAccount *account)
 	if (purple_account_get_username(account)) {
 		const char *u = purple_account_get_username(account);
 		char **up = g_strsplit(u, "@", 2);
-		client->username = strdup(up[0]);
+		purple_account_get_username(client) = strdup(up[0]);
 		g_strfreev(up);
 	} else {
-		client->username = silc_get_username();
-		purple_account_set_username(account, client->username);
+		purple_account_get_username(client) = silc_get_username();
+		purple_account_set_username(account, purple_account_get_username(client));
 	}
 	realname = silc_get_real_name();
 	if (purple_account_get_user_info(account)) {
@@ -295,7 +295,7 @@ silcpurple_login(PurpleAccount *account)
 	}
 	client->hostname = silc_net_localhost();
 
-	purple_connection_set_display_name(gc, client->username);
+	purple_connection_set_display_name(gc, purple_account_get_username(client));
 
 	/* Register requested cipher and HMAC */
 	cipher = purple_account_get_string(account, "cipher", SILC_DEFAULT_CIPHER);
@@ -333,7 +333,7 @@ silcpurple_login(PurpleAccount *account)
 	g_snprintf(prd, sizeof(prd), "%s" G_DIR_SEPARATOR_S "private_key.prv", silcpurple_silcdir());
 	if (!silc_load_key_pair((char *)purple_account_get_string(account, "public-key", pkd),
 							(char *)purple_account_get_string(account, "private-key", prd),
-				(gc->password == NULL) ? "" : gc->password, &client->pkcs,
+				(purple_connection_get_password(gc) == NULL) ? "" : purple_connection_get_password(gc), &client->pkcs,
 				&client->public_key, &client->private_key)) {
 		g_snprintf(pkd, sizeof(pkd), _("Could not load SILC key pair: %s"), g_strerror(errno));
 		purple_connection_error_reason(gc, PURPLE_CONNECTION_ERROR_OTHER_ERROR,
@@ -346,7 +346,7 @@ silcpurple_login(PurpleAccount *account)
 		return;
 	memset(sg, 0, sizeof(*sg));
 	sg->client = client;
-	sg->gc = gc;
+	purple_account_get_connection(sg) = gc;
 	sg->account = account;
 	gc->proto_data = sg;
 
@@ -740,7 +740,7 @@ silcpurple_attrs(PurplePluginAction *act
 			    fields,
 			    _("OK"), G_CALLBACK(silcpurple_attrs_cb),
 			    _("Cancel"), G_CALLBACK(silcpurple_attrs_cancel),
-				gc->account, NULL, NULL, gc);
+				purple_connection_get_account(gc), NULL, NULL, gc);
 }
 
 static void
@@ -903,9 +903,9 @@ silcpurple_create_keypair(PurplePluginAc
 	g_snprintf(pkd2, sizeof(pkd2), "%s" G_DIR_SEPARATOR_S"public_key.pub", silcpurple_silcdir());
 	g_snprintf(prd2, sizeof(prd2), "%s" G_DIR_SEPARATOR_S"private_key.prv", silcpurple_silcdir());
 	g_snprintf(pkd, sizeof(pkd) - 1, "%s",
-		   purple_account_get_string(gc->account, "public-key", pkd2));
+		   purple_account_get_string(purple_connection_get_account(gc), "public-key", pkd2));
 	g_snprintf(prd, sizeof(prd) - 1, "%s",
-		   purple_account_get_string(gc->account, "private-key", prd2));
+		   purple_account_get_string(purple_connection_get_account(gc), "private-key", prd2));
 
 	fields = purple_request_fields_new();
 
@@ -946,7 +946,7 @@ silcpurple_create_keypair(PurplePluginAc
 			    _("Create New SILC Key Pair"), NULL, fields,
 			    _("Generate Key Pair"), G_CALLBACK(silcpurple_create_keypair_cb),
 			    _("Cancel"), G_CALLBACK(silcpurple_create_keypair_cancel),
-				gc->account, NULL, NULL, gc);
+				purple_connection_get_account(gc), NULL, NULL, gc);
 
 	g_strfreev(u);
 	silc_free(hostname);
@@ -964,7 +964,7 @@ silcpurple_change_passwd(PurpleConnectio
 {
         char prd[256];
 	g_snprintf(prd, sizeof(prd), "%s" G_DIR_SEPARATOR_S "private_key.pub", silcpurple_silcdir());
-	silc_change_private_key_passphrase(purple_account_get_string(gc->account,
+	silc_change_private_key_passphrase(purple_account_get_string(purple_connection_get_account(gc),
 								   "private-key",
 								   prd), old, new);
 }
@@ -1244,7 +1244,7 @@ static PurpleCmdRet silcpurple_cmd_chat_
 
 	if(args && args[0])
 		convo = purple_find_conversation_with_account(PURPLE_CONV_TYPE_CHAT, args[0],
-									gc->account);
+									purple_connection_get_account(gc));
 
 	if (convo != NULL)
 		id = purple_conv_chat_get_id(PURPLE_CONV_CHAT(convo));
@@ -1282,7 +1282,7 @@ static PurpleCmdRet silcpurple_cmd_chat_
 			g_free(tmp2);
 		} else
 			buf = g_strdup(_("No topic is set"));
-		purple_conv_chat_write(PURPLE_CONV_CHAT(conv), gc->account->username, buf,
+		purple_conv_chat_write(PURPLE_CONV_CHAT(conv), purple_account_get_username(purple_connection_get_account(gc)), buf,
 							 PURPLE_MESSAGE_SYSTEM|PURPLE_MESSAGE_NO_LOG, time(NULL));
 		g_free(buf);
 
============================================================
--- libpurple/protocols/silc10/util.c	8900079b4371f25fd62216e63a1504588bbc155e
+++ libpurple/protocols/silc10/util.c	efea2f9b869f39bc819826dd96bc3adaa7f334ce
@@ -197,9 +197,9 @@ gboolean silcpurple_check_silc_dir(Purpl
 	g_snprintf(pkd, sizeof(pkd), "%s" G_DIR_SEPARATOR_S "public_key.pub", silcpurple_silcdir());
 	g_snprintf(prd, sizeof(prd), "%s" G_DIR_SEPARATOR_S "private_key.prv", silcpurple_silcdir());
 	g_snprintf(file_public_key, sizeof(file_public_key) - 1, "%s",
-		   purple_account_get_string(gc->account, "public-key", pkd));
+		   purple_account_get_string(purple_connection_get_account(gc), "public-key", pkd));
 	g_snprintf(file_private_key, sizeof(file_public_key) - 1, "%s",
-		   purple_account_get_string(gc->account, "private-key", prd));
+		   purple_account_get_string(purple_connection_get_account(gc), "private-key", prd));
 
 	if ((g_stat(file_public_key, &st)) == -1) {
 		/* If file doesn't exist */
@@ -208,7 +208,7 @@ gboolean silcpurple_check_silc_dir(Purpl
 			if (!silc_create_key_pair(SILCPURPLE_DEF_PKCS,
 					     SILCPURPLE_DEF_PKCS_LEN,
 					     file_public_key, file_private_key, NULL,
-					     (gc->password == NULL) ? "" : gc->password,
+					     (purple_connection_get_password(gc) == NULL) ? "" : purple_connection_get_password(gc),
 						 NULL, NULL, NULL, FALSE)) {
 				purple_debug_error("silc", "Couldn't create key pair\n");
 				return FALSE;
@@ -248,7 +248,7 @@ gboolean silcpurple_check_silc_dir(Purpl
 			if (!silc_create_key_pair(SILCPURPLE_DEF_PKCS,
 					     SILCPURPLE_DEF_PKCS_LEN,
 					     file_public_key, file_private_key, NULL,
-					     (gc->password == NULL) ? "" : gc->password,
+					     (purple_connection_get_password(gc) == NULL) ? "" : purple_connection_get_password(gc),
 						 NULL, NULL, NULL, FALSE)) {
 				purple_debug_error("silc", "Couldn't create key pair\n");
 				return FALSE;
@@ -353,8 +353,8 @@ void silcpurple_show_public_key(SilcPurp
 		   the next strings (short strings: 2 tabs, longer strings 1 tab,
 		   sum: 3 tabs or 24 characters) */
 		g_string_append_printf(s, _("Real Name: \t%s\n"), ident->realname);
-	if (ident->username)
-		g_string_append_printf(s, _("User Name: \t%s\n"), ident->username);
+	if (purple_account_get_username(ident))
+		g_string_append_printf(s, _("User Name: \t%s\n"), purple_account_get_username(ident));
 	if (ident->email)
 		g_string_append_printf(s, _("E-Mail: \t\t%s\n"), ident->email);
 	if (ident->host)
@@ -371,9 +371,9 @@ void silcpurple_show_public_key(SilcPurp
 
 	buf = g_string_free(s, FALSE);
 
-	purple_request_action(sg->gc, _("Public Key Information"),
+	purple_request_action(purple_account_get_connection(sg), _("Public Key Information"),
 			    _("Public Key Information"),
-			    buf, 0, purple_connection_get_account(sg->gc),
+			    buf, 0, purple_connection_get_account(purple_account_get_connection(sg)),
 				NULL, NULL, context, 1, _("Close"), callback);
 
 	g_free(buf);
============================================================
--- libpurple/protocols/simple/simple.c	892323a64f84f293e2ea3be5e33b86a0cb76ca8b
+++ libpurple/protocols/simple/simple.c	4708ffe23e2cb1e1a325702c8ebb719353525aac
@@ -106,8 +106,8 @@ static void simple_set_status(PurpleAcco
 	if (!purple_status_is_active(status))
 		return;
 
-	if (account->gc)
-		sip = account->gc->proto_data;
+	if (purple_account_get_connection(account))
+		sip = purple_account_get_connection(account)->proto_data;
 
 	if (sip)
 	{
@@ -222,7 +222,7 @@ static void simple_get_buddies(PurpleCon
 			if(!PURPLE_BLIST_NODE_IS_CONTACT(cnode)) continue;
 			for(bnode = cnode->child; bnode; bnode = bnode->next) {
 				if(!PURPLE_BLIST_NODE_IS_BUDDY(bnode)) continue;
-				if(((PurpleBuddy*)bnode)->account == gc->account)
+				if(((PurpleBuddy*)bnode)->account == purple_connection_get_account(gc))
 					simple_add_buddy(gc, (PurpleBuddy*)bnode, (PurpleGroup *)gnode);
 			}
 		}
@@ -265,10 +265,10 @@ static gchar *auth_header(struct simple_
 	const char *authuser;
 
 	authdomain = purple_account_get_string(sip->account, "authdomain", "");
-	authuser = purple_account_get_string(sip->account, "authuser", sip->username);
+	authuser = purple_account_get_string(sip->account, "authuser", purple_account_get_username(sip));
 
 	if(!authuser || strlen(authuser) < 1) {
-		authuser = sip->username;
+		authuser = purple_account_get_username(sip);
 	}
 
 	if(auth->type == 1) { /* Digest */
@@ -284,7 +284,7 @@ static gchar *auth_header(struct simple_
 	} else if(auth->type == 2) { /* NTLM */
 		if(auth->nc == 3 && auth->nonce) {
 			/* TODO: Don't hardcode "purple" as the hostname */
-			ret = purple_ntlm_gen_type3(authuser, sip->password, "purple", authdomain, (const guint8 *)auth->nonce, &auth->flags);
+			ret = purple_ntlm_gen_type3(authuser, purple_account_get_password(sip), "purple", authdomain, (const guint8 *)auth->nonce, &auth->flags);
 			tmp = g_strdup_printf("NTLM qop=\"auth\", opaque=\"%s\", realm=\"%s\", targetname=\"%s\", gssapi-data=\"%s\"", auth->opaque, auth->realm, auth->target, ret);
 			g_free(ret);
 			return tmp;
@@ -327,10 +327,10 @@ static void fill_auth(struct simple_acco
 	char *tmp;
 	gchar **parts;
 
-	authuser = purple_account_get_string(sip->account, "authuser", sip->username);
+	authuser = purple_account_get_string(sip->account, "authuser", purple_account_get_username(sip));
 
 	if(!authuser || strlen(authuser) < 1) {
-		authuser = sip->username;
+		authuser = purple_account_get_username(sip);
 	}
 
 	if(!hdr) {
@@ -388,7 +388,7 @@ static void fill_auth(struct simple_acco
 	purple_debug(PURPLE_DEBUG_MISC, "simple", "nonce: %s realm: %s\n", auth->nonce ? auth->nonce : "(null)", auth->realm ? auth->realm : "(null)");
 	if(auth->realm) {
 		auth->digest_session_key = purple_http_digest_calculate_session_key(
-				"md5", authuser, auth->realm, sip->password, auth->nonce, NULL);
+				"md5", authuser, auth->realm, purple_account_get_password(sip), auth->nonce, NULL);
 
 		auth->nc = 1;
 	}
@@ -543,7 +543,7 @@ static void sendout_sipmsg(struct simple
 		tmp = g_slist_next(tmp);
 	}
 	g_string_append_printf(outstr, "\r\n%s", msg->body ? msg->body : "");
-	sendout_pkt(sip->gc, outstr->str);
+	sendout_pkt(purple_account_get_connection(sip), outstr->str);
 	g_string_free(outstr, TRUE);
 }
 
@@ -665,7 +665,7 @@ static void send_sip_request(PurpleConne
 			purple_network_get_my_ip(-1),
 			sip->listenport,
 			branch,
-			sip->username,
+			purple_account_get_username(sip),
 			sip->servername,
 			dialog ? dialog->ourtag : tag,
 			to,
@@ -695,7 +695,7 @@ static char *get_contact(struct simple_a
 
 static char *get_contact(struct simple_account_data  *sip) {
 	return g_strdup_printf("<sip:%s@%s:%d;transport=%s>;methods=\"MESSAGE, SUBSCRIBE, NOTIFY\"",
-			       sip->username, purple_network_get_my_ip(-1),
+			       purple_account_get_username(sip), purple_network_get_my_ip(-1),
 			       sip->listenport,
 			       sip->udp ? "udp" : "tcp");
 }
@@ -706,14 +706,14 @@ static void do_register_exp(struct simpl
 	sip->reregister = time(NULL) + expire - 50;
 
 	uri = g_strdup_printf("sip:%s", sip->servername);
-	to = g_strdup_printf("sip:%s@%s", sip->username, sip->servername);
+	to = g_strdup_printf("sip:%s@%s", purple_account_get_username(sip), sip->servername);
 	contact = get_contact(sip);
 	hdr = g_strdup_printf("Contact: %s\r\nExpires: %d\r\n", contact, expire);
 	g_free(contact);
 
 	sip->registerstatus = SIMPLE_REGISTER_SENT;
 
-	send_sip_request(sip->gc, "REGISTER", uri, to, hdr, "", NULL,
+	send_sip_request(purple_account_get_connection(sip), "REGISTER", uri, to, hdr, "", NULL,
 		process_register_response);
 
 	g_free(hdr);
@@ -828,7 +828,7 @@ static void simple_subscribe_exp(struct 
 	g_free(tmp);
 	g_free(tmp2);
 
-	send_sip_request(sip->gc, "SUBSCRIBE", to, to, contact,"",buddy->dialog,
+	send_sip_request(purple_account_get_connection(sip), "SUBSCRIBE", to, to, contact,"",buddy->dialog,
 			 (expiration > 0) ? process_subscribe_response : NULL);
 
 	g_free(to);
@@ -918,14 +918,14 @@ static void simple_subscribe_buddylist(s
 	gchar *contact = "Event: vnd-microsoft-roaming-contacts\r\nAccept: application/vnd-microsoft-roaming-contacts+xml\r\nSupported: com.microsoft.autoextend\r\nSupported: ms-benotify\r\nProxy-Require: ms-benotify\r\nSupported: ms-piggyback-first-notify\r\n";
 	gchar *to;
 	gchar *tmp;
-	to = g_strdup_printf("sip:%s@%s", sip->username, sip->servername);
+	to = g_strdup_printf("sip:%s@%s", purple_account_get_username(sip), sip->servername);
 
 	tmp = get_contact(sip);
 
 	contact = g_strdup_printf("%sContact: %s\r\n", contact, tmp);
 	g_free(tmp);
 
-	send_sip_request(sip->gc, "SUBSCRIBE", to, to, contact, "", NULL, simple_add_lcs_contacts);
+	send_sip_request(purple_account_get_connection(sip), "SUBSCRIBE", to, to, contact, "", NULL, simple_add_lcs_contacts);
 
 	g_free(to);
 	g_free(contact);
@@ -1007,7 +1007,7 @@ static void simple_send_message(struct s
 	} else {
 		hdr = g_strdup("Content-Type: text/plain\r\n");
 	}
-	send_sip_request(sip->gc, "MESSAGE", fullto, fullto, hdr, msg, NULL, NULL);
+	send_sip_request(purple_account_get_connection(sip), "MESSAGE", fullto, fullto, hdr, msg, NULL, NULL);
 	g_free(hdr);
 	g_free(fullto);
 }
@@ -1035,8 +1035,8 @@ static void process_incoming_message(str
 
 	contenttype = sipmsg_find_header(msg, "Content-Type");
 	if(!contenttype || !strncmp(contenttype, "text/plain", 10) || !strncmp(contenttype, "text/html", 9)) {
-		serv_got_im(sip->gc, from, msg->body, 0, time(NULL));
-		send_sip_response(sip->gc, msg, 200, "OK", NULL);
+		serv_got_im(purple_account_get_connection(sip), from, msg->body, 0, time(NULL));
+		send_sip_response(purple_account_get_connection(sip), msg, 200, "OK", NULL);
 		found = TRUE;
 	}
 	if(!strncmp(contenttype, "application/im-iscomposing+xml", 30)) {
@@ -1061,18 +1061,18 @@ static void process_incoming_message(str
 
 		statedata = xmlnode_get_data(state);
 		if(statedata) {
-			if(strstr(statedata, "active")) serv_got_typing(sip->gc, from, 0, PURPLE_TYPING);
-			else serv_got_typing_stopped(sip->gc, from);
+			if(strstr(statedata, "active")) serv_got_typing(purple_account_get_connection(sip), from, 0, PURPLE_TYPING);
+			else serv_got_typing_stopped(purple_account_get_connection(sip), from);
 
 			g_free(statedata);
 		}
 		xmlnode_free(isc);
-		send_sip_response(sip->gc, msg, 200, "OK", NULL);
+		send_sip_response(purple_account_get_connection(sip), msg, 200, "OK", NULL);
 		found = TRUE;
 	}
 	if(!found) {
 		purple_debug_info("simple", "got unknown mime-type\n");
-		send_sip_response(sip->gc, msg, 415, "Unsupported media type", NULL);
+		send_sip_response(purple_account_get_connection(sip), msg, 415, "Unsupported media type", NULL);
 	}
 	g_free(from);
 }
@@ -1089,10 +1089,10 @@ gboolean process_register_response(struc
 				}
 			}
 			sip->registerstatus = SIMPLE_REGISTER_COMPLETE;
-			purple_connection_set_state(sip->gc, PURPLE_CONNECTED);
+			purple_connection_set_state(purple_account_get_connection(sip), PURPLE_CONNECTION_STATE_CONNECTED);
 
 			/* get buddies from blist */
-			simple_get_buddies(sip->gc);
+			simple_get_buddies(purple_account_get_connection(sip));
 
 			subscribe_timeout(sip);
 			tmp = sipmsg_find_header(msg, "Allow-Events");
@@ -1105,9 +1105,9 @@ gboolean process_register_response(struc
 			if(sip->registerstatus != SIMPLE_REGISTER_RETRY) {
 				purple_debug_info("simple", "REGISTER retries %d\n", sip->registrar.retries);
 				if(sip->registrar.retries > SIMPLE_REGISTER_RETRY_MAX) {
-					if (!purple_account_get_remember_password(sip->gc->account))
-						purple_account_set_password(sip->gc->account, NULL);
-					purple_connection_error_reason(sip->gc,
+					if (!purple_account_get_remember_password(purple_account_get_connection(sip)->account))
+						purple_account_set_password(purple_account_get_connection(sip)->account, NULL);
+					purple_connection_error_reason(purple_account_get_connection(sip),
 						PURPLE_CONNECTION_ERROR_AUTHENTICATION_FAILED,
 						_("Incorrect password."));
 					return TRUE;
@@ -1122,7 +1122,7 @@ gboolean process_register_response(struc
 			if (sip->registerstatus != SIMPLE_REGISTER_RETRY) {
 				purple_debug_info("simple", "Unrecognized return code for REGISTER.\n");
 				if (sip->registrar.retries > SIMPLE_REGISTER_RETRY_MAX) {
-					purple_connection_error_reason(sip->gc,
+					purple_connection_error_reason(purple_account_get_connection(sip),
 						PURPLE_CONNECTION_ERROR_OTHER_ERROR,
 						_("Unknown server response."));
 					return TRUE;
@@ -1225,7 +1225,7 @@ static void process_incoming_notify(stru
 			}
 			g_strfreev(ssparts);
 		}
-		send_sip_response(sip->gc, msg, 200, "OK", NULL);
+		send_sip_response(purple_account_get_connection(sip), msg, 200, "OK", NULL);
 		g_free(from);
 		return;
 	}
@@ -1263,7 +1263,7 @@ static void process_incoming_notify(stru
 	g_free(from);
 	g_free(basicstatus_data);
 
-	send_sip_response(sip->gc, msg, 200, "OK", NULL);
+	send_sip_response(purple_account_get_connection(sip), msg, 200, "OK", NULL);
 }
 
 static unsigned int simple_typing(PurpleConnection *gc, const char *name, PurpleTypingState state) {
@@ -1319,11 +1319,11 @@ static gchar* gen_xpidf(struct simple_ac
 			"</address>\n"
 			"</atom>\n"
 			"</presence>\n",
-			sip->username,
+			purple_account_get_username(sip),
 			sip->servername,
-			sip->username,
+			purple_account_get_username(sip),
 			sip->servername,
-			sip->username,
+			purple_account_get_username(sip),
 			sip->servername,
 			sip->status);
 	return doc;
@@ -1341,7 +1341,7 @@ static gchar* gen_pidf(struct simple_acc
 			"<note>%s</note>\n"
 			"</tuple>\n"
 			"</presence>",
-			sip->username,
+			purple_account_get_username(sip),
 			sip->servername,
 			(open == TRUE) ? "open" : "closed",
 			(open == TRUE) ? sip->status : "");
@@ -1351,7 +1351,7 @@ static void send_notify(struct simple_ac
 static void send_notify(struct simple_account_data *sip, struct simple_watcher *watcher) {
 	gchar *doc = watcher->needsxpidf ? gen_xpidf(sip) : gen_pidf(sip, TRUE);
 	gchar *hdr = watcher->needsxpidf ? "Event: presence\r\nContent-Type: application/xpidf+xml\r\n" : "Event: presence\r\nContent-Type: application/pidf+xml\r\n";
-	send_sip_request(sip->gc, "NOTIFY", watcher->name, watcher->name, hdr, doc, &watcher->dialog, NULL);
+	send_sip_request(purple_account_get_connection(sip), "NOTIFY", watcher->name, watcher->name, hdr, doc, &watcher->dialog, NULL);
 	g_free(doc);
 }
 
@@ -1376,7 +1376,7 @@ static void send_open_publish(struct sim
 
 static void send_open_publish(struct simple_account_data *sip) {
 	gchar *add_headers = NULL;
-	gchar *uri = g_strdup_printf("sip:%s@%s", sip->username, sip->servername);
+	gchar *uri = g_strdup_printf("sip:%s@%s", purple_account_get_username(sip), sip->servername);
 	gchar *doc = gen_pidf(sip, TRUE);
 
 	add_headers = g_strdup_printf("%s%s%s%s%d\r\n%s",
@@ -1387,7 +1387,7 @@ static void send_open_publish(struct sim
 		"Event: presence\r\n"
 		"Content-Type: application/pidf+xml\r\n");
 
-	send_sip_request(sip->gc, "PUBLISH", uri, uri,
+	send_sip_request(purple_account_get_connection(sip), "PUBLISH", uri, uri,
 		add_headers, doc, NULL, process_publish_response);
 	sip->republish = time(NULL) + PUBLISH_EXPIRATION - 50;
 	g_free(uri);
@@ -1396,7 +1396,7 @@ static void send_closed_publish(struct s
 }
 
 static void send_closed_publish(struct simple_account_data *sip) {
-	gchar *uri = g_strdup_printf("sip:%s@%s", sip->username, sip->servername);
+	gchar *uri = g_strdup_printf("sip:%s@%s", purple_account_get_username(sip), sip->servername);
 	gchar *add_headers, *doc;
 
 	add_headers = g_strdup_printf("%s%s%s%s",
@@ -1408,7 +1408,7 @@ static void send_closed_publish(struct s
 		"Content-Type: application/pidf+xml\r\n");
 
 	doc = gen_pidf(sip, FALSE);
-	send_sip_request(sip->gc, "PUBLISH", uri, uri, add_headers,
+	send_sip_request(purple_account_get_connection(sip), "PUBLISH", uri, uri, add_headers,
 		doc, NULL, process_publish_response);
 	/*sip->republish = time(NULL) + 500;*/
 	g_free(uri);
@@ -1434,7 +1434,7 @@ static void process_incoming_subscribe(s
 		const gchar *acceptheader = sipmsg_find_header(msg, "Accept");
 		gboolean needsxpidf = FALSE;
 		if(!purple_privacy_check(sip->account, from)) {
-			send_sip_response(sip->gc, msg, 202, "Ok", NULL);
+			send_sip_response(purple_account_get_connection(sip), msg, 202, "Ok", NULL);
 			goto privend;
 		}
 		if(acceptheader) {
@@ -1474,7 +1474,7 @@ static void process_incoming_subscribe(s
 	sipmsg_add_header(msg, "Contact", tmp);
 	g_free(tmp);
 	purple_debug_info("simple", "got subscribe: name %s ourtag %s theirtag %s callid %s\n", watcher->name, watcher->dialog.ourtag, watcher->dialog.theirtag, watcher->dialog.callid);
-	send_sip_response(sip->gc, msg, 200, "Ok", NULL);
+	send_sip_response(purple_account_get_connection(sip), msg, 200, "Ok", NULL);
 	send_notify(sip, watcher);
 privend:
 	g_free(from);
@@ -1495,7 +1495,7 @@ static void process_input_message(struct
 			process_incoming_subscribe(sip, msg);
 			found = TRUE;
 		} else {
-			send_sip_response(sip->gc, msg, 501, "Not implemented", NULL);
+			send_sip_response(purple_account_get_connection(sip), msg, 501, "Not implemented", NULL);
 		}
 	} else { /* response */
 		struct transaction *trans = transactions_find(sip, msg);
@@ -1517,7 +1517,7 @@ static void process_input_message(struct
 				g_free(auth);
 				resend = sipmsg_to_string(trans->msg);
 				/* resend request */
-				sendout_pkt(sip->gc, resend);
+				sendout_pkt(purple_account_get_connection(sip), resend);
 				g_free(resend);
 			} else {
 				if(msg->response == 100) {
@@ -1561,7 +1561,7 @@ static void process_input_message(struct
 							g_free(auth);
 							resend = sipmsg_to_string(trans->msg);
 							/* resend request */
-							sendout_pkt(sip->gc, resend);
+							sendout_pkt(purple_account_get_connection(sip), resend);
 							g_free(resend);
 						} else {
 							/* Reset any count of retries that may have
@@ -1744,7 +1744,7 @@ static void simple_udp_host_resolved_lis
 	sip->listen_data = NULL;
 
 	if(listenfd == -1) {
-		purple_connection_error_reason(sip->gc,
+		purple_connection_error_reason(purple_account_get_connection(sip),
 			PURPLE_CONNECTION_ERROR_NETWORK_ERROR,
 			_("Could not create listen socket"));
 		return;
@@ -1755,7 +1755,7 @@ static void simple_udp_host_resolved_lis
 	sip->listenport = purple_network_get_port_from_fd(sip->fd);
 	sip->listenfd = sip->fd;
 
-	sip->listenpa = purple_input_add(sip->fd, PURPLE_INPUT_READ, simple_udp_process, sip->gc);
+	sip->listenpa = purple_input_add(sip->fd, PURPLE_INPUT_READ, simple_udp_process, purple_account_get_connection(sip));
 
 	sip->resendtimeout = purple_timeout_add(2500, (GSourceFunc) resend_timeout, sip);
 	sip->registertimeout = purple_timeout_add((rand()%100)+10*1000, (GSourceFunc)subscribe_timeout, sip);
@@ -1769,7 +1769,7 @@ static void simple_udp_host_resolved(GSL
 	sip->query_data = NULL;
 
 	if (!hosts || !hosts->data) {
-		purple_connection_error_reason(sip->gc,
+		purple_connection_error_reason(purple_account_get_connection(sip),
 			PURPLE_CONNECTION_ERROR_NETWORK_ERROR,
 			_("Couldn't resolve host"));
 		return;
@@ -1790,7 +1790,7 @@ static void simple_udp_host_resolved(GSL
 	sip->listen_data = purple_network_listen_range(5060, 5160, SOCK_DGRAM,
 				simple_udp_host_resolved_listen_cb, sip);
 	if (sip->listen_data == NULL) {
-		purple_connection_error_reason(sip->gc,
+		purple_connection_error_reason(purple_account_get_connection(sip),
 			PURPLE_CONNECTION_ERROR_NETWORK_ERROR,
 			_("Could not create listen socket"));
 		return;
@@ -1805,7 +1805,7 @@ simple_tcp_connect_listen_cb(int listenf
 
 	sip->listenfd = listenfd;
 	if(sip->listenfd == -1) {
-		purple_connection_error_reason(sip->gc,
+		purple_connection_error_reason(purple_account_get_connection(sip),
 			PURPLE_CONNECTION_ERROR_NETWORK_ERROR,
 			_("Could not create listen socket"));
 		return;
@@ -1814,13 +1814,13 @@ simple_tcp_connect_listen_cb(int listenf
 	purple_debug_info("simple", "listenfd: %d\n", sip->listenfd);
 	sip->listenport = purple_network_get_port_from_fd(sip->listenfd);
 	sip->listenpa = purple_input_add(sip->listenfd, PURPLE_INPUT_READ,
-			simple_newconn_cb, sip->gc);
+			simple_newconn_cb, purple_account_get_connection(sip));
 	purple_debug_info("simple", "connecting to %s port %d\n",
 			sip->realhostname, sip->realport);
 	/* open tcp connection to the server */
-	if (purple_proxy_connect(sip->gc, sip->account, sip->realhostname,
-			sip->realport, login_cb, sip->gc) == NULL) {
-		purple_connection_error_reason(sip->gc,
+	if (purple_proxy_connect(purple_account_get_connection(sip), sip->account, sip->realhostname,
+			sip->realport, login_cb, purple_account_get_connection(sip)) == NULL) {
+		purple_connection_error_reason(purple_account_get_connection(sip),
 			PURPLE_CONNECTION_ERROR_NETWORK_ERROR,
 			_("Couldn't create socket"));
 	}
@@ -1860,7 +1860,7 @@ static void srvresolved(PurpleSrvRespons
 		sip->listen_data = purple_network_listen_range(5060, 5160, SOCK_STREAM,
 					simple_tcp_connect_listen_cb, sip);
 		if (sip->listen_data == NULL) {
-			purple_connection_error_reason(sip->gc,
+			purple_connection_error_reason(purple_account_get_connection(sip),
 				PURPLE_CONNECTION_ERROR_NETWORK_ERROR,
 				_("Could not create listen socket"));
 			return;
@@ -1870,7 +1870,7 @@ static void srvresolved(PurpleSrvRespons
 
 		sip->query_data = purple_dnsquery_a(hostname, port, simple_udp_host_resolved, sip);
 		if (sip->query_data == NULL) {
-			purple_connection_error_reason(sip->gc,
+			purple_connection_error_reason(purple_account_get_connection(sip),
 				PURPLE_CONNECTION_ERROR_NETWORK_ERROR,
 				_("Could not resolve hostname"));
 		}
@@ -1895,7 +1895,7 @@ static void simple_login(PurpleAccount *
 	}
 
 	gc->proto_data = sip = g_new0(struct simple_account_data, 1);
-	sip->gc = gc;
+	purple_account_get_connection(sip) = gc;
 	sip->account = account;
 	sip->registerexpire = 900;
 	sip->udp = purple_account_get_bool(account, "udp", FALSE);
@@ -1905,9 +1905,9 @@ static void simple_login(PurpleAccount *
 
 	userserver = g_strsplit(username, "@", 2);
 	purple_connection_set_display_name(gc, userserver[0]);
-	sip->username = g_strdup(userserver[0]);
+	purple_account_get_username(sip) = g_strdup(userserver[0]);
 	sip->servername = g_strdup(userserver[1]);
-	sip->password = g_strdup(purple_connection_get_password(gc));
+	purple_account_get_password(sip) = g_strdup(purple_connection_get_password(gc));
 	g_strfreev(userserver);
 
 	sip->buddies = g_hash_table_new((GHashFunc)simple_ht_hash_nick, (GEqualFunc)simple_ht_equals_nick);
@@ -1958,8 +1958,8 @@ static void simple_close(PurpleConnectio
 			purple_network_listen_cancel(sip->listen_data);
 
 		g_free(sip->servername);
-		g_free(sip->username);
-		g_free(sip->password);
+		g_free(purple_account_get_username(sip));
+		g_free(purple_account_get_password(sip));
 		g_free(sip->registrar.nonce);
 		g_free(sip->registrar.opaque);
 		g_free(sip->registrar.target);
============================================================
--- libpurple/protocols/toc/toc.c	5578a9b909c434bd19db59996d7858513adfaba8
+++ libpurple/protocols/toc/toc.c	c6ac27281a1f7496979f5eb164c7be49fe977578
@@ -133,8 +133,8 @@ static void toc_login(PurpleAccount *acc
 
 	gc = purple_account_get_connection(account);
 	gc->proto_data = tdt = g_new0(struct toc_data, 1);
-	gc->flags |= PURPLE_CONNECTION_HTML;
-	gc->flags |= PURPLE_CONNECTION_AUTO_RESP;
+	gc->flags |= PURPLE_CONNECTION_FLAGS_HTML;
+	gc->flags |= PURPLE_CONNECTION_FLAGS_AUTO_RESP;
 
 	g_snprintf(buf, sizeof buf, _("Looking up %s"),
 			purple_account_get_string(account, "server", TOC_HOST));
@@ -144,7 +144,7 @@ static void toc_login(PurpleAccount *acc
 	if (purple_proxy_connect(gc, account,
 				purple_account_get_string(account, "server", TOC_HOST),
 				purple_account_get_int(account, "port", TOC_PORT),
-				toc_login_callback, gc) != 0 || !account->gc) {
+				toc_login_callback, gc) != 0 || !purple_account_get_connection(account)) {
 		g_snprintf(buf, sizeof(buf), _("Connect to %s failed"),
 				purple_account_get_string(account, "server", TOC_HOST));
 		purple_connection_error(gc, buf);
@@ -183,7 +183,7 @@ static void toc_login_callback(gpointer 
 	if (getpeername(tdt->toc_fd, (struct sockaddr *)&name, &namelen) == 0)
 		strncpy(tdt->toc_ip, inet_ntoa(name.sin_addr), sizeof(tdt->toc_ip));
 	else
-		strncpy(tdt->toc_ip, purple_account_get_string(gc->account, "server", TOC_HOST), sizeof(tdt->toc_ip));
+		strncpy(tdt->toc_ip, purple_account_get_string(purple_connection_get_account(gc), "server", TOC_HOST), sizeof(tdt->toc_ip));
 
 	purple_debug(PURPLE_DEBUG_INFO, "toc",
 			   "Client sends \"FLAPON\\r\\n\\r\\n\"\n");
@@ -198,7 +198,7 @@ static void toc_login_callback(gpointer 
 	 * toc_fd file descriptor, toc_callback is called, with gc passed as its data arg. */
 	gc->inpa = purple_input_add(tdt->toc_fd, PURPLE_INPUT_READ, toc_callback, gc);
 
-	g_snprintf(buf, sizeof(buf), _("Signon: %s"), purple_account_get_username(gc->account));
+	g_snprintf(buf, sizeof(buf), _("Signon: %s"), purple_account_get_username(purple_connection_get_account(gc)));
 	purple_connection_update_progress(gc, buf, 1, TOC_CONNECT_STEPS);
 }
 
@@ -646,12 +646,12 @@ parse_toc_buddy_list(PurpleAccount *acco
 		}
 	} while ((c = strtok(NULL, "\n")));
 
-	if (account->gc) {
+	if (purple_account_get_connection(account)) {
 		if (buddies != NULL) {
 			purple_account_add_buddies(account, buddies);
 			g_list_free(buddies);
 		}
-		serv_set_permit_deny(account->gc);
+		serv_set_permit_deny(purple_account_get_connection(account));
 	}
 	g_list_free(buddies);
 }
@@ -738,7 +738,7 @@ static void toc_callback(gpointer data, 
 
 		tdt->state = STATE_ONLINE;
 
-		purple_connection_set_state(gc, PURPLE_CONNECTED);
+		purple_connection_set_state(gc, PURPLE_CONNECTION_STATE_CONNECTED);
 
 		/*
 		 * Add me to my buddy list so that we know the time when
@@ -798,7 +798,7 @@ static void toc_callback(gpointer data, 
 	} else if (!g_ascii_strcasecmp(c, "NICK")) {
 		/* ignore NICK so that things get imported/exported properly
 		c = strtok(NULL, ":");
-		g_snprintf(gc->username, sizeof(gc->username), "%s", c);
+		g_snprintf(purple_account_get_username(gc), sizeof(purple_account_get_username(gc)), "%s", c);
 		*/
 	} else if (!g_ascii_strcasecmp(c, "IM_IN")) {
 		char *away, *message;
@@ -861,7 +861,7 @@ static void toc_callback(gpointer data, 
 		 * If we have info for ourselves then set our display name, warning
 		 * level and official time of login.
 		 */
-		tmp = g_strdup(purple_normalize(account, purple_account_get_username(gc->account)));
+		tmp = g_strdup(purple_normalize(account, purple_account_get_username(purple_connection_get_account(gc))));
 		if (!strcmp(tmp, purple_normalize(account, c))) {
 			purple_connection_set_display_name(gc, c);
 			/* XXX - What should the second parameter be here? */
@@ -986,7 +986,7 @@ static void toc_callback(gpointer data, 
 		url = strtok(NULL, ":");
 
 		g_snprintf(tmp, sizeof(tmp), "http://%s:%d/%s", tdt->toc_ip,
-				purple_account_get_int(gc->account, "port", TOC_PORT),
+				purple_account_get_int(purple_connection_get_account(gc), "port", TOC_PORT),
 				url);
 		purple_url_fetch(tmp, FALSE, NULL, FALSE, toc_got_info, gc);
 	} else if (!g_ascii_strcasecmp(c, "DIR_STATUS")) {
@@ -1061,7 +1061,7 @@ static void toc_callback(gpointer data, 
 			ft->size = totalsize;
 			ft->files = files;
 			g_snprintf(ft->UID, sizeof(ft->UID), "%s", FILE_SEND_UID);
-			ft->gc = gc;
+			purple_account_get_connection(ft) = gc;
 
 			g_free(tmp);
 			for (i--; i >= 0; i--)
@@ -1100,7 +1100,7 @@ static void toc_callback(gpointer data, 
 				ft->message = NULL;
 			ft->user = g_strdup(user);
 			g_snprintf(ft->UID, sizeof(ft->UID), "%s", FILE_GET_UID);
-			ft->gc = gc;
+			purple_account_get_connection(ft) = gc;
 
 			g_free(tmp);
 			for (i--; i >= 0; i--)
@@ -1152,7 +1152,7 @@ static int toc_send_im(PurpleConnection 
 		g_free(buf1);
 		return -E2BIG;
 	}
-	buf2 = g_strdup_printf("toc_send_im %s \"%s\"%s", purple_normalize(gc->account, name), buf1,
+	buf2 = g_strdup_printf("toc_send_im %s \"%s\"%s", purple_normalize(purple_connection_get_account(gc), name), buf1,
 						   ((flags & PURPLE_MESSAGE_AUTO_RESP) ? " auto" : ""));
 	g_free(buf1);
 #else
@@ -1176,7 +1176,7 @@ static int toc_send_im(PurpleConnection 
 		return -E2BIG;
 	}
 
-	buf2 = g_strdup_printf("toc2_send_im_enc %s F U en \"%s\" %s", purple_normalize(gc->account, name), buf1, 
+	buf2 = g_strdup_printf("toc2_send_im_enc %s F U en \"%s\" %s", purple_normalize(purple_connection_get_account(gc), name), buf1, 
 						   ((flags & PURPLE_MESSAGE_AUTO_RESP) ? "auto" : ""));
 	g_free(buf1);
 #endif
@@ -1190,7 +1190,7 @@ static void toc_set_config(PurpleConnect
 static void toc_set_config(PurpleConnection *gc)
 {
 	char *buf = g_malloc(MSG_LEN), snd[BUF_LEN * 2];
-	toc_build_config(gc->account, buf, MSG_LEN - strlen("toc_set_config \\{\\}"), FALSE);
+	toc_build_config(purple_connection_get_account(gc), buf, MSG_LEN - strlen("toc_set_config \\{\\}"), FALSE);
 	g_snprintf(snd, MSG_LEN, "toc_set_config {%s}", buf);
 	sflap_send(gc, snd, -1, TYPE_DATA);
 	g_free(buf);
@@ -1199,7 +1199,7 @@ static void toc_get_info(PurpleConnectio
 static void toc_get_info(PurpleConnection *gc, const char *name)
 {
 	char buf[BUF_LEN * 2];
-	g_snprintf(buf, MSG_LEN, "toc_get_info %s", purple_normalize(gc->account, name));
+	g_snprintf(buf, MSG_LEN, "toc_get_info %s", purple_normalize(purple_connection_get_account(gc), name));
 	sflap_send(gc, buf, -1, TYPE_DATA);
 }
 
@@ -1291,7 +1291,7 @@ toc_add_buddy(PurpleConnection *gc, Purp
 toc_add_buddy(PurpleConnection *gc, PurpleBuddy *buddy, PurpleGroup *group)
 {
 	char buf[BUF_LEN * 2];
-	g_snprintf(buf, sizeof(buf), "toc_add_buddy %s", purple_normalize(gc->account, buddy->name));
+	g_snprintf(buf, sizeof(buf), "toc_add_buddy %s", purple_normalize(purple_connection_get_account(gc), buddy->name));
 	sflap_send(gc, buf, -1, TYPE_DATA);
 	toc_set_config(gc);
 }
@@ -1306,11 +1306,11 @@ static void toc_add_buddies(PurpleConnec
 	for (cur = buddies; cur != NULL; cur = cur->next) {
 		PurpleBuddy *buddy = cur->data;
 
-		if (strlen(purple_normalize(gc->account, buddy->name)) + n + 32 > MSG_LEN) {
+		if (strlen(purple_normalize(purple_connection_get_account(gc), buddy->name)) + n + 32 > MSG_LEN) {
 			sflap_send(gc, buf, -1, TYPE_DATA);
 			n = g_snprintf(buf, sizeof(buf), "toc_add_buddy");
 		}
-		n += g_snprintf(buf + n, sizeof(buf) - n, " %s", purple_normalize(gc->account, buddy->name));
+		n += g_snprintf(buf + n, sizeof(buf) - n, " %s", purple_normalize(purple_connection_get_account(gc), buddy->name));
 	}
 	sflap_send(gc, buf, -1, TYPE_DATA);
 }
@@ -1318,7 +1318,7 @@ static void toc_remove_buddy(PurpleConne
 static void toc_remove_buddy(PurpleConnection *gc, PurpleBuddy *buddy, PurpleGroup *group)
 {
 	char buf[BUF_LEN * 2];
-	g_snprintf(buf, sizeof(buf), "toc_remove_buddy %s", purple_normalize(gc->account, buddy->name));
+	g_snprintf(buf, sizeof(buf), "toc_remove_buddy %s", purple_normalize(purple_connection_get_account(gc), buddy->name));
 	sflap_send(gc, buf, -1, TYPE_DATA);
 	toc_set_config(gc);
 }
@@ -1333,11 +1333,11 @@ static void toc_remove_buddies(PurpleCon
 	for (cur = buddies; cur != NULL; cur = cur->next) {
 		PurpleBuddy *buddy = cur->data;
 
-		if (strlen(purple_normalize(gc->account, buddy->name)) + n + 32 > MSG_LEN) {
+		if (strlen(purple_normalize(purple_connection_get_account(gc), buddy->name)) + n + 32 > MSG_LEN) {
 			sflap_send(gc, buf, -1, TYPE_DATA);
 			n = g_snprintf(buf, sizeof(buf), "toc_remove_buddy");
 		}
-		n += g_snprintf(buf + n, sizeof(buf) - n, " %s", purple_normalize(gc->account, buddy->name));
+		n += g_snprintf(buf + n, sizeof(buf) - n, " %s", purple_normalize(purple_connection_get_account(gc), buddy->name));
 	}
 	sflap_send(gc, buf, -1, TYPE_DATA);
 	toc_set_config(gc);
@@ -1413,7 +1413,7 @@ static void toc_chat_invite(PurpleConnec
 {
 	char buf[BUF_LONG];
 	g_snprintf(buf, sizeof(buf) / 2, "toc_chat_invite %d \"%s\" %s", id,
-			message ? message : "", purple_normalize(gc->account, name));
+			message ? message : "", purple_normalize(purple_connection_get_account(gc), name));
 	sflap_send(gc, buf, -1, TYPE_DATA);
 }
 
@@ -1448,7 +1448,7 @@ static void toc_chat_whisper(PurpleConne
 {
 	char *buf1, *buf2;
 	buf1 = escape_text(message);
-	buf2 = g_strdup_printf("toc_chat_whisper %d %s \"%s\"", id, purple_normalize(gc->account, who), buf1);
+	buf2 = g_strdup_printf("toc_chat_whisper %d %s \"%s\"", id, purple_normalize(purple_connection_get_account(gc), who), buf1);
 	g_free(buf1);
 	sflap_send(gc, buf2, -1, TYPE_DATA);
 	g_free(buf2);
@@ -1543,9 +1543,9 @@ static void toc_add_permit(PurpleConnect
 static void toc_add_permit(PurpleConnection *gc, const char *who)
 {
 	char buf2[BUF_LEN * 2];
-	if (gc->account->perm_deny != 3)
+	if (purple_connection_get_account(gc)->perm_deny != 3)
 		return;
-	g_snprintf(buf2, sizeof(buf2), "toc_add_permit %s", purple_normalize(gc->account, who));
+	g_snprintf(buf2, sizeof(buf2), "toc_add_permit %s", purple_normalize(purple_connection_get_account(gc), who));
 	sflap_send(gc, buf2, -1, TYPE_DATA);
 	toc_set_config(gc);
 }
@@ -1553,9 +1553,9 @@ static void toc_add_deny(PurpleConnectio
 static void toc_add_deny(PurpleConnection *gc, const char *who)
 {
 	char buf2[BUF_LEN * 2];
-	if (gc->account->perm_deny != 4)
+	if (purple_connection_get_account(gc)->perm_deny != 4)
 		return;
-	g_snprintf(buf2, sizeof(buf2), "toc_add_deny %s", purple_normalize(gc->account, who));
+	g_snprintf(buf2, sizeof(buf2), "toc_add_deny %s", purple_normalize(purple_connection_get_account(gc), who));
 	sflap_send(gc, buf2, -1, TYPE_DATA);
 	toc_set_config(gc);
 }
@@ -1566,7 +1566,7 @@ static void toc_set_permit_deny(PurpleCo
 	GSList *list;
 	int at;
 
-	switch (gc->account->perm_deny) {
+	switch (purple_connection_get_account(gc)->perm_deny) {
 	case 1:
 		/* permit all, deny none. to get here reliably we need to have been in permit
 		 * mode, and send an empty toc_add_deny message, which will switch us to deny none */
@@ -1590,9 +1590,9 @@ static void toc_set_permit_deny(PurpleCo
 		sflap_send(gc, buf2, -1, TYPE_DATA);
 
 		at = g_snprintf(buf2, sizeof(buf2), "toc_add_permit ");
-		list = gc->account->permit;
+		list = purple_connection_get_account(gc)->permit;
 		while (list) {
-			at += g_snprintf(buf2 + at, sizeof(buf2) - at, "%s ", purple_normalize(gc->account, list->data));
+			at += g_snprintf(buf2 + at, sizeof(buf2) - at, "%s ", purple_normalize(purple_connection_get_account(gc), list->data));
 			if (at > MSG_LEN + 32) {	/* from out my ass comes greatness */
 				sflap_send(gc, buf2, -1, TYPE_DATA);
 				at = g_snprintf(buf2, sizeof(buf2), "toc_add_permit ");
@@ -1608,9 +1608,9 @@ static void toc_set_permit_deny(PurpleCo
 		sflap_send(gc, buf2, -1, TYPE_DATA);
 
 		at = g_snprintf(buf2, sizeof(buf2), "toc_add_deny ");
-		list = gc->account->deny;
+		list = purple_connection_get_account(gc)->deny;
 		while (list) {
-			at += g_snprintf(buf2 + at, sizeof(buf2) - at, "%s ", purple_normalize(gc->account, list->data));
+			at += g_snprintf(buf2 + at, sizeof(buf2) - at, "%s ", purple_normalize(purple_connection_get_account(gc), list->data));
 			if (at > MSG_LEN + 32) {	/* from out my ass comes greatness */
 				sflap_send(gc, buf2, -1, TYPE_DATA);
 				at = g_snprintf(buf2, sizeof(buf2), "toc_add_deny ");
@@ -1627,14 +1627,14 @@ static void toc_rem_permit(PurpleConnect
 
 static void toc_rem_permit(PurpleConnection *gc, const char *who)
 {
-	if (gc->account->perm_deny != 3)
+	if (purple_connection_get_account(gc)->perm_deny != 3)
 		return;
 	toc_set_permit_deny(gc);
 }
 
 static void toc_rem_deny(PurpleConnection *gc, const char *who)
 {
-	if (gc->account->perm_deny != 4)
+	if (purple_connection_get_account(gc)->perm_deny != 4)
 		return;
 	toc_set_permit_deny(gc);
 }
@@ -1795,7 +1795,7 @@ static void toc_send_file_callback(gpoin
 			ft->file = g_fopen(ft->filename, "w");
 			if (!ft->file) {
 				buf = g_strdup_printf(_("Could not open %s for writing!"), ft->filename);
-				purple_notify_error(ft->gc, NULL, buf, g_strerror(errno));
+				purple_notify_error(purple_account_get_connection(ft), NULL, buf, g_strerror(errno));
 				g_free(buf);
 				purple_input_remove(ft->inpa);
 				close(source);
@@ -1812,7 +1812,7 @@ static void toc_send_file_callback(gpoin
 			if (!ft->file) {
 				buf = g_strdup_printf("Could not open %s/%s for writing!", ft->filename,
 						ft->hdr.name);
-				purple_notify_error(ft->gc, NULL, buf, g_strerror(errno));
+				purple_notify_error(purple_account_get_connection(ft), NULL, buf, g_strerror(errno));
 				g_free(buf);
 				purple_input_remove(ft->inpa);
 				close(source);
@@ -1829,7 +1829,7 @@ static void toc_send_file_callback(gpoin
 
 	rt = read(source, buf, MIN(ntohl(ft->hdr.size) - ft->recvsize, 1024));
 	if (rt < 0) {
-		purple_notify_error(ft->gc, NULL,
+		purple_notify_error(purple_account_get_connection(ft), NULL,
 						  _("File transfer failed; other side probably "
 							"canceled."), NULL);
 		purple_input_remove(ft->inpa);
@@ -1874,7 +1874,7 @@ static void toc_send_file_connect(gpoint
 	struct file_transfer *ft = data;
 
 	if (src == -1) {
-		purple_notify_error(ft->gc, NULL,
+		purple_notify_error(purple_account_get_connection(ft), NULL,
 						  _("Could not connect for transfer."), NULL);
 		g_free(ft->filename);
 		g_free(ft->cookie);
@@ -1906,15 +1906,15 @@ static void toc_send_file(gpointer a, st
 	ft->ip = g_strdup(old_ft->ip);
 	ft->files = old_ft->files;
 	ft->port = old_ft->port;
-	ft->gc = old_ft->gc;
-	account = ft->gc->account;
+	purple_account_get_connection(ft) = old_purple_account_get_connection(ft);
+	account = purple_account_get_connection(ft)->account;
 	gtk_widget_destroy(old_ft->window);
 
 	g_snprintf(buf, sizeof(buf), "toc_rvous_accept %s %s %s", ft->user, ft->cookie, FILE_SEND_UID);
-	sflap_send(ft->gc, buf, -1, TYPE_DATA);
+	sflap_send(purple_account_get_connection(ft), buf, -1, TYPE_DATA);
 
-	if (purple_proxy_connect(ft->gc, account, ft->ip, ft->port, toc_send_file_connect, ft) != 0) {
-		purple_notify_error(ft->gc, NULL,
+	if (purple_proxy_connect(purple_account_get_connection(ft), account, ft->ip, ft->port, toc_send_file_connect, ft) != 0) {
+		purple_notify_error(purple_account_get_connection(ft), NULL,
 						  _("Could not connect for transfer."), NULL);
 		g_free(ft->filename);
 		g_free(ft->cookie);
@@ -1981,7 +1981,7 @@ static void toc_get_file_callback(gpoint
 
 		if (ft->hdr.hdrtype != htons(0x120c)) {
 			g_snprintf(buf, sizeof(buf), "%s decided to cancel the transfer", ft->user);
-			purple_notify_error(ft->gc, NULL, buf, NULL);
+			purple_notify_error(purple_account_get_connection(ft), NULL, buf, NULL);
 			purple_input_remove(ft->inpa);
 			close(source);
 			g_free(ft->filename);
@@ -2038,7 +2038,7 @@ static void toc_get_file_connect(gpointe
 	char *basename;
 
 	if (src == -1) {
-		purple_notify_error(ft->gc, NULL,
+		purple_notify_error(purple_account_get_connection(ft), NULL,
 						  _("Could not connect for transfer."), NULL);
 		fclose(ft->file);
 		g_free(ft->filename);
@@ -2071,7 +2071,7 @@ static void toc_get_file_connect(gpointe
 	hdr->lsizeoffset = 0x10;
 	g_snprintf(hdr->name, 64, "listing.txt");
 	if (write(src, hdr, 256) < 0) {
-		purple_notify_error(ft->gc, NULL,
+		purple_notify_error(purple_account_get_connection(ft), NULL,
 						  _("Could not write file header.  The file will "
 							"not be transferred."), NULL);
 		fclose(ft->file);
@@ -2100,7 +2100,7 @@ static void toc_get_file(gpointer a, str
 	ft->file = g_fopen(ft->filename, "r");
 	if (!ft->file) {
 		buf = g_strdup_printf("Unable to open %s for transfer.", ft->filename);
-		purple_notify_error(ft->gc, NULL, buf, NULL);
+		purple_notify_error(purple_account_get_connection(ft), NULL, buf, NULL);
 		g_free(buf);
 		g_free(ft->filename);
 		g_free(ft);
@@ -2108,7 +2108,7 @@ static void toc_get_file(gpointer a, str
 	}
 	if (g_stat(dirname, &ft->st)) {
 		buf = g_strdup_printf("Unable to examine %s.", dirname);
-		purple_notify_error(ft->gc, NULL, buf, NULL);
+		purple_notify_error(purple_account_get_connection(ft), NULL, buf, NULL);
 		g_free(buf);
 		g_free(ft->filename);
 		g_free(ft);
@@ -2118,15 +2118,15 @@ static void toc_get_file(gpointer a, str
 	ft->user = g_strdup(old_ft->user);
 	ft->ip = g_strdup(old_ft->ip);
 	ft->port = old_ft->port;
-	ft->gc = old_ft->gc;
-	account = ft->gc->account;
+	purple_account_get_connection(ft) = old_purple_account_get_connection(ft);
+	account = purple_account_get_connection(ft)->account;
 	gtk_widget_destroy(old_ft->window);
 
 	g_snprintf(buf2, sizeof(buf2), "toc_rvous_accept %s %s %s", ft->user, ft->cookie, FILE_GET_UID);
-	sflap_send(ft->gc, buf2, -1, TYPE_DATA);
+	sflap_send(purple_account_get_connection(ft), buf2, -1, TYPE_DATA);
 
-	if (purple_proxy_connect(ft->gc, account, ft->ip, ft->port, toc_get_file_connect, ft) < 0) {
-		purple_notify_error(ft->gc, NULL,
+	if (purple_proxy_connect(purple_account_get_connection(ft), account, ft->ip, ft->port, toc_get_file_connect, ft) < 0) {
+		purple_notify_error(purple_account_get_connection(ft), NULL,
 						  _("Could not connect for transfer."), NULL);
 		fclose(ft->file);
 		g_free(ft->filename);
@@ -2160,12 +2160,12 @@ static void toc_accept_ft(struct ft_requ
 
 
 static void toc_accept_ft(struct ft_request *fr) {
-	if(g_list_find(purple_connections_get_all(), fr->gc)) {
+	if(g_list_find(purple_connections_get_all(), purple_account_get_connection(fr))) {
 		GtkWidget *window;
 		char buf[BUF_LEN];
 
 		struct file_transfer *ft = g_new0(struct file_transfer, 1);
-		ft->gc = fr->gc;
+		purple_account_get_connection(ft) = purple_account_get_connection(fr);
 		ft->user = g_strdup(fr->user);
 		ft->cookie = g_strdup(fr->cookie);
 		ft->ip = g_strdup(fr->ip);
@@ -2209,14 +2209,14 @@ static void accept_file_dialog(struct ft
 				"%s requests %s to accept %d file: %s (%.2f %s)%s%s",
 				"%s requests %s to accept %d files: %s (%.2f %s)%s%s",
 				ft->files),
-				ft->user, purple_account_get_username(ft->gc->account), ft->files,
+				ft->user, purple_account_get_username(purple_account_get_connection(ft)->account), ft->files,
 				ft->filename, size, sizes[index], (ft->message) ? "\n" : "",
 				(ft->message) ? ft->message : "");
 	} else {
 		g_snprintf(buf, sizeof(buf), _("%s requests you to send them a file"), ft->user);
 	}
 
-	purple_request_accept_cancel(ft->gc, NULL, buf, NULL, 
+	purple_request_accept_cancel(purple_account_get_connection(ft), NULL, buf, NULL, 
 							   PURPLE_DEFAULT_ACTION_NONE, ft,
 							   G_CALLBACK(toc_accept_ft),
 							   G_CALLBACK(toc_reject_ft));
============================================================
--- libpurple/protocols/yahoo/yahoo.c	2cda90950e86bad176a886e9d33adf53a984e8f6
+++ libpurple/protocols/yahoo/yahoo.c	949f85346e8369b47b2f3e64b2daae65056c388d
@@ -166,7 +166,7 @@ static void yahoo_process_status(PurpleC
 		case 1: /* we don't get the full buddy list here. */
 			if (!yd->logged_in) {
 				purple_connection_set_display_name(gc, pair->value);
-				purple_connection_set_state(gc, PURPLE_CONNECTED);
+				purple_connection_set_state(gc, PURPLE_CONNECTION_STATE_CONNECTED);
 				yd->logged_in = TRUE;
 				if (yd->picture_upload_todo) {
 					yahoo_buddy_icon_upload(gc, yd->picture_upload_todo);
@@ -310,12 +310,12 @@ static void yahoo_process_status(PurpleC
 			if (!name)
 				break;
 
-			b = purple_find_buddy(gc->account, name);
+			b = purple_find_buddy(purple_connection_get_account(gc), name);
 
 			if (!cksum || (cksum == -1)) {
 				if (f)
 					yahoo_friend_set_buddy_icon_need_request(f, TRUE);
-				purple_buddy_icons_set_for_user(gc->account, name, NULL, 0, NULL);
+				purple_buddy_icons_set_for_user(purple_connection_get_account(gc), name, NULL, 0, NULL);
 				break;
 			}
 
@@ -520,7 +520,7 @@ static void yahoo_process_list_15(Purple
 			} else {
 				/* This buddy is on the ignore list (and therefore in no group) */
 				purple_debug_info("yahoo", "%s adding %s to the deny list because of the ignore list / no group was found",
-								  account->username, norm_bud);
+								  purple_account_get_username(account), norm_bud);
 				purple_privacy_deny_add(account, norm_bud, 1);
 			}
 			break;
@@ -664,7 +664,7 @@ static void yahoo_process_list(PurpleCon
 	{
 		account->perm_deny = PURPLE_PRIVACY_DENY_USERS;
 		purple_debug_info("yahoo", "%s privacy defaulting to PURPLE_PRIVACY_DENY_USERS.\n",
-				account->username);
+				purple_account_get_username(account));
 	}
 
 	if (yd->tmp_serv_plist) {
@@ -673,7 +673,7 @@ static void yahoo_process_list(PurpleCon
 			f = yahoo_friend_find(gc, *bud);
 			if (f) {
 				purple_debug_info("yahoo", "%s setting presence for %s to PERM_OFFLINE\n",
-						account->username, *bud);
+						purple_account_get_username(account), *bud);
 				f->presence = YAHOO_PRESENCE_PERM_OFFLINE;
 			}
 		}
@@ -932,7 +932,7 @@ yahoo_buddy_add_authorize_cb(gpointer da
 {
 	struct yahoo_add_request *add_req = data;
 	struct yahoo_packet *pkt;
-	struct yahoo_data *yd = add_req->gc->proto_data;
+	struct yahoo_data *yd = add_purple_account_get_connection(req)->proto_data;
 
 	pkt = yahoo_packet_new(YAHOO_SERVICE_AUTH_REQ_15, YAHOO_STATUS_AVAILABLE, 0);
 	yahoo_packet_hash(pkt, "ssiii",
@@ -951,13 +951,13 @@ yahoo_buddy_add_deny_cb(struct yahoo_add
 static void
 yahoo_buddy_add_deny_cb(struct yahoo_add_request *add_req, const char *msg)
 {
-	struct yahoo_data *yd = add_req->gc->proto_data;
+	struct yahoo_data *yd = add_purple_account_get_connection(req)->proto_data;
 	struct yahoo_packet *pkt;
 	char *encoded_msg = NULL;
-	PurpleAccount *account = purple_connection_get_account(add_req->gc);
+	PurpleAccount *account = purple_connection_get_account(add_purple_account_get_connection(req));
 
 	if (msg && *msg)
-		encoded_msg = yahoo_string_encode(add_req->gc, msg, NULL);
+		encoded_msg = yahoo_string_encode(add_purple_account_get_connection(req), msg, NULL);
 
 	pkt = yahoo_packet_new(YAHOO_SERVICE_AUTH_REQ_15,
 			YAHOO_STATUS_AVAILABLE, 0);
@@ -988,11 +988,11 @@ yahoo_buddy_add_deny_reason_cb(gpointer 
 static void
 yahoo_buddy_add_deny_reason_cb(gpointer data) {
 	struct yahoo_add_request *add_req = data;
-	purple_request_input(add_req->gc, NULL, _("Authorization denied message:"),
+	purple_request_input(add_purple_account_get_connection(req), NULL, _("Authorization denied message:"),
 			NULL, _("No reason given."), TRUE, FALSE, NULL,
 			_("OK"), G_CALLBACK(yahoo_buddy_add_deny_cb),
 			_("Cancel"), G_CALLBACK(yahoo_buddy_add_deny_noreason_cb),
-			purple_connection_get_account(add_req->gc), add_req->who, NULL,
+			purple_connection_get_account(add_purple_account_get_connection(req)), add_req->who, NULL,
 			add_req);
 }
 
@@ -1063,7 +1063,7 @@ static void yahoo_buddy_auth_req_15(Purp
 		const char *firstname = NULL, *lastname = NULL;
 
 		add_req = g_new0(struct yahoo_add_request, 1);
-		add_req->gc = gc;
+		add_purple_account_get_connection(req) = gc;
 
 		while (l) {
 			struct yahoo_pair *pair = l->data;
@@ -1144,7 +1144,7 @@ static void yahoo_buddy_added_us(PurpleC
 	account = purple_connection_get_account(gc);
 
 	add_req = g_new0(struct yahoo_add_request, 1);
-	add_req->gc = gc;
+	add_purple_account_get_connection(req) = gc;
 
 	while (l) {
 		struct yahoo_pair *pair = l->data;
@@ -2015,7 +2015,7 @@ static void ignore_buddy(PurpleBuddy *bu
 	purple_account_remove_buddy(account, buddy, group);
 	purple_blist_remove_buddy(buddy);
 
-	serv_add_deny(account->gc, name);
+	serv_add_deny(purple_account_get_connection(account), name);
 
 	g_free(name);
 }
@@ -2067,12 +2067,12 @@ static void yahoo_process_ignore(PurpleC
 							  who, (ignore ? "ignoring" : "unignoring"));
 
 			if (ignore) {
-				b = purple_find_buddy(gc->account, who);
+				b = purple_find_buddy(purple_connection_get_account(gc), who);
 				g_snprintf(buf, sizeof(buf), _("You have tried to ignore %s, but the "
 											   "user is on your buddy list.  Clicking \"Yes\" "
 											   "will remove and ignore the buddy."), who);
 				purple_request_yes_no(gc, NULL, _("Ignore buddy?"), buf, 0,
-									  gc->account, who, NULL,
+									  purple_connection_get_account(gc), who, NULL,
 									  b,
 									  G_CALLBACK(ignore_buddy),
 									  G_CALLBACK(keep_buddy));
@@ -2101,7 +2101,7 @@ static void yahoo_process_authresp(Purpl
 	char *msg;
 	char *url = NULL;
 	char *fullmsg;
-	PurpleAccount *account = gc->account;
+	PurpleAccount *account = purple_connection_get_account(gc);
 	PurpleConnectionError reason = PURPLE_CONNECTION_ERROR_AUTHENTICATION_FAILED;
 
 	while (l) {
@@ -2596,7 +2596,7 @@ static void yahoo_got_connected(gpointer
 
 	pkt = yahoo_packet_new(YAHOO_SERVICE_AUTH, yd->current_status, 0);
 
-	yahoo_packet_hash_str(pkt, 1, purple_normalize(gc->account, purple_account_get_username(purple_connection_get_account(gc))));
+	yahoo_packet_hash_str(pkt, 1, purple_normalize(purple_connection_get_account(gc), purple_account_get_username(purple_connection_get_account(gc))));
 	yahoo_packet_send_and_free(pkt, yd);
 
 	gc->inpa = purple_input_add(yd->fd, PURPLE_INPUT_READ, yahoo_pending, gc);
@@ -2629,8 +2629,8 @@ static void yahoo_got_web_connected(gpoi
 	pkt = yahoo_packet_new(YAHOO_SERVICE_WEBLOGIN, YAHOO_STATUS_WEBLOGIN, 0);
 
 	yahoo_packet_hash(pkt, "sss", 0,
-	                  purple_normalize(gc->account, purple_account_get_username(purple_connection_get_account(gc))),
-	                  1, purple_normalize(gc->account, purple_account_get_username(purple_connection_get_account(gc))),
+	                  purple_normalize(purple_connection_get_account(gc), purple_account_get_username(purple_connection_get_account(gc))),
+	                  1, purple_normalize(purple_connection_get_account(gc), purple_account_get_username(purple_connection_get_account(gc))),
 	                  6, yd->auth);
 	yahoo_packet_send_and_free(pkt, yd);
 
@@ -2972,7 +2972,7 @@ static void yahoo_login(PurpleAccount *a
 	PurpleConnection *gc = purple_account_get_connection(account);
 	struct yahoo_data *yd = gc->proto_data = g_new0(struct yahoo_data, 1);
 	PurpleStatus *status = purple_account_get_active_status(account);
-	gc->flags |= PURPLE_CONNECTION_HTML | PURPLE_CONNECTION_NO_BGCOLOR | PURPLE_CONNECTION_NO_URLDESC;
+	gc->flags |= PURPLE_CONNECTION_FLAGS_HTML | PURPLE_CONNECTION_FLAGS_NO_BGCOLOR | PURPLE_CONNECTION_FLAGS_NO_URLDESC;
 
 	purple_connection_update_progress(gc, _("Connecting"), 1, 2);
 
@@ -3231,7 +3231,7 @@ static char *yahoo_status_text(PurpleBud
 	const char *msg;
 	char *msg2;
 
-	f = yahoo_friend_find(b->account->gc, b->name);
+	f = yahoo_friend_find(purple_account_get_connection(b->account), b->name);
 	if (!f)
 		return g_strdup(_("Not on server list"));
 
@@ -3261,7 +3261,7 @@ void yahoo_tooltip_text(PurpleBuddy *b, 
 	char *status = NULL;
 	const char *presence = NULL;
 
-	f = yahoo_friend_find(b->account->gc, b->name);
+	f = yahoo_friend_find(purple_account_get_connection(b->account), b->name);
 	if (!f)
 		status = g_strdup_printf("\n%s", _("Not on server list"));
 	else {
@@ -3372,7 +3372,7 @@ static void yahoo_doodle_blist_node(Purp
 static void yahoo_doodle_blist_node(PurpleBlistNode *node, gpointer data)
 {
 	PurpleBuddy *b = (PurpleBuddy *)node;
-	PurpleConnection *gc = b->account->gc;
+	PurpleConnection *gc = purple_account_get_connection(b->account);
 
 	yahoo_doodle_initiate(gc, b->name);
 }
@@ -3525,7 +3525,7 @@ static void yahoo_show_inbox(PurplePlugi
 	gboolean use_whole_url = FALSE;
 
 	/* use whole URL if using HTTP Proxy */
-	if ((gc->account->proxy_info) && (gc->account->proxy_info->type == PURPLE_PROXY_HTTP))
+	if ((purple_connection_get_account(gc)->proxy_info) && (purple_connection_get_account(gc)->proxy_info->type == PURPLE_PROXY_HTTP))
 	    use_whole_url = TRUE;
 
 	url_data = purple_util_fetch_url_request(base_url, use_whole_url,
@@ -3619,7 +3619,7 @@ static int yahoo_send_im(PurpleConnectio
 	 *
 	 * If they have no set an IMVironment, then use the default.
 	 */
-	wb = purple_whiteboard_get_session(gc->account, who);
+	wb = purple_whiteboard_get_session(purple_connection_get_account(gc), who);
 	if (wb)
 		yahoo_packet_hash_str(pkt, 63, DOODLE_IMV_KEY);
 	else
@@ -4078,7 +4078,7 @@ yahoopurple_cmd_buzz(PurpleConversation 
 	if (*args && args[0])
 		return PURPLE_CMD_RET_FAILED;
 
-	serv_send_attention(account->gc, c->name, YAHOO_BUZZ);
+	serv_send_attention(purple_account_get_connection(account), c->name, YAHOO_BUZZ);
 
 	return PURPLE_CMD_RET_OK;
 }
@@ -4135,7 +4135,7 @@ gboolean yahoo_send_attention(PurpleConn
 	PurpleConversation *c;
 
 	c = purple_find_conversation_with_account(PURPLE_CONV_TYPE_IM,
-			username, gc->account);
+			username, purple_connection_get_account(gc));
 
 	g_return_val_if_fail(c != NULL, FALSE);
 
============================================================
--- libpurple/protocols/yahoo/yahoo_aliases.c	ed2a609c354f204e7677be611301ff6652d1a7d1
+++ libpurple/protocols/yahoo/yahoo_aliases.c	de5e88c14a1c7fbe35ac24f4b12d8c5b3ed6e62f
@@ -59,7 +59,7 @@ yahoo_fetch_aliases_cb(PurpleUtilFetchUr
 yahoo_fetch_aliases_cb(PurpleUtilFetchUrlData *url_data, gpointer user_data,const gchar *url_text, size_t len, const gchar *error_message)
 {
 	struct callback_data *cb = user_data;
-	PurpleConnection *gc = cb->gc;
+	PurpleConnection *gc = purple_account_get_connection(cb);
 	struct yahoo_data *yd = gc->proto_data;
 
 	yd->url_datas = g_slist_remove(yd->url_datas, url_data);
@@ -106,7 +106,7 @@ yahoo_fetch_aliases_cb(PurpleUtilFetchUr
 					alias = NULL;  /* No nickname, first name or last name, then you get no alias !!  */
 
 				/*  Find the local buddy that matches */
-				b = purple_find_buddy(cb->gc->account, yid);
+				b = purple_find_buddy(purple_account_get_connection(cb)->account, yid);
 
 				/*  If we don't find a matching buddy, ignore the alias !!  */
 				if (b != NULL) {
@@ -121,11 +121,11 @@ yahoo_fetch_aliases_cb(PurpleUtilFetchUr
 
 					/* Finally, if we received an alias, we better update the buddy list */
 					if (alias != NULL) {
-						serv_got_alias(cb->gc, yid, alias);
+						serv_got_alias(purple_account_get_connection(cb), yid, alias);
 						purple_debug_info("yahoo","Fetched alias '%s' (%s)\n",alias,id);
 					} else if (b->alias != alias && strcmp(b->alias, "") != 0) {
 					/* Or if we have an alias that Yahoo doesn't, send it up */
-						yahoo_update_alias(cb->gc, yid, b->alias);
+						yahoo_update_alias(purple_account_get_connection(cb), yid, b->alias);
 						purple_debug_info("yahoo","Sent alias '%s'\n", b->alias);
 					}
 				} else {
@@ -151,12 +151,12 @@ yahoo_fetch_aliases(PurpleConnection *gc
 	gboolean use_whole_url = FALSE;
 
 	/* use whole URL if using HTTP Proxy */
-	if ((gc->account->proxy_info) && (gc->account->proxy_info->type == PURPLE_PROXY_HTTP))
+	if ((purple_connection_get_account(gc)->proxy_info) && (purple_connection_get_account(gc)->proxy_info->type == PURPLE_PROXY_HTTP))
 	    use_whole_url = TRUE;
 
 	/* Using callback_data so I have access to gc in the callback function */
 	cb = g_new0(struct callback_data, 1);
-	cb->gc = gc;
+	purple_account_get_connection(cb) = gc;
 
 	/*  Build all the info to make the web request */
 	url = yd->jp ? YAHOOJP_ALIAS_FETCH_URL : YAHOO_ALIAS_FETCH_URL;
@@ -188,7 +188,7 @@ yahoo_update_alias_cb(PurpleUtilFetchUrl
 {
 	xmlnode *node, *result;
 	struct callback_data *cb = user_data;
-	PurpleConnection *gc = cb->gc;
+	PurpleConnection *gc = purple_account_get_connection(cb);
 	struct yahoo_data *yd;
 
 	yd = gc->proto_data;
@@ -241,7 +241,7 @@ yahoo_update_alias(PurpleConnection *gc,
 	gboolean use_whole_url = FALSE;
 
 	/* use whole URL if using HTTP Proxy */
-	if ((gc->account->proxy_info) && (gc->account->proxy_info->type == PURPLE_PROXY_HTTP))
+	if ((purple_connection_get_account(gc)->proxy_info) && (purple_connection_get_account(gc)->proxy_info->type == PURPLE_PROXY_HTTP))
 	    use_whole_url = TRUE;
 
 	g_return_if_fail(alias != NULL);
@@ -250,7 +250,7 @@ yahoo_update_alias(PurpleConnection *gc,
 
 	purple_debug_info("yahoo", "Sending '%s' as new alias for user '%s'.\n",alias, who);
 
-	buddy = purple_find_buddy(gc->account, who);
+	buddy = purple_find_buddy(purple_connection_get_account(gc), who);
 	if (buddy == NULL || buddy->proto_data == NULL) {
 		purple_debug_info("yahoo", "Missing proto_data (get_yahoo_aliases must have failed), bailing out\n");
 		return;
@@ -262,7 +262,7 @@ yahoo_update_alias(PurpleConnection *gc,
 	/* Using callback_data so I have access to gc in the callback function */
 	cb = g_new0(struct callback_data, 1);
 	cb->id = g_strdup(yu->id);
-	cb->gc = gc;
+	purple_account_get_connection(cb) = gc;
 
 	/*  Build all the info to make the web request */
 	url = yd->jp? YAHOOJP_ALIAS_UPDATE_URL: YAHOO_ALIAS_UPDATE_URL;
@@ -273,7 +273,7 @@ yahoo_update_alias(PurpleConnection *gc,
 		converted_alias_jp = yahoo_convert_to_numeric(alias_jp);
 		content = g_strdup_printf("<ab k=\"%s\" cc=\"1\">\n"
 		                          "<ct e=\"1\"  yi='%s' id='%s' nn='%s' pr='0' />\n</ab>\r\n",
-		                          gc->account->username, who, yu->id, converted_alias_jp);
+		                          purple_account_get_username(purple_connection_get_account(gc)), who, yu->id, converted_alias_jp);
 		free(converted_alias_jp);
 		g_free(alias_jp);
 	}
@@ -281,7 +281,7 @@ yahoo_update_alias(PurpleConnection *gc,
 		escaped_alias = g_markup_escape_text(alias, strlen(alias));
 		content = g_strdup_printf("<?xml version=\"1.0\" encoding=\"utf-8\"?><ab k=\"%s\" cc=\"1\">\n"
 		                          "<ct e=\"1\"  yi='%s' id='%s' nn='%s' pr='0' />\n</ab>\r\n",
-		                          gc->account->username, who, yu->id, escaped_alias);
+		                          purple_account_get_username(purple_connection_get_account(gc)), who, yu->id, escaped_alias);
 		g_free(escaped_alias);
 	}
 
============================================================
--- libpurple/protocols/yahoo/yahoo_doodle.c	4a86f7fd0511ca34bc48ecc2129cc568103f79cd
+++ libpurple/protocols/yahoo/yahoo_doodle.c	144192b316911fe476ddbd0aafeac646f7588db6
@@ -395,7 +395,7 @@ static void yahoo_doodle_command_send_ge
 	/* Make and send an acknowledge (ready) Doodle packet */
 	pkt = yahoo_packet_new(YAHOO_SERVICE_P2PFILEXFER, YAHOO_STATUS_AVAILABLE, 0);
 	yahoo_packet_hash_str(pkt, 49,  "IMVIRONMENT");
-	yahoo_packet_hash_str(pkt, 1,    purple_account_get_username(gc->account));
+	yahoo_packet_hash_str(pkt, 1,    purple_account_get_username(purple_connection_get_account(gc)));
 	yahoo_packet_hash_str(pkt, 14,   message);
 	yahoo_packet_hash_int(pkt, 13,   command);
 	yahoo_packet_hash_str(pkt, 5,    to);
@@ -501,14 +501,14 @@ void yahoo_doodle_send_draw_list(PurpleW
 	g_return_if_fail(draw_list != NULL);
 
 	message = yahoo_doodle_build_draw_string(ds, draw_list);
-	yahoo_doodle_command_send_draw(wb->account->gc, wb->who, message, ds->imv_key);
+	yahoo_doodle_command_send_draw(purple_account_get_connection(wb->account), wb->who, message, ds->imv_key);
 	g_free(message);
 }
 
 void yahoo_doodle_clear(PurpleWhiteboard *wb)
 {
 	doodle_session *ds = wb->proto_data;
-	yahoo_doodle_command_send_clear(wb->account->gc, wb->who, ds->imv_key);
+	yahoo_doodle_command_send_clear(purple_account_get_connection(wb->account), wb->who, ds->imv_key);
 }
 
 
============================================================
--- libpurple/protocols/yahoo/yahoo_filexfer.c	781119f6911c43edc1d6046cb10069ab6b2b1ab1
+++ libpurple/protocols/yahoo/yahoo_filexfer.c	704b56a7f89aac373b4315ebdacef99c03323b00
@@ -75,7 +75,7 @@ static void yahoo_xfer_data_free(struct 
 	PurpleXfer *xfer;
 	GSList *l;
 
-	gc = xd->gc;
+	gc = purple_account_get_connection(xd);
 	yd = gc->proto_data;
 
 	/*remove entry from map*/
@@ -243,7 +243,7 @@ static void yahoo_sendfile_connected(gpo
 	xfer->fd = source;
 
 	/* Assemble the tx buffer */
-	gc = xd->gc;
+	gc = purple_account_get_connection(xd);
 	account = purple_connection_get_account(gc);
 	yd = gc->proto_data;
 
@@ -305,7 +305,7 @@ static void yahoo_xfer_init(PurpleXfer *
 	struct yahoo_data *yd;
 
 	xfer_data = xfer->data;
-	gc = xfer_data->gc;
+	gc = xfer_purple_account_get_connection(data);
 	yd = gc->proto_data;
 	account = purple_connection_get_account(gc);
 
@@ -349,7 +349,7 @@ static void yahoo_xfer_init_15(PurpleXfe
 	struct yahoo_packet *pkt;
 
 	xfer_data = xfer->data;
-	gc = xfer_data->gc;
+	gc = xfer_purple_account_get_connection(data);
 	yd = gc->proto_data;
 	account = purple_connection_get_account(gc);
 
@@ -519,7 +519,7 @@ static void yahoo_xfer_cancel_send(Purpl
 		struct yahoo_data *yd;
 		struct yahoo_packet *pkt;
 
-		gc = xfer_data->gc;
+		gc = xfer_purple_account_get_connection(data);
 		yd = gc->proto_data;
 		account = purple_connection_get_account(gc);
 		if(xfer_data->xfer_idstring_for_relay) /* hack to see if file trans acc/info packet has been received */
@@ -567,7 +567,7 @@ static void yahoo_xfer_cancel_recv(Purpl
 		struct yahoo_data *yd;
 		struct yahoo_packet *pkt;
 
-		gc = xfer_data->gc;
+		gc = xfer_purple_account_get_connection(data);
 		yd = gc->proto_data;
 		account = purple_connection_get_account(gc);
 		if(!xfer_data->xfer_idstring_for_relay) /* hack to see if file trans acc/info packet has been received */
@@ -631,7 +631,7 @@ static void yahoo_xfer_end(PurpleXfer *x
 			filename = xfer_data->filename_list->data;
 			filesize = atol( xfer_data->size_list->data );
 
-			gc = xfer_data->gc;
+			gc = xfer_purple_account_get_connection(data);
 			yd = gc->proto_data;
 
 			/* setting up xfer_data for next file's tranfer */
@@ -662,7 +662,7 @@ static void yahoo_xfer_end(PurpleXfer *x
 			xfer_old->data = NULL;
 
 			/* Build the file transfer handle. */
-			xfer = purple_xfer_new(gc->account, PURPLE_XFER_RECEIVE, xfer_old->who);
+			xfer = purple_xfer_new(purple_connection_get_account(gc), PURPLE_XFER_RECEIVE, xfer_old->who);
 
 			
 			if (xfer) {
@@ -840,7 +840,7 @@ void yahoo_process_filetransfer(PurpleCo
 
 	/* Setup the Yahoo-specific file transfer data */
 	xfer_data = g_new0(struct yahoo_xfer_data, 1);
-	xfer_data->gc = gc;
+	xfer_purple_account_get_connection(data) = gc;
 	if (!purple_url_parse(url, &(xfer_data->host), &(xfer_data->port), &(xfer_data->path), NULL, NULL)) {
 		g_free(xfer_data);
 		return;
@@ -850,7 +850,7 @@ void yahoo_process_filetransfer(PurpleCo
 	                xfer_data->host, xfer_data->port, xfer_data->path, url);
 
 	/* Build the file transfer handle. */
-	xfer = purple_xfer_new(gc->account, PURPLE_XFER_RECEIVE, from);
+	xfer = purple_xfer_new(purple_connection_get_account(gc), PURPLE_XFER_RECEIVE, from);
 	if (xfer)
 	{
 		xfer->data = xfer_data;
@@ -901,10 +901,10 @@ PurpleXfer *yahoo_new_xfer(PurpleConnect
 	g_return_val_if_fail(who != NULL, NULL);
 
 	xfer_data = g_new0(struct yahoo_xfer_data, 1);
-	xfer_data->gc = gc;
+	xfer_purple_account_get_connection(data) = gc;
 
 	/* Build the file transfer handle. */
-	xfer = purple_xfer_new(gc->account, PURPLE_XFER_SEND, who);
+	xfer = purple_xfer_new(purple_connection_get_account(gc), PURPLE_XFER_SEND, who);
 	if (xfer)
 	{
 		xfer->data = xfer_data;
@@ -960,7 +960,7 @@ static void yahoo_xfer_dns_connected_15(
 		return;
 	if (!(xd = xfer->data))
 		return;
-	gc = xd->gc;
+	gc = purple_account_get_connection(xd);
 	account = purple_connection_get_account(gc);
 	yd = gc->proto_data;
 
@@ -1074,8 +1074,8 @@ static void yahoo_xfer_recv_cb_15(gpoint
 
 	xfer = data;
 	xd = xfer->data;
-	account = purple_connection_get_account(xd->gc);
-	gc = xd->gc;
+	account = purple_connection_get_account(purple_account_get_connection(xd));
+	gc = purple_account_get_connection(xd);
 
 	buf=g_strnfill(1000, 0);
 	while((did = read(source, buf, 998)) > 0)
@@ -1187,8 +1187,8 @@ static void yahoo_xfer_connected_15(gpoi
 		return;
 	if (!(xd = xfer->data))
 		return;
-	yd = xd->gc->proto_data;
-	account = purple_connection_get_account(xd->gc);
+	yd = purple_account_get_connection(xd)->proto_data;
+	account = purple_connection_get_account(purple_account_get_connection(xd));
 	if ((source < 0) || (xd->path == NULL) || (xd->host == NULL)) {
 		purple_xfer_error(PURPLE_XFER_RECEIVE, purple_xfer_get_account(xfer),
 			xfer->who, _("Unable to connect."));
@@ -1199,7 +1199,7 @@ static void yahoo_xfer_connected_15(gpoi
 	if (xd->txbuflen == 0)
 	{
 		gchar* cookies;
-		cookies = yahoo_get_cookies(xd->gc);
+		cookies = yahoo_get_cookies(purple_account_get_connection(xd));
 		if(purple_xfer_get_type(xfer) == PURPLE_XFER_SEND && xd->status_15 == ACCEPTED)
 		{
 			xd->txbuf = g_strdup_printf("POST /relay?token=%s&sender=%s&recver=%s HTTP/1.1\r\nCookie:%s\r\nUser-Agent: Mozilla/4.0 (compatible; MSIE 5.5)\r\nHost: %s\r\nContent-Length: %ld\r\nCache-Control: no-cache\r\n\r\n",
@@ -1370,13 +1370,13 @@ void yahoo_process_filetrans_15(PurpleCo
 	xfer_data = g_new0(struct yahoo_xfer_data, 1);
 	xfer_data->version = 15;
 	xfer_data->firstoflist = TRUE;
-	xfer_data->gc = gc;
+	xfer_purple_account_get_connection(data) = gc;
 	xfer_data->xfer_peer_idstring = g_strdup(xfer_peer_idstring);
 	xfer_data->filename_list = filename_list;
 	xfer_data->size_list = size_list;
 	
 	/* Build the file transfer handle. */
-	xfer = purple_xfer_new(gc->account, PURPLE_XFER_RECEIVE, from);
+	xfer = purple_xfer_new(purple_connection_get_account(gc), PURPLE_XFER_RECEIVE, from);
 	xfer->message = NULL;
 
 	if (xfer)
@@ -1493,7 +1493,7 @@ void yahoo_process_filetrans_info_15(Pur
 		return;
 	}
 
-	account = purple_connection_get_account(xfer_data->gc);
+	account = purple_connection_get_account(xfer_purple_account_get_connection(data));
 
 	pkt_to_send = yahoo_packet_new(YAHOO_SERVICE_FILETRANS_ACC_15,
 		YAHOO_STATUS_AVAILABLE, yd->session_id);
============================================================
--- libpurple/protocols/yahoo/yahoo_packet.c	1054e522508747778369adbb833ec8b14312f8aa
+++ libpurple/protocols/yahoo/yahoo_packet.c	fc9caa4c3dfef18a68daa2c063bb20a737093bf2
@@ -303,7 +303,7 @@ yahoo_packet_send_can_write(gpointer dat
 		return;
 	else if (ret < 0) {
 		/* TODO: what to do here - do we really have to disconnect? */
-		purple_connection_error_reason(yd->gc, PURPLE_CONNECTION_ERROR_NETWORK_ERROR,
+		purple_connection_error_reason(purple_account_get_connection(yd), PURPLE_CONNECTION_ERROR_NETWORK_ERROR,
 		                               _("Write Error"));
 		return;
 	}
============================================================
--- libpurple/protocols/yahoo/yahoo_picture.c	1b127a32d43bdf54963b417a77804bd286e8ae0c
+++ libpurple/protocols/yahoo/yahoo_picture.c	1b4751b08fff5b90b46ded85a9f8867be257dc2a
@@ -51,7 +51,7 @@ yahoo_fetch_picture_cb(PurpleUtilFetchUr
 	struct yahoo_data *yd;
 
 	d = user_data;
-	yd = d->gc->proto_data;
+	yd = purple_account_get_connection(d)->proto_data;
 	yd->url_datas = g_slist_remove(yd->url_datas, url_data);
 
 	if (error_message != NULL) {
@@ -60,7 +60,7 @@ yahoo_fetch_picture_cb(PurpleUtilFetchUr
 		purple_debug_error("yahoo", "Fetched an icon with length 0.  Strange.\n");
 	} else {
 		char *checksum = g_strdup_printf("%i", d->checksum);
-		purple_buddy_icons_set_for_user(purple_connection_get_account(d->gc), d->who, g_memdup(pic_data, len), len, checksum);
+		purple_buddy_icons_set_for_user(purple_connection_get_account(purple_account_get_connection(d)), d->who, g_memdup(pic_data, len), len, checksum);
 		g_free(checksum);
 	}
 
@@ -114,12 +114,12 @@ void yahoo_process_picture(PurpleConnect
 		/* TODO: make this work p2p, try p2p before the url */
 		PurpleUtilFetchUrlData *url_data;
 		struct yahoo_fetch_picture_data *data;
-		PurpleBuddy *b = purple_find_buddy(gc->account, who);
+		PurpleBuddy *b = purple_find_buddy(purple_connection_get_account(gc), who);
 		const char *locksum = NULL;
 		gboolean use_whole_url = FALSE;
 
 		/* use whole URL if using HTTP Proxy */
-		if ((gc->account->proxy_info) && (gc->account->proxy_info->type == PURPLE_PROXY_HTTP))
+		if ((purple_connection_get_account(gc)->proxy_info) && (purple_connection_get_account(gc)->proxy_info->type == PURPLE_PROXY_HTTP))
 		    use_whole_url = TRUE;
 
 		/* FIXME: Cleanup this strtol() stuff if possible. */
@@ -128,7 +128,7 @@ void yahoo_process_picture(PurpleConnect
 			return;
 
 		data = g_new0(struct yahoo_fetch_picture_data, 1);
-		data->gc = gc;
+		purple_account_get_connection(data) = gc;
 		data->who = g_strdup(who);
 		data->checksum = checksum;
 		url_data = purple_util_fetch_url(url, use_whole_url,
@@ -177,7 +177,7 @@ void yahoo_process_picture_update(Purple
 			yahoo_send_picture_request(gc, who);
 		else if ((icon == 0) || (icon == 1)) {
 			YahooFriend *f;
-			purple_buddy_icons_set_for_user(gc->account, who, NULL, 0, NULL);
+			purple_buddy_icons_set_for_user(purple_connection_get_account(gc), who, NULL, 0, NULL);
 			if ((f = yahoo_friend_find(gc, who)))
 				yahoo_friend_set_buddy_icon_need_request(f, TRUE);
 			purple_debug_misc("yahoo", "Setting user %s's icon to NULL.\n", who);
@@ -209,7 +209,7 @@ void yahoo_process_picture_checksum(Purp
 	}
 
 	if (who) {
-		PurpleBuddy *b = purple_find_buddy(gc->account, who);
+		PurpleBuddy *b = purple_find_buddy(purple_connection_get_account(gc), who);
 		const char *locksum = NULL;
 
 		/* FIXME: Cleanup this strtol() stuff if possible. */
@@ -290,7 +290,7 @@ void yahoo_process_avatar_update(PurpleC
 			yahoo_send_picture_request(gc, who);
 		else if ((avatar == 0) || (avatar == 1)) {
 			YahooFriend *f;
-			purple_buddy_icons_set_for_user(gc->account, who, NULL, 0, NULL);
+			purple_buddy_icons_set_for_user(purple_connection_get_account(gc), who, NULL, 0, NULL);
 			if ((f = yahoo_friend_find(gc, who)))
 				yahoo_friend_set_buddy_icon_need_request(f, TRUE);
 			purple_debug_misc("yahoo", "Setting user %s's icon to NULL.\n", who);
@@ -360,7 +360,7 @@ static void yahoo_send_picture_update_fo
 	struct yspufe *d = data;
 
 	if (f->status != YAHOO_STATUS_OFFLINE)
-		yahoo_send_picture_update_to_user(d->gc, who, d->type);
+		yahoo_send_picture_update_to_user(purple_account_get_connection(d), who, d->type);
 }
 
 void yahoo_send_picture_update(PurpleConnection *gc, int type)
@@ -392,7 +392,7 @@ static void yahoo_buddy_icon_upload_read
 static void yahoo_buddy_icon_upload_reading(gpointer data, gint source, PurpleInputCondition condition)
 {
 	struct yahoo_buddy_icon_upload_data *d = data;
-	PurpleConnection *gc = d->gc;
+	PurpleConnection *gc = purple_account_get_connection(d);
 	char buf[1024];
 	int ret;
 
@@ -412,7 +412,7 @@ static void yahoo_buddy_icon_upload_pend
 static void yahoo_buddy_icon_upload_pending(gpointer data, gint source, PurpleInputCondition condition)
 {
 	struct yahoo_buddy_icon_upload_data *d = data;
-	PurpleConnection *gc = d->gc;
+	PurpleConnection *gc = purple_account_get_connection(d);
 	ssize_t wrote;
 
 	if (!PURPLE_CONNECTION_IS_VALID(gc)) {
@@ -448,7 +448,7 @@ static void yahoo_buddy_icon_upload_conn
 	PurpleAccount *account;
 	struct yahoo_data *yd;
 
-	gc = d->gc;
+	gc = purple_account_get_connection(d);
 	account = purple_connection_get_account(gc);
 	yd = gc->proto_data;
 
@@ -531,7 +531,7 @@ void yahoo_set_buddy_icon(PurpleConnecti
 void yahoo_set_buddy_icon(PurpleConnection *gc, PurpleStoredImage *img)
 {
 	struct yahoo_data *yd = gc->proto_data;
-	PurpleAccount *account = gc->account;
+	PurpleAccount *account = purple_connection_get_account(gc);
 
 	if (img == NULL) {
 		g_free(yd->picture_url);
@@ -574,7 +574,7 @@ void yahoo_set_buddy_icon(PurpleConnecti
 		/* We use this solely for sending a filename to the server */
 		iconfile = g_strdup(purple_imgstore_get_filename(img));
 		d = g_new0(struct yahoo_buddy_icon_upload_data, 1);
-		d->gc = gc;
+		purple_account_get_connection(d) = gc;
 		d->str = s;
 		d->fd = -1;
 		d->filename = iconfile;
============================================================
--- libpurple/protocols/yahoo/yahoo_profile.c	951dbd6d885ca9a549a1dc5ba47a8261ad2a72fb
+++ libpurple/protocols/yahoo/yahoo_profile.c	e3f1b6fc004cb0816865161a40916d21c6051159
@@ -695,7 +695,7 @@ static void yahoo_extract_user_info_text
 	PurpleBuddy *b;
 	YahooFriend *f;
 
-	b = purple_find_buddy(purple_connection_get_account(info_data->gc),
+	b = purple_find_buddy(purple_connection_get_account(info_purple_account_get_connection(data)),
 			info_data->name);
 
 	if (b) {
@@ -715,7 +715,7 @@ static void yahoo_extract_user_info_text
 		/* Add the normal tooltip pairs */
 		yahoo_tooltip_text(b, user_info, TRUE);
 
-		if ((f = yahoo_friend_find(info_data->gc, b->name))) {
+		if ((f = yahoo_friend_find(info_purple_account_get_connection(data), b->name))) {
 			const char *ip;
 			if ((ip = yahoo_friend_get_ip(f)))
 				purple_notify_user_info_add_pair(user_info, _("IP Address"), ip);
@@ -789,7 +789,7 @@ static void yahoo_got_info(PurpleUtilFet
 
 	purple_debug_info("yahoo", "In yahoo_got_info\n");
 
-	yd = info_data->gc->proto_data;
+	yd = info_purple_account_get_connection(data)->proto_data;
 	yd->url_datas = g_slist_remove(yd->url_datas, url_data);
 
 	user_info = purple_notify_user_info_new();
@@ -806,7 +806,7 @@ static void yahoo_got_info(PurpleUtilFet
 	 */
 	if (error_message != NULL || url_text == NULL || strcmp(url_text, "") == 0) {
 		purple_notify_user_info_add_pair(user_info, _("Error retrieving profile"), NULL);
-		purple_notify_userinfo(info_data->gc, info_data->name, 
+		purple_notify_userinfo(info_purple_account_get_connection(data), info_data->name, 
 			user_info, NULL, NULL);
 		purple_notify_user_info_destroy(user_info);
 		g_free(profile_url_text);
@@ -843,7 +843,7 @@ static void yahoo_got_info(PurpleUtilFet
 		purple_notify_user_info_add_pair(user_info, NULL, tmp);		
 		g_free(tmp);
 
-		purple_notify_userinfo(info_data->gc, info_data->name, 
+		purple_notify_userinfo(info_purple_account_get_connection(data), info_data->name, 
 				user_info, NULL, NULL);
 
 		g_free(profile_url_text);
@@ -935,7 +935,7 @@ static void yahoo_got_info(PurpleUtilFet
 		gboolean use_whole_url = FALSE;
 
 		/* use whole URL if using HTTP Proxy */
-		if ((info_data->gc->account->proxy_info) && (info_data->gc->account->proxy_info->type == PURPLE_PROXY_HTTP))
+		if ((info_purple_account_get_connection(data)->account->proxy_info) && (info_purple_account_get_connection(data)->account->proxy_info->type == PURPLE_PROXY_HTTP))
 		    use_whole_url = TRUE;
 
 		/* User-uploaded photos use a different server that requires the Host
@@ -991,7 +991,7 @@ yahoo_got_photo(PurpleUtilFetchUrlData *
 	/* in to purple_markup_strip_html*/
 	char *fudged_buffer;
 
-	yd = info_data->gc->proto_data;
+	yd = info_purple_account_get_connection(data)->proto_data;
 	yd->url_datas = g_slist_remove(yd->url_datas, url_data);
 
 	fudged_buffer = purple_strcasereplace(url_buffer, "</dd>", "</dd><br>");
@@ -1213,7 +1213,7 @@ yahoo_got_photo(PurpleUtilFetchUrlData *
 
 		} else if (profile_state == PROFILE_STATE_NOT_FOUND) {
 			PurpleBuddy *b = purple_find_buddy
-					(purple_connection_get_account(info_data->gc),
+					(purple_connection_get_account(info_purple_account_get_connection(data)),
 							info_data->name);
 			YahooFriend *f = NULL;
 			if (b) {
@@ -1221,7 +1221,7 @@ yahoo_got_photo(PurpleUtilFetchUrlData *
 				 * in which case the user may or may not actually exist.
 				 * Hence this extra step.
 				 */
-				f = yahoo_friend_find(b->account->gc, b->name);
+				f = yahoo_friend_find(purple_account_get_connection(b->account), b->name);
 			}
 			g_string_append_printf(str, "%s<br><br>",
 				f?  _("Could not retrieve the user's profile. "
@@ -1249,7 +1249,7 @@ yahoo_got_photo(PurpleUtilFetchUrlData *
 	g_free(stripped);
 
 	/* show it to the user */
-	purple_notify_userinfo(info_data->gc, info_data->name,
+	purple_notify_userinfo(info_purple_account_get_connection(data), info_data->name,
 						  user_info, NULL, NULL);
 	purple_notify_user_info_destroy(user_info);
 
@@ -1276,7 +1276,7 @@ void yahoo_get_info(PurpleConnection *gc
 	PurpleUtilFetchUrlData *url_data;
 
 	data       = g_new0(YahooGetInfoData, 1);
-	data->gc   = gc;
+	purple_account_get_connection(data)   = gc;
 	data->name = g_strdup(name);
 
 	url = g_strdup_printf("%s%s",
============================================================
--- libpurple/protocols/yahoo/ycht.c	f6ebdce24d6993c86b52837cc66896d69223f67c
+++ libpurple/protocols/yahoo/ycht.c	0bc804b4f405d5b0988f2f22c7b1e497a3792c48
@@ -54,7 +54,7 @@ static void ycht_process_login(YchtConn 
  ************************************************************************************/
 static void ycht_process_login(YchtConn *ycht, YchtPkt *pkt)
 {
-	PurpleConnection *gc = ycht->gc;
+	PurpleConnection *gc = purple_account_get_connection(ycht);
 	struct yahoo_data *yd = gc->proto_data;
 
 	if (ycht->logged_in)
@@ -69,7 +69,7 @@ static void ycht_process_logout(YchtConn
 
 static void ycht_process_logout(YchtConn *ycht, YchtPkt *pkt)
 {
-	PurpleConnection *gc = ycht->gc;
+	PurpleConnection *gc = purple_account_get_connection(ycht);
 	struct yahoo_data *yd = gc->proto_data;
 
 	yd->chat_online = FALSE;
@@ -79,7 +79,7 @@ static void ycht_process_chatjoin(YchtCo
 static void ycht_process_chatjoin(YchtConn *ycht, YchtPkt *pkt)
 {
 	char *room, *topic;
-	PurpleConnection *gc = ycht->gc;
+	PurpleConnection *gc = purple_account_get_connection(ycht);
 	PurpleConversation *c = NULL;
 	gboolean new_room = FALSE;
 	char **members;
@@ -115,7 +115,7 @@ static void ycht_process_chatjoin(YchtCo
 
 	for (i = 0; members[i]; i++) {
 		if (new_room) {
-			/*if (!strcmp(members[i], purple_connection_get_display_name(ycht->gc)))
+			/*if (!strcmp(members[i], purple_connection_get_display_name(purple_account_get_connection(ycht))))
 				continue;*/
 			purple_conv_chat_add_user(PURPLE_CONV_CHAT(c), members[i], NULL, PURPLE_CBFLAGS_NONE, TRUE);
 		} else {
@@ -134,7 +134,7 @@ static void ycht_process_chatpart(YchtCo
 	who = g_list_nth_data(pkt->data, 1);
 
 	if (who && room) {
-		PurpleConversation *c = purple_find_chat(ycht->gc, YAHOO_CHAT_ID);
+		PurpleConversation *c = purple_find_chat(purple_account_get_connection(ycht), YAHOO_CHAT_ID);
 		if (c && !purple_utf8_strcasecmp(purple_conversation_get_name(c), room))
 			purple_conv_chat_remove_user(PURPLE_CONV_CHAT(c), who, NULL);
 
@@ -145,7 +145,7 @@ static void ycht_progress_chatmsg(YchtCo
 {
 	char *who, *what, *msg;
 	PurpleConversation *c;
-	PurpleConnection *gc = ycht->gc;
+	PurpleConnection *gc = purple_account_get_connection(ycht);
 
 	who = g_list_nth_data(pkt->data, 1);
 	what = g_list_nth_data(pkt->data, 2);
@@ -174,7 +174,7 @@ static void ycht_progress_online_friends
 static void ycht_progress_online_friends(YchtConn *ycht, YchtPkt *pkt)
 {
 #if 0
-	PurpleConnection *gc = ycht->gc;
+	PurpleConnection *gc = purple_account_get_connection(ycht);
 	struct yahoo_data *yd = gc->proto_data;
 
 	if (ycht->logged_in)
@@ -429,7 +429,7 @@ void ycht_connection_close(YchtConn *ych
 
 void ycht_connection_close(YchtConn *ycht)
 {
-	struct yahoo_data *yd = ycht->gc->proto_data;
+	struct yahoo_data *yd = purple_account_get_connection(ycht)->proto_data;
 
 	if (yd) {
 		yd->ycht = NULL;
@@ -454,7 +454,7 @@ static void ycht_connection_error(YchtCo
 static void ycht_connection_error(YchtConn *ycht, const gchar *error)
 {
 
-	purple_notify_info(ycht->gc, NULL, _("Connection problem with the YCHT server."), error);
+	purple_notify_info(purple_account_get_connection(ycht), NULL, _("Connection problem with the YCHT server."), error);
 	ycht_connection_close(ycht);
 }
 
@@ -541,7 +541,7 @@ static void ycht_got_connected(gpointer 
 static void ycht_got_connected(gpointer data, gint source, const gchar *error_message)
 {
 	YchtConn *ycht = data;
-	PurpleConnection *gc = ycht->gc;
+	PurpleConnection *gc = purple_account_get_connection(ycht);
 	struct yahoo_data *yd = gc->proto_data;
 	YchtPkt *pkt;
 	char *buf;
@@ -573,7 +573,7 @@ void ycht_connection_open(PurpleConnecti
 	PurpleAccount *account = purple_connection_get_account(gc);
 
 	ycht = g_new0(YchtConn, 1);
-	ycht->gc = gc;
+	purple_account_get_connection(ycht) = gc;
 	ycht->fd = -1;
 
 	yd->ycht = ycht;
@@ -622,7 +622,7 @@ int ycht_chat_send(YchtConn *ycht, const
 	pkt = ycht_packet_new(YCHT_VERSION, YCHT_SERVICE_CHATMSG, 0);
 
 	msg1 = yahoo_html_to_codes(what);
-	msg2 = yahoo_string_encode(ycht->gc, msg1, NULL);
+	msg2 = yahoo_string_encode(purple_account_get_connection(ycht), msg1, NULL);
 	g_free(msg1);
 
 	buf = g_strdup_printf("%s\001%s", ycht->room, msg2);
============================================================
--- libpurple/protocols/zephyr/zephyr.c	b282d503470d98f20ea7008e1742ee7721947bd7
+++ libpurple/protocols/zephyr/zephyr.c	52cd42c851c6ea34e0fabb3a870225edb160f989
@@ -776,9 +776,9 @@ static void handle_message(PurpleConnect
 			if (ZParseLocations(&notice, NULL, &nlocs, &user) != ZERR_NONE)
 				return;
 
-			if ((b = purple_find_buddy(gc->account, user)) == NULL) {
+			if ((b = purple_find_buddy(purple_connection_get_account(gc), user)) == NULL) {
 				char* stripped_user = zephyr_strip_local_realm(zephyr,user);
-				b = purple_find_buddy(gc->account,stripped_user);
+				b = purple_find_buddy(purple_connection_get_account(gc),stripped_user);
 				g_free(stripped_user);
 			}
 			if ((b && pending_zloc(zephyr,b->name)) || pending_zloc(zephyr,user)) {
@@ -807,9 +807,9 @@ static void handle_message(PurpleConnect
 				purple_notify_user_info_destroy(user_info);
 			} else {
 				if (nlocs>0) 
-					purple_prpl_got_user_status(gc->account, b ? b->name : user, "available", NULL);
+					purple_prpl_got_user_status(purple_connection_get_account(gc), b ? b->name : user, "available", NULL);
 				else 
-					purple_prpl_got_user_status(gc->account, b ? b->name : user, "offline", NULL);
+					purple_prpl_got_user_status(purple_connection_get_account(gc), b ? b->name : user, "offline", NULL);
 			}
 
 			g_free(user);
@@ -821,7 +821,7 @@ static void handle_message(PurpleConnect
 		PurpleConvChat *gcc;
 		char *ptr = (char *) notice.z_message + (strlen(notice.z_message) + 1);
 		int len; 
-		char *sendertmp = g_strdup_printf("%s", zephyr->username);
+		char *sendertmp = g_strdup_printf("%s", purple_account_get_username(zephyr));
 		int signature_length = strlen(notice.z_message);
 		int message_has_no_body = 0;
 		PurpleMessageFlags flags = 0;
@@ -850,7 +850,7 @@ static void handle_message(PurpleConnect
 		}
 
 		if (!g_ascii_strcasecmp(notice.z_class, "MESSAGE") && !g_ascii_strcasecmp(notice.z_class_inst, "PERSONAL") 
-		    && !g_ascii_strcasecmp(notice.z_recipient,zephyr->username)) {
+		    && !g_ascii_strcasecmp(notice.z_recipient,purple_account_get_username(zephyr))) {
 			gchar* stripped_sender;
 			if (!g_ascii_strcasecmp(notice.z_message, "Automated reply:"))
 				flags |= PURPLE_MESSAGE_AUTO_RESP;
@@ -891,7 +891,7 @@ static void handle_message(PurpleConnect
 			}
 
 			gconv1 = purple_find_conversation_with_account(PURPLE_CONV_TYPE_CHAT,
-														 zt2->name, gc->account);
+														 zt2->name, purple_connection_get_account(gc));
 			gcc = purple_conversation_get_chat_data(gconv1);
 
 			if (!purple_conv_chat_find_user(gcc, sendertmp)) {
@@ -1143,9 +1143,9 @@ static gint check_notify_tzc(gpointer da
 				gchar *locval;
 				user = tree_child(find_node(newparsetree,"user"),2)->contents;
 
-				if ((b = purple_find_buddy(gc->account, user)) == NULL) {
+				if ((b = purple_find_buddy(purple_connection_get_account(gc), user)) == NULL) {
 					gchar *stripped_user = zephyr_strip_local_realm(zephyr,user);
-					b = purple_find_buddy(gc->account, stripped_user);
+					b = purple_find_buddy(purple_connection_get_account(gc), stripped_user);
 					g_free(stripped_user);
 				}
 				locations = find_node(newparsetree,"locations");
@@ -1181,9 +1181,9 @@ static gint check_notify_tzc(gpointer da
 					purple_notify_user_info_destroy(user_info);
 				} else {
 					if (nlocs>0) 
-						purple_prpl_got_user_status(gc->account, b ? b->name : user, "available", NULL);
+						purple_prpl_got_user_status(purple_connection_get_account(gc), b ? b->name : user, "available", NULL);
 					else 
-						purple_prpl_got_user_status(gc->account, b ? b->name : user, "offline", NULL);
+						purple_prpl_got_user_status(purple_connection_get_account(gc), b ? b->name : user, "offline", NULL);
 				}
 			}
 			else if (!g_ascii_strncasecmp(spewtype,"subscribed",10)) {
@@ -1259,7 +1259,7 @@ static gint check_loc(gpointer_data)
 
 				if (!PURPLE_BLIST_NODE_IS_BUDDY(bnode))
 					continue;
-				if (b->account->gc == zgc) {
+				if (purple_account_get_connection(b->account) == zgc) {
 					char *chk;
                                         chk = local_zephyr_normalize(b->name);
                                         ZLocateUser(chk,&numlocs, ZAUTH);
@@ -1303,7 +1303,7 @@ static gint check_loc(gpointer data)
 
 				if (!PURPLE_BLIST_NODE_IS_BUDDY(bnode))
 					continue;
-				if (b->account->gc == gc) {
+				if (purple_account_get_connection(b->account) == gc) {
 					const char *chk;
 
 					chk = local_zephyr_normalize(zephyr,b->name);
@@ -1320,9 +1320,9 @@ static gint check_loc(gpointer data)
 							for(i=0;i<numlocs;i++) {
 								ZGetLocations(&locations,&one);
 								if (nlocs>0) 
-									purple_prpl_got_user_status(gc->account,b->name,"available",NULL);
+									purple_prpl_got_user_status(purple_connection_get_account(gc),b->name,"available",NULL);
 								else 
-									purple_prpl_got_user_status(gc->account,b->name,"offline",NULL);
+									purple_prpl_got_user_status(purple_connection_get_account(gc),b->name,"offline",NULL);
 							}
 						}
 #else
@@ -1429,7 +1429,7 @@ static void process_zsubs(zephyr_account
 			if (buff[0]) {
 				triple = g_strsplit(buff, ",", 3);
 				if (triple[0] && triple[1]) {
-					char *tmp = g_strdup_printf("%s", zephyr->username);
+					char *tmp = g_strdup_printf("%s", purple_account_get_username(zephyr));
 					char *atptr;
 
 					z_class = triple[0];
@@ -1437,7 +1437,7 @@ static void process_zsubs(zephyr_account
 					if (triple[2] == NULL) {
 						recip = g_malloc0(1);
 					} else if (!g_ascii_strcasecmp(triple[2], "%me%")) {
-						recip = g_strdup_printf("%s", zephyr->username);
+						recip = g_strdup_printf("%s", purple_account_get_username(zephyr));
 					} else if (!g_ascii_strcasecmp(triple[2], "*")) {
 						/* wildcard
 						 * form of class,instance,* */
@@ -1517,11 +1517,11 @@ static void process_anyone(PurpleConnect
 		while (fgets(buff, BUFSIZ, fd)) {
 			strip_comments(buff);
 			if (buff[0]) {
-				if (!(b = purple_find_buddy(gc->account, buff))) {
+				if (!(b = purple_find_buddy(purple_connection_get_account(gc), buff))) {
 					char *stripped_user = zephyr_strip_local_realm(gc->proto_data,buff);
 					purple_debug_info("zephyr","stripped_user %s\n",stripped_user);
-					if (!(b = purple_find_buddy(gc->account,stripped_user))){
-						b = purple_buddy_new(gc->account, stripped_user, NULL);
+					if (!(b = purple_find_buddy(purple_connection_get_account(gc),stripped_user))){
+						b = purple_buddy_new(purple_connection_get_account(gc), stripped_user, NULL);
 						purple_blist_add_buddy(b, NULL, g, NULL);
 					} 
 					g_free(stripped_user);
@@ -1560,14 +1560,14 @@ static void zephyr_login(PurpleAccount *
 	gchar *exposure;
 
 	gc = purple_account_get_connection(account);
-	read_anyone = purple_account_get_bool(gc->account,"read_anyone",TRUE);
-	read_zsubs = purple_account_get_bool(gc->account,"read_zsubs",TRUE);
-	exposure = (gchar *)purple_account_get_string(gc->account, "exposure_level", EXPOSE_REALMVIS); 
+	read_anyone = purple_account_get_bool(purple_connection_get_account(gc),"read_anyone",TRUE);
+	read_zsubs = purple_account_get_bool(purple_connection_get_account(gc),"read_zsubs",TRUE);
+	exposure = (gchar *)purple_account_get_string(purple_connection_get_account(gc), "exposure_level", EXPOSE_REALMVIS); 
 
 #ifdef WIN32
 	username = purple_account_get_username(account);
 #endif
-	gc->flags |= PURPLE_CONNECTION_HTML | PURPLE_CONNECTION_NO_BGCOLOR | PURPLE_CONNECTION_NO_URLDESC;
+	gc->flags |= PURPLE_CONNECTION_FLAGS_HTML | PURPLE_CONNECTION_FLAGS_NO_BGCOLOR | PURPLE_CONNECTION_FLAGS_NO_URLDESC;
 	gc->proto_data = zephyr=g_new0(zephyr_account,1); 
 
 	zephyr->account = account;
@@ -1575,13 +1575,13 @@ static void zephyr_login(PurpleAccount *
 	/* Make sure that the exposure (visibility) is set to a sane value */
 	zephyr->exposure=g_strdup(normalize_zephyr_exposure(exposure));
 
-	if (purple_account_get_bool(gc->account,"use_tzc",0)) {
+	if (purple_account_get_bool(purple_connection_get_account(gc),"use_tzc",0)) {
 		zephyr->connection_type = PURPLE_ZEPHYR_TZC;
 	} else {
 		zephyr->connection_type = PURPLE_ZEPHYR_KRB4;
 	}
 
-	zephyr->encoding = (char *)purple_account_get_string(gc->account, "encoding", ZEPHYR_FALLBACK_CHARSET);
+	zephyr->encoding = (char *)purple_account_get_string(purple_connection_get_account(gc), "encoding", ZEPHYR_FALLBACK_CHARSET);
 	purple_connection_update_progress(gc, _("Connecting"), 0, 8);
 
 	/* XXX z_call_s should actually try to report the com_err determined error */
@@ -1602,7 +1602,7 @@ static void zephyr_login(PurpleAccount *
 		if (pid == 0) {
 			unsigned int i=0;
 			gboolean found_ps = FALSE;
-			gchar ** tzc_cmd_array = g_strsplit(purple_account_get_string(gc->account,"tzc_command","/usr/bin/tzc -e %s")," ",0);
+			gchar ** tzc_cmd_array = g_strsplit(purple_account_get_string(purple_connection_get_account(gc),"tzc_command","/usr/bin/tzc -e %s")," ",0);
 			if (close(1) == -1) {
 				purple_debug_error("zephyr", "stdout couldn't be closed. dying\n");
 				exit(-1);
@@ -1767,11 +1767,11 @@ static void zephyr_login(PurpleAccount *
 						while(tempstr[tempstridx] !='"' && tempstridx < 20000)
 							username[username_idx++]=tempstr[tempstridx++];
 							
-						zephyr->username = g_strdup_printf("%s",username);
+						purple_account_get_username(zephyr) = g_strdup_printf("%s",username);
 						if ((realm = strchr(username,'@'))) 
 							zephyr->realm = g_strdup_printf("%s",realm+1);
 						else {
-							realm = (gchar *)purple_account_get_string(gc->account,"realm","");
+							realm = (gchar *)purple_account_get_string(purple_connection_get_account(gc),"realm","");
 							if (!*realm) {
 								realm = "local-realm";
 							}
@@ -1808,13 +1808,13 @@ static void zephyr_login(PurpleAccount *
 		z_call_s(ZOpenPort(&(zephyr->port)), "Couldn't open port");
 		z_call_s(ZSetLocation((char *)zephyr->exposure), "Couldn't set location");
 
-		realm = (gchar *)purple_account_get_string(gc->account,"realm","");
+		realm = (gchar *)purple_account_get_string(purple_connection_get_account(gc),"realm","");
 		if (!*realm) {
 			realm = ZGetRealm();
 		}
 		zephyr->realm = g_strdup(realm);
 		g_strlcpy(__Zephyr_realm, (const char*)zephyr->realm, REALM_SZ-1);
-		zephyr->username = g_strdup(ZGetSender());
+		purple_account_get_username(zephyr) = g_strdup(ZGetSender());
 
 		/*		zephyr->realm = g_strdup(ZGetRealm()); */
 		purple_debug_info("zephyr","realm: %s\n",zephyr->realm);
@@ -1824,22 +1824,22 @@ static void zephyr_login(PurpleAccount *
 		return;
 	}
 	purple_debug_info("zephyr","does it get here\n");
-	purple_debug_info("zephyr"," realm: %s username:%s\n", zephyr->realm, zephyr->username);
+	purple_debug_info("zephyr"," realm: %s username:%s\n", zephyr->realm, purple_account_get_username(zephyr));
 
 	/* For now */
 	zephyr->galaxy = NULL;
 	zephyr->krbtkfile = NULL;
 	zephyr_inithosts(zephyr);
 
-	if (zephyr_subscribe_to(zephyr,"MESSAGE","PERSONAL",zephyr->username,NULL) != ZERR_NONE) {
+	if (zephyr_subscribe_to(zephyr,"MESSAGE","PERSONAL",purple_account_get_username(zephyr),NULL) != ZERR_NONE) {
 		/* XXX don't translate this yet. It could be written better */
 		/* XXX error messages could be handled with more detail */
-		purple_notify_error(account->gc, NULL,
+		purple_notify_error(purple_account_get_connection(account), NULL,
 				  "Unable to subscribe to messages", "Unable to subscribe to initial messages");
 		return;
 	}
 
-	purple_connection_set_state(gc, PURPLE_CONNECTED);
+	purple_connection_set_state(gc, PURPLE_CONNECTION_STATE_CONNECTED);
 
 	if (read_anyone)
 		process_anyone(gc);
@@ -1906,7 +1906,7 @@ static void write_zsubs(zephyr_account *
 			zrecip = g_strdup("*");
 		} else if (!g_ascii_strcasecmp(triple[2],"")){
 			zrecip = g_strdup("*");
-		} else if (!g_ascii_strcasecmp(triple[2], zephyr->username)) {
+		} else if (!g_ascii_strcasecmp(triple[2], purple_account_get_username(zephyr))) {
 			zrecip = g_strdup("%me%");
 		} else {
 			zrecip = g_strdup(triple[2]);
@@ -1948,7 +1948,7 @@ static void write_anyone(PurpleConnectio
 				if (!PURPLE_BLIST_NODE_IS_BUDDY(bnode))
 					continue;
 				b = (PurpleBuddy *) bnode;
-				if (b->account == gc->account) {
+				if (b->account == purple_connection_get_account(gc)) {
 					gchar *stripped_user = zephyr_strip_local_realm(zephyr,b->name);
 					fprintf(fd, "%s\n", stripped_user);
 					g_free(stripped_user);
@@ -1975,10 +1975,10 @@ static void zephyr_close(PurpleConnectio
 	}
 	g_list_free(zephyr->pending_zloc_names);
 
-	if (purple_account_get_bool(gc->account, "write_anyone", FALSE))
+	if (purple_account_get_bool(purple_connection_get_account(gc), "write_anyone", FALSE))
 		write_anyone(gc);
 
-	if (purple_account_get_bool(gc->account, "write_zsubs", FALSE))
+	if (purple_account_get_bool(purple_connection_get_account(gc), "write_zsubs", FALSE))
 		write_zsubs(gc->proto_data);
 
 	s = zephyr->subscrips;
@@ -2050,7 +2050,7 @@ static int zephyr_chat_send(PurpleConnec
 	sig = zephyr_get_signature();
 
 	gconv1 = purple_find_conversation_with_account(PURPLE_CONV_TYPE_CHAT, zt->name,
-												 gc->account);
+												 purple_connection_get_account(gc));
 	gcc = purple_conversation_get_chat_data(gconv1);
 
 	if (!(inst = (char *)purple_conv_chat_get_topic(gcc)))
@@ -2440,7 +2440,7 @@ static void zephyr_join_chat(PurpleConne
 	if (!recip || (*recip == '*'))
 		recip = "";
 	if (!g_ascii_strcasecmp(recip, "%me%"))
-		recip = zephyr->username;
+		recip = purple_account_get_username(zephyr);
 
 	zt1 = new_triple(gc->proto_data,classname, instname, recip);
 	zt2 = find_sub_by_triple(gc->proto_data,zt1);
@@ -2566,14 +2566,14 @@ static void zephyr_chat_set_topic(Purple
 	PurpleConvChat *gcc;
 	gchar *topic_utf8;
 	zephyr_account* zephyr = gc->proto_data;
-	char *sender = (char *)zephyr->username;
+	char *sender = (char *)purple_account_get_username(zephyr);
 
 	zt = find_sub_by_id(gc->proto_data,id);
 	/* find_sub_by_id can return NULL */
 	if (!zt) 
 		return;
 	gconv = purple_find_conversation_with_account(PURPLE_CONV_TYPE_CHAT, zt->name,
-												gc->account);
+												purple_connection_get_account(gc));
 	gcc = purple_conversation_get_chat_data(gconv);
 
 	topic_utf8 = zephyr_recv_convert(gc,(gchar *)topic,strlen(topic));
@@ -2797,7 +2797,7 @@ static void zephyr_action_get_subs_from_
 	if (use_zeph02(zephyr)) {
 		GString* subout = g_string_new("Subscription list<br>");
 		
-		title = g_strdup_printf("Server subscriptions for %s", zephyr->username);
+		title = g_strdup_printf("Server subscriptions for %s", purple_account_get_username(zephyr));
 		
 		if (zephyr->port == 0) {
 			purple_debug_error("zephyr", "error while retrieving port\n");
============================================================
--- libpurple/server.c	2f84d197fbaa0bd1e623a3abb426260c3246df4c
+++ libpurple/server.c	16a8551f03c2cd36b4031039e7d7216d181f8ea3
@@ -128,6 +128,7 @@ int serv_send_im(PurpleConnection *gc, c
 	PurplePluginProtocolInfo *prpl_info = NULL;
 	int val = -EINVAL;
 	const gchar *auto_reply_pref = NULL;
+	PurpleConnectionFlags cflags;
 
 	g_return_val_if_fail(gc != NULL, val);
 
@@ -150,7 +151,8 @@ 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) &&
+	cflags = purple_connection_get_flags(gc);
+	if((cflags & PURPLE_CONNECTION_FLAGS_AUTO_RESP) &&
 			flags & PURPLE_MESSAGE_AUTO_RESP &&
 			!purple_presence_is_available(presence) &&
 			strcmp(auto_reply_pref, "never")) {
@@ -251,8 +253,8 @@ serv_got_alias(PurpleConnection *gc, con
 		b = buddies->data;
 		buddies = g_slist_delete_link(buddies, buddies);
 
-		if((b->server_alias == NULL && alias == NULL) ||
-		    (b->server_alias && alias && !strcmp(b->server_alias, alias)))
+		if((purple_buddy_get_server_alias(b) == NULL && alias == NULL) ||
+		    (purple_buddy_get_server_alias(b) && alias && !strcmp(purple_buddy_get_server_alias(b), alias)))
 		{
 			continue;
 		}
@@ -337,13 +339,13 @@ serv_send_attention(PurpleConnection *gc
 	g_return_if_fail(gc != NULL);
 	g_return_if_fail(who != NULL);
 
-	prpl = purple_find_prpl(purple_account_get_protocol_id(gc->account));
+	prpl = purple_find_prpl(purple_account_get_protocol_id(purple_connection_get_account(gc)));
 	send_attention = PURPLE_PLUGIN_PROTOCOL_INFO(prpl)->send_attention;
 	g_return_if_fail(send_attention != NULL);
 
 	mtime = time(NULL);
 
-	attn = purple_get_attention_type_from_code(gc->account, type_code);
+	attn = purple_get_attention_type_from_code(purple_connection_get_account(gc), type_code);
 
 	if ((buddy = purple_find_buddy(purple_connection_get_account(gc), who)) != NULL)
 		alias = purple_buddy_get_contact_alias(buddy);
@@ -364,7 +366,7 @@ serv_send_attention(PurpleConnection *gc
 	if (!send_attention(gc, who, type_code))
 		return;
 
-	conv = purple_conversation_new(PURPLE_CONV_TYPE_IM, gc->account, who);
+	conv = purple_conversation_new(PURPLE_CONV_TYPE_IM, purple_connection_get_account(gc), who);
 	purple_conv_im_write(PURPLE_CONV_IM(conv), NULL, description, flags, mtime);
 
 	g_free(description);
@@ -382,7 +384,7 @@ serv_got_attention(PurpleConnection *gc,
 
 	mtime = time(NULL);
 
-	attn = purple_get_attention_type_from_code(gc->account, type_code);
+	attn = purple_get_attention_type_from_code(purple_connection_get_account(gc), type_code);
 
 	/* PURPLE_MESSAGE_NOTIFY is for attention messages. */
 	flags = PURPLE_MESSAGE_SYSTEM | PURPLE_MESSAGE_NOTIFY | PURPLE_MESSAGE_RECV;
@@ -667,7 +669,7 @@ void serv_got_im(PurpleConnection *gc, c
 	 * We should update the conversation window buttons and menu,
 	 * if it exists.
 	 */
-	conv = purple_find_conversation_with_account(PURPLE_CONV_TYPE_IM, who, gc->account);
+	conv = purple_find_conversation_with_account(PURPLE_CONV_TYPE_IM, who, purple_connection_get_account(gc));
 
 	/*
 	 * Make copies of the message and the sender in case plugins want
@@ -678,7 +680,7 @@ void serv_got_im(PurpleConnection *gc, c
 
 	plugin_return = GPOINTER_TO_INT(
 		purple_signal_emit_return_1(purple_conversations_get_handle(),
-								  "receiving-im-msg", gc->account,
+								  "receiving-im-msg", purple_connection_get_account(gc),
 								  &angel, &buffy, conv, &flags));
 
 	if (!buffy || !angel || plugin_return) {
@@ -690,12 +692,12 @@ void serv_got_im(PurpleConnection *gc, c
 	name = angel;
 	message = buffy;
 
-	purple_signal_emit(purple_conversations_get_handle(), "received-im-msg", gc->account,
+	purple_signal_emit(purple_conversations_get_handle(), "received-im-msg", purple_connection_get_account(gc),
 					 name, message, conv, flags);
 
 	/* search for conversation again in case it was created by received-im-msg handler */
 	if (conv == NULL)
-		conv = purple_find_conversation_with_account(PURPLE_CONV_TYPE_IM, name, gc->account);
+		conv = purple_find_conversation_with_account(PURPLE_CONV_TYPE_IM, name, purple_connection_get_account(gc));
 
 	/*
 	 * XXX: Should we be setting this here, or relying on prpls to set it?
@@ -717,7 +719,7 @@ void serv_got_im(PurpleConnection *gc, c
 	 *  - or we're not idle and the 'only auto respond if idle' pref
 	 *    is set
 	 */
-	if (gc->flags & PURPLE_CONNECTION_AUTO_RESP)
+	if (purple_connection_get_flags(gc) & PURPLE_CONNECTION_FLAGS_AUTO_RESP)
 	{
 		PurplePresence *presence;
 		PurpleStatus *status;
@@ -788,7 +790,7 @@ void serv_got_typing(PurpleConnection *g
 	PurpleConversation *conv;
 	PurpleConvIm *im = NULL;
 
-	conv = purple_find_conversation_with_account(PURPLE_CONV_TYPE_IM, name, gc->account);
+	conv = purple_find_conversation_with_account(PURPLE_CONV_TYPE_IM, name, purple_connection_get_account(gc));
 	if (conv != NULL) {
 		im = PURPLE_CONV_IM(conv);
 
@@ -799,15 +801,15 @@ void serv_got_typing(PurpleConnection *g
 		{
 			case PURPLE_TYPING:
 				purple_signal_emit(purple_conversations_get_handle(),
-								   "buddy-typing", gc->account, name);
+								   "buddy-typing", purple_connection_get_account(gc), name);
 				break;
 			case PURPLE_TYPED:
 				purple_signal_emit(purple_conversations_get_handle(),
-								   "buddy-typed", gc->account, name);
+								   "buddy-typed", purple_connection_get_account(gc), name);
 				break;
 			case PURPLE_NOT_TYPING:
 				purple_signal_emit(purple_conversations_get_handle(),
-								   "buddy-typing-stopped", gc->account, name);
+								   "buddy-typing-stopped", purple_connection_get_account(gc), name);
 				break;
 		}
 	}
@@ -821,7 +823,7 @@ void serv_got_typing_stopped(PurpleConne
 	PurpleConversation *conv;
 	PurpleConvIm *im;
 
-	conv = purple_find_conversation_with_account(PURPLE_CONV_TYPE_IM, name, gc->account);
+	conv = purple_find_conversation_with_account(PURPLE_CONV_TYPE_IM, name, purple_connection_get_account(gc));
 	if (conv != NULL)
 	{
 		im = PURPLE_CONV_IM(conv);
@@ -836,7 +838,7 @@ void serv_got_typing_stopped(PurpleConne
 	else
 	{
 		purple_signal_emit(purple_conversations_get_handle(),
-						 "buddy-typing-stopped", gc->account, name);
+						 "buddy-typing-stopped", purple_connection_get_account(gc), name);
 	}
 }
 
@@ -927,8 +929,10 @@ PurpleConversation *serv_got_joined_chat
 	conv = purple_conversation_new(PURPLE_CONV_TYPE_CHAT, account, name);
 	chat = PURPLE_CONV_CHAT(conv);
 
+#if 0
 	if (!g_slist_find(gc->buddy_chats, conv))
 		gc->buddy_chats = g_slist_append(gc->buddy_chats, conv);
+#endif
 
 	purple_conv_chat_set_id(chat, id);
 
@@ -943,6 +947,7 @@ void serv_got_chat_left(PurpleConnection
 	PurpleConversation *conv = NULL;
 	PurpleConvChat *chat = NULL;
 
+#if 0
 	for (bcs = g->buddy_chats; bcs != NULL; bcs = bcs->next) {
 		conv = (PurpleConversation *)bcs->data;
 
@@ -961,6 +966,7 @@ void serv_got_chat_left(PurpleConnection
 			   purple_conversation_get_name(conv));
 
 	g->buddy_chats = g_slist_remove(g->buddy_chats, conv);
+#endif
 
 	purple_conv_chat_left(PURPLE_CONV_CHAT(conv));
 
@@ -975,10 +981,12 @@ void serv_got_chat_in(PurpleConnection *
 	PurpleConvChat *chat = NULL;
 	char *buffy, *angel;
 	int plugin_return;
+	PurpleAccount *account;
 
 	g_return_if_fail(who != NULL);
 	g_return_if_fail(message != NULL);
 
+#if 0
 	for (bcs = g->buddy_chats; bcs != NULL; bcs = bcs->next) {
 		conv = (PurpleConversation *)bcs->data;
 
@@ -992,6 +1000,7 @@ void serv_got_chat_in(PurpleConnection *
 
 	if (!conv)
 		return;
+#endif
 
 	/*
 	 * Make copies of the message and the sender in case plugins want
@@ -1000,9 +1009,10 @@ void serv_got_chat_in(PurpleConnection *
 	buffy = g_strdup(message);
 	angel = g_strdup(who);
 
+	account = purple_connection_get_account(g);
 	plugin_return = GPOINTER_TO_INT(
 		purple_signal_emit_return_1(purple_conversations_get_handle(),
-								  "receiving-chat-msg", g->account,
+								  "receiving-chat-msg", account,
 								  &angel, &buffy, conv, &flags));
 
 	if (!buffy || !angel || plugin_return) {
@@ -1014,7 +1024,7 @@ void serv_got_chat_in(PurpleConnection *
 	who = angel;
 	message = buffy;
 
-	purple_signal_emit(purple_conversations_get_handle(), "received-chat-msg", g->account,
+	purple_signal_emit(purple_conversations_get_handle(), "received-chat-msg", account,
 					 who, message, conv, flags);
 
 	purple_conv_chat_write(chat, who, message, flags, mtime);


More information about the Commits mailing list