Index: protocols/oscar/oscar.c
===================================================================
--- protocols/oscar/oscar.c	(revision 0a3c243b6659dc10efb227e507f324c2711d6dcd)
+++ protocols/oscar/oscar.c	(revision 936ded65a76dac7a7af56ef3f1ad6c84a32270c6)
@@ -255,6 +255,6 @@
 static int msgerrreasonlen = 25;
 
-static gboolean oscar_callback(gpointer data, gint source,
-				b_input_condition condition) {
+static void oscar_callback(gpointer data, gint source,
+				GaimInputCondition condition) {
 	aim_conn_t *conn = (aim_conn_t *)data;
 	aim_session_t *sess = aim_conn_getsess(conn);
@@ -264,5 +264,5 @@
 	if (!gc) {
 		/* gc is null. we return, else we seg SIGSEG on next line. */
-		return FALSE;
+		return;
 	}
       
@@ -270,5 +270,5 @@
 		/* oh boy. this is probably bad. i guess the only thing we 
 		 * can really do is return? */
-		return FALSE;
+		return;
 	}
 
@@ -290,5 +290,5 @@
 				c->conn = NULL;
 				if (c->inpa > 0)
-					b_event_remove(c->inpa);
+					gaim_input_remove(c->inpa);
 				c->inpa = 0;
 				c->fd = -1;
@@ -298,5 +298,5 @@
 			} else if (conn->type == AIM_CONN_TYPE_CHATNAV) {
 				if (odata->cnpa > 0)
-					b_event_remove(odata->cnpa);
+					gaim_input_remove(odata->cnpa);
 				odata->cnpa = 0;
 				while (odata->create_rooms) {
@@ -312,5 +312,5 @@
 			} else if (conn->type == AIM_CONN_TYPE_AUTH) {
 				if (odata->paspa > 0)
-					b_event_remove(odata->paspa);
+					gaim_input_remove(odata->paspa);
 				odata->paspa = 0;
 				aim_conn_kill(odata->sess, &conn);
@@ -319,13 +319,8 @@
 			}
 		}
-	} else {
-		/* WTF??? */
-		return FALSE;
-	}
-		
-	return TRUE;
-}
-
-static gboolean oscar_login_connect(gpointer data, gint source, b_input_condition cond)
+	}
+}
+
+static void oscar_login_connect(gpointer data, gint source, GaimInputCondition cond)
 {
 	struct gaim_connection *gc = data;
@@ -336,5 +331,5 @@
 	if (!g_slist_find(get_connections(), gc)) {
 		closesocket(source);
-		return FALSE;
+		return;
 	}
 
@@ -346,26 +341,24 @@
 		hide_login_progress(gc, _("Couldn't connect to host"));
 		signoff(gc);
-		return FALSE;
+		return;
 	}
 
 	aim_conn_completeconnect(sess, conn);
