Index: Makefile
===================================================================
--- Makefile	(revision 57c96f7be2511a0a50015512dc03a30ba0923862)
+++ Makefile	(revision 1f92a5851e0e3b1730e940980f2b0122c506c724)
@@ -11,5 +11,5 @@
 # Program variables
 #objects = bitlbee.o chat.o dcc.o help.o ipc.o irc.o irc_commands.o nick.o query.o root_commands.o set.o storage.o $(STORAGE_OBJS)
-objects = bitlbee.o help.o ipc.o irc.o irc_im.o irc_channel.o irc_commands.o irc_send.o irc_user.o nick.o root_commands.o set.o
+objects = bitlbee.o help.o ipc.o irc.o irc_im.o irc_channel.o irc_commands.o irc_send.o irc_user.o nick.o root_commands.o set.o storage.o $(STORAGE_OBJS)
 headers = account.h bitlbee.h commands.h conf.h config.h help.h ipc.h irc.h log.h nick.h query.h set.h sock.h storage.h user.h lib/events.h lib/ftutil.h lib/http_client.h lib/ini.h lib/md5.h lib/misc.h lib/proxy.h lib/sha1.h lib/ssl_client.h lib/url.h protocols/ft.h protocols/nogaim.h
 subdirs = lib protocols
Index: irc.c
===================================================================
--- irc.c	(revision 57c96f7be2511a0a50015512dc03a30ba0923862)
+++ irc.c	(revision 1f92a5851e0e3b1730e940980f2b0122c506c724)
@@ -259,4 +259,17 @@
 	
 	return( TRUE );
+}
+
+/* USE WITH CAUTION!
+   Sets pass without checking */
+void irc_setpass (irc_t *irc, const char *pass)
+{
+	g_free (irc->password);
+	
+	if (pass) {
+		irc->password = g_strdup (pass);
+	} else {
+		irc->password = NULL;
+	}
 }
 
Index: irc.h
===================================================================
--- irc.h	(revision 57c96f7be2511a0a50015512dc03a30ba0923862)
+++ irc.h	(revision 1f92a5851e0e3b1730e940980f2b0122c506c724)
@@ -160,4 +160,5 @@
 void irc_abort( irc_t *irc, int immed, char *format, ... ) G_GNUC_PRINTF( 3, 4 );
 void irc_free( irc_t *irc );
+void irc_setpass (irc_t *irc, const char *pass);
 
 void irc_process( irc_t *irc );
Index: root_commands.c
===================================================================
--- root_commands.c	(revision 57c96f7be2511a0a50015512dc03a30ba0923862)
+++ root_commands.c	(revision 1f92a5851e0e3b1730e940980f2b0122c506c724)
@@ -136,5 +136,4 @@
 }
 
-#if 0
 static void cmd_account( irc_t *irc, char **cmd );
 
@@ -162,5 +161,5 @@
 		irc->status |= USTATUS_IDENTIFIED;
 		irc_umode_set( irc, "+R", 1 );
-		if( set_getbool( &irc->set, "auto_connect" ) )
+		if( set_getbool( &irc->b->set, "auto_connect" ) )
 			cmd_account( irc, account_on );
 		break;
@@ -202,5 +201,5 @@
 	storage_status_t status;
 	
-	status = storage_remove (irc->nick, cmd[1]);
+	status = storage_remove (irc->user->nick, cmd[1]);
 	switch (status) {
 	case STORAGE_NO_SUCH_USER:
@@ -214,5 +213,5 @@
 		irc->status &= ~USTATUS_IDENTIFIED;
 		irc_umode_set( irc, "-R", 1 );
-		irc_usermsg( irc, "Account `%s' removed", irc->nick );
+		irc_usermsg( irc, "Account `%s' removed", irc->user->nick );
 		break;
 	default:
@@ -221,5 +220,14 @@
 	}
 }
-#endif
+
+static void cmd_save( irc_t *irc, char **cmd )
+{
+	if( ( irc->status & USTATUS_IDENTIFIED ) == 0 )
+		irc_usermsg( irc, "Please create an account first" );
+	else if( storage_save( irc, NULL, TRUE ) == STORAGE_OK )
+		irc_usermsg( irc, "Configuration saved" );
+	else
+		irc_usermsg( irc, "Configuration could not be saved!" );
+}
 
 struct cmd_account_del_data
@@ -909,14 +917,4 @@
 }
 
-static void cmd_save( irc_t *irc, char **cmd )
-{
-	if( ( irc->status & USTATUS_IDENTIFIED ) == 0 )
-		irc_usermsg( irc, "Please create an account first" );
-	else if( storage_save( irc, NULL, TRUE ) == STORAGE_OK )
-		irc_usermsg( irc, "Configuration saved" );
-	else
-		irc_usermsg( irc, "Configuration could not be saved!" );
-}
-
 static void cmd_blist( irc_t *irc, char **cmd )
 {
@@ -984,32 +982,4 @@
 }
 
