changeset 5563:9eb5b13fd412

[gaim-migrate @ 5965] Just a taste of what's coming. Standard "This won't compile" thing. Plugin authors, you're going to hate me, but that's okay, because I have friends too! It's really late. My brain resembles that of fish swimming in jello pudding with neon lights flying around chanting musicals. I'm not on drugs. I'm just that tired. committer: Tailor Script <tailor@pidgin.im>
author Christian Hammond <chipx86@chipx86.com>
date Fri, 30 May 2003 09:38:29 +0000
parents 3c8d34574601
children 187c740f2a4e
files src/Makefile.am src/account.c src/account.h src/away.c src/blist.c src/blist.h src/buddy_chat.c src/connection.c src/connection.h src/conversation.c src/conversation.h src/core.c src/core.h src/dialogs.c src/ft.c src/ft.h src/gaim.h src/gaimrc.c src/gtkaccount.c src/gtkaccount.h src/gtkblist.h src/gtkconv.c src/gtknotify.c src/gtkpounce.c src/gtkpounce.h src/gtkprefs.c src/idle.c src/log.c src/main.c src/multi.c src/multi.h src/pounce.c src/pounce.h src/privacy.h src/protocols/gg/gg.c src/proxy.c src/proxy.h src/prpl.c src/prpl.h src/server.c src/stock.c src/stock.h src/ui.h src/util.c src/util.h
diffstat 45 files changed, 2157 insertions(+), 2500 deletions(-) [+]
line wrap: on
line diff
--- a/src/Makefile.am	Fri May 30 04:13:58 2003 +0000
+++ b/src/Makefile.am	Fri May 30 09:38:29 2003 +0000
@@ -6,8 +6,12 @@
 SUBDIRS = protocols
 
 CORESOURCES = \
+	account.c \
+	account.h \
 	blist.c \
 	blist.h \
+	connection.c \
+	connection.h \
 	conversation.c \
 	conversation.h \
 	core.c \
@@ -53,6 +57,8 @@
 	gaim-disclosure.c \
 	gaim-disclosure.h \
 	gaimrc.c \
+	gtkaccount.c \
+	gtkaccount.h \
 	gtkcellrendererprogress.c \
 	gtkcellrendererprogress.h \
 	gtkblist.c \
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/account.c	Fri May 30 09:38:29 2003 +0000
@@ -0,0 +1,376 @@
+/**
+ * @file account.c Account API
+ * @ingroup core
+ *
+ * gaim
+ *
+ * Copyright (C) 2003 Christian Hammond <chipx86@gnupdate.org>
+ * 
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ */
+#include "account.h"
+#include "prefs.h"
+
+typedef struct
+{
+	GaimPrefType type;
+
+	union
+	{
+		int integer;
+		char *string;
+		gboolean bool;
+
+	} value;
+
+} GaimAccountSetting;
+
+static GList *accounts = NULL;
+
+static void
+__delete_setting(void *data)
+{
+	GaimAccountSetting *setting = (GaimAccountSetting *)data;
+
+	if (setting->type == GAIM_PREF_STRING)
+		g_free(setting->value.string);
+
+	g_free(setting);
+}
+
+GaimAccount *
+gaim_account_new(const char *username, GaimProtocol protocol)
+{
+	GaimAccount *account;
+
+	g_return_val_if_fail(username != NULL, NULL);
+
+	account = g_new0(GaimAccount, 1);
+
+	gaim_account_set_username(account, username);
+	gaim_account_set_protocol(account, protocol);
+
+	account->settings = g_hash_table_new_full(g_str_hash, g_str_equal,
+											  g_free, __delete_setting);
+
+	accounts = g_list_append(accounts, account);
+
+	return account;
+}
+
+void
+gaim_account_destroy(GaimAccount *account)
+{
+	g_return_if_fail(account != NULL);
+
+	if (account->gc != NULL)
+		gaim_connection_destroy(account->gc);
+
+	if (account->username  != NULL) g_free(account->username);
+	if (account->alias     != NULL) g_free(account->alias);
+	if (account->password  != NULL) g_free(account->password);
+	if (account->user_info != NULL) g_free(account->user_info);
+
+	g_hash_table_destroy(account->settings);
+
+	accounts = g_list_remove(accounts, account);
+
+	g_free(account);
+}
+
+GaimConnection *
+gaim_account_connect(GaimAccount *account)
+{
+	GaimConnection *gc;
+
+	g_return_val_if_fail(account != NULL, NULL);
+	g_return_val_if_fail(!gaim_account_is_connected(account), NULL);
+
+	gc = gaim_connection_new(account);
+
+	gaim_connection_connect(gc);
+
+	return gc;
+}
+
+void
+gaim_account_disconnect(GaimAccount *account)
+{
+	g_return_if_fail(account != NULL);
+	g_return_if_fail(gaim_account_is_connected(account));
+
+	gaim_connection_disconnect(account->gc);
+	gaim_connection_destroy(account->gc);
+
+	account->gc = NULL;
+}
+
+void
+gaim_account_set_username(GaimAccount *account, const char *username)
+{
+	g_return_if_fail(account  != NULL);
+	g_return_if_fail(username != NULL);
+
+	if (account->username != NULL)
+		g_free(account->username);
+
+	account->username = (username == NULL ? NULL : g_strdup(username));
+}
+
+void
+gaim_account_set_password(GaimAccount *account, const char *password)
+{
+	g_return_if_fail(account  != NULL);
+	g_return_if_fail(password != NULL);
+
+	if (account->password != NULL)
+		g_free(account->password);
+
+	account->password = (password == NULL ? NULL : g_strdup(password));
+}
+
+void
+gaim_account_set_alias(GaimAccount *account, const char *alias)
+{
+	g_return_if_fail(account != NULL);
+	g_return_if_fail(alias   != NULL);
+
+	if (account->alias != NULL)
+		g_free(account->alias);
+
+	account->alias = (alias == NULL ? NULL : g_strdup(alias));
+}
+
+void
+gaim_account_set_user_info(GaimAccount *account, const char *user_info)
+{
+	g_return_if_fail(account   != NULL);
+	g_return_if_fail(user_info != NULL);
+
+	if (account->user_info != NULL)
+		g_free(account->user_info);
+
+	account->user_info = (user_info == NULL ? NULL : g_strdup(user_info));
+}
+
+void
+gaim_account_set_buddy_icon(GaimAccount *account, const char *icon)
+{
+	g_return_if_fail(account != NULL);
+	g_return_if_fail(icon    != NULL);
+
+	if (account->buddy_icon != NULL)
+		g_free(account->buddy_icon);
+
+	account->buddy_icon = (icon == NULL ? NULL : g_strdup(icon));
+}
+
+void
+gaim_account_set_protocol(GaimAccount *account, GaimProtocol protocol)
+{
+	g_return_if_fail(account != NULL);
+
+	account->protocol = protocol;
+}
+
+void
+gaim_account_set_connection(GaimAccount *account, GaimConnection *gc)
+{
+	g_return_if_fail(account != NULL);
+	g_return_if_fail(gc      != NULL);
+
+	account->gc = gc;
+}
+
+void
+gaim_account_set_remember_password(GaimAccount *account, gboolean value)
+{
+	g_return_if_fail(account != NULL);
+
+	account->remember_pass = value;
+}
+
+void
+gaim_account_set_int(GaimAccount *account, const char *name, int value)
+{
+	GaimAccountSetting *setting;
+
+	g_return_if_fail(account != NULL);
+	g_return_if_fail(name    != NULL);
+
+	setting = g_new0(GaimAccountSetting, 1);
+
+	setting->type          = GAIM_PREF_INT;
+	setting->value.integer = value;
+
+	g_hash_table_insert(account->settings, g_strdup(name), setting);
+}
+
+void
+gaim_account_set_string(GaimAccount *account, const char *name,
+						const char *value)
+{
+	GaimAccountSetting *setting;
+
+	g_return_if_fail(account != NULL);
+	g_return_if_fail(name    != NULL);
+
+	setting = g_new0(GaimAccountSetting, 1);
+
+	setting->type         = GAIM_PREF_STRING;
+	setting->value.string = g_strdup(value);
+
+	g_hash_table_insert(account->settings, g_strdup(name), setting);
+}
+
+void
+gaim_account_set_bool(GaimAccount *account, const char *name, gboolean value)
+{
+	GaimAccountSetting *setting;
+
+	g_return_if_fail(account != NULL);
+	g_return_if_fail(name    != NULL);
+
+	setting = g_new0(GaimAccountSetting, 1);
+
+	setting->type       = GAIM_PREF_BOOLEAN;
+	setting->value.bool = value;
+
+	g_hash_table_insert(account->settings, g_strdup(name), setting);
+}
+
+gboolean
+gaim_account_is_connected(const GaimAccount *account)
+{
+	g_return_val_if_fail(account != NULL, FALSE);
+
+	return (account->gc != NULL &&
+			gaim_connection_get_state(account->gc) == GAIM_CONNECTED);
+}
+
+const char *
+gaim_account_get_username(const GaimAccount *account)
+{
+	g_return_val_if_fail(account != NULL, NULL);
+
+	return account->username;
+}
+
+const char *
+gaim_account_get_password(const GaimAccount *account)
+{
+	g_return_val_if_fail(account != NULL, NULL);
+
+	return account->password;
+}
+
+const char *
+gaim_account_get_alias(const GaimAccount *account)
+{
+	g_return_val_if_fail(account != NULL, NULL);
+
+	return account->alias;
+}
+
+const char *
+gaim_account_get_user_info(const GaimAccount *account)
+{
+	g_return_val_if_fail(account != NULL, NULL);
+
+	return account->user_info;
+}
+
+const char *
+gaim_account_get_buddy_icon(const GaimAccount *account)
+{
+	g_return_val_if_fail(account != NULL, NULL);
+
+	return account->buddy_icon;
+}
+
+GaimProtocol
+gaim_account_get_protocol(const GaimAccount *account)
+{
+	g_return_val_if_fail(account != NULL, -1);
+
+	return account->protocol;
+}
+
+GaimConnection *
+gaim_account_get_connection(const GaimAccount *account)
+{
+	g_return_val_if_fail(account != NULL, NULL);
+
+	return account->gc;
+}
+
+gboolean
+gaim_account_get_remember_password(const GaimAccount *account)
+{
+	g_return_val_if_fail(account != NULL, FALSE);
+
+	return account->remember_pass;
+}
+
+int
+gaim_account_get_int(const GaimAccount *account, const char *name)
+{
+	GaimAccountSetting *setting;
+
+	g_return_val_if_fail(account != NULL, -1);
+	g_return_val_if_fail(name    != NULL, -1);
+
+	setting = g_hash_table_lookup(account->settings, name);
+
+	g_return_val_if_fail(setting->type == GAIM_PREF_INT, -1);
+
+	return setting->value.integer;
+}
+
+const char *
+gaim_account_get_string(const GaimAccount *account, const char *name)
+{
+	GaimAccountSetting *setting;
+
+	g_return_val_if_fail(account != NULL, NULL);
+	g_return_val_if_fail(name    != NULL, NULL);
+
+	setting = g_hash_table_lookup(account->settings, name);
+
+	g_return_val_if_fail(setting->type == GAIM_PREF_STRING, NULL);
+
+	return setting->value.string;
+}
+
+gboolean
+gaim_account_get_bool(const GaimAccount *account, const char *name)
+{
+	GaimAccountSetting *setting;
+
+	g_return_val_if_fail(account != NULL, FALSE);
+	g_return_val_if_fail(name    != NULL, FALSE);
+
+	setting = g_hash_table_lookup(account->settings, name);
+
+	g_return_val_if_fail(setting->type == GAIM_PREF_BOOLEAN, FALSE);
+
+	return setting->value.bool;
+}
+
+GList *
+gaim_accounts_get_all(void)
+{
+	return accounts;
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/account.h	Fri May 30 09:38:29 2003 +0000
@@ -0,0 +1,301 @@
+/**
+ * @file account.h Account API
+ * @ingroup core
+ *
+ * gaim
+ *
+ * Copyright (C) 2003 Christian Hammond <chipx86@gnupdate.org>
+ * 
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ */
+#ifndef _GAIM_ACCOUNTS_H_
+#define _GAIM_ACCOUNTS_H_
+
+typedef struct _GaimAccount GaimAccount;
+
+#include "connection.h"
+#include "prpl.h"
+
+struct _GaimAccount
+{
+	char *username;             /**< The username.               */
+	char *alias;                /**< The current alias.          */
+	char *password;             /**< The account password.       */
+	char *user_info;            /**< User information.           */
+
+	char *buddy_icon;           /**< The buddy icon.             */
+
+	gboolean remember_pass;     /**< Remember the password.      */
+
+	GaimProtocol protocol;      /**< The account protocol.       */
+
+	GaimConnection *gc;         /**< The connection handle.      */
+
+	GHashTable *settings;       /**< Protocol-specific settings. */
+
+	struct gaim_proxy_info *gpi; /**< Proxy information.         */
+
+	GSList *permit;             /**< Permit list.                */
+	GSList *deny;               /**< Deny list.                  */
+	int perm_deny;              /**< The permit/deny setting.    */
+};
+
+/**
+ * Creates a new account.
+ *
+ * @param username The username.
+ * @param protocol The protocol.
+ */
+GaimAccount *gaim_account_new(const char *username, GaimProtocol protocol);
+
+/**
+ * Destroys an account.
+ *
+ * @param account The account to destroy.
+ */
+void gaim_account_destroy(GaimAccount *account);
+
+/**
+ * Connects to an account.
+ *
+ * @param account The account to connect to.
+ *
+ * @return The gaim connection.
+ */
+GaimConnection *gaim_account_connect(GaimAccount *account);
+
+/**
+ * Disconnects from an account.
+ *
+ * @param account The account to disconnect from.
+ *
+ * @return The gaim connection.
+ */
+void gaim_account_disconnect(GaimAccount *account);
+
+/**
+ * Sets the account's username.
+ *
+ * @param account  The account.
+ * @param username The username.
+ */
+void gaim_account_set_username(GaimAccount *account, const char *username);
+
+/**
+ * Sets the account's password.
+ *
+ * @param account  The account.
+ * @param password The password.
+ */
+void gaim_account_set_password(GaimAccount *account, const char *password);
+
+/**
+ * Sets the account's alias.
+ *
+ * @param account The account.
+ * @param alias   The alias.
+ */
+void gaim_account_set_alias(GaimAccount *account, const char *alias);
+
+/**
+ * Sets the account's user information
+ *
+ * @param account The account.
+ * @param info    The user information.
+ */
+void gaim_account_set_user_info(GaimAccount *account, const char *user_info);
+
+/**
+ * Sets the account's buddy icon.
+ * 
+ * @param account The account.
+ * @param icon    The buddy icon file.
+ */
+void gaim_account_set_buddy_icon(GaimAccount *account, const char *icon);
+
+/**
+ * Sets the account's protocol.
+ *
+ * @param account  The account.
+ * @param protocol The protocol.
+ */
+void gaim_account_set_protocol(GaimAccount *account, GaimProtocol protocol);
+
+/**
+ * Sets the account's connection.
+ *
+ * @param account The account.
+ * @param gc      The connection.
+ */
+void gaim_account_set_connection(GaimAccount *account, GaimConnection *gc);
+
+/**
+ * Sets whether or not this account should save its password.
+ *
+ * @param account The account.
+ * @param value   @c TRUE if it should remember the password.
+ */
+void gaim_account_set_remember_password(GaimAccount *account, gboolean value);
+
+/**
+ * Sets a protocol-specific integer setting for an account.
+ *
+ * @param account The account.
+ * @param name    The name of the setting.
+ * @param value   The setting's value.
+ */
+void gaim_account_set_int(GaimAccount *account, const char *name, int value);
+
+/**
+ * Sets a protocol-specific string setting for an account.
+ *
+ * @param account The account.
+ * @param name    The name of the setting.
+ * @param value   The setting's value.
+ */
+void gaim_account_set_string(GaimAccount *account, const char *name,
+							 const char *string);
+
+/**
+ * Sets a protocol-specific boolean setting for an account.
+ *
+ * @param account The account.
+ * @param name    The name of the setting.
+ * @param value   The setting's value.
+ */
+void gaim_account_set_bool(GaimAccount *account, const char *name,
+						   gboolean value);
+
+
+/**
+ * Returns whether or not the account is connected.
+ *
+ * @param account The account.
+ *
+ * @return @c TRUE if connected, or @c FALSE otherwise.
+ */
+gboolean gaim_account_is_connected(const GaimAccount *account);
+
+/**
+ * Returns the account's username.
+ *
+ * @param account The account.
+ *
+ * @return The username.
+ */
+const char *gaim_account_get_username(const GaimAccount *account);
+
+/**
+ * Returns the account's password.
+ *
+ * @param account The account.
+ *
+ * @return The password.
+ */
+const char *gaim_account_get_password(const GaimAccount *account);
+
+/**
+ * Returns the account's alias.
+ *
+ * @param account The account.
+ *
+ * @return The alias.
+ */
+const char *gaim_account_get_alias(const GaimAccount *account);
+
+/**
+ * Returns the account's user information.
+ *
+ * @param account The account.
+ *
+ * @return The user information.
+ */
+const char *gaim_account_get_user_info(const GaimAccount *account);
+
+/**
+ * Returns the account's buddy icon filename.
+ *
+ * @param account The account.
+ *
+ * @return The buddy icon filename.
+ */
+const char *gaim_account_get_buddy_icon(const GaimAccount *account);
+
+/**
+ * Returns the account's protocol.
+ *
+ * @param account The account.
+ *
+ * @return The protocol.
+ */
+GaimProtocol gaim_account_get_protocol(const GaimAccount *account);
+
+/**
+ * Returns the account's connection.
+ *
+ * @param account The account.
+ *
+ * @return The connection.
+ */
+GaimConnection *gaim_account_get_connection(const GaimAccount *account);
+
+/**
+ * Returns whether or not this account should save its password.
+ *
+ * @param account The account.
+ *
+ * @return @c TRUE if it should remember the password.
+ */
+gboolean gaim_account_get_remember_password(const GaimAccount *account);
+
+/**
+ * Returns a protocol-specific integer setting for an account.
+ *
+ * @param account The account.
+ * @param name    The name of the setting.
+ *
+ * @return The value.
+ */
+int gaim_account_get_int(const GaimAccount *account, const char *name);
+
+/**
+ * Returns a protocol-specific string setting for an account.
+ *
+ * @param account The account.
+ * @param name    The name of the setting.
+ *
+ * @return The value.
+ */
+const char *gaim_account_get_string(const GaimAccount *account,
+									const char *name);
+
+/**
+ * Returns a protocol-specific boolean setting for an account.
+ *
+ * @param account The account.
+ * @param name    The name of the setting.
+ *
+ * @return The value.
+ */
+gboolean gaim_account_get_bool(const GaimAccount *account, const char *name);
+
+/**
+ * Returns a list of all accounts.
+ *
+ * @return A list of all accounts.
+ */
+GList *gaim_accounts_get_all(void);
+
+#endif /* _GAIM_ACCOUNTS_H_ */
--- a/src/away.c	Fri May 30 04:13:58 2003 +0000
+++ b/src/away.c	Fri May 30 09:38:29 2003 +0000
@@ -75,7 +75,7 @@
 		struct queued_message *qm = templist->data;
 		if (templist->data) {
 			if (!gaim_utf8_strcasecmp(qm->name, name)) {
-				struct gaim_account *account = NULL;
+				GaimAccount *account = NULL;
 
 				if (g_slist_index(gaim_accounts, qm->account) >= 0)
 					account = qm->account;
@@ -110,7 +110,7 @@
 	GSList *q = *queue;
 	struct queued_message *qm;
 	struct gaim_conversation *cnv;
-	struct gaim_account *account;
+	GaimAccount *account;
 
 	while (q) {
 		qm = q->data;
@@ -322,7 +322,7 @@
 	save_prefs();
 }
 
-static void set_gc_away(GObject *obj, struct gaim_connection *gc)
+static void set_gc_away(GObject *obj, GaimConnection *gc)
 {
 	struct away_message *awy = g_object_get_data(obj, "away_message");
 
@@ -332,7 +332,7 @@
 		serv_set_away(gc, GAIM_AWAY_CUSTOM, NULL);
 }
 
-static void set_gc_state(GObject *obj, struct gaim_connection *gc)
+static void set_gc_state(GObject *obj, GaimConnection *gc)
 {
 	char *awy = g_object_get_data(obj, "away_state");
 
@@ -354,8 +354,8 @@
 	GList *l;
 	GSList *awy = away_messages;
 	struct away_message *a;
-	GSList *con = connections;
-	struct gaim_connection *gc = NULL;
+	GList *con;
+	GaimConnection *gc = NULL;
 	GaimPluginProtocolInfo *prpl_info = NULL;
 
 	int count = 0;
@@ -413,28 +413,26 @@
 
 		gaim_separator(awaymenu);
 
-		while (con) {
+		for (con = gaim_connections_get_all(); con != NULL; con = con->next) {
 			gc = con->data;
 
 			prpl_info = GAIM_PLUGIN_PROTOCOL_INFO(gc->prpl);
 
 			if (prpl_info->away_states != NULL && prpl_info->set_away != NULL)
 				count++;
-			con = g_slist_next(con);
 		}
-		con = connections;
 
 		if (count == 0) {
 		} else if (count == 1) {
 			GList *msgs, *tmp;
-			while (con) {
+
+			for (con = gaim_connections_get_all(); con != NULL; con = con->next) {
 				gc = con->data;
 
 				prpl_info = GAIM_PLUGIN_PROTOCOL_INFO(gc->prpl);
 
 				if (prpl_info->away_states && prpl_info->set_away)
 					break;
-				con = g_slist_next(con);
 			}
 
 			tmp = msgs = prpl_info->away_states(gc);
@@ -493,21 +491,23 @@
 				}
 
 			g_list_free(tmp);
-		} else {
-			while (con) {
+		}
+		else {
+			for (con = gaim_connections_get_all(); con != NULL; con = con->next) {
+				GaimAccount *account;
 				char buf[256];
 				GList *msgs, *tmp;
 				gc = con->data;
 
 				prpl_info = GAIM_PLUGIN_PROTOCOL_INFO(gc->prpl);
 
-				if (!prpl_info->away_states || !prpl_info->set_away) {
-					con = con->next;
+				if (!prpl_info->away_states || !prpl_info->set_away)
 					continue;
-				}
+
+				account = gaim_connection_get_account(gc);
 
 				g_snprintf(buf, sizeof(buf), "%s (%s)",
-					   gc->username, gc->prpl->info->name);
+					   gaim_account_get_username(account), gc->prpl->info->name);
 				menuitem = gtk_image_menu_item_new_with_label(buf);
 
 				pixbuf = create_prpl_icon(gc->account);
@@ -598,8 +598,6 @@
 					}
 
 				g_list_free(tmp);
-
-				con = g_slist_next(con);
 			}
 
 			menuitem = gtk_menu_item_new_with_label(_("Set All Away"));
--- a/src/blist.c	Fri May 30 04:13:58 2003 +0000
+++ b/src/blist.c	Fri May 30 09:38:29 2003 +0000
@@ -69,7 +69,7 @@
 
 struct _gaim_hbuddy {
 	char *name;
-	struct gaim_account *account;
+	GaimAccount *account;
 };
 
 static guint _gaim_blist_hbuddy_hash (struct _gaim_hbuddy *hb)
@@ -295,14 +295,14 @@
 			child = next;
 		}
 		for (accts = gaim_group_get_accounts(group); accts; accts = g_slist_remove(accts, accts->data)) {
-			struct gaim_account *account = accts->data;
+			GaimAccount *account = accts->data;
 			serv_rename_group(account->gc, group, name);
 		}
 		gaim_blist_remove_group(group);
 	} else {
 		/* a simple rename */
 		for (accts = gaim_group_get_accounts(group); accts; accts = g_slist_remove(accts, accts->data)) {
-			struct gaim_account *account = accts->data;
+			GaimAccount *account = accts->data;
 			serv_rename_group(account->gc, group, name);
 		}
 		g_free(group->name);
@@ -312,7 +312,7 @@
 	}
 }
 
-struct chat *gaim_chat_new(struct gaim_account *account, const char *alias, GHashTable *components)
+struct chat *gaim_chat_new(GaimAccount *account, const char *alias, GHashTable *components)
 {
 	struct chat *chat;
 	struct gaim_blist_ui_ops *ops;
@@ -336,7 +336,7 @@
 	return chat;
 }
 
-struct buddy *gaim_buddy_new(struct gaim_account *account, const char *screenname, const char *alias)
+struct buddy *gaim_buddy_new(GaimAccount *account, const char *screenname, const char *alias)
 {
 	struct buddy *b;
 	struct gaim_blist_ui_ops *ops;
@@ -723,7 +723,7 @@
 
 }
 
-struct buddy *gaim_find_buddy(struct gaim_account *account, const char *name)
+struct buddy *gaim_find_buddy(GaimAccount *account, const char *name)
 {
 	struct buddy *buddy;
 	struct _gaim_hbuddy hb;
@@ -771,7 +771,7 @@
 	return l;
 }
 
-void gaim_blist_add_account(struct gaim_account *account)
+void gaim_blist_add_account(GaimAccount *account)
 {
 	struct gaim_blist_ui_ops *ops = gaimbuddylist->ui_ops;
 	GaimBlistNode *group, *buddy;
@@ -801,7 +801,7 @@
 	}
 }
 
-void gaim_blist_remove_account(struct gaim_account *account)
+void gaim_blist_remove_account(GaimAccount *account)
 {
 	struct gaim_blist_ui_ops *ops = gaimbuddylist->ui_ops;
 	GaimBlistNode *group, *buddy;
@@ -834,7 +834,7 @@
 	}
 }
 
-void parse_toc_buddy_list(struct gaim_account *account, char *config)
+void parse_toc_buddy_list(GaimAccount *account, char *config)
 {
 	char *c;
 	char current[256];
@@ -899,17 +899,17 @@
 			} else if (*c == 'd') {
 				gaim_privacy_deny_add(account, c + 2);
 			} else if (!strncmp("toc", c, 3)) {
-				sscanf(c + strlen(c) - 1, "%d", &account->permdeny);
+				sscanf(c + strlen(c) - 1, "%d", &account->perm_deny);
 				gaim_debug(GAIM_DEBUG_MISC, "toc blist",
-						   "permdeny: %d\n", account->permdeny);
-				if (account->permdeny == 0)
-					account->permdeny = 1;
+						   "permdeny: %d\n", account->perm_deny);
+				if (account->perm_deny == 0)
+					account->perm_deny = 1;
 			} else if (*c == 'm') {
-				sscanf(c + 2, "%d", &account->permdeny);
+				sscanf(c + 2, "%d", &account->perm_deny);
 				gaim_debug(GAIM_DEBUG_MISC, "toc blist",
-						   "permdeny: %d\n", account->permdeny);
-				if (account->permdeny == 0)
-					account->permdeny = 1;
+						   "permdeny: %d\n", account->perm_deny);
+				if (account->perm_deny == 0)
+					account->perm_deny = 1;
 			}
 		} while ((c = strtok(NULL, "\n")));
 
@@ -1105,7 +1105,7 @@
 static gboolean gaim_blist_read(const char *filename);
 
 
-static void do_import(struct gaim_account *account, const char *filename)
+static void do_import(GaimAccount *account, const char *filename)
 {
 	GString *buf = NULL;
 	char first[64];
@@ -1198,7 +1198,7 @@
 	}
 }
 