-	gc->inpa = b_input_add(conn->fd, GAIM_INPUT_READ,
+	gc->inpa = gaim_input_add(conn->fd, GAIM_INPUT_READ,
 			oscar_callback, conn);
-	
-	return FALSE;
-}
-
-static void oscar_login(account_t *acc) {
+}
+
+static void oscar_login(struct aim_user *user) {
 	aim_session_t *sess;
 	aim_conn_t *conn;
 	char buf[256];
-	struct gaim_connection *gc = new_gaim_conn(acc);
+	struct gaim_connection *gc = new_gaim_conn(user);
 	struct oscar_data *odata = gc->proto_data = g_new0(struct oscar_data, 1);
 
-	if (isdigit(acc->user[0])) {
+	if (isdigit(*user->username)) {
 		odata->icq = TRUE;
 		/* This is odd but it's necessary for a proper do_import and do_export.
 		   We don't do those anymore, but let's stick with it, just in case
-		   it accidentally fixes something else too... </bitlbee> */
+		   it accidentally fixes something else too... */
 		gc->password[8] = 0;
 	} else {
@@ -390,7 +383,7 @@
 	}
 	
-	if (g_strcasecmp(acc->server, "login.icq.com") != 0 &&
-	    g_strcasecmp(acc->server, "login.oscar.aol.com") != 0) {
-		serv_got_crap(gc, "Warning: Unknown OSCAR server: `%s'. Please review your configuration if the connection fails.",acc->server);
+	if (g_strcasecmp(user->proto_opt[USEROPT_AUTH], "login.icq.com") != 0 &&
+	    g_strcasecmp(user->proto_opt[USEROPT_AUTH], "login.oscar.aol.com") != 0) {
+		serv_got_crap(gc, "Warning: Unknown OSCAR server: `%s'. Please review your configuration if the connection fails.",user->proto_opt[USEROPT_AUTH]);
 	}
 	
@@ -402,5 +395,9 @@
 
 	conn->status |= AIM_CONN_STATUS_INPROGRESS;
-	conn->fd = proxy_connect(acc->server, AIM_LOGIN_PORT, oscar_login_connect, gc);
+	conn->fd = proxy_connect(user->proto_opt[USEROPT_AUTH][0] ?
+					user->proto_opt[USEROPT_AUTH] : AIM_DEFAULT_LOGIN_SERVER,
+				 user->proto_opt[USEROPT_AUTHPORT][0] ?
+					atoi(user->proto_opt[USEROPT_AUTHPORT]) : AIM_LOGIN_PORT,
+				 oscar_login_connect, gc);
 	if (conn->fd < 0) {
 		hide_login_progress(gc, _("Couldn't connect to host"));
@@ -417,5 +414,5 @@
 		struct chat_connection *n = odata->oscar_chats->data;
 		if (n->inpa > 0)
-			b_event_remove(n->inpa);
+			gaim_input_remove(n->inpa);
 		g_free(n->name);
 		g_free(n->show);
@@ -436,9 +433,9 @@
 		g_free(odata->oldp);
 	if (gc->inpa > 0)
-		b_event_remove(gc->inpa);
+		gaim_input_remove(gc->inpa);
 	if (odata->cnpa > 0)
-		b_event_remove(odata->cnpa);
+		gaim_input_remove(odata->cnpa);
 	if (odata->paspa > 0)
-		b_event_remove(odata->paspa);
+		gaim_input_remove(odata->paspa);
 	aim_session_kill(odata->sess);
 	g_free(odata->sess);
@@ -448,5 +445,5 @@
 }
 
-static gboolean oscar_bos_connect(gpointer data, gint source, b_input_condition cond) {
+static void oscar_bos_connect(gpointer data, gint source, GaimInputCondition cond) {
 	struct gaim_connection *gc = data;
 	struct oscar_data *odata;
@@ -456,5 +453,5 @@
 	if (!g_slist_find(get_connections(), gc)) {
 		closesocket(source);
-		return FALSE;
+		return;
 	}
 
@@ -466,13 +463,11 @@
 		hide_login_progress(gc, _("Could Not Connect"));
 		signoff(gc);
-		return FALSE;
+		return;
 	}
 
 	aim_conn_completeconnect(sess, bosconn);
-	gc->inpa = b_input_add(bosconn->fd, GAIM_INPUT_READ,
+	gc->inpa = gaim_input_add(bosconn->fd, GAIM_INPUT_READ,
 			oscar_callback, bosconn);
 	set_login_progress(gc, 4, _("Connection established, cookie sent"));
-	
-	return FALSE;
 }
 
@@ -481,9 +476,12 @@
 	struct aim_authresp_info *info;
 	int i; char *host; int port;
+	struct aim_user *user;
 	aim_conn_t *bosconn;
 
 	struct gaim_connection *gc = sess->aux_data;
         struct oscar_data *od = gc->proto_data;
-	port = AIM_LOGIN_PORT;
+	user = gc->user;
+	port = user->proto_opt[USEROPT_AUTHPORT][0] ?
+		atoi(user->proto_opt[USEROPT_AUTHPORT]) : AIM_LOGIN_PORT,
 
 	va_start(ap, fr);
@@ -574,5 +572,5 @@
 	}
 	aim_sendcookie(sess, bosconn, info->cookie);
-	b_event_remove(gc->inpa);
+	gaim_input_remove(gc->inpa);
 
 	return 1;
@@ -589,5 +587,5 @@
 };
 
-static gboolean damn_you(gpointer data, gint source, b_input_condition c)
+static void damn_you(gpointer data, gint source, GaimInputCondition c)
 {
 	struct pieceofcrap *pos = data;
@@ -609,21 +607,19 @@
 		do_error_dialog(pos->gc, "Gaim was unable to get a valid hash for logging into AIM."
 				" You may be disconnected shortly.", "Login Error");
-		b_event_remove(pos->inpa);
+		gaim_input_remove(pos->inpa);
 		closesocket(pos->fd);
 		g_free(pos);
-		return FALSE;
+		return;
 	}
 	/* [WvG] Wheeeee! Who needs error checking anyway? ;-) */
 	read(pos->fd, m, 16);
 	m[16] = '\0';
-	b_event_remove(pos->inpa);
+	gaim_input_remove(pos->inpa);
 	closesocket(pos->fd);
 	aim_sendmemblock(od->sess, pos->conn, 0, 16, m, AIM_SENDMEMBLOCK_FLAG_ISHASH);
 	g_free(pos);
-	
-	return FALSE;
-}
-
-static gboolean straight_to_hell(gpointer data, gint source, b_input_condition cond) {
+}
+
+static void straight_to_hell(gpointer data, gint source, GaimInputCondition cond) {
 	struct pieceofcrap *pos = data;
 	char buf[BUF_LONG];
@@ -635,5 +631,5 @@
 			g_free(pos->modname);
 		g_free(pos);
-		return FALSE;
+		return;
 	}
 
@@ -644,6 +640,6 @@
 	if (pos->modname)
 		g_free(pos->modname);
-	pos->inpa = b_input_add(pos->fd, GAIM_INPUT_READ, damn_you, pos);
-	return FALSE;
+	pos->inpa = gaim_input_add(pos->fd, GAIM_INPUT_READ, damn_you, pos);
+	return;
 }
 