-static void cmd_nick( irc_t *irc, char **cmd ) 
-{
-	account_t *a;
-
-	if( !cmd[1] || !( a = account_get( irc, cmd[1] ) ) )
-	{
-		irc_usermsg( irc, "Invalid account");
-	}
-	else if( !( a->ic && ( a->ic->flags & OPT_LOGGED_IN ) ) )
-	{
-		irc_usermsg( irc, "That account is not on-line" );
-	}
-	else if ( !cmd[2] ) 
-	{
-		irc_usermsg( irc, "Your name is `%s'" , a->ic->displayname ? a->ic->displayname : "NULL" );
-	}
-	else if ( !a->prpl->set_my_name ) 
-	{
-		irc_usermsg( irc, "Command `%s' not supported by this protocol", cmd[0] );
-	}
-	else
-	{
-		irc_usermsg( irc, "Setting your name to `%s'", cmd[2] );
-		
-		a->prpl->set_my_name( a->ic, cmd[2] );
-	}
-}
-
 static void cmd_qlist( irc_t *irc, char **cmd )
 {
@@ -1030,10 +1000,4 @@
 		else
 			irc_usermsg( irc, "%d, BitlBee: %s", num, q->question );
-}
-
-static void cmd_join_chat( irc_t *irc, char **cmd )
-{
-	irc_usermsg( irc, "This command is now obsolete. "
-	                  "Please try the `chat' command instead." );
 }
 
@@ -1216,8 +1180,9 @@
 	{ "help",           0, cmd_help,           0 }, 
 	{ "account",        1, cmd_account,        0 },
-#if 0
 	{ "identify",       1, cmd_identify,       0 },
 	{ "register",       1, cmd_register,       0 },
 	{ "drop",           1, cmd_drop,           0 },
+	{ "save",           0, cmd_save,           0 },
+#if 0
 	{ "add",            2, cmd_add,            0 },
 	{ "info",           1, cmd_info,           0 },
@@ -1228,5 +1193,4 @@
 	{ "block",          1, cmd_block,          0 },
 	{ "allow",          1, cmd_allow,          0 },
-	{ "save",           0, cmd_save,           0 },
 	{ "set",            0, cmd_set,            0 },
 	{ "yes",            0, cmd_yesno,          0 },
Index: storage_xml.c
===================================================================
--- storage_xml.c	(revision 57c96f7be2511a0a50015512dc03a30ba0923862)
+++ storage_xml.c	(revision 1f92a5851e0e3b1730e940980f2b0122c506c724)
@@ -147,5 +147,5 @@
 		                         arc_decode( pass_cr, pass_len, &password, xd->given_pass ) )
 		{
-			xd->current_account = account_add( irc, prpl, handle, password );
+			xd->current_account = account_add( irc->b, prpl, handle, password );
 			if( server )
 				set_setstr( &xd->current_account->set, "server", server );
@@ -181,5 +181,5 @@
 				xd->current_set_head = &xd->current_account->set;
 			else
-				xd->current_set_head = &xd->irc->set;
+				xd->current_set_head = &xd->irc->b->set;
 			
 			xd->current_setting = g_strdup( setting );
@@ -215,5 +215,5 @@
 		if( xd->current_account && handle && channel )
 		{
-			xd->current_chat = chat_add( xd->irc, xd->current_account, handle, channel );
+			//xd->current_chat = chat_add( xd->irc, xd->current_account, handle, channel );
 		}
 		else
@@ -353,5 +353,5 @@
 static storage_status_t xml_load( irc_t *irc, const char *password )
 {
-	return xml_load_real( irc, irc->nick, password, XML_PASS_UNKNOWN );
+	return xml_load_real( irc, irc->user->nick, password, XML_PASS_UNKNOWN );
 }
 
@@ -396,5 +396,5 @@
 	md5_state_t md5_state;
 	
-	path2 = g_strdup( irc->nick );
+	path2 = g_strdup( irc->user->nick );
 	nick_lc( path2 );
 	g_snprintf( path, sizeof( path ) - 2, "%s%s%s", global.conf->configdir, path2, ".xml" );
@@ -422,15 +422,15 @@
 	pass_buf = base64_encode( pass_md5, 21 );
 	
-	if( !xml_printf( fd, 0, "<user nick=\"%s\" password=\"%s\" version=\"%d\">\n", irc->nick, pass_buf, XML_FORMAT_VERSION ) )
+	if( !xml_printf( fd, 0, "<user nick=\"%s\" password=\"%s\" version=\"%d\">\n", irc->user->nick, pass_buf, XML_FORMAT_VERSION ) )
 		goto write_error;
 	
 	g_free( pass_buf );
 	
-	for( set = irc->set; set; set = set->next )
+	for( set = irc->b->set; set; set = set->next )
 		if( set->value )
 			if( !xml_printf( fd, 1, "<setting name=\"%s\">%s</setting>\n", set->key, set->value ) )
 				goto write_error;
 	
-	for( acc = irc->accounts; acc; acc = acc->next )
+	for( acc = irc->b->accounts; acc; acc = acc->next )
 	{
 		unsigned char *pass_cr;
@@ -470,4 +470,5 @@
 			goto write_error;
 		
+#if 0
 		for( c = irc->chatrooms; c; c = c->next )
 		{
@@ -488,4 +489,5 @@
 				goto write_error;
 		}
+#endif
 		
 		if( !xml_printf( fd, 1, "</account>\n" ) )
Index: unix.c
===================================================================
--- unix.c	(revision 57c96f7be2511a0a50015512dc03a30ba0923862)
+++ unix.c	(revision 1f92a5851e0e3b1730e940980f2b0122c506c724)
@@ -115,5 +115,4 @@
 	}
 
-	/*
 	global.storage = storage_init( global.conf->primary_storage, global.conf->migrate_storage );
 	if( global.storage == NULL )
@@ -122,5 +121,4 @@
 		return( 1 );
 	}
-	*/
  	
 	/* Catch some signals to tell the user what's happening before quitting */
