Index: protocols/jabber/io.c
===================================================================
--- protocols/jabber/io.c	(revision fa29d09342c79b886efacee4cfc3078be5f5a722)
+++ protocols/jabber/io.c	(revision 0da65d5fb37691ed4d31f7ab4058732f1440db6b)
@@ -26,7 +26,7 @@
 
 static gboolean jabber_write_callback( gpointer data, gint fd, b_input_condition cond );
-static gboolean jabber_write_queue( struct gaim_connection *gc );
-
-int jabber_write_packet( struct gaim_connection *gc, struct xt_node *node )
+static gboolean jabber_write_queue( struct im_connection *ic );
+
+int jabber_write_packet( struct im_connection *ic, struct xt_node *node )
 {
 	char *buf;
@@ -34,5 +34,5 @@
 	
 	buf = xt_to_string( node );
-	st = jabber_write( gc, buf, strlen( buf ) );
+	st = jabber_write( ic, buf, strlen( buf ) );
 	g_free( buf );
 	
@@ -40,7 +40,7 @@
 }
 
-int jabber_write( struct gaim_connection *gc, char *buf, int len )
-{
-	struct jabber_data *jd = gc->proto_data;
+int jabber_write( struct im_connection *ic, char *buf, int len )
+{
+	struct jabber_data *jd = ic->proto_data;
 	gboolean ret;
 	
@@ -54,6 +54,6 @@
 		   it via the event handler. If not, add the handler. (In
 		   most cases it probably won't be necessary.) */
-		if( ( ret = jabber_write_queue( gc ) ) && jd->tx_len > 0 )
-			jd->w_inpa = b_input_add( jd->fd, GAIM_INPUT_WRITE, jabber_write_callback, gc );
+		if( ( ret = jabber_write_queue( ic ) ) && jd->tx_len > 0 )
+			jd->w_inpa = b_input_add( jd->fd, GAIM_INPUT_WRITE, jabber_write_callback, ic );
 	}
 	else
@@ -85,5 +85,5 @@
 static gboolean jabber_write_callback( gpointer data, gint fd, b_input_condition cond )
 {
-	struct jabber_data *jd = ((struct gaim_connection *)data)->proto_data;
+	struct jabber_data *jd = ((struct im_connection *)data)->proto_data;
 	
 	return jd->fd != -1 &&
@@ -92,7 +92,7 @@
 }
 
-static gboolean jabber_write_queue( struct gaim_connection *gc )
-{
-	struct jabber_data *jd = gc->proto_data;
+static gboolean jabber_write_queue( struct im_connection *ic )
+{
+	struct jabber_data *jd = ic->proto_data;
 	int st;
 	
@@ -117,6 +117,6 @@
 		jd->fd = -1;
 		
-		hide_login_progress_error( gc, "Short write() to server" );
-		signoff( gc );
+		hide_login_progress_error( ic, "Short write() to server" );
+		signoff( ic );
 		return FALSE;
 	}
@@ -142,6 +142,6 @@
 static gboolean jabber_read_callback( gpointer data, gint fd, b_input_condition cond )
 {
-	struct gaim_connection *gc = data;
-	struct jabber_data *jd = gc->proto_data;
+	struct im_connection *ic = data;
+	struct jabber_data *jd = ic->proto_data;
 	char buf[512];
 	int st;
@@ -160,6 +160,6 @@
 		if( xt_feed( jd->xt, buf, st ) < 0 )
 		{
-			hide_login_progress_error( gc, "XML stream error" );
-			signoff( gc );
+			hide_login_progress_error( ic, "XML stream error" );
+			signoff( ic );
 			return FALSE;
 		}
@@ -176,5 +176,5 @@
 		{
 			jd->flags &= ~JFLAG_STREAM_RESTART;
-			jabber_start_stream( gc );
+			jabber_start_stream( ic );
 		}
 		
@@ -196,19 +196,19 @@
 				   this is an old server that can't do SASL
 				   authentication. */
-				if( !sasl_supported( gc ) )
+				if( !sasl_supported( ic ) )
 				{
 					/* If there's no version= tag, we suppose
 					   this server does NOT implement: XMPP 1.0,
 					   SASL and TLS. */
-					if( set_getbool( &gc->acc->set, "tls" ) )
+					if( set_getbool( &ic->acc->set, "tls" ) )
 					{
-						hide_login_progress( gc, "TLS is turned on for this "
+						hide_login_progress( ic, "TLS is turned on for this "
 						          "account, but is not supported by this server" );
-						signoff( gc );
+						signoff( ic );
 						return FALSE;
 					}
 					else
 					{
-						return jabber_init_iq_auth( gc );
+						return jabber_init_iq_auth( ic );
 					}
 				}
@@ -216,6 +216,6 @@
 			else
 			{
-				hide_login_progress( gc, "XML stream error" );
-				signoff( gc );
+				hide_login_progress( ic, "XML stream error" );
+				signoff( ic );
 				return FALSE;
 			}
@@ -227,6 +227,6 @@
 		jd->fd = -1;
 		
-		hide_login_progress_error( gc, "Error while reading from server" );
-		signoff( gc );
+		hide_login_progress_error( ic, "Error while reading from server" );
+		signoff( ic );
 		return FALSE;
 	}
@@ -238,22 +238,22 @@
 gboolean jabber_connected_plain( gpointer data, gint source, b_input_condition cond )
 {
-	struct gaim_connection *gc = data;
+	struct im_connection *ic = data;
 	
 	if( source == -1 )
 	{
-		hide_login_progress( gc, "Could not connect to server" );
-		signoff( gc );
+		hide_login_progress( ic, "Could not connect to server" );
+		signoff( ic );
 		return FALSE;
 	}
 	
-	set_login_progress( gc, 1, "Connected to server, logging in" );
-	
-	return jabber_start_stream( gc );
+	set_login_progress( ic, 1, "Connected to server, logging in" );
+	
+	return jabber_start_stream( ic );
 }
 
 gboolean jabber_connected_ssl( gpointer data, void *source, b_input_condition cond )
 {
-	struct gaim_connection *gc = data;
-	struct jabber_data *jd = gc->proto_data;
+	struct im_connection *ic = data;
+	struct jabber_data *jd = ic->proto_data;
 	
 	if( source == NULL )
@@ -263,12 +263,12 @@
 		jd->ssl = NULL;
 		
-		hide_login_progress( gc, "Could not connect to server" );
-		signoff( gc );
+		hide_login_progress( ic, "Could not connect to server" );
+		signoff( ic );
 		return FALSE;
 	}
 	
-	set_login_progress( gc, 1, "Connected to server, logging in" );
-	
-	return jabber_start_stream( gc );
+	set_login_progress( ic, 1, "Connected to server, logging in" );
+	
+	return jabber_start_stream( ic );
 }
 
@@ -281,10 +281,10 @@
 static xt_status jabber_pkt_features( struct xt_node *node, gpointer data )
 {
-	struct gaim_connection *gc = data;
-	struct jabber_data *jd = gc->proto_data;
+	struct im_connection *ic = data;
+	struct jabber_data *jd = ic->proto_data;
 	struct xt_node *c, *reply;
 	int trytls;
 	
-	trytls = g_strcasecmp( set_getstr( &gc->acc->set, "tls" ), "try" ) == 0;
+	trytls = g_strcasecmp( set_getstr( &ic->acc->set, "tls" ), "try" ) == 0;
 	c = xt_find_node( node->children, "starttls" );
 	if( c && !jd->ssl )
@@ -295,8 +295,8 @@
 		c = xt_find_node( c->children, "required" );
 		
-		if( c && ( !trytls && !set_getbool( &gc->acc->set, "tls" ) ) )
-		{
-			hide_login_progress( gc, "Server requires TLS connections, but TLS is turned off for this account" );
-			signoff( gc );
+		if( c && ( !trytls && !set_getbool( &ic->acc->set, "tls" ) ) )
+		{
+			hide_login_progress( ic, "Server requires TLS connections, but TLS is turned off for this account" );
+			signoff( ic );
 			
 			return XT_ABORT;
@@ -304,9 +304,9 @@
 		
 		/* Only run this if the tls setting is set to true or try: */
-		if( ( trytls || set_getbool( &gc->acc->set, "tls" ) ) )
+		if( ( trytls || set_getbool( &ic->acc->set, "tls" ) ) )
 		{
 			reply = xt_new_node( "starttls", NULL, NULL );
 			xt_add_attr( reply, "xmlns", XMLNS_TLS );
-			if( !jabber_write_packet( gc, reply ) )
+			if( !jabber_write_packet( ic, reply ) )
 			{
 				xt_free_node( reply );
@@ -325,8 +325,8 @@
 		   using SSL/TLS. */
 		
-		if( !trytls && set_getbool( &gc->acc->set, "tls" ) )
-		{
-			hide_login_progress( gc, "TLS is turned on for this account, but is not supported by this server" );
-			signoff( gc );
+		if( !trytls && set_getbool( &ic->acc->set, "tls" ) )
+		{
+			hide_login_progress( ic, "TLS is turned on for this account, but is not supported by this server" );
+			signoff( ic );
 			
 			return XT_ABORT;
@@ -346,7 +346,7 @@
 	   other way. jabber.com doesn't seem to do SASL while it pretends
 	   to be XMPP 1.0 compliant! */
-	else if( !( jd->flags & JFLAG_AUTHENTICATED ) && sasl_supported( gc ) )
-	{
-		if( !jabber_init_iq_auth( gc ) )
+	else if( !( jd->flags & JFLAG_AUTHENTICATED ) && sasl_supported( ic ) )
+	{
+		if( !jabber_init_iq_auth( ic ) )
 			return XT_ABORT;
 	}
@@ -354,10 +354,10 @@
 	if( ( c = xt_find_node( node->children, "bind" ) ) )
 	{
-		reply = xt_new_node( "bind", NULL, xt_new_node( "resource", set_getstr( &gc->acc->set, "resource" ), NULL ) );
+		reply = xt_new_node( "bind", NULL, xt_new_node( "resource", set_getstr( &ic->acc->set, "resource" ), NULL ) );
 		xt_add_attr( reply, "xmlns", XMLNS_BIND );
 		reply = jabber_make_packet( "iq", "set", NULL, reply );
-		jabber_cache_add( gc, reply, jabber_pkt_bind_sess );
-		
-		if( !jabber_write_packet( gc, reply ) )
+		jabber_cache_add( ic, reply, jabber_pkt_bind_sess );
+		
+		if( !jabber_write_packet( ic, reply ) )
 			return XT_ABORT;
 		
@@ -370,7 +370,7 @@
 		xt_add_attr( reply, "xmlns", XMLNS_SESSION );
 		reply = jabber_make_packet( "iq", "set", NULL, reply );
-		jabber_cache_add( gc, reply, jabber_pkt_bind_sess );
-		
-		if( !jabber_write_packet( gc, reply ) )
+		jabber_cache_add( ic, reply, jabber_pkt_bind_sess );
+		
+		if( !jabber_write_packet( ic, reply ) )
 			return XT_ABORT;
 		
@@ -383,5 +383,5 @@
 	if( jd->flags & JFLAG_AUTHENTICATED && ( jd->flags & ( JFLAG_WAIT_BIND | JFLAG_WAIT_SESSION ) ) == 0 )
 	{
-		if( !jabber_get_roster( gc ) )
+		if( !jabber_get_roster( ic ) )
 			return XT_ABORT;
 	}
@@ -392,6 +392,6 @@
 static xt_status jabber_pkt_proceed_tls( struct xt_node *node, gpointer data )
 {
-	struct gaim_connection *gc = data;
-	struct jabber_data *jd = gc->proto_data;
+	struct im_connection *ic = data;
+	struct jabber_data *jd = ic->proto_data;
 	char *xmlns;
 	
@@ -417,7 +417,7 @@
 	jd->w_inpa = jd->r_inpa = 0;
 	
-	set_login_progress( gc, 1, "Converting stream to TLS" );
-	
-	jd->ssl = ssl_starttls( jd->fd, jabber_connected_ssl, gc );
+	set_login_progress( ic, 1, "Converting stream to TLS" );
+	
+	jd->ssl = ssl_starttls( jd->fd, jabber_connected_ssl, ic );
 	
 	return XT_HANDLED;
@@ -426,5 +426,5 @@
 static xt_status jabber_pkt_stream_error( struct xt_node *node, gpointer data )
 {
-	struct gaim_connection *gc = data;
+	struct im_connection *ic = data;
 	struct xt_node *c;
 	char *s, *type = NULL, *text = NULL;
@@ -452,6 +452,6 @@
 	if( type == NULL )
 	{
-		hide_login_progress_error( gc, "Unknown stream error reported by server" );
-		signoff( gc );
+		hide_login_progress_error( ic, "Unknown stream error reported by server" );
+		signoff( ic );
 		return XT_ABORT;
 	}
@@ -462,15 +462,15 @@
 	if( strcmp( type, "conflict" ) == 0 )
 	{
-		hide_login_progress( gc, "Account and resource used from a different location" );
-		gc->wants_to_die = TRUE;
+		hide_login_progress( ic, "Account and resource used from a different location" );
+		ic->wants_to_die = TRUE;
 	}
 	else
 	{
 		s = g_strdup_printf( "Stream error: %s%s%s", type, text ? ": " : "", text ? text : "" );
-		hide_login_progress_error( gc, s );
+		hide_login_progress_error( ic, s );
 		g_free( s );
 	}
 	
-	signoff( gc );
+	signoff( ic );
 	
 	return XT_ABORT;
@@ -500,7 +500,7 @@
 };
 
-gboolean jabber_start_stream( struct gaim_connection *gc )
-{
-	struct jabber_data *jd = gc->proto_data;
+gboolean jabber_start_stream( struct im_connection *ic )
+{
+	struct jabber_data *jd = ic->proto_data;
 	int st;
 	char *greet;
@@ -509,9 +509,9 @@
 	   from the server too. */
 	xt_free( jd->xt );	/* In case we're RE-starting. */
-	jd->xt = xt_new( gc );
+	jd->xt = xt_new( ic );
 	jd->xt->handlers = (struct xt_handler_entry*) jabber_handlers;
 	
 	if( jd->r_inpa <= 0 )
-		jd->r_inpa = b_input_add( jd->fd, GAIM_INPUT_READ, jabber_read_callback, gc );
+		jd->r_inpa = b_input_add( jd->fd, GAIM_INPUT_READ, jabber_read_callback, ic );
 	
 	greet = g_strdup_printf( "<?xml version='1.0' ?>"
@@ -519,5 +519,5 @@
 	                          "xmlns:stream=\"http://etherx.jabber.org/streams\" version=\"1.0\">", jd->server );
 	
-	st = jabber_write( gc, greet, strlen( greet ) );
+	st = jabber_write( ic, greet, strlen( greet ) );
 	
 	g_free( greet );
@@ -526,7 +526,7 @@
 }
 
-void jabber_end_stream( struct gaim_connection *gc )
-{
-	struct jabber_data *jd = gc->proto_data;
+void jabber_end_stream( struct im_connection *ic )
+{
+	struct jabber_data *jd = ic->proto_data;
 	
 	/* Let's only do this if the queue is currently empty, otherwise it'd
@@ -538,13 +538,13 @@
 		int st = 1;
 		
-		if( gc->flags & OPT_LOGGED_IN )
+		if( ic->flags & OPT_LOGGED_IN )
 		{
 			node = jabber_make_packet( "presence", "unavailable", NULL, NULL );
-			st = jabber_write_packet( gc, node );
+			st = jabber_write_packet( ic, node );
 			xt_free_node( node );
 		}
 		
 		if( st )
-			jabber_write( gc, eos, strlen( eos ) );
-	}
-}
+			jabber_write( ic, eos, strlen( eos ) );
+	}
+}
Index: protocols/jabber/iq.c
===================================================================
--- protocols/jabber/iq.c	(revision fa29d09342c79b886efacee4cfc3078be5f5a722)
+++ protocols/jabber/iq.c	(revision 0da65d5fb37691ed4d31f7ab4058732f1440db6b)
@@ -24,11 +24,11 @@
 #include "jabber.h"
 
-static xt_status jabber_parse_roster( struct gaim_connection *gc, struct xt_node *node, struct xt_node *orig );
-static xt_status jabber_iq_display_vcard( struct gaim_connection *gc, struct xt_node *node, struct xt_node *orig );
+static xt_status jabber_parse_roster( struct im_connection *ic, struct xt_node *node, struct xt_node *orig );
+static xt_status jabber_iq_display_vcard( struct im_connection *ic, struct xt_node *node, struct xt_node *orig );
 
 xt_status jabber_pkt_iq( struct xt_node *node, gpointer data )
 {
-	struct gaim_connection *gc = data;
-	struct jabber_data *jd = gc->proto_data;
+	struct im_connection *ic = data;
+	struct jabber_data *jd = ic->proto_data;
 	struct xt_node *c, *reply = NULL;
 	char *type, *s;
@@ -39,6 +39,6 @@
 	if( !type )
 	{
-		hide_login_progress_error( gc, "Received IQ packet without type." );
-		signoff( gc );
+		hide_login_progress_error( ic, "Received IQ packet without type." );
+		signoff( ic );
 		return XT_ABORT;
 	}
@@ -60,7 +60,7 @@
 		
 		if( entry == NULL )
-			serv_got_crap( gc, "WARNING: Received IQ-%s packet with unknown/expired ID %s!", type, s );
+			serv_got_crap( ic, "WARNING: Received IQ-%s packet with unknown/expired ID %s!", type, s );
 		else if( entry->func )
-			return entry->func( gc, node, entry->node );
+			return entry->func( ic, node, entry->node );
 	}
 	else if( strcmp( type, "get" ) == 0 )
@@ -69,5 +69,5 @@
 		    !( s = xt_find_attr( c, "xmlns" ) ) )
 		{
-			serv_got_crap( gc, "WARNING: Received incomplete IQ-%s packet", type );
+			serv_got_crap( ic, "WARNING: Received incomplete IQ-%s packet", type );
 			return XT_HANDLED;
 		}
@@ -132,5 +132,5 @@
 		    !( s = xt_find_attr( c, "xmlns" ) ) )
 		{
-			serv_got_crap( gc, "WARNING: Received incomplete IQ-%s packet", type );
+			serv_got_crap( ic, "WARNING: Received incomplete IQ-%s packet", type );
 			return XT_HANDLED;
 		}
@@ -141,11 +141,11 @@
 		if( strcmp( s, XMLNS_ROSTER ) == 0 )
 		{
-			int bare_len = strlen( gc->acc->user );
+			int bare_len = strlen( ic->acc->user );
 			
 			if( ( s = xt_find_attr( node, "from" ) ) == NULL ||
-			    ( strncmp( s, gc->acc->user, bare_len ) == 0 &&
+			    ( strncmp( s, ic->acc->user, bare_len ) == 0 &&
 			      ( s[bare_len] == 0 || s[bare_len] == '/' ) ) )
 			{
-				jabber_parse_roster( gc, node, NULL );
+				jabber_parse_roster( ic, node, NULL );
 				
 				/* Should we generate a reply here? Don't think it's
@@ -154,5 +154,5 @@
 			else
 			{
-				serv_got_crap( gc, "WARNING: %s tried to fake a roster push!", s ? s : "(unknown)" );
+				serv_got_crap( ic, "WARNING: %s tried to fake a roster push!", s ? s : "(unknown)" );
 				
 				xt_free_node( reply );
@@ -182,5 +182,5 @@
 		}
 		
-		st = jabber_write_packet( gc, reply );
+		st = jabber_write_packet( ic, reply );
 		xt_free_node( reply );
 		if( !st )
@@ -191,10 +191,10 @@
 }
 
-static xt_status jabber_do_iq_auth( struct gaim_connection *gc, struct xt_node *node, struct xt_node *orig );
-static xt_status jabber_finish_iq_auth( struct gaim_connection *gc, struct xt_node *node, struct xt_node *orig );
-
-int jabber_init_iq_auth( struct gaim_connection *gc )
-{
-	struct jabber_data *jd = gc->proto_data;
+static xt_status jabber_do_iq_auth( struct im_connection *ic, struct xt_node *node, struct xt_node *orig );
+static xt_status jabber_finish_iq_auth( struct im_connection *ic, struct xt_node *node, struct xt_node *orig );
+
+int jabber_init_iq_auth( struct im_connection *ic )
+{
+	struct jabber_data *jd = ic->proto_data;
 	struct xt_node *node;
 	int st;
@@ -204,13 +204,13 @@
 	node = jabber_make_packet( "iq", "get", NULL, node );
 	
-	jabber_cache_add( gc, node, jabber_do_iq_auth );
-	st = jabber_write_packet( gc, node );
+	jabber_cache_add( ic, node, jabber_do_iq_auth );
+	st = jabber_write_packet( ic, node );
 	
 	return st;
 }
 
-static xt_status jabber_do_iq_auth( struct gaim_connection *gc, struct xt_node *node, struct xt_node *orig )
-{
-	struct jabber_data *jd = gc->proto_data;
+static xt_status jabber_do_iq_auth( struct im_connection *ic, struct xt_node *node, struct xt_node *orig )
+{
+	struct jabber_data *jd = ic->proto_data;
 	struct xt_node *reply, *query;
 	xt_status st;
@@ -219,6 +219,6 @@
 	if( !( query = xt_find_node( node->children, "query" ) ) )
 	{
-		serv_got_crap( gc, "WARNING: Received incomplete IQ packet while authenticating" );
-		signoff( gc );
+		serv_got_crap( ic, "WARNING: Received incomplete IQ packet while authenticating" );
+		signoff( ic );
 		return XT_HANDLED;
 	}
@@ -228,5 +228,5 @@
 	xt_add_attr( reply, "xmlns", XMLNS_AUTH );
 	xt_add_child( reply, xt_new_node( "username", jd->username, NULL ) );
-	xt_add_child( reply, xt_new_node( "resource", set_getstr( &gc->acc->set, "resource" ), NULL ) );
+	xt_add_child( reply, xt_new_node( "resource", set_getstr( &ic->acc->set, "resource" ), NULL ) );
 	
 	if( xt_find_node( query->children, "digest" ) && ( s = xt_find_attr( jd->xt->root, "id" ) ) )
@@ -241,5 +241,5 @@
 		shaInit( &sha );
 		shaUpdate( &sha, (unsigned char*) s, strlen( s ) );
-		shaUpdate( &sha, (unsigned char*) gc->acc->pass, strlen( gc->acc->pass ) );
+		shaUpdate( &sha, (unsigned char*) ic->acc->pass, strlen( ic->acc->pass ) );
 		shaFinal( &sha, hash );
 		
@@ -252,5 +252,5 @@
 	{
 		/* We'll have to stick with plaintext. Let's hope we're using SSL/TLS... */
-		xt_add_child( reply, xt_new_node( "password", gc->acc->pass, NULL ) );
+		xt_add_child( reply, xt_new_node( "password", ic->acc->pass, NULL ) );
 	}
 	else
@@ -258,25 +258,25 @@
 		xt_free_node( reply );
 		
-		hide_login_progress( gc, "Can't find suitable authentication method" );
-		signoff( gc );
+		hide_login_progress( ic, "Can't find suitable authentication method" );
+		signoff( ic );
 		return XT_ABORT;
 	}
 	
 	reply = jabber_make_packet( "iq", "set", NULL, reply );
-	jabber_cache_add( gc, reply, jabber_finish_iq_auth );
-	st = jabber_write_packet( gc, reply );
+	jabber_cache_add( ic, reply, jabber_finish_iq_auth );
+	st = jabber_write_packet( ic, reply );
 	
 	return st ? XT_HANDLED : XT_ABORT;
 }
 
-static xt_status jabber_finish_iq_auth( struct gaim_connection *gc, struct xt_node *node, struct xt_node *orig )
-{
-	struct jabber_data *jd = gc->proto_data;
+static xt_status jabber_finish_iq_auth( struct im_connection *ic, struct xt_node *node, struct xt_node *orig )
+{
+	struct jabber_data *jd = ic->proto_data;
 	char *type;
 	
 	if( !( type = xt_find_attr( node, "type" ) ) )
 	{
-		serv_got_crap( gc, "WARNING: Received incomplete IQ packet while authenticating" );
-		signoff( gc );
+		serv_got_crap( ic, "WARNING: Received incomplete IQ packet while authenticating" );
+		signoff( ic );
 		return XT_HANDLED;
 	}
@@ -284,6 +284,6 @@
 	if( strcmp( type, "error" ) == 0 )
 	{
-		hide_login_progress( gc, "Authentication failure" );
-		signoff( gc );
+		hide_login_progress( ic, "Authentication failure" );
+		signoff( ic );
 		return XT_ABORT;
 	}
@@ -293,5 +293,5 @@
 		   old (non-SASL) way. */
 		jd->flags |= JFLAG_AUTHENTICATED;
-		if( !jabber_get_roster( gc ) )
+		if( !jabber_get_roster( ic ) )
 			return XT_ABORT;
 	}
@@ -300,7 +300,7 @@
 }
 
-xt_status jabber_pkt_bind_sess( struct gaim_connection *gc, struct xt_node *node, struct xt_node *orig )
-{
-	struct jabber_data *jd = gc->proto_data;
+xt_status jabber_pkt_bind_sess( struct im_connection *ic, struct xt_node *node, struct xt_node *orig )
+{
+	struct jabber_data *jd = ic->proto_data;
 	struct xt_node *c;
 	char *s;
@@ -310,6 +310,6 @@
 		c = xt_find_node( c->children, "jid" );
 		if( c && c->text_len && ( s = strchr( c->text, '/' ) ) &&
-		    strcmp( s + 1, set_getstr( &gc->acc->set, "resource" ) ) != 0 )
-			serv_got_crap( gc, "Server changed session resource string to `%s'", s + 1 );
+		    strcmp( s + 1, set_getstr( &ic->acc->set, "resource" ) ) != 0 )
+			serv_got_crap( ic, "Server changed session resource string to `%s'", s + 1 );
 		
 		jd->flags &= ~JFLAG_WAIT_BIND;
@@ -322,5 +322,5 @@
 	if( ( jd->flags & ( JFLAG_WAIT_BIND | JFLAG_WAIT_SESSION ) ) == 0 )
 	{
-		if( !jabber_get_roster( gc ) )
+		if( !jabber_get_roster( ic ) )
 			return XT_ABORT;
 	}
@@ -329,10 +329,10 @@
 }
 
-int jabber_get_roster( struct gaim_connection *gc )
+int jabber_get_roster( struct im_connection *ic )
 {
 	struct xt_node *node;
 	int st;
 	
-	set_login_progress( gc, 1, "Authenticated, requesting buddy list" );
+	set_login_progress( ic, 1, "Authenticated, requesting buddy list" );
 	
 	node = xt_new_node( "query", NULL, NULL );
@@ -340,11 +340,11 @@
 	node = jabber_make_packet( "iq", "get", NULL, node );
 	
-	jabber_cache_add( gc, node, jabber_parse_roster );
-	st = jabber_write_packet( gc, node );
+	jabber_cache_add( ic, node, jabber_parse_roster );
+	st = jabber_write_packet( ic, node );
 	
 	return st;
 }
 
-static xt_status jabber_parse_roster( struct gaim_connection *gc, struct xt_node *node, struct xt_node *orig )
+static xt_status jabber_parse_roster( struct im_connection *ic, struct xt_node *node, struct xt_node *orig )
 {
 	struct xt_node *query, *c;
@@ -353,5 +353,5 @@
 	if( !( query = xt_find_node( node->children, "query" ) ) )
 	{
-		serv_got_crap( gc, "WARNING: Received NULL roster packet" );
+		serv_got_crap( ic, "WARNING: Received NULL roster packet" );
 		return XT_HANDLED;
 	}
@@ -371,5 +371,5 @@
 		{
 			if( ( strcmp( sub, "both" ) == 0 || strcmp( sub, "to" ) == 0 ) )
-				add_buddy( gc, NULL, jid, name );
+				add_buddy( ic, NULL, jid, name );
 		}
 		else
@@ -378,8 +378,8 @@
 			if( ( strcmp( sub, "both" ) == 0 || strcmp( sub, "to" ) == 0 ) )
 			{
-				if( find_buddy( gc, jid ) == NULL )
-					add_buddy( gc, NULL, jid, name );
+				if( find_buddy( ic, jid ) == NULL )
+					add_buddy( ic, NULL, jid, name );
 				else if( name )
-					serv_buddy_rename( gc, jid, name );
+					serv_buddy_rename( ic, jid, name );
 			}
 			else if( strcmp( sub, "remove" ) == 0 )
@@ -387,6 +387,6 @@
 				/* Don't have any API call for this yet! So let's
 				   just try to handle this as well as we can. */
-				jabber_buddy_remove_bare( gc, jid );
-				serv_got_update( gc, jid, 0, 0, 0, 0, 0, 0 );
+				jabber_buddy_remove_bare( ic, jid );
+				serv_got_update( ic, jid, 0, 0, 0, 0, 0, 0 );
 				/* FIXME! */
 			}
@@ -397,10 +397,10 @@
 	
 	if( initial )
-		account_online( gc );
+		account_online( ic );
 	
 	return XT_HANDLED;
 }
 
-int jabber_get_vcard( struct gaim_connection *gc, char *bare_jid )
+int jabber_get_vcard( struct im_connection *ic, char *bare_jid )
 {
 	struct xt_node *node;
@@ -413,11 +413,11 @@
 	node = jabber_make_packet( "iq", "get", bare_jid, node );
 	
-	jabber_cache_add( gc, node, jabber_iq_display_vcard );
-	return jabber_write_packet( gc, node );
-}
-
-static xt_status jabber_iq_display_vcard( struct gaim_connection *gc, struct xt_node *node, struct xt_node *orig )
-{
-	struct xt_node *vc, *c, *sc; /* subchild, gc is already in use ;-) */
+	jabber_cache_add( ic, node, jabber_iq_display_vcard );
+	return jabber_write_packet( ic, node );
+}
+
+static xt_status jabber_iq_display_vcard( struct im_connection *ic, struct xt_node *node, struct xt_node *orig )
+{
+	struct xt_node *vc, *c, *sc; /* subchild, ic is already in use ;-) */
 	GString *reply;
 	char *s;
@@ -428,5 +428,5 @@
 	{
 		s = xt_find_attr( orig, "to" ); /* If this returns NULL something's wrong.. */
-		serv_got_crap( gc, "Could not retrieve vCard of %s", s ? s : "(NULL)" );
+		serv_got_crap( ic, "Could not retrieve vCard of %s", s ? s : "(NULL)" );
 		return XT_HANDLED;
 	}
@@ -536,5 +536,5 @@
 	/* *sigh* */
 	
-	serv_got_crap( gc, reply->str );
+	serv_got_crap( ic, reply->str );
 	g_string_free( reply, TRUE );
 	
@@ -542,5 +542,5 @@
 }
 
-int jabber_add_to_roster( struct gaim_connection *gc, char *handle, char *name )
+int jabber_add_to_roster( struct im_connection *ic, char *handle, char *name )
 {
 	struct xt_node *node;
@@ -558,5 +558,5 @@
 	node = jabber_make_packet( "iq", "set", NULL, node );
 	
-	st = jabber_write_packet( gc, node );
+	st = jabber_write_packet( ic, node );
 	
 	xt_free_node( node );
@@ -564,5 +564,5 @@
 }
 
-int jabber_remove_from_roster( struct gaim_connection *gc, char *handle )
+int jabber_remove_from_roster( struct im_connection *ic, char *handle )
 {
 	struct xt_node *node;
@@ -579,5 +579,5 @@
 	node = jabber_make_packet( "iq", "set", NULL, node );
 	
-	st = jabber_write_packet( gc, node );
+	st = jabber_write_packet( ic, node );
 	
 	xt_free_node( node );
Index: protocols/jabber/jabber.c
===================================================================
--- protocols/jabber/jabber.c	(revision fa29d09342c79b886efacee4cfc3078be5f5a722)
+++ protocols/jabber/jabber.c	(revision 0da65d5fb37691ed4d31f7ab4058732f1440db6b)
@@ -33,5 +33,5 @@
 #include "jabber.h"
 
-static void jabber_acc_init( account_t *acc )
+static void jabber_init( account_t *acc )
 {
 	set_t *s;
@@ -59,11 +59,11 @@
 static void jabber_login( account_t *acc )
 {
-	struct gaim_connection *gc = new_gaim_conn( acc );
+	struct im_connection *ic = new_gaim_conn( acc );
 	struct jabber_data *jd = g_new0( struct jabber_data, 1 );
 	struct ns_srv_reply *srv = NULL;
 	char *connect_to, *s;
 	
-	jd->gc = gc;
-	gc->proto_data = jd;
+	jd->ic = ic;
+	ic->proto_data = jd;
 	
 	jd->username = g_strdup( acc->user );
@@ -72,6 +72,6 @@
 	if( jd->server == NULL )
 	{
-		hide_login_progress( gc, "Incomplete account name (format it like <username@jabberserver.name>)" );
-		signoff( gc );
+		hide_login_progress( ic, "Incomplete account name (format it like <username@jabberserver.name>)" );
+		signoff( ic );
 		return;
 	}
@@ -159,12 +159,12 @@
 		connect_to = jd->server;
 	
-	set_login_progress( gc, 0, "Connecting" );
+	set_login_progress( ic, 0, "Connecting" );
 	
 	if( set_getint( &acc->set, "port" ) < JABBER_PORT_MIN ||
 	    set_getint( &acc->set, "port" ) > JABBER_PORT_MAX )
 	{
-		serv_got_crap( gc, "Incorrect port number, must be in the %d-%d range",
+		serv_got_crap( ic, "Incorrect port number, must be in the %d-%d range",
 		               JABBER_PORT_MIN, JABBER_PORT_MAX );
-		signoff( gc );
+		signoff( ic );
 		return;
 	}
@@ -175,10 +175,10 @@
 	if( set_getbool( &acc->set, "ssl" ) )
 	{
-		jd->ssl = ssl_connect( connect_to, set_getint( &acc->set, "port" ), jabber_connected_ssl, gc );
+		jd->ssl = ssl_connect( connect_to, set_getint( &acc->set, "port" ), jabber_connected_ssl, ic );
 		jd->fd = jd->ssl ? ssl_getfd( jd->ssl ) : -1;
 	}
 	else
 	{
-		jd->fd = proxy_connect( connect_to, srv ? srv->port : set_getint( &acc->set, "port" ), jabber_connected_plain, gc );
+		jd->fd = proxy_connect( connect_to, srv ? srv->port : set_getint( &acc->set, "port" ), jabber_connected_plain, ic );
 	}
 	g_free( srv );
@@ -186,14 +186,14 @@
 	if( jd->fd == -1 )
 	{
-		hide_login_progress( gc, "Could not connect to server" );
-		signoff( gc );
-	}
-}
-
-static void jabber_close( struct gaim_connection *gc )
-{
-	struct jabber_data *jd = gc->proto_data;
-	
-	jabber_end_stream( gc );
+		hide_login_progress( ic, "Could not connect to server" );
+		signoff( ic );
+	}
+}
+
+static void jabber_logout( struct im_connection *ic )
+{
+	struct jabber_data *jd = ic->proto_data;
+	
+	jabber_end_stream( ic );
 	
 	if( jd->r_inpa >= 0 )
@@ -219,12 +219,12 @@
 }
 
-static int jabber_send_im( struct gaim_connection *gc, char *who, char *message, int len, int away )
-{
-	struct jabber_data *jd = gc->proto_data;
+static int jabber_send_im( struct im_connection *ic, char *who, char *message, int flags )
+{
+	struct jabber_data *jd = ic->proto_data;
 	struct jabber_buddy *bud;
 	struct xt_node *node;
 	int st;
 	
-	bud = jabber_buddy_by_jid( gc, who, 0 );
+	bud = jabber_buddy_by_jid( ic, who, 0 );
 	
 	node = xt_new_node( "body", message, NULL );
@@ -251,5 +251,5 @@
 	}
 	
-	st = jabber_write_packet( gc, node );
+	st = jabber_write_packet( ic, node );
 	xt_free_node( node );
 	
@@ -257,5 +257,5 @@
 }
 
-static GList *jabber_away_states( struct gaim_connection *gc )
+static GList *jabber_away_states( struct im_connection *ic )
 {
 	static GList *l = NULL;
@@ -269,11 +269,11 @@
 }
 
-static void jabber_get_info( struct gaim_connection *gc, char *who )
-{
-	struct jabber_data *jd = gc->proto_data;
+static void jabber_get_info( struct im_connection *ic, char *who )
+{
+	struct jabber_data *jd = ic->proto_data;
 	struct jabber_buddy *bud;
 	
 	if( strchr( who, '/' ) )
-		bud = jabber_buddy_by_jid( gc, who, 0 );
+		bud = jabber_buddy_by_jid( ic, who, 0 );
 	else
 	{
@@ -285,5 +285,5 @@
 	while( bud )
 	{
-		serv_got_crap( gc, "Buddy %s (%d) information:\nAway state: %s\nAway message: %s",
+		serv_got_crap( ic, "Buddy %s (%d) information:\nAway state: %s\nAway message: %s",
 		                   bud->full_jid, bud->priority,
 		                   bud->away_state ? bud->away_state->full_name : "(none)",
@@ -292,10 +292,10 @@
 	}
 	
-	jabber_get_vcard( gc, bud ? bud->full_jid : who );
-}
-
-static void jabber_set_away( struct gaim_connection *gc, char *state_txt, char *message )
-{
-	struct jabber_data *jd = gc->proto_data;
+	jabber_get_vcard( ic, bud ? bud->full_jid : who );
+}
+
+static void jabber_set_away( struct im_connection *ic, char *state_txt, char *message )
+{
+	struct jabber_data *jd = ic->proto_data;
 	struct jabber_away_state *state;
 	
@@ -306,35 +306,35 @@
 	jd->away_message = ( message && *message ) ? g_strdup( message ) : NULL;
 	
-	presence_send_update( gc );
-}
-
-static void jabber_add_buddy( struct gaim_connection *gc, char *who )
-{
-	if( jabber_add_to_roster( gc, who, NULL ) )
-		presence_send_request( gc, who, "subscribe" );
-}
-
-static void jabber_remove_buddy( struct gaim_connection *gc, char *who, char *group )
+	presence_send_update( ic );
+}
+
+static void jabber_add_buddy( struct im_connection *ic, char *who, char *group )
+{
+	if( jabber_add_to_roster( ic, who, NULL ) )
+		presence_send_request( ic, who, "subscribe" );
+}
+
+static void jabber_remove_buddy( struct im_connection *ic, char *who, char *group )
 {
 	/* We should always do this part. Clean up our administration a little bit. */
-	jabber_buddy_remove_bare( gc, who );
-	
-	if( jabber_remove_from_roster( gc, who ) )
-		presence_send_request( gc, who, "unsubscribe" );
-}
-
-static void jabber_keepalive( struct gaim_connection *gc )
+	jabber_buddy_remove_bare( ic, who );
+	
+	if( jabber_remove_from_roster( ic, who ) )
+		presence_send_request( ic, who, "unsubscribe" );
+}
+
+static void jabber_keepalive( struct im_connection *ic )
 {
 	/* Just any whitespace character is enough as a keepalive for XMPP sessions. */
-	jabber_write( gc, "\n", 1 );
+	jabber_write( ic, "\n", 1 );
 	
 	/* This runs the garbage collection every minute, which means every packet
 	   is in the cache for about a minute (which should be enough AFAIK). */
-	jabber_cache_clean( gc );
-}
-
-static int jabber_send_typing( struct gaim_connection *gc, char *who, int typing )
-{
-	struct jabber_data *jd = gc->proto_data;
+	jabber_cache_clean( ic );
+}
+
+static int jabber_send_typing( struct im_connection *ic, char *who, int typing )
+{
+	struct jabber_data *jd = ic->proto_data;
 	struct jabber_buddy *bud;
 	
@@ -342,5 +342,5 @@
 	jd->flags |= JFLAG_WANT_TYPING;
 	
-	if( ( bud = jabber_buddy_by_jid( gc, who, 0 ) ) == NULL )
+	if( ( bud = jabber_buddy_by_jid( ic, who, 0 ) ) == NULL )
 	{
 		/* Sending typing notifications to unknown buddies is
@@ -369,5 +369,5 @@
 		node = jabber_make_packet( "message", "chat", bud->full_jid, node );
 		
-		st = jabber_write_packet( gc, node );
+		st = jabber_write_packet( ic, node );
 		xt_free_node( node );
 		
@@ -378,5 +378,5 @@
 }
 
-void jabber_init()
+void jabber_initmodule()
 {
 	struct prpl *ret = g_new0( struct prpl, 1 );
@@ -384,6 +384,6 @@
 	ret->name = "jabber";
 	ret->login = jabber_login;
-	ret->acc_init = jabber_acc_init;
-	ret->close = jabber_close;
+	ret->init = jabber_init;
+	ret->logout = jabber_logout;
 	ret->send_im = jabber_send_im;
 	ret->away_states = jabber_away_states;
Index: protocols/jabber/jabber.h
===================================================================
--- protocols/jabber/jabber.h	(revision fa29d09342c79b886efacee4cfc3078be5f5a722)
+++ protocols/jabber/jabber.h	(revision 0da65d5fb37691ed4d31f7ab4058732f1440db6b)
@@ -58,5 +58,5 @@
 struct jabber_data
 {
-	struct gaim_connection *gc;
+	struct im_connection *ic;
 	
 	int fd;
@@ -87,5 +87,5 @@
 };
 
-typedef xt_status (*jabber_cache_event) ( struct gaim_connection *gc, struct xt_node *node, struct xt_node *orig );
+typedef xt_status (*jabber_cache_event) ( struct im_connection *ic, struct xt_node *node, struct xt_node *orig );
 
 struct jabber_cache_entry
@@ -137,10 +137,10 @@
 /* iq.c */
 xt_status jabber_pkt_iq( struct xt_node *node, gpointer data );
-int jabber_init_iq_auth( struct gaim_connection *gc );
-xt_status jabber_pkt_bind_sess( struct gaim_connection *gc, struct xt_node *node, struct xt_node *orig );
-int jabber_get_roster( struct gaim_connection *gc );
-int jabber_get_vcard( struct gaim_connection *gc, char *bare_jid );
-int jabber_add_to_roster( struct gaim_connection *gc, char *handle, char *name );
-int jabber_remove_from_roster( struct gaim_connection *gc, char *handle );
+int jabber_init_iq_auth( struct im_connection *ic );
+xt_status jabber_pkt_bind_sess( struct im_connection *ic, struct xt_node *node, struct xt_node *orig );
+int jabber_get_roster( struct im_connection *ic );
+int jabber_get_vcard( struct im_connection *ic, char *bare_jid );
+int jabber_add_to_roster( struct im_connection *ic, char *handle, char *name );
+int jabber_remove_from_roster( struct im_connection *ic, char *handle );
 
 /* message.c */
@@ -149,6 +149,6 @@
 /* presence.c */
 xt_status jabber_pkt_presence( struct xt_node *node, gpointer data );
-int presence_send_update( struct gaim_connection *gc );
-int presence_send_request( struct gaim_connection *gc, char *handle, char *request );
+int presence_send_update( struct im_connection *ic );
+int presence_send_request( struct im_connection *ic, char *handle, char *request );
 
 /* jabber_util.c */
@@ -157,11 +157,11 @@
 struct xt_node *jabber_make_packet( char *name, char *type, char *to, struct xt_node *children );
 struct xt_node *jabber_make_error_packet( struct xt_node *orig, char *err_cond, char *err_type );
-void jabber_cache_add( struct gaim_connection *gc, struct xt_node *node, jabber_cache_event func );
-struct xt_node *jabber_cache_get( struct gaim_connection *gc, char *id );
+void jabber_cache_add( struct im_connection *ic, struct xt_node *node, jabber_cache_event func );
+struct xt_node *jabber_cache_get( struct im_connection *ic, char *id );
 void jabber_cache_entry_free( gpointer entry );
-void jabber_cache_clean( struct gaim_connection *gc );
+void jabber_cache_clean( struct im_connection *ic );
 const struct jabber_away_state *jabber_away_state_by_code( char *code );
 const struct jabber_away_state *jabber_away_state_by_name( char *name );
-void jabber_buddy_ask( struct gaim_connection *gc, char *handle );
+void jabber_buddy_ask( struct im_connection *ic, char *handle );
 char *jabber_normalize( char *orig );
 
@@ -172,18 +172,18 @@
 } get_buddy_flags_t;
 
-struct jabber_buddy *jabber_buddy_add( struct gaim_connection *gc, char *full_jid );
-struct jabber_buddy *jabber_buddy_by_jid( struct gaim_connection *gc, char *jid, get_buddy_flags_t flags );
-int jabber_buddy_remove( struct gaim_connection *gc, char *full_jid );
-int jabber_buddy_remove_bare( struct gaim_connection *gc, char *bare_jid );
+struct jabber_buddy *jabber_buddy_add( struct im_connection *ic, char *full_jid );
+struct jabber_buddy *jabber_buddy_by_jid( struct im_connection *ic, char *jid, get_buddy_flags_t flags );
+int jabber_buddy_remove( struct im_connection *ic, char *full_jid );
+int jabber_buddy_remove_bare( struct im_connection *ic, char *bare_jid );
 
 extern const struct jabber_away_state jabber_away_state_list[];
 
 /* io.c */
-int jabber_write_packet( struct gaim_connection *gc, struct xt_node *node );
-int jabber_write( struct gaim_connection *gc, char *buf, int len );
+int jabber_write_packet( struct im_connection *ic, struct xt_node *node );
+int jabber_write( struct im_connection *ic, char *buf, int len );
 gboolean jabber_connected_plain( gpointer data, gint source, b_input_condition cond );
 gboolean jabber_connected_ssl( gpointer data, void *source, b_input_condition cond );
-gboolean jabber_start_stream( struct gaim_connection *gc );
-void jabber_end_stream( struct gaim_connection *gc );
+gboolean jabber_start_stream( struct im_connection *ic );
+void jabber_end_stream( struct im_connection *ic );
 
 /* sasl.c */
@@ -191,5 +191,5 @@
 xt_status sasl_pkt_challenge( struct xt_node *node, gpointer data );
 xt_status sasl_pkt_result( struct xt_node *node, gpointer data );
-gboolean sasl_supported( struct gaim_connection *gc );
+gboolean sasl_supported( struct im_connection *ic );
 
 #endif
Index: protocols/jabber/jabber_util.c
===================================================================
--- protocols/jabber/jabber_util.c	(revision fa29d09342c79b886efacee4cfc3078be5f5a722)
+++ protocols/jabber/jabber_util.c	(revision 0da65d5fb37691ed4d31f7ab4058732f1440db6b)
@@ -42,5 +42,5 @@
 	/* Only run this stuff if the account is online ATM,
 	   and if the setting seems to be acceptable. */
-	if( acc->gc )
+	if( acc->ic )
 	{
 		/* Although set_eval functions usually are very nice and
@@ -58,5 +58,5 @@
 		/* (Yes, sorry, I prefer the hack. :-P) */
 		
-		presence_send_update( acc->gc );
+		presence_send_update( acc->ic );
 	}
 	
@@ -130,7 +130,7 @@
    them when you receive the response. Use this BEFORE sending the packet so
    it'll get a new id= tag, and do NOT free() the packet after writing it! */
-void jabber_cache_add( struct gaim_connection *gc, struct xt_node *node, jabber_cache_event func )
-{
-	struct jabber_data *jd = gc->proto_data;
+void jabber_cache_add( struct im_connection *ic, struct xt_node *node, jabber_cache_event func )
+{
+	struct jabber_data *jd = ic->proto_data;
 	char *id = g_strdup_printf( "%s%05x", JABBER_CACHED_ID, ( next_id++ ) & 0xfffff );
 	struct jabber_cache_entry *entry = g_new0( struct jabber_cache_entry, 1 );
@@ -159,7 +159,7 @@
    node should be available in the cache for at least a minute (assuming the
    function is indeed called every minute). */
-void jabber_cache_clean( struct gaim_connection *gc )
-{
-	struct jabber_data *jd = gc->proto_data;
+void jabber_cache_clean( struct im_connection *ic )
+{
+	struct jabber_data *jd = ic->proto_data;
 	
 	g_hash_table_foreach_remove( jd->node_cache, jabber_cache_clean_entry, NULL );
@@ -214,5 +214,5 @@
 struct jabber_buddy_ask_data
 {
-	struct gaim_connection *gc;
+	struct im_connection *ic;
 	char *handle;
 	char *realname;
@@ -221,8 +221,8 @@
 static void jabber_buddy_ask_yes( gpointer w, struct jabber_buddy_ask_data *bla )
 {
-	presence_send_request( bla->gc, bla->handle, "subscribed" );
-	
-	if( find_buddy( bla->gc, bla->handle ) == NULL )
-		show_got_added( bla->gc, bla->handle, NULL );
+	presence_send_request( bla->ic, bla->handle, "subscribed" );
+	
+	if( find_buddy( bla->ic, bla->handle ) == NULL )
+		show_got_added( bla->ic, bla->handle, NULL );
 	
 	g_free( bla->handle );
@@ -232,5 +232,5 @@
 static void jabber_buddy_ask_no( gpointer w, struct jabber_buddy_ask_data *bla )
 {
-	presence_send_request( bla->gc, bla->handle, "subscribed" );
+	presence_send_request( bla->ic, bla->handle, "subscribed" );
 	
 	g_free( bla->handle );
@@ -238,14 +238,14 @@
 }
 
-void jabber_buddy_ask( struct gaim_connection *gc, char *handle )
+void jabber_buddy_ask( struct im_connection *ic, char *handle )
 {
 	struct jabber_buddy_ask_data *bla = g_new0( struct jabber_buddy_ask_data, 1 );
 	char *buf;
 	
-	bla->gc = gc;
+	bla->ic = ic;
 	bla->handle = g_strdup( handle );
 	
 	buf = g_strdup_printf( "The user %s wants to add you to his/her buddy list.", handle );
-	do_ask_dialog( gc, buf, bla, jabber_buddy_ask_yes, jabber_buddy_ask_no );
+	do_ask_dialog( ic, buf, bla, jabber_buddy_ask_yes, jabber_buddy_ask_no );
 	g_free( buf );
 }
@@ -271,7 +271,7 @@
    to deal with that properly. Set their ->resource property to NULL. Do *NOT*
    allow to mix this stuff, though... */
-struct jabber_buddy *jabber_buddy_add( struct gaim_connection *gc, char *full_jid_ )
-{
-	struct jabber_data *jd = gc->proto_data;
+struct jabber_buddy *jabber_buddy_add( struct im_connection *ic, char *full_jid_ )
+{
+	struct jabber_data *jd = ic->proto_data;
 	struct jabber_buddy *bud, *new, *bi;
 	char *s, *full_jid;
@@ -343,7 +343,7 @@
    asked for a bare JID, it uses the "resource_select" setting to see which
    resource to pick. */
-struct jabber_buddy *jabber_buddy_by_jid( struct gaim_connection *gc, char *jid_, get_buddy_flags_t flags )
-{
-	struct jabber_data *jd = gc->proto_data;
+struct jabber_buddy *jabber_buddy_by_jid( struct im_connection *ic, char *jid_, get_buddy_flags_t flags )
+{
+	struct jabber_data *jd = ic->proto_data;
 	struct jabber_buddy *bud;
 	char *s, *jid;
@@ -371,8 +371,8 @@
 		}
 		
-		if( bud == NULL && ( flags & GET_BUDDY_CREAT ) && find_buddy( gc, jid ) )
+		if( bud == NULL && ( flags & GET_BUDDY_CREAT ) && find_buddy( ic, jid ) )
 		{
 			*s = '/';
-			bud = jabber_buddy_add( gc, jid );
+			bud = jabber_buddy_add( ic, jid );
 		}
 		
@@ -391,6 +391,6 @@
 		if( bud == NULL )
 			/* No match. Create it now? */
-			return ( ( flags & GET_BUDDY_CREAT ) && find_buddy( gc, jid_ ) ) ?
-			           jabber_buddy_add( gc, jid_ ) : NULL;
+			return ( ( flags & GET_BUDDY_CREAT ) && find_buddy( ic, jid_ ) ) ?
+			           jabber_buddy_add( ic, jid_ ) : NULL;
 		else if( bud->resource && ( flags & GET_BUDDY_EXACT ) )
 			/* We want an exact match, so in thise case there shouldn't be a /resource. */
@@ -409,5 +409,5 @@
 		}
 		
-		if( ( set = set_getstr( &gc->acc->set, "resource_select" ) ) == NULL )
+		if( ( set = set_getstr( &ic->acc->set, "resource_select" ) ) == NULL )
 			return NULL;
 		else if( strcmp( set, "activity" ) == 0 )
@@ -421,7 +421,7 @@
    off-line (because (s)he can still be online from a different location.
    XXX: See above, we should accept bare JIDs too... */
-int jabber_buddy_remove( struct gaim_connection *gc, char *full_jid_ )
-{
-	struct jabber_data *jd = gc->proto_data;
+int jabber_buddy_remove( struct im_connection *ic, char *full_jid_ )
+{
+	struct jabber_data *jd = ic->proto_data;
 	struct jabber_buddy *bud, *prev, *bi;
 	char *s, *full_jid;
@@ -495,7 +495,7 @@
    specified bare JID. Use this when removing someone from the contact
    list, for example. */
-int jabber_buddy_remove_bare( struct gaim_connection *gc, char *bare_jid_ )
-{
-	struct jabber_data *jd = gc->proto_data;
+int jabber_buddy_remove_bare( struct im_connection *ic, char *bare_jid_ )
+{
+	struct jabber_data *jd = ic->proto_data;
 	struct jabber_buddy *bud, *next;
 	char *bare_jid;
Index: protocols/jabber/message.c
===================================================================
--- protocols/jabber/message.c	(revision fa29d09342c79b886efacee4cfc3078be5f5a722)
+++ protocols/jabber/message.c	(revision 0da65d5fb37691ed4d31f7ab4058732f1440db6b)
@@ -26,5 +26,5 @@
 xt_status jabber_pkt_message( struct xt_node *node, gpointer data )
 {
-	struct gaim_connection *gc = data;
+	struct im_connection *ic = data;
 	char *from = xt_find_attr( node, "from" );
 	char *type = xt_find_attr( node, "type" );
@@ -47,5 +47,5 @@
 		if( ( s = strchr( from, '/' ) ) )
 		{
-			if( ( bud = jabber_buddy_by_jid( gc, from, GET_BUDDY_EXACT ) ) )
+			if( ( bud = jabber_buddy_by_jid( ic, from, GET_BUDDY_EXACT ) ) )
 				bud->last_act = time( NULL );
 			else
@@ -76,5 +76,5 @@
 		
 		if( fullmsg->len > 0 )
-			serv_got_im( gc, bud ? bud->bare_jid : from, fullmsg->str, 0, 0, fullmsg->len );
+			serv_got_im( ic, bud ? bud->bare_jid : from, fullmsg->str, 0, 0, fullmsg->len );
 		
 		g_string_free( fullmsg, TRUE );
@@ -84,5 +84,5 @@
 		{
 			bud->flags |= JBFLAG_DOES_XEP85;
-			serv_got_typing( gc, bud ? bud->bare_jid : from, 0, 1 );
+			serv_got_typing( ic, bud ? bud->bare_jid : from, 0, 1 );
 		}
 		/* No need to send a "stopped typing" signal when there's a message. */
@@ -90,10 +90,10 @@
 		{
 			bud->flags |= JBFLAG_DOES_XEP85;
-			serv_got_typing( gc, bud ? bud->bare_jid : from, 0, 0 );
+			serv_got_typing( ic, bud ? bud->bare_jid : from, 0, 0 );
 		}
 		else if( xt_find_node( node->children, "paused" ) )
 		{
 			bud->flags |= JBFLAG_DOES_XEP85;
-			serv_got_typing( gc, bud ? bud->bare_jid : from, 0, 2 );
+			serv_got_typing( ic, bud ? bud->bare_jid : from, 0, 2 );
 		}
 		
Index: protocols/jabber/presence.c
===================================================================
--- protocols/jabber/presence.c	(revision fa29d09342c79b886efacee4cfc3078be5f5a722)
+++ protocols/jabber/presence.c	(revision 0da65d5fb37691ed4d31f7ab4058732f1440db6b)
@@ -26,5 +26,5 @@
 xt_status jabber_pkt_presence( struct xt_node *node, gpointer data )
 {
-	struct gaim_connection *gc = data;
+	struct im_connection *ic = data;
 	char *from = xt_find_attr( node, "from" );
 	char *type = xt_find_attr( node, "type" );	/* NULL should mean the person is online. */
@@ -38,8 +38,8 @@
 	if( type == NULL )
 	{
-		if( !( bud = jabber_buddy_by_jid( gc, from, GET_BUDDY_EXACT | GET_BUDDY_CREAT ) ) )
+		if( !( bud = jabber_buddy_by_jid( ic, from, GET_BUDDY_EXACT | GET_BUDDY_CREAT ) ) )
 		{
-			if( set_getbool( &gc->irc->set, "debug" ) )
-				serv_got_crap( gc, "WARNING: Could not handle presence information from JID: %s", from );
+			if( set_getbool( &ic->irc->set, "debug" ) )
+				serv_got_crap( ic, "WARNING: Could not handle presence information from JID: %s", from );
 			return XT_HANDLED;
 		}
@@ -66,17 +66,17 @@
 			bud->priority = 0;
 		
-		serv_got_update( gc, bud->bare_jid, 1, 0, 0, 0,
+		serv_got_update( ic, bud->bare_jid, 1, 0, 0, 0,
 		                 bud->away_state ? UC_UNAVAILABLE : 0, 0 );
 	}
 	else if( strcmp( type, "unavailable" ) == 0 )
 	{
-		if( jabber_buddy_by_jid( gc, from, GET_BUDDY_EXACT ) == NULL )
+		if( jabber_buddy_by_jid( ic, from, GET_BUDDY_EXACT ) == NULL )
 		{
-			if( set_getbool( &gc->irc->set, "debug" ) )
-				serv_got_crap( gc, "WARNING: Received presence information from unknown JID: %s", from );
+			if( set_getbool( &ic->irc->set, "debug" ) )
+				serv_got_crap( ic, "WARNING: Received presence information from unknown JID: %s", from );
 			return XT_HANDLED;
 		}
 		
-		jabber_buddy_remove( gc, from );
+		jabber_buddy_remove( ic, from );
 		
 		if( ( s = strchr( from, '/' ) ) )
@@ -86,6 +86,6 @@
 			/* Only count this as offline if there's no other resource
 			   available anymore. */
-			if( jabber_buddy_by_jid( gc, from, 0 ) == NULL )
-				serv_got_update( gc, from, 0, 0, 0, 0, 0, 0 );
+			if( jabber_buddy_by_jid( ic, from, 0 ) == NULL )
+				serv_got_update( ic, from, 0, 0, 0, 0, 0, 0 );
 			
 			*s = '/';
@@ -93,15 +93,15 @@
 		else
 		{
-			serv_got_update( gc, from, 0, 0, 0, 0, 0, 0 );
+			serv_got_update( ic, from, 0, 0, 0, 0, 0, 0 );
 		}
 	}
 	else if( strcmp( type, "subscribe" ) == 0 )
 	{
-		jabber_buddy_ask( gc, from );
+		jabber_buddy_ask( ic, from );
 	}
 	else if( strcmp( type, "subscribed" ) == 0 )
 	{
 		/* Not sure about this one, actually... */
-		serv_got_crap( gc, "%s just accepted your authorization request", from );
+		serv_got_crap( ic, "%s just accepted your authorization request", from );
 	}
 	else if( strcmp( type, "unsubscribe" ) == 0 || strcmp( type, "unsubscribed" ) == 0 )
@@ -131,7 +131,7 @@
 /* Whenever presence information is updated, call this function to inform the
    server. */
-int presence_send_update( struct gaim_connection *gc )
+int presence_send_update( struct im_connection *ic )
 {
-	struct jabber_data *jd = gc->proto_data;
+	struct jabber_data *jd = ic->proto_data;
 	struct xt_node *node;
 	char *show = jd->away_state->code;
@@ -140,5 +140,5 @@
 	
 	node = jabber_make_packet( "presence", NULL, NULL, NULL );
-	xt_add_child( node, xt_new_node( "priority", set_getstr( &gc->acc->set, "priority" ), NULL ) );
+	xt_add_child( node, xt_new_node( "priority", set_getstr( &ic->acc->set, "priority" ), NULL ) );
 	if( show && *show )
 		xt_add_child( node, xt_new_node( "show", show, NULL ) );
@@ -146,5 +146,5 @@
 		xt_add_child( node, xt_new_node( "status", status, NULL ) );
 	
-	st = jabber_write_packet( gc, node );
+	st = jabber_write_packet( ic, node );
 	
 	xt_free_node( node );
@@ -153,5 +153,5 @@
 
 /* Send a subscribe/unsubscribe request to a buddy. */
-int presence_send_request( struct gaim_connection *gc, char *handle, char *request )
+int presence_send_request( struct im_connection *ic, char *handle, char *request )
 {
 	struct xt_node *node;
@@ -162,5 +162,5 @@
 	xt_add_attr( node, "type", request );
 	
-	st = jabber_write_packet( gc, node );
+	st = jabber_write_packet( ic, node );
 	
 	xt_free_node( node );
Index: protocols/jabber/sasl.c
===================================================================
--- protocols/jabber/sasl.c	(revision fa29d09342c79b886efacee4cfc3078be5f5a722)
+++ protocols/jabber/sasl.c	(revision 0da65d5fb37691ed4d31f7ab4058732f1440db6b)
@@ -27,16 +27,16 @@
 xt_status sasl_pkt_mechanisms( struct xt_node *node, gpointer data )
 {
-	struct gaim_connection *gc = data;
-	struct jabber_data *jd = gc->proto_data;
+	struct im_connection *ic = data;
+	struct jabber_data *jd = ic->proto_data;
 	struct xt_node *c, *reply;
 	char *s;
 	int sup_plain = 0, sup_digest = 0;
 	
-	if( !sasl_supported( gc ) )
+	if( !sasl_supported( ic ) )
 	{
 		/* Should abort this now, since we should already be doing
 		   IQ authentication. Strange things happen when you try
 		   to do both... */
-		serv_got_crap( gc, "XMPP 1.0 non-compliant server seems to support SASL, please report this as a BitlBee bug!" );
+		serv_got_crap( ic, "XMPP 1.0 non-compliant server seems to support SASL, please report this as a BitlBee bug!" );
 		return XT_HANDLED;
 	}
@@ -45,5 +45,5 @@
 	if( !s || strcmp( s, XMLNS_SASL ) != 0 )
 	{
-		signoff( gc );
+		signoff( ic );
 		return XT_ABORT;
 	}
@@ -62,6 +62,6 @@
 	if( !sup_plain && !sup_digest )
 	{
-		hide_login_progress( gc, "No known SASL authentication schemes supported" );
-		signoff( gc );
+		hide_login_progress( ic, "No known SASL authentication schemes supported" );
+		signoff( ic );
 		return XT_ABORT;
 	}
@@ -83,9 +83,9 @@
 		
 		/* With SASL PLAIN in XMPP, the text should be b64(\0user\0pass) */
-		len = strlen( jd->username ) + strlen( gc->acc->pass ) + 2;
+		len = strlen( jd->username ) + strlen( ic->acc->pass ) + 2;
 		s = g_malloc( len + 1 );
 		s[0] = 0;
 		strcpy( s + 1, jd->username );
-		strcpy( s + 2 + strlen( jd->username ), gc->acc->pass );
+		strcpy( s + 2 + strlen( jd->username ), ic->acc->pass );
 		reply->text = base64_encode( s, len );
 		reply->text_len = strlen( reply->text );
@@ -93,5 +93,5 @@
 	}
 	
-	if( !jabber_write_packet( gc, reply ) )
+	if( !jabber_write_packet( ic, reply ) )
 	{
 		xt_free_node( reply );
@@ -181,6 +181,6 @@
 xt_status sasl_pkt_challenge( struct xt_node *node, gpointer data )
 {
-	struct gaim_connection *gc = data;
-	struct jabber_data *jd = gc->proto_data;
+	struct im_connection *ic = data;
+	struct jabber_data *jd = ic->proto_data;
 	struct xt_node *reply = NULL;
 	char *nonce = NULL, *realm = NULL, *cnonce = NULL, cnonce_bin[30];
@@ -222,5 +222,5 @@
 		   I decided to call it H. */
 		md5_init( &H );
-		s = g_strdup_printf( "%s:%s:%s", jd->username, realm, gc->acc->pass );
+		s = g_strdup_printf( "%s:%s:%s", jd->username, realm, ic->acc->pass );
 		md5_append( &H, (unsigned char *) s, strlen( s ) );
 		g_free( s );
@@ -272,5 +272,5 @@
 	xt_add_attr( reply, "xmlns", XMLNS_SASL );
 	
-	if( !jabber_write_packet( gc, reply ) )
+	if( !jabber_write_packet( ic, reply ) )
 		goto silent_error;
 	
@@ -279,6 +279,6 @@
 
 error:
-	hide_login_progress( gc, "Incorrect SASL challenge received" );
-	signoff( gc );
+	hide_login_progress( ic, "Incorrect SASL challenge received" );
+	signoff( ic );
 
 silent_error:
@@ -296,6 +296,6 @@
 xt_status sasl_pkt_result( struct xt_node *node, gpointer data )
 {
-	struct gaim_connection *gc = data;
-	struct jabber_data *jd = gc->proto_data;
+	struct im_connection *ic = data;
+	struct jabber_data *jd = ic->proto_data;
 	char *s;
 	
@@ -303,5 +303,5 @@
 	if( !s || strcmp( s, XMLNS_SASL ) != 0 )
 	{
-		signoff( gc );
+		signoff( ic );
 		return XT_ABORT;
 	}
@@ -309,11 +309,11 @@
 	if( strcmp( node->name, "success" ) == 0 )
 	{
-		set_login_progress( gc, 1, "Authentication finished" );
+		set_login_progress( ic, 1, "Authentication finished" );
 		jd->flags |= JFLAG_AUTHENTICATED | JFLAG_STREAM_RESTART;
 	}
 	else if( strcmp( node->name, "failure" ) == 0 )
 	{
-		hide_login_progress( gc, "Authentication failure" );
-		signoff( gc );
+		hide_login_progress( ic, "Authentication failure" );
+		signoff( ic );
 		return XT_ABORT;
 	}
@@ -325,7 +325,7 @@
    It's done by checking if the <stream:stream> from the server has a
    version attribute. I don't know if this is the right way though... */
-gboolean sasl_supported( struct gaim_connection *gc )
-{
-	struct jabber_data *jd = gc->proto_data;
+gboolean sasl_supported( struct im_connection *ic )
+{
+	struct jabber_data *jd = ic->proto_data;
 	
 	return ( (void*) ( jd->xt && jd->xt->root && xt_find_attr( jd->xt->root, "version" ) ) ) != NULL;
Index: protocols/msn/msn.c
===================================================================
--- protocols/msn/msn.c	(revision fa29d09342c79b886efacee4cfc3078be5f5a722)
+++ protocols/msn/msn.c	(revision 0da65d5fb37691ed4d31f7ab4058732f1440db6b)
@@ -29,5 +29,5 @@
 static char *msn_set_display_name( set_t *set, char *value );
 
-static void msn_acc_init( account_t *acc )
+static void msn_init( account_t *acc )
 {
 	set_t *s;
@@ -39,36 +39,36 @@
 static void msn_login( account_t *acc )
 {
-	struct gaim_connection *gc = new_gaim_conn( acc );
+	struct im_connection *ic = new_gaim_conn( acc );
 	struct msn_data *md = g_new0( struct msn_data, 1 );
 	
-	gc->proto_data = md;
+	ic->proto_data = md;
 	md->fd = -1;
 	
 	if( strchr( acc->user, '@' ) == NULL )
 	{
-		hide_login_progress( gc, "Invalid account name" );
-		signoff( gc );
+		hide_login_progress( ic, "Invalid account name" );
+		signoff( ic );
 		return;
 	}
 	
-	set_login_progress( gc, 1, "Connecting" );
-	
-	md->fd = proxy_connect( "messenger.hotmail.com", 1863, msn_ns_connected, gc );
+	set_login_progress( ic, 1, "Connecting" );
+	
+	md->fd = proxy_connect( "messenger.hotmail.com", 1863, msn_ns_connected, ic );
 	if( md->fd < 0 )
 	{
-		hide_login_progress( gc, "Could not connect to server" );
-		signoff( gc );
+		hide_login_progress( ic, "Could not connect to server" );
+		signoff( ic );
 		return;
 	}
 	
-	md->gc = gc;
+	md->ic = ic;
 	md->away_state = msn_away_state_list;
 	
-	msn_connections = g_slist_append( msn_connections, gc );
-}
-
-static void msn_close( struct gaim_connection *gc )
-{
-	struct msn_data *md = gc->proto_data;
+	msn_connections = g_slist_append( msn_connections, ic );
+}
+
+static void msn_logout( struct im_connection *ic )
+{
+	struct msn_data *md = ic->proto_data;
 	GSList *l;
 	
@@ -96,5 +96,5 @@
 				m = l->data;
 			
-				serv_got_crap( gc, "Warning: Closing down MSN connection with unsent message to %s, you'll have to resend it.", m->who );
+				serv_got_crap( ic, "Warning: Closing down MSN connection with unsent message to %s, you'll have to resend it.", m->who );
 				g_free( m->who );
 				g_free( m->text );
@@ -111,21 +111,21 @@
 	}
 	
-	for( l = gc->permit; l; l = l->next )
+	for( l = ic->permit; l; l = l->next )
 		g_free( l->data );
-	g_slist_free( gc->permit );
-	
-	for( l = gc->deny; l; l = l->next )
+	g_slist_free( ic->permit );
+	
+	for( l = ic->deny; l; l = l->next )
 		g_free( l->data );
-	g_slist_free( gc->deny );
-	
-	msn_connections = g_slist_remove( msn_connections, gc );
-}
-
-static int msn_send_im( struct gaim_connection *gc, char *who, char *message, int len, int away )
+	g_slist_free( ic->deny );
+	
+	msn_connections = g_slist_remove( msn_connections, ic );
+}
+
+static int msn_send_im( struct im_connection *ic, char *who, char *message, int away )
 {
 	struct msn_switchboard *sb;
-	struct msn_data *md = gc->proto_data;
-	
-	if( ( sb = msn_sb_by_handle( gc, who ) ) )
+	struct msn_data *md = ic->proto_data;
+	
+	if( ( sb = msn_sb_by_handle( ic, who ) ) )
 	{
 		return( msn_sb_sendmessage( sb, message ) );
@@ -142,5 +142,5 @@
 		
 		/* FIXME: *CHECK* the reliability of using spare sb's! */
-		if( ( sb = msn_sb_spare( gc ) ) )
+		if( ( sb = msn_sb_spare( ic ) ) )
 		{
 			debug( "Trying to use a spare switchboard to message %s", who );
@@ -160,5 +160,5 @@
 		/* If we reach this line, there was no spare switchboard, so let's make one. */
 		g_snprintf( buf, sizeof( buf ), "XFR %d SB\r\n", ++md->trId );
-		if( !msn_write( gc, buf, strlen( buf ) ) )
+		if( !msn_write( ic, buf, strlen( buf ) ) )
 		{
 			g_free( m->who );
@@ -180,5 +180,5 @@
 }
 
-static GList *msn_away_states( struct gaim_connection *gc )
+static GList *msn_away_states( struct im_connection *ic )
 {
 	static GList *l = NULL;
@@ -192,5 +192,5 @@
 }
 
-static char *msn_get_status_string( struct gaim_connection *gc, int number )
+static char *msn_get_status_string( struct im_connection *ic, int number )
 {
 	const struct msn_away_state *st = msn_away_state_by_number( number );
@@ -202,8 +202,8 @@
 }
 
-static void msn_set_away( struct gaim_connection *gc, char *state, char *message )
+static void msn_set_away( struct im_connection *ic, char *state, char *message )
 {
 	char buf[1024];
-	struct msn_data *md = gc->proto_data;
+	struct msn_data *md = ic->proto_data;
 	const struct msn_away_state *st;
 	
@@ -217,39 +217,39 @@
 	
 	g_snprintf( buf, sizeof( buf ), "CHG %d %s\r\n", ++md->trId, st->code );
-	msn_write( gc, buf, strlen( buf ) );
-}
-
-static void msn_set_info( struct gaim_connection *gc, char *info )
-{
-	msn_set_display_name( set_find( &gc->acc->set, "display_name" ), info );
-}
-
-static void msn_get_info(struct gaim_connection *gc, char *who) 
+	msn_write( ic, buf, strlen( buf ) );
+}
+
+static void msn_set_my_name( struct im_connection *ic, char *info )
+{
+	msn_set_display_name( set_find( &ic->acc->set, "display_name" ), info );
+}
+
+static void msn_get_info(struct im_connection *ic, char *who) 
 {
 	/* Just make an URL and let the user fetch the info */
-	serv_got_crap( gc, "%s\n%s: %s%s", _("User Info"), _("For now, fetch yourself"), PROFILE_URL, who );
-}
-
-static void msn_add_buddy( struct gaim_connection *gc, char *who )
-{
-	msn_buddy_list_add( gc, "FL", who, who );
-}
-
-static void msn_remove_buddy( struct gaim_connection *gc, char *who, char *group )
-{
-	msn_buddy_list_remove( gc, "FL", who );
-}
-
-static int msn_chat_send( struct conversation *c, char *message )
+	serv_got_crap( ic, "%s\n%s: %s%s", _("User Info"), _("For now, fetch yourself"), PROFILE_URL, who );
+}
+
+static void msn_add_buddy( struct im_connection *ic, char *who, char *group )
+{
+	msn_buddy_list_add( ic, "FL", who, who );
+}
+
+static void msn_remove_buddy( struct im_connection *ic, char *who, char *group )
+{
+	msn_buddy_list_remove( ic, "FL", who );
+}
+
+static void msn_chat_send( struct groupchat *c, char *message, int flags )
 {
 	struct msn_switchboard *sb = msn_sb_by_chat( c );
 	
 	if( sb )
-		return( msn_sb_sendmessage( sb, message ) );
-	else
-		return( 0 );
-}
-
-static void msn_chat_invite( struct conversation *c, char *msg, char *who )
+		msn_sb_sendmessage( sb, message );
+	/* FIXME: Error handling (although this can't happen unless something's
+	   already severely broken) disappeared here! */
+}
+
+static void msn_chat_invite( struct groupchat *c, char *msg, char *who )
 {
 	struct msn_switchboard *sb = msn_sb_by_chat( c );
@@ -263,5 +263,5 @@
 }
 
-static void msn_chat_leave( struct conversation *c )
+static void msn_chat_leave( struct groupchat *c )
 {
 	struct msn_switchboard *sb = msn_sb_by_chat( c );
@@ -271,11 +271,11 @@
 }
 
-static struct conversation *msn_chat_open( struct gaim_connection *gc, char *who )
+static struct groupchat *msn_chat_with( struct im_connection *ic, char *who )
 {
 	struct msn_switchboard *sb;
-	struct msn_data *md = gc->proto_data;
+	struct msn_data *md = ic->proto_data;
 	char buf[1024];
 	
-	if( ( sb = msn_sb_by_handle( gc, who ) ) )
+	if( ( sb = msn_sb_by_handle( ic, who ) ) )
 	{
 		debug( "Converting existing switchboard to %s to a groupchat", who );
@@ -286,5 +286,5 @@
 		struct msn_message *m;
 		
-		if( ( sb = msn_sb_spare( gc ) ) )
+		if( ( sb = msn_sb_spare( ic ) ) )
 		{
 			debug( "Trying to reuse an existing switchboard as a groupchat with %s", who );
@@ -299,5 +299,5 @@
 		/* Request a new switchboard. */
 		g_snprintf( buf, sizeof( buf ), "XFR %d SB\r\n", ++md->trId );
-		if( !msn_write( gc, buf, strlen( buf ) ) )
+		if( !msn_write( ic, buf, strlen( buf ) ) )
 			return( 0 );
 		
@@ -317,27 +317,27 @@
 }
 
-static void msn_keepalive( struct gaim_connection *gc )
-{
-	msn_write( gc, "PNG\r\n", strlen( "PNG\r\n" ) );
-}
-
-static void msn_add_permit( struct gaim_connection *gc, char *who )
-{
-	msn_buddy_list_add( gc, "AL", who, who );
-}
-
-static void msn_rem_permit( struct gaim_connection *gc, char *who )
-{
-	msn_buddy_list_remove( gc, "AL", who );
-}
-
-static void msn_add_deny( struct gaim_connection *gc, char *who )
+static void msn_keepalive( struct im_connection *ic )
+{
+	msn_write( ic, "PNG\r\n", strlen( "PNG\r\n" ) );
+}
+
+static void msn_add_permit( struct im_connection *ic, char *who )
+{
+	msn_buddy_list_add( ic, "AL", who, who );
+}
+
+static void msn_rem_permit( struct im_connection *ic, char *who )
+{
+	msn_buddy_list_remove( ic, "AL", who );
+}
+
+static void msn_add_deny( struct im_connection *ic, char *who )
 {
 	struct msn_switchboard *sb;
 	
-	msn_buddy_list_add( gc, "BL", who, who );
+	msn_buddy_list_add( ic, "BL", who, who );
 	
 	/* If there's still a conversation with this person, close it. */
-	if( ( sb = msn_sb_by_handle( gc, who ) ) )
+	if( ( sb = msn_sb_by_handle( ic, who ) ) )
 	{
 		msn_sb_destroy( sb );
@@ -345,13 +345,13 @@
 }
 
-static void msn_rem_deny( struct gaim_connection *gc, char *who )
-{
-	msn_buddy_list_remove( gc, "BL", who );
-}
-
-static int msn_send_typing( struct gaim_connection *gc, char *who, int typing )
+static void msn_rem_deny( struct im_connection *ic, char *who )
+{
+	msn_buddy_list_remove( ic, "BL", who );
+}
+
+static int msn_send_typing( struct im_connection *ic, char *who, int typing )
 {
 	if( typing )
-		return( msn_send_im( gc, who, TYPING_NOTIFICATION_MESSAGE, strlen( TYPING_NOTIFICATION_MESSAGE ), 0 ) );
+		return( msn_send_im( ic, who, TYPING_NOTIFICATION_MESSAGE, 0 ) );
 	else
 		return( 1 );
@@ -361,17 +361,17 @@
 {
 	account_t *acc = set->data;
-	struct gaim_connection *gc = acc->gc;
+	struct im_connection *ic = acc->ic;
 	struct msn_data *md;
 	char buf[1024], *fn;
 	
 	/* Double-check. */
-	if( gc == NULL )
+	if( ic == NULL )
 		return NULL;
 	
-	md = gc->proto_data;
+	md = ic->proto_data;
 	
 	if( strlen( value ) > 129 )
 	{
-		serv_got_crap( gc, "Maximum name length exceeded" );
+		serv_got_crap( ic, "Maximum name length exceeded" );
 		return NULL;
 	}
@@ -379,6 +379,6 @@
 	fn = msn_http_encode( value );
 	
-	g_snprintf( buf, sizeof( buf ), "REA %d %s %s\r\n", ++md->trId, gc->username, fn );
-	msn_write( gc, buf, strlen( buf ) );
+	g_snprintf( buf, sizeof( buf ), "REA %d %s %s\r\n", ++md->trId, ic->username, fn );
+	msn_write( ic, buf, strlen( buf ) );
 	g_free( fn );
 	
@@ -389,5 +389,5 @@
 }
 
-void msn_init()
+void msn_initmodule()
 {
 	struct prpl *ret = g_new0(struct prpl, 1);
@@ -395,12 +395,12 @@
 	ret->name = "msn";
 	ret->login = msn_login;
-	ret->acc_init = msn_acc_init;
-	ret->close = msn_close;
+	ret->init = msn_init;
+	ret->logout = msn_logout;
 	ret->send_im = msn_send_im;
 	ret->away_states = msn_away_states;
 	ret->get_status_string = msn_get_status_string;
 	ret->set_away = msn_set_away;
-	ret->set_info = msn_set_info;
 	ret->get_info = msn_get_info;
+	ret->set_my_name = msn_set_my_name;
 	ret->add_buddy = msn_add_buddy;
 	ret->remove_buddy = msn_remove_buddy;
@@ -408,5 +408,5 @@
 	ret->chat_invite = msn_chat_invite;
 	ret->chat_leave = msn_chat_leave;
-	ret->chat_open = msn_chat_open;
+	ret->chat_with = msn_chat_with;
 	ret->keepalive = msn_keepalive;
 	ret->add_permit = msn_add_permit;
Index: protocols/msn/msn.h
===================================================================
--- protocols/msn/msn.h	(revision fa29d09342c79b886efacee4cfc3078be5f5a722)
+++ protocols/msn/msn.h	(revision 0da65d5fb37691ed4d31f7ab4058732f1440db6b)
@@ -57,5 +57,5 @@
 struct msn_data
 {
-	struct gaim_connection *gc;
+	struct im_connection *ic;
 	
 	int fd;
@@ -75,5 +75,5 @@
 struct msn_switchboard
 {
-	struct gaim_connection *gc;
+	struct im_connection *ic;
 	
 	int fd;
@@ -89,5 +89,5 @@
 	GSList *msgq;
 	char *who;
-	struct conversation *chat;
+	struct groupchat *chat;
 };
 
@@ -149,9 +149,9 @@
 
 /* msn_util.c */
-int msn_write( struct gaim_connection *gc, char *s, int len );
-int msn_logged_in( struct gaim_connection *gc );
-int msn_buddy_list_add( struct gaim_connection *gc, char *list, char *who, char *realname );
-int msn_buddy_list_remove( struct gaim_connection *gc, char *list, char *who );
-void msn_buddy_ask( struct gaim_connection *gc, char *handle, char *realname );
+int msn_write( struct im_connection *ic, char *s, int len );
+int msn_logged_in( struct im_connection *ic );
+int msn_buddy_list_add( struct im_connection *ic, char *list, char *who, char *realname );
+int msn_buddy_list_remove( struct im_connection *ic, char *list, char *who );
+void msn_buddy_ask( struct im_connection *ic, char *handle, char *realname );
 char *msn_findheader( char *text, char *header, int len );
 char **msn_linesplit( char *line );
@@ -167,10 +167,10 @@
 /* sb.c */
 int msn_sb_write( struct msn_switchboard *sb, char *s, int len );
-struct msn_switchboard *msn_sb_create( struct gaim_connection *gc, char *host, int port, char *key, int session );
-struct msn_switchboard *msn_sb_by_handle( struct gaim_connection *gc, char *handle );
-struct msn_switchboard *msn_sb_by_chat( struct conversation *c );
-struct msn_switchboard *msn_sb_spare( struct gaim_connection *gc );
+struct msn_switchboard *msn_sb_create( struct im_connection *ic, char *host, int port, char *key, int session );
+struct msn_switchboard *msn_sb_by_handle( struct im_connection *ic, char *handle );
+struct msn_switchboard *msn_sb_by_chat( struct groupchat *c );
+struct msn_switchboard *msn_sb_spare( struct im_connection *ic );
 int msn_sb_sendmessage( struct msn_switchboard *sb, char *text );
-struct conversation *msn_sb_to_chat( struct msn_switchboard *sb );
+struct groupchat *msn_sb_to_chat( struct msn_switchboard *sb );
 void msn_sb_destroy( struct msn_switchboard *sb );
 gboolean msn_sb_connected( gpointer data, gint source, b_input_condition cond );
Index: protocols/msn/msn_util.c
===================================================================
--- protocols/msn/msn_util.c	(revision fa29d09342c79b886efacee4cfc3078be5f5a722)
+++ protocols/msn/msn_util.c	(revision 0da65d5fb37691ed4d31f7ab4058732f1440db6b)
@@ -28,7 +28,7 @@
 #include <ctype.h>
 
-int msn_write( struct gaim_connection *gc, char *s, int len )
-{
-	struct msn_data *md = gc->proto_data;
+int msn_write( struct im_connection *ic, char *s, int len )
+{
+	struct msn_data *md = ic->proto_data;
 	int st;
 	
@@ -36,6 +36,6 @@
 	if( st != len )
 	{
-		hide_login_progress_error( gc, "Short write() to main server" );
-		signoff( gc );
+		hide_login_progress_error( ic, "Short write() to main server" );
+		signoff( ic );
 		return( 0 );
 	}
@@ -44,14 +44,14 @@
 }
 
-int msn_logged_in( struct gaim_connection *gc )
-{
-	account_online( gc );
+int msn_logged_in( struct im_connection *ic )
+{
+	account_online( ic );
 	
 	return( 0 );
 }
 
-int msn_buddy_list_add( struct gaim_connection *gc, char *list, char *who, char *realname_ )
-{
-	struct msn_data *md = gc->proto_data;
+int msn_buddy_list_add( struct im_connection *ic, char *list, char *who, char *realname_ )
+{
+	struct msn_data *md = ic->proto_data;
 	char buf[1024], *realname;
 	
@@ -59,5 +59,5 @@
 	
 	g_snprintf( buf, sizeof( buf ), "ADD %d %s %s %s\r\n", ++md->trId, list, who, realname );
-	if( msn_write( gc, buf, strlen( buf ) ) )
+	if( msn_write( ic, buf, strlen( buf ) ) )
 	{
 		g_free( realname );
@@ -71,11 +71,11 @@
 }
 
-int msn_buddy_list_remove( struct gaim_connection *gc, char *list, char *who )
-{
-	struct msn_data *md = gc->proto_data;
+int msn_buddy_list_remove( struct im_connection *ic, char *list, char *who )
+{
+	struct msn_data *md = ic->proto_data;
 	char buf[1024];
 	
 	g_snprintf( buf, sizeof( buf ), "REM %d %s %s\r\n", ++md->trId, list, who );
-	if( msn_write( gc, buf, strlen( buf ) ) )
+	if( msn_write( ic, buf, strlen( buf ) ) )
 		return( 1 );
 	
@@ -85,5 +85,5 @@
 struct msn_buddy_ask_data
 {
-	struct gaim_connection *gc;
+	struct im_connection *ic;
 	char *handle;
 	char *realname;
@@ -92,8 +92,8 @@
 static void msn_buddy_ask_yes( gpointer w, struct msn_buddy_ask_data *bla )
 {
-	msn_buddy_list_add( bla->gc, "AL", bla->handle, bla->realname );
-	
-	if( find_buddy( bla->gc, bla->handle ) == NULL )
-		show_got_added( bla->gc, bla->handle, NULL );
+	msn_buddy_list_add( bla->ic, "AL", bla->handle, bla->realname );
+	
+	if( find_buddy( bla->ic, bla->handle ) == NULL )
+		show_got_added( bla->ic, bla->handle, NULL );
 	
 	g_free( bla->handle );
@@ -104,5 +104,5 @@
 static void msn_buddy_ask_no( gpointer w, struct msn_buddy_ask_data *bla )
 {
-	msn_buddy_list_add( bla->gc, "BL", bla->handle, bla->realname );
+	msn_buddy_list_add( bla->ic, "BL", bla->handle, bla->realname );
 	
 	g_free( bla->handle );
@@ -111,10 +111,10 @@
 }
 
-void msn_buddy_ask( struct gaim_connection *gc, char *handle, char *realname )
+void msn_buddy_ask( struct im_connection *ic, char *handle, char *realname )
 {
 	struct msn_buddy_ask_data *bla = g_new0( struct msn_buddy_ask_data, 1 );
 	char buf[1024];
 	
-	bla->gc = gc;
+	bla->ic = ic;
 	bla->handle = g_strdup( handle );
 	bla->realname = g_strdup( realname );
@@ -123,5 +123,5 @@
 	            "The user %s (%s) wants to add you to his/her buddy list.",
 	            handle, realname );
-	do_ask_dialog( gc, buf, bla, msn_buddy_ask_yes, msn_buddy_ask_no );
+	do_ask_dialog( ic, buf, bla, msn_buddy_ask_yes, msn_buddy_ask_no );
 }
 
Index: protocols/msn/ns.c
===================================================================
--- protocols/msn/ns.c	(revision fa29d09342c79b886efacee4cfc3078be5f5a722)
+++ protocols/msn/ns.c	(revision 0da65d5fb37691ed4d31f7ab4058732f1440db6b)
@@ -38,24 +38,24 @@
 gboolean msn_ns_connected( gpointer data, gint source, b_input_condition cond )
 {
-	struct gaim_connection *gc = data;
+	struct im_connection *ic = data;
 	struct msn_data *md;
 	char s[1024];
 	
-	if( !g_slist_find( msn_connections, gc ) )
+	if( !g_slist_find( msn_connections, ic ) )
 		return FALSE;
 	
 	if( source == -1 )
 	{
-		hide_login_progress( gc, "Could not connect to server" );
-		signoff( gc );
+		hide_login_progress( ic, "Could not connect to server" );
+		signoff( ic );
 		return FALSE;
 	}
 	
-	md = gc->proto_data;
+	md = ic->proto_data;
 	
 	if( !md->handler )
 	{
 		md->handler = g_new0( struct msn_handler_data, 1 );
-		md->handler->data = gc;
+		md->handler->data = ic;
 		md->handler->exec_command = msn_ns_command;
 		md->handler->exec_message = msn_ns_message;
@@ -73,8 +73,8 @@
 	
 	g_snprintf( s, sizeof( s ), "VER %d MSNP8 CVR0\r\n", ++md->trId );
-	if( msn_write( gc, s, strlen( s ) ) )
-	{
-		gc->inpa = b_input_add( md->fd, GAIM_INPUT_READ, msn_ns_callback, gc );
-		set_login_progress( gc, 1, "Connected to server, waiting for reply" );
+	if( msn_write( ic, s, strlen( s ) ) )
+	{
+		ic->inpa = b_input_add( md->fd, GAIM_INPUT_READ, msn_ns_callback, ic );
+		set_login_progress( ic, 1, "Connected to server, waiting for reply" );
 	}
 	
@@ -84,11 +84,11 @@
 static gboolean msn_ns_callback( gpointer data, gint source, b_input_condition cond )
 {
-	struct gaim_connection *gc = data;
-	struct msn_data *md = gc->proto_data;
+	struct im_connection *ic = data;
+	struct msn_data *md = ic->proto_data;
 	
 	if( msn_handler( md->handler ) == -1 ) /* Don't do this on ret == 0, it's already done then. */
 	{
-		hide_login_progress( gc, "Error while reading from server" );
-		signoff( gc );
+		hide_login_progress( ic, "Error while reading from server" );
+		signoff( ic );
 		
 		return FALSE;
@@ -100,6 +100,6 @@
 static int msn_ns_command( gpointer data, char **cmd, int num_parts )
 {
-	struct gaim_connection *gc = data;
-	struct msn_data *md = gc->proto_data;
+	struct im_connection *ic = data;
+	struct msn_data *md = ic->proto_data;
 	char buf[1024];
 	
@@ -114,18 +114,18 @@
 		if( cmd[2] && strncmp( cmd[2], "MSNP8", 5 ) != 0 )
 		{
-			hide_login_progress( gc, "Unsupported protocol" );
-			signoff( gc );
+			hide_login_progress( ic, "Unsupported protocol" );
+			signoff( ic );
 			return( 0 );
 		}
 		
 		g_snprintf( buf, sizeof( buf ), "CVR %d 0x0409 mac 10.2.0 ppc macmsgs 3.5.1 macmsgs %s\r\n",
-		                                ++md->trId, gc->username );
-		return( msn_write( gc, buf, strlen( buf ) ) );
+		                                ++md->trId, ic->username );
+		return( msn_write( ic, buf, strlen( buf ) ) );
 	}
 	else if( strcmp( cmd[0], "CVR" ) == 0 )
 	{
 		/* We don't give a damn about the information we just received */
-		g_snprintf( buf, sizeof( buf ), "USR %d TWN I %s\r\n", ++md->trId, gc->username );
-		return( msn_write( gc, buf, strlen( buf ) ) );
+		g_snprintf( buf, sizeof( buf ), "USR %d TWN I %s\r\n", ++md->trId, ic->username );
+		return( msn_write( ic, buf, strlen( buf ) ) );
 	}
 	else if( strcmp( cmd[0], "XFR" ) == 0 )
@@ -136,6 +136,6 @@
 		if( num_parts == 6 && strcmp( cmd[2], "NS" ) == 0 )
 		{
-			b_event_remove( gc->inpa );
-			gc->inpa = 0;
+			b_event_remove( ic->inpa );
+			ic->inpa = 0;
 			closesocket( md->fd );
 			
@@ -143,6 +143,6 @@
 			if( !server )
 			{
-				hide_login_progress_error( gc, "Syntax error" );
-				signoff( gc );
+				hide_login_progress_error( ic, "Syntax error" );
+				signoff( ic );
 				return( 0 );
 			}
@@ -151,7 +151,7 @@
 			server = cmd[3];
 			
-			set_login_progress( gc, 1, "Transferring to other server" );
-			
-			md->fd = proxy_connect( server, port, msn_ns_connected, gc );
+			set_login_progress( ic, 1, "Transferring to other server" );
+			
+			md->fd = proxy_connect( server, port, msn_ns_connected, ic );
 		}
 		else if( num_parts == 6 && strcmp( cmd[2], "SB" ) == 0 )
@@ -162,6 +162,6 @@
 			if( !server )
 			{
-				hide_login_progress_error( gc, "Syntax error" );
-				signoff( gc );
+				hide_login_progress_error( ic, "Syntax error" );
+				signoff( ic );
 				return( 0 );
 			}
@@ -172,11 +172,11 @@
 			if( strcmp( cmd[4], "CKI" ) != 0 )
 			{
-				hide_login_progress_error( gc, "Unknown authentication method for switchboard" );
-				signoff( gc );
+				hide_login_progress_error( ic, "Unknown authentication method for switchboard" );
+				signoff( ic );
 				return( 0 );
 			}
 			
 			debug( "Connecting to a new switchboard with key %s", cmd[5] );
-			sb = msn_sb_create( gc, server, port, cmd[5], MSN_SB_NEW );
+			sb = msn_sb_create( ic, server, port, cmd[5], MSN_SB_NEW );
 			
 			if( md->msgq )
@@ -204,6 +204,6 @@
 		else
 		{
-			hide_login_progress_error( gc, "Syntax error" );
-			signoff( gc );
+			hide_login_progress_error( ic, "Syntax error" );
+			signoff( ic );
 			return( 0 );
 		}
@@ -214,8 +214,8 @@
 		{
 			/* Time for some Passport black magic... */
-			if( !passport_get_id( msn_auth_got_passport_id, gc, gc->username, gc->password, cmd[4] ) )
-			{
-				hide_login_progress_error( gc, "Error while contacting Passport server" );
-				signoff( gc );
+			if( !passport_get_id( msn_auth_got_passport_id, ic, ic->username, ic->password, cmd[4] ) )
+			{
+				hide_login_progress_error( ic, "Error while contacting Passport server" );
+				signoff( ic );
 				return( 0 );
 			}
@@ -227,8 +227,8 @@
 			http_decode( cmd[4] );
 			
-			strncpy( gc->displayname, cmd[4], sizeof( gc->displayname ) );
-			gc->displayname[sizeof(gc->displayname)-1] = 0;
-			
-			if( ( s = set_find( &gc->acc->set, "display_name" ) ) )
+			strncpy( ic->displayname, cmd[4], sizeof( ic->displayname ) );
+			ic->displayname[sizeof(ic->displayname)-1] = 0;
+			
+			if( ( s = set_find( &ic->acc->set, "display_name" ) ) )
 			{
 				g_free( s->value );
@@ -236,13 +236,13 @@
 			}
 			
-			set_login_progress( gc, 1, "Authenticated, getting buddy list" );
+			set_login_progress( ic, 1, "Authenticated, getting buddy list" );
 			
 			g_snprintf( buf, sizeof( buf ), "SYN %d 0\r\n", ++md->trId );
-			return( msn_write( gc, buf, strlen( buf ) ) );
+			return( msn_write( ic, buf, strlen( buf ) ) );
 		}
 		else
 		{
-			hide_login_progress( gc, "Unknown authentication type" );
-			signoff( gc );
+			hide_login_progress( ic, "Unknown authentication type" );
+			signoff( ic );
 			return( 0 );
 		}
@@ -252,6 +252,6 @@
 		if( num_parts != 4 )
 		{
-			hide_login_progress_error( gc, "Syntax error" );
-			signoff( gc );
+			hide_login_progress_error( ic, "Syntax error" );
+			signoff( ic );
 			return( 0 );
 		}
@@ -261,6 +261,6 @@
 		if( md->handler->msglen <= 0 )
 		{
-			hide_login_progress_error( gc, "Syntax error" );
-			signoff( gc );
+			hide_login_progress_error( ic, "Syntax error" );
+			signoff( ic );
 			return( 0 );
 		}
@@ -276,5 +276,5 @@
 			
 			if( !*cmd[3] || md->buddycount == 0 )
-				msn_logged_in( gc );
+				msn_logged_in( ic );
 		}
 		else
@@ -283,5 +283,5 @@
 			   Let's assume everything is okay. */
 			
-			msn_logged_in( gc );
+			msn_logged_in( ic );
 		}
 	}
@@ -292,6 +292,6 @@
 		if( num_parts != 4 && num_parts != 5 )
 		{
-			hide_login_progress( gc, "Syntax error" );
-			signoff( gc );
+			hide_login_progress( ic, "Syntax error" );
+			signoff( ic );
 			return( 0 );
 		}
@@ -308,31 +308,31 @@
 				group = md->grouplist[num];
 			
-			add_buddy( gc, group, cmd[1], cmd[2] );
+			add_buddy( ic, group, cmd[1], cmd[2] );
 		}
 		if( list & 2 ) /* AL */
 		{
-			gc->permit = g_slist_append( gc->permit, g_strdup( cmd[1] ) );
+			ic->permit = g_slist_append( ic->permit, g_strdup( cmd[1] ) );
 		}
 		if( list & 4 ) /* BL */
 		{
-			gc->deny = g_slist_append( gc->deny, g_strdup( cmd[1] ) );
+			ic->deny = g_slist_append( ic->deny, g_strdup( cmd[1] ) );
 		}
 		if( list & 8 ) /* RL */
 		{
 			if( ( list & 6 ) == 0 )
-				msn_buddy_ask( gc, cmd[1], cmd[2] );
+				msn_buddy_ask( ic, cmd[1], cmd[2] );
 		}
 		
 		if( --md->buddycount == 0 )
 		{
-			if( gc->flags & OPT_LOGGED_IN )
-			{
-				serv_got_crap( gc, "Successfully transferred to different server" );
+			if( ic->flags & OPT_LOGGED_IN )
+			{
+				serv_got_crap( ic, "Successfully transferred to different server" );
 				g_snprintf( buf, sizeof( buf ), "CHG %d %s %d\r\n", ++md->trId, md->away_state->code, 0 );
-				return( msn_write( gc, buf, strlen( buf ) ) );
+				return( msn_write( ic, buf, strlen( buf ) ) );
 			}
 			else
 			{
-				msn_logged_in( gc );
+				msn_logged_in( ic );
 			}
 		}
@@ -344,6 +344,6 @@
 		if( num_parts != 4 )
 		{
-			hide_login_progress_error( gc, "Syntax error" );
-			signoff( gc );
+			hide_login_progress_error( ic, "Syntax error" );
+			signoff( ic );
 			return( 0 );
 		}
@@ -363,6 +363,6 @@
 		if( num_parts != 3 )
 		{
-			hide_login_progress_error( gc, "Syntax error" );
-			signoff( gc );
+			hide_login_progress_error( ic, "Syntax error" );
+			signoff( ic );
 			return( 0 );
 		}
@@ -377,5 +377,5 @@
 			g_snprintf( buf + strlen( buf ), 3, "%02x", digest[i] );
 		
-		return( msn_write( gc, buf, strlen( buf ) ) );
+		return( msn_write( ic, buf, strlen( buf ) ) );
 	}
 	else if( strcmp( cmd[0], "ILN" ) == 0 )
@@ -385,11 +385,11 @@
 		if( num_parts != 6 )
 		{
-			hide_login_progress_error( gc, "Syntax error" );
-			signoff( gc );
+			hide_login_progress_error( ic, "Syntax error" );
+			signoff( ic );
 			return( 0 );
 		}
 		
 		http_decode( cmd[4] );
-		serv_buddy_rename( gc, cmd[3], cmd[4] );
+		serv_buddy_rename( ic, cmd[3], cmd[4] );
 		
 		st = msn_away_state_by_code( cmd[2] );
@@ -400,10 +400,10 @@
 		}
 		
-		serv_got_update( gc, cmd[3], 1, 0, 0, 0, st->number, 0 );
+		serv_got_update( ic, cmd[3], 1, 0, 0, 0, st->number, 0 );
 	}
 	else if( strcmp( cmd[0], "FLN" ) == 0 )
 	{
 		if( cmd[1] )
-			serv_got_update( gc, cmd[1], 0, 0, 0, 0, 0, 0 );
+			serv_got_update( ic, cmd[1], 0, 0, 0, 0, 0, 0 );
 	}
 	else if( strcmp( cmd[0], "NLN" ) == 0 )
@@ -413,11 +413,11 @@
 		if( num_parts != 5 )
 		{
-			hide_login_progress_error( gc, "Syntax error" );
-			signoff( gc );
+			hide_login_progress_error( ic, "Syntax error" );
+			signoff( ic );
 			return( 0 );
 		}
 		
 		http_decode( cmd[3] );
-		serv_buddy_rename( gc, cmd[2], cmd[3] );
+		serv_buddy_rename( ic, cmd[2], cmd[3] );
 		
 		st = msn_away_state_by_code( cmd[1] );
@@ -428,5 +428,5 @@
 		}
 		
-		serv_got_update( gc, cmd[2], 1, 0, 0, 0, st->number, 0 );
+		serv_got_update( ic, cmd[2], 1, 0, 0, 0, st->number, 0 );
 	}
 	else if( strcmp( cmd[0], "RNG" ) == 0 )
@@ -438,6 +438,6 @@
 		if( num_parts != 7 )
 		{
-			hide_login_progress_error( gc, "Syntax error" );
-			signoff( gc );
+			hide_login_progress_error( ic, "Syntax error" );
+			signoff( ic );
 			return( 0 );
 		}
@@ -448,6 +448,6 @@
 		if( !server )
 		{
-			hide_login_progress_error( gc, "Syntax error" );
-			signoff( gc );
+			hide_login_progress_error( ic, "Syntax error" );
+			signoff( ic );
 			return( 0 );
 		}
@@ -458,6 +458,6 @@
 		if( strcmp( cmd[3], "CKI" ) != 0 )
 		{
-			hide_login_progress_error( gc, "Unknown authentication method for switchboard" );
-			signoff( gc );
+			hide_login_progress_error( ic, "Unknown authentication method for switchboard" );
+			signoff( ic );
 			return( 0 );
 		}
@@ -465,5 +465,5 @@
 		debug( "Got a call from %s (session %d). Key = %s", cmd[5], session, cmd[4] );
 		
-		sb = msn_sb_create( gc, server, port, cmd[4], session );
+		sb = msn_sb_create( ic, server, port, cmd[4], session );
 		sb->who = g_strdup( cmd[5] );
 	}
@@ -478,19 +478,19 @@
 			if( strchr( cmd[4], '@' ) == NULL )
 			{
-				hide_login_progress_error( gc, "Syntax error" );
-				signoff( gc );
+				hide_login_progress_error( ic, "Syntax error" );
+				signoff( ic );
 				return( 0 );
 			}
 			
 			/* We got added by someone. If we don't have this person in permit/deny yet, inform the user. */
-			for( l = gc->permit; l; l = l->next )
+			for( l = ic->permit; l; l = l->next )
 				if( g_strcasecmp( l->data, cmd[4] ) == 0 )
 					return( 1 );
 			
-			for( l = gc->deny; l; l = l->next )
+			for( l = ic->deny; l; l = l->next )
 				if( g_strcasecmp( l->data, cmd[4] ) == 0 )
 					return( 1 );
 			
-			msn_buddy_ask( gc, cmd[4], cmd[5] );
+			msn_buddy_ask( ic, cmd[4], cmd[5] );
 		}
 	}
@@ -499,17 +499,17 @@
 		if( cmd[1] && strcmp( cmd[1], "OTH" ) == 0 )
 		{
-			hide_login_progress_error( gc, "Someone else logged in with your account" );
-			gc->wants_to_die = 1;
+			hide_login_progress_error( ic, "Someone else logged in with your account" );
+			ic->wants_to_die = 1;
 		}
 		else if( cmd[1] && strcmp( cmd[1], "SSD" ) == 0 )
 		{
-			hide_login_progress_error( gc, "Terminating session because of server shutdown" );
+			hide_login_progress_error( ic, "Terminating session because of server shutdown" );
 		}
 		else
 		{
-			hide_login_progress_error( gc, "Session terminated by remote server (reason unknown)" );
-		}
-		
-		signoff( gc );
+			hide_login_progress_error( ic, "Session terminated by remote server (reason unknown)" );
+		}
+		
+		signoff( ic );
 		return( 0 );
 	}
@@ -518,18 +518,18 @@
 		if( num_parts != 5 )
 		{
-			hide_login_progress_error( gc, "Syntax error" );
-			signoff( gc );
-			return( 0 );
-		}
-		
-		if( g_strcasecmp( cmd[3], gc->username ) == 0 )
+			hide_login_progress_error( ic, "Syntax error" );
+			signoff( ic );
+			return( 0 );
+		}
+		
+		if( g_strcasecmp( cmd[3], ic->username ) == 0 )
 		{
 			set_t *s;
 			
 			http_decode( cmd[4] );
-			strncpy( gc->displayname, cmd[4], sizeof( gc->displayname ) );
-			gc->displayname[sizeof(gc->displayname)-1] = 0;
-			
-			if( ( s = set_find( &gc->acc->set, "display_name" ) ) )
+			strncpy( ic->displayname, cmd[4], sizeof( ic->displayname ) );
+			ic->displayname[sizeof(ic->displayname)-1] = 0;
+			
+			if( ( s = set_find( &ic->acc->set, "display_name" ) ) )
 			{
 				g_free( s->value );
@@ -541,10 +541,10 @@
 			/* This is not supposed to happen, but let's handle it anyway... */
 			http_decode( cmd[4] );
-			serv_buddy_rename( gc, cmd[3], cmd[4] );
+			serv_buddy_rename( ic, cmd[3], cmd[4] );
 		}
 	}
 	else if( strcmp( cmd[0], "IPG" ) == 0 )
 	{
-		do_error_dialog( gc, "Received IPG command, we don't handle them yet.", "MSN" );
+		do_error_dialog( ic, "Received IPG command, we don't handle them yet.", "MSN" );
 		
 		md->handler->msglen = atoi( cmd[1] );
@@ -552,6 +552,6 @@
 		if( md->handler->msglen <= 0 )
 		{
-			hide_login_progress_error( gc, "Syntax error" );
-			signoff( gc );
+			hide_login_progress_error( ic, "Syntax error" );
+			signoff( ic );
 			return( 0 );
 		}
@@ -563,9 +563,9 @@
 		
 		g_snprintf( buf, sizeof( buf ), "Error reported by MSN server: %s", err->text );
-		do_error_dialog( gc, buf, "MSN" );
+		do_error_dialog( ic, buf, "MSN" );
 		
 		if( err->flags & STATUS_FATAL )
 		{
-			signoff( gc );
+			signoff( ic );
 			return( 0 );
 		}
@@ -581,5 +581,5 @@
 static int msn_ns_message( gpointer data, char *msg, int msglen, char **cmd, int num_parts )
 {
-	struct gaim_connection *gc = data;
+	struct im_connection *ic = data;
 	char *body;
 	int blen = 0;
@@ -617,5 +617,5 @@
 				{
 					if( arg1 )
-						serv_got_crap( gc, "The server is going down for maintenance in %s minutes.", arg1 );
+						serv_got_crap( ic, "The server is going down for maintenance in %s minutes.", arg1 );
 				}
 				
@@ -634,5 +634,5 @@
 				if( inbox && folders )
 				{
-					serv_got_crap( gc, "INBOX contains %s new messages, plus %s messages in other folders.", inbox, folders );
+					serv_got_crap( ic, "INBOX contains %s new messages, plus %s messages in other folders.", inbox, folders );
 				}
 			}
@@ -644,5 +644,5 @@
 				if( from && fromname )
 				{
-					serv_got_crap( gc, "Received an e-mail message from %s <%s>.", fromname, from );
+					serv_got_crap( ic, "Received an e-mail message from %s <%s>.", fromname, from );
 				}
 			}
@@ -665,6 +665,6 @@
 static void msn_auth_got_passport_id( struct passport_reply *rep )
 {
-	struct gaim_connection *gc = rep->data;
-	struct msn_data *md = gc->proto_data;
+	struct im_connection *ic = rep->data;
+	struct msn_data *md = ic->proto_data;
 	char *key = rep->result;
 	char buf[1024];
@@ -677,6 +677,6 @@
 		                       rep->error_string ? rep->error_string : "Unknown error" );
 		
-		hide_login_progress( gc, err );
-		signoff( gc );
+		hide_login_progress( ic, err );
+		signoff( ic );
 		
 		g_free( err );
@@ -685,5 +685,5 @@
 	{
 		g_snprintf( buf, sizeof( buf ), "USR %d TWN S %s\r\n", ++md->trId, key );
-		msn_write( gc, buf, strlen( buf ) );
+		msn_write( ic, buf, strlen( buf ) );
 	}
 }
Index: protocols/msn/sb.c
===================================================================
--- protocols/msn/sb.c	(revision fa29d09342c79b886efacee4cfc3078be5f5a722)
+++ protocols/msn/sb.c	(revision 0da65d5fb37691ed4d31f7ab4058732f1440db6b)
@@ -48,7 +48,7 @@
 }
 
-struct msn_switchboard *msn_sb_create( struct gaim_connection *gc, char *host, int port, char *key, int session )
-{
-	struct msn_data *md = gc->proto_data;
+struct msn_switchboard *msn_sb_create( struct im_connection *ic, char *host, int port, char *key, int session )
+{
+	struct msn_data *md = ic->proto_data;
 	struct msn_switchboard *sb = g_new0( struct msn_switchboard, 1 );
 	
@@ -60,5 +60,5 @@
 	}
 	
-	sb->gc = gc;
+	sb->ic = ic;
 	sb->key = g_strdup( key );
 	sb->session = session;
@@ -70,7 +70,7 @@
 }
 
-struct msn_switchboard *msn_sb_by_handle( struct gaim_connection *gc, char *handle )
-{
-	struct msn_data *md = gc->proto_data;
+struct msn_switchboard *msn_sb_by_handle( struct im_connection *ic, char *handle )
+{
+	struct msn_data *md = ic->proto_data;
 	struct msn_switchboard *sb;
 	GSList *l;
@@ -86,7 +86,7 @@
 }
 
-struct msn_switchboard *msn_sb_by_chat( struct conversation *c )
-{
-	struct msn_data *md = c->gc->proto_data;
+struct msn_switchboard *msn_sb_by_chat( struct groupchat *c )
+{
+	struct msn_data *md = c->ic->proto_data;
 	struct msn_switchboard *sb;
 	GSList *l;
@@ -102,7 +102,7 @@
 }
 
-struct msn_switchboard *msn_sb_spare( struct gaim_connection *gc )
-{
-	struct msn_data *md = gc->proto_data;
+struct msn_switchboard *msn_sb_spare( struct im_connection *ic )
+{
+	struct msn_data *md = ic->proto_data;
 	struct msn_switchboard *sb;
 	GSList *l;
@@ -142,7 +142,7 @@
 		else
 		{
-			i = strlen( MSN_TYPING_HEADERS ) + strlen( sb->gc->username );
+			i = strlen( MSN_TYPING_HEADERS ) + strlen( sb->ic->username );
 			buf = g_new0( char, i );
-			i = g_snprintf( buf, i, MSN_TYPING_HEADERS, sb->gc->username );
+			i = g_snprintf( buf, i, MSN_TYPING_HEADERS, sb->ic->username );
 		}
 		
@@ -177,16 +177,16 @@
 }
 
-struct conversation *msn_sb_to_chat( struct msn_switchboard *sb )
-{
-	struct gaim_connection *gc = sb->gc;
+struct groupchat *msn_sb_to_chat( struct msn_switchboard *sb )
+{
+	struct im_connection *ic = sb->ic;
 	char buf[1024];
 	
 	/* Create the groupchat structure. */
 	g_snprintf( buf, sizeof( buf ), "MSN groupchat session %d", sb->session );
-	sb->chat = serv_got_joined_chat( gc, buf );
+	sb->chat = serv_got_joined_chat( ic, buf );
 	
 	/* Populate the channel. */
 	if( sb->who ) add_chat_buddy( sb->chat, sb->who );
-	add_chat_buddy( sb->chat, gc->username );
+	add_chat_buddy( sb->chat, ic->username );
 	
 	/* And make sure the switchboard doesn't look like a regular chat anymore. */
@@ -202,6 +202,6 @@
 void msn_sb_destroy( struct msn_switchboard *sb )
 {
-	struct gaim_connection *gc = sb->gc;
-	struct msn_data *md = gc->proto_data;
+	struct im_connection *ic = sb->ic;
+	struct msn_data *md = ic->proto_data;
 	
 	debug( "Destroying switchboard: %s", sb->who ? sb->who : sb->key ? sb->key : "" );
@@ -222,5 +222,5 @@
 		g_slist_free( sb->msgq );
 		
-		serv_got_crap( gc, "Warning: Closing down MSN switchboard connection with "
+		serv_got_crap( ic, "Warning: Closing down MSN switchboard connection with "
 		                   "unsent message to %s, you'll have to resend it.",
 		                   sb->who ? sb->who : "(unknown)" );
@@ -253,5 +253,5 @@
 {
 	struct msn_switchboard *sb = data;
-	struct gaim_connection *gc;
+	struct im_connection *ic;
 	struct msn_data *md;
 	char buf[1024];
@@ -261,6 +261,6 @@
 		return FALSE;
 	
-	gc = sb->gc;
-	md = gc->proto_data;
+	ic = sb->ic;
+	md = ic->proto_data;
 	
 	if( source != sb->fd )
@@ -280,7 +280,7 @@
 	
 	if( sb->session == MSN_SB_NEW )
-		g_snprintf( buf, sizeof( buf ), "USR %d %s %s\r\n", ++sb->trId, gc->username, sb->key );
+		g_snprintf( buf, sizeof( buf ), "USR %d %s %s\r\n", ++sb->trId, ic->username, sb->key );
 	else
-		g_snprintf( buf, sizeof( buf ), "ANS %d %s %s %d\r\n", ++sb->trId, gc->username, sb->key, sb->session );
+		g_snprintf( buf, sizeof( buf ), "ANS %d %s %s %d\r\n", ++sb->trId, ic->username, sb->key, sb->session );
 	
 	if( msn_sb_write( sb, buf, strlen( buf ) ) )
@@ -310,5 +310,5 @@
 {
 	struct msn_switchboard *sb = data;
-	struct gaim_connection *gc = sb->gc;
+	struct im_connection *ic = sb->ic;
 	char buf[1024];
 	
@@ -321,6 +321,6 @@
 	if( strcmp( cmd[0], "XFR" ) == 0 )
 	{
-		hide_login_progress_error( gc, "Received an XFR from a switchboard server, unable to comply! This is likely to be a bug, please report it!" );
-		signoff( gc );
+		hide_login_progress_error( ic, "Received an XFR from a switchboard server, unable to comply! This is likely to be a bug, please report it!" );
+		signoff( ic );
 		return( 0 );
 	}
@@ -374,5 +374,5 @@
 			{
 				g_snprintf( buf, sizeof( buf ), "MSN groupchat session %d", sb->session );
-				sb->chat = serv_got_joined_chat( gc, buf );
+				sb->chat = serv_got_joined_chat( ic, buf );
 				
 				g_free( sb->who );
@@ -384,5 +384,5 @@
 			if( num == tot )
 			{
-				add_chat_buddy( sb->chat, gc->username );
+				add_chat_buddy( sb->chat, ic->username );
 			}
 		}
@@ -529,5 +529,5 @@
 		
 		g_snprintf( buf, sizeof( buf ), "Error reported by switchboard server: %s", err->text );
-		do_error_dialog( gc, buf, "MSN" );
+		do_error_dialog( ic, buf, "MSN" );
 		
 		if( err->flags & STATUS_SB_FATAL )
@@ -538,5 +538,5 @@
 		else if( err->flags & STATUS_FATAL )
 		{
-			signoff( gc );
+			signoff( ic );
 			return 0;
 		}
@@ -579,5 +579,5 @@
 {
 	struct msn_switchboard *sb = data;
-	struct gaim_connection *gc = sb->gc;
+	struct im_connection *ic = sb->ic;
 	char *body;
 	int blen = 0;
@@ -608,5 +608,5 @@
 			if( sb->who )
 			{
-				serv_got_im( gc, cmd[1], body, 0, 0, blen );
+				serv_got_im( ic, cmd[1], body, 0, 0, blen );
 			}
 			else if( sb->chat )
@@ -667,5 +667,5 @@
 			if( sb->who )
 			{
-				serv_got_im( gc, cmd[1], buf, 0, 0, strlen( buf ) );
+				serv_got_im( ic, cmd[1], buf, 0, 0, strlen( buf ) );
 			}
 			else if( sb->chat )
@@ -684,5 +684,5 @@
 			if( who )
 			{
-				serv_got_typing( gc, who, 5, 1 );
+				serv_got_typing( ic, who, 5, 1 );
 				g_free( who );
 			}
Index: protocols/nogaim.c
===================================================================
--- protocols/nogaim.c	(revision fa29d09342c79b886efacee4cfc3078be5f5a722)
+++ protocols/nogaim.c	(revision 0da65d5fb37691ed4d31f7ab4058732f1440db6b)
@@ -36,5 +36,5 @@
 #include <ctype.h>
 
-static int remove_chat_buddy_silent( struct conversation *b, char *handle );
+static int remove_chat_buddy_silent( struct groupchat *b, char *handle );
 
 GSList *connections;
@@ -115,23 +115,23 @@
 void nogaim_init()
 {
-	extern void msn_init();
-	extern void oscar_init();
-	extern void byahoo_init();
-	extern void jabber_init();
+	extern void msn_initmodule();
+	extern void oscar_initmodule();
+	extern void byahoo_initmodule();
+	extern void jabber_initmodule();
 
 #ifdef WITH_MSN
-	msn_init();
+	msn_initmodule();
 #endif
 
 #ifdef WITH_OSCAR
-	oscar_init();
+	oscar_initmodule();
 #endif
 	
 #ifdef WITH_YAHOO
-	byahoo_init();
+	byahoo_initmodule();
 #endif
 	
 #ifdef WITH_JABBER
-	jabber_init();
+	jabber_initmodule();
 #endif
 
@@ -145,57 +145,57 @@
 /* multi.c */
 
-struct gaim_connection *new_gaim_conn( account_t *acc )
-{
-	struct gaim_connection *gc;
-	
-	gc = g_new0( struct gaim_connection, 1 );
+struct im_connection *new_gaim_conn( account_t *acc )
+{
+	struct im_connection *ic;
+	
+	ic = g_new0( struct im_connection, 1 );
 	
 	/* Maybe we should get rid of this memory waste later. ;-) */
-	g_snprintf( gc->username, sizeof( gc->username ), "%s", acc->user );
-	g_snprintf( gc->password, sizeof( gc->password ), "%s", acc->pass );
-	
-	gc->irc = acc->irc;
-	gc->acc = acc;
-	acc->gc = gc;
-	
-	connections = g_slist_append( connections, gc );
-	
-	return( gc );
-}
-
-void destroy_gaim_conn( struct gaim_connection *gc )
+	g_snprintf( ic->username, sizeof( ic->username ), "%s", acc->user );
+	g_snprintf( ic->password, sizeof( ic->password ), "%s", acc->pass );
+	
+	ic->irc = acc->irc;
+	ic->acc = acc;
+	acc->ic = ic;
+	
+	connections = g_slist_append( connections, ic );
+	
+	return( ic );
+}
+
+void destroy_gaim_conn( struct im_connection *ic )
 {
 	account_t *a;
 	
 	/* Destroy the pointer to this connection from the account list */
-	for( a = gc->irc->accounts; a; a = a->next )
-		if( a->gc == gc )
-		{
-			a->gc = NULL;
+	for( a = ic->irc->accounts; a; a = a->next )
+		if( a->ic == ic )
+		{
+			a->ic = NULL;
 			break;
 		}
 	
-	connections = g_slist_remove( connections, gc );
-	g_free( gc );
-}
-
-void set_login_progress( struct gaim_connection *gc, int step, char *msg )
-{
-	serv_got_crap( gc, "Logging in: %s", msg );
+	connections = g_slist_remove( connections, ic );
+	g_free( ic );
+}
+
+void set_login_progress( struct im_connection *ic, int step, char *msg )
+{
+	serv_got_crap( ic, "Logging in: %s", msg );
 }
 
 /* Errors *while* logging in */
-void hide_login_progress( struct gaim_connection *gc, char *msg )
-{
-	serv_got_crap( gc, "Login error: %s", msg );
+void hide_login_progress( struct im_connection *ic, char *msg )
+{
+	serv_got_crap( ic, "Login error: %s", msg );
 }
 
 /* Errors *after* logging in */
-void hide_login_progress_error( struct gaim_connection *gc, char *msg )
-{
-	serv_got_crap( gc, "Logged out: %s", msg );
-}
-
-void serv_got_crap( struct gaim_connection *gc, char *format, ... )
+void hide_login_progress_error( struct im_connection *ic, char *msg )
+{
+	serv_got_crap( ic, "Logged out: %s", msg );
+}
+
+void serv_got_crap( struct im_connection *ic, char *format, ... )
 {
 	va_list params;
@@ -207,18 +207,18 @@
 	va_end( params );
 
-	if( ( g_strcasecmp( set_getstr( &gc->irc->set, "strip_html" ), "always" ) == 0 ) ||
-	    ( ( gc->flags & OPT_CONN_HTML ) && set_getbool( &gc->irc->set, "strip_html" ) ) )
+	if( ( g_strcasecmp( set_getstr( &ic->irc->set, "strip_html" ), "always" ) == 0 ) ||
+	    ( ( ic->flags & OPT_CONN_HTML ) && set_getbool( &ic->irc->set, "strip_html" ) ) )
 		strip_html( text );
 	
 	/* Try to find a different connection on the same protocol. */
-	for( a = gc->irc->accounts; a; a = a->next )
-		if( a->prpl == gc->acc->prpl && a->gc != gc )
+	for( a = ic->irc->accounts; a; a = a->next )
+		if( a->prpl == ic->acc->prpl && a->ic != ic )
 			break;
 	
 	/* If we found one, include the screenname in the message. */
 	if( a )
-		irc_usermsg( gc->irc, "%s(%s) - %s", gc->acc->prpl->name, gc->username, text );
+		irc_usermsg( ic->irc, "%s(%s) - %s", ic->acc->prpl->name, ic->username, text );
 	else
-		irc_usermsg( gc->irc, "%s - %s", gc->acc->prpl->name, text );
+		irc_usermsg( ic->irc, "%s - %s", ic->acc->prpl->name, text );
 	
 	g_free( text );
@@ -227,13 +227,13 @@
 static gboolean send_keepalive( gpointer d, gint fd, b_input_condition cond )
 {
-	struct gaim_connection *gc = d;
-	
-	if( gc->acc->prpl->keepalive )
-		gc->acc->prpl->keepalive( gc );
+	struct im_connection *ic = d;
+	
+	if( ic->acc->prpl->keepalive )
+		ic->acc->prpl->keepalive( ic );
 	
 	return TRUE;
 }
 
-void account_online( struct gaim_connection *gc )
+void account_online( struct im_connection *ic )
 {
 	user_t *u;
@@ -242,17 +242,17 @@
 	   the whole login sequence again, so these "late" calls to this
 	   function should be handled correctly. (IOW, ignored) */
-	if( gc->flags & OPT_LOGGED_IN )
+	if( ic->flags & OPT_LOGGED_IN )
 		return;
 	
-	u = user_find( gc->irc, gc->irc->nick );
-	
-	serv_got_crap( gc, "Logged in" );
-	
-	gc->keepalive = b_timeout_add( 60000, send_keepalive, gc );
-	gc->flags |= OPT_LOGGED_IN;
+	u = user_find( ic->irc, ic->irc->nick );
+	
+	serv_got_crap( ic, "Logged in" );
+	
+	ic->keepalive = b_timeout_add( 60000, send_keepalive, ic );
+	ic->flags |= OPT_LOGGED_IN;
 	
 	/* Also necessary when we're not away, at least for some of the
 	   protocols. */
-	bim_set_away( gc, u->away );
+	bim_set_away( ic, u->away );
 }
 
@@ -274,7 +274,7 @@
 }
 
-void signoff( struct gaim_connection *gc )
-{
-	irc_t *irc = gc->irc;
+void signoff( struct im_connection *ic )
+{
+	irc_t *irc = ic->irc;
 	user_t *t, *u = irc->users;
 	account_t *a;
@@ -282,19 +282,19 @@
 	/* Nested calls might happen sometimes, this is probably the best
 	   place to catch them. */
-	if( gc->flags & OPT_LOGGING_OUT )
+	if( ic->flags & OPT_LOGGING_OUT )
 		return;
 	else
-		gc->flags |= OPT_LOGGING_OUT;
-	
-	serv_got_crap( gc, "Signing off.." );
-	
-	b_event_remove( gc->keepalive );
-	gc->keepalive = 0;
-	gc->acc->prpl->close( gc );
-	b_event_remove( gc->inpa );
+		ic->flags |= OPT_LOGGING_OUT;
+	
+	serv_got_crap( ic, "Signing off.." );
+	
+	b_event_remove( ic->keepalive );
+	ic->keepalive = 0;
+	ic->acc->prpl->logout( ic );
+	b_event_remove( ic->inpa );
 	
 	while( u )
 	{
-		if( u->gc == gc )
+		if( u->ic == ic )
 		{
 			t = u->next;
@@ -306,8 +306,8 @@
 	}
 	
-	query_del_by_gc( gc->irc, gc );
+	query_del_by_conn( ic->irc, ic );
 	
 	for( a = irc->accounts; a; a = a->next )
-		if( a->gc == gc )
+		if( a->ic == ic )
 			break;
 	
@@ -316,14 +316,14 @@
 		/* Uhm... This is very sick. */
 	}
-	else if( !gc->wants_to_die && set_getbool( &irc->set, "auto_reconnect" ) &&
+	else if( !ic->wants_to_die && set_getbool( &irc->set, "auto_reconnect" ) &&
 	         set_getbool( &a->set, "auto_reconnect" ) )
 	{
 		int delay = set_getint( &irc->set, "auto_reconnect_delay" );
 		
-		serv_got_crap( gc, "Reconnecting in %d seconds..", delay );
+		serv_got_crap( ic, "Reconnecting in %d seconds..", delay );
 		a->reconnect = b_timeout_add( delay * 1000, auto_reconnect, a );
 	}
 	
-	destroy_gaim_conn( gc );
+	destroy_gaim_conn( ic );
 }
 
@@ -331,19 +331,19 @@
 /* dialogs.c */
 
-void do_error_dialog( struct gaim_connection *gc, char *msg, char *title )
+void do_error_dialog( struct im_connection *ic, char *msg, char *title )
 {
 	if( msg && title )
-		serv_got_crap( gc, "Error: %s: %s", title, msg );
+		serv_got_crap( ic, "Error: %s: %s", title, msg );
 	else if( msg )
-		serv_got_crap( gc, "Error: %s", msg );
+		serv_got_crap( ic, "Error: %s", msg );
 	else if( title )
-		serv_got_crap( gc, "Error: %s", title );
+		serv_got_crap( ic, "Error: %s", title );
 	else
-		serv_got_crap( gc, "Error" );
-}
-
-void do_ask_dialog( struct gaim_connection *gc, char *msg, void *data, void *doit, void *dont )
-{
-	query_add( gc->irc, gc, msg, doit, dont, data );
+		serv_got_crap( ic, "Error" );
+}
+
+void do_ask_dialog( struct im_connection *ic, char *msg, void *data, void *doit, void *dont )
+{
+	query_add( ic->irc, ic, msg, doit, dont, data );
 }
 
@@ -351,18 +351,18 @@
 /* list.c */
 
-void add_buddy( struct gaim_connection *gc, char *group, char *handle, char *realname )
+void add_buddy( struct im_connection *ic, char *group, char *handle, char *realname )
 {
 	user_t *u;
 	char nick[MAX_NICK_LENGTH+1];
 	char *s;
-	irc_t *irc = gc->irc;
+	irc_t *irc = ic->irc;
 	
 	if( set_getbool( &irc->set, "debug" ) && 0 ) /* This message is too useless */
-		serv_got_crap( gc, "Receiving user add from handle: %s", handle );
-	
-	if( user_findhandle( gc, handle ) )
+		serv_got_crap( ic, "Receiving user add from handle: %s", handle );
+	
+	if( user_findhandle( ic, handle ) )
 	{
 		if( set_getbool( &irc->set, "debug" ) )
-			serv_got_crap( gc, "User already exists, ignoring add request: %s", handle );
+			serv_got_crap( ic, "User already exists, ignoring add request: %s", handle );
 		
 		return;
@@ -372,7 +372,7 @@
 	
 	memset( nick, 0, MAX_NICK_LENGTH + 1 );
-	strcpy( nick, nick_get( gc->acc, handle, realname ) );
-	
-	u = user_add( gc->irc, nick );
+	strcpy( nick, nick_get( ic->acc, handle, realname ) );
+	
+	u = user_add( ic->irc, nick );
 	
 	if( !realname || !*realname ) realname = nick;
@@ -384,13 +384,13 @@
 		u->user = g_strndup( handle, s - handle );
 	}
-	else if( gc->acc->server )
+	else if( ic->acc->server )
 	{
 		char *colon;
 		
-		if( ( colon = strchr( gc->acc->server, ':' ) ) )
-			u->host = g_strndup( gc->acc->server,
-			                     colon - gc->acc->server );
+		if( ( colon = strchr( ic->acc->server, ':' ) ) )
+			u->host = g_strndup( ic->acc->server,
+			                     colon - ic->acc->server );
 		else
-			u->host = g_strdup( gc->acc->server );
+			u->host = g_strdup( ic->acc->server );
 		
 		u->user = g_strdup( handle );
@@ -403,9 +403,9 @@
 	else
 	{
-		u->host = g_strdup( gc->acc->prpl->name );
+		u->host = g_strdup( ic->acc->prpl->name );
 		u->user = g_strdup( handle );
 	}
 	
-	u->gc = gc;
+	u->ic = ic;
 	u->handle = g_strdup( handle );
 	if( group ) u->group = g_strdup( group );
@@ -414,10 +414,10 @@
 }
 
-struct buddy *find_buddy( struct gaim_connection *gc, char *handle )
+struct buddy *find_buddy( struct im_connection *ic, char *handle )
 {
 	static struct buddy b[1];
 	user_t *u;
 	
-	u = user_findhandle( gc, handle );
+	u = user_findhandle( ic, handle );
 	
 	if( !u )
@@ -428,10 +428,10 @@
 	strncpy( b->show, u->realname, BUDDY_ALIAS_MAXLEN );
 	b->present = u->online;
-	b->gc = u->gc;
+	b->ic = u->ic;
 	
 	return( b );
 }
 
-void signoff_blocked( struct gaim_connection *gc )
+void signoff_blocked( struct im_connection *ic )
 {
 	return; /* Make all blocked users look invisible (TODO?) */
@@ -439,7 +439,7 @@
 
 
-void serv_buddy_rename( struct gaim_connection *gc, char *handle, char *realname )
-{
-	user_t *u = user_findhandle( gc, handle );
+void serv_buddy_rename( struct im_connection *ic, char *handle, char *realname )
+{
+	user_t *u = user_findhandle( ic, handle );
 	
 	if( !u ) return;
@@ -451,6 +451,6 @@
 		u->realname = g_strdup( realname );
 		
-		if( ( gc->flags & OPT_LOGGED_IN ) && set_getbool( &gc->irc->set, "display_namechanges" ) )
-			serv_got_crap( gc, "User `%s' changed name to `%s'", u->nick, u->realname );
+		if( ( ic->flags & OPT_LOGGED_IN ) && set_getbool( &ic->irc->set, "display_namechanges" ) )
+			serv_got_crap( ic, "User `%s' changed name to `%s'", u->nick, u->realname );
 	}
 }
@@ -461,5 +461,5 @@
 struct show_got_added_data
 {
-	struct gaim_connection *gc;
+	struct im_connection *ic;
 	char *handle;
 };
@@ -473,11 +473,11 @@
 void show_got_added_yes( gpointer w, struct show_got_added_data *data )
 {
-	data->gc->acc->prpl->add_buddy( data->gc, data->handle );
-	add_buddy( data->gc, NULL, data->handle, data->handle );
+	data->ic->acc->prpl->add_buddy( data->ic, data->handle, NULL );
+	add_buddy( data->ic, NULL, data->handle, data->handle );
 	
 	return show_got_added_no( w, data );
 }
 
-void show_got_added( struct gaim_connection *gc, char *handle, const char *realname )
+void show_got_added( struct im_connection *ic, char *handle, const char *realname )
 {
 	struct show_got_added_data *data = g_new0( struct show_got_added_data, 1 );
@@ -485,12 +485,12 @@
 	
 	/* TODO: Make a setting for this! */
-	if( user_findhandle( gc, handle ) != NULL )
+	if( user_findhandle( ic, handle ) != NULL )
 		return;
 	
 	s = g_strdup_printf( "The user %s is not in your buddy list yet. Do you want to add him/her now?", handle );
 	
-	data->gc = gc;
+	data->ic = ic;
 	data->handle = g_strdup( handle );
-	query_add( gc->irc, gc, s, show_got_added_yes, show_got_added_no, data );
+	query_add( ic->irc, ic, s, show_got_added_yes, show_got_added_no, data );
 }
 
@@ -498,24 +498,24 @@
 /* server.c */                    
 
-void serv_got_update( struct gaim_connection *gc, char *handle, int loggedin, int evil, time_t signon, time_t idle, int type, guint caps )
+void serv_got_update( struct im_connection *ic, char *handle, int loggedin, int evil, time_t signon, time_t idle, int type, guint caps )
 {
 	user_t *u;
 	int oa, oo;
 	
-	u = user_findhandle( gc, handle );
+	u = user_findhandle( ic, handle );
 	
 	if( !u )
 	{
-		if( g_strcasecmp( set_getstr( &gc->irc->set, "handle_unknown" ), "add" ) == 0 )
-		{
-			add_buddy( gc, NULL, handle, NULL );
-			u = user_findhandle( gc, handle );
+		if( g_strcasecmp( set_getstr( &ic->irc->set, "handle_unknown" ), "add" ) == 0 )
+		{
+			add_buddy( ic, NULL, handle, NULL );
+			u = user_findhandle( ic, handle );
 		}
 		else
 		{
-			if( set_getbool( &gc->irc->set, "debug" ) || g_strcasecmp( set_getstr( &gc->irc->set, "handle_unknown" ), "ignore" ) != 0 )
+			if( set_getbool( &ic->irc->set, "debug" ) || g_strcasecmp( set_getstr( &ic->irc->set, "handle_unknown" ), "ignore" ) != 0 )
 			{
-				serv_got_crap( gc, "serv_got_update() for handle %s:", handle );
-				serv_got_crap( gc, "loggedin = %d, type = %d", loggedin, type );
+				serv_got_crap( ic, "serv_got_update() for handle %s:", handle );
+				serv_got_crap( ic, "loggedin = %d, type = %d", loggedin, type );
 			}
 			
@@ -537,24 +537,24 @@
 	if( loggedin && !u->online )
 	{
-		irc_spawn( gc->irc, u );
+		irc_spawn( ic->irc, u );
 		u->online = 1;
 	}
 	else if( !loggedin && u->online )
 	{
-		struct conversation *c;
-		
-		irc_kill( gc->irc, u );
+		struct groupchat *c;
+		
+		irc_kill( ic->irc, u );
 		u->online = 0;
 		
 		/* Remove him/her from the conversations to prevent PART messages after he/she QUIT already */
-		for( c = gc->conversations; c; c = c->next )
+		for( c = ic->conversations; c; c = c->next )
 			remove_chat_buddy_silent( c, handle );
 	}
 	
-	if( ( type & UC_UNAVAILABLE ) && ( strcmp( gc->acc->prpl->name, "oscar" ) == 0 || strcmp( gc->acc->prpl->name, "icq" ) == 0 ) )
+	if( ( type & UC_UNAVAILABLE ) && ( strcmp( ic->acc->prpl->name, "oscar" ) == 0 || strcmp( ic->acc->prpl->name, "icq" ) == 0 ) )
 	{
 		u->away = g_strdup( "Away" );
 	}
-	else if( ( type & UC_UNAVAILABLE ) && ( strcmp( gc->acc->prpl->name, "jabber" ) == 0 ) )
+	else if( ( type & UC_UNAVAILABLE ) && ( strcmp( ic->acc->prpl->name, "jabber" ) == 0 ) )
 	{
 		if( type & UC_DND )
@@ -565,7 +565,7 @@
 			u->away = g_strdup( "Away" );
 	}
-	else if( ( type & UC_UNAVAILABLE ) && gc->acc->prpl->get_status_string )
-	{
-		u->away = g_strdup( gc->acc->prpl->get_status_string( gc, type ) );
+	else if( ( type & UC_UNAVAILABLE ) && ic->acc->prpl->get_status_string )
+	{
+		u->away = g_strdup( ic->acc->prpl->get_status_string( ic, type ) );
 	}
 	else
@@ -573,20 +573,20 @@
 	
 	/* LISPy... */
-	if( ( set_getbool( &gc->irc->set, "away_devoice" ) ) &&		/* Don't do a thing when user doesn't want it */
+	if( ( set_getbool( &ic->irc->set, "away_devoice" ) ) &&		/* Don't do a thing when user doesn't want it */
 	    ( u->online ) &&						/* Don't touch offline people */
 	    ( ( ( u->online != oo ) && !u->away ) ||			/* Voice joining people */
 	      ( ( u->online == oo ) && ( oa == !u->away ) ) ) )		/* (De)voice people changing state */
 	{
-		irc_write( gc->irc, ":%s MODE %s %cv %s", gc->irc->myhost,
-		                                                gc->irc->channel, u->away?'-':'+', u->nick );
-	}
-}
-
-void serv_got_im( struct gaim_connection *gc, char *handle, char *msg, guint32 flags, time_t mtime, gint len )
-{
-	irc_t *irc = gc->irc;
+		irc_write( ic->irc, ":%s MODE %s %cv %s", ic->irc->myhost,
+		                                                ic->irc->channel, u->away?'-':'+', u->nick );
+	}
+}
+
+void serv_got_im( struct im_connection *ic, char *handle, char *msg, guint32 flags, time_t mtime, gint len )
+{
+	irc_t *irc = ic->irc;
 	user_t *u;
 	
-	u = user_findhandle( gc, handle );
+	u = user_findhandle( ic, handle );
 	
 	if( !u )
@@ -597,5 +597,5 @@
 		{
 			if( set_getbool( &irc->set, "debug" ) )
-				serv_got_crap( gc, "Ignoring message from unknown handle %s", handle );
+				serv_got_crap( ic, "Ignoring message from unknown handle %s", handle );
 			
 			return;
@@ -613,17 +613,17 @@
 			}
 			
-			add_buddy( gc, NULL, handle, NULL );
-			u = user_findhandle( gc, handle );
+			add_buddy( ic, NULL, handle, NULL );
+			u = user_findhandle( ic, handle );
 			u->is_private = private;
 		}
 		else
 		{
-			serv_got_crap( gc, "Message from unknown handle %s:", handle );
+			serv_got_crap( ic, "Message from unknown handle %s:", handle );
 			u = user_find( irc, irc->mynick );
 		}
 	}
 	
-	if( ( g_strcasecmp( set_getstr( &gc->irc->set, "strip_html" ), "always" ) == 0 ) ||
-	    ( ( gc->flags & OPT_CONN_HTML ) && set_getbool( &gc->irc->set, "strip_html" ) ) )
+	if( ( g_strcasecmp( set_getstr( &ic->irc->set, "strip_html" ), "always" ) == 0 ) ||
+	    ( ( ic->flags & OPT_CONN_HTML ) && set_getbool( &ic->irc->set, "strip_html" ) ) )
 		strip_html( msg );
 
@@ -661,12 +661,12 @@
 }
 
-void serv_got_typing( struct gaim_connection *gc, char *handle, int timeout, int type )
+void serv_got_typing( struct im_connection *ic, char *handle, int timeout, int type )
 {
 	user_t *u;
 	
-	if( !set_getbool( &gc->irc->set, "typing_notice" ) )
+	if( !set_getbool( &ic->irc->set, "typing_notice" ) )
 		return;
 	
-	if( ( u = user_findhandle( gc, handle ) ) ) {
+	if( ( u = user_findhandle( ic, handle ) ) ) {
 		/* If type is:
 		 * 0: user has stopped typing
@@ -677,17 +677,17 @@
 			char buf[256]; 
 			g_snprintf(buf, 256, "\1TYPING %d\1", type); 
-			irc_privmsg( gc->irc, u, "PRIVMSG", gc->irc->nick, NULL, buf );
-		}
-	}
-}
-
-void serv_got_chat_left( struct conversation *c )
-{
-	struct gaim_connection *gc = c->gc;
-	struct conversation *l = NULL;
+			irc_privmsg( ic->irc, u, "PRIVMSG", ic->irc->nick, NULL, buf );
+		}
+	}
+}
+
+void serv_got_chat_left( struct groupchat *c )
+{
+	struct im_connection *ic = c->ic;
+	struct groupchat *l = NULL;
 	GList *ir;
 	
-	if( set_getbool( &gc->irc->set, "debug" ) )
-		serv_got_crap( gc, "You were removed from conversation 0x%x", (int) c );
+	if( set_getbool( &ic->irc->set, "debug" ) )
+		serv_got_crap( ic, "You were removed from conversation 0x%x", (int) c );
 	
 	if( c )
@@ -697,10 +697,10 @@
 			user_t *u, *r;
 			
-			r = user_find( gc->irc, gc->irc->mynick );
-			irc_privmsg( gc->irc, r, "PRIVMSG", c->channel, "", "Cleaning up channel, bye!" );
+			r = user_find( ic->irc, ic->irc->mynick );
+			irc_privmsg( ic->irc, r, "PRIVMSG", c->channel, "", "Cleaning up channel, bye!" );
 			
-			u = user_find( gc->irc, gc->irc->nick );
-			irc_kick( gc->irc, u, c->channel, r );
-			/* irc_part( gc->irc, u, c->channel ); */
+			u = user_find( ic->irc, ic->irc->nick );
+			irc_kick( ic->irc, u, c->channel, r );
+			/* irc_part( ic->irc, u, c->channel ); */
 		}
 		
@@ -708,5 +708,5 @@
 			l->next = c->next;
 		else
-			gc->conversations = c->next;
+			ic->conversations = c->next;
 		
 		for( ir = c->in_room; ir; ir = ir->next )
@@ -719,45 +719,45 @@
 }
 
-void serv_got_chat_in( struct conversation *c, char *who, int whisper, char *msg, time_t mtime )
-{
-	struct gaim_connection *gc = c->gc;
+void serv_got_chat_in( struct groupchat *c, char *who, int whisper, char *msg, time_t mtime )
+{
+	struct im_connection *ic = c->ic;
 	user_t *u;
 	
 	/* Gaim sends own messages through this too. IRC doesn't want this, so kill them */
-	if( g_strcasecmp( who, gc->username ) == 0 )
+	if( g_strcasecmp( who, ic->username ) == 0 )
 		return;
 	
-	u = user_findhandle( gc, who );
-	
-	if( ( g_strcasecmp( set_getstr( &gc->irc->set, "strip_html" ), "always" ) == 0 ) ||
-	    ( ( gc->flags & OPT_CONN_HTML ) && set_getbool( &gc->irc->set, "strip_html" ) ) )
+	u = user_findhandle( ic, who );
+	
+	if( ( g_strcasecmp( set_getstr( &ic->irc->set, "strip_html" ), "always" ) == 0 ) ||
+	    ( ( ic->flags & OPT_CONN_HTML ) && set_getbool( &ic->irc->set, "strip_html" ) ) )
 		strip_html( msg );
 	
 	if( c && u )
-		irc_privmsg( gc->irc, u, "PRIVMSG", c->channel, "", msg );
+		irc_privmsg( ic->irc, u, "PRIVMSG", c->channel, "", msg );
 	else
-		serv_got_crap( gc, "Message from/to conversation %s@0x%x (unknown conv/user): %s", who, (int) c, msg );
-}
-
-struct conversation *serv_got_joined_chat( struct gaim_connection *gc, char *handle )
-{
-	struct conversation *c;
+		serv_got_crap( ic, "Message from/to conversation %s@0x%x (unknown conv/user): %s", who, (int) c, msg );
+}
+
+struct groupchat *serv_got_joined_chat( struct im_connection *ic, char *handle )
+{
+	struct groupchat *c;
 	
 	/* This one just creates the conversation structure, user won't see anything yet */
 	
-	if( gc->conversations )
-	{
-		for( c = gc->conversations; c->next; c = c->next );
-		c = c->next = g_new0( struct conversation, 1 );
+	if( ic->conversations )
+	{
+		for( c = ic->conversations; c->next; c = c->next );
+		c = c->next = g_new0( struct groupchat, 1 );
 	}
 	else
-		gc->conversations = c = g_new0( struct conversation, 1 );
-	
-	c->gc = gc;
+		ic->conversations = c = g_new0( struct groupchat, 1 );
+	
+	c->ic = ic;
 	c->title = g_strdup( handle );
-	c->channel = g_strdup_printf( "&chat_%03d", gc->irc->c_id++ );
-	
-	if( set_getbool( &gc->irc->set, "debug" ) )
-		serv_got_crap( gc, "Creating new conversation: (id=0x%x,handle=%s)", (int) c, handle );
+	c->channel = g_strdup_printf( "&chat_%03d", ic->irc->c_id++ );
+	
+	if( set_getbool( &ic->irc->set, "debug" ) )
+		serv_got_crap( ic, "Creating new conversation: (id=0x%x,handle=%s)", (int) c, handle );
 	
 	return c;
@@ -767,18 +767,18 @@
 /* buddy_chat.c */
 
-void add_chat_buddy( struct conversation *b, char *handle )
-{
-	user_t *u = user_findhandle( b->gc, handle );
+void add_chat_buddy( struct groupchat *b, char *handle )
+{
+	user_t *u = user_findhandle( b->ic, handle );
 	int me = 0;
 	
-	if( set_getbool( &b->gc->irc->set, "debug" ) )
-		serv_got_crap( b->gc, "User %s added to conversation 0x%x", handle, (int) b );
+	if( set_getbool( &b->ic->irc->set, "debug" ) )
+		serv_got_crap( b->ic, "User %s added to conversation 0x%x", handle, (int) b );
 	
 	/* It might be yourself! */
-	if( b->gc->acc->prpl->handle_cmp( handle, b->gc->username ) == 0 )
-	{
-		u = user_find( b->gc->irc, b->gc->irc->nick );
+	if( b->ic->acc->prpl->handle_cmp( handle, b->ic->username ) == 0 )
+	{
+		u = user_find( b->ic->irc, b->ic->irc->nick );
 		if( !b->joined )
-			irc_join( b->gc->irc, u, b->channel );
+			irc_join( b->ic->irc, u, b->channel );
 		b->joined = me = 1;
 	}
@@ -788,6 +788,6 @@
 	if( !u )
 	{
-		add_buddy( b->gc, NULL, handle, NULL );
-		u = user_findhandle( b->gc, handle );
+		add_buddy( b->ic, NULL, handle, NULL );
+		u = user_findhandle( b->ic, handle );
 	}
 	
@@ -796,21 +796,21 @@
 	{
 		if( b->joined )
-			irc_join( b->gc->irc, u, b->channel );
+			irc_join( b->ic->irc, u, b->channel );
 		b->in_room = g_list_append( b->in_room, g_strdup( handle ) );
 	}
 }
 
-void remove_chat_buddy( struct conversation *b, char *handle, char *reason )
+void remove_chat_buddy( struct groupchat *b, char *handle, char *reason )
 {
 	user_t *u;
 	int me = 0;
 	
-	if( set_getbool( &b->gc->irc->set, "debug" ) )
-		serv_got_crap( b->gc, "User %s removed from conversation 0x%x (%s)", handle, (int) b, reason ? reason : "" );
+	if( set_getbool( &b->ic->irc->set, "debug" ) )
+		serv_got_crap( b->ic, "User %s removed from conversation 0x%x (%s)", handle, (int) b, reason ? reason : "" );
 	
 	/* It might be yourself! */
-	if( g_strcasecmp( handle, b->gc->username ) == 0 )
-	{
-		u = user_find( b->gc->irc, b->gc->irc->nick );
+	if( g_strcasecmp( handle, b->ic->username ) == 0 )
+	{
+		u = user_find( b->ic->irc, b->ic->irc->nick );
 		b->joined = 0;
 		me = 1;
@@ -818,13 +818,13 @@
 	else
 	{
-		u = user_findhandle( b->gc, handle );
+		u = user_findhandle( b->ic, handle );
 	}
 	
 	if( remove_chat_buddy_silent( b, handle ) )
 		if( ( b->joined || me ) && u )
-			irc_part( b->gc->irc, u, b->channel );
-}
-
-static int remove_chat_buddy_silent( struct conversation *b, char *handle )
+			irc_part( b->ic->irc, u, b->channel );
+}
+
+static int remove_chat_buddy_silent( struct groupchat *b, char *handle )
 {
 	GList *i;
@@ -850,8 +850,8 @@
 /* Misc. BitlBee stuff which shouldn't really be here */
 
-struct conversation *chat_by_channel( char *channel )
-{
-	struct gaim_connection *gc;
-	struct conversation *c;
+struct groupchat *chat_by_channel( char *channel )
+{
+	struct im_connection *ic;
+	struct groupchat *c;
 	GSList *l;
 	
@@ -859,6 +859,6 @@
 	for( l = connections; l; l = l->next )
 	{
-		gc = l->data;
-		for( c = gc->conversations; c && g_strcasecmp( c->channel, channel ) != 0; c = c->next );
+		ic = l->data;
+		for( c = ic->conversations; c && g_strcasecmp( c->channel, channel ) != 0; c = c->next );
 		if( c )
 			return c;
@@ -899,5 +899,5 @@
 		while( u )
 		{
-			if( u->gc && u->online && !u->away )
+			if( u->ic && u->online && !u->away )
 			{
 				if( ( strlen( list ) + strlen( u->nick ) ) >= 79 )
@@ -933,10 +933,10 @@
    them all from some wrappers. We'll start to define some down here: */
 
-int bim_buddy_msg( struct gaim_connection *gc, char *handle, char *msg, int flags )
+int bim_buddy_msg( struct im_connection *ic, char *handle, char *msg, int flags )
 {
 	char *buf = NULL;
 	int st;
 	
-	if( ( gc->flags & OPT_CONN_HTML ) && ( g_strncasecmp( msg, "<html>", 6 ) != 0 ) )
+	if( ( ic->flags & OPT_CONN_HTML ) && ( g_strncasecmp( msg, "<html>", 6 ) != 0 ) )
 	{
 		buf = escape_html( msg );
@@ -944,5 +944,5 @@
 	}
 	
-	st = gc->acc->prpl->send_im( gc, handle, msg, strlen( msg ), flags );
+	st = ic->acc->prpl->send_im( ic, handle, msg, flags );
 	g_free( buf );
 	
@@ -950,10 +950,10 @@
 }
 
-int bim_chat_msg( struct conversation *c, char *msg )
+int bim_chat_msg( struct groupchat *c, char *msg, int flags )
 {
 	char *buf = NULL;
 	int st;
 	
-	if( ( c->gc->flags & OPT_CONN_HTML ) && ( g_strncasecmp( msg, "<html>", 6 ) != 0 ) )
+	if( ( c->ic->flags & OPT_CONN_HTML ) && ( g_strncasecmp( msg, "<html>", 6 ) != 0 ) )
 	{
 		buf = escape_html( msg );
@@ -961,13 +961,13 @@
 	}
 	
-	st = c->gc->acc->prpl->chat_send( c, msg );
+	c->ic->acc->prpl->chat_send( c, msg, flags );
 	g_free( buf );
 	
-	return st;
+	return 1;
 }
 
 static char *bim_away_alias_find( GList *gcm, char *away );
 
-int bim_set_away( struct gaim_connection *gc, char *away )
+int bim_set_away( struct im_connection *ic, char *away )
 {
 	GList *m, *ms;
@@ -975,5 +975,5 @@
 	
 	if( !away ) away = "";
-	ms = m = gc->acc->prpl->away_states( gc );
+	ms = m = ic->acc->prpl->away_states( ic );
 	
 	while( m )
@@ -996,5 +996,5 @@
 	if( m )
 	{
-		gc->acc->prpl->set_away( gc, m->data, *away ? away : NULL );
+		ic->acc->prpl->set_away( ic, m->data, *away ? away : NULL );
 	}
 	else
@@ -1003,10 +1003,10 @@
 		if( s )
 		{
-			gc->acc->prpl->set_away( gc, s, away );
-			if( set_getbool( &gc->irc->set, "debug" ) )
-				serv_got_crap( gc, "Setting away state to %s", s );
+			ic->acc->prpl->set_away( ic, s, away );
+			if( set_getbool( &ic->irc->set, "debug" ) )
+				serv_got_crap( ic, "Setting away state to %s", s );
 		}
 		else
-			gc->acc->prpl->set_away( gc, GAIM_AWAY_CUSTOM, away );
+			ic->acc->prpl->set_away( ic, GAIM_AWAY_CUSTOM, away );
 	}
 	
@@ -1056,47 +1056,47 @@
 }
 
-void bim_add_allow( struct gaim_connection *gc, char *handle )
-{
-	if( g_slist_find_custom( gc->permit, handle, (GCompareFunc) gc->acc->prpl->handle_cmp ) == NULL )
-	{
-		gc->permit = g_slist_prepend( gc->permit, g_strdup( handle ) );
-	}
-	
-	gc->acc->prpl->add_permit( gc, handle );
-}
-
-void bim_rem_allow( struct gaim_connection *gc, char *handle )
+void bim_add_allow( struct im_connection *ic, char *handle )
+{
+	if( g_slist_find_custom( ic->permit, handle, (GCompareFunc) ic->acc->prpl->handle_cmp ) == NULL )
+	{
+		ic->permit = g_slist_prepend( ic->permit, g_strdup( handle ) );
+	}
+	
+	ic->acc->prpl->add_permit( ic, handle );
+}
+
+void bim_rem_allow( struct im_connection *ic, char *handle )
 {
 	GSList *l;
 	
-	if( ( l = g_slist_find_custom( gc->permit, handle, (GCompareFunc) gc->acc->prpl->handle_cmp ) ) )
+	if( ( l = g_slist_find_custom( ic->permit, handle, (GCompareFunc) ic->acc->prpl->handle_cmp ) ) )
 	{
 		g_free( l->data );
-		gc->permit = g_slist_delete_link( gc->permit, l );
-	}
-	
-	gc->acc->prpl->rem_permit( gc, handle );
-}
-
-void bim_add_block( struct gaim_connection *gc, char *handle )
-{
-	if( g_slist_find_custom( gc->deny, handle, (GCompareFunc) gc->acc->prpl->handle_cmp ) == NULL )
-	{
-		gc->deny = g_slist_prepend( gc->deny, g_strdup( handle ) );
-	}
-	
-	gc->acc->prpl->add_deny( gc, handle );
-}
-
-void bim_rem_block( struct gaim_connection *gc, char *handle )
+		ic->permit = g_slist_delete_link( ic->permit, l );
+	}
+	
+	ic->acc->prpl->rem_permit( ic, handle );
+}
+
+void bim_add_block( struct im_connection *ic, char *handle )
+{
+	if( g_slist_find_custom( ic->deny, handle, (GCompareFunc) ic->acc->prpl->handle_cmp ) == NULL )
+	{
+		ic->deny = g_slist_prepend( ic->deny, g_strdup( handle ) );
+	}
+	
+	ic->acc->prpl->add_deny( ic, handle );
+}
+
+void bim_rem_block( struct im_connection *ic, char *handle )
 {
 	GSList *l;
 	
-	if( ( l = g_slist_find_custom( gc->deny, handle, (GCompareFunc) gc->acc->prpl->handle_cmp ) ) )
+	if( ( l = g_slist_find_custom( ic->deny, handle, (GCompareFunc) ic->acc->prpl->handle_cmp ) ) )
 	{
 		g_free( l->data );
-		gc->deny = g_slist_delete_link( gc->deny, l );
-	}
-	
-	gc->acc->prpl->rem_deny( gc, handle );
-}
+		ic->deny = g_slist_delete_link( ic->deny, l );
+	}
+	
+	ic->acc->prpl->rem_deny( ic, handle );
+}
Index: protocols/nogaim.h
===================================================================
--- protocols/nogaim.h	(revision fa29d09342c79b886efacee4cfc3078be5f5a722)
+++ protocols/nogaim.h	(revision 0da65d5fb37691ed4d31f7ab4058732f1440db6b)
@@ -62,5 +62,5 @@
 
 /* ok. now the fun begins. first we create a connection structure */
-struct gaim_connection
+struct im_connection
 {
 	account_t *acc;
@@ -92,10 +92,10 @@
 	irc_t *irc;
 	
-	struct conversation *conversations;
+	struct groupchat *conversations;
 };
 
 /* struct buddy_chat went away and got merged with this. */
-struct conversation {
-	struct gaim_connection *gc;
+struct groupchat {
+	struct im_connection *ic;
 
 	/* stuff used just for chat */
@@ -104,5 +104,5 @@
 	
 	/* BitlBee */
-	struct conversation *next;
+	struct groupchat *next;
 	char *channel;
 	char *title;
@@ -121,5 +121,5 @@
 	guint caps; /* woohoo! */
 	void *proto_data; /* what a hack */
-	struct gaim_connection *gc; /* the connection it belongs to */
+	struct im_connection *ic; /* the connection it belongs to */
 };
 
@@ -128,40 +128,48 @@
 	const char *name;
 
-	void (* acc_init)	(account_t *);
+	/* Added this one to be able to add per-account settings, don't think
+	   it should be used for anything else. */
+	void (* init)		(account_t *);
+	/* These should all be pretty obvious. */
 	void (* login)		(account_t *);
-	void (* keepalive)	(struct gaim_connection *);
-	void (* close)		(struct gaim_connection *);
-	
-	int  (* send_im)	(struct gaim_connection *, char *who, char *message, int len, int away);
-	void (* set_away)	(struct gaim_connection *, char *state, char *message);
-	void (* get_away)       (struct gaim_connection *, char *who);
-	int  (* send_typing)	(struct gaim_connection *, char *who, int typing);
-	
-	void (* add_buddy)	(struct gaim_connection *, char *name);
-	void (* group_buddy)	(struct gaim_connection *, char *who, char *old_group, char *new_group);
-	void (* remove_buddy)	(struct gaim_connection *, char *name, char *group);
-	void (* add_permit)	(struct gaim_connection *, char *name);
-	void (* add_deny)	(struct gaim_connection *, char *name);
-	void (* rem_permit)	(struct gaim_connection *, char *name);
-	void (* rem_deny)	(struct gaim_connection *, char *name);
-	void (* set_permit_deny)(struct gaim_connection *);
-	
-	void (* set_info)	(struct gaim_connection *, char *info);
-	void (* get_info)	(struct gaim_connection *, char *who);
-	void (* alias_buddy)	(struct gaim_connection *, char *who);	/* save/store buddy's alias on server list/roster */
+	void (* keepalive)	(struct im_connection *);
+	void (* logout)		(struct im_connection *);
+	
+	int  (* send_im)	(struct im_connection *, char *to, char *message, int flags);
+	void (* set_away)	(struct im_connection *, char *state, char *message);
+	void (* get_away)       (struct im_connection *, char *who);
+	int  (* send_typing)	(struct im_connection *, char *who, int typing);
+	
+	/* For now BitlBee doesn't really handle groups, just set it to NULL. */
+	void (* add_buddy)	(struct im_connection *, char *name, char *group);
+	void (* remove_buddy)	(struct im_connection *, char *name, char *group);
+	
+	/* Block list stuff. */
+	void (* add_permit)	(struct im_connection *, char *who);
+	void (* add_deny)	(struct im_connection *, char *who);
+	void (* rem_permit)	(struct im_connection *, char *who);
+	void (* rem_deny)	(struct im_connection *, char *who);
+	/* Doesn't actually have UI hooks. */
+	void (* set_permit_deny)(struct im_connection *);
+	
+	/* Request profile info. Free-formatted stuff, the IM module gives back
+	   this info via imc_log(). */
+	void (* get_info)	(struct im_connection *, char *who);
+	void (* set_my_name)	(struct im_connection *, char *name);
+	void (* set_name)	(struct im_connection *, char *who, char *name);
 	
 	/* Group chat stuff. */
-	void (* chat_invite)	(struct conversation *, char *who, char *message);
-	void (* chat_leave)	(struct conversation *);
-	int  (* chat_send)	(struct conversation *, char *message);
-	struct conversation *
-	     (* chat_open)	(struct gaim_connection *, char *who);
-	struct conversation *
-	     (* chat_join)	(struct gaim_connection *, char *chat, char *nick, char *password);
+	void (* chat_invite)	(struct groupchat *, char *who, char *message);
+	void (* chat_leave)	(struct groupchat *);
+	void (* chat_send)	(struct groupchat *, char *message, int flags);
+	struct groupchat *
+	     (* chat_with)	(struct im_connection *, char *who);
+	struct groupchat *
+	     (* chat_join)	(struct im_connection *, char *chat, char *nick, char *password);
 	
 	/* DIE! */
-	char *(* get_status_string) (struct gaim_connection *gc, int stat);
-	
-	GList *(* away_states)(struct gaim_connection *gc);
+	char *(* get_status_string) (struct im_connection *ic, int stat);
+	
+	GList *(* away_states)(struct im_connection *ic);
 	
 	/* Mainly for AOL, since they think "Bung hole" == "Bu ngho le". *sigh* */
@@ -182,12 +190,12 @@
 
 /* nogaim.c */
-int bim_set_away( struct gaim_connection *gc, char *away );
-int bim_buddy_msg( struct gaim_connection *gc, char *handle, char *msg, int flags );
-int bim_chat_msg( struct conversation *c, char *msg );
-
-void bim_add_allow( struct gaim_connection *gc, char *handle );
-void bim_rem_allow( struct gaim_connection *gc, char *handle );
-void bim_add_block( struct gaim_connection *gc, char *handle );
-void bim_rem_block( struct gaim_connection *gc, char *handle );
+int bim_set_away( struct im_connection *ic, char *away );
+int bim_buddy_msg( struct im_connection *ic, char *handle, char *msg, int flags );
+int bim_chat_msg( struct groupchat *c, char *msg, int flags );
+
+void bim_add_allow( struct im_connection *ic, char *handle );
+void bim_rem_allow( struct im_connection *ic, char *handle );
+void bim_add_block( struct im_connection *ic, char *handle );
+void bim_rem_block( struct im_connection *ic, char *handle );
 
 void nogaim_init();
@@ -198,42 +206,42 @@
 
 /* multi.c */
-G_MODULE_EXPORT struct gaim_connection *new_gaim_conn( account_t *acc );
-G_MODULE_EXPORT void destroy_gaim_conn( struct gaim_connection *gc );
-G_MODULE_EXPORT void set_login_progress( struct gaim_connection *gc, int step, char *msg );
-G_MODULE_EXPORT void hide_login_progress( struct gaim_connection *gc, char *msg );
-G_MODULE_EXPORT void hide_login_progress_error( struct gaim_connection *gc, char *msg );
-G_MODULE_EXPORT void serv_got_crap( struct gaim_connection *gc, char *format, ... ) G_GNUC_PRINTF( 2, 3 );
-G_MODULE_EXPORT void account_online( struct gaim_connection *gc );
-G_MODULE_EXPORT void signoff( struct gaim_connection *gc );
+G_MODULE_EXPORT struct im_connection *new_gaim_conn( account_t *acc );
+G_MODULE_EXPORT void destroy_gaim_conn( struct im_connection *ic );
+G_MODULE_EXPORT void set_login_progress( struct im_connection *ic, int step, char *msg );
+G_MODULE_EXPORT void hide_login_progress( struct im_connection *ic, char *msg );
+G_MODULE_EXPORT void hide_login_progress_error( struct im_connection *ic, char *msg );
+G_MODULE_EXPORT void serv_got_crap( struct im_connection *ic, char *format, ... ) G_GNUC_PRINTF( 2, 3 );
+G_MODULE_EXPORT void account_online( struct im_connection *ic );
+G_MODULE_EXPORT void signoff( struct im_connection *ic );
 
 /* dialogs.c */
-G_MODULE_EXPORT void do_error_dialog( struct gaim_connection *gc, char *msg, char *title );
-G_MODULE_EXPORT void do_ask_dialog( struct gaim_connection *gc, char *msg, void *data, void *doit, void *dont );
+G_MODULE_EXPORT void do_error_dialog( struct im_connection *ic, char *msg, char *title );
+G_MODULE_EXPORT void do_ask_dialog( struct im_connection *ic, char *msg, void *data, void *doit, void *dont );
 
 /* list.c */
-G_MODULE_EXPORT void add_buddy( struct gaim_connection *gc, char *group, char *handle, char *realname );
-G_MODULE_EXPORT struct buddy *find_buddy( struct gaim_connection *gc, char *handle );
-G_MODULE_EXPORT void signoff_blocked( struct gaim_connection *gc );
-
-G_MODULE_EXPORT void serv_buddy_rename( struct gaim_connection *gc, char *handle, char *realname );
+G_MODULE_EXPORT void add_buddy( struct im_connection *ic, char *group, char *handle, char *realname );
+G_MODULE_EXPORT struct buddy *find_buddy( struct im_connection *ic, char *handle );
+G_MODULE_EXPORT void signoff_blocked( struct im_connection *ic );
+
+G_MODULE_EXPORT void serv_buddy_rename( struct im_connection *ic, char *handle, char *realname );
 
 /* buddy_chat.c */
-G_MODULE_EXPORT void add_chat_buddy( struct conversation *b, char *handle );
-G_MODULE_EXPORT void remove_chat_buddy( struct conversation *b, char *handle, char *reason );
+G_MODULE_EXPORT void add_chat_buddy( struct groupchat *b, char *handle );
+G_MODULE_EXPORT void remove_chat_buddy( struct groupchat *b, char *handle, char *reason );
 
 /* prpl.c */
-G_MODULE_EXPORT void show_got_added( struct gaim_connection *gc, char *handle, const char *realname );
+G_MODULE_EXPORT void show_got_added( struct im_connection *ic, char *handle, const char *realname );
 
 /* server.c */
-G_MODULE_EXPORT void serv_got_update( struct gaim_connection *gc, char *handle, int loggedin, int evil, time_t signon, time_t idle, int type, guint caps );
-G_MODULE_EXPORT void serv_got_im( struct gaim_connection *gc, char *handle, char *msg, guint32 flags, time_t mtime, gint len );
-G_MODULE_EXPORT void serv_got_typing( struct gaim_connection *gc, char *handle, int timeout, int type );
-G_MODULE_EXPORT void serv_got_chat_invite( struct gaim_connection *gc, char *handle, char *who, char *msg, GList *data );
-G_MODULE_EXPORT struct conversation *serv_got_joined_chat( struct gaim_connection *gc, char *handle );
-G_MODULE_EXPORT void serv_got_chat_in( struct conversation *c, char *who, int whisper, char *msg, time_t mtime );
-G_MODULE_EXPORT void serv_got_chat_left( struct conversation *c );
-
-struct conversation *chat_by_channel( char *channel );
-struct conversation *chat_by_id( int id );
+G_MODULE_EXPORT void serv_got_update( struct im_connection *ic, char *handle, int loggedin, int evil, time_t signon, time_t idle, int type, guint caps );
+G_MODULE_EXPORT void serv_got_im( struct im_connection *ic, char *handle, char *msg, guint32 flags, time_t mtime, gint len );
+G_MODULE_EXPORT void serv_got_typing( struct im_connection *ic, char *handle, int timeout, int type );
+G_MODULE_EXPORT void serv_got_chat_invite( struct im_connection *ic, char *handle, char *who, char *msg, GList *data );
+G_MODULE_EXPORT struct groupchat *serv_got_joined_chat( struct im_connection *ic, char *handle );
+G_MODULE_EXPORT void serv_got_chat_in( struct groupchat *c, char *who, int whisper, char *msg, time_t mtime );
+G_MODULE_EXPORT void serv_got_chat_left( struct groupchat *c );
+
+struct groupchat *chat_by_channel( char *channel );
+struct groupchat *chat_by_id( int id );
 
 #endif
Index: protocols/oscar/aim.h
===================================================================
--- protocols/oscar/aim.h	(revision fa29d09342c79b886efacee4cfc3078be5f5a722)
+++ protocols/oscar/aim.h	(revision 0da65d5fb37691ed4d31f7ab4058732f1440db6b)
@@ -574,5 +574,5 @@
 
 struct aim_chat_invitation {
-	struct gaim_connection * gc;
+	struct im_connection * ic;
 	char * name;
 	guint8 exchange;
Index: protocols/oscar/im.c
===================================================================
--- protocols/oscar/im.c	(revision fa29d09342c79b886efacee4cfc3078be5f5a722)
+++ protocols/oscar/im.c	(revision 0da65d5fb37691ed4d31f7ab4058732f1440db6b)
@@ -1417,5 +1417,5 @@
     guint8 *plugin;
     int i = 0, tmp = 0;
-    struct gaim_connection *gc = sess->aux_data;
+    struct im_connection *ic = sess->aux_data;
 
     /* at the moment we just can deal with requests, not with cancel or accept */
@@ -1469,5 +1469,5 @@
 	    case 0x9c:	/* ICQ 5 seems to send this */
                 aim_send_im_ch2_statusmessage(sess, userinfo->sn, args->cookie,
-                        gc->away ? gc->away : "", sess->aim_icq_state, dc);
+                        ic->away ? ic->away : "", sess->aim_icq_state, dc);
                 break;
 
Index: protocols/oscar/oscar.c
===================================================================
--- protocols/oscar/oscar.c	(revision fa29d09342c79b886efacee4cfc3078be5f5a722)
+++ protocols/oscar/oscar.c	(revision 0da65d5fb37691ed4d31f7ab4058732f1440db6b)
@@ -116,6 +116,6 @@
 	int inpa;
 	int id;
-	struct gaim_connection *gc; /* i hate this. */
-	struct conversation *cnv; /* bah. */
+	struct im_connection *ic; /* i hate this. */
+	struct groupchat *cnv; /* bah. */
 	int maxlen;
 	int maxvis;
@@ -123,5 +123,5 @@
 
 struct ask_direct {
-	struct gaim_connection *gc;
+	struct im_connection *ic;
 	char *sn;
 	char ip[64];
@@ -130,5 +130,5 @@
 
 struct icq_auth {
-	struct gaim_connection *gc;
+	struct im_connection *ic;
 	guint32 uin;
 };
@@ -158,7 +158,7 @@
 }
 
-static struct chat_connection *find_oscar_chat_by_conn(struct gaim_connection *gc,
+static struct chat_connection *find_oscar_chat_by_conn(struct im_connection *ic,
 							aim_conn_t *conn) {
-	GSList *g = ((struct oscar_data *)gc->proto_data)->oscar_chats;
+	GSList *g = ((struct oscar_data *)ic->proto_data)->oscar_chats;
 	struct chat_connection *c = NULL;
 
@@ -243,13 +243,13 @@
 	aim_conn_t *conn = (aim_conn_t *)data;
 	aim_session_t *sess = aim_conn_getsess(conn);
-	struct gaim_connection *gc = sess ? sess->aux_data : NULL;
+	struct im_connection *ic = sess ? sess->aux_data : NULL;
 	struct oscar_data *odata;
 
-	if (!gc) {
-		/* gc is null. we return, else we seg SIGSEG on next line. */
+	if (!ic) {
+		/* ic is null. we return, else we seg SIGSEG on next line. */
 		return FALSE;
 	}
       
-	if (!g_slist_find(get_connections(), gc)) {
+	if (!g_slist_find(get_connections(), ic)) {
 		/* oh boy. this is probably bad. i guess the only thing we 
 		 * can really do is return? */
@@ -257,5 +257,5 @@
 	}
 
-	odata = (struct oscar_data *)gc->proto_data;
+	odata = (struct oscar_data *)ic->proto_data;
 
 	if (condition & GAIM_INPUT_READ) {
@@ -263,12 +263,12 @@
 			aim_rxdispatch(odata->sess);
                                if (odata->killme)
-                                       signoff(gc);
+                                       signoff(ic);
 		} else {
 			if ((conn->type == AIM_CONN_TYPE_BOS) ||
 				   !(aim_getconn_type(odata->sess, AIM_CONN_TYPE_BOS))) {
-				hide_login_progress_error(gc, _("Disconnected."));
-				signoff(gc);
+				hide_login_progress_error(ic, _("Disconnected."));
+				signoff(ic);
 			} else if (conn->type == AIM_CONN_TYPE_CHAT) {
-				struct chat_connection *c = find_oscar_chat_by_conn(gc, conn);
+				struct chat_connection *c = find_oscar_chat_by_conn(ic, conn);
 				char buf[BUF_LONG];
 				c->conn = NULL;
@@ -313,26 +313,26 @@
 static gboolean oscar_login_connect(gpointer data, gint source, b_input_condition cond)
 {
-	struct gaim_connection *gc = data;
+	struct im_connection *ic = data;
 	struct oscar_data *odata;
 	aim_session_t *sess;
 	aim_conn_t *conn;
 
-	if (!g_slist_find(get_connections(), gc)) {
+	if (!g_slist_find(get_connections(), ic)) {
 		closesocket(source);
 		return FALSE;
 	}
 
-	odata = gc->proto_data;
+	odata = ic->proto_data;
 	sess = odata->sess;
 	conn = aim_getconn_type_all(sess, AIM_CONN_TYPE_AUTH);
 
 	if (source < 0) {
-		hide_login_progress(gc, _("Couldn't connect to host"));
-		signoff(gc);
+		hide_login_progress(ic, _("Couldn't connect to host"));
+		signoff(ic);
 		return FALSE;
 	}
 
 	aim_conn_completeconnect(sess, conn);
-	gc->inpa = b_input_add(conn->fd, GAIM_INPUT_READ,
+	ic->inpa = b_input_add(conn->fd, GAIM_INPUT_READ,
 			oscar_callback, conn);
 	
@@ -340,5 +340,5 @@
 }
 
-static void oscar_acc_init(account_t *acc)
+static void oscar_init(account_t *acc)
 {
 	set_t *s;
@@ -357,6 +357,6 @@
 	aim_conn_t *conn;
 	char buf[256];
-	struct gaim_connection *gc = new_gaim_conn(acc);
-	struct oscar_data *odata = gc->proto_data = g_new0(struct oscar_data, 1);
+	struct im_connection *ic = new_gaim_conn(acc);
+	struct oscar_data *odata = ic->proto_data = g_new0(struct oscar_data, 1);
 
 	if (isdigit(acc->user[0])) {
@@ -365,7 +365,7 @@
 		   We don't do those anymore, but let's stick with it, just in case
 		   it accidentally fixes something else too... </bitlbee> */
-		gc->password[8] = 0;
+		ic->password[8] = 0;
 	} else {
-		gc->flags |= OPT_CONN_HTML;
+		ic->flags |= OPT_CONN_HTML;
 	}
 
@@ -378,16 +378,16 @@
 	aim_tx_setenqueue(sess, AIM_TX_IMMEDIATE, NULL);
 	odata->sess = sess;
-	sess->aux_data = gc;
+	sess->aux_data = ic;
 
 	conn = aim_newconn(sess, AIM_CONN_TYPE_AUTH, NULL);
 	if (conn == NULL) {
-		hide_login_progress(gc, _("Unable to login to AIM"));
-		signoff(gc);
+		hide_login_progress(ic, _("Unable to login to AIM"));
+		signoff(ic);
 		return;
 	}
 	
 	if (acc->server == NULL) {
-		hide_login_progress(gc, "No servername specified");
-		signoff(gc);
+		hide_login_progress(ic, "No servername specified");
+		signoff(ic);
 		return;
 	}
@@ -395,9 +395,9 @@
 	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);
-	}
-	
-	g_snprintf(buf, sizeof(buf), _("Signon: %s"), gc->username);
-	set_login_progress(gc, 2, buf);
+		serv_got_crap(ic, "Warning: Unknown OSCAR server: `%s'. Please review your configuration if the connection fails.",acc->server);
+	}
+	
+	g_snprintf(buf, sizeof(buf), _("Signon: %s"), ic->username);
+	set_login_progress(ic, 2, buf);
 
 	aim_conn_addhandler(sess, conn, 0x0017, 0x0007, gaim_parse_login, 0);
@@ -405,15 +405,15 @@
 
 	conn->status |= AIM_CONN_STATUS_INPROGRESS;
-	conn->fd = proxy_connect(acc->server, AIM_LOGIN_PORT, oscar_login_connect, gc);
+	conn->fd = proxy_connect(acc->server, AIM_LOGIN_PORT, oscar_login_connect, ic);
 	if (conn->fd < 0) {
-		hide_login_progress(gc, _("Couldn't connect to host"));
-		signoff(gc);
+		hide_login_progress(ic, _("Couldn't connect to host"));
+		signoff(ic);
 		return;
 	}
-	aim_request_login(sess, conn, gc->username);
-}
-
-static void oscar_close(struct gaim_connection *gc) {
-	struct oscar_data *odata = (struct oscar_data *)gc->proto_data;
+	aim_request_login(sess, conn, ic->username);
+}
+
+static void oscar_logout(struct im_connection *ic) {
+	struct oscar_data *odata = (struct oscar_data *)ic->proto_data;
 	
 	while (odata->oscar_chats) {
@@ -438,6 +438,6 @@
 	if (odata->oldp)
 		g_free(odata->oldp);
-	if (gc->inpa > 0)
-		b_event_remove(gc->inpa);
+	if (ic->inpa > 0)
+		b_event_remove(ic->inpa);
 	if (odata->cnpa > 0)
 		b_event_remove(odata->cnpa);
@@ -447,33 +447,33 @@
 	g_free(odata->sess);
 	odata->sess = NULL;
-	g_free(gc->proto_data);
-	gc->proto_data = NULL;
+	g_free(ic->proto_data);
+	ic->proto_data = NULL;
 }
 
 static gboolean oscar_bos_connect(gpointer data, gint source, b_input_condition cond) {
-	struct gaim_connection *gc = data;
+	struct im_connection *ic = data;
 	struct oscar_data *odata;
 	aim_session_t *sess;
 	aim_conn_t *bosconn;
 
-	if (!g_slist_find(get_connections(), gc)) {
+	if (!g_slist_find(get_connections(), ic)) {
 		closesocket(source);
 		return FALSE;
 	}
 
-	odata = gc->proto_data;
+	odata = ic->proto_data;
 	sess = odata->sess;
 	bosconn = odata->conn;
 
 	if (source < 0) {
-		hide_login_progress(gc, _("Could Not Connect"));
-		signoff(gc);
+		hide_login_progress(ic, _("Could Not Connect"));
+		signoff(ic);
 		return FALSE;
 	}
 
 	aim_conn_completeconnect(sess, bosconn);
-	gc->inpa = b_input_add(bosconn->fd, GAIM_INPUT_READ,
+	ic->inpa = b_input_add(bosconn->fd, GAIM_INPUT_READ,
 			oscar_callback, bosconn);
-	set_login_progress(gc, 4, _("Connection established, cookie sent"));
+	set_login_progress(ic, 4, _("Connection established, cookie sent"));
 	
 	return FALSE;
@@ -486,6 +486,6 @@
 	aim_conn_t *bosconn;
 
-	struct gaim_connection *gc = sess->aux_data;
-        struct oscar_data *od = gc->proto_data;
+	struct im_connection *ic = sess->aux_data;
+        struct oscar_data *od = ic->proto_data;
 	port = AIM_LOGIN_PORT;
 
@@ -498,21 +498,21 @@
 		case 0x05:
 			/* Incorrect nick/password */
-			hide_login_progress(gc, _("Incorrect nickname or password."));
+			hide_login_progress(ic, _("Incorrect nickname or password."));
 //			plugin_event(event_error, (void *)980, 0, 0, 0);
 			break;
 		case 0x11:
 			/* Suspended account */
-			hide_login_progress(gc, _("Your account is currently suspended."));
+			hide_login_progress(ic, _("Your account is currently suspended."));
 			break;
 		case 0x18:
 			/* connecting too frequently */
-			hide_login_progress(gc, _("You have been connecting and disconnecting too frequently. Wait ten minutes and try again. If you continue to try, you will need to wait even longer."));
+			hide_login_progress(ic, _("You have been connecting and disconnecting too frequently. Wait ten minutes and try again. If you continue to try, you will need to wait even longer."));
 			break;
 		case 0x1c:
 			/* client too old */
-			hide_login_progress(gc, _("The client version you are using is too old. Please upgrade at " WEBSITE));
+			hide_login_progress(ic, _("The client version you are using is too old. Please upgrade at " WEBSITE));
 			break;
 		default:
-			hide_login_progress(gc, _("Authentication Failed"));
+			hide_login_progress(ic, _("Authentication Failed"));
 			break;
 		}
@@ -526,5 +526,5 @@
 	bosconn = aim_newconn(sess, AIM_CONN_TYPE_BOS, NULL);
 	if (bosconn == NULL) {
-		hide_login_progress(gc, _("Internal Error"));
+		hide_login_progress(ic, _("Internal Error"));
 		od->killme = TRUE;
 		return 0;
@@ -560,5 +560,5 @@
 	aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_MSG, AIM_CB_MSG_MTN, gaim_parsemtn, 0);
 
-	((struct oscar_data *)gc->proto_data)->conn = bosconn;
+	((struct oscar_data *)ic->proto_data)->conn = bosconn;
 	for (i = 0; i < (int)strlen(info->bosip); i++) {
 		if (info->bosip[i] == ':') {
@@ -569,13 +569,13 @@
 	host = g_strndup(info->bosip, i);
 	bosconn->status |= AIM_CONN_STATUS_INPROGRESS;
-	bosconn->fd = proxy_connect(host, port, oscar_bos_connect, gc);
+	bosconn->fd = proxy_connect(host, port, oscar_bos_connect, ic);
 	g_free(host);
 	if (bosconn->fd < 0) {
-		hide_login_progress(gc, _("Could Not Connect"));
+		hide_login_progress(ic, _("Could Not Connect"));
 		od->killme = TRUE;
 		return 0;
 	}
 	aim_sendcookie(sess, bosconn, info->cookie);
-	b_event_remove(gc->inpa);
+	b_event_remove(ic->inpa);
 
 	return 1;
@@ -583,5 +583,5 @@
 
 struct pieceofcrap {
-	struct gaim_connection *gc;
+	struct im_connection *ic;
 	unsigned long offset;
 	unsigned long len;
@@ -595,5 +595,5 @@
 {
 	struct pieceofcrap *pos = data;
-	struct oscar_data *od = pos->gc->proto_data;
+	struct oscar_data *od = pos->ic->proto_data;
 	char in = '\0';
 	int x = 0;
@@ -610,5 +610,5 @@
 	}
 	if (in != '\n') {
-		do_error_dialog(pos->gc, "Gaim was unable to get a valid hash for logging into AIM."
+		do_error_dialog(pos->ic, "Gaim was unable to get a valid hash for logging into AIM."
 				" You may be disconnected shortly.", "Login Error");
 		b_event_remove(pos->inpa);
@@ -633,5 +633,5 @@
 
 	if (source < 0) {
-		do_error_dialog(pos->gc, "Gaim was unable to get a valid hash for logging into AIM."
+		do_error_dialog(pos->ic, "Gaim was unable to get a valid hash for logging into AIM."
 				" You may be disconnected shortly.", "Login Error");
 		if (pos->modname)
@@ -699,5 +699,5 @@
 
 	pos = g_new0(struct pieceofcrap, 1);
-	pos->gc = sess->aux_data;
+	pos->ic = sess->aux_data;
 	pos->conn = fr->conn;
 
@@ -727,5 +727,5 @@
 	char *key;
 	va_list ap;
-	struct gaim_connection *gc = sess->aux_data;
+	struct im_connection *ic = sess->aux_data;
 
 	va_start(ap, fr);
@@ -733,5 +733,5 @@
 	va_end(ap);
 
-	aim_send_login(sess, fr->conn, gc->username, gc->password, &info, key);
+	aim_send_login(sess, fr->conn, ic->username, ic->password, &info, key);
 
 	return 1;
@@ -739,5 +739,5 @@
 
 static int conninitdone_chat(aim_session_t *sess, aim_frame_t *fr, ...) {
-	struct gaim_connection *gc = sess->aux_data;
+	struct im_connection *ic = sess->aux_data;
 	struct chat_connection *chatcon;
 	static int id = 1;
@@ -751,7 +751,7 @@
 	aim_clientready(sess, fr->conn);
 
-	chatcon = find_oscar_chat_by_conn(gc, fr->conn);
+	chatcon = find_oscar_chat_by_conn(ic, fr->conn);
 	chatcon->id = id;
-	chatcon->cnv = serv_got_joined_chat(gc, chatcon->show);
+	chatcon->cnv = serv_got_joined_chat(ic, chatcon->show);
 	chatcon->cnv->data = chatcon;
 
@@ -772,15 +772,15 @@
 
 static gboolean oscar_chatnav_connect(gpointer data, gint source, b_input_condition cond) {
-	struct gaim_connection *gc = data;
+	struct im_connection *ic = data;
 	struct oscar_data *odata;
 	aim_session_t *sess;
 	aim_conn_t *tstconn;
 
-	if (!g_slist_find(get_connections(), gc)) {
+	if (!g_slist_find(get_connections(), ic)) {
 		closesocket(source);
 		return FALSE;
 	}
 
-	odata = gc->proto_data;
+	odata = ic->proto_data;
 	sess = odata->sess;
 	tstconn = aim_getconn_type_all(sess, AIM_CONN_TYPE_CHATNAV);
@@ -800,15 +800,15 @@
 static gboolean oscar_auth_connect(gpointer data, gint source, b_input_condition cond)
 {
-	struct gaim_connection *gc = data;
+	struct im_connection *ic = data;
 	struct oscar_data *odata;
 	aim_session_t *sess;
 	aim_conn_t *tstconn;
 
-	if (!g_slist_find(get_connections(), gc)) {
+	if (!g_slist_find(get_connections(), ic)) {
 		closesocket(source);
 		return FALSE;
 	}
 
-	odata = gc->proto_data;
+	odata = ic->proto_data;
 	sess = odata->sess;
 	tstconn = aim_getconn_type_all(sess, AIM_CONN_TYPE_AUTH);
@@ -829,10 +829,10 @@
 {
 	struct chat_connection *ccon = data;
-	struct gaim_connection *gc = ccon->gc;
+	struct im_connection *ic = ccon->ic;
 	struct oscar_data *odata;
 	aim_session_t *sess;
 	aim_conn_t *tstconn;
 
-	if (!g_slist_find(get_connections(), gc)) {
+	if (!g_slist_find(get_connections(), ic)) {
 		closesocket(source);
 		g_free(ccon->show);
@@ -842,5 +842,5 @@
 	}
 
-	odata = gc->proto_data;
+	odata = ic->proto_data;
 	sess = odata->sess;
 	tstconn = ccon->conn;
@@ -867,5 +867,5 @@
 	va_list ap;
 	struct aim_redirect_data *redir;
-	struct gaim_connection *gc = sess->aux_data;
+	struct im_connection *ic = sess->aux_data;
 	aim_conn_t *tstconn;
 	int i;
@@ -899,5 +899,5 @@
 
 		tstconn->status |= AIM_CONN_STATUS_INPROGRESS;
-		tstconn->fd = proxy_connect(host, port, oscar_auth_connect, gc);
+		tstconn->fd = proxy_connect(host, port, oscar_auth_connect, ic);
 		if (tstconn->fd < 0) {
 			aim_conn_kill(sess, &tstconn);
@@ -916,5 +916,5 @@
 
 		tstconn->status |= AIM_CONN_STATUS_INPROGRESS;
-		tstconn->fd = proxy_connect(host, port, oscar_chatnav_connect, gc);
+		tstconn->fd = proxy_connect(host, port, oscar_chatnav_connect, ic);
 		if (tstconn->fd < 0) {
 			aim_conn_kill(sess, &tstconn);
@@ -938,5 +938,5 @@
 		ccon = g_new0(struct chat_connection, 1);
 		ccon->conn = tstconn;
-		ccon->gc = gc;
+		ccon->ic = ic;
 		ccon->fd = -1;
 		ccon->name = g_strdup(redir->chat.room);
@@ -967,6 +967,6 @@
 
 static int gaim_parse_oncoming(aim_session_t *sess, aim_frame_t *fr, ...) {
-	struct gaim_connection *gc = sess->aux_data;
-	struct oscar_data *od = gc->proto_data;
+	struct im_connection *ic = sess->aux_data;
+	struct oscar_data *od = ic->proto_data;
 	aim_userinfo_t *info;
 	time_t time_idle = 0, signon = 0;
@@ -1018,10 +1018,10 @@
 		signon = time(NULL) - info->sessionlen;
 
-	tmp = g_strdup(normalize(gc->username));
+	tmp = g_strdup(normalize(ic->username));
 	if (!strcmp(tmp, normalize(info->sn)))
-		g_snprintf(gc->displayname, sizeof(gc->displayname), "%s", info->sn);
+		g_snprintf(ic->displayname, sizeof(ic->displayname), "%s", info->sn);
 	g_free(tmp);
 
-	serv_got_update(gc, info->sn, 1, info->warnlevel/10, signon,
+	serv_got_update(ic, info->sn, 1, info->warnlevel/10, signon,
 			time_idle, type, caps);
 
@@ -1032,5 +1032,5 @@
 	aim_userinfo_t *info;
 	va_list ap;
-	struct gaim_connection *gc = sess->aux_data;
+	struct im_connection *ic = sess->aux_data;
 
 	va_start(ap, fr);
@@ -1038,5 +1038,5 @@
 	va_end(ap);
 
-	serv_got_update(gc, info->sn, 0, 0, 0, 0, 0, 0);
+	serv_got_update(ic, info->sn, 0, 0, 0, 0, 0, 0);
 
 	return 1;
@@ -1045,5 +1045,5 @@
 static int incomingim_chan1(aim_session_t *sess, aim_conn_t *conn, aim_userinfo_t *userinfo, struct aim_incomingim_ch1_args *args) {
 	char *tmp = g_malloc(BUF_LONG + 1);
-	struct gaim_connection *gc = sess->aux_data;
+	struct im_connection *ic = sess->aux_data;
 	int flags = 0;
 	
@@ -1083,5 +1083,5 @@
 	
 	strip_linefeed(tmp);
-	serv_got_im(gc, userinfo->sn, tmp, flags, time(NULL), -1);
+	serv_got_im(ic, userinfo->sn, tmp, flags, time(NULL), -1);
 	g_free(tmp);
 	
@@ -1093,5 +1093,5 @@
 	
 static int incomingim_chan2(aim_session_t *sess, aim_conn_t *conn, aim_userinfo_t *userinfo, struct aim_incomingim_ch2_args *args) {
-	struct gaim_connection *gc = sess->aux_data;
+	struct im_connection *ic = sess->aux_data;
 
 	if (args->status != AIM_RENDEZVOUS_PROPOSE)
@@ -1111,9 +1111,9 @@
 		g_snprintf( txt, 1024, "Got an invitation to chatroom %s from %s: %s", name, userinfo->sn, args->msg );
 
-		inv->gc = gc;
+		inv->ic = ic;
 		inv->exchange = *exch;
 		inv->name = g_strdup(name);
 		
-		do_ask_dialog( gc, txt, inv, oscar_accept_chat, oscar_reject_chat);
+		do_ask_dialog( ic, txt, inv, oscar_accept_chat, oscar_reject_chat);
 	
 		if (name)
@@ -1126,5 +1126,5 @@
 static void gaim_icq_authgrant(gpointer w, struct icq_auth *data) {
 	char *uin, message;
-	struct oscar_data *od = (struct oscar_data *)data->gc->proto_data;
+	struct oscar_data *od = (struct oscar_data *)data->ic->proto_data;
 	
 	uin = g_strdup_printf("%u", data->uin);
@@ -1132,6 +1132,6 @@
 	aim_ssi_auth_reply(od->sess, od->conn, uin, 1, "");
 	// aim_send_im_ch4(od->sess, uin, AIM_ICQMSG_AUTHGRANTED, &message);
-	if(find_buddy(data->gc, uin) == NULL)
-		show_got_added(data->gc, uin, NULL);
+	if(find_buddy(data->ic, uin) == NULL)
+		show_got_added(data->ic, uin, NULL);
 	
 	g_free(uin);
@@ -1141,5 +1141,5 @@
 static void gaim_icq_authdeny(gpointer w, struct icq_auth *data) {
 	char *uin, *message;
-	struct oscar_data *od = (struct oscar_data *)data->gc->proto_data;
+	struct oscar_data *od = (struct oscar_data *)data->ic->proto_data;
 	
 	uin = g_strdup_printf("%u", data->uin);
@@ -1156,5 +1156,5 @@
  * For when other people ask you for authorization
  */
-static void gaim_icq_authask(struct gaim_connection *gc, guint32 uin, char *msg) {
+static void gaim_icq_authask(struct im_connection *ic, guint32 uin, char *msg) {
 	struct icq_auth *data = g_new(struct icq_auth, 1);
 	char *reason = NULL;
@@ -1165,12 +1165,12 @@
 	
 	dialog_msg = g_strdup_printf("The user %u wants to add you to their buddy list for the following reason: %s", uin, reason ? reason : "No reason given.");
-	data->gc = gc;
+	data->ic = ic;
 	data->uin = uin;
-	do_ask_dialog(gc, dialog_msg, data, gaim_icq_authgrant, gaim_icq_authdeny);
+	do_ask_dialog(ic, dialog_msg, data, gaim_icq_authgrant, gaim_icq_authdeny);
 	g_free(dialog_msg);
 }
 
 static int incomingim_chan4(aim_session_t *sess, aim_conn_t *conn, aim_userinfo_t *userinfo, struct aim_incomingim_ch4_args *args) {
-	struct gaim_connection *gc = sess->aux_data;
+	struct im_connection *ic = sess->aux_data;
 
 	switch (args->type) {
@@ -1180,5 +1180,5 @@
 			message = g_strdup(args->msg);
 			strip_linefeed(message);
-			serv_got_im(gc, uin, message, 0, time(NULL), -1);
+			serv_got_im(ic, uin, message, 0, time(NULL), -1);
 			g_free(uin);
 			g_free(message);
@@ -1199,5 +1199,5 @@
 
 			strip_linefeed(message);
-			serv_got_im(gc, uin, message, 0, time(NULL), -1);
+			serv_got_im(ic, uin, message, 0, time(NULL), -1);
 			g_free(uin);
 			g_free(m);
@@ -1206,5 +1206,5 @@
 		
 		case 0x0006: { /* Someone requested authorization */
-			gaim_icq_authask(gc, args->uin, args->msg);
+			gaim_icq_authask(ic, args->uin, args->msg);
 		} break;
 
@@ -1418,6 +1418,6 @@
 	va_list ap;
 	guint16 type;
-	struct gaim_connection *gc = sess->aux_data;
-	struct oscar_data *odata = (struct oscar_data *)gc->proto_data;
+	struct im_connection *ic = sess->aux_data;
+	struct oscar_data *odata = (struct oscar_data *)ic->proto_data;
 
 	va_start(ap, fr);
@@ -1477,5 +1477,5 @@
 	int count, i;
 	aim_userinfo_t *info;
-	struct gaim_connection *g = sess->aux_data;
+	struct im_connection *g = sess->aux_data;
 
 	struct chat_connection *c = NULL;
@@ -1500,5 +1500,5 @@
 	int count, i;
 	aim_userinfo_t *info;
-	struct gaim_connection *g = sess->aux_data;
+	struct im_connection *g = sess->aux_data;
 
 	struct chat_connection *c = NULL;
@@ -1528,6 +1528,6 @@
 	guint16 unknown_c9, unknown_d2, unknown_d5, maxmsglen, maxvisiblemsglen;
 	guint32 creationtime;
-	struct gaim_connection *gc = sess->aux_data;
-	struct chat_connection *ccon = find_oscar_chat_by_conn(gc, fr->conn);
+	struct im_connection *ic = sess->aux_data;
+	struct chat_connection *ccon = find_oscar_chat_by_conn(ic, fr->conn);
 
 	va_start(ap, fr);
@@ -1555,6 +1555,6 @@
 	aim_userinfo_t *info;
 	char *msg;
-	struct gaim_connection *gc = sess->aux_data;
-	struct chat_connection *ccon = find_oscar_chat_by_conn(gc, fr->conn);
+	struct im_connection *ic = sess->aux_data;
+	struct chat_connection *ccon = find_oscar_chat_by_conn(ic, fr->conn);
 	char *tmp;
 
@@ -1617,5 +1617,5 @@
 	va_list ap;
 	aim_userinfo_t *info;
-	struct gaim_connection *gc = sess->aux_data;
+	struct im_connection *ic = sess->aux_data;
 
 	va_start(ap, fr);
@@ -1623,6 +1623,6 @@
 	va_end(ap);
 
-	gc->evil = info->warnlevel/10;
-	/* gc->correction_time = (info->onlinesince - gc->login_time); */
+	ic->evil = info->warnlevel/10;
+	/* ic->correction_time = (info->onlinesince - ic->login_time); */
 
 	return 1;
@@ -1646,6 +1646,6 @@
 
 static int conninitdone_admin(aim_session_t *sess, aim_frame_t *fr, ...) {
-	struct gaim_connection *gc = sess->aux_data;
-	struct oscar_data *od = gc->proto_data;
+	struct im_connection *ic = sess->aux_data;
+	struct oscar_data *od = ic->proto_data;
 
 	aim_clientready(sess, fr->conn);
@@ -1704,6 +1704,6 @@
 	va_list ap;
 	guint16 maxsiglen;
-	struct gaim_connection *gc = sess->aux_data;
-	struct oscar_data *odata = (struct oscar_data *)gc->proto_data;
+	struct im_connection *ic = sess->aux_data;
+	struct oscar_data *odata = (struct oscar_data *)ic->proto_data;
 
 	va_start(ap, fr);
@@ -1715,5 +1715,5 @@
 	/* 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);
+	aim_bos_setprofile(sess, fr->conn, ic->user->user_info, NULL, gaim_caps);
 	*/
 	
@@ -1724,6 +1724,6 @@
 	va_list ap;
 	guint16 maxbuddies, maxwatchers;
-	struct gaim_connection *gc = sess->aux_data;
-	struct oscar_data *odata = (struct oscar_data *)gc->proto_data;
+	struct im_connection *ic = sess->aux_data;
+	struct oscar_data *odata = (struct oscar_data *)ic->proto_data;
 
 	va_start(ap, fr);
@@ -1741,6 +1741,6 @@
 	guint16 maxpermits, maxdenies;
 	va_list ap;
-	struct gaim_connection *gc = sess->aux_data;
-	struct oscar_data *odata = (struct oscar_data *)gc->proto_data;
+	struct im_connection *ic = sess->aux_data;
+	struct oscar_data *odata = (struct oscar_data *)ic->proto_data;
 
 	va_start(ap, fr);
@@ -1765,5 +1765,5 @@
 	va_list ap;
 	struct aim_icq_offlinemsg *msg;
-	struct gaim_connection *gc = sess->aux_data;
+	struct im_connection *ic = sess->aux_data;
 
 	va_start(ap, fr);
@@ -1778,5 +1778,5 @@
 			g_snprintf(sender, sizeof(sender), "%u", msg->sender);
 			strip_linefeed(dialog_msg);
-			serv_got_im(gc, sender, dialog_msg, 0, t, -1);
+			serv_got_im(ic, sender, dialog_msg, 0, t, -1);
 			g_free(dialog_msg);
 		} break;
@@ -1799,5 +1799,5 @@
 
 			strip_linefeed(dialog_msg);
-			serv_got_im(gc, sender, dialog_msg, 0, t, -1);
+			serv_got_im(ic, sender, dialog_msg, 0, t, -1);
 			g_free(dialog_msg);
 			g_free(m);
@@ -1805,5 +1805,5 @@
 		
 		case 0x0006: { /* Authorization request */
-			gaim_icq_authask(gc, msg->sender, msg->msg);
+			gaim_icq_authask(ic, msg->sender, msg->msg);
 		} break;
 
@@ -1833,12 +1833,12 @@
 }
 
-static void oscar_keepalive(struct gaim_connection *gc) {
-	struct oscar_data *odata = (struct oscar_data *)gc->proto_data;
+static void oscar_keepalive(struct im_connection *ic) {
+	struct oscar_data *odata = (struct oscar_data *)ic->proto_data;
 	aim_flap_nop(odata->sess, odata->conn);
 }
 
-static int oscar_send_im(struct gaim_connection *gc, char *name, char *message, int len, int imflags) {
-	struct oscar_data *odata = (struct oscar_data *)gc->proto_data;
-	int ret = 0;
+static int oscar_send_im(struct im_connection *ic, char *name, char *message, int imflags) {
+	struct oscar_data *odata = (struct oscar_data *)ic->proto_data;
+	int ret = 0, len = strlen(message);
 	if (imflags & IM_FLAG_AWAY) {
 		ret = aim_send_im(odata->sess, name, AIM_IMFLAGS_AWAY, message);
@@ -1892,5 +1892,5 @@
 }
 
-static void oscar_get_info(struct gaim_connection *g, char *name) {
+static void oscar_get_info(struct im_connection *g, char *name) {
 	struct oscar_data *odata = (struct oscar_data *)g->proto_data;
 	if (odata->icq)
@@ -1902,5 +1902,5 @@
 }
 
-static void oscar_get_away(struct gaim_connection *g, char *who) {
+static void oscar_get_away(struct im_connection *g, char *who) {
 	struct oscar_data *odata = (struct oscar_data *)g->proto_data;
 	if (odata->icq) {
@@ -1914,5 +1914,5 @@
 }
 
-static void oscar_set_away_aim(struct gaim_connection *gc, struct oscar_data *od, const char *state, const char *message)
+static void oscar_set_away_aim(struct im_connection *ic, struct oscar_data *od, const char *state, const char *message)
 {
 
@@ -1926,11 +1926,11 @@
 
 	if (od->rights.maxawaymsglen == 0)
-		do_error_dialog(gc, "oscar_set_away_aim called before locate rights received", "Protocol Error");
+		do_error_dialog(ic, "oscar_set_away_aim called before locate rights received", "Protocol Error");
 
 	aim_setextstatus(od->sess, od->conn, AIM_ICQ_STATE_NORMAL);
 
-	if (gc->away)
-		g_free(gc->away);
-	gc->away = NULL;
+	if (ic->away)
+		g_free(ic->away);
+	ic->away = NULL;
 
 	if (!message) {
@@ -1944,16 +1944,16 @@
 		errstr = g_strdup_printf("Maximum away message length of %d bytes exceeded, truncating", od->rights.maxawaymsglen);
 
-		do_error_dialog(gc, errstr, "Away Message Too Long");
+		do_error_dialog(ic, errstr, "Away Message Too Long");
 
 		g_free(errstr);
 	}
 
-	gc->away = g_strndup(message, od->rights.maxawaymsglen);
-	aim_bos_setprofile(od->sess, od->conn, NULL, gc->away, gaim_caps);
+	ic->away = g_strndup(message, od->rights.maxawaymsglen);
+	aim_bos_setprofile(od->sess, od->conn, NULL, ic->away, gaim_caps);
 
 	return;
 }
 
-static void oscar_set_away_icq(struct gaim_connection *gc, struct oscar_data *od, const char *state, const char *message)
+static void oscar_set_away_icq(struct im_connection *ic, struct oscar_data *od, const char *state, const char *message)
 {
     const char *msg = NULL;
@@ -1961,7 +1961,7 @@
 
 	/* clean old states */
-    if (gc->away) {
-		g_free(gc->away);
-		gc->away = NULL;
+    if (ic->away) {
+		g_free(ic->away);
+		ic->away = NULL;
     }
 	od->sess->aim_icq_state = 0;
@@ -1979,25 +1979,25 @@
 	} else if (!g_strcasecmp(state, "Away")) {
 		aim_setextstatus(od->sess, od->conn, AIM_ICQ_STATE_AWAY);
-        gc->away = g_strdup(msg);
+        ic->away = g_strdup(msg);
 		od->sess->aim_icq_state = AIM_MTYPE_AUTOAWAY;
 	} else if (!g_strcasecmp(state, "Do Not Disturb")) {
 		aim_setextstatus(od->sess, od->conn, AIM_ICQ_STATE_AWAY | AIM_ICQ_STATE_DND | AIM_ICQ_STATE_BUSY);
-        gc->away = g_strdup(msg);
+        ic->away = g_strdup(msg);
 		od->sess->aim_icq_state = AIM_MTYPE_AUTODND;
 	} else if (!g_strcasecmp(state, "Not Available")) {
 		aim_setextstatus(od->sess, od->conn, AIM_ICQ_STATE_OUT | AIM_ICQ_STATE_AWAY);
-        gc->away = g_strdup(msg);
+        ic->away = g_strdup(msg);
 		od->sess->aim_icq_state = AIM_MTYPE_AUTONA;
 	} else if (!g_strcasecmp(state, "Occupied")) {
 		aim_setextstatus(od->sess, od->conn, AIM_ICQ_STATE_AWAY | AIM_ICQ_STATE_BUSY);
-        gc->away = g_strdup(msg);
+        ic->away = g_strdup(msg);
 		od->sess->aim_icq_state = AIM_MTYPE_AUTOBUSY;
 	} else if (!g_strcasecmp(state, "Free For Chat")) {
 		aim_setextstatus(od->sess, od->conn, AIM_ICQ_STATE_CHAT);
-        gc->away = g_strdup(msg);
+        ic->away = g_strdup(msg);
 		od->sess->aim_icq_state = AIM_MTYPE_AUTOFFC;
 	} else if (!g_strcasecmp(state, "Invisible")) {
 		aim_setextstatus(od->sess, od->conn, AIM_ICQ_STATE_INVISIBLE);
-        gc->away = g_strdup(msg);
+        ic->away = g_strdup(msg);
 	} else if (!g_strcasecmp(state, GAIM_AWAY_CUSTOM)) {
 	 	if (no_message) {
@@ -2005,5 +2005,5 @@
 		} else {
 			aim_setextstatus(od->sess, od->conn, AIM_ICQ_STATE_AWAY);
-            gc->away = g_strdup(msg);
+            ic->away = g_strdup(msg);
 			od->sess->aim_icq_state = AIM_MTYPE_AUTOAWAY;
 		}
@@ -2013,21 +2013,21 @@
 }
 
-static void oscar_set_away(struct gaim_connection *gc, char *state, char *message)
-{
-	struct oscar_data *od = (struct oscar_data *)gc->proto_data;
-
-    oscar_set_away_aim(gc, od, state, message);
+static void oscar_set_away(struct im_connection *ic, char *state, char *message)
+{
+	struct oscar_data *od = (struct oscar_data *)ic->proto_data;
+
+    oscar_set_away_aim(ic, od, state, message);
 	if (od->icq)
-		oscar_set_away_icq(gc, od, state, message);
+		oscar_set_away_icq(ic, od, state, message);
 
 	return;
 }
 
-static void oscar_add_buddy(struct gaim_connection *g, char *name) {
+static void oscar_add_buddy(struct im_connection *g, char *name, char *group) {
 	struct oscar_data *odata = (struct oscar_data *)g->proto_data;
 	aim_ssi_addbuddies(odata->sess, odata->conn, OSCAR_GROUP, &name, 1, 0);
 }
 
-static void oscar_remove_buddy(struct gaim_connection *g, char *name, char *group) {
+static void oscar_remove_buddy(struct im_connection *g, char *name, char *group) {
 	struct oscar_data *odata = (struct oscar_data *)g->proto_data;
 	struct aim_ssi_item *ssigroup;
@@ -2040,5 +2040,5 @@
 
 static int gaim_ssi_parselist(aim_session_t *sess, aim_frame_t *fr, ...) {
-	struct gaim_connection *gc = sess->aux_data;
+	struct im_connection *ic = sess->aux_data;
 	struct aim_ssi_item *curitem;
 	int tmp;
@@ -2049,5 +2049,5 @@
 		switch (curitem->type) {
 			case 0x0000: /* Buddy */
-				if ((curitem->name) && (!find_buddy(gc, curitem->name))) {
+				if ((curitem->name) && (!find_buddy(ic, curitem->name))) {
 					char *realname = NULL;
 
@@ -2055,5 +2055,5 @@
 						    realname = aim_gettlv_str(curitem->data, 0x0131, 1);
 						
-					add_buddy(gc, NULL, curitem->name, realname);
+					add_buddy(ic, NULL, curitem->name, realname);
 					
 					if (realname)
@@ -2065,9 +2065,9 @@
 				if (curitem->name) {
 					GSList *list;
-					for (list=gc->permit; (list && aim_sncmp(curitem->name, list->data)); list=list->next);
+					for (list=ic->permit; (list && aim_sncmp(curitem->name, list->data)); list=list->next);
 					if (!list) {
 						char *name;
 						name = g_strdup(normalize(curitem->name));
-						gc->permit = g_slist_append(gc->permit, name);
+						ic->permit = g_slist_append(ic->permit, name);
 						tmp++;
 					}
@@ -2078,9 +2078,9 @@
 				if (curitem->name) {
 					GSList *list;
-					for (list=gc->deny; (list && aim_sncmp(curitem->name, list->data)); list=list->next);
+					for (list=ic->deny; (list && aim_sncmp(curitem->name, list->data)); list=list->next);
 					if (!list) {
 						char *name;
 						name = g_strdup(normalize(curitem->name));
-						gc->deny = g_slist_append(gc->deny, name);
+						ic->deny = g_slist_append(ic->deny, name);
 						tmp++;
 					}
@@ -2091,6 +2091,6 @@
 				if (curitem->data) {
 					guint8 permdeny;
-					if ((permdeny = aim_ssi_getpermdeny(sess->ssi.items)) && (permdeny != gc->permdeny)) {
-						gc->permdeny = permdeny;
+					if ((permdeny = aim_ssi_getpermdeny(sess->ssi.items)) && (permdeny != ic->permdeny)) {
+						ic->permdeny = permdeny;
 						tmp++;
 					}
@@ -2110,5 +2110,5 @@
 	
 	/* Now that we have a buddy list, we can tell BitlBee that we're online. */
-	account_online(gc);
+	account_online(ic);
 	
 	return 1;
@@ -2155,6 +2155,6 @@
 }
 
-static void oscar_set_permit_deny(struct gaim_connection *gc) {
-	struct oscar_data *od = (struct oscar_data *)gc->proto_data;
+static void oscar_set_permit_deny(struct im_connection *ic) {
+	struct oscar_data *od = (struct oscar_data *)ic->proto_data;
 	if (od->icq) {
 		GSList *list;
@@ -2162,13 +2162,13 @@
 		int at;
 
-		switch(gc->permdeny) {
+		switch(ic->permdeny) {
 		case 1:
-			aim_bos_changevisibility(od->sess, od->conn, AIM_VISIBILITYCHANGE_DENYADD, gc->username);
+			aim_bos_changevisibility(od->sess, od->conn, AIM_VISIBILITYCHANGE_DENYADD, ic->username);
 			break;
 		case 2:
-			aim_bos_changevisibility(od->sess, od->conn, AIM_VISIBILITYCHANGE_PERMITADD, gc->username);
+			aim_bos_changevisibility(od->sess, od->conn, AIM_VISIBILITYCHANGE_PERMITADD, ic->username);
 			break;
 		case 3:
-			list = gc->permit;
+			list = ic->permit;
 			at = 0;
 			while (list) {
@@ -2179,5 +2179,5 @@
 			break;
 		case 4:
-			list = gc->deny;
+			list = ic->deny;
 			at = 0;
 			while (list) {
@@ -2190,13 +2190,13 @@
 			break;
 		}
-		signoff_blocked(gc);
+		signoff_blocked(ic);
 	} else {
 		if (od->sess->ssi.received_data)
-			aim_ssi_setpermdeny(od->sess, od->conn, gc->permdeny, 0xffffffff);
-	}
-}
-
-static void oscar_add_permit(struct gaim_connection *gc, char *who) {
-	struct oscar_data *od = (struct oscar_data *)gc->proto_data;
+			aim_ssi_setpermdeny(od->sess, od->conn, ic->permdeny, 0xffffffff);
+	}
+}
+
+static void oscar_add_permit(struct im_connection *ic, char *who) {
+	struct oscar_data *od = (struct oscar_data *)ic->proto_data;
 	if (od->icq) {
 		aim_ssi_auth_reply(od->sess, od->conn, who, 1, "");
@@ -2207,6 +2207,6 @@
 }
 
-static void oscar_add_deny(struct gaim_connection *gc, char *who) {
-	struct oscar_data *od = (struct oscar_data *)gc->proto_data;
+static void oscar_add_deny(struct im_connection *ic, char *who) {
+	struct oscar_data *od = (struct oscar_data *)ic->proto_data;
 	if (od->icq) {
 		aim_ssi_auth_reply(od->sess, od->conn, who, 0, "");
@@ -2217,6 +2217,6 @@
 }
 
-static void oscar_rem_permit(struct gaim_connection *gc, char *who) {
-	struct oscar_data *od = (struct oscar_data *)gc->proto_data;
+static void oscar_rem_permit(struct im_connection *ic, char *who) {
+	struct oscar_data *od = (struct oscar_data *)ic->proto_data;
 	if (!od->icq) {
 		if (od->sess->ssi.received_data)
@@ -2225,6 +2225,6 @@
 }
 
-static void oscar_rem_deny(struct gaim_connection *gc, char *who) {
-	struct oscar_data *od = (struct oscar_data *)gc->proto_data;
+static void oscar_rem_deny(struct im_connection *ic, char *who) {
+	struct oscar_data *od = (struct oscar_data *)ic->proto_data;
 	if (!od->icq) {
 		if (od->sess->ssi.received_data)
@@ -2233,7 +2233,7 @@
 }
 
-static GList *oscar_away_states(struct gaim_connection *gc)
-{
-	struct oscar_data *od = gc->proto_data;
+static GList *oscar_away_states(struct im_connection *ic)
+{
+	struct oscar_data *od = ic->proto_data;
 	GList *m = NULL;
 
@@ -2254,5 +2254,5 @@
 static int gaim_icqinfo(aim_session_t *sess, aim_frame_t *fr, ...)
 {
-        struct gaim_connection *gc = sess->aux_data;
+        struct im_connection *ic = sess->aux_data;
         gchar who[16];
         GString *str;
@@ -2330,5 +2330,5 @@
         }
 
-		serv_got_crap(gc, "%s\n%s", _("User Info"), str->str);
+		serv_got_crap(ic, "%s\n%s", _("User Info"), str->str);
         g_string_free(str, TRUE);
 
@@ -2395,5 +2395,5 @@
 static int gaim_parseaiminfo(aim_session_t *sess, aim_frame_t *fr, ...)
 {
-	struct gaim_connection *gc = sess->aux_data;
+	struct im_connection *ic = sess->aux_data;
 	va_list ap;
 	aim_userinfo_t *userinfo;
@@ -2424,16 +2424,16 @@
 			idletime.tm_sec = 0;
 			strftime(buff, 256, _("%d days %H hours %M minutes"), &idletime);
-			serv_got_crap(gc, "%s: %s", _("Idle Time"), buff);
+			serv_got_crap(ic, "%s: %s", _("Idle Time"), buff);
 		}
 		
 		if(text) {
 			utf8 = oscar_encoding_to_utf8(extracted_encoding, text, text_length);
-			serv_got_crap(gc, "%s\n%s", _("User Info"), utf8);
+			serv_got_crap(ic, "%s\n%s", _("User Info"), utf8);
 		} else {
-			serv_got_crap(gc, _("No user info available."));
+			serv_got_crap(ic, _("No user info available."));
 		}
 	} else if(infotype == AIM_GETINFO_AWAYMESSAGE && userinfo->flags & AIM_FLAG_AWAY) {
 		utf8 = oscar_encoding_to_utf8(extracted_encoding, text, text_length);
-		serv_got_crap(gc, "%s\n%s", _("Away Message"), utf8);
+		serv_got_crap(ic, "%s\n%s", _("Away Message"), utf8);
 	}
 
@@ -2445,5 +2445,5 @@
 int gaim_parsemtn(aim_session_t *sess, aim_frame_t *fr, ...)
 {
-	struct gaim_connection * gc = sess->aux_data;
+	struct im_connection * ic = sess->aux_data;
 	va_list ap;
 	guint16 type1, type2;
@@ -2458,13 +2458,13 @@
 	if(type2 == 0x0002) {
 		/* User is typing */
-		serv_got_typing(gc, sn, 0, 1);
+		serv_got_typing(ic, sn, 0, 1);
 	} 
 	else if (type2 == 0x0001) {
 		/* User has typed something, but is not actively typing (stale) */
-		serv_got_typing(gc, sn, 0, 2);
+		serv_got_typing(ic, sn, 0, 2);
 	}
 	else {
 		/* User has stopped typing */
-		serv_got_typing(gc, sn, 0, 0);
+		serv_got_typing(ic, sn, 0, 0);
 	}        
 	
@@ -2472,7 +2472,7 @@
 }
 
-static char *oscar_get_status_string( struct gaim_connection *gc, int number )
-{
-	struct oscar_data *od = gc->proto_data;
+static char *oscar_get_status_string( struct im_connection *ic, int number )
+{
+	struct oscar_data *od = ic->proto_data;
 	
 	if( ! number & UC_UNAVAILABLE )
@@ -2500,14 +2500,14 @@
 }
 
-int oscar_send_typing(struct gaim_connection *gc, char * who, int typing)
-{
-	struct oscar_data *od = gc->proto_data;
+int oscar_send_typing(struct im_connection *ic, char * who, int typing)
+{
+	struct oscar_data *od = ic->proto_data;
 	return( aim_im_sendmtn(od->sess, 1, who, typing ? 0x0002 : 0x0000) );
 }
 
-int oscar_chat_send(struct conversation *c, char *message)
-{
-	struct gaim_connection *gc = c->gc;
-	struct oscar_data * od = (struct oscar_data*)gc->proto_data;
+void oscar_chat_send(struct groupchat *c, char *message, int msgflags)
+{
+	struct im_connection *ic = c->ic;
+	struct oscar_data * od = (struct oscar_data*)ic->proto_data;
 	struct chat_connection * ccon;
 	int ret;
@@ -2550,11 +2550,11 @@
   }
   
-  return (ret >= 0);
-}
-
-void oscar_chat_invite(struct conversation *c, char *message, char *who)
-{
-	struct gaim_connection *gc = c->gc;
-	struct oscar_data * od = (struct oscar_data *)gc->proto_data;
+/*  return (ret >= 0); */
+}
+
+void oscar_chat_invite(struct groupchat *c, char *message, char *who)
+{
+	struct im_connection *ic = c->ic;
+	struct oscar_data * od = (struct oscar_data *)ic->proto_data;
 	struct chat_connection *ccon = c->data;
 	
@@ -2563,7 +2563,7 @@
 }
 
-void oscar_chat_kill(struct gaim_connection *gc, struct chat_connection *cc)
-{
-	struct oscar_data *od = (struct oscar_data *)gc->proto_data;
+void oscar_chat_kill(struct im_connection *ic, struct chat_connection *cc)
+{
+	struct oscar_data *od = (struct oscar_data *)ic->proto_data;
 
 	/* Notify the conversation window that we've left the chat */
@@ -2580,12 +2580,12 @@
 }
 
-void oscar_chat_leave(struct conversation *c)
-{
-	oscar_chat_kill(c->gc, c->data);
-}
-
-int oscar_chat_join(struct gaim_connection * gc, char * name)
-{
-	struct oscar_data * od = (struct oscar_data *)gc->proto_data;
+void oscar_chat_leave(struct groupchat *c)
+{
+	oscar_chat_kill(c->ic, c->data);
+}
+
+int oscar_chat_join(struct im_connection * ic, char * name)
+{
+	struct oscar_data * od = (struct oscar_data *)ic->proto_data;
 	
 	aim_conn_t * cur;
@@ -2605,14 +2605,14 @@
 }
 
-struct conversation *oscar_chat_open(struct gaim_connection * gc, char *who)
-{
-	struct oscar_data * od = (struct oscar_data *)gc->proto_data;
+struct groupchat *oscar_chat_with(struct im_connection * ic, char *who)
+{
+	struct oscar_data * od = (struct oscar_data *)ic->proto_data;
 	int ret;
 	static int chat_id = 0;
 	char * chatname;
 	
-	chatname = g_strdup_printf("%s%d", gc->username, chat_id++);
+	chatname = g_strdup_printf("%s%d", ic->username, chat_id++);
   
-	ret = oscar_chat_join(gc, chatname);
+	ret = oscar_chat_join(ic, chatname);
 
 	aim_chat_invite(od->sess, od->conn, who, "", 4, chatname, 0x0);
@@ -2625,5 +2625,5 @@
 void oscar_accept_chat(gpointer w, struct aim_chat_invitation * inv)
 {
-	oscar_chat_join(inv->gc, inv->name);
+	oscar_chat_join(inv->ic, inv->name);
 	g_free(inv->name);
 	g_free(inv);
@@ -2636,12 +2636,13 @@
 }
 
-void oscar_init() 
+void oscar_initmodule() 
 {
 	struct prpl *ret = g_new0(struct prpl, 1);
 	ret->name = "oscar";
 	ret->away_states = oscar_away_states;
+	ret->init = oscar_init;
 	ret->login = oscar_login;
-	ret->acc_init = oscar_acc_init;
-	ret->close = oscar_close;
+	ret->keepalive = oscar_keepalive;
+	ret->logout = oscar_logout;
 	ret->send_im = oscar_send_im;
 	ret->get_info = oscar_get_info;
@@ -2653,5 +2654,5 @@
 	ret->chat_invite = oscar_chat_invite;
 	ret->chat_leave = oscar_chat_leave;
-	ret->chat_open = oscar_chat_open;
+	ret->chat_with = oscar_chat_with;
 	ret->add_permit = oscar_add_permit;
 	ret->add_deny = oscar_add_deny;
@@ -2659,5 +2660,4 @@
 	ret->rem_deny = oscar_rem_deny;
 	ret->set_permit_deny = oscar_set_permit_deny;
-	ret->keepalive = oscar_keepalive;
 	ret->get_status_string = oscar_get_status_string;
 	ret->send_typing = oscar_send_typing;
Index: protocols/oscar/service.c
===================================================================
--- protocols/oscar/service.c	(revision fa29d09342c79b886efacee4cfc3078be5f5a722)
+++ protocols/oscar/service.c	(revision 0da65d5fb37691ed4d31f7ab4058732f1440db6b)
@@ -732,9 +732,9 @@
 	guint32 data;
 	int tlvlen;
-	struct gaim_connection *gc = sess ? sess->aux_data : NULL;
+	struct im_connection *ic = sess ? sess->aux_data : NULL;
 
 	data = AIM_ICQ_STATE_HIDEIP | status; /* yay for error checking ;^) */
 	
-	if (gc && set_getbool(&gc->acc->set, "web_aware"))
+	if (ic && set_getbool(&ic->acc->set, "web_aware"))
 		data |= AIM_ICQ_STATE_WEBAWARE;
 
Index: protocols/yahoo/yahoo.c
===================================================================
--- protocols/yahoo/yahoo.c	(revision fa29d09342c79b886efacee4cfc3078be5f5a722)
+++ protocols/yahoo/yahoo.c	(revision 0da65d5fb37691ed4d31f7ab4058732f1440db6b)
@@ -58,8 +58,8 @@
 {
 	char *name;
-	struct conversation *c;
+	struct groupchat *c;
 	int yid;
 	YList *members;
-	struct gaim_connection *gc;
+	struct im_connection *ic;
 };
 
@@ -123,22 +123,22 @@
 static void byahoo_login( account_t *acc )
 {
-	struct gaim_connection *gc = new_gaim_conn( acc );
-	struct byahoo_data *yd = gc->proto_data = g_new0( struct byahoo_data, 1 );
+	struct im_connection *ic = new_gaim_conn( acc );
+	struct byahoo_data *yd = ic->proto_data = g_new0( struct byahoo_data, 1 );
 	
 	yd->logged_in = FALSE;
 	yd->current_status = YAHOO_STATUS_AVAILABLE;
 	
-	set_login_progress( gc, 1, "Connecting" );
+	set_login_progress( ic, 1, "Connecting" );
 	yd->y2_id = yahoo_init( acc->user, acc->pass );
 	yahoo_login( yd->y2_id, yd->current_status );
 }
 
-static void byahoo_close( struct gaim_connection *gc )
-{
-	struct byahoo_data *yd = (struct byahoo_data *) gc->proto_data;
+static void byahoo_logout( struct im_connection *ic )
+{
+	struct byahoo_data *yd = (struct byahoo_data *) ic->proto_data;
 	GSList *l;
 	
-	while( gc->conversations )
-		serv_got_chat_left( gc->conversations );
+	while( ic->conversations )
+		serv_got_chat_left( ic->conversations );
 	
 	for( l = yd->buddygroups; l; l = l->next )
@@ -160,15 +160,15 @@
 }
 
-static void byahoo_get_info(struct gaim_connection *gc, char *who) 
+static void byahoo_get_info(struct im_connection *ic, char *who) 
 {
 	/* Just make an URL and let the user fetch the info */
-	serv_got_crap(gc, "%s\n%s: %s%s", _("User Info"), 
+	serv_got_crap(ic, "%s\n%s: %s%s", _("User Info"), 
 			_("For now, fetch yourself"), yahoo_get_profile_url(),
 			who);
 }
 
-static int byahoo_send_im( struct gaim_connection *gc, char *who, char *what, int len, int flags )
-{
-	struct byahoo_data *yd = gc->proto_data;
+static int byahoo_send_im( struct im_connection *ic, char *who, char *what, int flags )
+{
+	struct byahoo_data *yd = ic->proto_data;
 	
 	yahoo_send_im( yd->y2_id, NULL, who, what, 1 );
@@ -177,7 +177,7 @@
 }
 
-static int byahoo_send_typing( struct gaim_connection *gc, char *who, int typing )
-{
-	struct byahoo_data *yd = gc->proto_data;
+static int byahoo_send_typing( struct im_connection *ic, char *who, int typing )
+{
+	struct byahoo_data *yd = ic->proto_data;
 	
 	yahoo_send_typing( yd->y2_id, NULL, who, typing );
@@ -186,14 +186,14 @@
 }
 
-static void byahoo_set_away( struct gaim_connection *gc, char *state, char *msg )
-{
-	struct byahoo_data *yd = (struct byahoo_data *) gc->proto_data;
-	
-	gc->away = NULL;
+static void byahoo_set_away( struct im_connection *ic, char *state, char *msg )
+{
+	struct byahoo_data *yd = (struct byahoo_data *) ic->proto_data;
+	
+	ic->away = NULL;
 	
 	if( state && msg && g_strcasecmp( state, msg ) != 0 )
 	{
 		yd->current_status = YAHOO_STATUS_CUSTOM;
-		gc->away = "";
+		ic->away = "";
 	}
 	else if( state )
@@ -204,9 +204,9 @@
 		msg = NULL;
 		
-		gc->away = "";
+		ic->away = "";
 		if( g_strcasecmp( state, "Available" ) == 0 )
 		{
 			yd->current_status = YAHOO_STATUS_AVAILABLE;
-			gc->away = NULL;
+			ic->away = NULL;
 		}
 		else if( g_strcasecmp( state, "Be Right Back" ) == 0 )
@@ -234,5 +234,5 @@
 			yd->current_status = YAHOO_STATUS_AVAILABLE;
 			
-			gc->away = NULL;
+			ic->away = NULL;
 		}
 	}
@@ -240,8 +240,8 @@
 		yd->current_status = YAHOO_STATUS_AVAILABLE;
 	
-	yahoo_set_away( yd->y2_id, yd->current_status, msg, gc->away != NULL );
-}
-
-static GList *byahoo_away_states( struct gaim_connection *gc )
+	yahoo_set_away( yd->y2_id, yd->current_status, msg, ic->away != NULL );
+}
+
+static GList *byahoo_away_states( struct im_connection *ic )
 {
 	GList *m = NULL;
@@ -263,21 +263,21 @@
 }
 
-static void byahoo_keepalive( struct gaim_connection *gc )
-{
-	struct byahoo_data *yd = gc->proto_data;
+static void byahoo_keepalive( struct im_connection *ic )
+{
+	struct byahoo_data *yd = ic->proto_data;
 	
 	yahoo_keepalive( yd->y2_id );
 }
 
-static void byahoo_add_buddy( struct gaim_connection *gc, char *who )
-{
-	struct byahoo_data *yd = (struct byahoo_data *) gc->proto_data;
-	
-	yahoo_add_buddy( yd->y2_id, who, BYAHOO_DEFAULT_GROUP );
-}
-
-static void byahoo_remove_buddy( struct gaim_connection *gc, char *who, char *group )
-{
-	struct byahoo_data *yd = (struct byahoo_data *) gc->proto_data;
+static void byahoo_add_buddy( struct im_connection *ic, char *who, char *group )
+{
+	struct byahoo_data *yd = (struct byahoo_data *) ic->proto_data;
+	
+	yahoo_add_buddy( yd->y2_id, who, group ? group : BYAHOO_DEFAULT_GROUP );
+}
+
+static void byahoo_remove_buddy( struct im_connection *ic, char *who, char *group )
+{
+	struct byahoo_data *yd = (struct byahoo_data *) ic->proto_data;
 	GSList *bgl;
 	
@@ -293,5 +293,5 @@
 }
 
-static char *byahoo_get_status_string( struct gaim_connection *gc, int stat )
+static char *byahoo_get_status_string( struct im_connection *ic, int stat )
 {
 	enum yahoo_status a = stat >> 1;
@@ -332,23 +332,21 @@
 }
 
-static int byahoo_chat_send( struct conversation *c, char *message )
-{
-	struct byahoo_data *yd = (struct byahoo_data *) c->gc->proto_data;
+static void byahoo_chat_send( struct groupchat *c, char *message, int flags )
+{
+	struct byahoo_data *yd = (struct byahoo_data *) c->ic->proto_data;
 	
 	yahoo_conference_message( yd->y2_id, NULL, c->data, c->title, message, 1 );
-	
-	return( 0 );
-}
-
-static void byahoo_chat_invite( struct conversation *c, char *msg, char *who )
-{
-	struct byahoo_data *yd = (struct byahoo_data *) c->gc->proto_data;
+}
+
+static void byahoo_chat_invite( struct groupchat *c, char *msg, char *who )
+{
+	struct byahoo_data *yd = (struct byahoo_data *) c->ic->proto_data;
 	
 	yahoo_conference_invite( yd->y2_id, NULL, c->data, c->title, msg );
 }
 
-static void byahoo_chat_leave( struct conversation *c )
-{
-	struct byahoo_data *yd = (struct byahoo_data *) c->gc->proto_data;
+static void byahoo_chat_leave( struct groupchat *c )
+{
+	struct byahoo_data *yd = (struct byahoo_data *) c->ic->proto_data;
 	
 	yahoo_conference_logoff( yd->y2_id, NULL, c->data, c->title );
@@ -356,16 +354,16 @@
 }
 
-static struct conversation *byahoo_chat_open( struct gaim_connection *gc, char *who )
-{
-	struct byahoo_data *yd = (struct byahoo_data *) gc->proto_data;
-	struct conversation *c;
+static struct groupchat *byahoo_chat_with( struct im_connection *ic, char *who )
+{
+	struct byahoo_data *yd = (struct byahoo_data *) ic->proto_data;
+	struct groupchat *c;
 	char *roomname;
 	YList *members;
 	
-	roomname = g_new0( char, strlen( gc->username ) + 16 );
-	g_snprintf( roomname, strlen( gc->username ) + 16, "%s-Bee-%d", gc->username, byahoo_chat_id );
-	
-	c = serv_got_joined_chat( gc, roomname );
-	add_chat_buddy( c, gc->username );
+	roomname = g_new0( char, strlen( ic->username ) + 16 );
+	g_snprintf( roomname, strlen( ic->username ) + 16, "%s-Bee-%d", ic->username, byahoo_chat_id );
+	
+	c = serv_got_joined_chat( ic, roomname );
+	add_chat_buddy( c, ic->username );
 	
 	/* FIXME: Free this thing when the chat's destroyed. We can't *always*
@@ -381,5 +379,5 @@
 }
 
-void byahoo_init( )
+void byahoo_initmodule( )
 {
 	struct prpl *ret = g_new0(struct prpl, 1);
@@ -387,10 +385,11 @@
 	
 	ret->login = byahoo_login;
-	ret->close = byahoo_close;
+	ret->keepalive = byahoo_keepalive;
+	ret->logout = byahoo_logout;
+	
 	ret->send_im = byahoo_send_im;
 	ret->get_info = byahoo_get_info;
 	ret->away_states = byahoo_away_states;
 	ret->set_away = byahoo_set_away;
-	ret->keepalive = byahoo_keepalive;
 	ret->add_buddy = byahoo_add_buddy;
 	ret->remove_buddy = byahoo_remove_buddy;
@@ -401,5 +400,5 @@
 	ret->chat_invite = byahoo_chat_invite;
 	ret->chat_leave = byahoo_chat_leave;
-	ret->chat_open = byahoo_chat_open;
+	ret->chat_with = byahoo_chat_with;
 
 	ret->handle_cmp = g_strcasecmp;
@@ -408,17 +407,17 @@
 }
 
-static struct gaim_connection *byahoo_get_gc_by_id( int id )
+static struct im_connection *byahoo_get_ic_by_id( int id )
 {
 	GSList *l;
-	struct gaim_connection *gc;
+	struct im_connection *ic;
 	struct byahoo_data *yd;
 	
 	for( l = get_connections(); l; l = l->next )
 	{
-		gc = l->data;
-		yd = gc->proto_data;
-		
-		if( strcmp( gc->acc->prpl->name, "yahoo" ) == 0 && yd->y2_id == id )
-			return( gc );
+		ic = l->data;
+		yd = ic->proto_data;
+		
+		if( strcmp( ic->acc->prpl->name, "yahoo" ) == 0 && yd->y2_id == id )
+			return( ic );
 	}
 	
@@ -441,5 +440,5 @@
 	struct byahoo_connect_callback_data *d = data;
 	
-	if( !byahoo_get_gc_by_id( d->id ) )
+	if( !byahoo_get_ic_by_id( d->id ) )
 	{
 		g_free( d );
@@ -463,5 +462,5 @@
 	struct byahoo_read_ready_data *d = data;
 	
-	if( !byahoo_get_gc_by_id( d->id ) )
+	if( !byahoo_get_ic_by_id( d->id ) )
 		/* WTF doesn't libyahoo clean this up? */
 		return FALSE;
@@ -484,5 +483,5 @@
 	struct byahoo_write_ready_data *d = data;
 	
-	if( !byahoo_get_gc_by_id( d->id ) )
+	if( !byahoo_get_ic_by_id( d->id ) )
 		/* WTF doesn't libyahoo clean this up? */
 		return FALSE;
@@ -495,8 +494,8 @@
 void ext_yahoo_login_response( int id, int succ, char *url )
 {
-	struct gaim_connection *gc = byahoo_get_gc_by_id( id );
+	struct im_connection *ic = byahoo_get_ic_by_id( id );
 	struct byahoo_data *yd = NULL;
 	
-	if( gc == NULL )
+	if( ic == NULL )
 	{
 		/* libyahoo2 seems to call this one twice when something
@@ -508,9 +507,9 @@
 	}
 	
-	yd = (struct byahoo_data *) gc->proto_data;
+	yd = (struct byahoo_data *) ic->proto_data;
 	
 	if( succ == YAHOO_LOGIN_OK )
 	{
-		account_online( gc );
+		account_online( ic );
 		
 		yd->logged_in = TRUE;
@@ -532,5 +531,5 @@
 		{
 			errstr = "Logged in on a different machine or device";
-			gc->wants_to_die = TRUE;
+			ic->wants_to_die = TRUE;
 		}
 		else if( succ == YAHOO_LOGIN_SOCK )
@@ -551,11 +550,11 @@
 		
 		if( yd->logged_in )
-			hide_login_progress_error( gc, s );
+			hide_login_progress_error( ic, s );
 		else
-			hide_login_progress( gc, s );
+			hide_login_progress( ic, s );
 		
 		g_free( s );
 		
-		signoff( gc );
+		signoff( ic );
 	}
 }
@@ -563,6 +562,6 @@
 void ext_yahoo_got_buddies( int id, YList *buds )
 {
-	struct gaim_connection *gc = byahoo_get_gc_by_id( id );
-	struct byahoo_data *yd = gc->proto_data;
+	struct im_connection *ic = byahoo_get_ic_by_id( id );
+	struct byahoo_data *yd = ic->proto_data;
 	YList *bl = buds;
 	
@@ -581,5 +580,5 @@
 		}
 		
-		add_buddy( gc, b->group, b->id, b->real_name );
+		add_buddy( ic, b->group, b->id, b->real_name );
 		bl = bl->next;
 	}
@@ -600,7 +599,7 @@
 void ext_yahoo_status_changed( int id, char *who, int stat, char *msg, int away )
 {
-	struct gaim_connection *gc = byahoo_get_gc_by_id( id );
-	
-	serv_got_update( gc, who, stat != YAHOO_STATUS_OFFLINE, 0, 0,
+	struct im_connection *ic = byahoo_get_ic_by_id( id );
+	
+	serv_got_update( ic, who, stat != YAHOO_STATUS_OFFLINE, 0, 0,
 	                 ( stat == YAHOO_STATUS_IDLE ) ? away : 0,
 	                 ( stat != YAHOO_STATUS_AVAILABLE ) | ( stat << 1 ), 0 );
@@ -609,8 +608,8 @@
 void ext_yahoo_got_im( int id, char *who, char *msg, long tm, int stat, int utf8 )
 {
-	struct gaim_connection *gc = byahoo_get_gc_by_id( id );
+	struct im_connection *ic = byahoo_get_ic_by_id( id );
 	char *m = byahoo_strip( msg );
 	
-	serv_got_im( gc, who, m, 0, 0, strlen( m ) );
+	serv_got_im( ic, who, m, 0, 0, strlen( m ) );
 	g_free( m );
 }
@@ -618,19 +617,19 @@
 void ext_yahoo_got_file( int id, char *who, char *url, long expires, char *msg, char *fname, unsigned long fesize )
 {
-	struct gaim_connection *gc = byahoo_get_gc_by_id( id );
-	
-	serv_got_crap( gc, "Got a file transfer (file = %s) from %s. Ignoring for now due to lack of support.", fname, who );
+	struct im_connection *ic = byahoo_get_ic_by_id( id );
+	
+	serv_got_crap( ic, "Got a file transfer (file = %s) from %s. Ignoring for now due to lack of support.", fname, who );
 }
 
 void ext_yahoo_typing_notify( int id, char *who, int stat )
 {
-	struct gaim_connection *gc = byahoo_get_gc_by_id( id );
+	struct im_connection *ic = byahoo_get_ic_by_id( id );
 	if (stat == 1) {
 		/* User is typing */
-		serv_got_typing( gc, who, 1, 1 );
+		serv_got_typing( ic, who, 1, 1 );
 	}
 	else {
 		/* User stopped typing */
-		serv_got_typing( gc, who, 1, 0 );
+		serv_got_typing( ic, who, 1, 0 );
 	}
 }
@@ -638,28 +637,28 @@
 void ext_yahoo_system_message( int id, char *msg )
 {
-	struct gaim_connection *gc = byahoo_get_gc_by_id( id );
-	
-	serv_got_crap( gc, "Yahoo! system message: %s", msg );
+	struct im_connection *ic = byahoo_get_ic_by_id( id );
+	
+	serv_got_crap( ic, "Yahoo! system message: %s", msg );
 }
 
 void ext_yahoo_webcam_invite( int id, char *from )
 {
-	struct gaim_connection *gc = byahoo_get_gc_by_id( id );
-	
-	serv_got_crap( gc, "Got a webcam invitation from %s. IRC+webcams is a no-no though...", from );
+	struct im_connection *ic = byahoo_get_ic_by_id( id );
+	
+	serv_got_crap( ic, "Got a webcam invitation from %s. IRC+webcams is a no-no though...", from );
 }
 
 void ext_yahoo_error( int id, char *err, int fatal )
 {
-	struct gaim_connection *gc = byahoo_get_gc_by_id( id );
+	struct im_connection *ic = byahoo_get_ic_by_id( id );
 	
 	if( fatal )
 	{
-		hide_login_progress_error( gc, err );
-		signoff( gc );
+		hide_login_progress_error( ic, err );
+		signoff( ic );
 	}
 	else
 	{
-		do_error_dialog( gc, err, "Yahoo! error" );
+		do_error_dialog( ic, err, "Yahoo! error" );
 	}
 }
@@ -788,5 +787,5 @@
 {
 	yahoo_conference_logon( inv->yid, NULL, inv->members, inv->name );
-	add_chat_buddy( inv->c, inv->gc->username );
+	add_chat_buddy( inv->c, inv->ic->username );
 	g_free( inv->name );
 	g_free( inv );
@@ -803,5 +802,5 @@
 void ext_yahoo_got_conf_invite( int id, char *who, char *room, char *msg, YList *members )
 {
-	struct gaim_connection *gc = byahoo_get_gc_by_id( id );
+	struct im_connection *ic = byahoo_get_ic_by_id( id );
 	struct byahoo_conf_invitation *inv;
 	char txt[1024];
@@ -811,32 +810,32 @@
 	memset( inv, 0, sizeof( struct byahoo_conf_invitation ) );
 	inv->name = g_strdup( room );
-	inv->c = serv_got_joined_chat( gc, room );
+	inv->c = serv_got_joined_chat( ic, room );
 	inv->c->data = members;
 	inv->yid = id;
 	inv->members = members;
-	inv->gc = gc;
+	inv->ic = ic;
 	
 	for( m = members; m; m = m->next )
-		if( g_strcasecmp( m->data, gc->username ) != 0 )
+		if( g_strcasecmp( m->data, ic->username ) != 0 )
 			add_chat_buddy( inv->c, m->data );
 	
 	g_snprintf( txt, 1024, "Got an invitation to chatroom %s from %s: %s", room, who, msg );
 	
-	do_ask_dialog( gc, txt, inv, byahoo_accept_conf, byahoo_reject_conf );
+	do_ask_dialog( ic, txt, inv, byahoo_accept_conf, byahoo_reject_conf );
 }
 
 void ext_yahoo_conf_userdecline( int id, char *who, char *room, char *msg )
 {
-	struct gaim_connection *gc = byahoo_get_gc_by_id( id );
-	
-	serv_got_crap( gc, "Invite to chatroom %s rejected by %s: %s", room, who, msg );
+	struct im_connection *ic = byahoo_get_ic_by_id( id );
+	
+	serv_got_crap( ic, "Invite to chatroom %s rejected by %s: %s", room, who, msg );
 }
 
 void ext_yahoo_conf_userjoin( int id, char *who, char *room )
 {
-	struct gaim_connection *gc = byahoo_get_gc_by_id( id );
-	struct conversation *c;
-	
-	for( c = gc->conversations; c && strcmp( c->title, room ) != 0; c = c->next );
+	struct im_connection *ic = byahoo_get_ic_by_id( id );
+	struct groupchat *c;
+	
+	for( c = ic->conversations; c && strcmp( c->title, room ) != 0; c = c->next );
 	
 	if( c )
@@ -846,8 +845,8 @@
 void ext_yahoo_conf_userleave( int id, char *who, char *room )
 {
-	struct gaim_connection *gc = byahoo_get_gc_by_id( id );
-	struct conversation *c;
-	
-	for( c = gc->conversations; c && strcmp( c->title, room ) != 0; c = c->next );
+	struct im_connection *ic = byahoo_get_ic_by_id( id );
+	struct groupchat *c;
+	
+	for( c = ic->conversations; c && strcmp( c->title, room ) != 0; c = c->next );
 	
 	if( c )
@@ -857,9 +856,9 @@
 void ext_yahoo_conf_message( int id, char *who, char *room, char *msg, int utf8 )
 {
-	struct gaim_connection *gc = byahoo_get_gc_by_id( id );
+	struct im_connection *ic = byahoo_get_ic_by_id( id );
 	char *m = byahoo_strip( msg );
-	struct conversation *c;
-	
-	for( c = gc->conversations; c && strcmp( c->title, room ) != 0; c = c->next );
+	struct groupchat *c;
+	
+	for( c = ic->conversations; c && strcmp( c->title, room ) != 0; c = c->next );
 	
 	if( c )
@@ -910,10 +909,10 @@
 void ext_yahoo_mail_notify( int id, char *from, char *subj, int cnt )
 {
-	struct gaim_connection *gc = byahoo_get_gc_by_id( id );
+	struct im_connection *ic = byahoo_get_ic_by_id( id );
 	
 	if( from && subj )
-		serv_got_crap( gc, "Received e-mail message from %s with subject `%s'", from, subj );
+		serv_got_crap( ic, "Received e-mail message from %s with subject `%s'", from, subj );
 	else if( cnt > 0 )
-		serv_got_crap( gc, "Received %d new e-mails", cnt );
+		serv_got_crap( ic, "Received %d new e-mails", cnt );
 }
 
