changeset 5564:187c740f2a4e

[gaim-migrate @ 5966] Committing what I have so far. Some new functions, and msn is almost done. committer: Tailor Script <tailor@pidgin.im>
author Christian Hammond <chipx86@chipx86.com>
date Fri, 30 May 2003 18:04:45 +0000
parents 9eb5b13fd412
children c3c4aaf69f65
files src/account.c src/account.h src/blist.h src/connection.c src/connection.h src/multi.h src/protocols/msn/buddyicon.c src/protocols/msn/dispatch.c src/protocols/msn/ft.c src/protocols/msn/msn.c src/protocols/msn/msn.h src/protocols/msn/notification.c src/protocols/msn/session.c src/protocols/msn/session.h src/protocols/msn/switchboard.c
diffstat 15 files changed, 298 insertions(+), 267 deletions(-) [+]
line wrap: on
line diff
--- a/src/account.c	Fri May 30 09:38:29 2003 +0000
+++ b/src/account.c	Fri May 30 18:04:45 2003 +0000
@@ -325,7 +325,8 @@
 }
 
 int
-gaim_account_get_int(const GaimAccount *account, const char *name)
+gaim_account_get_int(const GaimAccount *account, const char *name,
+					 int default_value)
 {
 	GaimAccountSetting *setting;
 
@@ -334,13 +335,17 @@
 
 	setting = g_hash_table_lookup(account->settings, name);
 
+	if (setting == NULL)
+		return default_value;
+
 	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)
+gaim_account_get_string(const GaimAccount *account, const char *name,
+						const char *default_value)
 {
 	GaimAccountSetting *setting;
 
@@ -349,13 +354,17 @@
 
 	setting = g_hash_table_lookup(account->settings, name);
 
+	if (setting == NULL)
+		return default_value;
+
 	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)
+gaim_account_get_bool(const GaimAccount *account, const char *name,
+					  gboolean default_value)
 {
 	GaimAccountSetting *setting;
 
@@ -364,6 +373,9 @@
 
 	setting = g_hash_table_lookup(account->settings, name);
 
+	if (setting == NULL)
+		return default_value;
+
 	g_return_val_if_fail(setting->type == GAIM_PREF_BOOLEAN, FALSE);
 
 	return setting->value.bool;
--- a/src/account.h	Fri May 30 09:38:29 2003 +0000
+++ b/src/account.h	Fri May 30 18:04:45 2003 +0000
@@ -263,33 +263,39 @@
 /**
  * Returns a protocol-specific integer setting for an account.
  *
- * @param account The account.
- * @param name    The name of the setting.
+ * @param account       The account.
+ * @param name          The name of the setting.
+ * @param default_value The default value.
  *
  * @return The value.
  */
-int gaim_account_get_int(const GaimAccount *account, const char *name);
+int gaim_account_get_int(const GaimAccount *account, const char *name,
+						 int default_value);
 
 /**
  * Returns a protocol-specific string setting for an account.
  *
- * @param account The account.
- * @param name    The name of the setting.
+ * @param account       The account.
+ * @param name          The name of the setting.
+ * @param default_value The default value.
  *
  * @return The value.
  */
 const char *gaim_account_get_string(const GaimAccount *account,
-									const char *name);
+									const char *name,
+									const char *default_value);
 
 /**
  * Returns a protocol-specific boolean setting for an account.
  *
- * @param account The account.
- * @param name    The name of the setting.
+ * @param account       The account.
+ * @param name          The name of the setting.
+ * @param default_value The default value.
  *
  * @return The value.
  */
-gboolean gaim_account_get_bool(const GaimAccount *account, const char *name);
+gboolean gaim_account_get_bool(const GaimAccount *account, const char *name,
+							   gboolean default_value);
 
 /**
  * Returns a list of all accounts.
--- a/src/blist.h	Fri May 30 09:38:29 2003 +0000
+++ b/src/blist.h	Fri May 30 18:04:45 2003 +0000
@@ -28,6 +28,13 @@
 
 #include <glib.h>
 
+typedef struct _GaimBlistNode GaimBlistNode;
+
+/* TODO Namespace these! */
+struct chat;
+
+#include "account.h"
+
 /**************************************************************************/
 /* Enumerations                                                           */
 /**************************************************************************/
@@ -57,7 +64,6 @@
 /* Data Structures                                                        */
 /**************************************************************************/
 
-typedef struct _GaimBlistNode GaimBlistNode;
 /**
  * A Buddy list node.  This can represent a group, a buddy, or anything else.  This is a base class for struct buddy and
  * struct group and for anything else that wants to put itself in the buddy list. */
--- a/src/connection.c	Fri May 30 09:38:29 2003 +0000
+++ b/src/connection.c	Fri May 30 18:04:45 2003 +0000
@@ -23,6 +23,7 @@
 #include "connection.h"
 
 static GList *connections = NULL;
+static GList *connections_connecting = NULL;
 static GaimConnectionUiOps *connection_ui_ops = NULL;
 
 GaimConnection *
@@ -172,6 +173,8 @@
 		/* Set the time the account came online */
 		time(&gc->login_time);
 
+		connections_connecting = g_list_append(connections_connecting, gc);
+
 		if (ops != NULL && ops->connected != NULL)
 			ops->connected(gc);
 
@@ -231,6 +234,9 @@
 
 		serv_set_permit_deny(gc);
 	}
+	else {
+		connections_connecting = g_list_remove(connections_connecting, gc);
+	}
 }
 
 void
@@ -295,6 +301,24 @@
 }
 
 void
+gaim_connection_error(GaimConnection *gc, const char *text)
+{
+	GaimConnectionUiOps *ops;
+
+	g_return_if_fail(gc   != NULL);
+	g_return_if_fail(text != NULL);
+
+	ops = gaim_get_connection_ui_ops();
+
+	gaim_connection_disconnect(gc);
+
+	if (ops != NULL && ops->disconnected != NULL)
+		ops->disconnected(gc, text);
+
+	gaim_connection_destroy(gc);
+}
+
+void
 gaim_connections_disconnect_all(void)
 {
 	GList *l;
--- a/src/connection.h	Fri May 30 09:38:29 2003 +0000
+++ b/src/connection.h	Fri May 30 18:04:45 2003 +0000
@@ -178,6 +178,14 @@
 									 size_t step, size_t count);
 
 /**
+ * Closes a connection with an error.
+ *
+ * @param gc     The connection.
+ * @param reason The error text.
+ */
+void gaim_connection_error(GaimConnection *gc, const char *reason);
+
+/**
  * Disconnects from all connections.
  */
 void gaim_connections_disconnect_all(void);
@@ -189,6 +197,13 @@
  */
 GList *gaim_connections_get_all(void);
 
+/**
+ * Returns a list of all connections in the process of connecting.
+ *
+ * @return A list of connecting connections.
+ */
+GList *gaim_connections_get_connecting(void);
+
 /**************************************************************************/
 /** @name UI Operations API                                               */
 /**************************************************************************/
--- a/src/multi.h	Fri May 30 09:38:29 2003 +0000
+++ b/src/multi.h	Fri May 30 18:04:45 2003 +0000
@@ -111,9 +111,4 @@
 	int max;
 };
 
-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/protocols/msn/buddyicon.c	Fri May 30 09:38:29 2003 +0000
+++ b/src/protocols/msn/buddyicon.c	Fri May 30 18:04:45 2003 +0000
@@ -71,24 +71,27 @@
 }
 
 static gboolean