@@ -767,5 +763,5 @@
 }
 
-static gboolean oscar_chatnav_connect(gpointer data, gint source, b_input_condition cond) {
+static void oscar_chatnav_connect(gpointer data, gint source, GaimInputCondition cond) {
 	struct gaim_connection *gc = data;
 	struct oscar_data *odata;
@@ -775,5 +771,5 @@
 	if (!g_slist_find(get_connections(), gc)) {
 		closesocket(source);
-		return FALSE;
+		return;
 	}
 
@@ -784,15 +780,13 @@
 	if (source < 0) {
 		aim_conn_kill(sess, &tstconn);
-		return FALSE;
+		return;
 	}
 
 	aim_conn_completeconnect(sess, tstconn);
-	odata->cnpa = b_input_add(tstconn->fd, GAIM_INPUT_READ,
+	odata->cnpa = gaim_input_add(tstconn->fd, GAIM_INPUT_READ,
 					oscar_callback, tstconn);
-	
-	return FALSE;
-}
-
-static gboolean oscar_auth_connect(gpointer data, gint source, b_input_condition cond)
+}
+
+static void oscar_auth_connect(gpointer data, gint source, GaimInputCondition cond)
 {
 	struct gaim_connection *gc = data;
@@ -803,5 +797,5 @@
 	if (!g_slist_find(get_connections(), gc)) {
 		closesocket(source);
-		return FALSE;
+		return;
 	}
 
@@ -812,15 +806,13 @@
 	if (source < 0) {
 		aim_conn_kill(sess, &tstconn);
-		return FALSE;
+		return;
 	}
 
 	aim_conn_completeconnect(sess, tstconn);
-	odata->paspa = b_input_add(tstconn->fd, GAIM_INPUT_READ,
+	odata->paspa = gaim_input_add(tstconn->fd, GAIM_INPUT_READ,
 				oscar_callback, tstconn);
-	
-	return FALSE;
-}
-
-static gboolean oscar_chat_connect(gpointer data, gint source, b_input_condition cond)
+}
+
+static void oscar_chat_connect(gpointer data, gint source, GaimInputCondition cond)
 {
 	struct chat_connection *ccon = data;
@@ -835,5 +827,5 @@
 		g_free(ccon->name);
 		g_free(ccon);
-		return FALSE;
+		return;
 	}
 
@@ -847,14 +839,12 @@
 		g_free(ccon->name);
 		g_free(ccon);
-		return FALSE;
+		return;
 	}
 
 	aim_conn_completeconnect(sess, ccon->conn);
-	ccon->inpa = b_input_add(tstconn->fd,
+	ccon->inpa = gaim_input_add(tstconn->fd,
 			GAIM_INPUT_READ,
 			oscar_callback, tstconn);
 	odata->oscar_chats = g_slist_append(odata->oscar_chats, ccon);
-	
-	return FALSE;
 }
 
@@ -864,4 +854,5 @@
 	struct aim_redirect_data *redir;
 	struct gaim_connection *gc = sess->aux_data;
+	struct aim_user *user = gc->user;
 	aim_conn_t *tstconn;
 	int i;
@@ -869,9 +860,11 @@
 	int port;
 
+	port = user->proto_opt[USEROPT_AUTHPORT][0] ?
+		atoi(user->proto_opt[USEROPT_AUTHPORT]) : AIM_LOGIN_PORT,
+
 	va_start(ap, fr);
 	redir = va_arg(ap, struct aim_redirect_data *);
 	va_end(ap);
 
-	port = AIM_LOGIN_PORT;
 	for (i = 0; i < (int)strlen(redir->ip); i++) {
 		if (redir->ip[i] == ':') {
@@ -1713,9 +1706,6 @@
 	odata->rights.maxsiglen = odata->rights.maxawaymsglen = (guint)maxsiglen;
 
-	/* FIXME: It seems we're not really using this, and it broke now that
-	   struct aim_user is dead.
 	aim_bos_setprofile(sess, fr->conn, gc->user->user_info, NULL, gaim_caps);
-	*/
-	
+
 	return 1;
 }
@@ -2575,5 +2565,5 @@
 	od->oscar_chats = g_slist_remove(od->oscar_chats, cc);
 	if (cc->inpa > 0)
-		b_event_remove(cc->inpa);
+		gaim_input_remove(cc->inpa);
 	aim_conn_kill(od->sess, &cc->conn);
 	g_free(cc->name);