-gboolean gaim_group_on_account(struct group *g, struct gaim_account *account) {
+gboolean gaim_group_on_account(struct group *g, GaimAccount *account) {
 	GaimBlistNode *bnode;
 	for(bnode = g->node.child; bnode; bnode = bnode->next) {
 		struct buddy *b = (struct buddy *)bnode;
@@ -1358,7 +1358,7 @@
 		tag_stack = g_list_delete_link(tag_stack, tag_stack);
 		blist_parser_group_settings = NULL;
 	} else if(!strcmp(element_name, "chat")) {
-		struct gaim_account *account = gaim_account_find(blist_parser_account_name,
+		GaimAccount *account = gaim_account_find(blist_parser_account_name,
 				blist_parser_account_protocol);
 		if(account) {
 			struct chat *chat = gaim_chat_new(account, blist_parser_chat_alias, blist_parser_chat_components);
@@ -1376,7 +1376,7 @@
 		blist_parser_person_name = NULL;
 		tag_stack = g_list_delete_link(tag_stack, tag_stack);
 	} else if(!strcmp(element_name, "buddy")) {
-		struct gaim_account *account = gaim_account_find(blist_parser_account_name,
+		GaimAccount *account = gaim_account_find(blist_parser_account_name,
 				blist_parser_account_protocol);
 		if(account) {
 			struct buddy *b = gaim_buddy_new(account, blist_parser_buddy_name, blist_parser_buddy_alias);
@@ -1441,16 +1441,16 @@
 	} else if(!strcmp(element_name, "privacy")) {
 		tag_stack = g_list_delete_link(tag_stack, tag_stack);
 	} else if(!strcmp(element_name, "account")) {
-		struct gaim_account *account = gaim_account_find(blist_parser_account_name,
+		GaimAccount *account = gaim_account_find(blist_parser_account_name,
 				blist_parser_account_protocol);
 		if(account) {
-			account->permdeny = blist_parser_privacy_mode;
+			account->perm_deny = blist_parser_privacy_mode;
 		}
 		g_free(blist_parser_account_name);
 		blist_parser_account_name = NULL;
 		tag_stack = g_list_delete_link(tag_stack, tag_stack);
 	} else if(!strcmp(element_name, "permit")) {
-		struct gaim_account *account = gaim_account_find(blist_parser_account_name,
+		GaimAccount *account = gaim_account_find(blist_parser_account_name,
 				blist_parser_account_protocol);
 		if(account) {
 			gaim_privacy_permit_add(account, blist_parser_buddy_name);
@@ -1459,7 +1459,7 @@
 		blist_parser_buddy_name = NULL;
 		tag_stack = g_list_delete_link(tag_stack, tag_stack);
 	} else if(!strcmp(element_name, "block")) {
-		struct gaim_account *account = gaim_account_find(blist_parser_account_name,
+		GaimAccount *account = gaim_account_find(blist_parser_account_name,
 				blist_parser_account_protocol);
 		if(account) {
 			gaim_privacy_deny_add(account, blist_parser_buddy_name);
@@ -1658,7 +1658,7 @@
 	g_free(data_val);
 }
 
-static void gaim_blist_write(FILE *file, struct gaim_account *exp_acct) {
+static void gaim_blist_write(FILE *file, GaimAccount *exp_acct) {
 	GSList *accounts, *buds;
 	GaimBlistNode *gnode,*bnode;
 	struct group *group;
@@ -1728,11 +1728,11 @@
 	fprintf(file, "\t<privacy>\n");
 
 	for(accounts = gaim_accounts; accounts; accounts = accounts->next) {
-		struct gaim_account *account = accounts->data;
+		GaimAccount *account = accounts->data;
 		char *acct_name = g_markup_escape_text(account->username, -1);
 		if(!exp_acct || account == exp_acct) {
 			fprintf(file, "\t\t<account protocol=\"%d\" name=\"%s\" "
-					"mode=\"%d\">\n", account->protocol, acct_name, account->permdeny);
+					"mode=\"%d\">\n", account->protocol, acct_name, account->perm_deny);
 			for(buds = account->permit; buds; buds = buds->next) {
 				char *bud_name = g_markup_escape_text(buds->data, -1);
 				fprintf(file, "\t\t\t<permit>%s</permit>\n", bud_name);
@@ -1794,7 +1794,7 @@
 	g_free(filename_real);
 }
 
-gboolean gaim_privacy_permit_add(struct gaim_account *account, const char *who) {
+gboolean gaim_privacy_permit_add(GaimAccount *account, const char *who) {
 	GSList *d = account->permit;
 	char *n = g_strdup(normalize(who));
 	while(d) {
@@ -1811,7 +1811,7 @@
 	return FALSE;
 }
 
-gboolean gaim_privacy_permit_remove(struct gaim_account *account, const char *who) {
+gboolean gaim_privacy_permit_remove(GaimAccount *account, const char *who) {
 	GSList *d = account->permit;
 	char *n = g_strdup(normalize(who));
 	while(d) {
@@ -1828,7 +1828,7 @@
 	return FALSE;
 }
 
-gboolean gaim_privacy_deny_add(struct gaim_account *account, const char *who) {
+gboolean gaim_privacy_deny_add(GaimAccount *account, const char *who) {
 	GSList *d = account->deny;
 	char *n = g_strdup(normalize(who));
 	while(d) {
@@ -1845,7 +1845,7 @@
 	return FALSE;
 }
 
-gboolean gaim_privacy_deny_remove(struct gaim_account *account, const char *who) {
+gboolean gaim_privacy_deny_remove(GaimAccount *account, const char *who) {
 	GSList *d = account->deny;
 	char *n = g_strdup(normalize(who));
 	while(d) {
--- a/src/blist.h	Fri May 30 04:13:58 2003 +0000
+++ b/src/blist.h	Fri May 30 09:38:29 2003 +0000
@@ -85,7 +85,7 @@
 	int idle;                               /**< The time the buddy has been idle in minutes. */
 	int uc;                                 /**< This is a cryptic bitmask that makes sense only to the prpl.  This will get changed */
 	void *proto_data;                       /**< This allows the prpl to associate whatever data it wants with a buddy */
-	struct gaim_account *account;           /**< the account this buddy belongs to */ 
+	GaimAccount *account;           /**< the account this buddy belongs to */ 
 	GHashTable *settings;                   /**< per-buddy settings from the XML buddy list, set by plugins and the likes. */
 	guint timer;							/**< The timer handle. */
 };
@@ -110,7 +110,7 @@
 	GaimBlistNode node;      /**< The node that this chat inherits from */
 	char *alias;             /**< The display name of this chat. */
 	GHashTable *components;  /**< the stuff the protocol needs to know to join the chat */
-	struct gaim_account *account; /**< The account this chat is attached to */
+	GaimAccount *account; /**< The account this chat is attached to */
 };
 
 
@@ -276,7 +276,7 @@
  * @param components The info the prpl needs to join the chat
  * @return           A newly allocated chat
  */
-struct chat *gaim_chat_new(struct gaim_account *account, const char *alias, GHashTable *components);
+struct chat *gaim_chat_new(GaimAccount *account, const char *alias, GHashTable *components);
 
 /**
  * Adds a new chat to the buddy list.
@@ -299,7 +299,7 @@
  * @param alias      The alias of the new buddy (or NULL if unaliased)
  * @return           A newly allocated buddy
  */
-struct buddy *gaim_buddy_new(struct gaim_account *account, const char *screenname, const char *alias);
+struct buddy *gaim_buddy_new(GaimAccount *account, const char *screenname, const char *alias);
 
 /**
  * Adds a new buddy to the buddy list.
@@ -382,7 +382,7 @@
  * @param account The account this buddy belongs to
  * @return        The buddy or NULL if the buddy does not exist
  */
-struct buddy *gaim_find_buddy(struct gaim_account *account, const char *name);   
+struct buddy *gaim_find_buddy(GaimAccount *account, const char *name);   
 
 /**
  * Finds a group by name
@@ -415,7 +415,7 @@
  * @param g       The group to search through.
  * @param account The account.
  */
-gboolean gaim_group_on_account(struct group *g, struct gaim_account *account);
+gboolean gaim_group_on_account(struct group *g, GaimAccount *account);
 
 /**
  * Called when an account gets signed on.  Tells the UI to update all the
@@ -423,7 +423,7 @@
  *
  * @param account   The account
  */
-void gaim_blist_add_account(struct gaim_account *account);
+void gaim_blist_add_account(GaimAccount *account);
 
 
 /**
@@ -432,7 +432,7 @@
  *
  * @param account   The account 
  */
-void gaim_blist_remove_account(struct gaim_account *account);
+void gaim_blist_remove_account(GaimAccount *account);
 
 
 /**
@@ -470,7 +470,7 @@
  * @param account  This is the account that the buddies and groups from config will get added to
  * @param config   This is the toc-style buddy list data
  */
-void parse_toc_buddy_list(struct gaim_account *account, char *config);
+void parse_toc_buddy_list(GaimAccount *account, char *config);
 
 
 /**
--- a/src/buddy_chat.c	Fri May 30 04:13:58 2003 +0000
+++ b/src/buddy_chat.c	Fri May 30 09:38:29 2003 +0000
@@ -41,7 +41,7 @@
 static GList *chatentries = NULL;
 static GtkWidget *joinchat = NULL;
 static GtkWidget *jc_vbox = NULL;
-static struct gaim_connection *joinchatgc;
+static GaimConnection *joinchatgc;
 
 static void
 do_join_chat()
@@ -157,7 +157,7 @@
 }
 
 static void
-joinchat_choose(GtkWidget *w, struct gaim_connection *g)
+joinchat_choose(GtkWidget *w, GaimConnection *g)
 {
 	if (joinchatgc == g)
 		return;
@@ -173,11 +173,12 @@
 static void
 create_joinchat_menu(GtkWidget *box)
 {
+	GaimAccount *account;
 	GtkWidget *optmenu;
 	GtkWidget *menu;
 	GtkWidget *opt;
-	GSList *c;
-	struct gaim_connection *g;
+	GList *c;
+	GaimConnection *g;
 	char buf[2048];
 
 	optmenu = gtk_option_menu_new();
@@ -186,8 +187,8 @@
 	menu = gtk_menu_new();
 	joinchatgc = NULL;
 
-	for (c = connections; c != NULL; c = c->next) {
-		g = (struct gaim_connection *)c->data;
+	for (c = gaim_connections_get_all(); c != NULL; c = c->next) {
+		g = (GaimConnection *)c->data;
 
 		if (!GAIM_PLUGIN_PROTOCOL_INFO(g->prpl)->join_chat)
 			continue;
@@ -195,8 +196,10 @@
 		if (!joinchatgc)
 			joinchatgc = g;
 
+		account = gaim_connection_get_account(g);
+
 		g_snprintf(buf, sizeof(buf), "%s (%s)",
-				   g->username, g->prpl->info->name);
+				   gaim_account_get_username(account), g->prpl->info->name);
 		opt = gtk_menu_item_new_with_label(buf);
 
 		g_object_set_data(G_OBJECT(opt), "gaim_connection", g);
@@ -233,10 +236,10 @@
 	GtkWidget *cancel;
 	GtkWidget *label;
 	GtkWidget *sep;
-	GSList *c;
-	struct gaim_connection *gc = NULL;
+	GList *c;
+	GaimConnection *gc = NULL;
 
-	for (c = connections; c != NULL; c = c->next) {
+	for (c = gaim_connections_get_all(); c != NULL; c = c->next) {
 		gc = c->data;
 
 		if (GAIM_PLUGIN_PROTOCOL_INFO(gc->prpl)->join_chat)
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/connection.c	Fri May 30 09:38:29 2003 +0000
@@ -0,0 +1,323 @@
+/**
+ * @file connection.c Connection API
+ * @ingroup core
+ *
+ * gaim
+ *
+ * Copyright (C) 2003 Christian Hammond <chipx86@gnupdate.org>
+ * 
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ */
+#include "connection.h"
+
+static GList *connections = NULL;
+static GaimConnectionUiOps *connection_ui_ops = NULL;
+
+GaimConnection *
+gaim_connection_new(GaimAccount *account)
+{
+	GaimConnection *gc;
+
+	g_return_val_if_fail(account != NULL, NULL);
+
+	gc = g_new0(GaimConnection, 1);
+
+	gc->prpl = gaim_find_prpl(gaim_account_get_protocol(account));
+
+	gaim_connection_set_account(gc, account);
+	gaim_account_set_connection(account, gc);
+
+	connections = g_list_append(connections, gc);
+
+	return gc;
+}
+
+void
+gaim_connection_destroy(GaimConnection *gc)
+{
+	g_return_if_fail(gc != NULL);
+
+	if (gaim_connection_get_state(gc) != GAIM_DISCONNECTED) {
+		gaim_connection_disconnect(gc);
+
+		return;
+	}
+
+	if (gc->display_name != NULL)
+		g_free(gc->display_name);
+
+	if (gc->away != NULL)
+		g_free(gc->away);
+
+	if (gc->away_state != NULL)
+		g_free(gc->away_state);
+
+	connections = g_list_remove(connections, gc);
+
+	g_free(gc);
+}
+
+void
+gaim_connection_connect(GaimConnection *gc)
+{
+	GaimAccount *account;
+	GaimConnectionUiOps *ops;
+	GaimPluginProtocolInfo *prpl_info = NULL;
+
+	g_return_if_fail(gc != NULL);
+
+	ops = gaim_get_connection_ui_ops();
+
+	prpl_info = GAIM_PLUGIN_PROTOCOL_INFO(gc->prpl);
+
+	account = gaim_connection_get_account(gc);
+
+	if ((prpl_info->options & OPT_PROTO_NO_PASSWORD) &&
+		!(prpl_info->options & OPT_PROTO_PASSWORD_OPTIONAL) &&
+		gaim_account_get_password(account) == NULL) {
+
+		if (ops != NULL && ops->request_pass != NULL)
+			ops->request_pass(gc);
+
+		return;
+	}
+
+	gaim_connection_set_state(gc, GAIM_CONNECTING);
+
+	serv_login(account);
+}
+
+void
+gaim_connection_disconnect(GaimConnection *gc)
+{
+	GList *wins;
+
+	g_return_if_fail(gc != NULL);
+	g_return_if_fail(gaim_connection_get_state(gc) != GAIM_DISCONNECTED);
+
+	if (gaim_connection_get_state(gc) != GAIM_CONNECTING)
+		gaim_blist_remove_account(gaim_connection_get_account(gc));
+
+	gaim_event_broadcast(event_signoff, gc);
+	system_log(log_signoff, gc, NULL, OPT_LOG_BUDDY_SIGNON | OPT_LOG_MY_SIGNON);
+
+	serv_close(gc);
+
+	gaim_connection_set_state(gc, GAIM_DISCONNECTED);
+
+	/* XXX Evil UI stuff!! */
+	do_away_menu();
+	do_proto_menu();
+
+	/*
+	 * XXX This is a hack! Remove this and replace it with a better event
+	 *     notification system.
+	 */
+	for (wins = gaim_get_windows(); wins != NULL; wins = wins->next) {
+		struct gaim_window *win = (struct gaim_window *)wins->data;
+		gaim_conversation_update(gaim_window_get_conversation_at(win, 0),
+								 GAIM_CONV_ACCOUNT_OFFLINE);
+	}
+
+	gaim_request_close_with_handle(gc);
+	gaim_notify_close_with_handle(gc);
+
+	update_privacy_connections();
+
+	/* XXX More UI stuff! */
+	if (connections != NULL)
+		return;
+
+	destroy_all_dialogs();
+	gaim_blist_destroy();
+
+	show_login();
+}
+
+/*
+ * d:)->-< 
+ *
+ * d:O-\-<
+ * 
+ * d:D-/-<
+ *
+ * d8D->-< DANCE!
+ */
+
+void
+gaim_connection_set_state(GaimConnection *gc, GaimConnectionState state)
+{
+	g_return_if_fail(gc != NULL);
+
+	gc->state = state;
+
+	if (gc->state == GAIM_CONNECTED) {
+		GaimConnectionUiOps *ops = gaim_get_connection_ui_ops();
+		GaimBlistNode *gnode,*bnode;
+		GList *wins;
+		GList *add_buds=NULL;
+
+		/* Set the time the account came online */
+		time(&gc->login_time);
+
+		if (ops != NULL && ops->connected != NULL)
+			ops->connected(gc);
+
+		gaim_blist_show();
+		gaim_blist_add_account(gc->account);
+
+		/* I hate this. -- ChipX86 */
+		gaim_setup(gc);
+
+		/*
+		 * XXX This is a hack! Remove this and replace it with a better event
+		 *     notification system.
+		 */
+		for (wins = gaim_get_windows(); wins != NULL; wins = wins->next) {
+			struct gaim_window *win = (struct gaim_window *)wins->data;
+			gaim_conversation_update(gaim_window_get_conversation_at(win, 0),
+									 GAIM_CONV_ACCOUNT_ONLINE);
+		}
+
+		gaim_event_broadcast(event_signon, gc);
+		system_log(log_signon, gc, NULL,
+				   OPT_LOG_BUDDY_SIGNON | OPT_LOG_MY_SIGNON);
+
+#if 0
+		/* away option given? */
+		if (opt_away) {
+			away_on_login(opt_away_arg);
+			/* don't do it again */
+			opt_away = 0;
+		} else if (awaymessage) {
+			serv_set_away(gc, GAIM_AWAY_CUSTOM, awaymessage->message);
+		}
+		if (opt_away_arg != NULL) {
+			g_free(opt_away_arg);
+			opt_away_arg = NULL;
+		}
+#endif
+
+		/* let the prpl know what buddies we pulled out of the local list */
+		for (gnode = gaim_get_blist()->root; gnode; gnode = gnode->next) {
+			if(!GAIM_BLIST_NODE_IS_GROUP(gnode))
+				continue;
+			for(bnode = gnode->child; bnode; bnode = bnode->next) {
+				if(GAIM_BLIST_NODE_IS_BUDDY(bnode)) {
+					struct buddy *b = (struct buddy *)bnode;
+					if(b->account == gc->account) {
+						add_buds = g_list_append(add_buds, b->name);
+					}
+				}
+			}
+		}
+
+		if(add_buds) {
+			serv_add_buddies(gc, add_buds);
+			g_list_free(add_buds);
+		}
+
+		serv_set_permit_deny(gc);
+	}
+}
+
+void
+gaim_connection_set_account(GaimConnection *gc, GaimAccount *account)
+{
+	g_return_if_fail(gc != NULL);
+	g_return_if_fail(account != NULL);
+
+	gc->account = account;
+}
+
+void
+gaim_connection_set_display_name(GaimConnection *gc, const char *name)
+{
+	g_return_if_fail(gc != NULL);
+
+	if (gc->display_name != NULL)
+		g_free(gc->display_name);
+
+	gc->display_name = (name == NULL ? NULL : g_strdup(name));
+}
+
+GaimConnectionState
+gaim_connection_get_state(const GaimConnection *gc)
+{
+	g_return_val_if_fail(gc != NULL, GAIM_DISCONNECTED);
+
+	return gc->state;
+}
+
+GaimAccount *
+gaim_connection_get_account(const GaimConnection *gc)
+{
+	g_return_val_if_fail(gc != NULL, NULL);
+
+	return gc->account;
+}
+
+const char *
+gaim_connection_get_display_name(const GaimConnection *gc)
+{
+	g_return_val_if_fail(gc != NULL, NULL);
+
+	return gc->display_name;
+}
+
+void
+gaim_connection_update_progress(GaimConnection *gc, const char *text,
+								size_t step, size_t count)
+{
+	GaimConnectionUiOps *ops;
+
+	g_return_if_fail(gc   != NULL);
+	g_return_if_fail(text != NULL);
+	g_return_if_fail(step < count);
+	g_return_if_fail(count > 1);
+
+	ops = gaim_get_connection_ui_ops();
+
+	if (ops != NULL && ops->connect_progress != NULL)
+		ops->connect_progress(gc, text, step, count);
+}
+
+void
+gaim_connections_disconnect_all(void)
+{
+	GList *l;
+
+	for (l = gaim_connections_get_all(); l != NULL; l = l->next)
+		gaim_connection_destroy(l->data);
+}
+
+GList *
+gaim_connections_get_all(void)
+{
+	return connections;
+}
+
+void
+gaim_set_connection_ui_ops(GaimConnectionUiOps *ops)
+{
+	connection_ui_ops = ops;
+}
+
+GaimConnectionUiOps *
+gaim_get_connection_ui_ops(void)
+{
+	return connection_ui_ops;
+}
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/connection.h	Fri May 30 09:38:29 2003 +0000
@@ -0,0 +1,213 @@
+/**
+ * @file connection.h Connection API
+ * @ingroup core
+ *
+ * gaim
+ *
+ * Copyright (C) 2003 Christian Hammond <chipx86@gnupdate.org>
+ * 
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ */
+#ifndef _GAIM_CONNECTION_H_
+#define _GAIM_CONNECTION_H_
+
+#include <stdlib.h>
+
+typedef struct _GaimConnection GaimConnection;
+
+#include "account.h"
+#include "plugin.h"
+#include "multi.h"
+
+typedef enum
+{
+	GAIM_DISCONNECTED = 0, /**< Disconnected. */
+	GAIM_CONNECTED,        /**< Connected.    */
+	GAIM_CONNECTING        /**< Connecting.   */
+
+} GaimConnectionState;
+
+typedef struct
+{
+	void (*connect_progress)(GaimConnection *gc, const char *text,
+							 size_t step, size_t step_count);
+	void (*connected)(GaimConnection *gc);
+	void (*request_pass)(GaimConnection *gc);
+	void (*disconnected)(GaimConnection *gc, const char *reason);
+
+} GaimConnectionUiOps;
+
+struct _GaimConnection
+{
+	GaimPlugin *prpl;            /**< The protocol plugin.               */
+	guint32 flags;               /**< Connection flags.                  */
+
+	GaimConnectionState state;   /**< The connection state.              */
+
+	GaimAccount *account;        /**< The account being connected to.    */
+	int inpa;                    /**< The input watcher.                 */
+
+	GSList *buddy_chats;         /**< A list of active chats.            */
+	void *proto_data;            /**< Protocol-specific data.            */
+
+	char *display_name;          /**< The name displayed.                */
+	guint keep_alive;            /**< Keep-alive.                        */
+
+	guint idle_timer;            /**< The idle timer.                    */
+	time_t login_time;           /**< Time of login.                     */
+	time_t login_time_official;  /**< Official time of login.            */
+	time_t last_sent_time;       /**< The time something was last sent.  */
+	int is_idle;                 /**< Idle state of the connection.      */
+
+	char *away;                  /**< The current away message, or NULL  */
+	char *away_state;            /**< The last away type.                */
+	gboolean is_auto_away;       /**< Whether or not it's auto-away.     */
+
+	int evil;                    /**< Warning level for AIM (why is
+	                                  this here?)                        */
+
+	gboolean wants_to_die;	     /**< Wants to Die state.                */
+};
+
+/**
+ * Creates a connection to the specified account.
+ *
+ * @param account The account the connection should be connecting to.
+ *
+ * @return The gaim connection.
+ */
+GaimConnection *gaim_connection_new(GaimAccount *account);
+
+/**
+ * Destroys and closes a gaim connection.
+ *
+ * @param gc The gaim connection to destroy.
+ */
+void gaim_connection_destroy(GaimConnection *gc);
+
+/**
+ * Signs a connection on.
+ *
+ * @param gc The connection to sign on.
+ *
+ * @see gaim_connection_disconnect()
+ */
+void gaim_connection_connect(GaimConnection *gc);
+
+/**
+ * Signs a connection off.
+ *
+ * @param gc The connection to sign off.
+ *
+ * @see gaim_connection_connect()
+ */
+void gaim_connection_disconnect(GaimConnection *gc);
+
+/**
+ * Sets the connection state.
+ *
+ * @param gc    The connection.
+ * @param state The connection state.
+ */
+void gaim_connection_set_state(GaimConnection *gc, GaimConnectionState state);
+
+/**
+ * Sets the connection's account.
+ *
+ * @param gc      The connection.
+ * @param account The account.
+ */
+void gaim_connection_set_account(GaimConnection *gc, GaimAccount *account);
+
+/**
+ * Sets the connection's displayed name.
+ *
+ * @param gc   The connection.
+ * @param name The displayed name.
+ */
+void gaim_connection_set_display_name(GaimConnection *gc, const char *name);
+
+/**
+ * Returns the connection state.
+ *
+ * @param gc The connection.
+ *
+ * @return The connection state.
+ */
+GaimConnectionState gaim_connection_get_state(const GaimConnection *gc);
+
+/**
+ * Returns the connection's account.
+ *
+ * @param gc The connection.
+ *
+ * @return The connection's account.
+ */
+GaimAccount *gaim_connection_get_account(const GaimConnection *gc);
+
+/**
+ * Returns the connection's displayed name.
+ *
+ * @param gc The connection.
+ *
+ * @return The connection's displayed name.
+ */
+const char *gaim_connection_get_display_name(const GaimConnection *gc);
+
+/**
+ * Updates the connection progress.
+ *
+ * @param gc    The connection.
+ * @param text  Information on the current step.
+ * @param step  The current step.
+ * @param count The total number of steps.
+ */
+void gaim_connection_update_progress(GaimConnection *gc, const char *text,
+									 size_t step, size_t count);
+
+/**
+ * Disconnects from all connections.
+ */
+void gaim_connections_disconnect_all(void);
+
+/**
+ * Returns a list of all active connections.
+ *
+ * @return A list of all active connections.
+ */
+GList *gaim_connections_get_all(void);
+
+/**************************************************************************/
+/** @name UI Operations API                                               */
+/**************************************************************************/
+/*@{*/
+
+/**
+ * Sets the UI operations structure to be used for connections.
+ *
+ * @param ops The UI operations structure.
+ */
+void gaim_set_connection_ui_ops(GaimConnectionUiOps *ops);
+
+/**
+ * Returns the UI operations structure used for connections.
+ *
+ * @return The UI operations structure in use.
+ */
+GaimConnectionUiOps *gaim_get_connection_ui_ops(void);
+
+/*@}*/
+
+#endif /* _GAIM_CONNECTION_H_ */
--- a/src/conversation.c	Fri May 30 04:13:58 2003 +0000
+++ b/src/conversation.c	Fri May 30 09:38:29 2003 +0000
@@ -85,14 +85,17 @@
 }
 
 static gboolean
-find_nick(struct gaim_connection *gc, const char *message)
+find_nick(GaimConnection *gc, const char *message)
 {
+	GaimAccount *account;
 	char *msg, *who, *p;
 	int n;
 
+	account = gaim_connection_get_account(gc);
+
 	msg = g_utf8_strdown(message, -1);
 
-	who = g_utf8_strdown(gc->username, -1);
+	who = g_utf8_strdown(gaim_account_get_username(account), -1);
 	n = strlen(who);
 
 	if ((p = strstr(msg, who)) != NULL) {
@@ -106,13 +109,14 @@
 
 	g_free(who);
 
-	if (!gaim_utf8_strcasecmp(gc->username, gc->displayname)) {
+	if (!gaim_utf8_strcasecmp(gaim_account_get_username(account),
+							  gaim_connection_get_display_name(gc))) {
 		g_free(msg);
 
 		return FALSE;
 	}
 
-	who = g_utf8_strdown(gc->displayname, -1);
+	who = g_utf8_strdown(gaim_connection_get_display_name(gc), -1);
 	n = strlen(who);
 
 	if (n > 0 && (p = strstr(msg, who)) != NULL) {
@@ -153,7 +157,7 @@
 send_typed(gpointer data)
 {
 	struct gaim_conversation *conv = (struct gaim_conversation *)data;
-	struct gaim_connection *gc;
+	GaimConnection *gc;
 	const char *name;
 
 	gc   = gaim_conversation_get_gc(conv);
@@ -175,7 +179,7 @@
 common_send(struct gaim_conversation *conv, const char *message)
 {
 	GaimConversationType type;
-	struct gaim_connection *gc;
+	GaimConnection *gc;
 	struct gaim_conversation_ui_ops *ops;
 	char *buf, *buf2, *buffy = NULL;
 	gulong length = 0;
@@ -857,7 +861,7 @@
  * Conversation API
  **************************************************************************/
 struct gaim_conversation *
-gaim_conversation_new(GaimConversationType type, struct gaim_account *account,
+gaim_conversation_new(GaimConversationType type, GaimAccount *account,
 					  const char *name)
 {
 	struct gaim_conversation *conv;
@@ -939,7 +943,7 @@
 	GaimPluginProtocolInfo *prpl_info = NULL;
 	struct gaim_window *win;
 	struct gaim_conversation_ui_ops *ops;
-	struct gaim_connection *gc;
+	GaimConnection *gc;
 	const char *name;
 	GList *node;
 
@@ -1099,7 +1103,7 @@
 
 void
 gaim_conversation_set_account(struct gaim_conversation *conv,
-						   struct gaim_account *account)
+						   GaimAccount *account)
 {
 	if (conv == NULL || account == gaim_conversation_get_account(conv))
 		return;
@@ -1109,7 +1113,7 @@
 	gaim_conversation_update(conv, GAIM_CONV_UPDATE_ACCOUNT);
 }
 
-struct gaim_account *
+GaimAccount *
 gaim_conversation_get_account(const struct gaim_conversation *conv)
 {
 	if (conv == NULL)
@@ -1118,10 +1122,10 @@
 	return conv->account;
 }
 
-struct gaim_connection *
+GaimConnection *
 gaim_conversation_get_gc(const struct gaim_conversation *conv)
 {
-	struct gaim_account *account;
+	GaimAccount *account;
 
 	if (conv == NULL)
 		return NULL;
@@ -1165,7 +1169,7 @@
 void
 gaim_conversation_autoset_title(struct gaim_conversation *conv)
 {
-	struct gaim_account *account;
+	GaimAccount *account;
 	struct buddy *b;
 	const char *text, *name;
 
@@ -1386,7 +1390,7 @@
 }
 
 struct gaim_conversation *
-gaim_find_conversation_with_account(const char *name, const struct gaim_account *account)
+gaim_find_conversation_with_account(const char *name, const GaimAccount *account)
 {
 	struct gaim_conversation *c = NULL;
 	char *cuser;
@@ -1420,7 +1424,8 @@
 						time_t mtime)
 {
 	GaimPluginProtocolInfo *prpl_info = NULL;
-	struct gaim_account *account;
+	GaimConnection *gc;
+	GaimAccount *account;
 	struct gaim_conversation_ui_ops *ops;
 	struct gaim_window *win;
 	struct buddy *b;
@@ -1436,6 +1441,7 @@
 		return;
 
 	account = gaim_conversation_get_account(conv);
+	gc      = gaim_account_get_connection(account);
 
 	if (gaim_conversation_get_type(conv) == GAIM_CONV_CHAT &&
 		(account->gc == NULL || !g_slist_find(account->gc->buddy_chats, conv)))
@@ -1453,15 +1459,17 @@
 
 			if (who == NULL) {
 				if (flags & WFLAG_SEND) {
-					b = gaim_find_buddy(account, account->gc->username);
+					b = gaim_find_buddy(account,
+										gaim_account_get_username(account));
+
 					if (b != NULL && strcmp(b->name, gaim_get_buddy_alias(b)))
 						who = gaim_get_buddy_alias(b);
-					else if (*account->alias)
+					else if (gaim_account_get_alias(account) != NULL)
 						who = account->alias;
-					else if (*account->gc->displayname)
-						who = account->gc->displayname;
+					else if (gaim_connection_get_display_name(gc) != NULL)
+						who = gaim_connection_get_display_name(gc);
 					else
-						who = account->gc->username;
+						who = gaim_account_get_username(account);
 				}
 				else {
 					b = gaim_find_buddy(account,
@@ -1878,14 +1886,16 @@
 gaim_chat_write(struct gaim_chat *chat, const char *who,
 				const char *message, int flags, time_t mtime)
 {
+	GaimAccount *account;
 	struct gaim_conversation *conv;
-	struct gaim_connection *gc;
+	GaimConnection *gc;
 
 	if (chat == NULL || who == NULL || message == NULL)
 		return;
 
-	conv = gaim_chat_get_conversation(chat);
-	gc   = gaim_conversation_get_gc(conv);
+	conv    = gaim_chat_get_conversation(chat);
+	gc      = gaim_conversation_get_gc(conv);
+	account = gaim_connection_get_account(gc);
 
 	/* Don't display this if the person who wrote it is ignored. */
 	if (gaim_chat_is_user_ignored(chat, who))
@@ -1896,8 +1906,8 @@
 
 		str = g_strdup(normalize(who));
 
-		if (!gaim_utf8_strcasecmp(str, normalize(gc->username)) ||
-			!gaim_utf8_strcasecmp(str, normalize(gc->displayname))) {
+		if (!gaim_utf8_strcasecmp(str, normalize(gaim_account_get_username(account))) ||
+			!gaim_utf8_strcasecmp(str, normalize(gaim_connection_get_display_name(gc)))) {
 
 			flags |= WFLAG_SEND;
 		}
@@ -2058,7 +2068,7 @@
 }
 
 struct gaim_conversation *
-gaim_find_chat(struct gaim_connection *gc, int id)
+gaim_find_chat(GaimConnection *gc, int id)
 {
 	GList *l;
 	struct gaim_conversation *conv;
@@ -2183,7 +2193,7 @@
 {
 	GaimConversationType type;
 	GList *wins, *convs;
-	struct gaim_account *account;
+	GaimAccount *account;
 
 
 	account = gaim_conversation_get_account(conv);
--- a/src/conversation.h	Fri May 30 04:13:58 2003 +0000
+++ b/src/conversation.h	Fri May 30 09:38:29 2003 +0000
@@ -197,7 +197,7 @@
 {
 	GaimConversationType type;  /**< The type of conversation.          */
 
-	struct gaim_account *account;  /**< The user using this conversation.  */
+	GaimAccount *account;  /**< The user using this conversation.  */
 	struct gaim_window *window; /**< The parent window.                 */
 
 	int conversation_pos;       /**< The position in the window's list. */
@@ -428,7 +428,7 @@
  * @return The new conversation.
  */
 struct gaim_conversation *gaim_conversation_new(GaimConversationType type,
-												struct gaim_account *account,
+												GaimAccount *account,
 												const char *name);
 
 /**
@@ -481,7 +481,7 @@
  * @param account The gaim_account.
  */
 void gaim_conversation_set_account(struct gaim_conversation *conv,
-								struct gaim_account *account);
+								GaimAccount *account);
 
 /**
  * Returns the specified conversation's gaim_account.
@@ -493,7 +493,7 @@
  *
  * @return The conversation's gaim_account.
  */
-struct gaim_account *gaim_conversation_get_account(
+GaimAccount *gaim_conversation_get_account(
 		const struct gaim_conversation *conv);
 
 /**
@@ -505,7 +505,7 @@
  *
  * @return The conversation's gaim_connection.
  */
-struct gaim_connection *gaim_conversation_get_gc(
+GaimConnection *gaim_conversation_get_gc(
 		const struct gaim_conversation *conv);
 
 /**
@@ -716,7 +716,7 @@
  * @return The conversation if found, or @c NULL otherwise.
  */
 struct gaim_conversation *gaim_find_conversation_with_account(
-		const char *name, const struct gaim_account *account);
+		const char *name, const GaimAccount *account);
 
 /**
  * Writes to a conversation window.
@@ -1094,7 +1094,7 @@
  *
  * @return The chat conversation.
  */
-struct gaim_conversation *gaim_find_chat(struct gaim_connection *gc, int id);
+struct gaim_conversation *gaim_find_chat(GaimConnection *gc, int id);
 
 /*@}*/
 
--- a/src/core.c	Fri May 30 04:13:58 2003 +0000
+++ b/src/core.c	Fri May 30 09:38:29 2003 +0000
@@ -219,7 +219,7 @@
 static void user_handler(struct UI *ui, guchar subtype, guchar *data)
 {
 	guint id;
-	struct gaim_account *account;
+	GaimAccount *account;
 
 	switch (subtype) {
 		/*
@@ -258,7 +258,7 @@
 			return;
 		{
 			guint id;
-			struct gaim_connection *gc;
+			GaimConnection *gc;
 			guint len;
 			char *who, *msg;
 			gint flags;
@@ -266,7 +266,7 @@
 
 			memcpy(&id, data + pos, sizeof(id));
 			pos += sizeof(id);
-			gc = g_slist_nth_data(connections, id);
+			gc = g_list_nth_data(gaim_connections_get_all(), id);
 			if (!gc)
 				return;
 
--- a/src/core.h	Fri May 30 04:13:58 2003 +0000
+++ b/src/core.h	Fri May 30 09:38:29 2003 +0000
@@ -42,7 +42,6 @@
 #include <glib.h>
 #include <gmodule.h>
 
-struct gaim_account;
 struct group;
 struct buddy;
 
@@ -69,7 +68,8 @@
 /* This is far too long to be practical, but MSN users are probably used to long aliases */
 #define SELF_ALIAS_LEN 400
 
-struct gaim_account {
+#if 0
+GaimAccount {
 	char username[64];
 	char alias[SELF_ALIAS_LEN]; 
 	char password[32];
@@ -83,15 +83,15 @@
 	/* buddy icon file */
 	char iconfile[256];
 
-	struct gaim_proxy_info *gpi;
 
-	struct gaim_connection *gc;
+	GaimConnection *gc;
 	gboolean connecting;
 
 	GSList *permit;
 	GSList *deny;
 	int permdeny;
 };
+#endif
 
 /* XXX Temporary, until we have better account-specific prefs. */
 #define GAIM_ACCOUNT_CHECK_MAIL(account) \
@@ -122,16 +122,16 @@
 extern void save_prefs();
 
 /* Functions in server.c */
-extern void serv_got_update(struct gaim_connection *, char *, int, int, time_t, time_t, int);
-extern void serv_got_im(struct gaim_connection *, const char *, const char *, guint32, time_t, gint);
-extern void serv_got_typing(struct gaim_connection *, char *, int, int);
-extern void serv_got_typing_stopped(struct gaim_connection *, char *);
-extern void serv_got_eviled(struct gaim_connection *, char *, int);
-extern void serv_got_chat_invite(struct gaim_connection *, char *, char *, char *, GHashTable *);
-extern struct gaim_conversation *serv_got_joined_chat(struct gaim_connection *, int, char *);
-extern void serv_got_chat_left(struct gaim_connection *, int);
-extern void serv_got_chat_in(struct gaim_connection *, int, char *, int, char *, time_t);
-extern void serv_got_alias(struct gaim_connection *, char *, char *);
+extern void serv_got_update(GaimConnection *, char *, int, int, time_t, time_t, int);
+extern void serv_got_im(GaimConnection *, const char *, const char *, guint32, time_t, gint);
+extern void serv_got_typing(GaimConnection *, char *, int, int);
+extern void serv_got_typing_stopped(GaimConnection *, char *);
+extern void serv_got_eviled(GaimConnection *, char *, int);
+extern void serv_got_chat_invite(GaimConnection *, char *, char *, char *, GHashTable *);
+extern struct gaim_conversation *serv_got_joined_chat(GaimConnection *, int, char *);
+extern void serv_got_chat_left(GaimConnection *, int);
+extern void serv_got_chat_in(GaimConnection *, int, char *, int, char *, time_t);
+extern void serv_got_alias(GaimConnection *, char *, char *);
 extern void serv_finish_login();
 
 #endif /* _CORE_H_ */
--- a/src/dialogs.c	Fri May 30 04:13:58 2003 +0000
+++ b/src/dialogs.c	Fri May 30 09:38:29 2003 +0000
@@ -61,7 +61,7 @@
 static GtkWidget *imdialog = NULL;	/*I only want ONE of these :) */
 static GList *dialogwindows = NULL;
 static GtkWidget *importdialog;
-static struct gaim_connection *importgc;
+static GaimConnection *importgc;
 static GtkWidget *icondlg;
 static GtkWidget *alias_dialog = NULL;
 static GtkWidget *rename_dialog = NULL;
@@ -75,7 +75,7 @@
 	GtkWidget *ok;
 	GtkWidget *cancel;
 	char name[1024];
-	struct gaim_connection *gc;
+	GaimConnection *gc;
 };
 
 struct create_away {
@@ -89,7 +89,7 @@
 	GtkWidget *window;
 	GtkWidget *anon;
 	char *who;
-	struct gaim_connection *gc;
+	GaimConnection *gc;
 };
 
 struct addbuddy {
@@ -98,24 +98,24 @@
 	GtkWidget *entry;
 	GtkWidget *entry_for_alias;
 	GtkWidget *account;
-	struct gaim_connection *gc;
+	GaimConnection *gc;
 };
 
 struct addperm {
 	GtkWidget *window;
 	GtkWidget *entry;
-	struct gaim_connection *gc;
+	GaimConnection *gc;
 	gboolean permit;
 };
 
 struct findbyemail {
 	GtkWidget *window;
 	GtkWidget *emailentry;
-	struct gaim_connection *gc;
+	GaimConnection *gc;
 };
 
 struct findbyinfo {
-	struct gaim_connection *gc;
+	GaimConnection *gc;
 	GtkWidget *window;
 	GtkWidget *firstentry;
 	GtkWidget *middleentry;
@@ -127,7 +127,7 @@
 };
 
 struct info_dlg {
-	struct gaim_connection *gc;
+	GaimConnection *gc;
 	char *who;
 	GtkWidget *window;
 	GtkWidget *text;
@@ -137,7 +137,7 @@
 	GtkWidget *window;
 	GtkWidget *entry;
 	GtkWidget *account;
-	struct gaim_connection *gc; 
+	GaimConnection *gc; 
 };
 
 struct alias_dialog_info
@@ -150,7 +150,7 @@
 
 static GSList *info_dlgs = NULL;
 
-static struct info_dlg *find_info_dlg(struct gaim_connection *gc, const char *who)
+static struct info_dlg *find_info_dlg(GaimConnection *gc, const char *who)
 {
 	GSList *i = info_dlgs;
 	while (i) {
@@ -171,7 +171,7 @@
 struct set_info_dlg {
 	GtkWidget *window;
 	GtkWidget *menu;
-	struct gaim_account *account;
+	GaimAccount *account;
 	GtkWidget *text;
 	GtkWidget *save;
 	GtkWidget *cancel;
@@ -179,14 +179,14 @@
 
 struct set_icon_dlg {
 	GtkWidget *window;
-	struct gaim_account *account;
+	GaimAccount *account;
 	GtkWidget *ok;
 	GtkWidget *cancel;
 	GtkWidget *entry;
 };
 
 struct set_dir_dlg {
-	struct gaim_connection *gc;
+	GaimConnection *gc;
 	GtkWidget *window;
 	GtkWidget *first;
 	GtkWidget *middle;
@@ -218,7 +218,7 @@
 	GtkWidget *original;
 	GtkWidget *new1;
 	GtkWidget *new2;
-	struct gaim_connection *gc;
+	GaimConnection *gc;
 };
 
 struct view_log {
@@ -346,7 +346,7 @@
 	g_free(w);
 }
 
-void show_warn_dialog(struct gaim_connection *gc, char *who)
+void show_warn_dialog(GaimConnection *gc, char *who)
 {
 	char *labeltext;
 	GtkWidget *hbox, *vbox;
@@ -456,7 +456,7 @@
 	gaim_blist_save();
 }
 
-void show_confirm_del(struct gaim_connection *gc, gchar *name)
+void show_confirm_del(GaimConnection *gc, gchar *name)
 {
 	struct buddy *bd = gaim_find_buddy(gc->account, name);
 	char *text;
@@ -502,7 +502,7 @@
 {
 	const char *who;
 	struct gaim_conversation *conv;
-	struct gaim_account *account;
+	GaimAccount *account;
 
 	if (resp == GTK_RESPONSE_OK) {
 		who = gtk_entry_get_text(GTK_ENTRY(info->entry));
@@ -612,7 +612,7 @@
 	gtk_widget_show_all(window);
 }
 
-void show_info_select_account(GObject *w, struct gaim_connection *gc)
+void show_info_select_account(GObject *w, GaimConnection *gc)
 {
 	struct getuserinfo *info = g_object_get_data(w, "getuserinfo");
 	info->gc = gc;
@@ -629,8 +629,9 @@
 	GtkWidget *hbox, *vbox;
 	GtkWidget *label;
 	GtkWidget *table, *menu, *opt;
-	GSList *g = connections;
-	struct gaim_connection *c;
+	GList *g = gaim_connections_get_all();
+	GaimConnection *c;
+	GaimAccount *account;
 	struct gaim_gtk_buddy_list *gtkblist;
 	char buf[256];
 	GtkWidget *img = gtk_image_new_from_stock(GAIM_STOCK_DIALOG_QUESTION, GTK_ICON_SIZE_DIALOG);
@@ -640,7 +641,7 @@
 
 	if (!imdialog) {
 		info = g_new0(struct getuserinfo, 1);
-		info->gc = connections->data;
+		info->gc = gaim_connections_get_all()->data;
 		imdialog = gtk_dialog_new_with_buttons(_("New Message"), gtkblist ? GTK_WINDOW(gtkblist->window) : NULL, 0,
 						       GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL, GTK_STOCK_OK, GTK_RESPONSE_OK, NULL);
 		gtk_dialog_set_default_response (GTK_DIALOG(imdialog), GTK_RESPONSE_OK);
@@ -686,7 +687,7 @@
 		g_signal_connect(G_OBJECT(info->entry), "changed",
 				G_CALLBACK(dialog_set_ok_sensitive), imdialog);
 
-		if (connections->next) {
+		if (gaim_connections_get_all()->next) {
 
 			label = gtk_label_new(NULL);
 			gtk_table_attach_defaults(GTK_TABLE(table), label, 0, 1, 1, 2);
@@ -700,14 +701,18 @@
 			menu = gtk_menu_new();
 
 			while (g) {
-				c = (struct gaim_connection *)g->data;
+				c = (GaimConnection *)g->data;
 
 				if (!GAIM_PLUGIN_PROTOCOL_INFO(c->prpl)->send_im) {
 					g = g->next;
 					continue;
 				}
+
+				account = gaim_connection_get_account(c);
+
 				g_snprintf(buf, sizeof(buf), "%s (%s)",
-						   c->username, c->prpl->info->name);
+						   gaim_account_get_username(account),
+						   c->prpl->info->name);
 				opt = gtk_menu_item_new_with_label(buf);
 				g_object_set_data(G_OBJECT(opt), "getuserinfo", info);
 
@@ -735,15 +740,16 @@
 	GtkWidget *label;
 	GtkWidget *img = gtk_image_new_from_stock(GAIM_STOCK_DIALOG_QUESTION, GTK_ICON_SIZE_DIALOG);
 	GtkWidget *table, *menu, *opt;
-	GSList *g = connections;
-	struct gaim_connection *c;
+	GList *g = gaim_connections_get_all();
+	GaimConnection *c;
+	GaimAccount *account;
 	struct getuserinfo *info = g_new0(struct getuserinfo, 1);
 	struct gaim_gtk_buddy_list *gtkblist;
 	char buf[256];
 
 	gtkblist = GAIM_GTK_BLIST(gaim_get_blist());
 
-	info->gc = connections->data;
+	info->gc = gaim_connections_get_all()->data;
 
 	window = gtk_dialog_new_with_buttons(_("Get User Info"), gtkblist->window ? GTK_WINDOW(gtkblist->window) : NULL, 0, 
 					     GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL, GTK_STOCK_OK, GTK_RESPONSE_OK, NULL);
@@ -788,7 +794,7 @@
 	g_signal_connect(G_OBJECT(info->entry), "changed",
 			G_CALLBACK(dialog_set_ok_sensitive), window);
 	
-	if (connections->next) {
+	if (gaim_connections_get_all()->next) {
 
 		label = gtk_label_new(NULL);
 		gtk_table_attach_defaults(GTK_TABLE(table), label, 0, 1, 1, 2);
@@ -802,14 +808,18 @@
 		menu = gtk_menu_new();
 
 		while (g) {
-			c = (struct gaim_connection *)g->data;
+			c = (GaimConnection *)g->data;
 
 			if (!GAIM_PLUGIN_PROTOCOL_INFO(c->prpl)->get_info) {
 				g = g->next;
 				continue;
 			}
+
+			account = gaim_connection_get_account(c);
+
 			g_snprintf(buf, sizeof(buf), "%s (%s)",
-					   c->username, c->prpl->info->name);
+					   gaim_account_get_username(account),
+					   c->prpl->info->name);
 			opt = gtk_menu_item_new_with_label(buf);
 			g_object_set_data(G_OBJECT(opt), "getuserinfo", info);
 
@@ -889,7 +899,7 @@
 		grp = gtk_entry_get_text(GTK_ENTRY(a->entry));
 
 		if (!a->gc)
-			a->gc = connections->data;
+			a->gc = gaim_connections_get_all()->data;
 
 		g = gaim_group_new(grp);
 		gaim_blist_add_group (g, NULL);
@@ -930,7 +940,7 @@
 }
 
 
-void show_add_group(struct gaim_connection *gc)
+void show_add_group(GaimConnection *gc)
 {
 
 	GtkWidget *hbox, *vbox;
@@ -983,7 +993,7 @@
 	gtk_widget_grab_focus(GTK_WIDGET(a->entry));
 }
 
-static void addbuddy_select_account(GObject *w, struct gaim_connection *gc)
+static void addbuddy_select_account(GObject *w, GaimConnection *gc)
 {
 	struct addbuddy *b = g_object_get_data(w, "addbuddy");
 
@@ -994,8 +1004,9 @@
 static void create_online_user_names(struct addbuddy *b)
 {
 	char buf[2048]; /* Never hurts to be safe ;-) */
-	GSList *g = connections;
-	struct gaim_connection *c;
+	GList *g = gaim_connections_get_all();
+	GaimConnection *c;
+	GaimAccount *account;
 	GtkWidget *menu, *opt;
 	int count = 0;
 	int place = 0;
@@ -1003,9 +1014,13 @@
 	menu = gtk_menu_new();
 
 	while (g) {
-		c = (struct gaim_connection *)g->data;
+		c = (GaimConnection *)g->data;
+
+		account = gaim_connection_get_account(c);
+
 		g_snprintf(buf, sizeof(buf), "%s (%s)", 
-				c->username, c->prpl->info->name);
+				   gaim_account_get_username(account),
+				   c->prpl->info->name);
 		opt = gtk_menu_item_new_with_label(buf);
 		g_object_set_data(G_OBJECT(opt), "addbuddy", b);
 		g_signal_connect(G_OBJECT(opt), "activate",
@@ -1037,7 +1052,7 @@
 
 }
 
-void show_add_buddy(struct gaim_connection *gc, char *buddy, char *group, char *alias)
+void show_add_buddy(GaimConnection *gc, char *buddy, char *group, char *alias)
 {
 	GtkWidget *table;
 	GtkWidget *label;
@@ -1046,7 +1061,7 @@
 	struct gaim_gtk_buddy_list *gtkblist;
 	GtkWidget *img = gtk_image_new_from_stock(GAIM_STOCK_DIALOG_QUESTION, GTK_ICON_SIZE_DIALOG);
 	struct addbuddy *a = g_new0(struct addbuddy, 1);
-	a->gc = gc ? gc : connections->data;
+	a->gc = gc ? gc : gaim_connections_get_all()->data;
 
 	gtkblist = GAIM_GTK_BLIST(gaim_get_blist());
 
@@ -1141,7 +1156,7 @@
 }
 
 struct addchat {
-    struct gaim_account *account;
+    GaimAccount *account;
     GtkWidget *window;
 	GtkWidget *account_menu;
 	GtkWidget *alias_entry;
@@ -1267,7 +1282,7 @@
 	gtk_widget_show_all(ac->entries_box);
 }
 
-static void addchat_select_account(GObject *w, struct gaim_connection *gc)
+static void addchat_select_account(GObject *w, GaimConnection *gc)
 {
 	struct addchat *ac = g_object_get_data(w, "addchat");
 
@@ -1282,8 +1297,9 @@
 static void create_online_account_menu_for_add_chat(struct addchat *ac)
 {
 	char buf[2048]; /* Never hurts to be safe ;-) */
-	GSList *g = connections;
-	struct gaim_connection *c;
+	GList *g = gaim_connections_get_all();
+	GaimConnection *c;
+	GaimAccount *account;
 	GtkWidget *menu, *opt;
 	int count = 0;
 	int place = 0;
@@ -1291,10 +1307,13 @@
 	menu = gtk_menu_new();
 
 	while (g) {
-		c = (struct gaim_connection *)g->data;
+		c = (GaimConnection *)g->data;
+		account = gaim_connection_get_account(c);
+
 		if (GAIM_PLUGIN_PROTOCOL_INFO(c->prpl)->join_chat) {
-			g_snprintf(buf, sizeof(buf), "%s (%s)", 
-					c->username, c->prpl->info->name);
+			g_snprintf(buf, sizeof(buf), "%s (%s)",
+					   gaim_account_get_username(account),
+					   c->prpl->info->name);
 			opt = gtk_menu_item_new_with_label(buf);
 			g_object_set_data(G_OBJECT(opt), "addchat", ac);
 			g_signal_connect(G_OBJECT(opt), "activate",
@@ -1323,11 +1342,11 @@
 	gtk_option_menu_set_history(GTK_OPTION_MENU(ac->account_menu), place);
 }
 
-void show_add_chat(struct gaim_account *account, struct group *group) {
+void show_add_chat(GaimAccount *account, struct group *group) {
     struct addchat *ac = g_new0(struct addchat, 1);
     struct gaim_gtk_buddy_list *gtkblist;
-    GSList *c;
-    struct gaim_connection *gc;
+    GList *c;
+    GaimConnection *gc;
 
 	GtkWidget *label;
 	GtkWidget *rowbox;
@@ -1342,7 +1361,7 @@
 	ac->account = account;
     } else {
 	/* Select an account with chat capabilities */
-	for (c = connections; c != NULL; c = c->next) {
+	for (c = gaim_connections_get_all(); c != NULL; c = c->next) {
 	    gc = c->data;
 
 	    if (GAIM_PLUGIN_PROTOCOL_INFO(gc->prpl)->join_chat) {
@@ -1448,7 +1467,7 @@
 static GtkWidget *deny_type = NULL;
 static GtkWidget *deny_conn_hbox = NULL;
 static GtkWidget *deny_opt_menu = NULL;
-static struct gaim_connection *current_deny_gc = NULL;
+static GaimConnection *current_deny_gc = NULL;
 static gboolean current_is_deny = FALSE;
 static GtkWidget *allow_list = NULL;
 static GtkWidget *block_list = NULL;
@@ -1462,7 +1481,7 @@
 		return;
 
 	gaim_debug(GAIM_DEBUG_INFO, "privacy", "Setting deny mode %d\n", data);
-	current_deny_gc->account->permdeny = data;
+	current_deny_gc->account->perm_deny = data;
 	serv_set_permit_deny(current_deny_gc);
 	gaim_blist_save();
 }
@@ -1481,7 +1500,7 @@
 
 	g_signal_connect(G_OBJECT(opt), "toggled", G_CALLBACK(set_deny_mode), (void *)which);
 	gtk_widget_show(opt);
-	if (current_deny_gc->account->permdeny == which)
+	if (current_deny_gc->account->perm_deny == which)
 		gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(opt), TRUE);
 
 	return opt;
@@ -1506,7 +1525,7 @@
 {
 	GSList *bg = gtk_radio_button_get_group(GTK_RADIO_BUTTON(deny_type));
 
-	switch (current_deny_gc->account->permdeny) {
+	switch (current_deny_gc->account->perm_deny) {
 	case 5:
 		bg = bg->next->next;
 		break;
@@ -1573,7 +1592,7 @@
 	}
 }
 
-static void deny_gc_opt(GtkWidget *opt, struct gaim_connection *gc)
+static void deny_gc_opt(GtkWidget *opt, GaimConnection *gc)
 {
 	current_deny_gc = gc;
 	set_deny_type();
@@ -1585,13 +1604,14 @@
 {
 	GtkWidget *menu;
 	GtkWidget *opt;
-	GSList *c = connections;
-	struct gaim_connection *gc;
+	GList *c = gaim_connections_get_all();
+	GaimConnection *gc;
+	GaimAccount *account;
 	int count = 0;
 	gboolean found = FALSE;
 	char buf[2048];
 
-	if (g_slist_length(connections) == 1) {
+	if (g_list_length(gaim_connections_get_all()) == 1) {
 		gtk_widget_hide(deny_conn_hbox);
 		return;
 	} else
@@ -1600,14 +1620,16 @@
 	menu = gtk_menu_new();
 
 	while (c) {
-		gc = (struct gaim_connection *)c->data;
+		gc = (GaimConnection *)c->data;
 		c = c->next;
 
 		if (!GAIM_PLUGIN_PROTOCOL_INFO(gc->prpl)->set_permit_deny)
 			continue;
 
+		account = gaim_connection_get_account(gc);
+
 		g_snprintf(buf, sizeof buf, "%s (%s)",
-				   gc->username, gc->prpl->info->name);
+				   gaim_account_get_username(account), gc->prpl->info->name);
 		opt = gtk_menu_item_new_with_label(buf);
 		g_signal_connect(G_OBJECT(opt), "activate", G_CALLBACK(deny_gc_opt), gc);
 		gtk_widget_show(opt);
@@ -1619,7 +1641,7 @@
 	}
 
 	if (!found) {
-		current_deny_gc = connections->data;
+		current_deny_gc = gaim_connections_get_all()->data;
 		count = 0;
 	}
 
@@ -1700,11 +1722,12 @@
 	gaim_blist_save();
 }
 
-GtkWidget *privacy_win;
+static GtkWidget *privacy_win;
+
 void update_privacy_connections() { /* This is a slightly better name */
 	gboolean needdeny = FALSE;
-	GSList *c = connections;
-	struct gaim_connection *gc = NULL;
+	GList *c = gaim_connections_get_all();
+	GaimConnection *gc = NULL;
 
 	if (!privacy_win)
 		return;
@@ -1749,8 +1772,8 @@
 	GtkTreeViewColumn *col;
 	GtkWidget *table;
 
-	current_deny_gc = connections->data;	/* this is safe because this screen will only be
-						   available when there are connections */
+	current_deny_gc = gaim_connections_get_all()->data;	/* this is safe because this screen will only be
+						   available when there are gaim_connections_get_all() */
 	current_is_deny = TRUE;
 
 	privacy_win = pwin = gtk_window_new(GTK_WINDOW_TOPLEVEL);
@@ -1906,7 +1929,7 @@
 void do_save_info(GtkWidget *widget, struct set_info_dlg *b)
 {
 	gchar *junk;
-	struct gaim_connection *gc;
+	GaimConnection *gc;
 
 	junk = gtk_text_view_get_text(GTK_TEXT_VIEW(b->text), FALSE);
 
@@ -1941,8 +1964,9 @@
 	g_free(b);
 }
 
-void show_set_dir(struct gaim_connection *gc)
+void show_set_dir(GaimConnection *gc)
 {
+	GaimAccount *account;
 	GtkWidget *label;
 	GtkWidget *bot;
 	GtkWidget *vbox;
@@ -1952,8 +1976,11 @@
 	char buf[256];
 
 	struct set_dir_dlg *b = g_new0(struct set_dir_dlg, 1);
+
 	b->gc = gc;
 
+	account = gaim_connection_get_account(gc);
+
 	GAIM_DIALOG(b->window);
 	dialogwindows = g_list_prepend(dialogwindows, b->window);
 	gtk_window_set_role(GTK_WINDOW(b->window), "set_dir");
@@ -1976,7 +2003,8 @@
 	gtk_container_add(GTK_CONTAINER(frame), vbox);
 	gtk_widget_show(vbox);
 
-	g_snprintf(buf, sizeof(buf), _("Setting Dir Info for %s:"), gc->username);
+	g_snprintf(buf, sizeof(buf), _("Setting Dir Info for %s:"),
+			   gaim_account_get_username(account));
 	label = gtk_label_new(buf);
 	gtk_box_pack_start(GTK_BOX(vbox), label, FALSE, FALSE, 5);
 	gtk_widget_show(label);
@@ -2130,8 +2158,9 @@
 	g_free(b);
 }
 
-void show_change_passwd(struct gaim_connection *gc)
+void show_change_passwd(GaimConnection *gc)
 {
+	GaimAccount *account;
 	GtkWidget *hbox;
 	GtkWidget *label;
 	GtkWidget *vbox;
@@ -2142,6 +2171,8 @@
 	struct passwddlg *b = g_new0(struct passwddlg, 1);
 	b->gc = gc;
 
+	account = gaim_connection_get_account(gc);
+
 	GAIM_DIALOG(b->window);
 	gtk_window_set_resizable(GTK_WINDOW(b->window), TRUE);
 	gtk_window_set_role(GTK_WINDOW(b->window), "change_passwd");
@@ -2161,7 +2192,7 @@
 	gtk_container_set_border_width(GTK_CONTAINER(vbox), 5);
 	gtk_container_add(GTK_CONTAINER(frame), vbox);
 
-	g_snprintf(buf, sizeof(buf), _("Changing password for %s:"), gc->username);
+	g_snprintf(buf, sizeof(buf), _("Changing password for %s:"), gaim_account_get_username(account));
 	label = gtk_label_new(buf);
 	gtk_box_pack_start(GTK_BOX(vbox), label, FALSE, FALSE, 5);
 
@@ -2213,7 +2244,7 @@
 	gtk_widget_show_all(b->window);
 }
 
-void show_set_info(struct gaim_connection *gc)
+void show_set_info(GaimConnection *gc)
 {
 	GtkWidget *buttons;
 	GtkWidget *label;
@@ -2221,7 +2252,7 @@
 	GtkTextBuffer *buffer;
 	GtkWidget *frame;
 	gchar *buf;
-	struct gaim_account *account;
+	GaimAccount *account;
 
 	struct set_info_dlg *b = g_new0(struct set_info_dlg, 1);
 	account = gc->account;
@@ -2239,7 +2270,8 @@
 	gtk_container_add(GTK_CONTAINER(b->window), vbox);
 
 	buf = g_malloc(256);
-	g_snprintf(buf, 256, _("Changing info for %s:"), account->username);
+	g_snprintf(buf, 256, _("Changing info for %s:"),
+			   gaim_account_get_username(account));
 	label = gtk_label_new(buf);
 	g_free(buf);
 	gtk_box_pack_start(GTK_BOX(vbox), label, FALSE, FALSE, 5);
@@ -2291,7 +2323,7 @@
  *
  * i wish this were my client. if i were i wouldn't have to deal with this shit.
  */
-void g_show_info_text(struct gaim_connection *gc, const char *who, int away, const char *info, ...)
+void g_show_info_text(GaimConnection *gc, const char *who, int away, const char *info, ...)
 {
 	GtkWidget *ok;
 	GtkWidget *label;
@@ -2403,7 +2435,7 @@
 
 
 
-void show_add_perm(struct gaim_connection *gc, char *who, gboolean permit)
+void show_add_perm(GaimConnection *gc, char *who, gboolean permit)
 {
 	GtkWidget *cancel;
 	GtkWidget *add;
@@ -2595,7 +2627,7 @@
 	destroy_dialog(NULL, b->window);
 }
 
-void show_find_info(struct gaim_connection *gc)
+void show_find_info(GaimConnection *gc)
 {
 	GtkWidget *cancel;
 	GtkWidget *ok;
@@ -2723,7 +2755,7 @@
 	gtk_widget_show_all(b->window);
 }
 
-void show_find_email(struct gaim_connection *gc)
+void show_find_email(GaimConnection *gc)
 {
 	GtkWidget *label;
 	GtkWidget *bbox;
@@ -2733,7 +2765,7 @@
 	GtkWidget *button;
 
 	struct findbyemail *b = g_new0(struct findbyemail, 1);
-	if (g_slist_find(connections, gc))
+	if (g_list_find(gaim_connections_get_all(), gc))
 		b->gc = gc;
 	GAIM_DIALOG(b->window);
 	gtk_window_set_resizable(GTK_WINDOW(b->window), TRUE);
@@ -4342,7 +4374,7 @@
 	new_name = gtk_entry_get_text(GTK_ENTRY(entry));
 	b = g_object_get_data(obj, "buddy");
 
-	if (!g_slist_find(connections, b->account->gc)) {
+	if (!g_list_find(gaim_connections_get_all(), b->account->gc)) {
 		destroy_dialog(rename_bud_dialog, rename_bud_dialog);
 		return;
 	}
@@ -5009,7 +5041,7 @@
 void set_vcard_dialog_ok_clicked(GtkWidget *widget, gpointer  data)
 {
 	MultiEntryDlg *b = (MultiEntryDlg *) data;
-	struct gaim_connection *gc;
+	GaimConnection *gc;
 	gchar *tmp;
 	GSList *list;
 
--- a/src/ft.c	Fri May 30 04:13:58 2003 +0000
+++ b/src/ft.c	Fri May 30 09:38:29 2003 +0000
@@ -42,7 +42,7 @@
 static struct gaim_xfer_ui_ops *xfer_ui_ops = NULL;
 
 struct gaim_xfer *
-gaim_xfer_new(struct gaim_account *account, GaimXferType type,
+gaim_xfer_new(GaimAccount *account, GaimXferType type,
 			  const char *who)
 {
 	struct gaim_xfer *xfer;
@@ -190,7 +190,7 @@
 	return xfer->type;
 }
 
-struct gaim_account *
+GaimAccount *
 gaim_xfer_get_account(const struct gaim_xfer *xfer)
 {
 	if (xfer == NULL)
--- a/src/ft.h	Fri May 30 04:13:58 2003 +0000
+++ b/src/ft.h	Fri May 30 09:38:29 2003 +0000
@@ -64,7 +64,7 @@
 {
 	GaimXferType type;            /**< The type of transfer.               */
 
-	struct gaim_account *account; /**< The account.                        */
+	GaimAccount *account; /**< The account.                        */
 
 	char *who;                    /**< The person on the other end of the
 	                                   transfer.                           */
@@ -124,7 +124,7 @@
  *
  * @return A file transfer handle.
  */
-struct gaim_xfer *gaim_xfer_new(struct gaim_account *account,
+struct gaim_xfer *gaim_xfer_new(GaimAccount *account,
 								GaimXferType type, const char *who);
 
 /**
@@ -172,7 +172,7 @@
  *
  * @return The account.
  */
-struct gaim_account *gaim_xfer_get_account(const struct gaim_xfer *xfer);
+GaimAccount *gaim_xfer_get_account(const struct gaim_xfer *xfer);
 
 /**
  * Returns the completed state for a file transfer.
--- a/src/gaim.h	Fri May 30 04:13:58 2003 +0000
+++ b/src/gaim.h	Fri May 30 09:38:29 2003 +0000
@@ -153,11 +153,6 @@
 #  define _(x) (x)
 #endif
 
-#define OPT_ACCT_AUTO		0x00000001
-/*#define OPT_ACCT_KEEPALV	0x00000002 this shouldn't be optional */
-#define OPT_ACCT_REM_PASS	0x00000004
-#define OPT_ACCT_MAIL_CHECK      0x00000008
-
 #define DEFAULT_INFO "Visit the Gaim website at <A HREF=\"http://gaim.sourceforge.net/\">http://gaim.sourceforge.net/</A>."
 
 enum log_event {
@@ -207,7 +202,7 @@
 extern void do_quit();
 
 /* Functions in gtkblist.c */
-extern void signoff(struct gaim_connection *);
+extern void signoff(GaimConnection *);
 
 /* Functions in buddy_chat.c */
 #if 0
@@ -220,13 +215,13 @@
 #endif
 
 /* Functions in dialogs.c */
-extern void g_show_info_text(struct gaim_connection *, const char *, int, const char *, ...);
-extern void show_change_passwd(struct gaim_connection *);
-extern void show_set_dir(struct gaim_connection *);
-extern void show_find_email(struct gaim_connection *);
-extern void show_find_info(struct gaim_connection *);
-extern void show_set_info(struct gaim_connection *);
-extern void show_confirm_del(struct gaim_connection *, gchar *);
+extern void g_show_info_text(GaimConnection *, const char *, int, const char *, ...);
+extern void show_change_passwd(GaimConnection *);
+extern void show_set_dir(GaimConnection *);
+extern void show_find_email(GaimConnection *);
+extern void show_find_info(GaimConnection *);
+extern void show_set_info(GaimConnection *);
+extern void show_confirm_del(GaimConnection *, gchar *);
 extern void show_confirm_del_group(struct group *);
 extern void show_confirm_del_chat(struct chat *);
 
@@ -250,44 +245,44 @@
 
 /* Functions in server.c */
 /* input to serv */
-extern void serv_login(struct gaim_account *);
-extern void serv_close(struct gaim_connection *);
-extern void serv_touch_idle(struct gaim_connection *);
-extern int  serv_send_im(struct gaim_connection *, char *, char *, int, int);
-extern void serv_get_info(struct gaim_connection *, char *);
-extern void serv_get_dir(struct gaim_connection *, char *);
-extern void serv_set_idle(struct gaim_connection *, int);
-extern void serv_set_info(struct gaim_connection *, char *);
-extern void serv_set_away(struct gaim_connection *, char *, char *);
+extern void serv_login(GaimAccount *);
+extern void serv_close(GaimConnection *);
+extern void serv_touch_idle(GaimConnection *);
+extern int  serv_send_im(GaimConnection *, char *, char *, int, int);
+extern void serv_get_info(GaimConnection *, char *);
+extern void serv_get_dir(GaimConnection *, char *);
+extern void serv_set_idle(GaimConnection *, int);
+extern void serv_set_info(GaimConnection *, char *);
+extern void serv_set_away(GaimConnection *, char *, char *);
 extern void serv_set_away_all(char *);
-extern int  serv_send_typing(struct gaim_connection *, char *, int);
-extern void serv_change_passwd(struct gaim_connection *, const char *, const char *);
-extern void serv_add_buddy(struct gaim_connection *, const char *);
-extern void serv_add_buddies(struct gaim_connection *, GList *);
-extern void serv_remove_buddy(struct gaim_connection *, char *, char *);
-extern void serv_remove_buddies(struct gaim_connection *, GList *, char *);
-extern void serv_add_permit(struct gaim_connection *, const char *);
-extern void serv_add_deny(struct gaim_connection *, const char *);
-extern void serv_rem_permit(struct gaim_connection *, const char *);
-extern void serv_rem_deny(struct gaim_connection *, const char *);
-extern void serv_set_permit_deny(struct gaim_connection *);
-extern void serv_warn(struct gaim_connection *, char *, int);
-extern void serv_set_dir(struct gaim_connection *, const char *, const char *, const char *, const char *, const char *, const char *, const char *, int);
-extern void serv_dir_search(struct gaim_connection *, const char *, const char *, const char *, const char *, const char *, const char *, const char *, const char *);
-extern void serv_join_chat(struct gaim_connection *, GHashTable *);
-extern void serv_chat_invite(struct gaim_connection *, int, const char *, const char *);
-extern void serv_chat_leave(struct gaim_connection *, int);
-extern void serv_chat_whisper(struct gaim_connection *, int, char *, char *);
-extern int  serv_chat_send(struct gaim_connection *, int, char *);
+extern int  serv_send_typing(GaimConnection *, char *, int);
+extern void serv_change_passwd(GaimConnection *, const char *, const char *);
+extern void serv_add_buddy(GaimConnection *, const char *);
+extern void serv_add_buddies(GaimConnection *, GList *);
+extern void serv_remove_buddy(GaimConnection *, char *, char *);
+extern void serv_remove_buddies(GaimConnection *, GList *, char *);
+extern void serv_add_permit(GaimConnection *, const char *);
+extern void serv_add_deny(GaimConnection *, const char *);
+extern void serv_rem_permit(GaimConnection *, const char *);
+extern void serv_rem_deny(GaimConnection *, const char *);
+extern void serv_set_permit_deny(GaimConnection *);
+extern void serv_warn(GaimConnection *, char *, int);
+extern void serv_set_dir(GaimConnection *, const char *, const char *, const char *, const char *, const char *, const char *, const char *, int);
+extern void serv_dir_search(GaimConnection *, const char *, const char *, const char *, const char *, const char *, const char *, const char *, const char *);
+extern void serv_join_chat(GaimConnection *, GHashTable *);
+extern void serv_chat_invite(GaimConnection *, int, const char *, const char *);
+extern void serv_chat_leave(GaimConnection *, int);
+extern void serv_chat_whisper(GaimConnection *, int, char *, char *);
+extern int  serv_chat_send(GaimConnection *, int, char *);
 extern void serv_got_popup(char *, char *, int, int);
-extern void serv_get_away(struct gaim_connection *, const char *);
+extern void serv_get_away(GaimConnection *, const char *);
 extern void serv_alias_buddy(struct buddy *);
 extern void serv_move_buddy(struct buddy *, struct group *, struct group *);
-extern void serv_rename_group(struct gaim_connection *, struct group *, const char *);
+extern void serv_rename_group(GaimConnection *, struct group *, const char *);
 
 /* Functions in log.h */
 extern FILE *open_log_file (const char *, int);
-extern void system_log(enum log_event, struct gaim_connection *, struct buddy *, int);
+extern void system_log(enum log_event, GaimConnection *, struct buddy *, int);
 extern void rm_log(struct log_conversation *);
 extern struct log_conversation *find_log_info(const char *);
 extern void update_log_convs();
@@ -334,7 +329,7 @@
 	gchar *role;				/* window role */
 	char *title;				/* window title */
 
-	struct gaim_account *account;			/* user info - needed for most everything */
+	GaimAccount *account;			/* user info - needed for most everything */
 
 	MultiInstrData *instructions;		/* instructions (what else?) */
 
--- a/src/gaimrc.c	Fri May 30 04:13:58 2003 +0000
+++ b/src/gaimrc.c	Fri May 30 09:38:29 2003 +0000
@@ -152,6 +152,10 @@
 #define OPT_AWAY_QUEUE_UNREAD		0x00000080
 #define OPT_AWAY_DELAY_IN_USE		0x00000100
 
+#define OPT_ACCT_AUTO		0x00000001
+/*#define OPT_ACCT_KEEPALV	0x00000002 this shouldn't be optional */
+#define OPT_ACCT_REM_PASS	0x00000004
+#define OPT_ACCT_MAIL_CHECK      0x00000008
 
 GSList *gaim_accounts = NULL;
 static guint misc_options;
@@ -491,13 +495,15 @@
 	}
 }
 
-static struct gaim_account *gaimrc_read_user(FILE *f)
+static GaimAccount *gaimrc_read_user(FILE *f)
 {
 	struct parse parse_buffer;
 	struct parse *p;
-	struct gaim_account *account;
+	GaimAccount *account;
 	int i;
 	char buf[4096];
+	char user_info[2048];
+	int flags;
 
 	if (!fgets(buf, sizeof(buf), f))
 		return NULL;
@@ -507,15 +513,10 @@
 	if (strcmp(p->option, "ident"))
 		return NULL;
 
-	account = g_new0(struct gaim_account, 1);
-
-	strcpy(account->username, p->value[0]);
-	strcpy(account->password, p->value[1]);
+	account = gaim_account_new(p->value[0], GAIM_PROTO_DEFAULT);
 
-	account->user_info[0] = 0;
-	account->options = OPT_ACCT_REM_PASS;
-	account->protocol = GAIM_PROTO_DEFAULT;
-	account->permit = account->deny = NULL;
+	gaim_account_set_password(account, p->value[1]);
+	gaim_account_set_remember_password(account, TRUE);
 
 	if (!fgets(buf, sizeof(buf), f))
 		return account;
@@ -527,18 +528,23 @@
 	if (!fgets(buf, sizeof(buf), f))
 		return account;
 
+	*user_info = '\0';
+
 	while (strncmp(buf, "\t\t}", 3)) {
 		if (strlen(buf) > 3)
-			strcat(account->user_info, buf + 3);
+			strcat(user_info, buf + 3);
 
 		if (!fgets(buf, sizeof(buf), f)) {
+			gaim_account_set_user_info(account, user_info);
+
 			return account;
 		}
 	}
 
-	if ((i = strlen(account->user_info))) {
-		account->user_info[i - 1] = '\0';
-	}
+	if ((i = strlen(account->user_info)))
+		user_info[i - 1] = '\0';
+
+	gaim_account_set_user_info(account, user_info);
 
 	if (!fgets(buf, sizeof(buf), f)) {
 		return account;
@@ -553,8 +559,14 @@
 	if (strcmp(p->option, "user_opts"))
 		return account;
 
-	account->options = atoi(p->value[0]);
-	account->protocol = atoi(p->value[1]);
+	/* TODO: Handle OPT_ACCT_AUTO and OPT_ACCT_MAIL_CHECK */
+
+	flags = atoi(p->value[0]);
+
+	if (!(flags & OPT_ACCT_REM_PASS))
+		gaim_account_set_remember_password(account, FALSE);
+
+	gaim_account_set_protocol(account, atoi(p->value[1]));
 
 	if (!fgets(buf, sizeof(buf), f))
 		return account;
@@ -567,8 +579,14 @@
 	if (strcmp(p->option, "proto_opts"))
 		return account;
 
-	for (i = 0; i < 7; i++)
+	/* TODO: Server and port should be preserved! :/ */
+#if 0
+	for (i = 0; i < 7; i++) {
+		char buf[256];
+
 		g_snprintf(account->proto_opt[i], sizeof account->proto_opt[i], "%s", p->value[i]);
+	}
+#endif
 
 	if (!fgets(buf, sizeof(buf), f))
 		return account;
@@ -581,7 +599,7 @@
 	if (strcmp(p->option, "iconfile"))
 		return account;
 
-	g_snprintf(account->iconfile, sizeof(account->iconfile), "%s", p->value[0]);
+	gaim_account_set_buddy_icon(account, p->value[0]);
 
 	if (!fgets(buf, sizeof(buf), f))
 		return account;
@@ -594,7 +612,7 @@
 	if (strcmp(p->option, "alias"))
 		return account;
 
-	g_snprintf(account->alias, sizeof(account->alias), "%s", p->value[0]);
+	gaim_account_set_alias(account, p->value[0]);
 
 	if (!fgets(buf, sizeof(buf), f))
 		return account;
@@ -626,7 +644,7 @@
 static void gaimrc_read_users(FILE *f)
 {
 	char buf[2048];
-	struct gaim_account *account = NULL;
+	GaimAccount *account = NULL;
 	struct parse parse_buffer;
 	struct parse *p=NULL;
 
@@ -1344,7 +1362,7 @@
 	GList *l;
 	struct pounce_placeholder *ph;
 	struct gaim_pounce *pounce;
-	struct gaim_account *account;
+	GaimAccount *account;
 
 	for (l = buddy_pounces; l != NULL; l = l->next) {
 		GaimPounceEvent events = GAIM_POUNCE_NONE;
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/gtkaccount.c	Fri May 30 09:38:29 2003 +0000
@@ -0,0 +1,139 @@
+/**
+ * @file gtkaccount.c Account Editor dialog
+ * @ingroup gtkui
+ *
+ * gaim
+ *
+ * Copyright (C) 2002-2003, Christian Hammond <chipx86@gnupdate.org>
+ * 
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ */
+#include "gtkaccount.h"
+#include "account.h"
+#include "prefs.h"
+#include "stock.h"
+
+typedef struct
+{
+	GtkWidget *window;
+
+} AccountsDialog;
+
+static AccountsDialog *accounts_dialog = NULL;
+
+static gint
+__window_destroy_cb(GtkWidget *w, GdkEvent *event, void *unused)
+{
+	g_free(accounts_dialog);
+	accounts_dialog = NULL;
+
+	return FALSE;
+}
+
+static gboolean
+__configure_cb(GtkWidget *w, GdkEventConfigure *event, AccountsDialog *dialog)
+{
+	if (GTK_WIDGET_VISIBLE(w)) {
+		gaim_prefs_set_int("/gaim/gtk/accounts/dialog/width",  event->width);
+		gaim_prefs_set_int("/gaim/gtk/accounts/dialog/height", event->height);
+	}
+
+	return FALSE;
+}
+
+static GtkWidget *
+__create_accounts_list(void)
+{
+	return NULL;
+}
+
+void
+gaim_gtk_account_dialog_show(void)
+{
+	AccountsDialog *dialog;
+	GtkWidget *win;
+	GtkWidget *vbox;
+	GtkWidget *bbox;
+	GtkWidget *sw;
+	GtkWidget *sep;
+	GtkWidget *button;
+	int width, height;
+
+	if (accounts_dialog != NULL)
+		return;
+
+	dialog = g_new0(AccountsDialog, 1);
+
+	width  = gaim_prefs_get_int("/gaim/gtk/accounts/dialog/width");
+	height = gaim_prefs_get_int("/gaim/gtk/accounts/dialog/height");
+
+	win = accounts_dialog->window;
+
+	GAIM_DIALOG(win);
+	gtk_window_set_default_size(GTK_WINDOW(win), width, height);
+	gtk_window_set_role(GTK_WINDOW(win), "accounts");
+	gtk_window_set_title(GTK_WINDOW(win), "Accounts");
+	gtk_container_set_border_width(GTK_CONTAINER(win), 12);
+
+	g_signal_connect(G_OBJECT(win), "delete_event",
+					 G_CALLBACK(__window_destroy_cb), accounts_dialog);
+	g_signal_connect(G_OBJECT(win), "configure_event",
+					 G_CALLBACK(__configure_cb), accounts_dialog);
+
+	/* Setup the vbox */
+	vbox = gtk_vbox_new(FALSE, 12);
+	gtk_container_add(GTK_CONTAINER(win), vbox);
+	gtk_widget_show(vbox);
+
+	/* Setup the scrolled window that will contain the list of accounts. */
+	sw = __create_accounts_list();
+	gtk_box_pack_start(GTK_BOX(vbox), sw, TRUE, TRUE, 0);
+	gtk_widget_show(sw);
+
+	/* Separator... */
+	sep = gtk_hseparator_new();
+	gtk_box_pack_start(GTK_BOX(vbox), sep, FALSE, FALSE, 0);
+	gtk_widget_show(sep);
+
+	/* Button box. */
+	bbox = gtk_hbutton_box_new();
+	gtk_box_set_spacing(GTK_BOX(bbox), 6);
+	gtk_button_box_set_layout(GTK_BUTTON_BOX(bbox), GTK_BUTTONBOX_END);
+	gtk_box_pack_end(GTK_BOX(vbox), bbox, FALSE, TRUE, 0);
+	gtk_widget_show(vbox);
+
+	/* Add button */
+	button = gtk_button_new_from_stock(GTK_STOCK_ADD);
+	gtk_box_pack_start(GTK_BOX(bbox), button, FALSE, FALSE, 0);
+	gtk_widget_show(button);
+
+	/* Modify button */
+	button = gtk_button_new_from_stock(GAIM_STOCK_MODIFY);
+	gtk_box_pack_start(GTK_BOX(bbox), button, FALSE, FALSE, 0);
+	gtk_widget_show(button);
+
+	/* Delete button */
+	button = gtk_button_new_from_stock(GTK_STOCK_DELETE);
+	gtk_box_pack_start(GTK_BOX(button), button, FALSE, FALSE, 0);
+	gtk_widget_show(button);
+
+	/* Close button */
+	button = gtk_button_new_from_stock(GTK_STOCK_CLOSE);
+	gtk_box_pack_start(GTK_BOX(button), button, FALSE, FALSE, 0);
+	gtk_widget_show(button);
+
+	gtk_widget_show(win);
+}
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/gtkaccount.h	Fri May 30 09:38:29 2003 +0000
@@ -0,0 +1,37 @@
+/**
+ * @file gtkaccount.h Account Editor dialog
+ * @ingroup gtkui
+ *
+ * gaim
+ *
+ * Copyright (C) 2002-2003, Christian Hammond <chipx86@gnupdate.org>
+ * 
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ */
+#ifndef _GAIM_GTK_ACCOUNT_H_
+#define _GAIM_GTK_ACCOUNT_H_
+
+/**
+ * Shows the account editor dialog.
+ */
+void gaim_gtk_account_dialog_show(void);
+
+/**
+ * Hides the account editor dialog.
+ */
+void gaim_gtk_account_dialog_hide(void);
+
+#endif /* _GAIM_GTK_ACCOUNT_H_ */
+
--- a/src/gtkblist.h	Fri May 30 04:13:58 2003 +0000
+++ b/src/gtkblist.h	Fri May 30 09:38:29 2003 +0000
@@ -94,7 +94,7 @@
  * 
  * @return         The icon
  */
-GdkPixbuf *create_prpl_icon(struct gaim_account *account);
+GdkPixbuf *create_prpl_icon(GaimAccount *account);
 
 /**
  * Refreshes all the nodes of the buddy list.
--- a/src/gtkconv.c	Fri May 30 04:13:58 2003 +0000
+++ b/src/gtkconv.c	Fri May 30 09:38:29 2003 +0000
@@ -120,7 +120,7 @@
 static void toggle_fg_color(GtkWidget *color, struct gaim_conversation *conv);
 static void toggle_bg_color(GtkWidget *color, struct gaim_conversation *conv);
 static void got_typing_keypress(struct gaim_conversation *conv, gboolean first);
-static GList *generate_invite_user_names(struct gaim_connection *gc);
+static GList *generate_invite_user_names(GaimConnection *gc);
 static void add_chat_buddy_common(struct gaim_conversation *conv,
 								  const char *name, int pos);
 static void tab_complete(struct gaim_conversation *conv);
@@ -365,7 +365,7 @@
 	char *buf, *buf2;
 	GtkTextIter start_iter, end_iter;
 	int limit;
-	struct gaim_connection *gc = gaim_conversation_get_gc(conv);
+	GaimConnection *gc = gaim_conversation_get_gc(conv);
 
 	gtkconv = GAIM_GTK_CONVERSATION(conv);
 
@@ -474,7 +474,7 @@
 static void
 add_cb(GtkWidget *widget, struct gaim_conversation *conv)
 {
-	struct gaim_connection *gc;
+	GaimConnection *gc;
 	struct buddy *b;
 	const char *name;
 
@@ -536,7 +536,7 @@
 static void
 block_cb(GtkWidget *widget, struct gaim_conversation *conv)
 {
-	struct gaim_connection *gc;
+	GaimConnection *gc;
 
 	gc = gaim_conversation_get_gc(conv);
 
@@ -552,7 +552,7 @@
 	struct gaim_conversation *conv2;
 	struct gaim_gtk_conversation *gtkconv;
 	struct gaim_gtk_chat_pane *gtkchat;
-	struct gaim_account *account;
+	GaimAccount *account;
 	GtkTreeIter iter;
 	GtkTreeModel *model;
 	GtkTreeSelection *sel;
@@ -626,7 +626,7 @@
 {
 	const char *who;
 	struct gaim_conversation *conv2;
-	struct gaim_account *account;
+	GaimAccount *account;
 
 	who = g_object_get_data(G_OBJECT(w), "user_data");
 
@@ -644,7 +644,7 @@
 menu_info_cb(GtkWidget *w, struct gaim_conversation *conv)
 {
 	GaimPluginProtocolInfo *prpl_info = NULL;
-	struct gaim_connection *gc;
+	GaimConnection *gc;
 	char *who;
 
 	gc = gaim_conversation_get_gc(conv);
@@ -668,7 +668,7 @@
 menu_away_cb(GtkWidget *w, struct gaim_conversation *conv)
 {
 	GaimPluginProtocolInfo *prpl_info = NULL;
-	struct gaim_connection *gc;
+	GaimConnection *gc;
 	char *who;
 
 	gc  = gaim_conversation_get_gc(conv);
@@ -689,7 +689,7 @@
 static void
 menu_add_cb(GtkWidget *w, struct gaim_conversation *conv)
 {
-	struct gaim_connection *gc;
+	GaimConnection *gc;
 	struct buddy *b;
 	char *name;
 
@@ -712,8 +712,8 @@
 	GaimPluginProtocolInfo *prpl_info = NULL;
 	struct gaim_gtk_conversation *gtkconv;
 	struct gaim_gtk_chat_pane *gtkchat;
-	struct gaim_connection *gc;
-	struct gaim_account *account;
+	GaimConnection *gc;
+	GaimAccount *account;
 	GtkTreePath *path;
 	GtkTreeIter iter;
 	GtkTreeModel *model;
@@ -863,7 +863,7 @@
 	struct InviteBuddyInfo *info = NULL;
 
 	if (invite_dialog == NULL) {
-		struct gaim_connection *gc;
+		GaimConnection *gc;
 		struct gaim_window *win;
 		struct gaim_gtk_window *gtkwin;
 		GtkWidget *label;
@@ -1268,7 +1268,7 @@
 menu_conv_sel_send_cb(GObject *m, gpointer data)
 {
 	struct gaim_window *win = g_object_get_data(m, "user_data");
-	struct gaim_account *account = g_object_get_data(m, "gaim_account");
+	GaimAccount *account = g_object_get_data(m, "gaim_account");
 	struct gaim_conversation *conv;
 
 	conv = gaim_window_get_active_conversation(win);
@@ -1738,7 +1738,7 @@
 	struct gaim_conversation *conv;
 	struct gaim_gtk_conversation *gtkconv;
 	struct gaim_gtk_window *gtkwin;
-	struct gaim_connection *gc;
+	GaimConnection *gc;
 
 	win = (struct gaim_window *)user_data;
 
@@ -2003,7 +2003,7 @@
 static gboolean
 update_send_as_selection(struct gaim_window *win)
 {
-	struct gaim_account *account;
+	GaimAccount *account;
 	struct gaim_conversation *conv;
 	struct gaim_gtk_window *gtkwin;
 	GtkWidget *menu;
@@ -2037,7 +2037,7 @@
 		 child = child->next) {
 
 		GtkWidget *item = child->data;
-		struct gaim_account *item_account = g_object_get_data(G_OBJECT(item),
+		GaimAccount *item_account = g_object_get_data(G_OBJECT(item),
 				"gaim_account");
 
 		if (account == item_account) {
@@ -2055,7 +2055,7 @@
 	struct gaim_gtk_window *gtkwin;
 	GtkWidget *menu;
 	GtkWidget *menuitem;
-	GSList *gcs;
+	GList *gcs;
 	GList *convs;
 	GSList *group = NULL;
 	gboolean first_offline = TRUE;
@@ -2068,7 +2068,7 @@
 		gtk_widget_destroy(gtkwin->menu.send_as);
 
 	/* See if we have > 1 connection active. */
-	if (g_slist_length(connections) < 2) {
+	if (g_list_length(gaim_connections_get_all()) < 2) {
 		/* Now make sure we don't have any Offline entries. */
 		gboolean found_offline = FALSE;
 
@@ -2077,7 +2077,7 @@
 			 convs = convs->next) {
 
 			struct gaim_conversation *conv;
-			struct gaim_account *account;
+			GaimAccount *account;
 
 			conv = (struct gaim_conversation *)convs->data;
 			account = gaim_conversation_get_account(conv);
@@ -2107,9 +2107,10 @@
 	gtk_widget_show(menu);
 
 	/* Fill it with entries. */
-	for (gcs = connections; gcs != NULL; gcs = gcs->next) {
-
-		struct gaim_connection *gc;
+	for (gcs = gaim_connections_get_all(); gcs != NULL; gcs = gcs->next) {
+
+		GaimConnection *gc;
+		GaimAccount *account;
 		GtkWidget *box;
 		GtkWidget *label;
 		GtkWidget *image;
@@ -2117,7 +2118,7 @@
 
 		found_online = TRUE;
 
-		gc = (struct gaim_connection *)gcs->data;
+		gc = (GaimConnection *)gcs->data;
 
 		/* Create a pixmap for the protocol icon. */
 		pixbuf = create_prpl_icon(gc->account);
@@ -2134,8 +2135,11 @@
 		g_object_unref(G_OBJECT(scale));
 		g_object_unref(G_OBJECT(pixbuf));
 
+		account = gaim_connection_get_account(gc);
+
 		/* Make our menu item */
-		menuitem = gtk_radio_menu_item_new_with_label(group, gc->username);
+		menuitem = gtk_radio_menu_item_new_with_label(group,
+				gaim_account_get_username(account));
 		group = gtk_radio_menu_item_get_group(GTK_RADIO_MENU_ITEM(menuitem));
 
 		/* Do some evil, see some evil, speak some evil. */
@@ -2176,7 +2180,7 @@
 		 convs = convs->next) {
 
 		struct gaim_conversation *conv;
-		struct gaim_account *account;
+		GaimAccount *account;
 		GtkWidget *box;
 		GtkWidget *label;
 		GtkWidget *image;
@@ -2257,7 +2261,7 @@
 }
 
 static GList *
-generate_invite_user_names(struct gaim_connection *gc)
+generate_invite_user_names(GaimConnection *gc)
 {
 	GaimBlistNode *gnode,*bnode;
 	struct group *g;
@@ -2617,7 +2621,7 @@
 static void
 setup_im_buttons(struct gaim_conversation *conv, GtkWidget *parent)
 {
-	struct gaim_connection *gc;
+	GaimConnection *gc;
 	struct gaim_gtk_conversation *gtkconv;
 	struct gaim_gtk_im_pane *gtkim;
 	GaimConversationType type = GAIM_CONV_IM;
@@ -2717,7 +2721,7 @@
 static void
 setup_chat_buttons(struct gaim_conversation *conv, GtkWidget *parent)
 {
-	struct gaim_connection *gc;
+	GaimConnection *gc;
 	struct gaim_gtk_conversation *gtkconv;
 	struct gaim_gtk_chat_pane *gtkchat;
 	struct gaim_gtk_window *gtkwin;
@@ -2945,7 +2949,7 @@
 	GaimPluginProtocolInfo *prpl_info = NULL;
 	struct gaim_gtk_conversation *gtkconv;
 	struct gaim_gtk_chat_pane *gtkchat;
-	struct gaim_connection *gc;
+	GaimConnection *gc;
 	GtkWidget *vpaned, *hpaned;
 	GtkWidget *vbox, *hbox;
 	GtkWidget *lbox, *bbox;
@@ -3769,7 +3773,7 @@
 {
 	GaimPluginProtocolInfo *prpl_info = NULL;
 	struct gaim_gtk_conversation *gtkconv;
-	struct gaim_connection *gc;
+	GaimConnection *gc;
 	GaimConversationType type;
 	GtkWidget *parent;
 
@@ -3944,7 +3948,7 @@
 {
 	struct gaim_gtk_conversation *gtkconv;
 	struct gaim_window *win;
-	struct gaim_connection *gc;
+	GaimConnection *gc;
 	int gtk_font_options = 0;
 	GString *log_str;
 	FILE *fd;
@@ -5031,18 +5035,18 @@
 void
 gaim_gtkconv_update_chat_button_style()
 {
-	GSList *l;
-	struct gaim_connection *g;
+	GList *l;
+	GaimConnection *g;
 	GtkWidget *parent;
 	GaimConversationType type = GAIM_CONV_CHAT;
 
-	for (l = connections; l != NULL; l = l->next) {
+	for (l = gaim_connections_get_all(); l != NULL; l = l->next) {
 		GSList *bcs;
 		struct gaim_conversation *conv;
 		struct gaim_gtk_conversation *gtkconv;
 		struct gaim_gtk_window *gtkwin;
 
-		g = (struct gaim_connection *)l->data;
+		g = (GaimConnection *)l->data;
 
 		for (bcs = g->buddy_chats; bcs != NULL; bcs = bcs->next) {
 			conv = (struct gaim_conversation *)bcs->data;
@@ -5107,7 +5111,7 @@
 	struct gaim_window *win;
 	struct gaim_gtk_window *gtkwin = NULL;
 	struct gaim_gtk_conversation *gtkconv;
-	struct gaim_connection *gc;
+	GaimConnection *gc;
 
 	if (!GAIM_IS_GTK_CONVERSATION(conv))
 		return;
--- a/src/gtknotify.c	Fri May 30 04:13:58 2003 +0000
+++ b/src/gtknotify.c	Fri May 30 09:38:29 2003 +0000
@@ -29,7 +29,7 @@
 
 typedef struct
 {
-	struct gaim_connection *gc;
+	GaimConnection *gc;
 	char *url;
 	GtkWidget *dialog;
 	GtkWidget *label;
--- a/src/gtkpounce.c	Fri May 30 04:13:58 2003 +0000
+++ b/src/gtkpounce.c	Fri May 30 09:38:29 2003 +0000
@@ -33,7 +33,7 @@
 {
 	/* Pounce data */
 	struct gaim_pounce  *pounce;
-	struct gaim_account *account;
+	GaimAccount *account;
 
 	/* The window */
 	GtkWidget *window;
@@ -276,7 +276,7 @@
 static GtkWidget *
 pounce_user_menu(struct gaim_gtkpounce_dialog *dialog)
 {
-	struct gaim_account *account;
+	GaimAccount *account;
 	GaimPlugin *prpl;
 	GtkWidget *opt_menu;
 	GtkWidget *menu;
@@ -289,7 +289,7 @@
 	menu = gtk_menu_new();
 
 	for (l = gaim_accounts, count = 0; l != NULL; l = l->next, count++) {
-		account = (struct gaim_account *)l->data;
+		account = (GaimAccount *)l->data;
 
 		prpl = gaim_find_prpl(account->protocol);
 
@@ -322,7 +322,7 @@
 pounce_cb(struct gaim_pounce *pounce, GaimPounceEvent events, void *data)
 {
 	struct gaim_conversation *conv;
-	struct gaim_account *account;
+	GaimAccount *account;
 	struct gaim_gtkpounce_data *pounce_data;
 	const char *pouncee;
 
@@ -429,7 +429,7 @@
 }
 
 struct gaim_pounce *
-gaim_gtkpounce_new(struct gaim_account *pouncer, const char *pouncee,
+gaim_gtkpounce_new(GaimAccount *pouncer, const char *pouncee,
 				   GaimPounceEvent events, GaimGtkPounceAction actions,
 				   const char *message, const char *command,
 				   const char *sound, gboolean save)
--- a/src/gtkpounce.h	Fri May 30 04:13:58 2003 +0000
+++ b/src/gtkpounce.h	Fri May 30 09:38:29 2003 +0000
@@ -82,7 +82,7 @@
  *
  * @return The new buddy pounce.
  */
-struct gaim_pounce *gaim_gtkpounce_new(struct gaim_account *pouncer,
+struct gaim_pounce *gaim_gtkpounce_new(GaimAccount *pouncer,
 									   const char *pouncee,
 									   GaimPounceEvent events,
 									   GaimGtkPounceAction actions,
--- a/src/gtkprefs.c	Fri May 30 04:13:58 2003 +0000
+++ b/src/gtkprefs.c	Fri May 30 09:38:29 2003 +0000
@@ -2672,6 +2672,10 @@
 	gaim_prefs_add_none("/plugins/gtk/docklet");
 	gaim_prefs_add_bool("/plugins/gtk/docklet/queue_messages", FALSE);
 
+	/* Accounts Dialog */
+	gaim_prefs_add_int("/gaim/gtk/accounts/dialog/width",  550);
+	gaim_prefs_add_int("/gaim/gtk/accounts/dialog/height", 250);
+
 	/* Browsers */
 	gaim_prefs_add_none("/gaim/gtk/browsers");
 	gaim_prefs_add_bool("/gaim/gtk/browsers/new_window", FALSE);
--- a/src/idle.c	Fri May 30 04:13:58 2003 +0000
+++ b/src/idle.c	Fri May 30 09:38:29 2003 +0000
@@ -48,7 +48,8 @@
 gint check_idle(gpointer data)
 {
 	const char *report_idle;
-	struct gaim_connection *gc = data;
+	GaimConnection *gc = data;
+	GaimAccount *account;
 	time_t t;
 #ifdef USE_SCREENSAVER
 #ifndef _WIN32
@@ -57,6 +58,8 @@
 #endif
 	int idle_time;
 
+	account = gaim_connection_get_account(gc);
+
 	gaim_event_broadcast(event_blist_update);
 
 	time(&t);
@@ -80,15 +83,16 @@
 #endif
 	} else
 #endif /* USE_SCREENSAVER */
-		idle_time = t - gc->lastsent;
+		idle_time = t - gc->last_sent_time;
 
 	if (gaim_prefs_get_bool("/core/away/away_when_idle") &&
 		(idle_time > (60 * auto_away)) && (!gc->is_auto_away)) {
 
 		if (!gc->away) {
 			gaim_debug(GAIM_DEBUG_INFO, "idle",
-					   "Making %s away automatically\n", gc->username);
-			if (g_slist_length(connections) == 1)
+					   "Making %s away automatically\n",
+					   gaim_account_get_username(account));
+			if (g_list_length(gaim_connections_get_all()) == 1)
 				do_away_message(NULL, default_away);
 			else if (default_away)
 				serv_set_away(gc, GAIM_AWAY_CUSTOM, default_away->message);
@@ -104,15 +108,15 @@
 		gc->is_auto_away = 0;
 		if (awaymessage == NULL) {
 			gaim_debug(GAIM_DEBUG_INFO, "idle",
-					   "Removing auto-away message for %s\n", gc->username);
+					   "Removing auto-away message for %s\n", gaim_account_get_username(account));
 			serv_set_away(gc, GAIM_AWAY_CUSTOM, NULL);
 		} else {
-			if (g_slist_length(connections) == 1)
+			if (g_list_length(gaim_connections_get_all()) == 1)
 				do_im_back(0, 0);
 			else {
 				gaim_debug(GAIM_DEBUG_INFO, "idle",
 						   "Replacing auto-away with global for %s\n",
-						   gc->username);
+						   gaim_account_get_username(account));
 				serv_set_away(gc, GAIM_AWAY_CUSTOM, awaymessage->message);
 			}
 		}
@@ -128,13 +132,13 @@
 
 	if (idle_time >= IDLEMARK && !gc->is_idle) {
 		gaim_debug(GAIM_DEBUG_INFO, "idle", "Setting %s idle %d seconds\n",
-				   gc->username, idle_time);
+				   gaim_account_get_username(account), idle_time);
 		serv_set_idle(gc, idle_time);
 		gc->is_idle = 1;
 		system_log(log_idle, gc, NULL, OPT_LOG_BUDDY_IDLE | OPT_LOG_MY_SIGNON);
 	} else if (idle_time < IDLEMARK && gc->is_idle) {
 		gaim_debug(GAIM_DEBUG_INFO, "idle", "Setting %s unidle\n",
-				   gc->username);
+				   gaim_account_get_username(account));
 		serv_touch_idle(gc);
 		system_log(log_unidle, gc, NULL, OPT_LOG_BUDDY_IDLE | OPT_LOG_MY_SIGNON);
 	}
--- a/src/log.c	Fri May 30 04:13:58 2003 +0000
+++ b/src/log.c	Fri May 30 09:38:29 2003 +0000
@@ -283,12 +283,15 @@
 	return fd;
 }
 
-void system_log(enum log_event what, struct gaim_connection *gc,
+void system_log(enum log_event what, GaimConnection *gc,
 				struct buddy *who, int why)
 {
+	GaimAccount *account;
 	FILE *fd;
 	char text[256], html[256];
 
+	account = gaim_connection_get_account(gc);
+
 	if (((why & OPT_LOG_MY_SIGNON) &&
 		 !gaim_prefs_get_bool("/gaim/gtk/logging/log_own_states"))) {
 
@@ -297,7 +300,7 @@
 
 	if (gaim_prefs_get_bool("/gaim/gtk/logging/individual_logs")) {
 		if (why & OPT_LOG_MY_SIGNON)
-			fd = open_system_log_file(gc ? gc->username : NULL);
+			fd = open_system_log_file(gc ? (char *)gaim_account_get_username(account) : NULL);
 		else
 			fd = open_system_log_file(who->name);
 	} else
@@ -310,32 +313,32 @@
 		switch (what) {
 		case log_signon:
 			g_snprintf(text, sizeof(text), _("+++ %s (%s) signed on @ %s"),
-				   gc->username, gc->prpl->info->name, full_date());
+				   gaim_account_get_username(account), gc->prpl->info->name, full_date());
 			g_snprintf(html, sizeof(html), "<B>%s</B>", text);
 			break;
 		case log_signoff:
 			g_snprintf(text, sizeof(text), _("+++ %s (%s) signed off @ %s"),
-				   gc->username, gc->prpl->info->name, full_date());
+				   gaim_account_get_username(account), gc->prpl->info->name, full_date());
 			g_snprintf(html, sizeof(html), "<I><FONT COLOR=GRAY>%s</FONT></I>", text);
 			break;
 		case log_away:
 			g_snprintf(text, sizeof(text), _("+++ %s (%s) changed away state @ %s"),
-				   gc->username, gc->prpl->info->name, full_date());
+				   gaim_account_get_username(account), gc->prpl->info->name, full_date());
 			g_snprintf(html, sizeof(html), "<FONT COLOR=OLIVE>%s</FONT>", text);
 			break;
 		case log_back:
 			g_snprintf(text, sizeof(text), _("+++ %s (%s) came back @ %s"),
-				   gc->username, gc->prpl->info->name, full_date());
+				   gaim_account_get_username(account), gc->prpl->info->name, full_date());
 			g_snprintf(html, sizeof(html), "%s", text);
 			break;
 		case log_idle:
 			g_snprintf(text, sizeof(text), _("+++ %s (%s) became idle @ %s"),
-				   gc->username, gc->prpl->info->name, full_date());
+				   gaim_account_get_username(account), gc->prpl->info->name, full_date());
 			g_snprintf(html, sizeof(html), "<FONT COLOR=GRAY>%s</FONT>", text);
 			break;
 		case log_unidle:
 			g_snprintf(text, sizeof(text), _("+++ %s (%s) returned from idle @ %s"),
-				   gc->username, gc->prpl->info->name, full_date());
+				   gaim_account_get_username(account), gc->prpl->info->name, full_date());
 			g_snprintf(html, sizeof(html), "%s", text);
 			break;
 		case log_quit:
@@ -347,32 +350,32 @@
 		switch (what) {
 		case log_signon:
 			g_snprintf(text, sizeof(text), _("%s (%s) reported that %s (%s) signed on @ %s"),
-				   gc->username, gc->prpl->info->name, gaim_get_buddy_alias(who), who->name, full_date());
+				   gaim_account_get_username(account), gc->prpl->info->name, gaim_get_buddy_alias(who), who->name, full_date());
 			g_snprintf(html, sizeof(html), "<B>%s</B>", text);
 			break;
 		case log_signoff:
 			g_snprintf(text, sizeof(text), _("%s (%s) reported that %s (%s) signed off @ %s"),
-				   gc->username, gc->prpl->info->name, gaim_get_buddy_alias(who), who->name, full_date());
+				   gaim_account_get_username(account), gc->prpl->info->name, gaim_get_buddy_alias(who), who->name, full_date());
 			g_snprintf(html, sizeof(html), "<I><FONT COLOR=GRAY>%s</FONT></I>", text);
 			break;
 		case log_away:
 			g_snprintf(text, sizeof(text), _("%s (%s) reported that %s (%s) went away @ %s"),
-				   gc->username, gc->prpl->info->name, gaim_get_buddy_alias(who), who->name, full_date());
+				   gaim_account_get_username(account), gc->prpl->info->name, gaim_get_buddy_alias(who), who->name, full_date());
 			g_snprintf(html, sizeof(html), "<FONT COLOR=OLIVE>%s</FONT>", text);
 			break;
 		case log_back:
 			g_snprintf(text, sizeof(text), _("%s (%s) reported that %s (%s) came back @ %s"),
-				   gc->username, gc->prpl->info->name, gaim_get_buddy_alias(who), who->name, full_date());
+				   gaim_account_get_username(account), gc->prpl->info->name, gaim_get_buddy_alias(who), who->name, full_date());
 			g_snprintf(html, sizeof(html), "%s", text);
 			break;
 		case log_idle:
 			g_snprintf(text, sizeof(text), _("%s (%s) reported that %s (%s) became idle @ %s"),
-				   gc->username, gc->prpl->info->name, gaim_get_buddy_alias(who), who->name, full_date());
+				   gaim_account_get_username(account), gc->prpl->info->name, gaim_get_buddy_alias(who), who->name, full_date());
 			g_snprintf(html, sizeof(html), "<FONT COLOR=GRAY>%s</FONT>", text);
 			break;
 		case log_unidle:
 			g_snprintf(text, sizeof(text),
-				   _("%s (%s) reported that %s (%s) returned from idle @ %s"), gc->username,
+				   _("%s (%s) reported that %s (%s) returned from idle @ %s"), gaim_account_get_username(account),
 				   gc->prpl->info->name, gaim_get_buddy_alias(who), who->name, full_date());
 			g_snprintf(html, sizeof(html), "%s", text);
 			break;
@@ -385,32 +388,32 @@
 		switch (what) {
 		case log_signon:
 			g_snprintf(text, sizeof(text), _("%s (%s) reported that %s signed on @ %s"),
-				   gc->username, gc->prpl->info->name, who->name, full_date());
+				   gaim_account_get_username(account), gc->prpl->info->name, who->name, full_date());
 			g_snprintf(html, sizeof(html), "<B>%s</B>", text);
 			break;
 		case log_signoff:
 			g_snprintf(text, sizeof(text), _("%s (%s) reported that %s signed off @ %s"),
-				   gc->username, gc->prpl->info->name, who->name, full_date());
+				   gaim_account_get_username(account), gc->prpl->info->name, who->name, full_date());
 			g_snprintf(html, sizeof(html), "<I><FONT COLOR=GRAY>%s</FONT></I>", text);
 			break;
 		case log_away:
 			g_snprintf(text, sizeof(text), _("%s (%s) reported that %s went away @ %s"),
-				   gc->username, gc->prpl->info->name, who->name, full_date());
+				   gaim_account_get_username(account), gc->prpl->info->name, who->name, full_date());
 			g_snprintf(html, sizeof(html), "<FONT COLOR=OLIVE>%s</FONT>", text);
 			break;
 		case log_back:
 			g_snprintf(text, sizeof(text), _("%s (%s) reported that %s came back @ %s"),
-				   gc->username, gc->prpl->info->name, who->name, full_date());
+				   gaim_account_get_username(account), gc->prpl->info->name, who->name, full_date());
 			g_snprintf(html, sizeof(html), "%s", text);
 			break;
 		case log_idle:
 			g_snprintf(text, sizeof(text), _("%s (%s) reported that %s became idle @ %s"),
-				   gc->username, gc->prpl->info->name, who->name, full_date());
+				   gaim_account_get_username(account), gc->prpl->info->name, who->name, full_date());
 			g_snprintf(html, sizeof(html), "<FONT COLOR=GRAY>%s</FONT>", text);
 			break;
 		case log_unidle:
 			g_snprintf(text, sizeof(text),
-				   _("%s (%s) reported that %s returned from idle @ %s"), gc->username,
+				   _("%s (%s) reported that %s returned from idle @ %s"), gaim_account_get_username(account),
 				   gc->prpl->info->name, who->name, full_date());
 			g_snprintf(html, sizeof(html), "%s", text);
 			break;
--- a/src/main.c	Fri May 30 04:13:58 2003 +0000
+++ b/src/main.c	Fri May 30 09:38:29 2003 +0000
@@ -50,8 +50,10 @@
 #include "sound.h"
 #include "gaim.h"
 #include "gaim-socket.h"
+#include "account.h"
 #include "prefs.h"
 #include "notify.h"
+#include "gtkaccount.h"
 #include "gtkblist.h"
 #include "gtkdebug.h"
 #include "gtknotify.h"
@@ -119,7 +121,7 @@
 	gaim_event_broadcast(event_quit);
 
 	/* transmission ends */
-	signoff_all();
+	gaim_connections_disconnect_all();
 
 	/* record what we have before we blow it away... */
 	save_prefs();
@@ -156,7 +158,7 @@
 /* we need to do this for Oscar because serv_login only starts the login
  * process, it doesn't end there. gaim_setup will be called later from
  * oscar.c, after the buddy list is made and serv_finish_login is called */
-void gaim_setup(struct gaim_connection *gc)
+void gaim_setup(GaimConnection *gc)
 {
 	if (gaim_prefs_get_bool("/core/sound/login") && gaim_prefs_get_bool("/core/sound/silent_signon")) {
 		if(snd_tmout) {
@@ -172,13 +174,14 @@
 	if (event->button != 2)
 		return FALSE;
 
-	auto_login();
+	/* TODO auto_login(); */
+
 	return TRUE;
 }
 
 static void dologin(GtkWidget *widget, GtkWidget *w)
 {
-	struct gaim_account *account;
+	GaimAccount *account;
 	const char *username = gtk_entry_get_text(GTK_ENTRY(GTK_COMBO(name)->entry));
 	const char *password = gtk_entry_get_text(GTK_ENTRY(pass));
 
@@ -192,13 +195,15 @@
 	 * the second one */
 
 	account = gaim_account_find(username, -1);
-	if (!account)
-		account = gaim_account_new(username, GAIM_PROTO_DEFAULT,
-								   OPT_ACCT_REM_PASS);
+	if (!account) {
+		account = gaim_account_new(username, GAIM_PROTO_DEFAULT);
 
-	g_snprintf(account->password, sizeof account->password, "%s", password);
-	save_prefs();
-	serv_login(account);
+		gaim_account_set_remember_password(account, TRUE);
+	}
+
+	gaim_account_set_password(account, password);
+
+	gaim_account_connect(account);
 }
 
 /* <name> is a comma-separated list of names, or NULL
@@ -210,7 +215,7 @@
 */
 static int dologin_named(char *name)
 {
-	struct gaim_account *account;
+	GaimAccount *account;
 	char **names, **n;
 	int retval = -1;
 
@@ -219,7 +224,7 @@
 		for (n = names; *n != NULL; n++) {
 			account = gaim_account_find(*n, -1);
 			if (account) {	/* found a user */
-				if (account->options & OPT_ACCT_REM_PASS) {
+				if (gaim_account_get_remember_password(account)) {
 					retval = 0;
 					serv_login(account);
 				}
@@ -227,8 +232,9 @@
 		}
 		g_strfreev(names);
 	} else {		/* no name given, use default */
-		account = (struct gaim_account *)gaim_accounts->data;
-		if (account->options & OPT_ACCT_REM_PASS) {
+		account = (GaimAccount *)gaim_accounts->data;
+
+		if (gaim_account_get_remember_password(account)) {
 			retval = 0;
 			serv_login(account);
 		}
@@ -253,11 +259,11 @@
 static void combo_changed(GtkWidget *w, GtkWidget *combo)
 {
 	const char *txt = gtk_entry_get_text(GTK_ENTRY(GTK_COMBO(combo)->entry));
-	struct gaim_account *account;
+	GaimAccount *account;
 
 	account = gaim_account_find(txt, -1);
 
-	if (account && account->options & OPT_ACCT_REM_PASS) {
+	if (account && gaim_account_get_remember_password(account)) {
 		gtk_entry_set_text(GTK_ENTRY(pass), account->password);
 	} else {
 		gtk_entry_set_text(GTK_ENTRY(pass), "");
@@ -269,13 +275,13 @@
 {
 	GSList *accts = gaim_accounts;
 	GList *tmp = NULL;
-	struct gaim_account *account;
+	GaimAccount *account;
 
 	if (!accts)
 		return g_list_append(NULL, _("<New User>"));
 
 	while (accts) {
-		account = (struct gaim_account *)accts->data;
+		account = (GaimAccount *)accts->data;
 		tmp = g_list_append(tmp, account->username);
 		accts = accts->next;
 	}
@@ -367,7 +373,7 @@
 	button = gaim_pixbuf_button_from_stock(_("Accounts"), GAIM_STOCK_ACCOUNTS, GAIM_BUTTON_VERTICAL);
 	gtk_button_set_relief(GTK_BUTTON(button), GTK_RELIEF_NONE);
 	g_signal_connect(G_OBJECT(button), "clicked",
-					 G_CALLBACK(account_editor), mainwindow);
+					 G_CALLBACK(gaim_gtk_account_dialog_show), mainwindow);
 	gtk_box_pack_start(GTK_BOX(hbox), button, FALSE, FALSE, 0);
 
 #ifdef NO_MULTI
@@ -389,8 +395,9 @@
 
 	/* Now grab the focus that we need */
 	if (gaim_accounts) {
-		struct gaim_account *account = gaim_accounts->data;
-		if (account->options & OPT_ACCT_REM_PASS) {
+		GaimAccount *account = gaim_accounts->data;
+
+		if (gaim_account_get_remember_password(account)) {
 			combo_changed(NULL, name);
 			gtk_widget_grab_focus(button);
 		} else {
@@ -412,7 +419,7 @@
 	case SIGHUP:
 		gaim_debug(GAIM_DEBUG_WARNING, "sighandler",
 				   "Caught signal %d\n", sig);
-		signoff_all(NULL, NULL);
+		gaim_connections_disconnect_all();
 		break;
 	case SIGSEGV:
 		core_quit();
@@ -449,7 +456,7 @@
 	default:
 		gaim_debug(GAIM_DEBUG_WARNING, "sighandler",
 				   "Caught signal %d\n", sig);
-		signoff_all(NULL, NULL);
+		gaim_connections_disconnect_all();
 
 		gaim_plugins_unload_all();
 
@@ -578,12 +585,12 @@
 
 static void set_first_user(char *name)
 {
-	struct gaim_account *account;
+	GaimAccount *account;
 
 	account = gaim_account_find(name, -1);
 
 	if (!account) {		/* new user */
-		account = g_new0(struct gaim_account, 1);
+		account = g_new0(GaimAccount, 1);
 		g_snprintf(account->username, sizeof(account->username), "%s", name);
 		account->protocol = GAIM_PROTO_DEFAULT;
 		gaim_accounts = g_slist_prepend(gaim_accounts, account);
@@ -939,11 +946,11 @@
 	}
 
 	if (!opt_acct && !opt_nologin && gaim_session == 0)
-		auto_login();
+		; /* TODO auto_login(); */
 
 	if (opt_acct) {
-		account_editor(NULL, NULL);
-	} else if ((dologin_ret == -1) && !connections)
+		gaim_gtk_account_dialog_show();
+	} else if ((dologin_ret == -1) && !gaim_connections_get_all())
 		show_login();
 
 	gtk_main();
--- a/src/multi.c	Fri May 30 04:13:58 2003 +0000
+++ b/src/multi.c	Fri May 30 09:38:29 2003 +0000
@@ -37,15 +37,6 @@
 
 #define LOGIN_STEPS 5
 
-GSList *connections;
-int connecting_count = 0;
-
-static GtkWidget *acctedit = NULL;
-static GtkWidget *treeview = NULL; /* the treeview of names in the accteditor */
-static GtkListStore *model = NULL;
-
-static GSList *mod_accounts = NULL;
-
 enum
 {
 	COLUMN_SCREENNAME,
@@ -56,101 +47,6 @@
 	NUM_COLUMNS
 };
 
-struct mod_account {
-	struct gaim_account *account;
-
-	/* these are temporary */
-	char username[64];
-	char show[400];
-	char password[32];
-	int options;
-	int protocol;
-	char proto_opt[7][256];
-
-	/* stuff for modify window */
-	GtkWidget *mod;
-	GtkWidget *main;
-	GtkWidget *disc_box;
-	GtkWidget *name;
-	GtkWidget *alias;
-	GtkWidget *pwdbox;
-	GtkWidget *pass;
-	GtkWidget *rempass;
-	GtkWidget *login_frame;
-	GtkWidget *user_frame;
-	GtkWidget *proto_frame;
-	GtkSizeGroup *sg;
-	GList *user_split_entries;
-	GList *opt_entries;
-
-	/* stuff for icon selection */
-	char iconfile[256];
-	GtkWidget *iconsel;
-	GtkWidget *iconentry;
-	GtkWidget *icondlg;
-
-	/* stuff for mail check prompt */
-	GtkWidget *checkmail;
-
-	/* stuff for register with server */
-	GtkWidget *register_user;
-
-	/* stuff for proxy options */
-	GtkWidget *proxy_frame;
-	GtkWidget *proxy_host_box;
-	GtkWidget *proxytype_menu;
-	GtkWidget *proxyhost_entry;
-	GtkWidget *proxyport_entry;
-	GtkWidget *proxyuser_entry;
-	GtkWidget *proxypass_entry;
-};
-
-
-struct mod_account_opt {
-	struct mod_account *ma;
-	int opt;
-};
-
-static void acct_signin(GtkCellRendererToggle *cell, gchar *path_str,
-						gpointer d);
-static void acct_autologin(GtkCellRendererToggle *cell, gchar *path_str,
-						   gpointer d);
-
-static struct mod_account *mod_account_find(struct gaim_account *a)
-{
-	GSList *m = mod_accounts;
-	while (m) {
-		struct mod_account *ma = m->data;
-		if (ma->account == a)
-			return ma;
-		m = m->next;
-	}
-	return NULL;
-}
-
-
-struct gaim_connection *new_gaim_conn(struct gaim_account *account)
-{
-	struct gaim_connection *gc = g_new0(struct gaim_connection, 1);
-	gc->edittype = EDIT_GC;
-	gc->protocol = account->protocol;
-	gc->prpl = gaim_find_prpl(account->protocol);
-	g_snprintf(gc->username, sizeof(gc->username), "%s", account->username);
-	g_snprintf(gc->password, sizeof(gc->password), "%s", account->password);
-	gc->keepalive = 0;
-	gc->inpa = 0;
-	gc->buddy_chats = NULL;
-	gc->away = NULL;
-	gc->away_state = NULL;
-
-	connections = g_slist_append(connections, gc);
-
-	account->gc = gc;
-	gc->account = account;
-
-	return gc;
-}
-
 struct meter_window {
 		GtkWidget *window;
 		GtkTable *table;
@@ -158,1488 +54,15 @@
 		gint active_count;
 	} *meter_win = NULL;
 
-void destroy_gaim_conn(struct gaim_connection *gc)
-{
-	GaimBlistNode *gnode,*bnode;
-	struct group *m;
-	struct buddy *n;
-	for(gnode = gaim_get_blist()->root; gnode; gnode = gnode->next) {
-		if(!GAIM_BLIST_NODE_IS_GROUP(gnode))
-			continue;
-		m = (struct group *)gnode;
-		for(bnode = gnode->child; bnode; bnode = bnode->next) {
-			if(GAIM_BLIST_NODE_IS_BUDDY(bnode)) {
-				n = (struct buddy *)bnode;
-				if(n->account == gc->account) {
-					n->present = GAIM_BUDDY_OFFLINE;
-				}
-			}
-		}
-	}
-	g_free(gc->away);
-	g_free(gc->away_state);
-	g_free(gc);
-
-	if (!connections && mainwindow)
-		gtk_widget_show(mainwindow);
-}
-
-static void quit_acctedit(gpointer d)
-{
-	if (acctedit) {
-		save_prefs();
-		gtk_widget_destroy(acctedit);
-		acctedit = NULL;
-	}
-
-	treeview = NULL;
-
-	if (!d && !GAIM_GTK_BLIST(gaim_get_blist())->window &&
-		!mainwindow && !connections) {
-
-		do_quit();
-	}
-}
-
-static void on_delete_acctedit(GtkWidget *w, GdkEvent *ev, gpointer d)
-{
-	quit_acctedit(d);
-}
-
-static void on_close_acctedit(GtkButton *button, gpointer d)
-{
-	quit_acctedit(d);
-}
-
-static char *proto_name(int proto)
-{
-	GaimPlugin *p = gaim_find_prpl(proto);
-	if (p && p->info->name)
-		return p->info->name;
-	else
-		return "Unknown";
-}
-
-void regenerate_user_list()
-{
-	GSList *accounts = gaim_accounts;
-	struct gaim_account *a;
-	GtkTreeIter iter;
-
-	if (!acctedit)
-		return;
-
-	gtk_list_store_clear(model);
-
-	while (accounts) {
-		a = (struct gaim_account *)accounts->data;
-
-		gtk_list_store_append(model, &iter);
-		gtk_list_store_set(model, &iter,
-						   COLUMN_SCREENNAME, a->username,
-						   COLUMN_ONLINE, (a->gc ? TRUE : FALSE),
-						   COLUMN_AUTOLOGIN, (a->options & OPT_ACCT_AUTO),
-						   COLUMN_PROTOCOL, proto_name(a->protocol),
-						   COLUMN_DATA, a,
-						   -1);
-		accounts = accounts->next;
-	}
-}
-
-static gboolean get_iter_from_data(GtkTreeView *treeview,
-								   struct gaim_account *a, GtkTreeIter *iter)
-{
-	return gtk_tree_model_iter_nth_child(gtk_tree_view_get_model(treeview),
-										 iter, NULL,
-										 g_slist_index(gaim_accounts, a));
-}
-
-static void add_columns(GtkWidget *treeview)
-{
-	GtkCellRenderer *renderer;
-	/* GtkTreeViewColumn *column; */
-
-	/* Screennames */
-	renderer = gtk_cell_renderer_text_new();
-	gtk_tree_view_insert_column_with_attributes(GTK_TREE_VIEW(treeview),
-												-1, _("Screenname"),
-												renderer,
-												"text", COLUMN_SCREENNAME,
-												NULL);
-
-	/* Online? */
-	renderer = gtk_cell_renderer_toggle_new();
-	g_signal_connect(G_OBJECT(renderer), "toggled",
-					 G_CALLBACK(acct_signin), model);
-	gtk_tree_view_insert_column_with_attributes(GTK_TREE_VIEW(treeview),
-												-1, _("Online"),
-												renderer,
-												"active", COLUMN_ONLINE,
-												NULL);
-
-	/* Auto-login? */
-	renderer = gtk_cell_renderer_toggle_new();
-	g_signal_connect(G_OBJECT(renderer), "toggled",
-					 G_CALLBACK(acct_autologin), model);
-	gtk_tree_view_insert_column_with_attributes(GTK_TREE_VIEW(treeview),
-												-1, _("Auto-login"),
-												renderer,
-												"active", COLUMN_AUTOLOGIN,
-												NULL);
-
-	/* Protocol */
-	renderer = gtk_cell_renderer_text_new();
-	gtk_tree_view_insert_column_with_attributes(GTK_TREE_VIEW(treeview),
-												-1, _("Protocol"),
-												renderer,
-												"text", COLUMN_PROTOCOL,
-												NULL);
-
-	/* Data */
-	/*
-	column = gtk_tree_view_column_new();
-	gtk_tree_view_insert_column(GTK_TREE_VIEW(treeview), column, -1);
-	gtk_tree_view_column_set_visible(column, FALSE);
-	*/
-}
-
-static void
-__rows_reordered_cb(GtkTreeModel *model, GtkTreePath *arg1,
-					GtkTreeIter *arg2, int *new_order, gpointer user_data)
-{
-	GSList *accounts = gaim_accounts;
-	GSList *new_accounts = NULL;
-	struct gaim_account **account_array;
-	int count, i;
-
-	gaim_debug(GAIM_DEBUG_INFO, "accounts", "Reordering accounts\n");
-
-	count = g_slist_length(accounts);
-
-	/* Grr. */
-	account_array = g_new(struct gaim_account *, count);
-
-	/* I hate this. */
-	for (i = 0; i < count; i++, accounts = accounts->next)
-		account_array[new_order[i]] = accounts->data;
-
-	/* I hate this too. */
-	for (i = 0; i < count; i++)
-		new_accounts = g_slist_append(new_accounts, account_array[i]);
-
-	gaim_accounts = new_accounts;
-
-	g_slist_free(accounts);
-	g_free(account_array);
-
-	save_prefs();
-}
-
-static GtkWidget *generate_list()
-{
-	GtkWidget *win;
-
-	win = gtk_scrolled_window_new(0, 0);
-	gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(win),
-								   GTK_POLICY_AUTOMATIC,
-								   GTK_POLICY_ALWAYS);
-	gtk_scrolled_window_set_shadow_type(GTK_SCROLLED_WINDOW(win),
-										GTK_SHADOW_IN);
-
-	/* Create the list model. */
-	model = gtk_list_store_new(NUM_COLUMNS, G_TYPE_STRING, G_TYPE_BOOLEAN,
-							   G_TYPE_BOOLEAN, G_TYPE_STRING, G_TYPE_POINTER);
-
-	treeview = gtk_tree_view_new_with_model(GTK_TREE_MODEL(model));
-	gtk_tree_view_set_rules_hint(GTK_TREE_VIEW(treeview), TRUE);
-	gtk_tree_selection_set_mode(
-		gtk_tree_view_get_selection(GTK_TREE_VIEW(treeview)),
-		GTK_SELECTION_MULTIPLE);
-
-	add_columns(treeview);
-
-	gtk_container_add(GTK_CONTAINER(win), treeview);
-	gtk_widget_show(treeview);
-
-	regenerate_user_list();
-	gtk_tree_view_set_reorderable (GTK_TREE_VIEW(treeview), TRUE);
-	g_signal_connect(G_OBJECT(model), "rows-reordered",
-					 G_CALLBACK(__rows_reordered_cb), NULL);
-
-	gtk_widget_show(win);
-	return win;
-}
-
-static void delmod(GtkWidget *w, struct mod_account *ma)
-{
-	mod_accounts = g_slist_remove(mod_accounts, ma);
-	g_free(ma);
-}
-
-static void mod_opt(GtkWidget *b, struct mod_account_opt *mao)
-{
-	mao->ma->options = mao->ma->options ^ mao->opt;
-}
-
-static void free_mao(GtkWidget *b, struct mod_account_opt *mao)
-{
-	g_free(mao);
-}
-
-static GtkWidget *acct_button(const char *text, struct mod_account *ma, int option, GtkWidget *box)
-{
-	GtkWidget *button;
-	struct mod_account_opt *mao = g_new0(struct mod_account_opt, 1);
-	button = gtk_check_button_new_with_label(text);
-	gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(button), (ma->options & option));
-	gtk_box_pack_start(GTK_BOX(box), button, FALSE, FALSE, 0);
-	mao->ma = ma;
-	mao->opt = option;
-	g_signal_connect(G_OBJECT(button), "clicked", G_CALLBACK(mod_opt), mao);
-	g_signal_connect(G_OBJECT(button), "destroy", G_CALLBACK(free_mao), mao);
-	gtk_widget_show(button);
-	return button;
-}
-
-static void process_login_opts(struct mod_account *ma) {
-	GaimPlugin *p = gaim_find_prpl(ma->protocol);
-	const char *entry_text;
-	char *username = g_strdup(gtk_entry_get_text(GTK_ENTRY(ma->name)));
-	char *tmp;
-	GList *entries = ma->user_split_entries;
-	GList *user_splits = NULL;
-
-	if(p)
-		user_splits = GAIM_PLUGIN_PROTOCOL_INFO(p)->user_splits;
-
-	while(user_splits) {
-		GtkWidget *entry = entries->data;
-		struct proto_user_split *pus = user_splits->data;
-		char tmp_sep[2] = " ";
-		entry_text = gtk_entry_get_text(GTK_ENTRY(entry));
-
-		tmp_sep[0] = pus->sep;
-		tmp = g_strconcat(username, tmp_sep, *entry_text ? entry_text : pus->def, NULL);
-		g_free(username);
-		username = tmp;
-
-		entries = entries->next;
-		user_splits = user_splits->next;
-	}
-
-	g_snprintf(ma->username, sizeof(ma->username), "%s", username);
-	g_free(username);
-
-	entry_text = gtk_entry_get_text(GTK_ENTRY(ma->pass));
-	g_snprintf(ma->password, sizeof(ma->password), "%s", entry_text);
-
-	entry_text = gtk_entry_get_text(GTK_ENTRY(ma->alias));
-	g_snprintf(ma->show, sizeof(ma->show), "%s", entry_text);
-}
-
-static void ok_mod(GtkWidget *w, struct mod_account *ma)
-{
-	GList *tmp;
-	const char *txt;
-	struct gaim_account *a;
-	GaimPlugin *p = gaim_find_prpl(ma->protocol);
-	GaimPluginProtocolInfo *prpl_info = NULL;
-	GtkTreeIter iter;
-	int proxytype;
-
-	if (!ma->account) {
-		txt = gtk_entry_get_text(GTK_ENTRY(ma->name));
-		ma->account = gaim_account_new(txt, ma->protocol, ma->options);
-	}
-	a = ma->account;
-
-	a->options = ma->options;
-	a->protocol = ma->protocol;
-
-	process_login_opts(ma);
-	g_snprintf(a->username, sizeof(a->username), "%s", ma->username);
-	g_snprintf(a->alias, sizeof(a->alias), "%s", ma->show);
-
-	if (a->options & OPT_ACCT_REM_PASS)
-		g_snprintf(a->password, sizeof(a->password), "%s", ma->password);
-	else
-		a->password[0] = '\0';
-
-	if (get_iter_from_data(GTK_TREE_VIEW(treeview), a, &iter)) {
-		gtk_list_store_set(model, &iter,
-						   COLUMN_SCREENNAME, a->username,
-						   COLUMN_AUTOLOGIN, (a->options & OPT_ACCT_AUTO),
-						   COLUMN_PROTOCOL, proto_name(a->protocol),
-						   -1);
-	}
-
-#if 0
-	i = gtk_clist_find_row_from_data(GTK_CLIST(list), a);
-	gtk_clist_set_text(GTK_CLIST(list), i, 0, a->username);
-	gtk_clist_set_text(GTK_CLIST(list), i, 2,
-			   (a->options & OPT_ACCT_AUTO) ? "True" : "False");
-	gtk_clist_set_text(GTK_CLIST(list), i, 3, proto_name(a->protocol));
-#endif
-
-	tmp = ma->opt_entries;
-	while (tmp) {
-		GtkEntry *entry = tmp->data;
-		int pos = GPOINTER_TO_INT(g_object_get_data(G_OBJECT(entry), "position"));
-		g_snprintf(a->proto_opt[pos], sizeof(a->proto_opt[pos]), "%s",
-				   gtk_entry_get_text(entry));
-		tmp = tmp->next;
-	}
-	if (ma->opt_entries)
-		g_list_free(ma->opt_entries);
-	ma->opt_entries = NULL;
-
-	g_snprintf(a->iconfile, sizeof(a->iconfile), "%s", ma->iconfile);
-	if (ma->icondlg)
-		gtk_widget_destroy(ma->icondlg);
-	ma->icondlg = NULL;
-
-	if(ma->account->gpi)
-		g_free(ma->account->gpi);
-	ma->account->gpi = NULL;
-
-	proxytype = GPOINTER_TO_INT(g_object_get_data(
-				G_OBJECT(gtk_menu_get_active(GTK_MENU(ma->proxytype_menu))),
-				"proxytype"));
-
-	if(proxytype != PROXY_USE_GLOBAL) {
-		struct gaim_proxy_info *gpi = g_new0(struct gaim_proxy_info, 1);
-		gpi->proxytype = proxytype;
-		g_snprintf(gpi->proxyhost, sizeof(gpi->proxyhost), "%s", gtk_entry_get_text(GTK_ENTRY(ma->proxyhost_entry)));
-		gpi->proxyport = atoi(gtk_entry_get_text(GTK_ENTRY(ma->proxyport_entry)));
-		g_snprintf(gpi->proxyuser, sizeof(gpi->proxyuser), "%s", gtk_entry_get_text(GTK_ENTRY(ma->proxyuser_entry)));
-		g_snprintf(gpi->proxypass, sizeof(gpi->proxypass), "%s", gtk_entry_get_text(GTK_ENTRY(ma->proxypass_entry)));
-
-		ma->account->gpi = gpi;
-	}
-
-	prpl_info = GAIM_PLUGIN_PROTOCOL_INFO(p);
-
-	/*
-	 * See if user registration is supported/required
-	 */
-	if (!p) {
-		/* TBD: error dialog here! (This should never happen, you know...) */
-		fprintf(stderr, "dbg: couldn't find protocol for protocol number %d!\n", ma->protocol);
-		fflush(stderr);
-	} else {
-		if (prpl_info->register_user != NULL &&
-		   gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(ma->register_user)) == TRUE) {
-			prpl_info->register_user(a);
-		}
-	}
-
-	save_prefs();
-
-	gtk_widget_destroy(ma->mod);
-}
-
-static void cancel_mod(GtkWidget *w, struct mod_account *ma)
-{
-	if (ma->opt_entries)
-		g_list_free(ma->opt_entries);
-	ma->opt_entries = NULL;
-	if (ma->icondlg)
-		gtk_widget_destroy(ma->icondlg);
-	ma->icondlg = NULL;
-	gtk_widget_destroy(ma->mod);
-}
-
-static void generate_login_options(struct mod_account *ma, GtkWidget *box);
-static void generate_user_options(struct mod_account *ma, GtkWidget *box);
-static void generate_protocol_options(struct mod_account *ma, GtkWidget *box);
-
-static void set_prot(GtkWidget *opt, int proto)
-{
-	struct mod_account *ma = g_object_get_data(G_OBJECT(opt), "mod_account");
-	GaimPlugin *p;
-	if (ma->protocol != proto) {
-		int i;
-
-		for (i = 0; i < 7; i++)
-			ma->proto_opt[i][0] = '\0';
-		p = gaim_find_prpl(ma->protocol);
-
-		process_login_opts(ma);
-
-		ma->protocol = proto;
-
-		if(!ma->account)
-			g_snprintf(ma->username, sizeof(ma->username), "%s",
-					gtk_entry_get_text(GTK_ENTRY(ma->name)));
-
-		generate_login_options(ma, ma->main);
-		generate_user_options(ma, ma->main);
-		generate_protocol_options(ma, ma->disc_box);
-	}
-}
-
-static GtkWidget *make_protocol_menu(GtkWidget *box, struct mod_account *ma)
-{
-	GaimPluginProtocolInfo *prpl_info = NULL;
-	GtkWidget *optmenu;
-	GtkWidget *menu;
-	GtkWidget *opt;
-	GSList *p;
-	GaimPlugin *e;
-	int count = 0;
-	gboolean found = FALSE;
-
-	optmenu = gtk_option_menu_new();
-	gtk_box_pack_start(GTK_BOX(box), optmenu, FALSE, FALSE, 5);
-	gtk_widget_show(optmenu);
-
-	menu = gtk_menu_new();
-
-	for (p = protocols; p != NULL; p = p->next) {
-		e = (GaimPlugin *)p->data;
-		prpl_info = GAIM_PLUGIN_PROTOCOL_INFO(e);
-
-		if (prpl_info->protocol == ma->protocol)
-			found = TRUE;
-		if (!found)
-			count++;
-		if (e->info->name)
-			opt = gtk_menu_item_new_with_label(e->info->name);
-		else
-			opt = gtk_menu_item_new_with_label("Unknown");
-		g_object_set_data(G_OBJECT(opt), "mod_account", ma);
-		g_signal_connect(G_OBJECT(opt), "activate",
-						 G_CALLBACK(set_prot), (void *)prpl_info->protocol);
-		gtk_menu_shell_append(GTK_MENU_SHELL(menu), opt);
-		gtk_widget_show(opt);
-	}
-
-	gtk_option_menu_set_menu(GTK_OPTION_MENU(optmenu), menu);
-	gtk_option_menu_set_history(GTK_OPTION_MENU(optmenu), count);
-
-	return optmenu;
-}
-
-static void des_icon_sel(GtkWidget *w, struct mod_account *ma)
-{
-	w = ma->icondlg;
-	if (ma->icondlg)
-		ma->icondlg = NULL;
-	if (w)
-		gtk_widget_destroy(w);
-}
-
-static void set_icon(GtkWidget *w, struct mod_account *ma)
-{
-	GtkWidget *sel = ma->icondlg;
-	const char *file = gtk_file_selection_get_filename(GTK_FILE_SELECTION(sel));
-
-	if (file_is_dir(file, sel))
-		return;
-
-	gtk_entry_set_text(GTK_ENTRY(ma->iconentry), file);
-	g_snprintf(ma->iconfile, sizeof(ma->iconfile), "%s", file);
-	ma->icondlg = NULL;
-
-	gtk_widget_destroy(sel);
-}
-
-static void sel_icon_dlg(GtkWidget *w, struct mod_account *ma)
-{
-	GtkWidget *dlg;
-	char buf[256];
-
-	if (ma->icondlg) {
-		gtk_widget_show(ma->icondlg);
-		return;
-	}
-
-	dlg = gtk_file_selection_new(_("Load Buddy Icon"));
-	gtk_file_selection_hide_fileop_buttons(GTK_FILE_SELECTION(dlg));
-	if (ma->iconfile) {
-		char *tmp = g_path_get_dirname(ma->iconfile);
-		g_snprintf(buf, sizeof(buf), "%s" G_DIR_SEPARATOR_S, tmp);
-		g_free(tmp);
-	} else {
-		g_snprintf(buf, sizeof(buf), "%s" G_DIR_SEPARATOR_S, gaim_home_dir());
-	}
-	gtk_file_selection_set_filename(GTK_FILE_SELECTION(dlg), buf);
-
-	g_signal_connect(G_OBJECT(dlg), "destroy",
-					 G_CALLBACK(des_icon_sel), ma);
-	g_signal_connect(G_OBJECT(GTK_FILE_SELECTION(dlg)->cancel_button), "clicked",
-					 G_CALLBACK(des_icon_sel), ma);
-	g_signal_connect(G_OBJECT(GTK_FILE_SELECTION(dlg)->ok_button), "clicked",
-					 G_CALLBACK(set_icon), ma);
-
-	ma->icondlg = dlg;
-
-	gtk_widget_show(dlg);
-}
-
-static void reset_icon(GtkWidget *w, struct mod_account *ma)
-{
-	ma->iconfile[0] = 0;
-	gtk_entry_set_text(GTK_ENTRY(ma->iconentry), "");
-}
-
-static GtkWidget *build_icon_selection(struct mod_account *ma, GtkWidget *box)
-{
-	GtkWidget *hbox;
-	GtkWidget *label;
-	GtkWidget *name;
-	GtkWidget *browse;
-	GtkWidget *reset;
-
-	if (ma->account)
-		g_snprintf(ma->iconfile, sizeof(ma->iconfile), "%s", ma->account->iconfile);
-
-	hbox = gtk_hbox_new(FALSE, 0);
-	gtk_box_pack_start(GTK_BOX(box), hbox, FALSE, FALSE, 5);
-	gtk_widget_show(hbox);
-
-	label = gtk_label_new(_("Buddy Icon File:"));
-	gtk_size_group_add_widget(ma->sg, label);
-	gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5);
-	gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0);
-	gtk_widget_show(label);
-
-	name = gtk_entry_new();
-	gtk_entry_set_text(GTK_ENTRY(name), ma->iconfile);
-	gtk_editable_set_editable(GTK_EDITABLE(name), FALSE);
-	gtk_box_pack_start(GTK_BOX(hbox), name, TRUE, TRUE, 5);
-	gtk_widget_show(name);
-	ma->iconentry = name;
-
-	browse = gtk_button_new_with_label(_("Browse"));
-	g_signal_connect(G_OBJECT(browse), "clicked",
-					 G_CALLBACK(sel_icon_dlg), ma);
-	gtk_box_pack_start(GTK_BOX(hbox), browse, FALSE, FALSE, 0);
-	gtk_widget_show(browse);
-
-	reset = gtk_button_new_with_label(_("Reset"));
-	g_signal_connect(G_OBJECT(reset), "clicked",
-					 G_CALLBACK(reset_icon), ma);
-	gtk_box_pack_start(GTK_BOX(hbox), reset, FALSE, FALSE, 0);
-	gtk_widget_show(reset);
-
-	return hbox;
-}
-
-static void generate_login_options(struct mod_account *ma, GtkWidget *box)
-{
-	GtkWidget *frame;
-	GtkWidget *vbox;
-	GtkWidget *hbox;
-	GtkWidget *label;
-	GList *user_splits = NULL;
-	GList *split_entries;
-
-	GaimPlugin *p;
-
-	char *username = NULL;
-	char *start;
-
-	if(ma->login_frame)
-		gtk_widget_destroy(ma->login_frame);
-	ma->login_frame = NULL;
-
-	frame = gaim_gtk_make_frame(box, _("Login Options"));
-	ma->login_frame = gtk_widget_get_parent(gtk_widget_get_parent(frame));
-	gtk_box_reorder_child(GTK_BOX(box), ma->login_frame, 0);
-
-	vbox = gtk_vbox_new(FALSE, 5);
-	gtk_container_set_border_width(GTK_CONTAINER(vbox), 5);
-	gtk_container_add(GTK_CONTAINER(frame), vbox);
-
-	hbox = gtk_hbox_new(FALSE, 5);
-	gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0);
-	gtk_widget_show(hbox);
-
-	label = gtk_label_new(_("Protocol:"));
-	gtk_size_group_add_widget(ma->sg, label);
-	gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5);
-	gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0);
-
-	make_protocol_menu(hbox, ma);
-
-	hbox = gtk_hbox_new(FALSE, 5);
-	gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0);
-
-	p = gaim_find_prpl(ma->protocol);
-
-	if(p)
-		user_splits = GAIM_PLUGIN_PROTOCOL_INFO(p)->user_splits;
-
-	label = gtk_label_new(_("Screenname:"));
-	gtk_size_group_add_widget(ma->sg, label);
-	gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5);
-	gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0);
-
-	ma->name = gtk_entry_new();
-	gtk_box_pack_start(GTK_BOX(hbox), ma->name, TRUE, TRUE, 0);
-
-	if(ma->user_split_entries) {
-		g_list_free(ma->user_split_entries);
-		ma->user_split_entries = NULL;
-	}
-
-	while(user_splits) {
-		struct proto_user_split *pus = user_splits->data;
-		GtkWidget *entry;
-
-		hbox = gtk_hbox_new(FALSE, 5);
-		gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0);
-
-		label = gtk_label_new(pus->label);
-		gtk_size_group_add_widget(ma->sg, label);
-		gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5);
-		gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0);
-		user_splits = user_splits->next;
-
-		entry = gtk_entry_new();
-		gtk_box_pack_start(GTK_BOX(hbox), entry, TRUE, TRUE, 0);
-
-		ma->user_split_entries = g_list_append(ma->user_split_entries, entry);
-	}
-
-	ma->pwdbox = gtk_hbox_new(FALSE, 5);
-	gtk_box_pack_start(GTK_BOX(vbox), ma->pwdbox, FALSE, FALSE, 0);
-
-	label = gtk_label_new(_("Password:"));
-	gtk_size_group_add_widget(ma->sg, label);
-	gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5);
-	gtk_box_pack_start(GTK_BOX(ma->pwdbox), label, FALSE, FALSE, 0);
-
-	ma->pass = gtk_entry_new();
-	gtk_box_pack_start(GTK_BOX(ma->pwdbox), ma->pass, TRUE, TRUE, 0);
-	gtk_entry_set_visibility(GTK_ENTRY(ma->pass), FALSE);
-
-	hbox = gtk_hbox_new(FALSE, 5);
-	gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0);
-
-	label = gtk_label_new(_("Alias:"));
-	gtk_size_group_add_widget(ma->sg, label);
-	gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5);
-	gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0);
-
-	ma->alias = gtk_entry_new();
-	gtk_box_pack_start(GTK_BOX(hbox), ma->alias, TRUE, TRUE, 0);
-
-	ma->rempass = acct_button(_("Remember Password"), ma, OPT_ACCT_REM_PASS, vbox);
-	acct_button(_("Auto-Login"), ma, OPT_ACCT_AUTO, vbox);
-
-	gtk_widget_show_all(ma->login_frame);
-
-	if (p)
-		user_splits = g_list_last(GAIM_PLUGIN_PROTOCOL_INFO(p)->user_splits);
-
-	username = g_strdup(ma->username);
-	split_entries = g_list_last(ma->user_split_entries);
-
-	while(user_splits) {
-		struct proto_user_split *pus = user_splits->data;
-		GtkWidget *entry = split_entries->data;
-		start = strrchr(username, pus->sep);
-		if(start) {
-			*start = '\0';
-			start++;
-			gtk_entry_set_text(GTK_ENTRY(entry), start);
-		} else {
-			gtk_entry_set_text(GTK_ENTRY(entry), pus->def);
-		}
-		user_splits = user_splits->prev;
-		split_entries = split_entries->prev;
-	}
-
-	gtk_entry_set_text(GTK_ENTRY(ma->name), username);
-	gtk_entry_set_text(GTK_ENTRY(ma->alias), ma->show);
-	gtk_entry_set_text(GTK_ENTRY(ma->pass), ma->password);
-	g_free(username);
-
-	if (p && (GAIM_PLUGIN_PROTOCOL_INFO(p)->options & OPT_PROTO_NO_PASSWORD)) {
-		gtk_widget_hide(ma->pwdbox);
-		gtk_widget_hide(ma->rempass);
-	}
-}
-
-static void generate_user_options(struct mod_account *ma, GtkWidget *box)
-{
-	/* This function will add the appropriate (depending on the current
-	 * protocol) widgets to frame and return TRUE if there anything
-	 * was added (meaning the frame should be shown)
-	 * Eric will most likely change this (as he does all other submitted code)
-	 * so that it will accept the vbox as an argument and create, add, and show
-	 * the frame itself (like generate_protocol_options).  I'd do it myself, but I'm
-	 * tired and I don't care. */
-	/* Sean was right. I did do that. I told him I would. */
-
-	GtkWidget *vbox;
-	GtkWidget *frame;
-	GaimPluginProtocolInfo *prpl_info = NULL;
-
-	GaimPlugin *p = gaim_find_prpl(ma->protocol);
-
-	if(ma->user_frame)
-		gtk_widget_destroy(ma->user_frame);
-	ma->user_frame = NULL;
-
-	frame = gaim_gtk_make_frame(box, _("User Options"));
-	ma->user_frame = gtk_widget_get_parent(gtk_widget_get_parent(frame));
-	gtk_box_reorder_child(GTK_BOX(box), ma->user_frame, 1);
-	gtk_widget_show_all(ma->user_frame);
-
-	vbox = gtk_vbox_new(FALSE, 5);
-	gtk_container_set_border_width(GTK_CONTAINER(vbox), 5);
-	gtk_container_add(GTK_CONTAINER(frame), vbox);
-	gtk_widget_show(vbox);
-
-	ma->checkmail = acct_button(_("New Mail Notifications"), ma, OPT_ACCT_MAIL_CHECK, vbox);
-	ma->iconsel = build_icon_selection(ma, vbox);
-
-	if (!p) {
-		gtk_widget_hide(ma->user_frame);
-		return;
-	}
-
-	prpl_info = GAIM_PLUGIN_PROTOCOL_INFO(p);
-
-	if (!(prpl_info->options & OPT_PROTO_MAIL_CHECK))
-		gtk_widget_hide(ma->checkmail);
-	if (!(prpl_info->options & OPT_PROTO_BUDDY_ICON))
-		gtk_widget_hide(ma->iconsel);
-
-	if ((prpl_info->options & OPT_PROTO_BUDDY_ICON) ||
-		(prpl_info->options & OPT_PROTO_MAIL_CHECK)) {
-
-		return;
-	}
-
-	gtk_widget_hide(ma->user_frame);
-}
-
-static void generate_protocol_options(struct mod_account *ma, GtkWidget *box)
-{
-	GaimPlugin *p = gaim_find_prpl(ma->protocol);
-	GaimPluginProtocolInfo *prpl_info = NULL;
-
-	GList *op, *tmp;
-
-	GtkWidget *vbox;
-	GtkWidget *hbox;
-	GtkWidget *label;
-	GtkWidget *entry;
-	GtkWidget *frame;
-
-	char buf[256];
-
-	if (ma->proto_frame)
-		gtk_widget_destroy(ma->proto_frame);
-	ma->proto_frame = NULL;
-
-	if (ma->opt_entries) {
-		g_list_free(ma->opt_entries);
-		ma->opt_entries = NULL;
-	}
-
-	if (!p)
-		return;
-
-	prpl_info = GAIM_PLUGIN_PROTOCOL_INFO(p);
-
-	if (!prpl_info->user_opts)
-		return;
-
-	tmp = op = prpl_info->user_opts;
-
-	if (!op)
-		return;
-
-	g_snprintf(buf, sizeof(buf), _("%s Options"), p->info->name);
-	frame = gaim_gtk_make_frame(box, buf);
-
-	/* BLEH */
-	ma->proto_frame = gtk_widget_get_parent(gtk_widget_get_parent(frame));
-	gtk_box_reorder_child(GTK_BOX(box), ma->proto_frame, 0);
-	gtk_widget_show_all(ma->proto_frame);
-
-	vbox = gtk_vbox_new(FALSE, 5);
-	gtk_container_set_border_width(GTK_CONTAINER(vbox), 5);
-	gtk_container_add(GTK_CONTAINER(frame), vbox);
-	gtk_widget_show(vbox);
-
-	while (op) {
-		struct proto_user_opt *puo = op->data;
-
-		hbox = gtk_hbox_new(FALSE, 5);
-		gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0);
-		gtk_widget_show(hbox);
-
-		label = gtk_label_new(puo->label);
-		gtk_size_group_add_widget(ma->sg, label);
-		gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5);
-		gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0);
-		gtk_widget_show(label);
-
-		entry = gtk_entry_new();
-		gtk_box_pack_end(GTK_BOX(hbox), entry, FALSE, FALSE, 0);
-		g_object_set_data(G_OBJECT(entry), "position", GINT_TO_POINTER(puo->pos));
-		if (ma->proto_opt[puo->pos][0]) {
-			gaim_debug(GAIM_DEBUG_MISC, "protocol options",
-					   "Setting text %s\n", ma->proto_opt[puo->pos]);
-			gtk_entry_set_text(GTK_ENTRY(entry), ma->proto_opt[puo->pos]);
-		} else {
-			gtk_entry_set_text(GTK_ENTRY(entry), puo->def);
-		}
-		gtk_widget_show(entry);
-
-		ma->opt_entries = g_list_append(ma->opt_entries, entry);
-
-		op = op->next;
-	}
-
-	if(prpl_info->register_user != NULL) {
-		ma->register_user = gtk_check_button_new_with_label(_("Register with server"));
-		gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(ma->register_user), FALSE);
-		gtk_box_pack_start(GTK_BOX(vbox), ma->register_user, FALSE, FALSE, 0);
-		gtk_widget_show(ma->register_user);
-	}
-
-}
-
-static void proxy_dropdown_set(GObject *w, struct mod_account *ma) {
-	int opt = GPOINTER_TO_INT(g_object_get_data(w, "proxytype"));
-	if(opt == PROXY_NONE || opt == PROXY_USE_GLOBAL)
-		gtk_widget_hide_all(ma->proxy_host_box);
-	else {
-		gtk_widget_show_all(ma->proxy_host_box);
-	}
-}
-
-static void generate_proxy_options(struct mod_account *ma, GtkWidget *box) {
-	GtkWidget *frame;
-	GtkWidget *hbox;
-	GtkWidget *vbox;
-	GtkWidget *label;
-	GtkWidget *menu;
-	GtkWidget *dropdown;
-	GtkWidget *opt;
-	GtkWidget *entry;
-	GtkWidget *vbox2;
-
-	struct gaim_proxy_info *gpi = NULL;
-
-	if(ma->account)
-		gpi = ma->account->gpi;
-
-	frame = gaim_gtk_make_frame(box, _("Proxy Options"));
-	ma->proxy_frame = gtk_widget_get_parent(gtk_widget_get_parent(frame));
-	gtk_widget_show_all(ma->proxy_frame);
-
-	vbox = gtk_vbox_new(FALSE, 5);
-	gtk_container_set_border_width(GTK_CONTAINER(vbox), 5);
-	gtk_container_add(GTK_CONTAINER(frame), vbox);
-	gtk_widget_show(vbox);
-
-	/* make the dropdown w/o the benefit of the easy helper funcs in prefs.c */
-	hbox = gtk_hbox_new(FALSE, 5);
-	gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0);
-	gtk_widget_show(hbox);
-
-	label = gtk_label_new_with_mnemonic(_("Proxy _Type"));
-	gtk_size_group_add_widget(ma->sg, label);
-	gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5);
-	gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0);
-	gtk_widget_show(label);
-
-	dropdown = gtk_option_menu_new();
-	menu = gtk_menu_new();
-
-	opt = gtk_menu_item_new_with_label(_("Use Global Proxy Settings"));
-	g_object_set_data(G_OBJECT(opt), "proxytype", GINT_TO_POINTER(PROXY_USE_GLOBAL));
-	g_signal_connect(G_OBJECT(opt), "activate",
-			G_CALLBACK(proxy_dropdown_set), ma);
-	gtk_widget_show(opt);
-	gtk_menu_shell_append(GTK_MENU_SHELL(menu), opt);
-	if(!gpi)
-		gtk_menu_set_active(GTK_MENU(menu), 0);
-
-	opt = gtk_menu_item_new_with_label(_("No Proxy"));
-	g_object_set_data(G_OBJECT(opt), "proxytype", GINT_TO_POINTER(PROXY_NONE));
-	g_signal_connect(G_OBJECT(opt), "activate",
-			G_CALLBACK(proxy_dropdown_set), ma);
-	gtk_widget_show(opt);
-	gtk_menu_shell_append(GTK_MENU_SHELL(menu), opt);
-	if(gpi && gpi->proxytype == PROXY_NONE)
-		gtk_menu_set_active(GTK_MENU(menu), 1);
-
-	opt = gtk_menu_item_new_with_label("SOCKS 4");
-	g_object_set_data(G_OBJECT(opt), "proxytype", GINT_TO_POINTER(PROXY_SOCKS4));
-	g_signal_connect(G_OBJECT(opt), "activate",
-			G_CALLBACK(proxy_dropdown_set), ma);
-	gtk_widget_show(opt);
-	gtk_menu_shell_append(GTK_MENU_SHELL(menu), opt);
-	if(gpi && gpi->proxytype == PROXY_SOCKS4)
-		gtk_menu_set_active(GTK_MENU(menu), 2);
-
-	opt = gtk_menu_item_new_with_label("SOCKS 5");
-	g_object_set_data(G_OBJECT(opt), "proxytype", GINT_TO_POINTER(PROXY_SOCKS5));
-	g_signal_connect(G_OBJECT(opt), "activate",
-			G_CALLBACK(proxy_dropdown_set), ma);
-	gtk_widget_show(opt);
-	gtk_menu_shell_append(GTK_MENU_SHELL(menu), opt);
-	if(gpi && gpi->proxytype == PROXY_SOCKS5)
-		gtk_menu_set_active(GTK_MENU(menu), 3);
-
-	opt = gtk_menu_item_new_with_label("HTTP");
-	g_object_set_data(G_OBJECT(opt), "proxytype", GINT_TO_POINTER(PROXY_HTTP));
-	g_signal_connect(G_OBJECT(opt), "activate",
-			G_CALLBACK(proxy_dropdown_set), ma);
-	gtk_widget_show(opt);
-	gtk_menu_shell_append(GTK_MENU_SHELL(menu), opt);
-	if(gpi && gpi->proxytype == PROXY_HTTP)
-		gtk_menu_set_active(GTK_MENU(menu), 4);
-
-	gtk_option_menu_set_menu(GTK_OPTION_MENU(dropdown), menu);
-	gtk_box_pack_start(GTK_BOX(hbox), dropdown, FALSE, FALSE, 0);
-	gtk_widget_show(dropdown);
-
-	ma->proxytype_menu = menu;
-
-
-	vbox2 = gtk_vbox_new(FALSE, 5);
-	gtk_container_add(GTK_CONTAINER(vbox), vbox2);
-	gtk_widget_show(vbox2);
-	ma->proxy_host_box = vbox2;
-
-	hbox = gtk_hbox_new(FALSE, 5);
-	gtk_box_pack_start(GTK_BOX(vbox2), hbox, FALSE, FALSE, 0);
-	gtk_widget_show(hbox);
-
-	label = gtk_label_new_with_mnemonic(_("_Host:"));
-	gtk_size_group_add_widget(ma->sg, label);
-	gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5);
-	gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0);
-	gtk_widget_show(label);
-	entry = gtk_entry_new();
-	gtk_label_set_mnemonic_widget(GTK_LABEL(label), entry);
-	gtk_box_pack_start(GTK_BOX(hbox), entry, FALSE, FALSE, 0);
-	gtk_entry_set_text(GTK_ENTRY(entry), gpi ? gpi->proxyhost : "");
-	gtk_widget_show(entry);
-	ma->proxyhost_entry = entry;
-
-	hbox = gtk_hbox_new(FALSE, 5);
-	gtk_box_pack_start(GTK_BOX(vbox2), hbox, FALSE, FALSE, 0);
-	gtk_widget_show(hbox);
-
-	label = gtk_label_new_with_mnemonic(_("Port:"));
-	gtk_size_group_add_widget(ma->sg, label);
-	gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5);
-	gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0);
-	gtk_widget_show(label);
-	entry = gtk_entry_new();
-	gtk_label_set_mnemonic_widget(GTK_LABEL(label), entry);
-	gtk_box_pack_start(GTK_BOX(hbox), entry, FALSE, FALSE, 0);
-	if(gpi && gpi->proxyport) {
-		char buf[128];
-		g_snprintf(buf, sizeof(buf), "%d", gpi->proxyport);
-		gtk_entry_set_text(GTK_ENTRY(entry), buf);
-	}
-	gtk_widget_show(entry);
-	ma->proxyport_entry = entry;
-
-	hbox = gtk_hbox_new(FALSE, 5);
-	gtk_box_pack_start(GTK_BOX(vbox2), hbox, FALSE, FALSE, 0);
-	gtk_widget_show(hbox);
-
-	label = gtk_label_new_with_mnemonic(_("_User:"));
-	gtk_size_group_add_widget(ma->sg, label);
-	gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5);
-	gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0);
-	gtk_widget_show(label);
-	entry = gtk_entry_new();
-	gtk_label_set_mnemonic_widget(GTK_LABEL(label), entry);
-	gtk_box_pack_start(GTK_BOX(hbox), entry, FALSE, FALSE, 0);
-	gtk_entry_set_text(GTK_ENTRY(entry), gpi ? gpi->proxyuser : "");
-	gtk_widget_show(entry);
-	ma->proxyuser_entry = entry;
-
-	hbox = gtk_hbox_new(FALSE, 5);
-	gtk_box_pack_start(GTK_BOX(vbox2), hbox, FALSE, FALSE, 0);
-	gtk_widget_show(hbox);
-
-	label = gtk_label_new_with_mnemonic(_("Pa_ssword:"));
-	gtk_size_group_add_widget(ma->sg, label);
-	gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5);
-	gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0);
-	gtk_widget_show(label);
-	entry = gtk_entry_new();
-	gtk_label_set_mnemonic_widget(GTK_LABEL(label), entry);
-	gtk_box_pack_start(GTK_BOX(hbox), entry, FALSE, FALSE, 0);
-	gtk_entry_set_text(GTK_ENTRY(entry), gpi ? gpi->proxypass : "");
-	gtk_entry_set_visibility(GTK_ENTRY(entry),FALSE); /*show *'s for passwd*/
-	gtk_widget_show(entry);
-	ma->proxypass_entry = entry;
-
-	if(gpi == NULL || gpi->proxytype == PROXY_NONE)
-		gtk_widget_hide_all(vbox2);
-}
-
-static void show_acct_mod(struct gaim_account *a)
-{
-	/* This is the fucking modify account dialog. I've fucking seperated it into
-	 * three fucking frames:
-	 * a fucking Login Options frame, a fucking User Options frame and a fucking
-	 * Protcol Options frame. This fucking removes the two fucking tabs, which 
-	 * were quite fucking uneccessary. Fuck. */
-				/* -- SeanEgan */
-				/* YEAH!! -- ChipX86 */
-	GtkWidget *hbox, *vbox, *disc, *dbox;
-	GtkWidget *button;
-	GtkWidget *sep;
-	GtkSizeGroup *button_sg;
-
-	struct mod_account *ma = mod_account_find(a);
-
-	if (!ma) {
-		ma = g_new0(struct mod_account, 1);
-		ma->account = a;
-		mod_accounts = g_slist_append(mod_accounts, ma);
-
-		if (a) {
-			int i;
-			ma->options = a->options;
-			if (gaim_find_prpl(a->protocol))
-				ma->protocol = a->protocol;
-			else if (protocols)
-				ma->protocol = GAIM_PLUGIN_PROTOCOL_INFO(
-						((GaimPlugin *)protocols->data))->protocol;
-			else
-				ma->protocol = -1;
-			g_snprintf(ma->iconfile, sizeof(ma->iconfile), "%s", a->iconfile);
-			g_snprintf(ma->username, sizeof(ma->username), "%s", a->username);
-			g_snprintf(ma->show, sizeof(ma->show), "%s", a->alias);
-			g_snprintf(ma->password, sizeof(ma->password), "%s", a->password);
-
-			for (i = 0; i < 7; i++)
-				g_snprintf(ma->proto_opt[i], sizeof(ma->proto_opt[i]), "%s",
-						a->proto_opt[i]);
-		} else {
-			ma->options = OPT_ACCT_REM_PASS;
-			if (gaim_find_prpl(GAIM_PROTO_DEFAULT))
-				ma->protocol = GAIM_PROTO_DEFAULT;
-			else if (protocols)
-				ma->protocol = GAIM_PLUGIN_PROTOCOL_INFO(
-						((GaimPlugin *)protocols->data))->protocol;
-			else
-				ma->protocol = -1;
-		}
-	} else {
-		gtk_widget_show(ma->mod);
-		return;
-	}
-
-	ma->mod = gtk_window_new(GTK_WINDOW_TOPLEVEL);
-	gtk_window_set_role(GTK_WINDOW(ma->mod), "account");
-	gtk_widget_realize(ma->mod);
-	gtk_window_set_title(GTK_WINDOW(ma->mod), _("Modify Account"));
-	gtk_window_set_resizable(GTK_WINDOW(ma->mod), FALSE);	/* nothing odd here :) */
-	g_signal_connect(G_OBJECT(ma->mod), "destroy",
-					 G_CALLBACK(delmod), ma);
-
-	vbox = gtk_vbox_new(FALSE, 6);
-	gtk_container_set_border_width(GTK_CONTAINER(vbox), 6);
-	gtk_container_add(GTK_CONTAINER(ma->mod), vbox);
-	gtk_widget_show(vbox);
-
-	ma->main = gtk_vbox_new(FALSE, 12);
-	gtk_container_set_border_width(GTK_CONTAINER(ma->main), 6);
-	gtk_box_pack_start(GTK_BOX(vbox), ma->main, FALSE, FALSE, 0);
-	gtk_widget_show(ma->main);
-
-	ma->sg = gtk_size_group_new(GTK_SIZE_GROUP_HORIZONTAL);
-
-	generate_login_options(ma, ma->main);
-	generate_user_options(ma, ma->main);
-	disc = gaim_disclosure_new(_("Show more options"), _("Show fewer options"));
-	gtk_box_pack_start(GTK_BOX(ma->main), disc, FALSE, FALSE, 0);
-	gtk_widget_show(disc);
-	ma->disc_box = dbox = gtk_vbox_new(FALSE, 12);
-	gtk_container_set_border_width(GTK_CONTAINER(dbox), 6);
-	gtk_box_pack_start(GTK_BOX(ma->main), dbox, FALSE, FALSE, 0);
-	gaim_disclosure_set_container(GAIM_DISCLOSURE(disc), dbox);
-	generate_protocol_options(ma, dbox);
-	generate_proxy_options(ma, dbox);
-
-	hbox = gtk_hbox_new(FALSE, 6);
-	gtk_container_set_border_width (GTK_CONTAINER (hbox), 6);
-	gtk_box_pack_end(GTK_BOX(vbox), hbox, FALSE, FALSE, 0);
-
-	button_sg = gtk_size_group_new(GTK_SIZE_GROUP_BOTH);
-
-	button = gtk_button_new_from_stock(GTK_STOCK_OK);
-	gtk_size_group_add_widget(button_sg, button);
-	gtk_box_pack_end(GTK_BOX(hbox), button, FALSE, FALSE, 0);
-	g_signal_connect(G_OBJECT(button), "clicked",
-					 G_CALLBACK(ok_mod), ma);
-
-	button = gtk_button_new_from_stock(GTK_STOCK_CANCEL);
-	gtk_size_group_add_widget(button_sg, button);
-	gtk_box_pack_end(GTK_BOX(hbox), button, FALSE, FALSE, 0);
-	g_signal_connect(G_OBJECT(button), "clicked",
-					 G_CALLBACK(cancel_mod), ma);
-
-	sep = gtk_hseparator_new();
-	gtk_box_pack_end (GTK_BOX (vbox), sep, FALSE, FALSE, 0);
-	gtk_widget_show(sep);
-
-	gtk_widget_show_all(hbox);
-	gtk_widget_show(ma->mod);
-}
-
-static void add_acct(GtkWidget *w, gpointer d)
-{
-	show_acct_mod(NULL);
-}
-
-static void mod_acct_func(GtkTreeModel *model, GtkTreePath *path,
-						  GtkTreeIter *iter, gpointer data)
-{
-	struct gaim_account *a;
-
-	gtk_tree_model_get(model, iter, COLUMN_DATA, &a, -1);
-
-	if (a != NULL)
-		show_acct_mod(a);
-}
-
-static void mod_acct(GtkWidget *w, gpointer d)
-{
-	GtkTreeSelection *selection;
-
-	selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(treeview));
-
-	gtk_tree_selection_selected_foreach(selection, mod_acct_func, NULL);
-}
-
-struct pass_prompt {
-	struct gaim_account *account;
-	GtkWidget *win;
-	GtkWidget *entry;
-};
-static GSList *passes = NULL;
-
-static struct pass_prompt *find_pass_prompt(struct gaim_account *account)
-{
-	GSList *p = passes;
-	while (p) {
-		struct pass_prompt *r = p->data;
-		if (r->account == account)
-			return r;
-		p = p->next;
-	}
-	return NULL;
-}
-
-static void pass_callback(GtkDialog *d, gint resp, struct pass_prompt *p)
-{
-	if (resp == GTK_RESPONSE_YES) {	
-		const char *txt = gtk_entry_get_text(GTK_ENTRY(p->entry));
-		g_snprintf(p->account->password, sizeof(p->account->password), "%s", txt);
-		serv_login(p->account);
-	}
-	passes = g_slist_remove(passes, p);
-	gtk_widget_destroy(p->win);
-	g_free(p);
-}
-
-static void do_pass_dlg(struct gaim_account *account)
-{
-	/* we can safely assume that u is not NULL */
-	struct pass_prompt *p = find_pass_prompt(account);
-	GtkWidget *label;
-	GtkWidget *hbox, *vbox;
-	char *labeltext=NULL;
-	GtkWidget *img = gtk_image_new_from_stock(GAIM_STOCK_DIALOG_AUTH, GTK_ICON_SIZE_DIALOG);
-
-	if (p) {
-		gtk_widget_show(p->win);
-		return;
-	}
-
-	p = g_new0(struct pass_prompt, 1);
-	p->account = account;
-	passes = g_slist_append(passes, p);
-
-	p->win = gtk_dialog_new_with_buttons("", NULL, 0, GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
-						_("_Login"), GTK_RESPONSE_YES, NULL);
-
-	gtk_dialog_set_default_response (GTK_DIALOG(p->win), GTK_RESPONSE_YES);
-	g_signal_connect(G_OBJECT(p->win), "response", G_CALLBACK(pass_callback), p);
-
-	gtk_container_set_border_width (GTK_CONTAINER(p->win), 6);
-	gtk_window_set_resizable(GTK_WINDOW(p->win), FALSE);
-	gtk_dialog_set_has_separator(GTK_DIALOG(p->win), FALSE);
-	gtk_box_set_spacing(GTK_BOX(GTK_DIALOG(p->win)->vbox), 12);
-	gtk_container_set_border_width (GTK_CONTAINER(GTK_DIALOG(p->win)->vbox), 6);
-
-	hbox = gtk_hbox_new(FALSE, 12);
-	gtk_container_add(GTK_CONTAINER(GTK_DIALOG(p->win)->vbox), hbox);
-	gtk_box_pack_start(GTK_BOX(hbox), img, FALSE, FALSE, 0);
-
-	vbox = gtk_vbox_new(FALSE, 0);
-	gtk_container_add(GTK_CONTAINER(hbox), vbox);	
-
-	labeltext = g_strdup_printf(_("Please enter your password for %s.\n\n"),
-			account->username);
-	label = gtk_label_new(labeltext);
-	g_free(labeltext);
-
-	gtk_label_set_line_wrap(GTK_LABEL(label), TRUE);
-	gtk_misc_set_alignment(GTK_MISC(label), 0, 0);
-	gtk_box_pack_start(GTK_BOX(vbox), label, FALSE, FALSE, 0);
-
-	hbox = gtk_hbox_new(FALSE, 5);
-	gtk_container_add(GTK_CONTAINER(vbox), hbox);
-	label = gtk_label_new_with_mnemonic(_("_Password"));
-	gtk_misc_set_alignment(GTK_MISC(label), 0, 0);
-	gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 5);
-
-	p->entry = gtk_entry_new();
-	gtk_entry_set_visibility(GTK_ENTRY(p->entry), FALSE);
-	gtk_box_pack_start(GTK_BOX(hbox), p->entry, FALSE, FALSE, 5);
-	gtk_label_set_mnemonic_widget(GTK_LABEL(label), p->entry);
-	gtk_widget_grab_focus(p->entry);
-
-	gtk_widget_show_all(p->win);
-}
-
-static void acct_signin(GtkCellRendererToggle *cell, gchar *path_str,
-						gpointer d)
-{
-	GtkTreeModel *model = (GtkTreeModel *)d;
-	GtkTreeIter iter;
-
-	struct gaim_account *account = NULL;
-	GaimPlugin *p = NULL;
-	GaimPluginProtocolInfo *prpl_info = NULL;
-
-	gtk_tree_model_get_iter_from_string(model, &iter, path_str);
-	gtk_tree_model_get(model, &iter, COLUMN_DATA, &account, -1);
-
-	p = gaim_find_prpl(account->protocol);
-
-	if (p != NULL)
-		prpl_info = GAIM_PLUGIN_PROTOCOL_INFO(p);
-
-	if (!account->gc && p && prpl_info->login) {
-		GaimPlugin *p = gaim_find_prpl(account->protocol);
-
-		if (p != NULL)
-			prpl_info = GAIM_PLUGIN_PROTOCOL_INFO(p);
-
-		if (p && !(prpl_info->options & OPT_PROTO_NO_PASSWORD) &&
-			!(prpl_info->options & OPT_PROTO_PASSWORD_OPTIONAL) &&
-			!account->password[0]) {
-
-			do_pass_dlg(account);
-		}
-		else {
-			serv_login(account);
-		}
-	} else if (account->gc) {
-		account->gc->wants_to_die = TRUE;
-		signoff(account->gc);
-	} else {
-		if (account->protocol == GAIM_PROTO_TOC)
-			gaim_notify_error(NULL, NULL,
-							  _("TOC not found."),
-							  _("You have attempted to login an IM account "
-								"using the TOC protocol.  Because this "
-								"protocol is inferior to OSCAR, it is now "
-								"compiled as a plugin by default. To login, "
-								"edit this account to use OSCAR or load the "
-								"TOC plugin."));
-		else
-			gaim_notify_error(NULL, NULL,
-							  _("Protocol not found."),
-							  _("You cannot log this account in; you do "
-								"not have the protocol it uses loaded, or "
-								"the protocol does not have a login "
-								"function."));
-	}
-}
-
-static void acct_autologin(GtkCellRendererToggle *cell, gchar *path_str,
-						   gpointer d)
-{
-	GtkTreeModel *model = (GtkTreeModel *)d;
-	GtkTreeIter iter;
-
-	struct gaim_account *account = NULL;
-
-	gtk_tree_model_get_iter_from_string(model, &iter, path_str);
-	gtk_tree_model_get(model, &iter, COLUMN_DATA, &account, -1);
-
-	account->options ^= OPT_ACCT_AUTO;
-
-	gtk_list_store_set(GTK_LIST_STORE(model), &iter,
-					   COLUMN_AUTOLOGIN, (account->options & OPT_ACCT_AUTO), -1);
-
-	save_prefs();
-}
-
-static void do_del_acct(struct gaim_account *account)
-{
-	GtkTreeIter iter;
-	GaimBlistNode *gnode,*bnode;
-
-	if (account->gc) {
-		account->gc->wants_to_die = TRUE;
-		signoff(account->gc);
-	}
-
-	if (get_iter_from_data(GTK_TREE_VIEW(treeview), account, &iter)) {
-		gtk_list_store_remove(GTK_LIST_STORE(model), &iter);
-	}
-
-
-	/* remove the buddies for the account we just destroyed */
-	for(gnode = gaim_get_blist()->root; gnode; gnode = gnode->next) {
-		struct group *g = (struct group *)gnode;
-		if(!GAIM_BLIST_NODE_IS_GROUP(gnode))
-			continue;
-		for(bnode = gnode->child; bnode; bnode = bnode->next) {
-			if(GAIM_BLIST_NODE_IS_BUDDY(bnode)) {
-				struct buddy *b = (struct buddy *)bnode;
-				if(b->account == account)
-					gaim_blist_remove_buddy(b);
-			} else if(GAIM_BLIST_NODE_IS_CHAT(bnode)) {
-				struct chat *chat = (struct chat *)bnode;
-				if(chat->account == account)
-					gaim_blist_remove_chat(chat);
-			}
-		}
-		if(!gnode->child) {
-			gaim_blist_remove_group(g);
-		}
-	}
-
-	gaim_accounts = g_slist_remove(gaim_accounts, account);
-
-	gaim_blist_save();
-
-	save_prefs();
-}
-
-static void del_acct_func(GtkTreeModel *model, GtkTreePath *path,
-						  GtkTreeIter *iter, gpointer data)
-{
-	struct gaim_account *account;
-
-	gtk_tree_model_get(model, iter, COLUMN_DATA, &account, -1);
-
-	if (account != NULL) {
-		char buf[8192];
-
-		g_snprintf(buf, sizeof(buf),
-				   _("Are you sure you want to delete %s?"), account->username);
-
-		gaim_request_action(NULL, NULL, buf, NULL, 1, account, 2,
-							_("Delete"), G_CALLBACK(do_del_acct),
-							_("Cancel"), NULL);
-	}
-}
-
-static void del_acct(GtkWidget *w, gpointer d)
-{
-	GtkTreeSelection *selection;
-
-	selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(treeview));
-
-	gtk_tree_selection_selected_foreach(selection, del_acct_func, NULL);
-}
-
-void account_editor(GtkWidget *w, GtkWidget *W)
-{
-	/* please kill me */
-	GtkWidget *vbox;
-	GtkWidget *hbox;
-	GtkWidget *sw;
-	GtkWidget *button;	/* used for many things */
-	GtkWidget *sep;
-	GtkSizeGroup *sg;
-
-	if (acctedit) {
-		gtk_window_present(GTK_WINDOW(acctedit));
-		return;
-	}
-	
-	acctedit = gtk_window_new(GTK_WINDOW_TOPLEVEL);
-	gtk_window_set_title(GTK_WINDOW(acctedit), _("Account Editor"));
-	gtk_window_set_role(GTK_WINDOW(acctedit), "accounteditor");
-	gtk_widget_realize(acctedit);
-	gtk_widget_set_size_request(acctedit, -1, 250);
-	gtk_window_set_default_size(GTK_WINDOW(acctedit), 550, 250);
-	g_signal_connect(G_OBJECT(acctedit), "delete_event",
-					 G_CALLBACK(on_delete_acctedit), W);
-
-	vbox = gtk_vbox_new(FALSE, 6);
-	gtk_container_set_border_width(GTK_CONTAINER(vbox), 6);
-	gtk_container_add(GTK_CONTAINER(acctedit), vbox);
-
-	sw = generate_list();
-	hbox = gtk_hbox_new(FALSE, 6);
-	gtk_box_pack_start(GTK_BOX(vbox), hbox, TRUE, TRUE, 6);
-
-	gtk_box_pack_start(GTK_BOX(hbox), sw, TRUE, TRUE, 0);
-
-	sep = gtk_hseparator_new();
-	gtk_box_pack_start(GTK_BOX(vbox), sep, FALSE, FALSE, 0);
-
-	hbox = gtk_hbox_new(FALSE, 6);
-	gtk_container_set_border_width (GTK_CONTAINER (hbox), 6);
-	gtk_box_pack_end(GTK_BOX(vbox), hbox, FALSE, FALSE, 0);
-
-	sg = gtk_size_group_new(GTK_SIZE_GROUP_BOTH);
-
-	button = gtk_button_new_from_stock(GTK_STOCK_CLOSE);
-	gtk_size_group_add_widget(sg, button);
-	gtk_box_pack_end(GTK_BOX(hbox), button, FALSE, FALSE, 0);
-	g_signal_connect(G_OBJECT(button), "clicked",
-					 G_CALLBACK(on_close_acctedit), W);
-
-	button = gtk_button_new_from_stock(GTK_STOCK_DELETE);
-	gtk_size_group_add_widget(sg, button);
-	gtk_box_pack_end(GTK_BOX(hbox), button, FALSE, FALSE, 0);
-	g_signal_connect(G_OBJECT(button), "clicked",
-					 G_CALLBACK(del_acct), NULL);
-
-	button = gaim_pixbuf_button_from_stock(_("_Modify"), GTK_STOCK_PREFERENCES,
-										   GAIM_BUTTON_HORIZONTAL);
-	gtk_size_group_add_widget(sg, button);
-	gtk_box_pack_end(GTK_BOX(hbox), button, FALSE, FALSE, 0);
-	g_signal_connect(G_OBJECT(button), "clicked",
-					 G_CALLBACK(mod_acct), NULL);
-
-	button = gtk_button_new_from_stock(GTK_STOCK_ADD);
-	gtk_size_group_add_widget(sg, button);
-	gtk_box_pack_end(GTK_BOX(hbox), button, FALSE, FALSE, 0);
-	g_signal_connect(G_OBJECT(button), "clicked",
-					 G_CALLBACK(add_acct), NULL);
-
-	gtk_widget_show_all(acctedit);
-}
-
 struct signon_meter {
-	struct gaim_connection *gc;
+	GaimConnection *gc;
 	GtkWidget *button;
 	GtkWidget *progress;
 	GtkWidget *status;
 };
 static GSList *meters = NULL;
 
-GtkWidget* create_meter_pixmap (struct gaim_connection *gc)
+GtkWidget* create_meter_pixmap (GaimConnection *gc)
 {
 	GdkPixbuf *pb = create_prpl_icon(gc->account);
 	GdkPixbuf *scale = gdk_pixbuf_scale_simple(pb, 30,30,GDK_INTERP_BILINEAR);
@@ -1650,7 +73,7 @@
 	return image;
 }
 
-static struct signon_meter *find_signon_meter(struct gaim_connection *gc)
+static struct signon_meter *find_signon_meter(GaimConnection *gc)
 {
 	GSList *m = meters;
 	while (m) {
@@ -1706,175 +129,10 @@
 	return;
 }
 
-void account_online(struct gaim_connection *gc)
-{
-	struct signon_meter *meter = find_signon_meter(gc);
-	GList *wins;
-	GtkTreeIter iter;
-	GaimBlistNode *gnode,*bnode;
-	GList *add_buds=NULL;
-	GList *l;
-
-	/* Set the time the account came online */
-	time(&gc->login_time);
-
-	/* first we hide the login progress meter */
-	if (meter) {
-		kill_meter(meter);
-		meters = g_slist_remove(meters, meter);
-		g_free(meter);
-	}
-
-	/* then we do the buddy list stuff */
-	if (mainwindow)
-		gtk_widget_hide(mainwindow);
-
-	gaim_blist_show();
-
-	update_privacy_connections();
-	do_away_menu(NULL);
-	do_proto_menu();
-
-	gaim_blist_add_account(gc->account);
-
-	/*
-	 * XXX This is a hack! Remove this and replace it with a better event
-	 *     notification system.
-	 */
-	for (wins = gaim_get_windows(); wins != NULL; wins = wins->next) {
-		struct gaim_window *win = (struct gaim_window *)wins->data;
-		gaim_conversation_update(gaim_window_get_conversation_at(win, 0),
-								 GAIM_CONV_ACCOUNT_ONLINE);
-	}
-
-	gaim_setup(gc);
-
-	gc->account->connecting = FALSE;
-	connecting_count--;
-	gaim_debug(GAIM_DEBUG_MISC, "accounts",
-			   "Connecting count: %d\n", connecting_count);
-
-	gaim_event_broadcast(event_signon, gc);
-	system_log(log_signon, gc, NULL, OPT_LOG_BUDDY_SIGNON | OPT_LOG_MY_SIGNON);
-
-	/* away option given? */
-	if (opt_away) {
-		away_on_login(opt_away_arg);
-		/* don't do it again */
-		opt_away = 0;
-	} else if (awaymessage) {
-		serv_set_away(gc, GAIM_AWAY_CUSTOM, awaymessage->message);
-	}
-	if (opt_away_arg != NULL) {
-		g_free(opt_away_arg);
-		opt_away_arg = NULL;
-	}
-
-	/* let the prpl know what buddies we pulled out of the local list */
-	for(gnode = gaim_get_blist()->root; gnode; gnode = gnode->next) {
-		if(!GAIM_BLIST_NODE_IS_GROUP(gnode))
-			continue;
-		for(bnode = gnode->child; bnode; bnode = bnode->next) {
-			if(GAIM_BLIST_NODE_IS_BUDDY(bnode)) {
-				struct buddy *b = (struct buddy *)bnode;
-				if(b->account == gc->account) {
-					add_buds = g_list_append(add_buds, b->name);
-				}
-			}
-		}
-	}
-
-	if(add_buds) {
-		serv_add_buddies(gc, add_buds);
-		g_list_free(add_buds);
-	}
-
-	serv_set_permit_deny(gc);
-
-	/* everything for the account editor */
-	if (!acctedit)
-		return;
-
-	if (get_iter_from_data(GTK_TREE_VIEW(treeview), gc->account, &iter)) {
-		gtk_list_store_set(model, &iter,
-						   COLUMN_ONLINE, TRUE,
-						   COLUMN_PROTOCOL, gc->prpl->info->name,
-						   -1);
-	}
-
-	/* Update the conversation windows that use this account. */
-	for (l = gaim_get_conversations(); l != NULL; l = l->next) {
-		struct gaim_conversation *conv = (struct gaim_conversation *)l->data;
-
-		if (gaim_conversation_get_account(conv) == gc->account) {
-			gaim_conversation_update(conv, GAIM_CONV_UPDATE_ACCOUNT);
-		}
-	}
-}
-
-void account_offline(struct gaim_connection *gc)
-{
-	struct signon_meter *meter = find_signon_meter(gc);
-	GtkTreeIter iter;
-	GList *l;
-
-	if (meter) {
-		kill_meter(meter);
-		meters = g_slist_remove(meters, meter);
-		g_free(meter);
-	}
-
-	gaim_debug(GAIM_DEBUG_MISC, "accounts",
-			   "Disconnecting. user = %p, gc = %p (%p)\n",
-			   gc->account, gc->account->gc, gc);
-
-	gc->account->gc = NULL;	/* wasn't that awkward? */
-
-	if (!acctedit)
-		return;
-
-	if (get_iter_from_data(GTK_TREE_VIEW(treeview), gc->account, &iter)) {
-		gtk_list_store_set(model, &iter, COLUMN_ONLINE, FALSE, -1);
-	}
-
-	/* Update the conversation windows that use this account. */
-	for (l = gaim_get_conversations(); l != NULL; l = l->next) {
-		struct gaim_conversation *conv = (struct gaim_conversation *)l->data;
-
-		if (gaim_conversation_get_account(conv) == gc->account) {
-			gaim_conversation_update(conv, GAIM_CONV_UPDATE_ACCOUNT);
-		}
-	}
-}
-
-void auto_login()
-{
-	GSList *accts = gaim_accounts;
-	struct gaim_account *a = NULL;
-
-	while (accts) {
-		a = (struct gaim_account *)accts->data;
-		if ((a->options & OPT_ACCT_AUTO) && (a->options & OPT_ACCT_REM_PASS)) {
-			serv_login(a);
-		}
-		accts = accts->next;
-	}
-}
-
-/*
- * d:)->-< 
- *
- * d:O-\-<
- * 
- * d:D-/-<
- *
- * d8D->-< DANCE!
- */
-
 static void cancel_signon(GtkWidget *button, struct signon_meter *meter)
 {
 	meter->gc->wants_to_die = TRUE;
-	signoff(meter->gc);
+	gaim_connection_destroy(meter->gc);
 }
 
 static gint meter_destroy(GtkWidget *window, GdkEvent *evt, struct signon_meter *meter)
@@ -1882,15 +140,20 @@
 	return TRUE;
 }
 
-static struct signon_meter *register_meter(struct gaim_connection *gc, GtkWidget *widget, GtkTable *table, gint *rows)
+static struct signon_meter *
+register_meter(GaimConnection *gc, GtkWidget *widget,
+			   GtkTable *table, gint *rows)
 {
+	GaimAccount *account;
 	GtkWidget *graphic;
 	GtkWidget *label;
 	GtkWidget *nest_vbox;
 	GString *name_to_print;
 	struct signon_meter *meter;
 
-	name_to_print = g_string_new(gc->username);
+	account = gaim_connection_get_account(gc);
+
+	name_to_print = g_string_new(gaim_account_get_username(account));
 
 	meter = g_new0(struct signon_meter, 1);
 
@@ -1936,12 +199,12 @@
 	while (m) {
 		meter = (struct signon_meter *) (m->data);
 		meter->gc->wants_to_die = TRUE;
-		signoff((struct gaim_connection *) meter->gc);
+		gaim_connection_destroy((GaimConnection *) meter->gc);
 		m = meters;
 		}
 	}
 
-void set_login_progress(struct gaim_connection *gc, float howfar, char *message)
+void set_login_progress(GaimConnection *gc, float howfar, char *message)
 {
 	struct signon_meter *meter = find_signon_meter(gc);
 
@@ -1993,12 +256,12 @@
 }
 
 struct kick_dlg {
-	struct gaim_account *account;
+	GaimAccount *account;
 	GtkWidget *dlg;
 };
 static GSList *kicks = NULL;
 
-static struct kick_dlg *find_kick_dlg(struct gaim_account *account)
+static struct kick_dlg *find_kick_dlg(GaimAccount *account)
 {
 	GSList *k = kicks;
 	while (k) {
@@ -2019,7 +282,7 @@
 /*
  * Common code for hide_login_progress(), and hide_login_progress_info()
  */
-static void hide_login_progress_common(struct gaim_connection *gc,
+static void hide_login_progress_common(GaimConnection *gc,
 				       char *details,
 				       char *title,
 				       char *prologue)
@@ -2043,12 +306,14 @@
 	g_free(buf);
 }
 
-void hide_login_progress(struct gaim_connection *gc, char *why)
+void hide_login_progress(GaimConnection *gc, char *why)
 {
+	GaimAccount *account = gaim_connection_get_account(gc);
 	gchar *buf;
 
 	gaim_event_broadcast(event_error, gc, why);
-	buf = g_strdup_printf(_("%s was unable to sign on"), gc->username);
+	buf = g_strdup_printf(_("%s was unable to sign on"),
+						  gaim_account_get_username(account));
 	hide_login_progress_common(gc, why, _("Signon Error"), buf);
 	g_free(buf);
 }
@@ -2058,119 +323,26 @@
  * messages.
  *
  */
-void hide_login_progress_notice(struct gaim_connection *gc, char *why)
+void hide_login_progress_notice(GaimConnection *gc, char *why)
 {
-	hide_login_progress_common(gc, why, _("Notice"), gc->username);
+	GaimAccount *account = gaim_connection_get_account(gc);
+
+	hide_login_progress_common(gc, why, _("Notice"),
+							   (char *)gaim_account_get_username(account));
 }
 
 /*
  * Like hide_login_progress(), but for non-signon error messages.
  *
  */
-void hide_login_progress_error(struct gaim_connection *gc, char *why)
+void hide_login_progress_error(GaimConnection *gc, char *why)
 {
 	char buf[2048];
+	GaimAccount *account = gaim_connection_get_account(gc);
 
 	gaim_event_broadcast(event_error, gc, why);
-	g_snprintf(buf, sizeof(buf), _("%s has been signed off"), gc->username);
+	g_snprintf(buf, sizeof(buf), _("%s has been signed off"),
+			   gaim_account_get_username(account));
 	hide_login_progress_common(gc, why, _("Connection Error"), buf);
 }
 
-void signoff_all()
-{
-	GSList *c = connections;
-	struct gaim_connection *g = NULL;
-
-	while (c) {
-		g = (struct gaim_connection *)c->data;
-		g->wants_to_die = TRUE;
-		signoff(g);
-		c = connections;
-	}
-}
-
-void signoff(struct gaim_connection *gc)
-{
-	GList *wins;
-
-	/* we only remove the account if we ever added it */
-	if(!gc->account->connecting)
-		gaim_blist_remove_account(gc->account);
-
-	/* core stuff */
-	/* remove this here so plugins get a sensible count of connections */
-	connections = g_slist_remove(connections, gc);
-	gaim_debug(GAIM_DEBUG_MISC, "accounts", "date: %s\n", full_date());
-	gaim_event_broadcast(event_signoff, gc);
-	system_log(log_signoff, gc, NULL, OPT_LOG_BUDDY_SIGNON | OPT_LOG_MY_SIGNON);
-	/* set this in case the plugin died before really connecting.
-	   do it after calling the plugins so they can determine if
-	   this user was ever on-line or not */
-	if (gc->account->connecting) {
-		gc->account->connecting = FALSE;
-		connecting_count--;
-	}
-	gaim_debug(GAIM_DEBUG_MISC, "accounts", "connecting_count: %d\n",
-			   connecting_count);
-	serv_close(gc);
-
-	/* more UI stuff */
-	do_away_menu();
-	do_proto_menu();
-
-	/*
-	 * XXX This is a hack! Remove this and replace it with a better event
-	 *     notification system.
-	 */
-	for (wins = gaim_get_windows(); wins != NULL; wins = wins->next) {
-		struct gaim_window *win = (struct gaim_window *)wins->data;
-		gaim_conversation_update(gaim_window_get_conversation_at(win, 0),
-								 GAIM_CONV_ACCOUNT_OFFLINE);
-	}
-
-	gaim_request_close_with_handle(gc);
-	gaim_notify_close_with_handle(gc);
-
-	update_privacy_connections();
-
-	/* in, out, shake it all about */
-	if (connections)
-		return;
-
-	destroy_all_dialogs();
-	gaim_blist_destroy();
-
-	show_login();
-}
-
-struct gaim_account *gaim_account_new(const char *name, int proto, int opts)
-{
-	struct gaim_account *account = g_new0(struct gaim_account, 1);
-	g_snprintf(account->username, sizeof(account->username), "%s", name);
-	g_snprintf(account->user_info, sizeof(account->user_info), "%s", DEFAULT_INFO);
-	account->protocol = proto;
-	account->options = opts;
-	account->permit = NULL;
-	account->deny = NULL;
-	gaim_accounts = g_slist_append(gaim_accounts, account);
-
-	if (treeview) {
-		GtkTreeIter iter;
-
-		gtk_list_store_append(model, &iter);
-		gtk_list_store_set(model, &iter,
-						   COLUMN_SCREENNAME, account->username,
-						   COLUMN_ONLINE, (account->gc ? TRUE : FALSE),
-						   COLUMN_AUTOLOGIN, (account->options & OPT_ACCT_AUTO),
-						   COLUMN_PROTOCOL, proto_name(account->protocol),
-						   COLUMN_DATA, account,
-						   -1);
-	}
-
-	return account;
-}
-
-GSList *gaim_get_connections()
-{
-	return connections;
-}
--- a/src/multi.h	Fri May 30 04:13:58 2003 +0000
+++ b/src/multi.h	Fri May 30 09:38:29 2003 +0000
@@ -22,11 +22,13 @@
 #ifndef _MULTI_H_
 #define _MULTI_H_
 
+#include "account.h"
 #include "core.h"
 #include "plugin.h"
 
+#if 0
 /* ok. now the fun begins. first we create a connection structure */
-struct gaim_connection {
+GaimConnection {
 	int edittype; /* XXX CUI: this is ui-specific and should be removed */
 
 	/* we need to do either oscar or TOC */
@@ -47,7 +49,7 @@
 	/* each connection then can have its own protocol-specific data */
 	void *proto_data;
 
-	struct gaim_account *account;
+	GaimAccount *account;
 
 	char username[64];
 	char displayname[128];
@@ -70,6 +72,7 @@
 	int evil;		/* warning level for AIM (why is this here?) */
 	gboolean wants_to_die;	/* defaults to FALSE */
 };
+#endif
 
 #define OPT_CONN_HTML		0x00000001
 /* set this flag on a gc if you want serv_got_im to autoreply when away */
@@ -89,14 +92,14 @@
 
 struct proto_actions_menu {
 	char *label;
-	void (*callback)(struct gaim_connection *);
-	struct gaim_connection *gc;
+	void (*callback)(GaimConnection *);
+	GaimConnection *gc;
 };
 
 struct proto_buddy_menu {
 	char *label;
-	void (*callback)(struct gaim_connection *, const char *);
-	struct gaim_connection *gc;
+	void (*callback)(GaimConnection *, const char *);
+	GaimConnection *gc;
 };
 
 struct proto_chat_entry {
@@ -108,27 +111,9 @@
 	int max;
 };
 
-/* now that we have our struct, we're going to need lots of them. Maybe even a list of them. */
-extern GSList *connections;
-
-/* number of accounts that are currently in the process of connecting */
-extern int connecting_count;
-
-struct gaim_account *gaim_account_new(const char *, int, int);
-struct gaim_connection *new_gaim_conn(struct gaim_account *);
-void destroy_gaim_conn(struct gaim_connection *);
-
-void regenerate_user_list();
-
-void account_online(struct gaim_connection *);
-void account_offline(struct gaim_connection *);
-
-void auto_login();
-
-void set_login_progress(struct gaim_connection *, float, char *);
-void hide_login_progress(struct gaim_connection *, char *);
-void hide_login_progress_notice(struct gaim_connection *, char *);
-void hide_login_progress_error(struct gaim_connection *, char *);
-GSList *gaim_get_connections();
+void set_login_progress(GaimConnection *, float, char *);
+void hide_login_progress(GaimConnection *, char *);
+void hide_login_progress_notice(GaimConnection *, char *);
+void hide_login_progress_error(GaimConnection *, char *);
 
 #endif /* _MULTI_H_ */
--- a/src/pounce.c	Fri May 30 04:13:58 2003 +0000
+++ b/src/pounce.c	Fri May 30 09:38:29 2003 +0000
@@ -26,7 +26,7 @@
 static GList *pounces = NULL;
 
 struct gaim_pounce *
-gaim_pounce_new(struct gaim_account *pouncer, const char *pouncee,
+gaim_pounce_new(GaimAccount *pouncer, const char *pouncee,
 				GaimPounceEvent event, gaim_pounce_cb cb,
 				void *data, void (*free)(void *))
 {
@@ -77,7 +77,7 @@
 
 void
 gaim_pounce_set_pouncer(struct gaim_pounce *pounce,
-						struct gaim_account *pouncer)
+						GaimAccount *pouncer)
 {
 	if (pounce == NULL || pouncer == NULL)
 		return;
@@ -115,7 +115,7 @@
 	return pounce->events;
 }
 
-struct gaim_account *
+GaimAccount *
 gaim_pounce_get_pouncer(const struct gaim_pounce *pounce)
 {
 	if (pounce == NULL)
@@ -143,7 +143,7 @@
 }
 
 void
-gaim_pounce_execute(const struct gaim_account *pouncer,
+gaim_pounce_execute(const GaimAccount *pouncer,
 					const char *pouncee, GaimPounceEvent events)
 {
 	struct gaim_pounce *pounce;
@@ -166,7 +166,7 @@
 }
 
 struct gaim_pounce *
-gaim_find_pounce(const struct gaim_account *pouncer,
+gaim_find_pounce(const GaimAccount *pouncer,
 				 const char *pouncee, GaimPounceEvent events)
 {
 	struct gaim_pounce *pounce;
--- a/src/pounce.h	Fri May 30 04:13:58 2003 +0000
+++ b/src/pounce.h	Fri May 30 09:38:29 2003 +0000
@@ -56,7 +56,7 @@
 struct gaim_pounce
 {
 	GaimPounceEvent events;       /**< The event(s) to pounce on. */
-	struct gaim_account *pouncer; /**< The user who is pouncing.  */
+	GaimAccount *pouncer; /**< The user who is pouncing.  */
 
 	char *pouncee;                /**< The buddy to pounce on.    */
 
@@ -78,7 +78,7 @@
  *
  * @return The new buddy pounce structure.
  */
-struct gaim_pounce *gaim_pounce_new(struct gaim_account *pouncer,
+struct gaim_pounce *gaim_pounce_new(GaimAccount *pouncer,
 									const char *pouncee,
 									GaimPounceEvent event,
 									gaim_pounce_cb cb, void *data,
@@ -107,7 +107,7 @@
  * @param pouncer The account that will pounce.
  */
 void gaim_pounce_set_pouncer(struct gaim_pounce *pounce,
-							 struct gaim_account *pouncer);
+							 GaimAccount *pouncer);
 
 /**
  * Sets the buddy a pounce should pounce on.
@@ -149,7 +149,7 @@
  *
  * @return The account that will pounce.
  */
-struct gaim_account *gaim_pounce_get_pouncer(const struct gaim_pounce *pounce);
+GaimAccount *gaim_pounce_get_pouncer(const struct gaim_pounce *pounce);
 
 /**
  * Returns the buddy a pounce should pounce on.
@@ -176,7 +176,7 @@
  * @param pouncee The buddy that is being pounced.
  * @param events  The events that triggered the pounce.
  */
-void gaim_pounce_execute(const struct gaim_account *pouncer,
+void gaim_pounce_execute(const GaimAccount *pouncer,
 						 const char *pouncee,
 						 GaimPounceEvent events);
 
@@ -189,7 +189,7 @@
  *
  * @return The pounce if found, or @c NULL otherwise.
  */
-struct gaim_pounce *gaim_find_pounce(const struct gaim_account *pouncer,
+struct gaim_pounce *gaim_find_pounce(const GaimAccount *pouncer,
 									 const char *pouncee,
 									 GaimPounceEvent events);
 
--- a/src/privacy.h	Fri May 30 04:13:58 2003 +0000
+++ b/src/privacy.h	Fri May 30 09:38:29 2003 +0000
@@ -20,7 +20,7 @@
  */
 
 #include "gaim.h"
-gboolean gaim_privacy_permit_add(struct gaim_account *account, const char *name);
-gboolean gaim_privacy_deny_add(struct gaim_account *account, const char *name);
-gboolean gaim_privacy_deny_remove(struct gaim_account *account, const char *name);
-gboolean gaim_privacy_permit_remove(struct gaim_account *account, const char *name);
+gboolean gaim_privacy_permit_add(GaimAccount *account, const char *name);
+gboolean gaim_privacy_deny_add(GaimAccount *account, const char *name);
+gboolean gaim_privacy_deny_remove(GaimAccount *account, const char *name);
+gboolean gaim_privacy_permit_remove(GaimAccount *account, const char *name);
--- a/src/protocols/gg/gg.c	Fri May 30 04:13:58 2003 +0000
+++ b/src/protocols/gg/gg.c	Fri May 30 09:38:29 2003 +0000
@@ -1,6 +1,6 @@
 /*
  * gaim - Gadu-Gadu Protocol Plugin
- * $Id: gg.c 5818 2003-05-18 19:59:02Z chipx86 $
+ * $Id: gg.c 5965 2003-05-30 09:38:29Z chipx86 $
  *
  * Copyright (C) 2001 Arkadiusz Mi¶kiewicz <misiek@pld.ORG.PL>
  * 
@@ -92,7 +92,7 @@
 };
 
 struct agg_http {
-	struct gaim_connection *gc;
+	GaimConnection *gc;
 	gchar *request;
 	gchar *form;
 	gchar *host;
@@ -119,9 +119,11 @@
 	return g_ascii_strcasecmp((const gchar *)a,(const gchar *)b);
 }
 
-static gboolean allowed_uin(struct gaim_connection *gc, char *uin)
+static gboolean allowed_uin(GaimConnection *gc, char *uin)
 {
-	switch (gc->account->permdeny) {
+	GaimAccount *account = gaim_connection_get_account(gc);
+
+	switch (account->perm_deny) {
 	case 1:
 		/* permit all, deny none */
 		return TRUE;
@@ -148,7 +150,7 @@
 	}
 }
 
-static char *handle_errcode(struct gaim_connection *gc, int errcode)
+static char *handle_errcode(GaimConnection *gc, int errcode)
 {
 	static char msg[AGG_BUF_LEN];
 
@@ -181,7 +183,7 @@
 	return msg;
 }
 
-static void agg_set_away(struct gaim_connection *gc, char *state, char *msg)
+static void agg_set_away(GaimConnection *gc, char *state, char *msg)
 {
 	struct agg_data *gd = (struct agg_data *)gc->proto_data;
 	int status = gd->own_status;
@@ -250,7 +252,7 @@
 	}
 }
 
-static GList *agg_away_states(struct gaim_connection *gc)
+static GList *agg_away_states(GaimConnection *gc)
 {
 	GList *m = NULL;
 
@@ -265,7 +267,7 @@
 }
 
 /* Enhance these functions, more options and such stuff */
-static GList *agg_buddy_menu(struct gaim_connection *gc, const char *who)
+static GList *agg_buddy_menu(GaimConnection *gc, const char *who)
 {
 	GList *m = NULL;
 	struct proto_buddy_menu *pbm;
@@ -288,7 +290,7 @@
 
 static void main_callback(gpointer data, gint source, GaimInputCondition cond)
 {
-	struct gaim_connection *gc = data;
+	GaimConnection *gc = data;
 	struct agg_data *gd = gc->proto_data;
 	struct gg_event *e;
 
@@ -403,7 +405,7 @@
 
 void login_callback(gpointer data, gint source, GaimInputCondition cond)
 {
-	struct gaim_connection *gc = data;
+	GaimConnection *gc = data;
 	struct agg_data *gd = gc->proto_data;
 	struct gg_event *e;
 
@@ -495,7 +497,7 @@
 		gc->inpa = gaim_input_add(gd->sess->fd, GAIM_INPUT_READ, main_callback, gc);
 
 		/* Our signon is complete */
-		account_online(gc);
+		gaim_connection_set_state(gc, GAIM_CONNECTED);
 		serv_finish_login(gc);
 
 		break;
@@ -513,7 +515,7 @@
 	gg_free_event(e);
 }
 
-static void agg_keepalive(struct gaim_connection *gc)
+static void agg_keepalive(GaimConnection *gc)
 {
 	struct agg_data *gd = (struct agg_data *)gc->proto_data;
 	if (gg_ping(gd->sess) < 0) {
@@ -523,19 +525,19 @@
 	}
 }
 
-static void agg_login(struct gaim_account *account)
+static void agg_login(GaimAccount *account)
 {
-	struct gaim_connection *gc = new_gaim_conn(account);
+	GaimConnection *gc = gaim_account_get_connection(account);
 	struct agg_data *gd = gc->proto_data = g_new0(struct agg_data, 1);
 	char buf[80];
 
+#if 0
 	gc->checkbox = _("Send as message");
+#endif
 
 	gd->sess = g_new0(struct gg_session, 1);
 
-	if (account->proto_opt[USEROPT_NICK][0])
-		g_snprintf(gc->displayname, sizeof(gc->displayname), "%s",
-			   account->proto_opt[USEROPT_NICK]);
+	gaim_connection_set_display_name(account, gaim_account_get_string("nick"));
 
 	set_login_progress(gc, 1, _("Looking up GG server"));
 
@@ -571,7 +573,7 @@
 	}
 }
 
-static void agg_close(struct gaim_connection *gc)
+static void agg_close(GaimConnection *gc)
 {
 	struct agg_data *gd = (struct agg_data *)gc->proto_data;
 	if (gc->inpa)
@@ -582,7 +584,7 @@
 	g_free(gc->proto_data);
 }
 
-static int agg_send_im(struct gaim_connection *gc, const char *who, const char *msg, int len, int flags)
+static int agg_send_im(GaimConnection *gc, const char *who, const char *msg, int len, int flags)
 {
 	struct agg_data *gd = (struct agg_data *)gc->proto_data;
 	gchar *imsg;
@@ -605,7 +607,7 @@
 	return 1;
 }
 
-static void agg_add_buddy(struct gaim_connection *gc, const char *who)
+static void agg_add_buddy(GaimConnection *gc, const char *who)
 {
 	struct agg_data *gd = (struct agg_data *)gc->proto_data;
 	if (invalid_uin(who))
@@ -613,7 +615,7 @@
 	gg_add_notify(gd->sess, strtol(who, (char **)NULL, 10));
 }
 
-static void agg_rem_buddy(struct gaim_connection *gc, char *who, char *group)
+static void agg_rem_buddy(GaimConnection *gc, char *who, char *group)
 {
 	struct agg_data *gd = (struct agg_data *)gc->proto_data;
 	if (invalid_uin(who))
@@ -621,7 +623,7 @@
 	gg_remove_notify(gd->sess, strtol(who, (char **)NULL, 10));
 }
 
-static void agg_add_buddies(struct gaim_connection *gc, GList *whos)
+static void agg_add_buddies(GaimConnection *gc, GList *whos)
 {
 	struct agg_data *gd = (struct agg_data *)gc->proto_data;
 	uin_t *userlist = NULL;
@@ -643,7 +645,7 @@
 	}
 }
 
-static void search_results(struct gaim_connection *gc, gchar *webdata)
+static void search_results(GaimConnection *gc, gchar *webdata)
 {
 	gchar **webdata_tbl;
 	gchar *buf;
@@ -750,7 +752,7 @@
 	g_free(buf);
 }
 
-static void import_buddies_server_results(struct gaim_connection *gc, gchar *webdata)
+static void import_buddies_server_results(GaimConnection *gc, gchar *webdata)
 {
 	gchar *ptr;
 	gchar **users_tbl;
@@ -822,7 +824,7 @@
 	g_strfreev(users_tbl);
 }
 
-static void export_buddies_server_results(struct gaim_connection *gc, gchar *webdata)
+static void export_buddies_server_results(GaimConnection *gc, gchar *webdata)
 {
 	if (strstr(webdata, "put_success:")) {
 		gaim_notify_info(gc, NULL,
@@ -837,7 +839,7 @@
 					  NULL);
 }
 
-static void delete_buddies_server_results(struct gaim_connection *gc, gchar *webdata)
+static void delete_buddies_server_results(GaimConnection *gc, gchar *webdata)
 {
 	if (strstr(webdata, "put_success:")) {
 		gaim_notify_info(gc, NULL,
@@ -852,7 +854,7 @@
 					  NULL);
 }
 
-static void password_change_server_results(struct gaim_connection *gc, gchar *webdata)
+static void password_change_server_results(GaimConnection *gc, gchar *webdata)
 {
 	if (strstr(webdata, "reg_success:")) {
 		gaim_notify_info(gc, NULL,
@@ -868,7 +870,7 @@
 static void http_results(gpointer data, gint source, GaimInputCondition cond)
 {
 	struct agg_http *hdata = data;
-	struct gaim_connection *gc = hdata->gc;
+	GaimConnection *gc = hdata->gc;
 	char *webdata;
 	int len;
 	char read_data;
@@ -937,7 +939,7 @@
 static void http_req_callback(gpointer data, gint source, GaimInputCondition cond)
 {
 	struct agg_http *hdata = data;
-	struct gaim_connection *gc = hdata->gc;
+	GaimConnection *gc = hdata->gc;
 	gchar *request = hdata->request;
 	gchar *buf;
 
@@ -986,7 +988,7 @@
 	hdata->inpa = gaim_input_add(source, GAIM_INPUT_READ, http_results, hdata);
 }
 
-static void import_buddies_server(struct gaim_connection *gc)
+static void import_buddies_server(GaimConnection *gc)
 {
 	struct agg_http *hi = g_new0(struct agg_http, 1);
 	gchar *u = gg_urlencode(gc->username);
@@ -1012,7 +1014,7 @@
 	}
 }
 
-static void export_buddies_server(struct gaim_connection *gc)
+static void export_buddies_server(GaimConnection *gc)
 {
 	struct agg_http *he = g_new0(struct agg_http, 1);
 	gchar *ptr;
@@ -1082,7 +1084,7 @@
 	}
 }
 
-static void delete_buddies_server(struct gaim_connection *gc)
+static void delete_buddies_server(GaimConnection *gc)
 {
 	struct agg_http *he = g_new0(struct agg_http, 1);
 	gchar *u = gg_urlencode(gc->username);
@@ -1105,7 +1107,7 @@
 	}
 }
 
-static void agg_dir_search(struct gaim_connection *gc, const char *first, const char *middle,
+static void agg_dir_search(GaimConnection *gc, const char *first, const char *middle,
 			   const char *last, const char *maiden, const char *city, const char *state,
 			   const char *country, const char *email)
 {
@@ -1155,7 +1157,7 @@
 	}
 }
 
-static void agg_change_passwd(struct gaim_connection *gc, const char *old, const char *new)
+static void agg_change_passwd(GaimConnection *gc, const char *old, const char *new)
 {
 	struct agg_http *hpass = g_new0(struct agg_http, 1);
 	gchar *u = gg_urlencode(gc->username);
@@ -1190,7 +1192,7 @@
 	}                                        
 }
 
-static GList *agg_actions(struct gaim_connection *gc)
+static GList *agg_actions(GaimConnection *gc)
 {
 	GList *m = NULL;
 	struct proto_actions_menu *pam;
@@ -1232,7 +1234,7 @@
 	return m;
 }
 
-static void agg_get_info(struct gaim_connection *gc, const char *who)
+static void agg_get_info(GaimConnection *gc, const char *who)
 {
 	struct agg_http *srch = g_new0(struct agg_http, 1);
 	srch->gc = gc;
@@ -1267,7 +1269,7 @@
 	}
 }
 
-static const char *agg_list_icon(struct gaim_account *a, struct buddy *b)
+static const char *agg_list_icon(GaimAccount *a, struct buddy *b)
 {
 	return "gadu-gadu";
 }
@@ -1291,12 +1293,12 @@
 }
 
 
-static void agg_set_permit_deny_dummy(struct gaim_connection *gc)
+static void agg_set_permit_deny_dummy(GaimConnection *gc)
 {
 	/* It's implemented on client side because GG server doesn't support this */
 }
 
-static void agg_permit_deny_dummy(struct gaim_connection *gc, const char *who)
+static void agg_permit_deny_dummy(GaimConnection *gc, const char *who)
 {
 	/* It's implemented on client side because GG server doesn't support this */
 }
--- a/src/proxy.c	Fri May 30 04:13:58 2003 +0000
+++ b/src/proxy.c	Fri May 30 09:38:29 2003 +0000
@@ -64,7 +64,7 @@
 	int port;
 	gint inpa;
 	struct gaim_proxy_info *gpi;
-	struct gaim_account *account;
+	GaimAccount *account;
 };
 
 typedef struct _GaimIOClosure {
@@ -1241,7 +1241,7 @@
 }
 
 int
-proxy_connect(struct gaim_account *account, char *host, int port, GaimInputFunction func, gpointer data)
+proxy_connect(GaimAccount *account, char *host, int port, GaimInputFunction func, gpointer data)
 {
 	char *connecthost = host;
 	int connectport = port;
--- a/src/proxy.h	Fri May 30 04:13:58 2003 +0000
+++ b/src/proxy.h	Fri May 30 09:38:29 2003 +0000
@@ -71,6 +71,6 @@
 extern gint gaim_input_add(int, GaimInputCondition, GaimInputFunction, gpointer);
 extern void gaim_input_remove(gint);
 
-extern int proxy_connect(struct gaim_account *account, char *host, int port, GaimInputFunction func, gpointer data);
+extern int proxy_connect(GaimAccount *account, char *host, int port, GaimInputFunction func, gpointer data);
 
 #endif /* _PROXY_H_ */
--- a/src/prpl.c	Fri May 30 04:13:58 2003 +0000
+++ b/src/prpl.c	Fri May 30 09:38:29 2003 +0000
@@ -78,9 +78,9 @@
 	GtkWidget *submenu;
 	GaimPluginProtocolInfo *prpl_info = NULL;
 	GList *l;
-	GSList *c = connections;
+	GList *c;
 	struct proto_actions_menu *pam;
-	struct gaim_connection *gc = NULL;
+	GaimConnection *gc = NULL;
 	int count = 0;
 	char buf[256];
 
@@ -97,17 +97,14 @@
 		l = l->next;
 	}
 
-	while (c) {
+	for (c = gaim_connections_get_all(); c != NULL; c = c->next) {
 		gc = c->data;
 
 		prpl_info = GAIM_PLUGIN_PROTOCOL_INFO(gc->prpl);
 
 		if (prpl_info->actions && gc->login_time)
 			count++;
-
-		c = g_slist_next(c);
 	}
-	c = connections;
 
 	if (!count) {
 		g_snprintf(buf, sizeof(buf), _("No actions available"));
@@ -119,15 +116,14 @@
 
 	if (count == 1) {
 		GList *act;
-		while (c) {
+
+		for (c = gaim_connections_get_all(); c != NULL; c = c->next) {
 			gc = c->data;
 
 			prpl_info = GAIM_PLUGIN_PROTOCOL_INFO(gc->prpl);
 
 			if (prpl_info->actions && gc->login_time)
 				break;
-
-			c = g_slist_next(c);
 		}
 
 		act = prpl_info->actions(gc);
@@ -147,7 +143,8 @@
 			act = g_list_next(act);
 		}
 	} else {
-		while (c) {
+		for (c = gaim_connections_get_all(); c != NULL; c = c->next) {
+			GaimAccount *account;
 			GList *act;
 			GdkPixbuf *pixbuf, *scale;
 			GtkWidget *image;
@@ -156,13 +153,15 @@
 
 			prpl_info = GAIM_PLUGIN_PROTOCOL_INFO(gc->prpl);
 
-			if (!prpl_info->actions || !gc->login_time) {
-				c = g_slist_next(c);
+			if (!prpl_info->actions || !gc->login_time)
 				continue;
-			}
+
+			account = gaim_connection_get_account(gc);
 
 			g_snprintf(buf, sizeof(buf), "%s (%s)",
-					   gc->username, gc->prpl->info->name);
+					   gaim_account_get_username(account),
+					   gc->prpl->info->name);
+
 			menuitem = gtk_image_menu_item_new_with_label(buf);
 
 			pixbuf = create_prpl_icon(gc->account);
@@ -200,13 +199,12 @@
 				}
 				act = g_list_next(act);
 			}
-			c = g_slist_next(c);
 		}
 	}
 }
 
 struct icon_data {
-	struct gaim_connection *gc;
+	GaimConnection *gc;
 	char *who;
 	void *data;
 	int len;
@@ -222,7 +220,7 @@
 	return ((x->gc != y->gc) || gaim_utf8_strcasecmp(x->who, y->who));
 }
 
-void set_icon_data(struct gaim_connection *gc, const char *who, void *data, int len)
+void set_icon_data(GaimConnection *gc, const char *who, void *data, int len)
 {
 	struct gaim_conversation *conv;
 	struct icon_data tmp;
@@ -325,7 +323,7 @@
 	g_free(realwho);
 }
 
-void remove_icon_data(struct gaim_connection *gc)
+void remove_icon_data(GaimConnection *gc)
 {
 	GList *list = icons;
 	struct icon_data *id;
@@ -342,7 +340,7 @@
 	}
 }
 
-void *get_icon_data(struct gaim_connection *gc, const char *who, int *len)
+void *get_icon_data(GaimConnection *gc, const char *who, int *len)
 {
 	struct icon_data tmp = { gc, normalize(who), NULL, 0 };
 	GList *l = g_list_find_custom(icons, &tmp, find_icon_data);
@@ -358,7 +356,7 @@
 }
 
 struct got_add {
-	struct gaim_connection *gc;
+	GaimConnection *gc;
 	char *who;
 	char *alias;
 };
@@ -373,21 +371,26 @@
 
 static void do_add(struct got_add *ga)
 {
-	if (g_slist_find(connections, ga->gc))
+	if (g_list_find(gaim_connections_get_all(), ga->gc))
 		show_add_buddy(ga->gc, ga->who, NULL, ga->alias);
 	dont_add(ga);
 }
 
-void show_got_added(struct gaim_connection *gc, const char *id,
+void show_got_added(GaimConnection *gc, const char *id,
 		    const char *who, const char *alias, const char *msg)
 {
+	GaimAccount *account;
 	char buf[BUF_LONG];
-	struct got_add *ga = g_new0(struct got_add, 1);
-	struct buddy *b = gaim_find_buddy(gc->account, who);
+	struct got_add *ga;
+	struct buddy *b;
 
-	ga->gc = gc;
-	ga->who = g_strdup(who);
-	ga->alias = alias ? g_strdup(alias) : NULL;
+	account = gaim_connection_get_account(gc);
+	b = gaim_find_buddy(gc->account, who);
+
+	ga = g_new0(struct got_add, 1);
+	ga->gc    = gc;
+	ga->who   = g_strdup(who);
+	ga->alias = (alias ? g_strdup(alias) : NULL);
 
 
 	g_snprintf(buf, sizeof(buf), _("%s%s%s%s has made %s his or her buddy%s%s%s"),
@@ -395,7 +398,11 @@
 		   alias ? " (" : "",
 		   alias ? alias : "",
 		   alias ? ")" : "",
-		   id ? id : gc->displayname[0] ? gc->displayname : gc->username,
+		   (id
+			? id
+			: (gaim_connection_get_display_name(gc)
+			   ? gaim_connection_get_display_name(gc)
+			   : gaim_account_get_username(account))),
 		   msg ? ": " : ".",
 		   msg ? msg : "",
 		   b ? "" : _("\n\nDo you wish to add him or her to your buddy list?"));
--- a/src/prpl.h	Fri May 30 04:13:58 2003 +0000
+++ b/src/prpl.h	Fri May 30 09:38:29 2003 +0000
@@ -29,10 +29,6 @@
 
 typedef struct _GaimPluginProtocolInfo GaimPluginProtocolInfo;
 
-#include "core.h"
-#include "proxy.h"
-#include "multi.h"
-
 /**************************************************************************/
 /** @name Basic Protocol Information                                      */
 /**************************************************************************/
@@ -67,6 +63,10 @@
 
 } GaimProtocol;
 
+#include "core.h"
+#include "proxy.h"
+#include "multi.h"
+
 /** Default protocol plugin description */
 #define GAIM_PRPL_DESC(x) \
 		"Allows gaim to use the " (x) " protocol.\n\n"      \
@@ -191,7 +191,7 @@
 	 * Returns the base icon name for the given buddy and account.  
 	 * If buddy is NULL, it will return the name to use for the account's icon
 	 */
-	const char *(*list_icon)(struct gaim_account *account, struct buddy *buddy);
+	const char *(*list_icon)(GaimAccount *account, struct buddy *buddy);
 
 	/**
 	 * Fills the four char**'s with string identifiers for "emblems"
@@ -211,11 +211,11 @@
 	 */
 	char *(*tooltip_text)(struct buddy *buddy);
 	
-	GList *(*away_states)(struct gaim_connection *gc);
-	GList *(*actions)(struct gaim_connection *gc);
+	GList *(*away_states)(GaimConnection *gc);
+	GList *(*actions)(GaimConnection *gc);
 
-	GList *(*buddy_menu)(struct gaim_connection *, const char *);
-	GList *(*chat_info)(struct gaim_connection *);
+	GList *(*buddy_menu)(GaimConnection *, const char *);
+	GList *(*chat_info)(GaimConnection *);
 
 	/* All the server-related functions */
 
@@ -226,71 +226,71 @@
 	 * can set your dir info, the ui shows a dialog and needs to call
 	 * set_dir in order to set it)
 	 */
-	void (*login)(struct gaim_account *);
-	void (*close)(struct gaim_connection *);
-	int  (*send_im)(struct gaim_connection *, const char *who,
+	void (*login)(GaimAccount *);
+	void (*close)(GaimConnection *);
+	int  (*send_im)(GaimConnection *, const char *who,
 					const char *message, int len, int away);
-	void (*set_info)(struct gaim_connection *, char *info);
-	int  (*send_typing)(struct gaim_connection *, char *name, int typing);
-	void (*get_info)(struct gaim_connection *, const char *who);
-	void (*set_away)(struct gaim_connection *, char *state, char *message);
-	void (*get_away)(struct gaim_connection *, const char *who);
-	void (*set_dir)(struct gaim_connection *, const char *first,
+	void (*set_info)(GaimConnection *, char *info);
+	int  (*send_typing)(GaimConnection *, char *name, int typing);
+	void (*get_info)(GaimConnection *, const char *who);
+	void (*set_away)(GaimConnection *, char *state, char *message);
+	void (*get_away)(GaimConnection *, const char *who);
+	void (*set_dir)(GaimConnection *, const char *first,
 					const char *middle, const char *last,
 					const char *maiden, const char *city,
 					const char *state, const char *country, int web);
-	void (*get_dir)(struct gaim_connection *, const char *who);
-	void (*dir_search)(struct gaim_connection *, const char *first,
+	void (*get_dir)(GaimConnection *, const char *who);
+	void (*dir_search)(GaimConnection *, const char *first,
 					   const char *middle, const char *last,
 					   const char *maiden, const char *city,
 					   const char *state, const char *country,
 					   const char *email);
-	void (*set_idle)(struct gaim_connection *, int idletime);
-	void (*change_passwd)(struct gaim_connection *, const char *old,
+	void (*set_idle)(GaimConnection *, int idletime);
+	void (*change_passwd)(GaimConnection *, const char *old,
 						  const char *new);
-	void (*add_buddy)(struct gaim_connection *, const char *name);
-	void (*add_buddies)(struct gaim_connection *, GList *buddies);
-	void (*remove_buddy)(struct gaim_connection *, char *name, char *group);
-	void (*remove_buddies)(struct gaim_connection *, GList *buddies,
+	void (*add_buddy)(GaimConnection *, const char *name);
+	void (*add_buddies)(GaimConnection *, GList *buddies);
+	void (*remove_buddy)(GaimConnection *, char *name, char *group);
+	void (*remove_buddies)(GaimConnection *, GList *buddies,
 						   const char *group);
-	void (*add_permit)(struct gaim_connection *, const char *name);
-	void (*add_deny)(struct gaim_connection *, const char *name);
-	void (*rem_permit)(struct gaim_connection *, const char *name);
-	void (*rem_deny)(struct gaim_connection *, const char *name);
-	void (*set_permit_deny)(struct gaim_connection *);
-	void (*warn)(struct gaim_connection *, char *who, int anonymous);
-	void (*join_chat)(struct gaim_connection *, GHashTable *components);
-	void (*chat_invite)(struct gaim_connection *, int id,
+	void (*add_permit)(GaimConnection *, const char *name);
+	void (*add_deny)(GaimConnection *, const char *name);
+	void (*rem_permit)(GaimConnection *, const char *name);
+	void (*rem_deny)(GaimConnection *, const char *name);
+	void (*set_permit_deny)(GaimConnection *);
+	void (*warn)(GaimConnection *, char *who, int anonymous);
+	void (*join_chat)(GaimConnection *, GHashTable *components);
+	void (*chat_invite)(GaimConnection *, int id,
 						const char *who, const char *message);
-	void (*chat_leave)(struct gaim_connection *, int id);
-	void (*chat_whisper)(struct gaim_connection *, int id,
+	void (*chat_leave)(GaimConnection *, int id);
+	void (*chat_whisper)(GaimConnection *, int id,
 						 char *who, char *message);
-	int  (*chat_send)(struct gaim_connection *, int id, char *message);
-	void (*keepalive)(struct gaim_connection *);
+	int  (*chat_send)(GaimConnection *, int id, char *message);
+	void (*keepalive)(GaimConnection *);
 
 	/* new user registration */
-	void (*register_user)(struct gaim_account *);
+	void (*register_user)(GaimAccount *);
 
 	/* get "chat buddy" info and away message */
-	void (*get_cb_info)(struct gaim_connection *, int, char *who);
-	void (*get_cb_away)(struct gaim_connection *, int, char *who);
+	void (*get_cb_info)(GaimConnection *, int, char *who);
+	void (*get_cb_away)(GaimConnection *, int, char *who);
 
 	/* save/store buddy's alias on server list/roster */
-	void (*alias_buddy)(struct gaim_connection *, const char *who,
+	void (*alias_buddy)(GaimConnection *, const char *who,
 						const char *alias);
 
 	/* change a buddy's group on a server list/roster */
-	void (*group_buddy)(struct gaim_connection *, const char *who,
+	void (*group_buddy)(GaimConnection *, const char *who,
 						const char *old_group, const char *new_group);
 
 	/* rename a group on a server list/roster */
-	void (*rename_group)(struct gaim_connection *, const char *old_group,
+	void (*rename_group)(GaimConnection *, const char *old_group,
 						 const char *new_group, GList *members);
 
 	void (*buddy_free)(struct buddy *);
 
 	/* this is really bad. */
-	void (*convo_closed)(struct gaim_connection *, char *who);
+	void (*convo_closed)(GaimConnection *, char *who);
 
 	char *(*normalize)(const char *);
 };
@@ -342,7 +342,7 @@
  * @param alias The user's alias.
  * @param msg   The message to go along with the request.
  */
-void show_got_added(struct gaim_connection *gc, const char *id,
+void show_got_added(GaimConnection *gc, const char *id,
 					const char *who, const char *alias, const char *msg);
 
 /**
@@ -353,7 +353,7 @@
  * @param data The icon data.
  * @param len  The length of @a data.
  */
-void set_icon_data(struct gaim_connection *gc, const char *who, void *data, int len);
+void set_icon_data(GaimConnection *gc, const char *who, void *data, int len);
 
 /**
  * Retrieves the buddy icon data for a user.
@@ -364,6 +364,6 @@
  *
  * @return The buddy icon data.
  */
-void *get_icon_data(struct gaim_connection *gc, const char *who, int *len);
+void *get_icon_data(GaimConnection *gc, const char *who, int *len);
 
 #endif /* _PRPL_H_ */
--- a/src/server.c	Fri May 30 04:13:58 2003 +0000
+++ b/src/server.c	Fri May 30 09:38:29 2003 +0000
@@ -40,7 +40,7 @@
 #include "notify.h"
 #include "prefs.h"
 
-void serv_login(struct gaim_account *account)
+void serv_login(GaimAccount *account)
 {
 	GaimPlugin *p = gaim_find_prpl(account->protocol);
 	GaimPluginProtocolInfo *prpl_info = NULL;
@@ -61,10 +61,7 @@
 		gaim_debug(GAIM_DEBUG_INFO, "server",
 				   PACKAGE " " VERSION " logging in %s using %s\n",
 				   account->username, p->info->name);
-		account->connecting = TRUE;
-		connecting_count++;
-		gaim_debug(GAIM_DEBUG_MISC, "server",
-				   "connection count: %d\n", connecting_count);
+
 		gaim_event_broadcast(event_connecting, account);
 		prpl_info->login(account);
 	}
@@ -72,7 +69,7 @@
 
 static gboolean send_keepalive(gpointer d)
 {
-	struct gaim_connection *gc = d;
+	GaimConnection *gc = d;
 	GaimPluginProtocolInfo *prpl_info = NULL;
 
 	if (gc != NULL && gc->prpl != NULL)
@@ -84,19 +81,19 @@
 	return TRUE;
 }
 
-static void update_keepalive(struct gaim_connection *gc, gboolean on)
+static void update_keepalive(GaimConnection *gc, gboolean on)
 {
-	if (on && !gc->keepalive) {
+	if (on && !gc->keep_alive) {
 		gaim_debug(GAIM_DEBUG_INFO, "server", "allowing NOP\n");
-		gc->keepalive = g_timeout_add(60000, send_keepalive, gc);
-	} else if (!on && gc->keepalive > 0) {
+		gc->keep_alive = g_timeout_add(60000, send_keepalive, gc);
+	} else if (!on && gc->keep_alive > 0) {
 		gaim_debug(GAIM_DEBUG_INFO, "server", "removing NOP\n");
-		g_source_remove(gc->keepalive);
-		gc->keepalive = 0;
+		g_source_remove(gc->keep_alive);
+		gc->keep_alive = 0;
 	}
 }
 
-void serv_close(struct gaim_connection *gc)
+void serv_close(GaimConnection *gc)
 {
 	GaimPlugin *prpl;
 	GaimPluginProtocolInfo *prpl_info = NULL;
@@ -125,23 +122,23 @@
 	}
 
 	prpl = gc->prpl;
-	account_offline(gc);
-	destroy_gaim_conn(gc);
+
+	gaim_account_disconnect(gaim_connection_get_account(gc));
 }
 
-void serv_touch_idle(struct gaim_connection *gc)
+void serv_touch_idle(GaimConnection *gc)
 {
 	/* Are we idle?  If so, not anymore */
 	if (gc->is_idle > 0) {
 		gc->is_idle = 0;
 		serv_set_idle(gc, 0);
 	}
-	time(&gc->lastsent);
+	time(&gc->last_sent_time);
 	if (gc->is_auto_away)
 		check_idle(gc);
 }
 
-void serv_finish_login(struct gaim_connection *gc)
+void serv_finish_login(GaimConnection *gc)
 {
 	GaimPluginProtocolInfo *prpl_info = NULL;
 
@@ -162,7 +159,8 @@
 	serv_touch_idle(gc);
 
 	if (prpl_info->options & OPT_PROTO_CORRECT_TIME)
-		serv_add_buddy(gc, gc->username);
+		serv_add_buddy(gc,
+				gaim_account_get_username(gaim_connection_get_account(gc)));
 
 	update_keepalive(gc, TRUE);
 }
@@ -171,7 +169,7 @@
  * typing notifications.
  * if it returns zero, it will not send any more typing notifications 
  * typing is a flag - TRUE for typing, FALSE for stopped typing */
-int serv_send_typing(struct gaim_connection *g, char *name, int typing) {
+int serv_send_typing(GaimConnection *g, char *name, int typing) {
 	GaimPluginProtocolInfo *prpl_info = NULL;
 
 	if (g != NULL && g->prpl != NULL)
@@ -190,7 +188,7 @@
 
 struct queued_away_response *find_queued_away_response_by_name(char *name);
 
-int serv_send_im(struct gaim_connection *gc, char *name, char *message,
+int serv_send_im(GaimConnection *gc, char *name, char *message,
 				 int len, int flags)
 {
 	struct gaim_conversation *c;
@@ -231,7 +229,7 @@
 	return val;
 }
 
-void serv_get_info(struct gaim_connection *g, char *name)
+void serv_get_info(GaimConnection *g, char *name)
 {
 	GaimPluginProtocolInfo *prpl_info = NULL;
 
@@ -242,7 +240,7 @@
 		prpl_info->get_info(g, name);
 }
 
-void serv_get_away(struct gaim_connection *g, const char *name)
+void serv_get_away(GaimConnection *g, const char *name)
 {
 	GaimPluginProtocolInfo *prpl_info = NULL;
 
@@ -253,18 +251,18 @@
 		prpl_info->get_away(g, name);
 }
 
-void serv_get_dir(struct gaim_connection *g, char *name)
+void serv_get_dir(GaimConnection *g, char *name)
 {
 	GaimPluginProtocolInfo *prpl_info = NULL;
 
 	if (g != NULL && g->prpl != NULL)
 		prpl_info = GAIM_PLUGIN_PROTOCOL_INFO(g->prpl);
 
-	if (prpl_info && g_slist_find(connections, g) && prpl_info->get_dir)
+	if (prpl_info && g_list_find(gaim_connections_get_all(), g) && prpl_info->get_dir)
 		prpl_info->get_dir(g, name);
 }
 
-void serv_set_dir(struct gaim_connection *g, const char *first,
+void serv_set_dir(GaimConnection *g, const char *first,
 				  const char *middle, const char *last, const char *maiden,
 				  const char *city, const char *state, const char *country,
 				  int web)
@@ -274,12 +272,12 @@
 	if (g != NULL && g->prpl != NULL)
 		prpl_info = GAIM_PLUGIN_PROTOCOL_INFO(g->prpl);
 
-	if (prpl_info && g_slist_find(connections, g) && prpl_info->set_dir)
+	if (prpl_info && g_list_find(gaim_connections_get_all(), g) && prpl_info->set_dir)
 		prpl_info->set_dir(g, first, middle, last, maiden, city, state,
 						 country, web);
 }
 
-void serv_dir_search(struct gaim_connection *g, const char *first,
+void serv_dir_search(GaimConnection *g, const char *first,
 					 const char *middle, const char *last, const char *maiden,
 		     const char *city, const char *state, const char *country,
 			 const char *email)
@@ -289,13 +287,13 @@
 	if (g != NULL && g->prpl != NULL)
 		prpl_info = GAIM_PLUGIN_PROTOCOL_INFO(g->prpl);
 
-	if (prpl_info && g_slist_find(connections, g) && prpl_info->dir_search)
+	if (prpl_info && g_list_find(gaim_connections_get_all(), g) && prpl_info->dir_search)
 		prpl_info->dir_search(g, first, middle, last, maiden, city, state,
 							country, email);
 }
 
 
-void serv_set_away(struct gaim_connection *gc, char *state, char *message)
+void serv_set_away(GaimConnection *gc, char *state, char *message)
 {
 	GaimPluginProtocolInfo *prpl_info = NULL;
 
@@ -349,24 +347,24 @@
 
 void serv_set_away_all(char *message)
 {
-	GSList *c;
-	struct gaim_connection *g;
+	GList *c;
+	GaimConnection *g;
 
-	for (c = connections; c != NULL; c = c->next) {
-		g = (struct gaim_connection *)c->data;
+	for (c = gaim_connections_get_all(); c != NULL; c = c->next) {
+		g = (GaimConnection *)c->data;
 
 		serv_set_away(g, GAIM_AWAY_CUSTOM, message);
 	}
 }
 
-void serv_set_info(struct gaim_connection *g, char *info)
+void serv_set_info(GaimConnection *g, char *info)
 {
 	GaimPluginProtocolInfo *prpl_info = NULL;
 
 	if (g != NULL && g->prpl != NULL)
 		prpl_info = GAIM_PLUGIN_PROTOCOL_INFO(g->prpl);
 
-	if (prpl_info && g_slist_find(connections, g) && prpl_info->set_info) {
+	if (prpl_info && g_list_find(gaim_connections_get_all(), g) && prpl_info->set_info) {
 		if (gaim_event_broadcast(event_set_info, g, info))
 			return;
 
@@ -374,36 +372,36 @@
 	}
 }
 
-void serv_change_passwd(struct gaim_connection *g, const char *orig, const char *new)
+void serv_change_passwd(GaimConnection *g, const char *orig, const char *new)
 {
 	GaimPluginProtocolInfo *prpl_info = NULL;
 
 	if (g != NULL && g->prpl != NULL)
 		prpl_info = GAIM_PLUGIN_PROTOCOL_INFO(g->prpl);
 
-	if (prpl_info && g_slist_find(connections, g) && prpl_info->change_passwd)
+	if (prpl_info && g_list_find(gaim_connections_get_all(), g) && prpl_info->change_passwd)
 		prpl_info->change_passwd(g, orig, new);
 }
 
-void serv_add_buddy(struct gaim_connection *g, const char *name)
+void serv_add_buddy(GaimConnection *g, const char *name)
 {
 	GaimPluginProtocolInfo *prpl_info = NULL;
 
 	if (g != NULL && g->prpl != NULL)
 		prpl_info = GAIM_PLUGIN_PROTOCOL_INFO(g->prpl);
 
-	if (prpl_info && g_slist_find(connections, g) && prpl_info->add_buddy)
+	if (prpl_info && g_list_find(gaim_connections_get_all(), g) && prpl_info->add_buddy)
 		prpl_info->add_buddy(g, name);
 }
 
-void serv_add_buddies(struct gaim_connection *g, GList *buddies)
+void serv_add_buddies(GaimConnection *g, GList *buddies)
 {
 	GaimPluginProtocolInfo *prpl_info = NULL;
 
 	if (g != NULL && g->prpl != NULL)
 		prpl_info = GAIM_PLUGIN_PROTOCOL_INFO(g->prpl);
 
-	if (prpl_info && g_slist_find(connections, g)) {
+	if (prpl_info && g_list_find(gaim_connections_get_all(), g)) {
 		if (prpl_info->add_buddies)
 			prpl_info->add_buddies(g, buddies);
 		else if (prpl_info->add_buddy) {
@@ -416,22 +414,22 @@
 }
 
 
-void serv_remove_buddy(struct gaim_connection *g, char *name, char *group)
+void serv_remove_buddy(GaimConnection *g, char *name, char *group)
 {
 	GaimPluginProtocolInfo *prpl_info = NULL;
 
 	if (g != NULL && g->prpl != NULL)
 		prpl_info = GAIM_PLUGIN_PROTOCOL_INFO(g->prpl);
 
-	if (prpl_info && g_slist_find(connections, g) && prpl_info->remove_buddy)
+	if (prpl_info && g_list_find(gaim_connections_get_all(), g) && prpl_info->remove_buddy)
 		prpl_info->remove_buddy(g, name, group);
 }
 
-void serv_remove_buddies(struct gaim_connection *gc, GList *g, char *group)
+void serv_remove_buddies(GaimConnection *gc, GList *g, char *group)
 {
 	GaimPluginProtocolInfo *prpl_info = NULL;
 
-	if (!g_slist_find(connections, gc))
+	if (!g_list_find(gaim_connections_get_all(), gc))
 		return;
 
 	if (!gc->prpl)
@@ -465,7 +463,7 @@
 	}
 }
 
-void serv_got_alias(struct gaim_connection *gc, char *who, char *alias) {
+void serv_got_alias(GaimConnection *gc, char *who, char *alias) {
 	struct buddy *b = gaim_find_buddy(gc->account, who);
 	if(!b)
 		return;
@@ -504,7 +502,7 @@
 /*
  * Rename a group on server roster/list.
  */
-void serv_rename_group(struct gaim_connection *g, struct group *old_group,
+void serv_rename_group(GaimConnection *g, struct group *old_group,
 					   const char *new_name)
 {
 	GaimPluginProtocolInfo *prpl_info = NULL;
@@ -538,51 +536,51 @@
 	}
 }
 
-void serv_add_permit(struct gaim_connection *g, const char *name)
+void serv_add_permit(GaimConnection *g, const char *name)
 {
 	GaimPluginProtocolInfo *prpl_info = NULL;
 
 	if (g != NULL && g->prpl != NULL)
 		prpl_info = GAIM_PLUGIN_PROTOCOL_INFO(g->prpl);
 
-	if (prpl_info && g_slist_find(connections, g) && prpl_info->add_permit)
+	if (prpl_info && g_list_find(gaim_connections_get_all(), g) && prpl_info->add_permit)
 		prpl_info->add_permit(g, name);
 }
 
-void serv_add_deny(struct gaim_connection *g, const char *name)
+void serv_add_deny(GaimConnection *g, const char *name)
 {
 	GaimPluginProtocolInfo *prpl_info = NULL;
 
 	if (g != NULL && g->prpl != NULL)
 		prpl_info = GAIM_PLUGIN_PROTOCOL_INFO(g->prpl);
 
-	if (prpl_info && g_slist_find(connections, g) && prpl_info->add_deny)
+	if (prpl_info && g_list_find(gaim_connections_get_all(), g) && prpl_info->add_deny)
 		prpl_info->add_deny(g, name);
 }
 
-void serv_rem_permit(struct gaim_connection *g, const char *name)
+void serv_rem_permit(GaimConnection *g, const char *name)
 {
 	GaimPluginProtocolInfo *prpl_info = NULL;
 
 	if (g != NULL && g->prpl != NULL)
 		prpl_info = GAIM_PLUGIN_PROTOCOL_INFO(g->prpl);
 
-	if (prpl_info && g_slist_find(connections, g) && prpl_info->rem_permit)
+	if (prpl_info && g_list_find(gaim_connections_get_all(), g) && prpl_info->rem_permit)
 		prpl_info->rem_permit(g, name);
 }
 
-void serv_rem_deny(struct gaim_connection *g, const char *name)
+void serv_rem_deny(GaimConnection *g, const char *name)
 {
 	GaimPluginProtocolInfo *prpl_info = NULL;
 
 	if (g != NULL && g->prpl != NULL)
 		prpl_info = GAIM_PLUGIN_PROTOCOL_INFO(g->prpl);
 
-	if (prpl_info && g_slist_find(connections, g) && prpl_info->rem_deny)
+	if (prpl_info && g_list_find(gaim_connections_get_all(), g) && prpl_info->rem_deny)
 		prpl_info->rem_deny(g, name);
 }
 
-void serv_set_permit_deny(struct gaim_connection *g)
+void serv_set_permit_deny(GaimConnection *g)
 {
 	GaimPluginProtocolInfo *prpl_info = NULL;
 
@@ -595,45 +593,45 @@
 	 * in the prefs. In either case you should probably be resetting and
 	 * resending the permit/deny info when you get this.
 	 */
-	if (prpl_info && g_slist_find(connections, g) && prpl_info->set_permit_deny)
+	if (prpl_info && g_list_find(gaim_connections_get_all(), g) && prpl_info->set_permit_deny)
 		prpl_info->set_permit_deny(g);
 }
 
 
-void serv_set_idle(struct gaim_connection *g, int time)
+void serv_set_idle(GaimConnection *g, int time)
 {
 	GaimPluginProtocolInfo *prpl_info = NULL;
 
 	if (g != NULL && g->prpl != NULL)
 		prpl_info = GAIM_PLUGIN_PROTOCOL_INFO(g->prpl);
 
-	if (prpl_info && g_slist_find(connections, g) && prpl_info->set_idle)
+	if (prpl_info && g_list_find(gaim_connections_get_all(), g) && prpl_info->set_idle)
 		prpl_info->set_idle(g, time);
 }
 
-void serv_warn(struct gaim_connection *g, char *name, int anon)
+void serv_warn(GaimConnection *g, char *name, int anon)
 {
 	GaimPluginProtocolInfo *prpl_info = NULL;
 
 	if (g != NULL && g->prpl != NULL)
 		prpl_info = GAIM_PLUGIN_PROTOCOL_INFO(g->prpl);
 
-	if (prpl_info && g_slist_find(connections, g) && prpl_info->warn)
+	if (prpl_info && g_list_find(gaim_connections_get_all(), g) && prpl_info->warn)
 		prpl_info->warn(g, name, anon);
 }
 
-void serv_join_chat(struct gaim_connection *g, GHashTable *data)
+void serv_join_chat(GaimConnection *g, GHashTable *data)
 {
 	GaimPluginProtocolInfo *prpl_info = NULL;
 
 	if (g != NULL && g->prpl != NULL)
 		prpl_info = GAIM_PLUGIN_PROTOCOL_INFO(g->prpl);
 
-	if (prpl_info && g_slist_find(connections, g) && prpl_info->join_chat)
+	if (prpl_info && g_list_find(gaim_connections_get_all(), g) && prpl_info->join_chat)
 		prpl_info->join_chat(g, data);
 }
 
-void serv_chat_invite(struct gaim_connection *g, int id, const char *message, const char *name)
+void serv_chat_invite(GaimConnection *g, int id, const char *message, const char *name)
 {
 	GaimPluginProtocolInfo *prpl_info = NULL;
 	char *buffy = message && *message ? g_strdup(message) : NULL;
@@ -643,18 +641,18 @@
 
 	gaim_event_broadcast(event_chat_send_invite, g, (void *)id, name, &buffy);
 
-	if (prpl_info && g_slist_find(connections, g) && prpl_info->chat_invite)
+	if (prpl_info && g_list_find(gaim_connections_get_all(), g) && prpl_info->chat_invite)
 		prpl_info->chat_invite(g, id, buffy, name);
 
 	if (buffy)
 		g_free(buffy);
 }
 
-void serv_chat_leave(struct gaim_connection *g, int id)
+void serv_chat_leave(GaimConnection *g, int id)
 {
 	GaimPluginProtocolInfo *prpl_info = NULL;
 
-	if (!g_slist_find(connections, g))
+	if (!g_list_find(gaim_connections_get_all(), g))
 		return;
 
 	if (g->prpl != NULL)
@@ -664,7 +662,7 @@
 		prpl_info->chat_leave(g, id);
 }
 
-void serv_chat_whisper(struct gaim_connection *g, int id, char *who, char *message)
+void serv_chat_whisper(GaimConnection *g, int id, char *who, char *message)
 {
 	GaimPluginProtocolInfo *prpl_info = NULL;
 
@@ -675,7 +673,7 @@
 		prpl_info->chat_whisper(g, id, who, message);
 }
 
-int serv_chat_send(struct gaim_connection *g, int id, char *message)
+int serv_chat_send(GaimConnection *g, int id, char *message)
 {
 	int val = -EINVAL;
 	GaimPluginProtocolInfo *prpl_info = NULL;
@@ -753,7 +751,7 @@
  * woo. i'm actually going to comment this function. isn't that fun. make
  * sure to follow along, kids
  */
-void serv_got_im(struct gaim_connection *gc, const char *who, const char *msg,
+void serv_got_im(GaimConnection *gc, const char *who, const char *msg,
 				 guint32 flags, time_t mtime, gint len)
 {
 	char *buffy;
@@ -1027,16 +1025,22 @@
 
 
 
-void serv_got_update(struct gaim_connection *gc, char *name, int loggedin,
+void serv_got_update(GaimConnection *gc, char *name, int loggedin,
 					 int evil, time_t signon, time_t idle, int type)
 {
-	struct buddy *b = gaim_find_buddy(gc->account, name);
+	GaimAccount *account;
+	struct buddy *b;
+
+	account = gaim_connection_get_account(gc);
+	b = gaim_find_buddy(account, name);
 
 	if (signon && (GAIM_PLUGIN_PROTOCOL_INFO(gc->prpl)->options &
 				   OPT_PROTO_CORRECT_TIME)) {
 
 		char *tmp = g_strdup(normalize(name));
-		if (!gaim_utf8_strcasecmp(tmp, normalize(gc->username))) {
+		if (!gaim_utf8_strcasecmp(tmp,
+				normalize(gaim_account_get_username(account)))) {
+
 			gc->evil = evil;
 			gc->login_time_official = signon;
 			/*update_idle_times();*/
@@ -1145,7 +1149,7 @@
 }
 
 
-void serv_got_eviled(struct gaim_connection *gc, char *name, int lev)
+void serv_got_eviled(GaimConnection *gc, char *name, int lev)
 {
 	char buf2[1024];
 
@@ -1161,13 +1165,13 @@
 	g_snprintf(buf2, sizeof(buf2),
 			   _("%s has just been warned by %s.\n"
 				 "Your new warning level is %d%%"),
-			   gc->username,
-			   ((name == NULL)? _("an anonymous person") : name), lev);
+			   gaim_account_get_username(gaim_connection_get_account(gc)),
+			   ((name == NULL) ? _("an anonymous person") : name), lev);
 
 	gaim_notify_info(NULL, NULL, buf2, NULL);
 }
 
-void serv_got_typing(struct gaim_connection *gc, char *name, int timeout,
+void serv_got_typing(GaimConnection *gc, char *name, int timeout,
 					 int state) {
 
 	struct buddy *b;
@@ -1194,7 +1198,7 @@
 		gaim_im_start_typing_timeout(im, timeout);
 }
 
-void serv_got_typing_stopped(struct gaim_connection *gc, char *name) {
+void serv_got_typing_stopped(GaimConnection *gc, char *name) {
 
 	struct gaim_conversation *c = gaim_find_conversation(name);
 	struct gaim_im *im;
@@ -1219,7 +1223,7 @@
 }
 
 struct chat_invite_data {
-	struct gaim_connection *gc;
+	GaimConnection *gc;
 	GHashTable *components;
 };
 
@@ -1239,23 +1243,25 @@
 
 
 
-void serv_got_chat_invite(struct gaim_connection *gc, char *name,
+void serv_got_chat_invite(GaimConnection *gc, char *name,
 						  char *who, char *message, GHashTable *data)
 {
+	GaimAccount *account;
 	char buf2[BUF_LONG];
 	struct chat_invite_data *cid = g_new0(struct chat_invite_data, 1);
 
+	account = gaim_connection_get_account(gc);
 
 	gaim_event_broadcast(event_chat_invited, gc, who, name, message);
 
 	if (message)
 		g_snprintf(buf2, sizeof(buf2),
 				   _("User '%s' invites %s to buddy chat room: '%s'\n%s"),
-				   who, gc->username, name, message);
+				   who, gaim_account_get_username(account), name, message);
 	else
 		g_snprintf(buf2, sizeof(buf2),
 				   _("User '%s' invites %s to buddy chat room: '%s'\n"),
-				   who, gc->username, name);
+				   who, gaim_account_get_username(account), name);
 
 	cid->gc = gc;
 	cid->components = data;
@@ -1266,7 +1272,7 @@
 							   G_CALLBACK(chat_invite_data_free));
 }
 
-struct gaim_conversation *serv_got_joined_chat(struct gaim_connection *gc,
+struct gaim_conversation *serv_got_joined_chat(GaimConnection *gc,
 											   int id, char *name)
 {
 	struct gaim_conversation *b;
@@ -1313,7 +1319,7 @@
 	return b;
 }
 
-void serv_got_chat_left(struct gaim_connection *g, int id)
+void serv_got_chat_left(GaimConnection *g, int id)
 {
 	GSList *bcs;
 	struct gaim_conversation *conv = NULL;
@@ -1343,7 +1349,7 @@
 	gaim_conversation_destroy(conv);
 }
 
-void serv_got_chat_in(struct gaim_connection *g, int id, char *who,
+void serv_got_chat_in(GaimConnection *g, int id, char *who,
 					  int whisper, char *message, time_t mtime)
 {
 	int w;
--- a/src/stock.c	Fri May 30 04:13:58 2003 +0000
+++ b/src/stock.c	Fri May 30 09:38:29 2003 +0000
@@ -67,6 +67,7 @@
 	{ GAIM_STOCK_INVITE,          NULL,      GTK_STOCK_JUMP_TO          },
 	{ GAIM_STOCK_LINK,            "buttons", "insert-link-small.png"    },
 	{ GAIM_STOCK_LOGO,            "gaim",    "logo.png"                 },
+	{ GAIM_STOCK_MODIFY,          NULL,      GTK_STOCK_PREFERENCES      },
 	{ GAIM_STOCK_PRIVACY,         NULL,      GTK_STOCK_PROPERTIES       },
 	{ GAIM_STOCK_SEND,            NULL,      GTK_STOCK_CONVERT          },
 	{ GAIM_STOCK_SIGN_ON,         NULL,      GTK_STOCK_EXECUTE          },
@@ -84,6 +85,7 @@
 
 const GtkStockItem stock_items[] =
 {
+	{ GAIM_STOCK_MODIFY,    N_("_Modify"),    0, 0, NULL },
 	{ GAIM_STOCK_OPEN_MAIL, N_("_Open Mail"), 0, 0, NULL }
 };
 
--- a/src/stock.h	Fri May 30 04:13:58 2003 +0000
+++ b/src/stock.h	Fri May 30 09:38:29 2003 +0000
@@ -58,6 +58,7 @@
 #define GAIM_STOCK_INVITE          "gaim-invite"
 #define GAIM_STOCK_LINK            "gaim-link"
 #define GAIM_STOCK_LOGO            "gaim-logo"
+#define GAIM_STOCK_MODIFY          "gaim-modify"
 #define GAIM_STOCK_PRIVACY         "gaim-privacy"
 #define GAIM_STOCK_SEND            "gaim-send"
 #define GAIM_STOCK_SIGN_OFF        "gaim-sign-off"
--- a/src/ui.h	Fri May 30 04:13:58 2003 +0000
+++ b/src/ui.h	Fri May 30 09:38:29 2003 +0000
@@ -140,7 +140,7 @@
 	char name[80];
 	char *message;
 	time_t tm;
-	struct gaim_account *account;
+	GaimAccount *account;
 	int flags;
 	int len;
 };
@@ -205,7 +205,7 @@
 
 /* Functions in aim.c */
 extern void show_login();
-extern void gaim_setup(struct gaim_connection *gc);
+extern void gaim_setup(GaimConnection *gc);
 
 /* Functions in away.c */
 extern void rem_away_mess(GtkWidget *, struct away_message *);
@@ -231,10 +231,10 @@
 extern void show_buddy_list();
 extern void signoff_all();
 extern void do_im_back();
-extern void set_buddy(struct gaim_connection *, struct buddy *);
+extern void set_buddy(GaimConnection *, struct buddy *);
 extern void build_edit_tree();
 extern void do_bp_menu();
-extern void ui_add_buddy(struct gaim_connection *, struct group *, struct buddy *);
+extern void ui_add_buddy(GaimConnection *, struct group *, struct buddy *);
 extern void ui_remove_buddy(struct buddy *);
 extern void ui_add_group(struct group *);
 extern void ui_remove_group(struct group *);
@@ -253,13 +253,13 @@
 /* Functions in dialogs.c */
 extern void alias_dialog_bud(struct buddy *);
 extern void alias_dialog_chat(struct chat *);
-extern void show_warn_dialog(struct gaim_connection *, char *);
+extern void show_warn_dialog(GaimConnection *, char *);
 extern void show_im_dialog();
 extern void show_info_dialog();
-extern void show_add_buddy(struct gaim_connection *, char *, char *, char *);
-extern void show_add_chat(struct gaim_account *, struct group *);
-extern void show_add_group(struct gaim_connection *);
-extern void show_add_perm(struct gaim_connection *, char *, gboolean);
+extern void show_add_buddy(GaimConnection *, char *, char *, char *);
+extern void show_add_chat(GaimAccount *, struct group *);
+extern void show_add_group(GaimConnection *);
+extern void show_add_perm(GaimConnection *, char *, gboolean);
 extern void destroy_all_dialogs();
 extern void show_import_dialog();
 extern void show_export_dialog();
--- a/src/util.c	Fri May 30 04:13:58 2003 +0000
+++ b/src/util.c	Fri May 30 09:38:29 2003 +0000
@@ -568,14 +568,14 @@
 #endif
 }
 
-struct gaim_account *gaim_account_find(const char *name, int protocol)
+GaimAccount *gaim_account_find(const char *name, int protocol)
 {
 	char *who = g_strdup(normalize(name));
 	GSList *accts = gaim_accounts;
-	struct gaim_account *account;
+	GaimAccount *account;
 
 	while (accts) {
-		account = (struct gaim_account *)accts->data;
+		account = (GaimAccount *)accts->data;
 		if (!strcmp(normalize(account->username), who)) {
 			if (protocol != -1) {
 				if (account->protocol == protocol) {
@@ -1008,21 +1008,29 @@
 }
 
 /* AIM URI's ARE FUN :-D */
-const char *handle_uri(char *uri) {
+const char *
+handle_uri(char *uri)
+{
+	const char *username;
 	GString *str;
-	GSList *conn = connections;
-	struct gaim_connection *gc = NULL;
+	GList *conn;
+	GaimConnection *gc = NULL;
+	GaimAccount *account;
 
 	gaim_debug(GAIM_DEBUG_INFO, "handle_uri", "Handling URI: %s\n", uri);
 
 	/* Well, we'd better check to make sure we have at least one
 	   AIM account connected. */
-	while (conn) {
+	for (conn = gaim_connections_get_all(); conn != NULL; conn = conn->next) {
 		gc = conn->data;
-		if (gc->protocol == GAIM_PROTO_OSCAR && isalpha(gc->username[0])) {
+		account = gaim_connection_get_account(gc);
+		username = gaim_account_get_username(account);
+
+		if (gaim_account_get_protocol(account) == GAIM_PROTO_OSCAR &&
+			username != NULL && isalpha(*username)) {
+
 			break;
 		}
-		conn = conn->next;
 	}
 
 	if (gc == NULL)
--- a/src/util.h	Fri May 30 04:13:58 2003 +0000
+++ b/src/util.h	Fri May 30 09:38:29 2003 +0000
@@ -26,6 +26,8 @@
 #ifndef _GAIM_UTIL_H_
 #define _GAIM_UTIL_H_
 
+#include "account.h"
+
 /**
  * Normalizes a string, so that it is suitable for comparison.
  *
@@ -131,8 +133,7 @@
  *
  * @return The gaim_account, if found, or @c NULL otherwise.
  */
-struct gaim_account *gaim_account_find(const char *name,
-									   int protocol) G_GNUC_PURE;
+GaimAccount *gaim_account_find(const char *name, int protocol);
 
 /**
  * Returns the date and time in human-readable form.
@@ -144,7 +145,7 @@
  *
  * @see date()
  */
-char *full_date(void) G_GNUC_PURE;
+char *full_date(void);
 
 /**
  * Looks for %n, %d, or %t in a string, and replaces them with the
@@ -268,7 +269,7 @@
  * @return A time_t.
  */
 time_t get_time(int year, int month, int day,
-				int hour, int min, int sec) G_GNUC_CONST;
+				int hour, int min, int sec);
 
 /**
  * Creates a temporary file and returns a file pointer to it.