Index: protocols/jabber/iq.c
===================================================================
--- protocols/jabber/iq.c	(revision 9bcbe48c6e8a3ab80e498b78b486c0e7cb3466fd)
+++ 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 );
