diff options
| author | Wilmer van der Gaast <wilmer@gaast.net> | 2007-03-30 22:40:45 -0700 | 
|---|---|---|
| committer | Wilmer van der Gaast <wilmer@gaast.net> | 2007-03-30 22:40:45 -0700 | 
| commit | 0da65d5fb37691ed4d31f7ab4058732f1440db6b (patch) | |
| tree | a4904e65af761a4503bbc8d4a117d9a0a0ed42f8 /protocols/nogaim.c | |
| parent | fa29d09342c79b886efacee4cfc3078be5f5a722 (diff) | |
s/gaim_connection/im_connection/ and some other minor API changes. The rest
will come tomorrow. It compiles, I'll leave the real testing up to someone
else. ;-)
Diffstat (limited to 'protocols/nogaim.c')
| -rw-r--r-- | protocols/nogaim.c | 428 | 
1 files changed, 214 insertions, 214 deletions
| diff --git a/protocols/nogaim.c b/protocols/nogaim.c index e983352f..987c08f2 100644 --- a/protocols/nogaim.c +++ b/protocols/nogaim.c @@ -35,7 +35,7 @@  #include "nogaim.h"  #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; @@ -114,25 +114,25 @@ struct prpl *find_protocol(const char *name)  /* nogaim.c */  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  #ifdef WITH_PLUGINS @@ -144,59 +144,59 @@ GSList *get_connections() { return connections; }  /* multi.c */ -struct gaim_connection *new_gaim_conn( account_t *acc ) +struct im_connection *new_gaim_conn( account_t *acc )  { -	struct gaim_connection *gc; +	struct im_connection *ic; -	gc = g_new0( struct gaim_connection, 1 ); +	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 ); +	g_snprintf( ic->username, sizeof( ic->username ), "%s", acc->user ); +	g_snprintf( ic->password, sizeof( ic->password ), "%s", acc->pass ); -	gc->irc = acc->irc; -	gc->acc = acc; -	acc->gc = gc; +	ic->irc = acc->irc; +	ic->acc = acc; +	acc->ic = ic; -	connections = g_slist_append( connections, gc ); +	connections = g_slist_append( connections, ic ); -	return( gc ); +	return( ic );  } -void destroy_gaim_conn( struct gaim_connection *gc ) +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 ) +	for( a = ic->irc->accounts; a; a = a->next ) +		if( a->ic == ic )  		{ -			a->gc = NULL; +			a->ic = NULL;  			break;  		} -	connections = g_slist_remove( connections, gc ); -	g_free( gc ); +	connections = g_slist_remove( connections, ic ); +	g_free( ic );  } -void set_login_progress( struct gaim_connection *gc, int step, char *msg ) +void set_login_progress( struct im_connection *ic, int step, char *msg )  { -	serv_got_crap( gc, "Logging in: %s", msg ); +	serv_got_crap( ic, "Logging in: %s", msg );  }  /* Errors *while* logging in */ -void hide_login_progress( struct gaim_connection *gc, char *msg ) +void hide_login_progress( struct im_connection *ic, char *msg )  { -	serv_got_crap( gc, "Login error: %s", msg ); +	serv_got_crap( ic, "Login error: %s", msg );  }  /* Errors *after* logging in */ -void hide_login_progress_error( struct gaim_connection *gc, char *msg ) +void hide_login_progress_error( struct im_connection *ic, char *msg )  { -	serv_got_crap( gc, "Logged out: %s", msg ); +	serv_got_crap( ic, "Logged out: %s", msg );  } -void serv_got_crap( struct gaim_connection *gc, char *format, ... ) +void serv_got_crap( struct im_connection *ic, char *format, ... )  {  	va_list params;  	char *text; @@ -206,54 +206,54 @@ void serv_got_crap( struct gaim_connection *gc, char *format, ... )  	text = g_strdup_vprintf( format, params );  	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 );  }  static gboolean send_keepalive( gpointer d, gint fd, b_input_condition cond )  { -	struct gaim_connection *gc = d; +	struct im_connection *ic = d; -	if( gc->acc->prpl->keepalive ) -		gc->acc->prpl->keepalive( gc ); +	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;  	/* MSN servers sometimes redirect you to a different server and do  	   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 ); +	u = user_find( ic->irc, ic->irc->nick ); -	serv_got_crap( gc, "Logged in" ); +	serv_got_crap( ic, "Logged in" ); -	gc->keepalive = b_timeout_add( 60000, send_keepalive, gc ); -	gc->flags |= OPT_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 );  }  gboolean auto_reconnect( gpointer data, gint fd, b_input_condition cond ) @@ -273,29 +273,29 @@ void cancel_auto_reconnect( account_t *a )  	a->reconnect = 0;  } -void signoff( struct gaim_connection *gc ) +void signoff( struct im_connection *ic )  { -	irc_t *irc = gc->irc; +	irc_t *irc = ic->irc;  	user_t *t, *u = irc->users;  	account_t *a;  	/* 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; +		ic->flags |= OPT_LOGGING_OUT; -	serv_got_crap( gc, "Signing off.." ); +	serv_got_crap( ic, "Signing off.." ); -	b_event_remove( gc->keepalive ); -	gc->keepalive = 0; -	gc->acc->prpl->close( gc ); -	b_event_remove( gc->inpa ); +	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;  			user_del( irc, u->nick ); @@ -305,65 +305,65 @@ void signoff( struct gaim_connection *gc )  			u = u->next;  	} -	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;  	if( !a )  	{  		/* 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 );  }  /* 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" ); +		serv_got_crap( ic, "Error" );  } -void do_ask_dialog( struct gaim_connection *gc, char *msg, void *data, void *doit, void *dont ) +void do_ask_dialog( struct im_connection *ic, char *msg, void *data, void *doit, void *dont )  { -	query_add( gc->irc, gc, msg, doit, dont, data ); +	query_add( ic->irc, ic, msg, doit, dont, data );  }  /* 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 ); +		serv_got_crap( ic, "Receiving user add from handle: %s", handle ); -	if( user_findhandle( gc, 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; @@ -371,9 +371,9 @@ void add_buddy( struct gaim_connection *gc, char *group, char *handle, char *rea  	}  	memset( nick, 0, MAX_NICK_LENGTH + 1 ); -	strcpy( nick, nick_get( gc->acc, handle, realname ) ); +	strcpy( nick, nick_get( ic->acc, handle, realname ) ); -	u = user_add( gc->irc, nick ); +	u = user_add( ic->irc, nick );  	if( !realname || !*realname ) realname = nick;  	u->realname = g_strdup( realname ); @@ -383,15 +383,15 @@ void add_buddy( struct gaim_connection *gc, char *group, char *handle, char *rea  		u->host = g_strdup( s + 1 );  		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 ); @@ -402,23 +402,23 @@ void add_buddy( struct gaim_connection *gc, char *group, char *handle, char *rea  	}  	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 );  	u->send_handler = buddy_send_handler;  	u->last_typing_notice = 0;  } -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 )  		return( NULL ); @@ -427,20 +427,20 @@ struct buddy *find_buddy( struct gaim_connection *gc, char *handle )  	strncpy( b->name, handle, 80 );  	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?) */  } -void serv_buddy_rename( struct gaim_connection *gc, char *handle, char *realname ) +void serv_buddy_rename( struct im_connection *ic, char *handle, char *realname )  { -	user_t *u = user_findhandle( gc, handle ); +	user_t *u = user_findhandle( ic, handle );  	if( !u ) return; @@ -450,8 +450,8 @@ void serv_buddy_rename( struct gaim_connection *gc, char *handle, char *realname  		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 );  	}  } @@ -460,7 +460,7 @@ void serv_buddy_rename( struct gaim_connection *gc, char *handle, char *realname  struct show_got_added_data  { -	struct gaim_connection *gc; +	struct im_connection *ic;  	char *handle;  }; @@ -472,51 +472,51 @@ void show_got_added_no( gpointer w, struct show_got_added_data *data )  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 );  	char *s;  	/* 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 );  }  /* 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 ) +		if( g_strcasecmp( set_getstr( &ic->irc->set, "handle_unknown" ), "add" ) == 0 )  		{ -			add_buddy( gc, NULL, handle, NULL ); -			u = user_findhandle( gc, handle ); +			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 );  			}  			return; @@ -536,26 +536,26 @@ void serv_got_update( struct gaim_connection *gc, char *handle, int loggedin, in  	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; +		struct groupchat *c; -		irc_kill( gc->irc, u ); +		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 )  			u->away = g_strdup( "Do Not Disturb" ); @@ -564,30 +564,30 @@ void serv_got_update( struct gaim_connection *gc, char *handle, int loggedin, in  		else // if( type & UC_AWAY )  			u->away = g_strdup( "Away" );  	} -	else if( ( type & UC_UNAVAILABLE ) && gc->acc->prpl->get_status_string ) +	else if( ( type & UC_UNAVAILABLE ) && ic->acc->prpl->get_status_string )  	{ -		u->away = g_strdup( gc->acc->prpl->get_status_string( gc, type ) ); +		u->away = g_strdup( ic->acc->prpl->get_status_string( ic, type ) );  	}  	else  		u->away = NULL;  	/* 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 ); +		irc_write( ic->irc, ":%s MODE %s %cv %s", ic->irc->myhost, +		                                                ic->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 ) +void serv_got_im( struct im_connection *ic, char *handle, char *msg, guint32 flags, time_t mtime, gint len )  { -	irc_t *irc = gc->irc; +	irc_t *irc = ic->irc;  	user_t *u; -	u = user_findhandle( gc, handle ); +	u = user_findhandle( ic, handle );  	if( !u )  	{ @@ -596,7 +596,7 @@ void serv_got_im( struct gaim_connection *gc, char *handle, char *msg, guint32 f  		if( g_strcasecmp( h, "ignore" ) == 0 )  		{  			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;  		} @@ -612,19 +612,19 @@ void serv_got_im( struct gaim_connection *gc, char *handle, char *msg, guint32 f  					private = 0;  			} -			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 );  	while( strlen( msg ) > 425 ) @@ -660,14 +660,14 @@ void serv_got_im( struct gaim_connection *gc, char *handle, char *msg, guint32 f  	irc_msgfrom( irc, u->nick, msg );  } -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  		 * 1: user is actively typing @@ -676,19 +676,19 @@ void serv_got_typing( struct gaim_connection *gc, char *handle, int timeout, int  		if (type == 0 || type == 1 || type == 2) {  			char buf[256];   			g_snprintf(buf, 256, "\1TYPING %d\1", type);  -			irc_privmsg( gc->irc, u, "PRIVMSG", gc->irc->nick, NULL, buf ); +			irc_privmsg( ic->irc, u, "PRIVMSG", ic->irc->nick, NULL, buf );  		}  	}  } -void serv_got_chat_left( struct conversation *c ) +void serv_got_chat_left( struct groupchat *c )  { -	struct gaim_connection *gc = c->gc; -	struct conversation *l = NULL; +	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 )  	{ @@ -696,18 +696,18 @@ void serv_got_chat_left( struct conversation *c )  		{  			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 ); */  		}  		if( l )  			l->next = c->next;  		else -			gc->conversations = c->next; +			ic->conversations = c->next;  		for( ir = c->in_room; ir; ir = ir->next )  			g_free( ir->data ); @@ -718,47 +718,47 @@ void serv_got_chat_left( struct conversation *c )  	}  } -void serv_got_chat_in( struct conversation *c, char *who, int whisper, char *msg, time_t mtime ) +void serv_got_chat_in( struct groupchat *c, char *who, int whisper, char *msg, time_t mtime )  { -	struct gaim_connection *gc = c->gc; +	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 ); +	u = user_findhandle( ic, 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" ) ) ) +	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 ); +		serv_got_crap( ic, "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 groupchat *serv_got_joined_chat( struct im_connection *ic, char *handle )  { -	struct conversation *c; +	struct groupchat *c;  	/* This one just creates the conversation structure, user won't see anything yet */ -	if( gc->conversations ) +	if( ic->conversations )  	{ -		for( c = gc->conversations; c->next; c = c->next ); -		c = c->next = g_new0( struct conversation, 1 ); +		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 ); +		ic->conversations = c = g_new0( struct groupchat, 1 ); -	c->gc = gc; +	c->ic = ic;  	c->title = g_strdup( handle ); -	c->channel = g_strdup_printf( "&chat_%03d", gc->irc->c_id++ ); +	c->channel = g_strdup_printf( "&chat_%03d", ic->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 ); +	if( set_getbool( &ic->irc->set, "debug" ) ) +		serv_got_crap( ic, "Creating new conversation: (id=0x%x,handle=%s)", (int) c, handle );  	return c;  } @@ -766,20 +766,20 @@ struct conversation *serv_got_joined_chat( struct gaim_connection *gc, char *han  /* buddy_chat.c */ -void add_chat_buddy( struct conversation *b, char *handle ) +void add_chat_buddy( struct groupchat *b, char *handle )  { -	user_t *u = user_findhandle( b->gc, 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 ) +	if( b->ic->acc->prpl->handle_cmp( handle, b->ic->username ) == 0 )  	{ -		u = user_find( b->gc->irc, b->gc->irc->nick ); +		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;  	} @@ -787,45 +787,45 @@ void add_chat_buddy( struct conversation *b, char *handle )  	   your contact list. Try to handle that here */  	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 );  	}  	/* Add the handle to the room userlist, if it's not 'me' */  	if( !me )  	{  		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 ) +	if( g_strcasecmp( handle, b->ic->username ) == 0 )  	{ -		u = user_find( b->gc->irc, b->gc->irc->nick ); +		u = user_find( b->ic->irc, b->ic->irc->nick );  		b->joined = 0;  		me = 1;  	}  	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 ); +			irc_part( b->ic->irc, u, b->channel );  } -static int remove_chat_buddy_silent( struct conversation *b, char *handle ) +static int remove_chat_buddy_silent( struct groupchat *b, char *handle )  {  	GList *i; @@ -849,17 +849,17 @@ static int remove_chat_buddy_silent( struct conversation *b, char *handle )  /* Misc. BitlBee stuff which shouldn't really be here */ -struct conversation *chat_by_channel( char *channel ) +struct groupchat *chat_by_channel( char *channel )  { -	struct gaim_connection *gc; -	struct conversation *c; +	struct im_connection *ic; +	struct groupchat *c;  	GSList *l;  	/* This finds the connection which has a conversation which belongs to this channel */  	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;  	} @@ -898,7 +898,7 @@ char *set_eval_away_devoice( set_t *set, char *value )  		while( u )  		{ -			if( u->gc && u->online && !u->away ) +			if( u->ic && u->online && !u->away )  			{  				if( ( strlen( list ) + strlen( u->nick ) ) >= 79 )  				{ @@ -932,49 +932,49 @@ char *set_eval_away_devoice( set_t *set, char *value )  /* The plan is to not allow straight calls to prpl functions anymore, but do     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 );  		msg = buf;  	} -	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 );  	return st;  } -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 );  		msg = buf;  	} -	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;  	char *s;  	if( !away ) away = ""; -	ms = m = gc->acc->prpl->away_states( gc ); +	ms = m = ic->acc->prpl->away_states( ic );  	while( m )  	{ @@ -995,19 +995,19 @@ int bim_set_away( struct gaim_connection *gc, char *away )  	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  	{  		s = bim_away_alias_find( ms, away );  		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 );  	}  	return( 1 ); @@ -1055,48 +1055,48 @@ static char *bim_away_alias_find( GList *gcm, char *away )  	return( NULL );  } -void bim_add_allow( struct gaim_connection *gc, char *handle ) +void bim_add_allow( struct im_connection *ic, char *handle )  { -	if( g_slist_find_custom( gc->permit, handle, (GCompareFunc) gc->acc->prpl->handle_cmp ) == NULL ) +	if( g_slist_find_custom( ic->permit, handle, (GCompareFunc) ic->acc->prpl->handle_cmp ) == NULL )  	{ -		gc->permit = g_slist_prepend( gc->permit, g_strdup( handle ) ); +		ic->permit = g_slist_prepend( ic->permit, g_strdup( handle ) );  	} -	gc->acc->prpl->add_permit( gc, handle ); +	ic->acc->prpl->add_permit( ic, handle );  } -void bim_rem_allow( struct gaim_connection *gc, char *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 ); +		ic->permit = g_slist_delete_link( ic->permit, l );  	} -	gc->acc->prpl->rem_permit( gc, handle ); +	ic->acc->prpl->rem_permit( ic, handle );  } -void bim_add_block( struct gaim_connection *gc, char *handle ) +void bim_add_block( struct im_connection *ic, char *handle )  { -	if( g_slist_find_custom( gc->deny, handle, (GCompareFunc) gc->acc->prpl->handle_cmp ) == NULL ) +	if( g_slist_find_custom( ic->deny, handle, (GCompareFunc) ic->acc->prpl->handle_cmp ) == NULL )  	{ -		gc->deny = g_slist_prepend( gc->deny, g_strdup( handle ) ); +		ic->deny = g_slist_prepend( ic->deny, g_strdup( handle ) );  	} -	gc->acc->prpl->add_deny( gc, handle ); +	ic->acc->prpl->add_deny( ic, handle );  } -void bim_rem_block( struct gaim_connection *gc, char *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 ); +		ic->deny = g_slist_delete_link( ic->deny, l );  	} -	gc->acc->prpl->rem_deny( gc, handle ); +	ic->acc->prpl->rem_deny( ic, handle );  } | 
