Index: account.c
===================================================================
--- account.c	(revision fef6116e89bb0651c72454effbb51e04e9e1b8dc)
+++ account.c	(revision 96863f65118767e968469e82ba6b02006e36b81c)
@@ -28,6 +28,4 @@
 #include "account.h"
 
-char *set_eval_account( set_t *set, char *value );
-
 account_t *account_add( irc_t *irc, struct prpl *prpl, char *user, char *pass )
 {
@@ -51,16 +49,18 @@
 	a->irc = irc;
 	
-	s = set_add( &a->set, "auto_connect", NULL, set_eval_account, a );
+	s = set_add( &a->set, "auto_connect", "true", set_eval_account, a );
 	s->flags |= ACC_SET_NOSAVE;
 	
 	s = set_add( &a->set, "password", NULL, set_eval_account, a );
 	s->flags |= ACC_SET_NOSAVE;
-	
-	s = set_add( &a->set, "server", NULL, set_eval_account, a );
-	s->flags |= ACC_SET_NOSAVE | ACC_SET_OFFLINE_ONLY;
 	
 	s = set_add( &a->set, "username", NULL, set_eval_account, a );
 	s->flags |= ACC_SET_NOSAVE | ACC_SET_OFFLINE_ONLY;
 	set_setstr( &a->set, "username", user );
+	
+	/* This function adds some more settings (and might want to do more
+	   things that have to be done now, although I can't think of anything. */
+	if( prpl->acc_init )
+		prpl->acc_init( a );
 	
 	return( a );
Index: account.h
===================================================================
--- account.h	(revision fef6116e89bb0651c72454effbb51e04e9e1b8dc)
+++ account.h	(revision 96863f65118767e968469e82ba6b02006e36b81c)
@@ -50,4 +50,6 @@
 void account_off( irc_t *irc, account_t *a );
 
+char *set_eval_account( set_t *set, char *value );
+
 #define ACC_SET_NOSAVE		1
 #define ACC_SET_OFFLINE_ONLY	2
Index: protocols/jabber/jabber.c
===================================================================
--- protocols/jabber/jabber.c	(revision fef6116e89bb0651c72454effbb51e04e9e1b8dc)
+++ protocols/jabber/jabber.c	(revision 96863f65118767e968469e82ba6b02006e36b81c)
@@ -563,5 +563,5 @@
 	account_t *acc;
 	int port = -1, ssl = 0;
-	char *server = NULL, *s;
+	char *server = NULL;
 
 	if (!gjc || gjc->state != JCONN_STATE_OFF)
@@ -569,27 +569,9 @@
 
 	acc = GJ_GC(gjc)->acc;
-	if (acc->server) {
-		/* If there's a dot, assume there's a hostname in the beginning */
-		if (strchr(acc->server, '.')) {
-			server = g_strdup(acc->server);
-			if ((s = strchr(server, ':')))
-				*s = 0;
-		}
-		
-		/* After the hostname, there can be a port number */
-		s = strchr(acc->server, ':');
-		if (s && isdigit(s[1]))
-			sscanf(s + 1, "%d", &port);
-		
-		/* And if there's the string ssl, the user wants an SSL-connection */
-		if (strstr(acc->server, ":ssl") || g_strcasecmp(acc->server, "ssl") == 0)
-			ssl = 1;
-	}
-	
-	if (port == -1 && !ssl)
-		port = DEFAULT_PORT;
-	else if (port == -1 && ssl)
-		port = DEFAULT_PORT_SSL;
-	else if (port < JABBER_PORT_MIN || port > JABBER_PORT_MAX) {
+	server = acc->server;
+	port = set_getint(&acc->set, "port");
+	ssl = set_getbool(&acc->set, "ssl");
+	
+	if (port < JABBER_PORT_MIN || port > JABBER_PORT_MAX) {
 		serv_got_crap(GJ_GC(gjc), "For security reasons, the Jabber port number must be in the %d-%d range.", JABBER_PORT_MIN, JABBER_PORT_MAX);
 		STATE_EVT(JCONN_STATE_OFF)
@@ -613,6 +595,4 @@
 		gjc->fd = proxy_connect(server, port, gjab_connected, GJ_GC(gjc));
 	}
-	
-	g_free(server);
 	
 	if (!acc->gc || (gjc->fd < 0)) {
@@ -1516,10 +1496,60 @@
 }
 
+static void jabber_acc_init(account_t *acc)
+{
+	set_t *s;
+	
+	s = set_add( &acc->set, "port", "5222", set_eval_int, acc );
+	s->flags |= ACC_SET_OFFLINE_ONLY;
+	
+	s = set_add( &acc->set, "resource", "BitlBee", NULL, acc );
+	s->flags |= ACC_SET_OFFLINE_ONLY;
+	
+	s = set_add( &acc->set, "server", NULL, set_eval_account, acc );
+	s->flags |= ACC_SET_NOSAVE | ACC_SET_OFFLINE_ONLY;
+	
+	s = set_add( &acc->set, "ssl", "false", set_eval_bool, acc );
+	s->flags |= ACC_SET_OFFLINE_ONLY;
+}
+
 static void jabber_login(account_t *acc)
 {
-	struct gaim_connection *gc = new_gaim_conn(acc);
-	struct jabber_data *jd = gc->proto_data = g_new0(struct jabber_data, 1);
-	char *loginname = create_valid_jid(acc->user, DEFAULT_SERVER, "BitlBee");
-
+	struct gaim_connection *gc;
+	struct jabber_data *jd;
+	char *resource, *loginname;
+	
+	/* Time to move some data/things from the old syntax to the new one: */
+	if (acc->server) {
+		char *s, *tmp_server;
+		int port;
+		
+		if (g_strcasecmp(acc->server, "ssl") == 0) {
+			set_setstr(&acc->set, "server", "");
+			set_setint(&acc->set, "port", DEFAULT_PORT_SSL);
+			set_setstr(&acc->set, "ssl", "true");
+			
+			g_free(acc->server);
+			acc->server = NULL;
+		} else if ((s = strchr(acc->server, ':'))) {
+			if (strstr(acc->server, ":ssl")) {
+				set_setint(&acc->set, "port", DEFAULT_PORT_SSL);
+				set_setstr(&acc->set, "ssl", "true");
+			}
+			if (isdigit(s[1])) {
+				if (sscanf(s + 1, "%d", &port) == 1)
+					set_setint(&acc->set, "port", port);
+			}
+			tmp_server = g_strndup(acc->server, s - acc->server);
+			set_setstr(&acc->set, "server", tmp_server);
+			g_free(tmp_server);
+		}
+	}
+	
+	gc = new_gaim_conn(acc);
+	jd = gc->proto_data = g_new0(struct jabber_data, 1);
+	
+	resource = set_getstr(&acc->set, "resource");
+	loginname = create_valid_jid(acc->user, DEFAULT_SERVER, resource);
+	
 	jd->hash = g_hash_table_new(g_str_hash, g_str_equal);
 	jd->chats = NULL;	/* we have no chats yet */
@@ -2337,4 +2367,5 @@
 	ret->name = "jabber";
 	ret->away_states = jabber_away_states;
+	ret->acc_init = jabber_acc_init;
 	ret->login = jabber_login;
 	ret->close = jabber_close;
Index: protocols/nogaim.h
===================================================================
--- protocols/nogaim.h	(revision fef6116e89bb0651c72454effbb51e04e9e1b8dc)
+++ protocols/nogaim.h	(revision 96863f65118767e968469e82ba6b02006e36b81c)
@@ -129,4 +129,5 @@
 	const char *name;
 
+	void (* acc_init)	(account_t *);
 	void (* login)		(account_t *);
 	void (* keepalive)	(struct gaim_connection *);
Index: protocols/oscar/oscar.c
===================================================================
--- protocols/oscar/oscar.c	(revision fef6116e89bb0651c72454effbb51e04e9e1b8dc)
+++ protocols/oscar/oscar.c	(revision 96863f65118767e968469e82ba6b02006e36b81c)
@@ -356,4 +356,12 @@
 }
 
+static void oscar_acc_init(account_t *acc)
+{
+	set_t *s;
+	
+	s = set_add( &acc->set, "server", NULL, set_eval_account, acc );
+	s->flags |= ACC_SET_NOSAVE | ACC_SET_OFFLINE_ONLY;
+}
+
 static void oscar_login(account_t *acc) {
 	aim_session_t *sess;
@@ -386,4 +394,10 @@
 	if (conn == NULL) {
 		hide_login_progress(gc, _("Unable to login to AIM"));
+		signoff(gc);
+		return;
+	}
+	
+	if (acc->server == NULL) {
+		hide_login_progress(gc, "No servername specified");
 		signoff(gc);
 		return;
@@ -2649,4 +2663,5 @@
 	ret->away_states = oscar_away_states;
 	ret->login = oscar_login;
+	ret->acc_init = oscar_acc_init;
 	ret->close = oscar_close;
 	ret->send_im = oscar_send_im;