-__get_buddy_icon_info(struct gaim_account *account, char **base64,
+__get_buddy_icon_info(GaimAccount *account, char **base64,
 					  char **md5sum, int *file_size, int *base64_size)
 {
 	FILE *fp;
 	struct stat sb;
 	md5_state_t st;
 	md5_byte_t di[16];
+	const char *icon;
 
 	if (base64      != NULL) *base64      = NULL;
 	if (md5sum      != NULL) *md5sum      = NULL;
 	if (file_size   != NULL) *file_size   = 0;
 	if (base64_size != NULL) *base64_size = 0;
 
-	if (!stat(account->iconfile, &sb)) {
+	icon = gaim_account_get_buddy_icon(account);
+
+	if (!stat(icon, &sb)) {
 		if (file_size != NULL)
 			*file_size = sb.st_size;
 
-		if ((fp = fopen(account->iconfile, "rb")) != NULL) {
+		if ((fp = fopen(icon, "rb")) != NULL) {
 			char *buf = g_malloc(sb.st_size + 1);
 			char *temp;
 
@@ -140,7 +143,7 @@
 static gboolean
 __send_icon_data(MsnSwitchBoard *swboard, MsnBuddyIconXfer *buddyicon)
 {
-	struct gaim_connection *gc = swboard->servconn->session->account->gc;
+	GaimConnection *gc = swboard->servconn->session->account->gc;
 	char buf[MSN_BUF_LEN];
 	MsnMessage *msg;
 	int len;
@@ -166,8 +169,7 @@
 		msn_buddy_icon_xfer_destroy(swboard->buddy_icon_xfer);
 		swboard->buddy_icon_xfer = NULL;
 
-		hide_login_progress(gc, _("Write error"));
-		signoff(gc);
+		gaim_connection_error(gc, _("Write error"));
 
 		return FALSE;
 	}
@@ -198,7 +200,7 @@
 __process_invite(MsnServConn *servconn, const MsnMessage *msg)
 {
 	MsnSession *session = servconn->session;
-	struct gaim_connection *gc = session->account->gc;
+	GaimConnection *gc = session->account->gc;
 	MsnMessage *new_msg;
 	MsnSwitchBoard *swboard;
 	MsnBuddyIconXfer *buddyicon;
@@ -277,8 +279,7 @@
 		if ((swboard = msn_session_open_switchboard(session)) == NULL) {
 			msn_message_destroy(new_msg);
 
-			hide_login_progress(gc, _("Write error"));
-			signoff(gc);
+			gaim_connection_error(gc, _("Write error"));
 
 			return FALSE;
 		}
@@ -326,8 +327,7 @@
 			if ((swboard = msn_session_open_switchboard(session)) == NULL) {
 				msn_message_destroy(new_msg);
 
-				hide_login_progress(gc, _("Write error"));
-				signoff(gc);
+				gaim_connection_error(gc, _("Write error"));
 
 				return FALSE;
 			}
@@ -398,7 +398,7 @@
 static gboolean
 __process_data(MsnServConn *servconn, const MsnMessage *msg)
 {
-	struct gaim_connection *gc = servconn->session->account->gc;
+	GaimConnection *gc = servconn->session->account->gc;
 	MsnSwitchBoard *swboard;
 	MsnBuddyIconXfer *buddyicon;
 	MsnMessage *ack_msg;
@@ -432,8 +432,7 @@
 		msn_buddy_icon_xfer_destroy(swboard->buddy_icon_xfer);
 		swboard->buddy_icon_xfer = NULL;
 
-		hide_login_progress(gc, _("Write error"));
-		signoff(gc);
+		gaim_connection_error(gc, _("Write error"));
 
 		return FALSE;
 	}
@@ -475,8 +474,8 @@
 void
 msn_buddy_icon_invite(MsnSwitchBoard *swboard)
 {
-	struct gaim_account *account = swboard->servconn->session->account;
-	struct gaim_connection *gc = account->gc;
+	GaimAccount *account = swboard->servconn->session->account;
+	GaimConnection *gc = account->gc;
 	MsnMessage *msg;
 	char buf[MSN_BUF_LEN];
 	char *md5sum;
@@ -484,7 +483,7 @@
 
 	g_return_if_fail(swboard != NULL);
 
-	if (*account->iconfile == '\0')
+	if (gaim_account_get_buddy_icon(account) == NULL)
 		return; /* We don't have an icon to send. */
 
 	if (!__get_buddy_icon_info(account, NULL, &md5sum,
@@ -519,8 +518,7 @@
 	if (!msn_switchboard_send_msg(swboard, msg)) {
 		msn_message_destroy(msg);
 
-		hide_login_progress(gc, _("Write error"));
-		signoff(gc);
+		gaim_connection_error(gc, _("Write error"));
 
 		return;
 	}
--- a/src/protocols/msn/dispatch.c	Fri May 30 09:38:29 2003 +0000
+++ b/src/protocols/msn/dispatch.c	Fri May 30 18:04:45 2003 +0000
@@ -30,7 +30,7 @@
 __ver_cmd(MsnServConn *servconn, const char *command, const char **params,
 		  size_t param_count)
 {
-	struct gaim_connection *gc = servconn->session->account->gc;
+	GaimConnection *gc = servconn->session->account->gc;
 	size_t i;
 	gboolean msnp5_found = FALSE;
 
@@ -42,15 +42,13 @@
 	}
 
 	if (!msnp5_found) {
-		hide_login_progress(gc, _("Protocol not supported"));
-		signoff(gc);
+		gaim_connection_error(gc, _("Protocol not supported"));
 
 		return FALSE;
 	}
 
 	if (!msn_servconn_send_command(servconn, "INF", NULL)) {
-		hide_login_progress(gc, _("Unable to request INF\n"));
-		signoff(gc);
+		gaim_connection_error(gc, _("Unable to request INF\n"));
 
 		return FALSE;
 	}
@@ -62,26 +60,27 @@
 __inf_cmd(MsnServConn *servconn, const char *command, const char **params,
 		  size_t param_count)
 {
-	struct gaim_connection *gc = servconn->session->account->gc;
+	GaimAccount *account = servconn->session->account;
+	GaimConnection *gc = gaim_account_get_connection(account);
 	char outparams[MSN_BUF_LEN];
 
 	if (strcmp(params[1], "MD5")) {
-		hide_login_progress(gc, _("Unable to login using MD5"));
-		signoff(gc);
+		gaim_connection_error(gc, _("Unable to login using MD5"));
 
 		return FALSE;
 	}
 
-	g_snprintf(outparams, sizeof(outparams), "MD5 I %s", gc->username);
+	g_snprintf(outparams, sizeof(outparams), "MD5 I %s",
+			   gaim_account_get_username(account));
 
 	if (!msn_servconn_send_command(servconn, "USR", outparams)) {
-		hide_login_progress(gc, _("Unable to send USR\n"));
-		signoff(gc);
+		gaim_connection_error(gc, _("Unable to send USR\n"));
 
 		return FALSE;
 	}
 
-	set_login_progress(gc, 3, _("Requesting to send password"));
+	gaim_connection_update_progress(gc, _("Requesting to send password"),
+									3, MSN_CONNECT_STEPS);
 
 	return TRUE;
 }
@@ -91,14 +90,13 @@
 		  size_t param_count)
 {
 	MsnSession *session = servconn->session;
-	struct gaim_connection *gc = servconn->session->account->gc;
+	GaimConnection *gc = servconn->session->account->gc;
 	char *host;
 	int port;
 	char *c;
 
 	if (param_count < 2 || strcmp(params[1], "NS")) {
-		hide_login_progress(gc, _("Got invalid XFR\n"));
-		signoff(gc);
+		gaim_connection_error(gc, _("Got invalid XFR\n"));
 
 		return FALSE;
 	}
@@ -125,8 +123,7 @@
 	g_free(host);
 
 	if (!msn_servconn_connect(session->notification_conn)) {
-		hide_login_progress(gc, _("Unable to transfer"));
-		signoff(gc);
+		gaim_connection_error(gc, _("Unable to transfer"));
 	}
 
 	return FALSE;
@@ -136,7 +133,7 @@
 __unknown_cmd(MsnServConn *servconn, const char *command, const char **params,
 			  size_t param_count)
 {
-	struct gaim_connection *gc = servconn->session->account->gc;
+	GaimConnection *gc = servconn->session->account->gc;
 
 	if (isdigit(*command)) {
 		char buf[4];
@@ -144,12 +141,10 @@
 		strncpy(buf, command, 4);
 		buf[4] = '\0';
 
-		hide_login_progress(gc, (char *)msn_error_get_text(atoi(buf)));
+		gaim_connection_error(gc, (char *)msn_error_get_text(atoi(buf)));
 	}
 	else
-		hide_login_progress(gc, _("Unable to parse message."));
-
-	signoff(gc);
+		gaim_connection_error(gc, _("Unable to parse message."));
 
 	return FALSE;
 }
@@ -159,27 +154,26 @@
 {
 	MsnServConn *dispatch = data;
 	MsnSession *session = dispatch->session;
-	struct gaim_connection *gc = session->account->gc;
+	GaimConnection *gc = session->account->gc;
 
 	if (source == -1) {
-		hide_login_progress(session->account->gc, _("Unable to connect"));
-		signoff(session->account->gc);
+		gaim_connection_error(session->account->gc, _("Unable to connect"));
 		return FALSE;
 	}
 
-	set_login_progress(gc, 1, _("Connecting"));
+	gaim_connection_update_progress(gc, _("Connecting"), 1, MSN_CONNECT_STEPS);
 
 	if (dispatch->fd != source)
 		dispatch->fd = source;
 
 	if (!msn_servconn_send_command(dispatch, "VER",
 								   "MSNP7 MSNP6 MSNP5 MSNP4 CVR0")) {
-		hide_login_progress(gc, _("Unable to write to server"));
-		signoff(gc);
+		gaim_connection_error(gc, _("Unable to write to server"));
 		return FALSE;
 	}
 
-	set_login_progress(session->account->gc, 2, _("Syncing with server"));
+	gaim_connection_update_progress(gc, _("Syncing with server"),
+									2, MSN_CONNECT_STEPS);
 
 	return TRUE;
 }
@@ -188,12 +182,11 @@
 __failed_read_cb(gpointer data, gint source, GaimInputCondition cond)
 {
 	MsnServConn *dispatch = data;
-	struct gaim_connection *gc;
+	GaimConnection *gc;
 
 	gc = dispatch->session->account->gc;
 
-	hide_login_progress(gc, _("Error reading from server"));
-	signoff(gc);
+	gaim_connection_error(gc, _("Error reading from server"));
 }
 
 MsnServConn *
--- a/src/protocols/msn/ft.c	Fri May 30 09:38:29 2003 +0000
+++ b/src/protocols/msn/ft.c	Fri May 30 18:04:45 2003 +0000
@@ -29,7 +29,7 @@
 G_MODULE_IMPORT GSList *connections;
 
 static struct gaim_xfer *
-find_xfer_by_cookie(struct gaim_connection *gc, unsigned long cookie)
+find_xfer_by_cookie(GaimConnection *gc, unsigned long cookie)
 {
 	GSList *g;
 	struct msn_data *md = (struct msn_data *)gc->proto_data;
@@ -52,7 +52,7 @@
 static void
 msn_xfer_init(struct gaim_xfer *xfer)
 {
-	struct gaim_account *account;
+	GaimAccount *account;
 	struct msn_xfer_data *xfer_data;
 	struct msn_switchboard *ms;
 	char header[MSN_BUF_LEN];
@@ -117,7 +117,7 @@
 static void
 msn_xfer_end(struct gaim_xfer *xfer)
 {
-	struct gaim_account *account;
+	GaimAccount *account;
 	struct msn_xfer_data *xfer_data;
 	struct msn_data *md;
 
@@ -142,7 +142,7 @@
 static void
 msn_xfer_cancel_send(struct gaim_xfer *xfer)
 {
-	struct gaim_account *account;
+	GaimAccount *account;
 	struct msn_xfer_data *xfer_data;
 	struct msn_data *md;
 
@@ -162,7 +162,7 @@
 static void
 msn_xfer_cancel_recv(struct gaim_xfer *xfer)
 {
-	struct gaim_account *account;
+	GaimAccount *account;
 	struct msn_xfer_data *xfer_data;
 	struct msn_data *md;
 
@@ -222,7 +222,7 @@
 static size_t
 msn_xfer_write(const char *buffer, size_t size, struct gaim_xfer *xfer)
 {
-	struct gaim_account *account;
+	GaimAccount *account;
 	struct msn_xfer_data *xfer_data;
 	struct msn_data *md;
 	unsigned char header[3];
@@ -254,7 +254,7 @@
 msn_process_msnftp(struct gaim_xfer *xfer, gint source, const char *buf)
 {
 	struct msn_xfer_data *xfer_data;
-	struct gaim_account *account;
+	GaimAccount *account;
 	char sendbuf[MSN_BUF_LEN];
 
 	xfer_data = (struct msn_xfer_data *)xfer->data;
@@ -367,7 +367,7 @@
 static void
 msn_msnftp_connect(gpointer data, gint source, GaimInputCondition cond)
 {
-	struct gaim_account *account;
+	GaimAccount *account;
 	struct gaim_xfer *xfer;
 	struct msn_xfer_data *xfer_data;
 	char buf[MSN_BUF_LEN];
--- a/src/protocols/msn/msn.c	Fri May 30 09:38:29 2003 +0000
+++ b/src/protocols/msn/msn.c	Fri May 30 18:04:45 2003 +0000
@@ -37,15 +37,16 @@
 
 typedef struct
 {
-	struct gaim_connection *gc;
+	GaimConnection *gc;
 	const char *passport;
 
 } MsnMobileData;
 
 static void
-msn_act_id(struct gaim_connection *gc, const char *entry)
+msn_act_id(GaimConnection *gc, const char *entry)
 {
 	MsnSession *session = gc->proto_data;
+	GaimAccount *account = gaim_connection_get_account(gc);
 	char outparams[MSN_BUF_LEN];
 	char *alias;
 
@@ -61,20 +62,20 @@
 	}
 
 	g_snprintf(outparams, sizeof(outparams), "%s %s",
-			   gc->username, msn_url_encode(alias));
+			   gaim_account_get_username(account), msn_url_encode(alias));
 
 	g_free(alias);
 
 	if (!msn_servconn_send_command(session->notification_conn,
 								   "REA", outparams)) {
 
-		hide_login_progress(gc, _("Write error"));
-		signoff(gc);
+		gaim_connection_error(gc, _("Write error"));
+		return;
 	}
 }
 
 static void
-msn_set_prp(struct gaim_connection *gc, const char *type, const char *entry)
+msn_set_prp(GaimConnection *gc, const char *type, const char *entry)
 {
 	MsnSession *session = gc->proto_data;
 	char outparams[MSN_BUF_LEN];
@@ -87,37 +88,37 @@
 	if (!msn_servconn_send_command(session->notification_conn,
 								   "PRP", outparams)) {
 
-		hide_login_progress(gc, _("Write error"));
-		signoff(gc);
+		gaim_connection_error(gc, _("Write error"));
+		return;
 	}
 }
 
 static void
-msn_set_home_phone_cb(struct gaim_connection *gc, const char *entry)
+msn_set_home_phone_cb(GaimConnection *gc, const char *entry)
 {
 	msn_set_prp(gc, "PHH", entry);
 }
 
 static void
-msn_set_work_phone_cb(struct gaim_connection *gc, const char *entry)
+msn_set_work_phone_cb(GaimConnection *gc, const char *entry)
 {
 	msn_set_prp(gc, "PHW", entry);
 }
 
 static void
-msn_set_mobile_phone_cb(struct gaim_connection *gc, const char *entry)
+msn_set_mobile_phone_cb(GaimConnection *gc, const char *entry)
 {
 	msn_set_prp(gc, "PHM", entry);
 }
 
 static void
-__enable_msn_pages_cb(struct gaim_connection *gc)
+__enable_msn_pages_cb(GaimConnection *gc)
 {
 	msn_set_prp(gc, "MOB", "Y");
 }
 
 static void
-__disable_msn_pages_cb(struct gaim_connection *gc)
+__disable_msn_pages_cb(GaimConnection *gc)
 {
 	msn_set_prp(gc, "MOB", "N");
 }
@@ -145,8 +146,7 @@
 
 	if (!msn_servconn_write(servconn, page_str, strlen(page_str))) {
 
-		hide_login_progress(data->gc, _("Write error"));
-		signoff(data->gc);
+		gaim_connection_error(data->gc, _("Write error"));
 	}
 
 	g_free(page_str);
@@ -161,18 +161,18 @@
 /* -- */
 
 static void
-msn_show_set_friendly_name(struct gaim_connection *gc)
+msn_show_set_friendly_name(GaimConnection *gc)
 {
 	gaim_request_input(gc, NULL, _("Set your friendly name."),
 					   _("This is the name that other MSN buddies will "
 						 "see you as."),
-					   gc->displayname, FALSE,
+					   gaim_connection_get_display_name(gc), FALSE,
 					   _("OK"), G_CALLBACK(msn_act_id),
 					   _("Cancel"), NULL, gc);
 }
 
 static void
-msn_show_set_home_phone(struct gaim_connection *gc)
+msn_show_set_home_phone(GaimConnection *gc)
 {
 	MsnSession *session = gc->proto_data;
 
@@ -183,7 +183,7 @@
 }
 
 static void
-msn_show_set_work_phone(struct gaim_connection *gc)
+msn_show_set_work_phone(GaimConnection *gc)
 {
 	MsnSession *session = gc->proto_data;
 
@@ -194,7 +194,7 @@
 }
 
 static void
-msn_show_set_mobile_phone(struct gaim_connection *gc)
+msn_show_set_mobile_phone(GaimConnection *gc)
 {
 	MsnSession *session = gc->proto_data;
 
@@ -205,7 +205,7 @@
 }
 
 static void
-msn_show_set_mobile_pages(struct gaim_connection *gc)
+msn_show_set_mobile_pages(GaimConnection *gc)
 {
 	gaim_request_action(gc, NULL, _("Allow MSN Mobile pages?"),
 						_("Do you want to allow or disallow people on "
@@ -218,7 +218,7 @@
 }
 
 static void
-__show_send_to_mobile_cb(struct gaim_connection *gc, const char *passport)
+__show_send_to_mobile_cb(GaimConnection *gc, const char *passport)
 {
 	MsnUser *user;
 	MsnSession *session = gc->proto_data;
@@ -243,7 +243,7 @@
  **************************************************************************/
 
 static const char *
-msn_list_icon(struct gaim_account *a, struct buddy *b)
+msn_list_icon(GaimAccount *a, struct buddy *b)
 {
 	return "msn";
 }
@@ -304,7 +304,7 @@
 }
 
 static GList *
-msn_away_states(struct gaim_connection *gc)
+msn_away_states(GaimConnection *gc)
 {
 	GList *m = NULL;
 
@@ -320,7 +320,7 @@
 }
 
 static GList *
-msn_actions(struct gaim_connection *gc)
+msn_actions(GaimConnection *gc)
 {
 	GList *m = NULL;
 	struct proto_actions_menu *pam;
@@ -371,7 +371,7 @@
 }
 
 static GList *
-msn_buddy_menu(struct gaim_connection *gc, const char *who)
+msn_buddy_menu(GaimConnection *gc, const char *who)
 {
 	MsnUser *user;
 	struct proto_buddy_menu *pbm;
@@ -395,41 +395,41 @@
 }
 
 static void
-msn_login(struct gaim_account *account)
+msn_login(GaimAccount *account)
 {
-	struct gaim_connection *gc;
+	GaimConnection *gc;
 	MsnSession *session;
+	const char *username;
 	const char *server;
 	int port;
 
-	server = (*account->proto_opt[USEROPT_MSNSERVER]
-			  ? account->proto_opt[USEROPT_MSNSERVER]
-			  : MSN_SERVER);
-	port = (*account->proto_opt[USEROPT_MSNPORT]
-			? atoi(account->proto_opt[USEROPT_MSNPORT])
-			: MSN_PORT);
+	server = gaim_account_get_string(account, "server", MSN_SERVER);
+	port   = gaim_account_get_int(account,    "port",   MSN_PORT);
 
-
-	gc = new_gaim_conn(account);
+	gc = gaim_account_get_connection(account);
 
 	session = msn_session_new(account, server, port);
 	session->prpl = my_protocol;
 
 	gc->proto_data = session;
 
-	set_login_progress(gc, 1, _("Connecting"));
+	gaim_connection_update_progress(gc, _("Connecting"), 0, MSN_CONNECT_STEPS);
 
-	g_snprintf(gc->username, sizeof(gc->username), "%s",
-			   msn_normalize(gc->username));
+	/* Hmm, I don't like this. */
+	username = msn_normalize(gaim_account_get_username(account));
+
+	if (strcmp(username, gaim_account_get_username(account)))
+		gaim_account_set_username(account, username);
 
 	if (!msn_session_connect(session)) {
-		hide_login_progress(gc, _("Unable to connect"));
-		signoff(gc);
+		gaim_connection_error(gc, _("Unable to connect"));
+
+		return;
 	}
 }
 
 static void
-msn_close(struct gaim_connection *gc)
+msn_close(GaimConnection *gc)
 {
 	MsnSession *session = gc->proto_data;
 
@@ -439,15 +439,16 @@
 }
 
 static int
-msn_send_im(struct gaim_connection *gc, const char *who, const char *message,
+msn_send_im(GaimConnection *gc, const char *who, const char *message,
 			int len, int flags)
 {
+	GaimAccount *account = gaim_connection_get_account(gc);
 	MsnSession *session = gc->proto_data;
 	MsnSwitchBoard *swboard;
 
 	swboard = msn_session_find_switch_with_passport(session, who);
 
-	if (g_ascii_strcasecmp(who, gc->username)) {
+	if (g_ascii_strcasecmp(who, gaim_account_get_username(account))) {
 		MsnMessage *msg;
 		MsnUser *user;
 
@@ -467,8 +468,7 @@
 			if ((swboard = msn_session_open_switchboard(session)) == NULL) {
 				msn_message_destroy(msg);
 
-				hide_login_progress(gc, _("Write error"));
-				signoff(gc);
+				gaim_connection_error(gc, _("Write error"));
 
 				return 1;
 			}
@@ -494,8 +494,9 @@
 }
 
 static int
-msn_send_typing(struct gaim_connection *gc, char *who, int typing)
+msn_send_typing(GaimConnection *gc, char *who, int typing)
 {
+	GaimAccount *account = gaim_connection_get_account(gc);
 	MsnSession *session = gc->proto_data;
 	MsnSwitchBoard *swboard;
 	MsnMessage *msg;
@@ -504,7 +505,7 @@
 	if (!typing)
 		return 0;
 
-	if (!g_ascii_strcasecmp(who, gc->username)) {
+	if (!g_ascii_strcasecmp(who, gaim_account_get_username(account))) {
 		/* We'll just fake it, since we're sending to ourself. */
 		serv_got_typing(gc, who, MSN_TYPING_RECV_TIMEOUT, TYPING);
 
@@ -523,7 +524,8 @@
 	msn_message_set_receiver(msg, user);
 	msn_message_set_charset(msg, NULL);
 	msn_message_set_flag(msg, 'U');
-	msn_message_set_attr(msg, "TypingUser", gc->username);
+	msn_message_set_attr(msg, "TypingUser",
+						 gaim_account_get_username(account));
 	msn_message_set_attr(msg, "User-Agent", NULL);
 	msn_message_set_body(msg, "\r\n");
 
@@ -536,7 +538,7 @@
 }
 
 static void
-msn_set_away(struct gaim_connection *gc, char *state, char *msg)
+msn_set_away(GaimConnection *gc, char *state, char *msg)
 {
 	MsnSession *session = gc->proto_data;
 	const char *away;
@@ -577,13 +579,13 @@
 		away = "NLN";
 
 	if (!msn_servconn_send_command(session->notification_conn, "CHG", away)) {
-		hide_login_progress(gc, _("Write error"));
-		signoff(gc);
+		gaim_connection_error(gc, _("Write error"));
+		return;
 	}
 }
 
 static void
-msn_set_idle(struct gaim_connection *gc, int idle)
+msn_set_idle(GaimConnection *gc, int idle)
 {
 	MsnSession *session = gc->proto_data;
 
@@ -593,13 +595,13 @@
 	if (!msn_servconn_send_command(session->notification_conn, "CHG",
 								   (idle ? "IDL" : "NLN"))) {
 
-		hide_login_progress(gc, _("Write error"));
-		signoff(gc);
+		gaim_connection_error(gc, _("Write error"));
+		return;
 	}
 }
 
 static void
-msn_add_buddy(struct gaim_connection *gc, const char *name)
+msn_add_buddy(GaimConnection *gc, const char *name)
 {
 	MsnSession *session = gc->proto_data;
 	char *who;
@@ -628,13 +630,13 @@
 
 	if (!msn_servconn_send_command(session->notification_conn,
 								   "ADD", outparams)) {
-		hide_login_progress(gc, _("Write error"));
-		signoff(gc);
+		gaim_connection_error(gc, _("Write error"));
+		return;
 	}
 }
 
 static void
-msn_rem_buddy(struct gaim_connection *gc, char *who, char *group)
+msn_rem_buddy(GaimConnection *gc, char *who, char *group)
 {
 	MsnSession *session = gc->proto_data;
 	char outparams[MSN_BUF_LEN];
@@ -644,13 +646,13 @@
 	if (!msn_servconn_send_command(session->notification_conn,
 								   "REM", outparams)) {
 
-		hide_login_progress(gc, _("Write error"));
-		signoff(gc);
+		gaim_connection_error(gc, _("Write error"));
+		return;
 	}
 }
 
 static void
-msn_add_permit(struct gaim_connection *gc, const char *who)
+msn_add_permit(GaimConnection *gc, const char *who)
 {
 	MsnSession *session = gc->proto_data;
 	char buf[MSN_BUF_LEN];
@@ -676,8 +678,7 @@
 		if (!msn_servconn_send_command(session->notification_conn,
 									   "REM", buf)) {
 
-			hide_login_progress(gc, _("Write error"));
-			signoff(gc);
+			gaim_connection_error(gc, _("Write error"));
 			return;
 		}
 	}
@@ -685,13 +686,13 @@
 	g_snprintf(buf, sizeof(buf), "AL %s %s", who, who);
 
 	if (!msn_servconn_send_command(session->notification_conn, "ADD", buf)) {
-		hide_login_progress(gc, _("Write error"));
-		signoff(gc);
+		gaim_connection_error(gc, _("Write error"));
+		return;
 	}
 }
 
 static void
-msn_add_deny(struct gaim_connection *gc, const char *who)
+msn_add_deny(GaimConnection *gc, const char *who)
 {
 	MsnSession *session = gc->proto_data;
 	char buf[MSN_BUF_LEN];
@@ -718,8 +719,7 @@
 		if (!msn_servconn_send_command(session->notification_conn,
 									   "REM", buf)) {
 
-			hide_login_progress(gc, _("Write error"));
-			signoff(gc);
+			gaim_connection_error(gc, _("Write error"));
 			return;
 		}
 	}
@@ -727,14 +727,13 @@
 	g_snprintf(buf, sizeof(buf), "BL %s %s", who, who);
 
 	if (!msn_servconn_send_command(session->notification_conn, "ADD", buf)) {
-		hide_login_progress(gc, _("Write error"));
-		signoff(gc);
+		gaim_connection_error(gc, _("Write error"));
 		return;
 	}
 }
 
 static void
-msn_rem_permit(struct gaim_connection *gc, const char *who)
+msn_rem_permit(GaimConnection *gc, const char *who)
 {
 	MsnSession *session = gc->proto_data;
 	char buf[MSN_BUF_LEN];
@@ -742,8 +741,7 @@
 	g_snprintf(buf, sizeof(buf), "AL %s", who);
 
 	if (!msn_servconn_send_command(session->notification_conn, "REM", buf)) {
-		hide_login_progress(gc, _("Write error"));
-		signoff(gc);
+		gaim_connection_error(gc, _("Write error"));
 		return;
 	}
 
@@ -752,14 +750,13 @@
 	g_snprintf(buf, sizeof(buf), "BL %s %s", who, who);
 
 	if (!msn_servconn_send_command(session->notification_conn, "ADD", buf)) {
-		hide_login_progress(gc, _("Write error"));
-		signoff(gc);
+		gaim_connection_error(gc, _("Write error"));
 		return;
 	}
 }
 
 static void
-msn_rem_deny(struct gaim_connection *gc, const char *who)
+msn_rem_deny(GaimConnection *gc, const char *who)
 {
 	MsnSession *session = gc->proto_data;
 	char buf[MSN_BUF_LEN];
@@ -767,8 +764,7 @@
 	g_snprintf(buf, sizeof(buf), "BL %s", who);
 
 	if (!msn_servconn_send_command(session->notification_conn, "REM", buf)) {
-		hide_login_progress(gc, _("Write error"));
-		signoff(gc);
+		gaim_connection_error(gc, _("Write error"));
 		return;
 	}
 
@@ -777,21 +773,21 @@
 	g_snprintf(buf, sizeof(buf), "AL %s %s", who, who);
 
 	if (!msn_servconn_send_command(session->notification_conn, "ADD", buf)) {
-		hide_login_progress(gc, _("Write error"));
-		signoff(gc);
+		gaim_connection_error(gc, _("Write error"));
 		return;
 	}
 }
 
 static void
-msn_set_permit_deny(struct gaim_connection *gc)
+msn_set_permit_deny(GaimConnection *gc)
 {
+	GaimAccount *account = gaim_connection_get_account(gc);
 	MsnSession *session = gc->proto_data;
 	char buf[MSN_BUF_LEN];
 	GSList *s, *t = NULL;
 
-	if (gc->account->permdeny == PERMIT_ALL ||
-		gc->account->permdeny == DENY_SOME) {
+	if (account->perm_deny == PERMIT_ALL ||
+		account->perm_deny == DENY_SOME) {
 
 		strcpy(buf, "AL");
 	}
@@ -799,8 +795,7 @@
 		strcpy(buf, "BL");
 
 	if (!msn_servconn_send_command(session->notification_conn, "BLP", buf)) {
-		hide_login_progress(gc, _("Write error"));
-		signoff(gc);
+		gaim_connection_error(gc, _("Write error"));
 		return;
 	}
 
@@ -850,8 +845,7 @@
 
 			if (!msn_servconn_send_command(session->notification_conn,
 										   "ADD", buf)) {
-				hide_login_progress(gc, _("Write error"));
-				signoff(gc);
+				gaim_connection_error(gc, _("Write error"));
 				return;
 			}
 		}
@@ -889,8 +883,7 @@
 
 			if (!msn_servconn_send_command(session->notification_conn,
 										   "ADD", buf)) {
-				hide_login_progress(gc, _("Write error"));
-				signoff(gc);
+				gaim_connection_error(gc, _("Write error"));
 				return;
 			}
 		}
@@ -907,7 +900,7 @@
 }
 
 static void
-msn_chat_invite(struct gaim_connection *gc, int id, const char *msg,
+msn_chat_invite(GaimConnection *gc, int id, const char *msg,
 				const char *who)
 {
 	MsnSession *session = gc->proto_data;
@@ -921,7 +914,7 @@
 }
 
 static void
-msn_chat_leave(struct gaim_connection *gc, int id)
+msn_chat_leave(GaimConnection *gc, int id)
 {
 	MsnSession *session = gc->proto_data;
 	MsnSwitchBoard *swboard = msn_session_find_switch_with_id(session, id);
@@ -937,8 +930,9 @@
 }
 
 static int
-msn_chat_send(struct gaim_connection *gc, int id, char *message)
+msn_chat_send(GaimConnection *gc, int id, char *message)
 {
+	GaimAccount *account = gaim_connection_get_account(gc);
 	MsnSession *session = gc->proto_data;
 	MsnSwitchBoard *swboard = msn_session_find_switch_with_id(session, id);
 	MsnMessage *msg;
@@ -965,13 +959,14 @@
 
 	msn_message_destroy(msg);
 
-	serv_got_chat_in(gc, id, gc->username, 0, message, time(NULL));
+	serv_got_chat_in(gc, id, (char *)gaim_account_get_username(account),
+					 0, message, time(NULL));
 
 	return 0;
 }
 
 static void
-msn_keepalive(struct gaim_connection *gc)
+msn_keepalive(GaimConnection *gc)
 {
 	MsnSession *session = gc->proto_data;
 	char buf[MSN_BUF_LEN];
@@ -981,14 +976,13 @@
 	if (msn_servconn_write(session->notification_conn,
 						   buf, strlen(buf)) < 0) {
 
-		hide_login_progress(gc, _("Write error"));
-		signoff(gc);
+		gaim_connection_error(gc, _("Write error"));
 		return;
 	}
 }
 
 static void
-msn_group_buddy(struct gaim_connection *gc, const char *who,
+msn_group_buddy(GaimConnection *gc, const char *who,
 				const char *old_group_name, const char *new_group_name)
 {
 	MsnSession *session = gc->proto_data;
@@ -1006,8 +1000,7 @@
 
 		if (!msn_servconn_send_command(session->notification_conn,
 									   "ADG", outparams)) {
-			hide_login_progress(gc, _("Write error"));
-			signoff(gc);
+			gaim_connection_error(gc, _("Write error"));
 			return;
 		}
 
@@ -1027,8 +1020,7 @@
 
 		if (!msn_servconn_send_command(session->notification_conn,
 									   "ADD", outparams)) {
-			hide_login_progress(gc, _("Write error"));
-			signoff(gc);
+			gaim_connection_error(gc, _("Write error"));
 			return;
 		}
 	}
@@ -1039,8 +1031,7 @@
 
 		if (!msn_servconn_send_command(session->notification_conn,
 									   "REM", outparams)) {
-			hide_login_progress(gc, _("Write error"));
-			signoff(gc);
+			gaim_connection_error(gc, _("Write error"));
 			return;
 		}
 
@@ -1051,8 +1042,7 @@
 			if (!msn_servconn_send_command(session->notification_conn,
 										   "RMG", outparams)) {
 
-				hide_login_progress(gc, _("Write error"));
-				signoff(gc);
+				gaim_connection_error(gc, _("Write error"));
 				return;
 			}
 		}
@@ -1060,7 +1050,7 @@
 }
 
 static void
-msn_rename_group(struct gaim_connection *gc, const char *old_group_name,
+msn_rename_group(GaimConnection *gc, const char *old_group_name,
 				 const char *new_group_name, GList *members)
 {
 	MsnSession *session = gc->proto_data;
@@ -1076,8 +1066,7 @@
 
 		if (!msn_servconn_send_command(session->notification_conn,
 									   "REG", outparams)) {
-			hide_login_progress(gc, _("Write error"));
-			signoff(gc);
+			gaim_connection_error(gc, _("Write error"));
 			return;
 		}
 
@@ -1089,8 +1078,7 @@
 
 		if (!msn_servconn_send_command(session->notification_conn,
 									   "ADG", outparams)) {
-			hide_login_progress(gc, _("Write error"));
-			signoff(gc);
+			gaim_connection_error(gc, _("Write error"));
 			return;
 		}
 	}
@@ -1106,8 +1094,9 @@
 }
 
 static void
-msn_convo_closed(struct gaim_connection *gc, char *who)
+msn_convo_closed(GaimConnection *gc, char *who)
 {
+	GaimAccount *account = gaim_connection_get_account(gc);
 	MsnSession *session = gc->proto_data;
 	MsnSwitchBoard *swboard;
 	
@@ -1116,7 +1105,8 @@
 	if (swboard != NULL) {
 		char sendbuf[256];
 
-		g_snprintf(sendbuf, sizeof(sendbuf), "BYE %s\r\n", gc->username);
+		g_snprintf(sendbuf, sizeof(sendbuf), "BYE %s\r\n",
+				   gaim_account_get_username(account));
 
 		msn_servconn_write(swboard->servconn, sendbuf, strlen(sendbuf));
 
--- a/src/protocols/msn/msn.h	Fri May 30 09:38:29 2003 +0000
+++ b/src/protocols/msn/msn.h	Fri May 30 18:04:45 2003 +0000
@@ -71,6 +71,8 @@
 
 #define MSN_FT_GUID "{5D3E02AB-6190-11d3-BBBB-00C04F795683}"
 
+#define MSN_CONNECT_STEPS 7
+
 #define MSN_CLIENTINFO \
 	"Client-Name: Gaim/" VERSION "\r\n" \
 	"Chat-Logging: Y\r\n" \
--- a/src/protocols/msn/notification.c	Fri May 30 09:38:29 2003 +0000
+++ b/src/protocols/msn/notification.c	Fri May 30 18:04:45 2003 +0000
@@ -27,7 +27,7 @@
 
 typedef struct
 {
-	struct gaim_connection *gc;
+	GaimConnection *gc;
 	MsnUser *user;
 
 } MsnPermitAdd;
@@ -43,7 +43,7 @@
 __add_buddy(MsnServConn *servconn, MsnUser *user)
 {
 	MsnSession *session = servconn->session;
-	struct gaim_connection *gc = session->account->gc;
+	GaimConnection *gc = session->account->gc;
 	struct buddy *b;
 	MsnGroup *group = NULL;
 	struct group *g = NULL;
@@ -125,8 +125,7 @@
 
 		if (msn_servconn_send_command(session->notification_conn,
 									  "ADD", outparams) <= 0) {
-			hide_login_progress(pa->gc, _("Write error"));
-			signoff(pa->gc);
+			gaim_connection_error(pa->gc, _("Write error"));
 			return;
 		}
 
@@ -155,8 +154,7 @@
 
 		if (msn_servconn_send_command(session->notification_conn,
 									  "ADD", outparams) <= 0) {
-			hide_login_progress(pa->gc, _("Write error"));
-			signoff(pa->gc);
+			gaim_connection_error(pa->gc, _("Write error"));
 			return;
 		}
 
@@ -217,7 +215,7 @@
 __ver_cmd(MsnServConn *servconn, const char *command, const char **params,
 		  size_t param_count)
 {
-	struct gaim_connection *gc = servconn->session->account->gc;
+	GaimConnection *gc = servconn->session->account->gc;
 	size_t i;
 	gboolean msnp5_found = FALSE;
 
@@ -229,15 +227,13 @@
 	}
 
 	if (!msnp5_found) {
-		hide_login_progress(gc, _("Protocol not supported"));
-		signoff(gc);
+		gaim_connection_error(gc, _("Protocol not supported"));
 
 		return FALSE;
 	}
 
 	if (!msn_servconn_send_command(servconn, "INF", NULL)) {
-		hide_login_progress(gc, _("Unable to request INF"));
-		signoff(gc);
+		gaim_connection_error(gc, _("Unable to request INF"));
 
 		return FALSE;
 	}
@@ -249,26 +245,27 @@
 __inf_cmd(MsnServConn *servconn, const char *command, const char **params,
 		  size_t param_count)
 {
-	struct gaim_connection *gc = servconn->session->account->gc;
+	GaimAccount *account = servconn->session->account;
+	GaimConnection *gc = gaim_account_get_connection(account);
 	char outparams[MSN_BUF_LEN];
 
 	if (strcmp(params[1], "MD5")) {
-		hide_login_progress(gc, _("Unable to login using MD5"));
-		signoff(gc);
+		gaim_connection_error(gc, _("Unable to login using MD5"));
 
 		return FALSE;
 	}
 
-	g_snprintf(outparams, sizeof(outparams), "MD5 I %s", gc->username);
+	g_snprintf(outparams, sizeof(outparams), "MD5 I %s",
+			   gaim_account_get_username(account));
 
 	if (!msn_servconn_send_command(servconn, "USR", outparams)) {
-		hide_login_progress(gc, _("Unable to send USR"));
-		signoff(gc);
+		gaim_connection_error(gc, _("Unable to send USR"));
 
 		return FALSE;
 	}
 
-	set_login_progress(gc, 4, _("Requesting to send password"));
+	gaim_connection_update_progress(gc, _("Requesting to send password"),
+									4, MSN_CONNECT_STEPS);
 
 	return TRUE;
 }
@@ -278,7 +275,8 @@
 		  size_t param_count)
 {
 	MsnSession *session = servconn->session;
-	struct gaim_connection *gc = session->account->gc;
+	GaimAccount *account = session->account;
+	GaimConnection *gc = gaim_account_get_connection(account);
 	char outparams[MSN_BUF_LEN];
 
 	/* We're either getting the challenge or the OK. Let's find out. */
@@ -292,13 +290,13 @@
 		session->syncing_lists = TRUE;
 
 		if (!msn_servconn_send_command(servconn, "SYN", "0")) {
-			hide_login_progress(gc, _("Unable to write"));
-			signoff(gc);
+			gaim_connection_error(gc, _("Unable to write"));
 
 			return FALSE;
 		}
 
-		set_login_progress(session->account->gc, 4, _("Retrieving buddy list"));
+		gaim_connection_update_progress(gc, _("Retrieving buddy list"),
+										5, MSN_CONNECT_STEPS);
 	}
 	else {
 		/* Challenge */
@@ -322,8 +320,7 @@
 		}
 
 		if (!msn_servconn_send_command(servconn, "USR", outparams)) {
-			hide_login_progress(gc, _("Unable to send password"));
-			signoff(gc);
+			gaim_connection_error(gc, _("Unable to send password"));
 
 			return FALSE;
 		}
@@ -341,19 +338,17 @@
 __out_cmd(MsnServConn *servconn, const char *command, const char **params,
 		  size_t param_count)
 {
-	struct gaim_connection *gc = servconn->session->account->gc;
+	GaimConnection *gc = servconn->session->account->gc;
 
 	if (!g_ascii_strcasecmp(params[0], "OTH")) {
-		hide_login_progress(gc,
+		gaim_connection_error(gc,
 							_("You have been disconnected. You have "
 							  "signed on from another location."));
-		signoff(gc);
 	}
 	else if (!g_ascii_strcasecmp(params[0], "SSD")) {
-		hide_login_progress(gc,
+		gaim_connection_error(gc,
 							_("You have been disconnected. The MSN servers "
 							  "are going down temporarily."));
-		signoff(gc);
 	}
 
 	return FALSE;
@@ -383,7 +378,7 @@
 __chl_cmd(MsnServConn *servconn, const char *command, const char **params,
 		  size_t param_count)
 {
-	struct gaim_connection *gc = servconn->session->account->gc;
+	GaimConnection *gc = servconn->session->account->gc;
 	char buf[MSN_BUF_LEN];
 	char buf2[3];
 	md5_state_t st;
@@ -406,8 +401,7 @@
 	}
 
 	if (msn_servconn_write(servconn, buf, strlen(buf)) <= 0) {
-		hide_login_progress(gc, _("Unable to write to server"));
-		signoff(gc);
+		gaim_connection_error(gc, _("Unable to write to server"));
 	}
 
 	return TRUE;
@@ -422,7 +416,8 @@
 {
 	MsnSession *session = servconn->session;
 	MsnUser *user;
-	struct gaim_connection *gc = session->account->gc;
+	GaimConnection *account = session->account;
+	GaimConnection *gc = gaim_account_get_connection(account);
 	MsnPermitAdd *pa;
 	GSList *sl;
 	const char *list, *passport;
@@ -459,7 +454,7 @@
 
 	g_snprintf(msg, sizeof(msg),
 			   _("The user %s (%s) wants to add %s to his or her buddy list."),
-			   passport, friend, gc->username);
+			   passport, friend, gaim_account_get_username(account));
 
 	gaim_request_action(gc, NULL, msg, NULL, 0, pa, 2,
 						_("Authorize"), G_CALLBACK(msn_accept_add_cb),
@@ -492,7 +487,7 @@
 __blp_cmd(MsnServConn *servconn, const char *command, const char **params,
 		  size_t param_count)
 {
-	struct gaim_connection *gc = servconn->session->account->gc;
+	GaimConnection *gc = servconn->session->account->gc;
 
 	if (!g_ascii_strcasecmp(params[2], "AL")) {
 		/*
@@ -520,7 +515,7 @@
 		  size_t param_count)
 {
 	MsnSession *session = servconn->session;
-	struct gaim_connection *gc = session->account->gc;
+	GaimConnection *gc = session->account->gc;
 	const char *passport, *type, *value;
 	struct buddy *b;
 	MsnUser *user;
@@ -559,7 +554,7 @@
 __fln_cmd(MsnServConn *servconn, const char *command, const char **params,
 		  size_t param_count)
 {
-	struct gaim_connection *gc = servconn->session->account->gc;
+	GaimConnection *gc = servconn->session->account->gc;
 
 	serv_got_update(gc, (char *)params[0], 0, 0, 0, 0, 0);
 
@@ -570,7 +565,7 @@
 __iln_cmd(MsnServConn *servconn, const char *command, const char **params,
 		  size_t param_count)
 {
-	struct gaim_connection *gc = servconn->session->account->gc;
+	GaimConnection *gc = servconn->session->account->gc;
 	int status = 0;
 	const char *state, *passport, *friend;
 	struct buddy *b;
@@ -640,7 +635,7 @@
 		  size_t param_count)
 {
 	MsnSession *session = servconn->session;
-	struct gaim_connection *gc = session->account->gc;
+	GaimConnection *gc = session->account->gc;
 	int user_num;
 	int num_users;
 	const char *type;
@@ -735,8 +730,7 @@
 		/* Now we're at the last one, so we can do final work. */
 		if (!session->lists_synced) {
 			if (!msn_servconn_send_command(servconn, "CHG", "NLN")) {
-				hide_login_progress(gc, _("Unable to write"));
-				signoff(gc);
+				gaim_connection_error(gc, _("Unable to write"));
 
 				return FALSE;
 			}
@@ -778,7 +772,7 @@
 		  size_t param_count)
 {
 	MsnSession *session = servconn->session;
-	struct gaim_connection *gc = session->account->gc;
+	GaimConnection *gc = session->account->gc;
 	const char *state;
 	const char *passport;
 	const char *friend;
@@ -835,7 +829,7 @@
 		  size_t param_count)
 {
 	MsnSession *session = servconn->session;
-	struct gaim_connection *gc = session->account->gc;
+	GaimConnection *gc = session->account->gc;
 	char *friend;
 
 	friend = msn_url_decode(params[3]);
@@ -878,7 +872,7 @@
 	/* I hate this. */
 	if (session->moving_buddy) {
 		MsnGroup *group, *old_group;
-		struct gaim_connection *gc = session->account->gc;
+		GaimConnection *gc = session->account->gc;
 		const char *passport = params[3];
 		char outparams[MSN_BUF_LEN];
 
@@ -909,8 +903,7 @@
 
 		if (!msn_servconn_send_command(session->notification_conn,
 									   "ADD", outparams)) {
-			hide_login_progress(gc, _("Write error"));
-			signoff(gc);
+			gaim_connection_error(gc, _("Write error"));
 			return FALSE;
 		}
 
@@ -930,8 +923,7 @@
 			if (!msn_servconn_send_command(session->notification_conn,
 										   "RMG", outparams)) {
 
-				hide_login_progress(gc, _("Write error"));
-				signoff(gc);
+				gaim_connection_error(gc, _("Write error"));
 				return FALSE;
 			}
 		}
@@ -963,7 +955,8 @@
 		  size_t param_count)
 {
 	MsnSession *session = servconn->session;
-	struct gaim_connection *gc = session->account->gc;
+	GaimAccount *account = session->account;
+	GaimConnection *gc = gaim_account_get_connection(gc);
 	const char *rru;
 	const char *url;
 	md5_state_t st;
@@ -1017,9 +1010,9 @@
 				url);
 		fprintf(fd, "<input type=\"hidden\" name=\"mode\" value=\"ttl\">\n");
 		fprintf(fd, "<input type=\"hidden\" name=\"login\" value=\"%s\">\n",
-				gc->username);
+				gaim_account_get_username(account));
 		fprintf(fd, "<input type=\"hidden\" name=\"username\" value=\"%s\">\n",
-				gc->username);
+				gaim_account_get_username(account));
 		fprintf(fd, "<input type=\"hidden\" name=\"sid\" value=\"%s\">\n",
 				session->passport_info.sid);
 		fprintf(fd, "<input type=\"hidden\" name=\"kv\" value=\"%s\">\n",
@@ -1123,14 +1116,13 @@
 {
 	MsnSession *session = servconn->session;
 	MsnSwitchBoard *swboard;
-	struct gaim_connection *gc = session->account->gc;
+	GaimConnection *gc = session->account->gc;
 	char *host;
 	char *c;
 	int port;
 
 	if (strcmp(params[1], "SB") && strcmp(params[1], "NS")) {
-		hide_login_progress(gc, _("Got invalid XFR"));
-		signoff(gc);
+		gaim_connection_error(gc, _("Got invalid XFR"));
 		
 		return FALSE;
 	}
@@ -1172,9 +1164,8 @@
 		session->notification_conn = msn_notification_new(session, host, port);
 
 		if (!msn_servconn_connect(session->notification_conn)) {
-			hide_login_progress(gc, _("Unable to transfer to "
+			gaim_connection_error(gc, _("Unable to transfer to "
 									  "notification server"));
-			signoff(gc);
 
 			return FALSE;
 		}
@@ -1215,7 +1206,7 @@
 __initial_email_msg(MsnServConn *servconn, MsnMessage *msg)
 {
 	MsnSession *session = servconn->session;
-	struct gaim_connection *gc = session->account->gc;
+	GaimConnection *gc = session->account->gc;
 	GHashTable *table;
 	const char *unread;
 
@@ -1256,7 +1247,7 @@
 __email_msg(MsnServConn *servconn, MsnMessage *msg)
 {
 	MsnSession *session = servconn->session;
-	struct gaim_connection *gc = session->account->gc;
+	GaimConnection *gc = session->account->gc;
 	GHashTable *table;
 	const char *from, *subject;
 
@@ -1334,11 +1325,11 @@
 {
 	MsnServConn *notification = data;
 	MsnSession *session = notification->session;
-	struct gaim_connection *gc = session->account->gc;
+	GaimAccount *account = session->account;
+	GaimConnection *gc = gaim_account_get_connection(account);
 
 	if (source == -1) {
-		hide_login_progress(session->account->gc, _("Unable to connect"));
-		signoff(session->account->gc);
+		gaim_connection_error(session->account->gc, _("Unable to connect"));
 		return FALSE;
 	}
 
@@ -1347,12 +1338,12 @@
 
 	if (!msn_servconn_send_command(notification, "VER",
 								   "MSNP7 MSNP6 MSNP5 MSNP4 CVR0")) {
-		hide_login_progress(gc, _("Unable to write to server"));
-		signoff(gc);
+		gaim_connection_error(gc, _("Unable to write to server"));
 		return FALSE;
 	}
 
-	session->user = msn_user_new(session, gc->username, NULL);
+	session->user = msn_user_new(session,
+								 gaim_connection_get_username(account), NULL);
 
 	set_login_progress(session->account->gc, 4, _("Syncing with server"));
 
@@ -1363,12 +1354,11 @@
 __failed_read_cb(gpointer data, gint source, GaimInputCondition cond)
 {
 	MsnServConn *notification = data;
-	struct gaim_connection *gc;
+	GaimConnection *gc;
 
 	gc = notification->session->account->gc;
 
-	hide_login_progress(gc, _("Error reading from server"));
-	signoff(gc);
+	gaim_connection_error(gc, _("Error reading from server"));
 }
 
 MsnServConn *
--- a/src/protocols/msn/session.c	Fri May 30 09:38:29 2003 +0000
+++ b/src/protocols/msn/session.c	Fri May 30 18:04:45 2003 +0000
@@ -24,7 +24,7 @@
 #include "dispatch.h"
 
 MsnSession *
-msn_session_new(struct gaim_account *account, const char *server, int port)
+msn_session_new(GaimAccount *account, const char *server, int port)
 {
 	MsnSession *session;
 
--- a/src/protocols/msn/session.h	Fri May 30 09:38:29 2003 +0000
+++ b/src/protocols/msn/session.h	Fri May 30 18:04:45 2003 +0000
@@ -31,7 +31,7 @@
 
 struct _MsnSession
 {
-	struct gaim_account *account;
+	GaimAccount *account;
 	MsnUser *user;
 
 	char *dispatch_server;
@@ -90,7 +90,7 @@
  *
  * @return The new MSN session.
  */
-MsnSession *msn_session_new(struct gaim_account *account,
+MsnSession *msn_session_new(GaimAccount *account,
 							const char *server, int port);
 
 /**
--- a/src/protocols/msn/switchboard.c	Fri May 30 09:38:29 2003 +0000
+++ b/src/protocols/msn/switchboard.c	Fri May 30 18:04:45 2003 +0000
@@ -83,7 +83,7 @@
 __ans_cmd(MsnServConn *servconn, const char *command, const char **params,
 		  size_t param_count)
 {
-	struct gaim_connection *gc = servconn->session->account->gc;
+	GaimConnection *gc = servconn->session->account->gc;
 	MsnSwitchBoard *swboard = servconn->data;
 
 	if (swboard->chat != NULL)
@@ -96,7 +96,7 @@
 __bye_cmd(MsnServConn *servconn, const char *command, const char **params,
 		  size_t param_count)
 {
-	struct gaim_connection *gc = servconn->session->account->gc;
+	GaimConnection *gc = servconn->session->account->gc;
 	MsnSwitchBoard *swboard = servconn->data;
 	const char *user = params[0];
 
@@ -140,7 +140,7 @@
 __iro_cmd(MsnServConn *servconn, const char *command, const char **params,
 		  size_t param_count)
 {
-	struct gaim_connection *gc = servconn->session->account->gc;
+	GaimConnection *gc = servconn->session->account->gc;
 	MsnSwitchBoard *swboard = servconn->data;
 
 	swboard->total_users = atoi(params[2]);
@@ -163,7 +163,7 @@
 __joi_cmd(MsnServConn *servconn, const char *command, const char **params,
 		  size_t param_count)
 {
-	struct gaim_connection *gc = servconn->session->account->gc;
+	GaimConnection *gc = servconn->session->account->gc;
 	MsnSwitchBoard *swboard = servconn->data;
 	const char *passport;
 
@@ -231,7 +231,7 @@
 __out_cmd(MsnServConn *servconn, const char *command, const char **params,
 		  size_t param_count)
 {
-	struct gaim_connection *gc = servconn->session->account->gc;
+	GaimConnection *gc = servconn->session->account->gc;
 	MsnSwitchBoard *swboard = servconn->data;
 
 	if (swboard->chat != NULL)
@@ -264,7 +264,7 @@
 static gboolean
 __plain_msg(MsnServConn *servconn, MsnMessage *msg)
 {
-	struct gaim_connection *gc = servconn->session->account->gc;
+	GaimConnection *gc = servconn->session->account->gc;
 	MsnSwitchBoard *swboard = servconn->data;
 	char *body;
 	const char *value;
@@ -303,7 +303,7 @@
 static gboolean
 __control_msg(MsnServConn *servconn, MsnMessage *msg)
 {
-	struct gaim_connection *gc = servconn->session->account->gc;
+	GaimConnection *gc = servconn->session->account->gc;
 	MsnSwitchBoard *swboard = servconn->data;
 	const char *value;