diff options
| -rw-r--r-- | account.c | 2 | ||||
| -rw-r--r-- | irc.c | 2 | ||||
| -rw-r--r-- | protocols/jabber/io.c | 54 | ||||
| -rw-r--r-- | protocols/jabber/iq.c | 40 | ||||
| -rw-r--r-- | protocols/jabber/jabber.c | 18 | ||||
| -rw-r--r-- | protocols/jabber/presence.c | 6 | ||||
| -rw-r--r-- | protocols/jabber/sasl.c | 20 | ||||
| -rw-r--r-- | protocols/msn/msn.c | 18 | ||||
| -rw-r--r-- | protocols/msn/msn_util.c | 6 | ||||
| -rw-r--r-- | protocols/msn/ns.c | 121 | ||||
| -rw-r--r-- | protocols/msn/sb.c | 11 | ||||
| -rw-r--r-- | protocols/nogaim.c | 107 | ||||
| -rw-r--r-- | protocols/nogaim.h | 15 | ||||
| -rw-r--r-- | protocols/oscar/chat.c | 6 | ||||
| -rw-r--r-- | protocols/oscar/chatnav.c | 10 | ||||
| -rw-r--r-- | protocols/oscar/icq.c | 2 | ||||
| -rw-r--r-- | protocols/oscar/im.c | 8 | ||||
| -rw-r--r-- | protocols/oscar/info.c | 6 | ||||
| -rw-r--r-- | protocols/oscar/oscar.c | 122 | ||||
| -rw-r--r-- | protocols/oscar/rxqueue.c | 2 | ||||
| -rw-r--r-- | protocols/oscar/search.c | 2 | ||||
| -rw-r--r-- | protocols/oscar/service.c | 4 | ||||
| -rw-r--r-- | protocols/oscar/txqueue.c | 8 | ||||
| -rw-r--r-- | protocols/yahoo/yahoo.c | 37 | ||||
| -rw-r--r-- | query.c | 8 | 
25 files changed, 308 insertions, 327 deletions
| @@ -223,7 +223,7 @@ void account_on( irc_t *irc, account_t *a )  void account_off( irc_t *irc, account_t *a )  {  	a->ic->wants_to_die = TRUE; -	signoff( a->ic ); +	imc_logout( a->ic );  	a->ic = NULL;  	if( a->reconnect )  	{ @@ -231,7 +231,7 @@ void irc_free(irc_t * irc)  	for (account = irc->accounts; account; account = account->next) {  		if (account->ic) {  			account->ic->wants_to_die = TRUE; -			signoff(account->ic); +			imc_logout(account->ic);  		} else if (account->reconnect) {  			cancel_auto_reconnect(account);  		} diff --git a/protocols/jabber/io.c b/protocols/jabber/io.c index 6e699301..699c7019 100644 --- a/protocols/jabber/io.c +++ b/protocols/jabber/io.c @@ -116,8 +116,8 @@ static gboolean jabber_write_queue( struct im_connection *ic )  		closesocket( jd->fd );	/* Shouldn't be necessary after errors? */  		jd->fd = -1; -		hide_login_progress_error( ic, "Short write() to server" ); -		signoff( ic ); +		imc_error( ic, "Short write() to server" ); +		imc_logout( ic );  		return FALSE;  	}  	else if( st > 0 ) @@ -159,8 +159,8 @@ static gboolean jabber_read_callback( gpointer data, gint fd, b_input_condition  		/* Parse. */  		if( xt_feed( jd->xt, buf, st ) < 0 )  		{ -			hide_login_progress_error( ic, "XML stream error" ); -			signoff( ic ); +			imc_error( ic, "XML stream error" ); +			imc_logout( ic );  			return FALSE;  		} @@ -202,9 +202,9 @@ static gboolean jabber_read_callback( gpointer data, gint fd, b_input_condition  					   SASL and TLS. */  					if( set_getbool( &ic->acc->set, "tls" ) )  					{ -						hide_login_progress( ic, "TLS is turned on for this " +						imc_error( ic, "TLS is turned on for this "  						          "account, but is not supported by this server" ); -						signoff( ic ); +						imc_logout( ic );  						return FALSE;  					}  					else @@ -215,8 +215,8 @@ static gboolean jabber_read_callback( gpointer data, gint fd, b_input_condition  			}  			else  			{ -				hide_login_progress( ic, "XML stream error" ); -				signoff( ic ); +				imc_error( ic, "XML stream error" ); +				imc_logout( ic );  				return FALSE;  			}  		} @@ -226,8 +226,8 @@ static gboolean jabber_read_callback( gpointer data, gint fd, b_input_condition  		closesocket( jd->fd );  		jd->fd = -1; -		hide_login_progress_error( ic, "Error while reading from server" ); -		signoff( ic ); +		imc_error( ic, "Error while reading from server" ); +		imc_logout( ic );  		return FALSE;  	} @@ -241,12 +241,12 @@ gboolean jabber_connected_plain( gpointer data, gint source, b_input_condition c  	if( source == -1 )  	{ -		hide_login_progress( ic, "Could not connect to server" ); -		signoff( ic ); +		imc_error( ic, "Could not connect to server" ); +		imc_logout( ic );  		return FALSE;  	} -	set_login_progress( ic, 1, "Connected to server, logging in" ); +	imc_log( ic, "Connected to server, logging in" );  	return jabber_start_stream( ic );  } @@ -262,19 +262,19 @@ gboolean jabber_connected_ssl( gpointer data, void *source, b_input_condition co  		   already, set it to NULL here to prevent a double cleanup: */  		jd->ssl = NULL; -		hide_login_progress( ic, "Could not connect to server" ); -		signoff( ic ); +		imc_error( ic, "Could not connect to server" ); +		imc_logout( ic );  		return FALSE;  	} -	set_login_progress( ic, 1, "Connected to server, logging in" ); +	imc_log( ic, "Connected to server, logging in" );  	return jabber_start_stream( ic );  }  static xt_status jabber_end_of_stream( struct xt_node *node, gpointer data )  { -	signoff( data ); +	imc_logout( data );  	return XT_ABORT;  } @@ -296,8 +296,8 @@ static xt_status jabber_pkt_features( struct xt_node *node, gpointer data )  		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 ); +			imc_error( ic, "Server requires TLS connections, but TLS is turned off for this account" ); +			imc_logout( ic );  			return XT_ABORT;  		} @@ -326,8 +326,8 @@ static xt_status jabber_pkt_features( struct xt_node *node, gpointer data )  		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 ); +			imc_error( ic, "TLS is turned on for this account, but is not supported by this server" ); +			imc_logout( ic );  			return XT_ABORT;  		} @@ -416,7 +416,7 @@ static xt_status jabber_pkt_proceed_tls( struct xt_node *node, gpointer data )  	}  	jd->w_inpa = jd->r_inpa = 0; -	set_login_progress( ic, 1, "Converting stream to TLS" ); +	imc_log( ic, "Converting stream to TLS" );  	jd->ssl = ssl_starttls( jd->fd, jabber_connected_ssl, ic ); @@ -451,8 +451,8 @@ static xt_status jabber_pkt_stream_error( struct xt_node *node, gpointer data )  	/* Tssk... */  	if( type == NULL )  	{ -		hide_login_progress_error( ic, "Unknown stream error reported by server" ); -		signoff( ic ); +		imc_error( ic, "Unknown stream error reported by server" ); +		imc_logout( ic );  		return XT_ABORT;  	} @@ -461,17 +461,17 @@ static xt_status jabber_pkt_stream_error( struct xt_node *node, gpointer data )  	   infinite loop! */  	if( strcmp( type, "conflict" ) == 0 )  	{ -		hide_login_progress( ic, "Account and resource used from a different location" ); +		imc_error( 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( ic, s ); +		imc_error( ic, s );  		g_free( s );  	} -	signoff( ic ); +	imc_logout( ic );  	return XT_ABORT;  } diff --git a/protocols/jabber/iq.c b/protocols/jabber/iq.c index 86d97e15..e1848272 100644 --- a/protocols/jabber/iq.c +++ b/protocols/jabber/iq.c @@ -38,8 +38,8 @@ xt_status jabber_pkt_iq( struct xt_node *node, gpointer data )  	if( !type )  	{ -		hide_login_progress_error( ic, "Received IQ packet without type." ); -		signoff( ic ); +		imc_error( ic, "Received IQ packet without type." ); +		imc_logout( ic );  		return XT_ABORT;  	} @@ -59,7 +59,7 @@ xt_status jabber_pkt_iq( struct xt_node *node, gpointer data )  		entry = g_hash_table_lookup( jd->node_cache, s );  		if( entry == NULL ) -			serv_got_crap( ic, "WARNING: Received IQ-%s packet with unknown/expired ID %s!", type, s ); +			imc_log( ic, "WARNING: Received IQ-%s packet with unknown/expired ID %s!", type, s );  		else if( entry->func )  			return entry->func( ic, node, entry->node );  	} @@ -68,7 +68,7 @@ xt_status jabber_pkt_iq( struct xt_node *node, gpointer data )  		if( !( c = xt_find_node( node->children, "query" ) ) ||  		    !( s = xt_find_attr( c, "xmlns" ) ) )  		{ -			serv_got_crap( ic, "WARNING: Received incomplete IQ-%s packet", type ); +			imc_log( ic, "WARNING: Received incomplete IQ-%s packet", type );  			return XT_HANDLED;  		} @@ -131,7 +131,7 @@ xt_status jabber_pkt_iq( struct xt_node *node, gpointer data )  		if( !( c = xt_find_node( node->children, "query" ) ) ||  		    !( s = xt_find_attr( c, "xmlns" ) ) )  		{ -			serv_got_crap( ic, "WARNING: Received incomplete IQ-%s packet", type ); +			imc_log( ic, "WARNING: Received incomplete IQ-%s packet", type );  			return XT_HANDLED;  		} @@ -153,7 +153,7 @@ xt_status jabber_pkt_iq( struct xt_node *node, gpointer data )  			}  			else  			{ -				serv_got_crap( ic, "WARNING: %s tried to fake a roster push!", s ? s : "(unknown)" ); +				imc_log( ic, "WARNING: %s tried to fake a roster push!", s ? s : "(unknown)" );  				xt_free_node( reply );  				reply = jabber_make_error_packet( node, "not-allowed", "cancel" ); @@ -218,8 +218,8 @@ static xt_status jabber_do_iq_auth( struct im_connection *ic, struct xt_node *no  	if( !( query = xt_find_node( node->children, "query" ) ) )  	{ -		serv_got_crap( ic, "WARNING: Received incomplete IQ packet while authenticating" ); -		signoff( ic ); +		imc_log( ic, "WARNING: Received incomplete IQ packet while authenticating" ); +		imc_logout( ic );  		return XT_HANDLED;  	} @@ -257,8 +257,8 @@ static xt_status jabber_do_iq_auth( struct im_connection *ic, struct xt_node *no  	{  		xt_free_node( reply ); -		hide_login_progress( ic, "Can't find suitable authentication method" ); -		signoff( ic ); +		imc_error( ic, "Can't find suitable authentication method" ); +		imc_logout( ic );  		return XT_ABORT;  	} @@ -276,15 +276,15 @@ static xt_status jabber_finish_iq_auth( struct im_connection *ic, struct xt_node  	if( !( type = xt_find_attr( node, "type" ) ) )  	{ -		serv_got_crap( ic, "WARNING: Received incomplete IQ packet while authenticating" ); -		signoff( ic ); +		imc_log( ic, "WARNING: Received incomplete IQ packet while authenticating" ); +		imc_logout( ic );  		return XT_HANDLED;  	}  	if( strcmp( type, "error" ) == 0 )  	{ -		hide_login_progress( ic, "Authentication failure" ); -		signoff( ic ); +		imc_error( ic, "Authentication failure" ); +		imc_logout( ic );  		return XT_ABORT;  	}  	else if( strcmp( type, "result" ) == 0 ) @@ -310,7 +310,7 @@ xt_status jabber_pkt_bind_sess( struct im_connection *ic, struct xt_node *node,  		c = xt_find_node( c->children, "jid" );  		if( c && c->text_len && ( s = strchr( c->text, '/' ) ) &&  		    strcmp( s + 1, set_getstr( &ic->acc->set, "resource" ) ) != 0 ) -			serv_got_crap( ic, "Server changed session resource string to `%s'", s + 1 ); +			imc_log( ic, "Server changed session resource string to `%s'", s + 1 );  		jd->flags &= ~JFLAG_WAIT_BIND;  	} @@ -333,7 +333,7 @@ int jabber_get_roster( struct im_connection *ic )  	struct xt_node *node;  	int st; -	set_login_progress( ic, 1, "Authenticated, requesting buddy list" ); +	imc_log( ic, "Authenticated, requesting buddy list" );  	node = xt_new_node( "query", NULL, NULL );  	xt_add_attr( node, "xmlns", XMLNS_ROSTER ); @@ -352,7 +352,7 @@ static xt_status jabber_parse_roster( struct im_connection *ic, struct xt_node *  	if( !( query = xt_find_node( node->children, "query" ) ) )  	{ -		serv_got_crap( ic, "WARNING: Received NULL roster packet" ); +		imc_log( ic, "WARNING: Received NULL roster packet" );  		return XT_HANDLED;  	} @@ -396,7 +396,7 @@ static xt_status jabber_parse_roster( struct im_connection *ic, struct xt_node *  	}  	if( initial ) -		account_online( ic ); +		imc_connected( ic );  	return XT_HANDLED;  } @@ -427,7 +427,7 @@ static xt_status jabber_iq_display_vcard( struct im_connection *ic, struct xt_no  	    ( vc = xt_find_node( node->children, "vCard" ) ) == NULL )  	{  		s = xt_find_attr( orig, "to" ); /* If this returns NULL something's wrong.. */ -		serv_got_crap( ic, "Could not retrieve vCard of %s", s ? s : "(NULL)" ); +		imc_log( ic, "Could not retrieve vCard of %s", s ? s : "(NULL)" );  		return XT_HANDLED;  	} @@ -535,7 +535,7 @@ static xt_status jabber_iq_display_vcard( struct im_connection *ic, struct xt_no  	/* *sigh* */ -	serv_got_crap( ic, reply->str ); +	imc_log( ic, reply->str );  	g_string_free( reply, TRUE );  	return XT_HANDLED; diff --git a/protocols/jabber/jabber.c b/protocols/jabber/jabber.c index 23de1103..ec0df487 100644 --- a/protocols/jabber/jabber.c +++ b/protocols/jabber/jabber.c @@ -58,7 +58,7 @@ static void jabber_init( account_t *acc )  static void jabber_login( account_t *acc )  { -	struct im_connection *ic = new_gaim_conn( acc ); +	struct im_connection *ic = imc_new( acc );  	struct jabber_data *jd = g_new0( struct jabber_data, 1 );  	struct ns_srv_reply *srv = NULL;  	char *connect_to, *s; @@ -71,8 +71,8 @@ static void jabber_login( account_t *acc )  	if( jd->server == NULL )  	{ -		hide_login_progress( ic, "Incomplete account name (format it like <username@jabberserver.name>)" ); -		signoff( ic ); +		imc_error( ic, "Incomplete account name (format it like <username@jabberserver.name>)" ); +		imc_logout( ic );  		return;  	} @@ -158,14 +158,14 @@ static void jabber_login( account_t *acc )  	else  		connect_to = jd->server; -	set_login_progress( ic, 0, "Connecting" ); +	imc_log( ic, "Connecting" );  	if( set_getint( &acc->set, "port" ) < JABBER_PORT_MIN ||  	    set_getint( &acc->set, "port" ) > JABBER_PORT_MAX )  	{ -		serv_got_crap( ic, "Incorrect port number, must be in the %d-%d range", +		imc_log( ic, "Incorrect port number, must be in the %d-%d range",  		               JABBER_PORT_MIN, JABBER_PORT_MAX ); -		signoff( ic ); +		imc_logout( ic );  		return;  	} @@ -185,8 +185,8 @@ static void jabber_login( account_t *acc )  	if( jd->fd == -1 )  	{ -		hide_login_progress( ic, "Could not connect to server" ); -		signoff( ic ); +		imc_error( ic, "Could not connect to server" ); +		imc_logout( ic );  	}  } @@ -284,7 +284,7 @@ static void jabber_get_info( struct im_connection *ic, char *who )  	while( bud )  	{ -		serv_got_crap( ic, "Buddy %s (%d) information:\nAway state: %s\nAway message: %s", +		imc_log( 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)",  		                   bud->away_message ? : "(none)" ); diff --git a/protocols/jabber/presence.c b/protocols/jabber/presence.c index 2db32fd1..634948bf 100644 --- a/protocols/jabber/presence.c +++ b/protocols/jabber/presence.c @@ -40,7 +40,7 @@ xt_status jabber_pkt_presence( struct xt_node *node, gpointer data )  		if( !( bud = jabber_buddy_by_jid( ic, from, GET_BUDDY_EXACT | GET_BUDDY_CREAT ) ) )  		{  			if( set_getbool( &ic->irc->set, "debug" ) ) -				serv_got_crap( ic, "WARNING: Could not handle presence information from JID: %s", from ); +				imc_log( ic, "WARNING: Could not handle presence information from JID: %s", from );  			return XT_HANDLED;  		} @@ -73,7 +73,7 @@ xt_status jabber_pkt_presence( struct xt_node *node, gpointer data )  		if( jabber_buddy_by_jid( ic, from, GET_BUDDY_EXACT ) == NULL )  		{  			if( set_getbool( &ic->irc->set, "debug" ) ) -				serv_got_crap( ic, "WARNING: Received presence information from unknown JID: %s", from ); +				imc_log( ic, "WARNING: Received presence information from unknown JID: %s", from );  			return XT_HANDLED;  		} @@ -102,7 +102,7 @@ xt_status jabber_pkt_presence( struct xt_node *node, gpointer data )  	else if( strcmp( type, "subscribed" ) == 0 )  	{  		/* Not sure about this one, actually... */ -		serv_got_crap( ic, "%s just accepted your authorization request", from ); +		imc_log( ic, "%s just accepted your authorization request", from );  	}  	else if( strcmp( type, "unsubscribe" ) == 0 || strcmp( type, "unsubscribed" ) == 0 )  	{ diff --git a/protocols/jabber/sasl.c b/protocols/jabber/sasl.c index 4943f59e..ab6f6c00 100644 --- a/protocols/jabber/sasl.c +++ b/protocols/jabber/sasl.c @@ -37,14 +37,14 @@ xt_status sasl_pkt_mechanisms( struct xt_node *node, gpointer data )  		/* Should abort this now, since we should already be doing  		   IQ authentication. Strange things happen when you try  		   to do both... */ -		serv_got_crap( ic, "XMPP 1.0 non-compliant server seems to support SASL, please report this as a BitlBee bug!" ); +		imc_log( ic, "XMPP 1.0 non-compliant server seems to support SASL, please report this as a BitlBee bug!" );  		return XT_HANDLED;  	}  	s = xt_find_attr( node, "xmlns" );  	if( !s || strcmp( s, XMLNS_SASL ) != 0 )  	{ -		signoff( ic ); +		imc_logout( ic );  		return XT_ABORT;  	} @@ -61,8 +61,8 @@ xt_status sasl_pkt_mechanisms( struct xt_node *node, gpointer data )  	if( !sup_plain && !sup_digest )  	{ -		hide_login_progress( ic, "No known SASL authentication schemes supported" ); -		signoff( ic ); +		imc_error( ic, "No known SASL authentication schemes supported" ); +		imc_logout( ic );  		return XT_ABORT;  	} @@ -278,8 +278,8 @@ xt_status sasl_pkt_challenge( struct xt_node *node, gpointer data )  	goto silent_error;  error: -	hide_login_progress( ic, "Incorrect SASL challenge received" ); -	signoff( ic ); +	imc_error( ic, "Incorrect SASL challenge received" ); +	imc_logout( ic );  silent_error:  	g_free( digest_uri ); @@ -302,19 +302,19 @@ xt_status sasl_pkt_result( struct xt_node *node, gpointer data )  	s = xt_find_attr( node, "xmlns" );  	if( !s || strcmp( s, XMLNS_SASL ) != 0 )  	{ -		signoff( ic ); +		imc_logout( ic );  		return XT_ABORT;  	}  	if( strcmp( node->name, "success" ) == 0 )  	{ -		set_login_progress( ic, 1, "Authentication finished" ); +		imc_log( ic, "Authentication finished" );  		jd->flags |= JFLAG_AUTHENTICATED | JFLAG_STREAM_RESTART;  	}  	else if( strcmp( node->name, "failure" ) == 0 )  	{ -		hide_login_progress( ic, "Authentication failure" ); -		signoff( ic ); +		imc_error( ic, "Authentication failure" ); +		imc_logout( ic );  		return XT_ABORT;  	} diff --git a/protocols/msn/msn.c b/protocols/msn/msn.c index afc90627..860be01b 100644 --- a/protocols/msn/msn.c +++ b/protocols/msn/msn.c @@ -38,7 +38,7 @@ static void msn_init( account_t *acc )  static void msn_login( account_t *acc )  { -	struct im_connection *ic = new_gaim_conn( acc ); +	struct im_connection *ic = imc_new( acc );  	struct msn_data *md = g_new0( struct msn_data, 1 );  	ic->proto_data = md; @@ -46,18 +46,18 @@ static void msn_login( account_t *acc )  	if( strchr( acc->user, '@' ) == NULL )  	{ -		hide_login_progress( ic, "Invalid account name" ); -		signoff( ic ); +		imc_error( ic, "Invalid account name" ); +		imc_logout( ic );  		return;  	} -	set_login_progress( ic, 1, "Connecting" ); +	imc_log( ic, "Connecting" );  	md->fd = proxy_connect( "messenger.hotmail.com", 1863, msn_ns_connected, ic );  	if( md->fd < 0 )  	{ -		hide_login_progress( ic, "Could not connect to server" ); -		signoff( ic ); +		imc_error( ic, "Could not connect to server" ); +		imc_logout( ic );  		return;  	} @@ -95,7 +95,7 @@ static void msn_logout( struct im_connection *ic )  			{  				m = l->data; -				serv_got_crap( ic, "Warning: Closing down MSN connection with unsent message to %s, you'll have to resend it.", m->who ); +				imc_log( 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 );  				g_free( m ); @@ -227,7 +227,7 @@ static void msn_set_my_name( struct im_connection *ic, char *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( ic, "%s\n%s: %s%s", _("User Info"), _("For now, fetch yourself"), PROFILE_URL, who ); +	imc_log( 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 ) @@ -372,7 +372,7 @@ static char *msn_set_display_name( set_t *set, char *value )  	if( strlen( value ) > 129 )  	{ -		serv_got_crap( ic, "Maximum name length exceeded" ); +		imc_log( ic, "Maximum name length exceeded" );  		return NULL;  	} diff --git a/protocols/msn/msn_util.c b/protocols/msn/msn_util.c index 1be1586c..72411095 100644 --- a/protocols/msn/msn_util.c +++ b/protocols/msn/msn_util.c @@ -35,8 +35,8 @@ int msn_write( struct im_connection *ic, char *s, int len )  	st = write( md->fd, s, len );  	if( st != len )  	{ -		hide_login_progress_error( ic, "Short write() to main server" ); -		signoff( ic ); +		imc_error( ic, "Short write() to main server" ); +		imc_logout( ic );  		return( 0 );  	} @@ -45,7 +45,7 @@ int msn_write( struct im_connection *ic, char *s, int len )  int msn_logged_in( struct im_connection *ic )  { -	account_online( ic ); +	imc_connected( ic );  	return( 0 );  } diff --git a/protocols/msn/ns.c b/protocols/msn/ns.c index 9d86a68e..e4530b8f 100644 --- a/protocols/msn/ns.c +++ b/protocols/msn/ns.c @@ -46,8 +46,8 @@ gboolean msn_ns_connected( gpointer data, gint source, b_input_condition cond )  	if( source == -1 )  	{ -		hide_login_progress( ic, "Could not connect to server" ); -		signoff( ic ); +		imc_error( ic, "Could not connect to server" ); +		imc_logout( ic );  		return FALSE;  	} @@ -75,7 +75,7 @@ gboolean msn_ns_connected( gpointer data, gint source, b_input_condition cond )  	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" ); +		imc_log( ic, "Connected to server, waiting for reply" );  	}  	return FALSE; @@ -88,8 +88,8 @@ static gboolean msn_ns_callback( gpointer data, gint source, b_input_condition c  	if( msn_handler( md->handler ) == -1 ) /* Don't do this on ret == 0, it's already done then. */  	{ -		hide_login_progress( ic, "Error while reading from server" ); -		signoff( ic ); +		imc_error( ic, "Error while reading from server" ); +		imc_logout( ic );  		return FALSE;  	} @@ -113,8 +113,8 @@ static int msn_ns_command( gpointer data, char **cmd, int num_parts )  	{  		if( cmd[2] && strncmp( cmd[2], "MSNP8", 5 ) != 0 )  		{ -			hide_login_progress( ic, "Unsupported protocol" ); -			signoff( ic ); +			imc_error( ic, "Unsupported protocol" ); +			imc_logout( ic );  			return( 0 );  		} @@ -142,15 +142,15 @@ static int msn_ns_command( gpointer data, char **cmd, int num_parts )  			server = strchr( cmd[3], ':' );  			if( !server )  			{ -				hide_login_progress_error( ic, "Syntax error" ); -				signoff( ic ); +				imc_error( ic, "Syntax error" ); +				imc_logout( ic );  				return( 0 );  			}  			*server = 0;  			port = atoi( server + 1 );  			server = cmd[3]; -			set_login_progress( ic, 1, "Transferring to other server" ); +			imc_log( ic, "Transferring to other server" );  			md->fd = proxy_connect( server, port, msn_ns_connected, ic );  		} @@ -161,8 +161,8 @@ static int msn_ns_command( gpointer data, char **cmd, int num_parts )  			server = strchr( cmd[3], ':' );  			if( !server )  			{ -				hide_login_progress_error( ic, "Syntax error" ); -				signoff( ic ); +				imc_error( ic, "Syntax error" ); +				imc_logout( ic );  				return( 0 );  			}  			*server = 0; @@ -171,8 +171,8 @@ static int msn_ns_command( gpointer data, char **cmd, int num_parts )  			if( strcmp( cmd[4], "CKI" ) != 0 )  			{ -				hide_login_progress_error( ic, "Unknown authentication method for switchboard" ); -				signoff( ic ); +				imc_error( ic, "Unknown authentication method for switchboard" ); +				imc_logout( ic );  				return( 0 );  			} @@ -203,8 +203,8 @@ static int msn_ns_command( gpointer data, char **cmd, int num_parts )  		}  		else  		{ -			hide_login_progress_error( ic, "Syntax error" ); -			signoff( ic ); +			imc_error( ic, "Syntax error" ); +			imc_logout( ic );  			return( 0 );  		}  	} @@ -215,8 +215,8 @@ static int msn_ns_command( gpointer data, char **cmd, int num_parts )  			/* Time for some Passport black magic... */  			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 ); +				imc_error( ic, "Error while contacting Passport server" ); +				imc_logout( ic );  				return( 0 );  			}  		} @@ -235,15 +235,15 @@ static int msn_ns_command( gpointer data, char **cmd, int num_parts )  				s->value = g_strdup( cmd[4] );  			} -			set_login_progress( ic, 1, "Authenticated, getting buddy list" ); +			imc_log( ic, "Authenticated, getting buddy list" );  			g_snprintf( buf, sizeof( buf ), "SYN %d 0\r\n", ++md->trId );  			return( msn_write( ic, buf, strlen( buf ) ) );  		}  		else  		{ -			hide_login_progress( ic, "Unknown authentication type" ); -			signoff( ic ); +			imc_error( ic, "Unknown authentication type" ); +			imc_logout( ic );  			return( 0 );  		}  	} @@ -251,8 +251,8 @@ static int msn_ns_command( gpointer data, char **cmd, int num_parts )  	{  		if( num_parts != 4 )  		{ -			hide_login_progress_error( ic, "Syntax error" ); -			signoff( ic ); +			imc_error( ic, "Syntax error" ); +			imc_logout( ic );  			return( 0 );  		} @@ -260,8 +260,8 @@ static int msn_ns_command( gpointer data, char **cmd, int num_parts )  		if( md->handler->msglen <= 0 )  		{ -			hide_login_progress_error( ic, "Syntax error" ); -			signoff( ic ); +			imc_error( ic, "Syntax error" ); +			imc_logout( ic );  			return( 0 );  		}  	} @@ -291,8 +291,8 @@ static int msn_ns_command( gpointer data, char **cmd, int num_parts )  		if( num_parts != 4 && num_parts != 5 )  		{ -			hide_login_progress( ic, "Syntax error" ); -			signoff( ic ); +			imc_error( ic, "Syntax error" ); +			imc_logout( ic );  			return( 0 );  		} @@ -327,7 +327,7 @@ static int msn_ns_command( gpointer data, char **cmd, int num_parts )  		{  			if( ic->flags & OPT_LOGGED_IN )  			{ -				serv_got_crap( ic, "Successfully transferred to different server" ); +				imc_log( 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( ic, buf, strlen( buf ) ) );  			} @@ -343,8 +343,8 @@ static int msn_ns_command( gpointer data, char **cmd, int num_parts )  		if( num_parts != 4 )  		{ -			hide_login_progress_error( ic, "Syntax error" ); -			signoff( ic ); +			imc_error( ic, "Syntax error" ); +			imc_logout( ic );  			return( 0 );  		} @@ -362,8 +362,8 @@ static int msn_ns_command( gpointer data, char **cmd, int num_parts )  		if( num_parts != 3 )  		{ -			hide_login_progress_error( ic, "Syntax error" ); -			signoff( ic ); +			imc_error( ic, "Syntax error" ); +			imc_logout( ic );  			return( 0 );  		} @@ -384,8 +384,8 @@ static int msn_ns_command( gpointer data, char **cmd, int num_parts )  		if( num_parts != 6 )  		{ -			hide_login_progress_error( ic, "Syntax error" ); -			signoff( ic ); +			imc_error( ic, "Syntax error" ); +			imc_logout( ic );  			return( 0 );  		} @@ -412,8 +412,8 @@ static int msn_ns_command( gpointer data, char **cmd, int num_parts )  		if( num_parts != 5 )  		{ -			hide_login_progress_error( ic, "Syntax error" ); -			signoff( ic ); +			imc_error( ic, "Syntax error" ); +			imc_logout( ic );  			return( 0 );  		} @@ -437,8 +437,8 @@ static int msn_ns_command( gpointer data, char **cmd, int num_parts )  		if( num_parts != 7 )  		{ -			hide_login_progress_error( ic, "Syntax error" ); -			signoff( ic ); +			imc_error( ic, "Syntax error" ); +			imc_logout( ic );  			return( 0 );  		} @@ -447,8 +447,8 @@ static int msn_ns_command( gpointer data, char **cmd, int num_parts )  		server = strchr( cmd[2], ':' );  		if( !server )  		{ -			hide_login_progress_error( ic, "Syntax error" ); -			signoff( ic ); +			imc_error( ic, "Syntax error" ); +			imc_logout( ic );  			return( 0 );  		}  		*server = 0; @@ -457,8 +457,8 @@ static int msn_ns_command( gpointer data, char **cmd, int num_parts )  		if( strcmp( cmd[3], "CKI" ) != 0 )  		{ -			hide_login_progress_error( ic, "Unknown authentication method for switchboard" ); -			signoff( ic ); +			imc_error( ic, "Unknown authentication method for switchboard" ); +			imc_logout( ic );  			return( 0 );  		} @@ -477,8 +477,8 @@ static int msn_ns_command( gpointer data, char **cmd, int num_parts )  			if( strchr( cmd[4], '@' ) == NULL )  			{ -				hide_login_progress_error( ic, "Syntax error" ); -				signoff( ic ); +				imc_error( ic, "Syntax error" ); +				imc_logout( ic );  				return( 0 );  			} @@ -498,27 +498,27 @@ static int msn_ns_command( gpointer data, char **cmd, int num_parts )  	{  		if( cmd[1] && strcmp( cmd[1], "OTH" ) == 0 )  		{ -			hide_login_progress_error( ic, "Someone else logged in with your account" ); +			imc_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( ic, "Terminating session because of server shutdown" ); +			imc_error( ic, "Terminating session because of server shutdown" );  		}  		else  		{ -			hide_login_progress_error( ic, "Session terminated by remote server (reason unknown)" ); +			imc_error( ic, "Session terminated by remote server (reason unknown)" );  		} -		signoff( ic ); +		imc_logout( ic );  		return( 0 );  	}  	else if( strcmp( cmd[0], "REA" ) == 0 )  	{  		if( num_parts != 5 )  		{ -			hide_login_progress_error( ic, "Syntax error" ); -			signoff( ic ); +			imc_error( ic, "Syntax error" ); +			imc_logout( ic );  			return( 0 );  		} @@ -545,14 +545,14 @@ static int msn_ns_command( gpointer data, char **cmd, int num_parts )  	}  	else if( strcmp( cmd[0], "IPG" ) == 0 )  	{ -		do_error_dialog( ic, "Received IPG command, we don't handle them yet.", "MSN" ); +		imc_error( ic, "Received IPG command, we don't handle them yet." );  		md->handler->msglen = atoi( cmd[1] );  		if( md->handler->msglen <= 0 )  		{ -			hide_login_progress_error( ic, "Syntax error" ); -			signoff( ic ); +			imc_error( ic, "Syntax error" ); +			imc_logout( ic );  			return( 0 );  		}  	} @@ -561,12 +561,11 @@ static int msn_ns_command( gpointer data, char **cmd, int num_parts )  		int num = atoi( cmd[0] );  		const struct msn_status_code *err = msn_status_by_number( num ); -		g_snprintf( buf, sizeof( buf ), "Error reported by MSN server: %s", err->text ); -		do_error_dialog( ic, buf, "MSN" ); +		imc_error( ic, "Error reported by MSN server: %s", err->text );  		if( err->flags & STATUS_FATAL )  		{ -			signoff( ic ); +			imc_logout( ic );  			return( 0 );  		}  	} @@ -616,7 +615,7 @@ static int msn_ns_message( gpointer data, char *msg, int msglen, char **cmd, int  				if( mtype && strcmp( mtype, "1" ) == 0 )  				{  					if( arg1 ) -						serv_got_crap( ic, "The server is going down for maintenance in %s minutes.", arg1 ); +						imc_log( ic, "The server is going down for maintenance in %s minutes.", arg1 );  				}  				if( arg1 ) g_free( arg1 ); @@ -633,7 +632,7 @@ static int msn_ns_message( gpointer data, char *msg, int msglen, char **cmd, int  				if( inbox && folders )  				{ -					serv_got_crap( ic, "INBOX contains %s new messages, plus %s messages in other folders.", inbox, folders ); +					imc_log( ic, "INBOX contains %s new messages, plus %s messages in other folders.", inbox, folders );  				}  			}  			else if( g_strncasecmp( ct, "text/x-msmsgsemailnotification", 30 ) == 0 ) @@ -643,7 +642,7 @@ static int msn_ns_message( gpointer data, char *msg, int msglen, char **cmd, int  				if( from && fromname )  				{ -					serv_got_crap( ic, "Received an e-mail message from %s <%s>.", fromname, from ); +					imc_log( ic, "Received an e-mail message from %s <%s>.", fromname, from );  				}  			}  			else if( g_strncasecmp( ct, "text/x-msmsgsactivemailnotification", 35 ) == 0 ) @@ -676,8 +675,8 @@ static void msn_auth_got_passport_id( struct passport_reply *rep )  		err = g_strdup_printf( "Error during Passport authentication (%s)",  		                       rep->error_string ? rep->error_string : "Unknown error" ); -		hide_login_progress( ic, err ); -		signoff( ic ); +		imc_error( ic, err ); +		imc_logout( ic );  		g_free( err );  	} diff --git a/protocols/msn/sb.c b/protocols/msn/sb.c index f9c755a5..f7007d32 100644 --- a/protocols/msn/sb.c +++ b/protocols/msn/sb.c @@ -221,7 +221,7 @@ void msn_sb_destroy( struct msn_switchboard *sb )  		}  		g_slist_free( sb->msgq ); -		serv_got_crap( ic, "Warning: Closing down MSN switchboard connection with " +		imc_log( ic, "Warning: Closing down MSN switchboard connection with "  		                   "unsent message to %s, you'll have to resend it.",  		                   sb->who ? sb->who : "(unknown)" );  	} @@ -320,8 +320,8 @@ static int msn_sb_command( gpointer data, char **cmd, int num_parts )  	if( strcmp( cmd[0], "XFR" ) == 0 )  	{ -		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 ); +		imc_error( ic, "Received an XFR from a switchboard server, unable to comply! This is likely to be a bug, please report it!" ); +		imc_logout( ic );  		return( 0 );  	}  	else if( strcmp( cmd[0], "USR" ) == 0 ) @@ -527,8 +527,7 @@ static int msn_sb_command( gpointer data, char **cmd, int num_parts )  		int num = atoi( cmd[0] );  		const struct msn_status_code *err = msn_status_by_number( num ); -		g_snprintf( buf, sizeof( buf ), "Error reported by switchboard server: %s", err->text ); -		do_error_dialog( ic, buf, "MSN" ); +		imc_error( ic, "Error reported by switchboard server: %s", err->text );  		if( err->flags & STATUS_SB_FATAL )  		{ @@ -537,7 +536,7 @@ static int msn_sb_command( gpointer data, char **cmd, int num_parts )  		}  		else if( err->flags & STATUS_FATAL )  		{ -			signoff( ic ); +			imc_logout( ic );  			return 0;  		}  		else if( err->flags & STATUS_SB_IM_SPARE ) diff --git a/protocols/nogaim.c b/protocols/nogaim.c index 987c08f2..0c042bac 100644 --- a/protocols/nogaim.c +++ b/protocols/nogaim.c @@ -144,7 +144,7 @@ GSList *get_connections() { return connections; }  /* multi.c */ -struct im_connection *new_gaim_conn( account_t *acc ) +struct im_connection *imc_new( account_t *acc )  {  	struct im_connection *ic; @@ -163,7 +163,7 @@ struct im_connection *new_gaim_conn( account_t *acc )  	return( ic );  } -void destroy_gaim_conn( struct im_connection *ic ) +void imc_free( struct im_connection *ic )  {  	account_t *a; @@ -179,24 +179,7 @@ void destroy_gaim_conn( struct im_connection *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 im_connection *ic, char *msg ) -{ -	serv_got_crap( ic, "Login error: %s", msg ); -} - -/* Errors *after* logging in */ -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, ... ) +static void serv_got_crap( struct im_connection *ic, char *format, ... )  {  	va_list params;  	char *text; @@ -224,6 +207,40 @@ void serv_got_crap( struct im_connection *ic, char *format, ... )  	g_free( text );  } +void imc_log( struct im_connection *ic, char *format, ... ) +{ +	va_list params; +	char *text; +	 +	va_start( params, format ); +	text = g_strdup_vprintf( format, params ); +	va_end( params ); +	 +	if( ic->flags & OPT_LOGGED_IN ) +		serv_got_crap( ic, "%s", text ); +	else +		serv_got_crap( ic, "Logging in: %s", text ); +	 +	g_free( text ); +} + +void imc_error( struct im_connection *ic, char *format, ... ) +{ +	va_list params; +	char *text; +	 +	va_start( params, format ); +	text = g_strdup_vprintf( format, params ); +	va_end( params ); +	 +	if( ic->flags & OPT_LOGGED_IN ) +		serv_got_crap( ic, "Error: %s", text ); +	else +		serv_got_crap( ic, "Couldn't log in: %s", text ); +	 +	g_free( text ); +} +  static gboolean send_keepalive( gpointer d, gint fd, b_input_condition cond )  {  	struct im_connection *ic = d; @@ -234,7 +251,7 @@ static gboolean send_keepalive( gpointer d, gint fd, b_input_condition cond )  	return TRUE;  } -void account_online( struct im_connection *ic ) +void imc_connected( struct im_connection *ic )  {  	user_t *u; @@ -246,7 +263,7 @@ void account_online( struct im_connection *ic )  	u = user_find( ic->irc, ic->irc->nick ); -	serv_got_crap( ic, "Logged in" ); +	imc_log( ic, "Logged in" );  	ic->keepalive = b_timeout_add( 60000, send_keepalive, ic );  	ic->flags |= OPT_LOGGED_IN; @@ -273,7 +290,7 @@ void cancel_auto_reconnect( account_t *a )  	a->reconnect = 0;  } -void signoff( struct im_connection *ic ) +void imc_logout( struct im_connection *ic )  {  	irc_t *irc = ic->irc;  	user_t *t, *u = irc->users; @@ -286,7 +303,7 @@ void signoff( struct im_connection *ic )  	else  		ic->flags |= OPT_LOGGING_OUT; -	serv_got_crap( ic, "Signing off.." ); +	imc_log( ic, "Signing off.." );  	b_event_remove( ic->keepalive );  	ic->keepalive = 0; @@ -320,28 +337,16 @@ void signoff( struct im_connection *ic )  	{  		int delay = set_getint( &irc->set, "auto_reconnect_delay" ); -		serv_got_crap( ic, "Reconnecting in %d seconds..", delay ); +		imc_log( ic, "Reconnecting in %d seconds..", delay );  		a->reconnect = b_timeout_add( delay * 1000, auto_reconnect, a );  	} -	destroy_gaim_conn( ic ); +	imc_free( ic );  }  /* dialogs.c */ -void do_error_dialog( struct im_connection *ic, char *msg, char *title ) -{ -	if( msg && title ) -		serv_got_crap( ic, "Error: %s: %s", title, msg ); -	else if( msg ) -		serv_got_crap( ic, "Error: %s", msg ); -	else if( title ) -		serv_got_crap( ic, "Error: %s", title ); -	else -		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 ); @@ -358,12 +363,12 @@ void add_buddy( struct im_connection *ic, char *group, char *handle, char *realn  	irc_t *irc = ic->irc;  	if( set_getbool( &irc->set, "debug" ) && 0 ) /* This message is too useless */ -		serv_got_crap( ic, "Receiving user add from handle: %s", handle ); +		imc_log( ic, "Receiving user add from handle: %s", handle );  	if( user_findhandle( ic, handle ) )  	{  		if( set_getbool( &irc->set, "debug" ) ) -			serv_got_crap( ic, "User already exists, ignoring add request: %s", handle ); +			imc_log( ic, "User already exists, ignoring add request: %s", handle );  		return; @@ -451,7 +456,7 @@ void serv_buddy_rename( struct im_connection *ic, char *handle, char *realname )  		u->realname = g_strdup( 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 ); +			imc_log( ic, "User `%s' changed name to `%s'", u->nick, u->realname );  	}  } @@ -515,8 +520,8 @@ void serv_got_update( struct im_connection *ic, char *handle, int loggedin, int  		{  			if( set_getbool( &ic->irc->set, "debug" ) || g_strcasecmp( set_getstr( &ic->irc->set, "handle_unknown" ), "ignore" ) != 0 )  			{ -				serv_got_crap( ic, "serv_got_update() for handle %s:", handle ); -				serv_got_crap( ic, "loggedin = %d, type = %d", loggedin, type ); +				imc_log( ic, "serv_got_update() for handle %s:", handle ); +				imc_log( ic, "loggedin = %d, type = %d", loggedin, type );  			}  			return; @@ -596,7 +601,7 @@ void serv_got_im( struct im_connection *ic, char *handle, char *msg, guint32 fla  		if( g_strcasecmp( h, "ignore" ) == 0 )  		{  			if( set_getbool( &irc->set, "debug" ) ) -				serv_got_crap( ic, "Ignoring message from unknown handle %s", handle ); +				imc_log( ic, "Ignoring message from unknown handle %s", handle );  			return;  		} @@ -618,7 +623,7 @@ void serv_got_im( struct im_connection *ic, char *handle, char *msg, guint32 fla  		}  		else  		{ -			serv_got_crap( ic, "Message from unknown handle %s:", handle ); +			imc_log( ic, "Message from unknown handle %s:", handle );  			u = user_find( irc, irc->mynick );  		}  	} @@ -688,7 +693,7 @@ void serv_got_chat_left( struct groupchat *c )  	GList *ir;  	if( set_getbool( &ic->irc->set, "debug" ) ) -		serv_got_crap( ic, "You were removed from conversation 0x%x", (int) c ); +		imc_log( ic, "You were removed from conversation 0x%x", (int) c );  	if( c )  	{ @@ -736,7 +741,7 @@ void serv_got_chat_in( struct groupchat *c, char *who, int whisper, char *msg, t  	if( c && u )  		irc_privmsg( ic->irc, u, "PRIVMSG", c->channel, "", msg );  	else -		serv_got_crap( ic, "Message from/to conversation %s@0x%x (unknown conv/user): %s", who, (int) c, msg ); +		imc_log( 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 ) @@ -758,7 +763,7 @@ struct groupchat *serv_got_joined_chat( struct im_connection *ic, char *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 ); +		imc_log( ic, "Creating new conversation: (id=0x%x,handle=%s)", (int) c, handle );  	return c;  } @@ -772,7 +777,7 @@ void add_chat_buddy( struct groupchat *b, char *handle )  	int me = 0;  	if( set_getbool( &b->ic->irc->set, "debug" ) ) -		serv_got_crap( b->ic, "User %s added to conversation 0x%x", handle, (int) b ); +		imc_log( b->ic, "User %s added to conversation 0x%x", handle, (int) b );  	/* It might be yourself! */  	if( b->ic->acc->prpl->handle_cmp( handle, b->ic->username ) == 0 ) @@ -806,7 +811,7 @@ void remove_chat_buddy( struct groupchat *b, char *handle, char *reason )  	int me = 0;  	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 : "" ); +		imc_log( b->ic, "User %s removed from conversation 0x%x (%s)", handle, (int) b, reason ? reason : "" );  	/* It might be yourself! */  	if( g_strcasecmp( handle, b->ic->username ) == 0 ) @@ -1004,7 +1009,7 @@ int bim_set_away( struct im_connection *ic, char *away )  		{  			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 ); +				imc_log( ic, "Setting away state to %s", s );  		}  		else  			ic->acc->prpl->set_away( ic, GAIM_AWAY_CUSTOM, away ); diff --git a/protocols/nogaim.h b/protocols/nogaim.h index 82472fd3..53e3b23b 100644 --- a/protocols/nogaim.h +++ b/protocols/nogaim.h @@ -205,17 +205,14 @@ gboolean auto_reconnect( gpointer data, gint fd, b_input_condition cond );  void cancel_auto_reconnect( struct account *a );  /* multi.c */ -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 ); +G_MODULE_EXPORT struct im_connection *imc_new( account_t *acc ); +G_MODULE_EXPORT void imc_free( struct im_connection *ic ); +G_MODULE_EXPORT void imc_log( struct im_connection *ic, char *format, ... ); +G_MODULE_EXPORT void imc_error( struct im_connection *ic, char *format, ... ); +G_MODULE_EXPORT void imc_connected( struct im_connection *ic ); +G_MODULE_EXPORT void imc_logout( struct im_connection *ic );  /* dialogs.c */ -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 */ diff --git a/protocols/oscar/chat.c b/protocols/oscar/chat.c index df535c4f..82aa5421 100644 --- a/protocols/oscar/chat.c +++ b/protocols/oscar/chat.c @@ -53,7 +53,7 @@ aim_conn_t *aim_chat_getconn(aim_session_t *sess, const char *name)  		if (cur->type != AIM_CONN_TYPE_CHAT)  			continue;  		if (!cur->priv) { -			do_error_dialog(sess->aux_data, "chat connection with no name!", "Gaim"); +			imc_error(sess->aux_data, "chat connection with no name!");  			continue;  		} @@ -396,7 +396,7 @@ static int infoupdate(aim_session_t *sess, aim_module_t *mod, aim_frame_t *rx, a  	detaillevel = aimbs_get8(bs);  	if (detaillevel != 0x02) { -		do_error_dialog(sess->aux_data, "Only detaillevel 0x2 is support at the moment", "Gaim"); +		imc_error(sess->aux_data, "Only detaillevel 0x2 is support at the moment");  		return 1;  	} @@ -614,7 +614,7 @@ static int incomingmsg(aim_session_t *sess, aim_module_t *mod, aim_frame_t *rx,  	channel = aimbs_get16(bs);  	if (channel != 0x0003) { -		do_error_dialog(sess->aux_data, "unknown channel!", "Gaim"); +		imc_error(sess->aux_data, "unknown channel!");  		return 0;  	} diff --git a/protocols/oscar/chatnav.c b/protocols/oscar/chatnav.c index c7e11765..05fdf6fa 100644 --- a/protocols/oscar/chatnav.c +++ b/protocols/oscar/chatnav.c @@ -285,7 +285,7 @@ static int parseinfo_create(aim_session_t *sess, aim_module_t *mod, aim_frame_t  	tlvlist = aim_readtlvchain(bs);  	if (!(bigblock = aim_gettlv(tlvlist, 0x0004, 1))) { -		do_error_dialog(sess->aux_data, "no bigblock in top tlv in create room response", "Gaim"); +		imc_error(sess->aux_data, "no bigblock in top tlv in create room response");  		aim_freetlvchain(&tlvlist);  		return 0; @@ -300,7 +300,7 @@ static int parseinfo_create(aim_session_t *sess, aim_module_t *mod, aim_frame_t  	detaillevel = aimbs_get8(&bbbs);  	if (detaillevel != 0x02) { -		do_error_dialog(sess->aux_data, "unknown detaillevel in create room response", "Gaim"); +		imc_error(sess->aux_data, "unknown detaillevel in create room response");  		aim_freetlvchain(&tlvlist);  		g_free(ck);  		return 0; @@ -366,12 +366,12 @@ static int parseinfo(aim_session_t *sess, aim_module_t *mod, aim_frame_t *rx, ai  	int ret = 0;  	if (!(snac2 = aim_remsnac(sess, snac->id))) { -		do_error_dialog(sess->aux_data, "received response to unknown request!", "Gaim"); +		imc_error(sess->aux_data, "received response to unknown request!");  		return 0;  	}  	if (snac2->family != 0x000d) { -		do_error_dialog(sess->aux_data, "recieved response that maps to corrupt request!", "Gaim"); +		imc_error(sess->aux_data, "recieved response that maps to corrupt request!");  		return 0;  	} @@ -388,7 +388,7 @@ static int parseinfo(aim_session_t *sess, aim_module_t *mod, aim_frame_t *rx, ai  	else if (snac2->type == 0x0008) /* create room */  		ret = parseinfo_create(sess, mod, rx, snac, bs, snac2);  	else -		do_error_dialog(sess->aux_data, "unknown request subtype", "Gaim"); +		imc_error(sess->aux_data, "unknown request subtype");  	if (snac2)  		g_free(snac2->data); diff --git a/protocols/oscar/icq.c b/protocols/oscar/icq.c index 23959b75..d3c7c182 100644 --- a/protocols/oscar/icq.c +++ b/protocols/oscar/icq.c @@ -239,7 +239,7 @@ static int icqresponse(aim_session_t *sess, aim_module_t *mod, aim_frame_t *rx,  	if (!(tl = aim_readtlvchain(bs)) || !(datatlv = aim_gettlv(tl, 0x0001, 1))) {  		aim_freetlvchain(&tl); -		do_error_dialog(sess->aux_data, "corrupt ICQ response\n", "Gaim"); +		imc_error(sess->aux_data, "corrupt ICQ response\n");  		return 0;  	} diff --git a/protocols/oscar/im.c b/protocols/oscar/im.c index bc2c2abe..ac3d08d4 100644 --- a/protocols/oscar/im.c +++ b/protocols/oscar/im.c @@ -936,7 +936,7 @@ static int outgoingim(aim_session_t *sess, aim_module_t *mod, aim_frame_t *rx, a  	channel = aimbs_get16(bs);  	if (channel != 0x01) { -		do_error_dialog(sess->aux_data, "icbm: ICBM recieved on unsupported channel.  Ignoring.", "Gaim"); +		imc_error(sess->aux_data, "icbm: ICBM recieved on unsupported channel.  Ignoring.");  		return 0;  	} @@ -1344,7 +1344,7 @@ static int incomingim_ch1(aim_session_t *sess, aim_module_t *mod, aim_frame_t *r  			args.extdata = aimbs_getraw(bs, args.extdatalen);  		} else { -			// do_error_dialog(sess->aux_data, "Unknown TLV encountered", "Gaim"); +			// imc_error(sess->aux_data, "Unknown TLV encountered");  		}  		/* @@ -1516,7 +1516,7 @@ static int incomingim_ch2(aim_session_t *sess, aim_module_t *mod, aim_frame_t *r  	 */  	cookie2 = aimbs_getraw(&bbs, 8);  	if (memcmp(cookie, cookie2, 8) != 0)  -		do_error_dialog(sess->aux_data, "rend: warning cookies don't match!", "Gaim"); +		imc_error(sess->aux_data, "rend: warning cookies don't match!");  	memcpy(args.cookie, cookie2, 8);  	g_free(cookie2); @@ -1782,7 +1782,7 @@ static int incomingim(aim_session_t *sess, aim_module_t *mod, aim_frame_t *rx, a  	} else { -		do_error_dialog(sess->aux_data, "ICBM received on an unsupported channel.  Ignoring.", "Gaim"); +		imc_error(sess->aux_data, "ICBM received on an unsupported channel.  Ignoring.");  		return 0;  	} diff --git a/protocols/oscar/info.c b/protocols/oscar/info.c index 0f1bcfd2..d1ed2059 100644 --- a/protocols/oscar/info.c +++ b/protocols/oscar/info.c @@ -473,7 +473,7 @@ int aim_extractuserinfo(aim_session_t *sess, aim_bstream_t *bs, aim_userinfo_t *  			 *  			 */  #ifdef DEBUG -			// do_error_dialog(sess->aux_data, G_STRLOC, "Unknown TLV encountered"); +			// imc_error(sess->aux_data, G_STRLOC);  #endif  		} @@ -634,7 +634,7 @@ static int userinfo(aim_session_t *sess, aim_module_t *mod, aim_frame_t *rx, aim  	origsnac = aim_remsnac(sess, snac->id);  	if (!origsnac || !origsnac->data) { -		do_error_dialog(sess->aux_data, "major problem: no snac stored!", "Gaim"); +		imc_error(sess->aux_data, "major problem: no snac stored!");  		return 0;  	} @@ -643,7 +643,7 @@ static int userinfo(aim_session_t *sess, aim_module_t *mod, aim_frame_t *rx, aim  	if ((inforeq->infotype != AIM_GETINFO_GENERALINFO) &&  			(inforeq->infotype != AIM_GETINFO_AWAYMESSAGE) &&  			(inforeq->infotype != AIM_GETINFO_CAPABILITIES)) { -		do_error_dialog(sess->aux_data, "unknown infotype in request!", "Gaim"); +		imc_error(sess->aux_data, "unknown infotype in request!");  		return 0;  	} diff --git a/protocols/oscar/oscar.c b/protocols/oscar/oscar.c index d2c6af1e..929b63d3 100644 --- a/protocols/oscar/oscar.c +++ b/protocols/oscar/oscar.c @@ -262,23 +262,21 @@ static gboolean oscar_callback(gpointer data, gint source,  		if (aim_get_command(odata->sess, conn) >= 0) {  			aim_rxdispatch(odata->sess);                                 if (odata->killme) -                                       signoff(ic); +                                       imc_logout(ic);  		} else {  			if ((conn->type == AIM_CONN_TYPE_BOS) ||  				   !(aim_getconn_type(odata->sess, AIM_CONN_TYPE_BOS))) { -				hide_login_progress_error(ic, _("Disconnected.")); -				signoff(ic); +				imc_error(ic, _("Disconnected.")); +				imc_logout(ic);  			} else if (conn->type == AIM_CONN_TYPE_CHAT) {  				struct chat_connection *c = find_oscar_chat_by_conn(ic, conn); -				char buf[BUF_LONG];  				c->conn = NULL;  				if (c->inpa > 0)  					b_event_remove(c->inpa);  				c->inpa = 0;  				c->fd = -1;  				aim_conn_kill(odata->sess, &conn); -				sprintf(buf, _("You have been disconnected from chat room %s."), c->name); -				do_error_dialog(sess->aux_data, buf, _("Chat Error!")); +				imc_error(sess->aux_data, _("You have been disconnected from chat room %s."), c->name);  			} else if (conn->type == AIM_CONN_TYPE_CHATNAV) {  				if (odata->cnpa > 0)  					b_event_remove(odata->cnpa); @@ -289,8 +287,7 @@ static gboolean oscar_callback(gpointer data, gint source,  					odata->create_rooms =  						g_slist_remove(odata->create_rooms, cr);  					g_free(cr); -					do_error_dialog(sess->aux_data, _("Chat is currently unavailable"), -							_("Gaim - Chat")); +					imc_error(sess->aux_data, _("Chat is currently unavailable"));  				}  				aim_conn_kill(odata->sess, &conn);  			} else if (conn->type == AIM_CONN_TYPE_AUTH) { @@ -327,8 +324,8 @@ static gboolean oscar_login_connect(gpointer data, gint source, b_input_conditio  	conn = aim_getconn_type_all(sess, AIM_CONN_TYPE_AUTH);  	if (source < 0) { -		hide_login_progress(ic, _("Couldn't connect to host")); -		signoff(ic); +		imc_error(ic, _("Couldn't connect to host")); +		imc_logout(ic);  		return FALSE;  	} @@ -355,8 +352,7 @@ static void oscar_init(account_t *acc)  static void oscar_login(account_t *acc) {  	aim_session_t *sess;  	aim_conn_t *conn; -	char buf[256]; -	struct im_connection *ic = new_gaim_conn(acc); +	struct im_connection *ic = imc_new(acc);  	struct oscar_data *odata = ic->proto_data = g_new0(struct oscar_data, 1);  	if (isdigit(acc->user[0])) { @@ -381,24 +377,23 @@ static void oscar_login(account_t *acc) {  	conn = aim_newconn(sess, AIM_CONN_TYPE_AUTH, NULL);  	if (conn == NULL) { -		hide_login_progress(ic, _("Unable to login to AIM")); -		signoff(ic); +		imc_error(ic, _("Unable to login to AIM")); +		imc_logout(ic);  		return;  	}  	if (acc->server == NULL) { -		hide_login_progress(ic, "No servername specified"); -		signoff(ic); +		imc_error(ic, "No servername specified"); +		imc_logout(ic);  		return;  	}  	if (g_strcasecmp(acc->server, "login.icq.com") != 0 &&  	    g_strcasecmp(acc->server, "login.oscar.aol.com") != 0) { -		serv_got_crap(ic, "Warning: Unknown OSCAR server: `%s'. Please review your configuration if the connection fails.",acc->server); +		imc_log(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); +	imc_log(ic, _("Signon: %s"), ic->username);  	aim_conn_addhandler(sess, conn, 0x0017, 0x0007, gaim_parse_login, 0);  	aim_conn_addhandler(sess, conn, 0x0017, 0x0003, gaim_parse_auth_resp, 0); @@ -406,8 +401,8 @@ static void oscar_login(account_t *acc) {  	conn->status |= AIM_CONN_STATUS_INPROGRESS;  	conn->fd = proxy_connect(acc->server, AIM_LOGIN_PORT, oscar_login_connect, ic);  	if (conn->fd < 0) { -		hide_login_progress(ic, _("Couldn't connect to host")); -		signoff(ic); +		imc_error(ic, _("Couldn't connect to host")); +		imc_logout(ic);  		return;  	}  	aim_request_login(sess, conn, ic->username); @@ -466,15 +461,15 @@ static gboolean oscar_bos_connect(gpointer data, gint source, b_input_condition  	bosconn = odata->conn;  	if (source < 0) { -		hide_login_progress(ic, _("Could Not Connect")); -		signoff(ic); +		imc_error(ic, _("Could Not Connect")); +		imc_logout(ic);  		return FALSE;  	}  	aim_conn_completeconnect(sess, bosconn);  	ic->inpa = b_input_add(bosconn->fd, GAIM_INPUT_READ,  			oscar_callback, bosconn); -	set_login_progress(ic, 4, _("Connection established, cookie sent")); +	imc_log(ic, _("Connection established, cookie sent"));  	return FALSE;  } @@ -497,23 +492,23 @@ static int gaim_parse_auth_resp(aim_session_t *sess, aim_frame_t *fr, ...) {  		switch (info->errorcode) {  		case 0x05:  			/* Incorrect nick/password */ -			hide_login_progress(ic, _("Incorrect nickname or password.")); +			imc_error(ic, _("Incorrect nickname or password."));  //			plugin_event(event_error, (void *)980, 0, 0, 0);  			break;  		case 0x11:  			/* Suspended account */ -			hide_login_progress(ic, _("Your account is currently suspended.")); +			imc_error(ic, _("Your account is currently suspended."));  			break;  		case 0x18:  			/* connecting too frequently */ -			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.")); +			imc_error(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(ic, _("The client version you are using is too old. Please upgrade at " WEBSITE)); +			imc_error(ic, _("The client version you are using is too old. Please upgrade at " WEBSITE));  			break;  		default: -			hide_login_progress(ic, _("Authentication Failed")); +			imc_error(ic, _("Authentication Failed"));  			break;  		}  		od->killme = TRUE; @@ -525,7 +520,7 @@ static int gaim_parse_auth_resp(aim_session_t *sess, aim_frame_t *fr, ...) {  	bosconn = aim_newconn(sess, AIM_CONN_TYPE_BOS, NULL);  	if (bosconn == NULL) { -		hide_login_progress(ic, _("Internal Error")); +		imc_error(ic, _("Internal Error"));  		od->killme = TRUE;  		return 0;  	} @@ -571,7 +566,7 @@ static int gaim_parse_auth_resp(aim_session_t *sess, aim_frame_t *fr, ...) {  	bosconn->fd = proxy_connect(host, port, oscar_bos_connect, ic);  	g_free(host);  	if (bosconn->fd < 0) { -		hide_login_progress(ic, _("Could Not Connect")); +		imc_error(ic, _("Could Not Connect"));  		od->killme = TRUE;  		return 0;  	} @@ -609,8 +604,8 @@ static gboolean damn_you(gpointer data, gint source, b_input_condition c)  		in = '\0';  	}  	if (in != '\n') { -		do_error_dialog(pos->ic, "Gaim was unable to get a valid hash for logging into AIM." -				" You may be disconnected shortly.", "Login Error"); +		imc_error(pos->ic, "Gaim was unable to get a valid hash for logging into AIM." +				" You may be disconnected shortly.");  		b_event_remove(pos->inpa);  		closesocket(pos->fd);  		g_free(pos); @@ -632,8 +627,8 @@ static gboolean straight_to_hell(gpointer data, gint source, b_input_condition c  	char buf[BUF_LONG];  	if (source < 0) { -		do_error_dialog(pos->ic, "Gaim was unable to get a valid hash for logging into AIM." -				" You may be disconnected shortly.", "Login Error"); +		imc_error(pos->ic, "Gaim was unable to get a valid hash for logging into AIM." +				" You may be disconnected shortly.");  		if (pos->modname)  			g_free(pos->modname);  		g_free(pos); @@ -710,8 +705,8 @@ int gaim_memrequest(aim_session_t *sess, aim_frame_t *fr, ...) {  		if (pos->modname)  			g_free(pos->modname);  		g_free(pos); -		do_error_dialog(sess->aux_data, "Gaim was unable to get a valid hash for logging into AIM." -				" You may be disconnected shortly.", "Login Error"); +		imc_error(sess->aux_data, "Gaim was unable to get a valid hash for logging into AIM." +				" You may be disconnected shortly.");  	}  	pos->fd = fd; @@ -1209,11 +1204,11 @@ static int incomingim_chan4(aim_session_t *sess, aim_conn_t *conn, aim_userinfo_  		} break;  		case 0x0007: { /* Someone has denied you authorization */ -			serv_got_crap(sess->aux_data, "The user %u has denied your request to add them to your contact list for the following reason:\n%s", args->uin, args->msg ? args->msg : _("No reason given.") ); +			imc_log(sess->aux_data, "The user %u has denied your request to add them to your contact list for the following reason:\n%s", args->uin, args->msg ? args->msg : _("No reason given.") );  		} break;  		case 0x0008: { /* Someone has granted you authorization */ -			serv_got_crap(sess->aux_data, "The user %u has granted your request to add them to your contact list for the following reason:\n%s", args->uin, args->msg ? args->msg : _("No reason given.") ); +			imc_log(sess->aux_data, "The user %u has granted your request to add them to your contact list for the following reason:\n%s", args->uin, args->msg ? args->msg : _("No reason given.") );  		} break;  		case 0x0012: { @@ -1338,7 +1333,7 @@ static int gaim_parse_misses(aim_session_t *sess, aim_frame_t *fr, ...) {  				   userinfo->sn);  			break;  	} -	do_error_dialog(sess->aux_data, buf, _("Gaim - Error")); +	imc_error(sess->aux_data, buf);  	return 1;  } @@ -1346,16 +1341,13 @@ static int gaim_parse_misses(aim_session_t *sess, aim_frame_t *fr, ...) {  static int gaim_parse_genericerr(aim_session_t *sess, aim_frame_t *fr, ...) {  	va_list ap;  	guint16 reason; -	char *m;  	va_start(ap, fr);  	reason = (guint16)va_arg(ap, unsigned int);  	va_end(ap); -	m = g_strdup_printf(_("SNAC threw error: %s\n"), -			reason < msgerrreasonlen ? msgerrreason[reason] : "Unknown error"); -	do_error_dialog(sess->aux_data, m, _("Gaim - Oscar SNAC Error")); -	g_free(m); +	imc_error(sess->aux_data, _("SNAC threw error: %s"), +	          reason < msgerrreasonlen ? msgerrreason[reason] : "Unknown error");  	return 1;  } @@ -1364,16 +1356,14 @@ static int gaim_parse_msgerr(aim_session_t *sess, aim_frame_t *fr, ...) {  	va_list ap;  	char *destn;  	guint16 reason; -	char buf[1024];  	va_start(ap, fr);  	reason = (guint16)va_arg(ap, unsigned int);  	destn = va_arg(ap, char *);  	va_end(ap); -	sprintf(buf, _("Your message to %s did not get sent: %s"), destn, +	imc_error(sess->aux_data, _("Your message to %s did not get sent: %s"), destn,  			(reason < msgerrreasonlen) ? msgerrreason[reason] : _("Reason unknown")); -	do_error_dialog(sess->aux_data, buf, _("Gaim - Error"));  	return 1;  } @@ -1382,17 +1372,14 @@ static int gaim_parse_locerr(aim_session_t *sess, aim_frame_t *fr, ...) {  	va_list ap;  	char *destn;  	guint16 reason; -	char buf[1024];  	va_start(ap, fr);  	reason = (guint16)va_arg(ap, unsigned int);  	destn = va_arg(ap, char *);  	va_end(ap); -	sprintf(buf, _("User information for %s unavailable: %s"), destn, +	imc_error(sess->aux_data, _("User information for %s unavailable: %s"), destn,  			(reason < msgerrreasonlen) ? msgerrreason[reason] : _("Reason unknown")); -	do_error_dialog(sess->aux_data, buf, _("Gaim - Error")); -  	return 1;  } @@ -1408,8 +1395,7 @@ static int gaim_parse_motd(aim_session_t *sess, aim_frame_t *fr, ...) {  	va_end(ap);  	if (id < 4) -		do_error_dialog(sess->aux_data, _("Your connection may be lost."), -				_("AOL error")); +		imc_error(sess->aux_data, _("Your connection may be lost."));  	return 1;  } @@ -1603,8 +1589,8 @@ static int gaim_parse_ratechange(aim_session_t *sess, aim_frame_t *fr, ...) {  	} else if (code == AIM_RATE_CODE_WARNING) {  		aim_conn_setlatency(fr->conn, windowsize/4);  	} else if (code == AIM_RATE_CODE_LIMIT) { -		do_error_dialog(sess->aux_data, _("The last message was not sent because you are over the rate limit. " -				  "Please wait 10 seconds and try again."), _("Gaim - Error")); +		imc_error(sess->aux_data, _("The last message was not sent because you are over the rate limit. " +			  "Please wait 10 seconds and try again."));  		aim_conn_setlatency(fr->conn, windowsize/2);  	} else if (code == AIM_RATE_CODE_CLEARLIMIT) {  		aim_conn_setlatency(fr->conn, 0); @@ -1808,11 +1794,11 @@ static int gaim_offlinemsg(aim_session_t *sess, aim_frame_t *fr, ...) {  		} break;  		case 0x0007: { /* Someone has denied you authorization */ -			serv_got_crap(sess->aux_data, "The user %u has denied your request to add them to your contact list for the following reason:\n%s", msg->sender, msg->msg ? msg->msg : _("No reason given.") ); +			imc_log(sess->aux_data, "The user %u has denied your request to add them to your contact list for the following reason:\n%s", msg->sender, msg->msg ? msg->msg : _("No reason given.") );  		} break;  		case 0x0008: { /* Someone has granted you authorization */ -			serv_got_crap(sess->aux_data, "The user %u has granted your request to add them to your contact list for the following reason:\n%s", msg->sender, msg->msg ? msg->msg : _("No reason given.") ); +			imc_log(sess->aux_data, "The user %u has granted your request to add them to your contact list for the following reason:\n%s", msg->sender, msg->msg ? msg->msg : _("No reason given.") );  		} break;  		case 0x0012: { @@ -1925,7 +1911,7 @@ static void oscar_set_away_aim(struct im_connection *ic, struct oscar_data *od,  	} /* else... */  	if (od->rights.maxawaymsglen == 0) -		do_error_dialog(ic, "oscar_set_away_aim called before locate rights received", "Protocol Error"); +		imc_error(ic, "oscar_set_away_aim called before locate rights received");  	aim_setextstatus(od->sess, od->conn, AIM_ICQ_STATE_NORMAL); @@ -1943,7 +1929,7 @@ static void oscar_set_away_aim(struct im_connection *ic, struct oscar_data *od,  		errstr = g_strdup_printf("Maximum away message length of %d bytes exceeded, truncating", od->rights.maxawaymsglen); -		do_error_dialog(ic, errstr, "Away Message Too Long"); +		imc_error(ic, errstr);  		g_free(errstr);  	} @@ -2109,7 +2095,7 @@ static int gaim_ssi_parselist(aim_session_t *sess, aim_frame_t *fr, ...) {  	aim_icq_reqofflinemsgs(sess);  	/* Now that we have a buddy list, we can tell BitlBee that we're online. */ -	account_online(ic); +	imc_connected(ic);  	return 1;  } @@ -2131,7 +2117,7 @@ static int gaim_ssi_parseack( aim_session_t *sess, aim_frame_t *fr, ... )  		if( count & 1 )  		{  			/* Hmm, the length should be even... */ -			do_error_dialog( sess->aux_data, "Received SSI ACK package with non-even length", "Gaim - Error" ); +			imc_error( sess->aux_data, "Received SSI ACK package with non-even length");  			return( 0 );  		}  		count >>= 1; @@ -2142,7 +2128,7 @@ static int gaim_ssi_parseack( aim_session_t *sess, aim_frame_t *fr, ... )  			st = aimbs_get16( &fr->data );  			if( st == 0x0E )  			{ -				serv_got_crap( sess->aux_data, "Buddy %s can't be added without authorization, requesting authorization", list ); +				imc_log( sess->aux_data, "Buddy %s can't be added without authorization, requesting authorization", list );  				aim_ssi_auth_request( sess, fr->conn, list, "" );  				aim_ssi_addbuddies( sess, fr->conn, OSCAR_GROUP, &list, 1, 1 ); @@ -2329,7 +2315,7 @@ static int gaim_icqinfo(aim_session_t *sess, aim_frame_t *fr, ...)                  g_string_sprintfa(str, "\n");          } -		serv_got_crap(ic, "%s\n%s", _("User Info"), str->str); +		imc_log(ic, "%s\n%s", _("User Info"), str->str);          g_string_free(str, TRUE);          return 1; @@ -2423,18 +2409,18 @@ static int gaim_parseaiminfo(aim_session_t *sess, aim_frame_t *fr, ...)  			idletime.tm_min = userinfo->idletime % 60;  			idletime.tm_sec = 0;  			strftime(buff, 256, _("%d days %H hours %M minutes"), &idletime); -			serv_got_crap(ic, "%s: %s", _("Idle Time"), buff); +			imc_log(ic, "%s: %s", _("Idle Time"), buff);  		}  		if(text) {  			utf8 = oscar_encoding_to_utf8(extracted_encoding, text, text_length); -			serv_got_crap(ic, "%s\n%s", _("User Info"), utf8); +			imc_log(ic, "%s\n%s", _("User Info"), utf8);  		} else { -			serv_got_crap(ic, _("No user info available.")); +			imc_log(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(ic, "%s\n%s", _("Away Message"), utf8); +		imc_log(ic, "%s\n%s", _("Away Message"), utf8);  	}  	g_free(utf8); diff --git a/protocols/oscar/rxqueue.c b/protocols/oscar/rxqueue.c index 6e8dd29c..b5a83be8 100644 --- a/protocols/oscar/rxqueue.c +++ b/protocols/oscar/rxqueue.c @@ -391,7 +391,7 @@ int aim_get_command(aim_session_t *sess, aim_conn_t *conn)  		aim_bstream_rewind(&flaphdr);  		start = aimbs_get8(&flaphdr); -		do_error_dialog(sess->aux_data, "FLAP framing disrupted", "Gaim"); +		imc_error(sess->aux_data, "FLAP framing disrupted");  		aim_conn_close(conn);  		return -1;  	}	 diff --git a/protocols/oscar/search.c b/protocols/oscar/search.c index 9685a3d1..c557e35f 100644 --- a/protocols/oscar/search.c +++ b/protocols/oscar/search.c @@ -38,7 +38,7 @@ static int error(aim_session_t *sess, aim_module_t *mod, aim_frame_t *rx, aim_mo  	/* XXX the modules interface should have already retrieved this for us */  	if (!(snac2 = aim_remsnac(sess, snac->id))) { -		do_error_dialog(sess->aux_data, "couldn't get snac", "Gaim"); +		imc_error(sess->aux_data, "couldn't get snac");  		return 0;  	} diff --git a/protocols/oscar/service.c b/protocols/oscar/service.c index 2a3dd1fb..69d53d00 100644 --- a/protocols/oscar/service.c +++ b/protocols/oscar/service.c @@ -566,7 +566,7 @@ static int migrate(aim_session_t *sess, aim_module_t *mod, aim_frame_t *rx, aim_  		group = aimbs_get16(bs); -		do_error_dialog(sess->aux_data, "bifurcated migration unsupported", "Gaim"); +		imc_error(sess->aux_data, "bifurcated migration unsupported");  	}  	tl = aim_readtlvchain(bs); @@ -893,7 +893,7 @@ int aim_sendmemblock(aim_session_t *sess, aim_conn_t *conn, guint32 offset, guin  			aimbs_put32(&fr->data, 0xecf8427e);  */  		} else -			do_error_dialog(sess->aux_data, "WARNING: unknown hash request", "Gaim"); +			imc_error(sess->aux_data, "WARNING: unknown hash request");  	} diff --git a/protocols/oscar/txqueue.c b/protocols/oscar/txqueue.c index 6b4854c5..bd8db49d 100644 --- a/protocols/oscar/txqueue.c +++ b/protocols/oscar/txqueue.c @@ -29,7 +29,7 @@ aim_frame_t *aim_tx_new(aim_session_t *sess, aim_conn_t *conn, guint8 framing, g  	aim_frame_t *fr;  	if (!conn) { -		do_error_dialog(sess->aux_data, "no connection specified", "Gaim"); +		imc_error(sess->aux_data, "no connection specified");  		return NULL;  	} @@ -45,7 +45,7 @@ aim_frame_t *aim_tx_new(aim_session_t *sess, aim_conn_t *conn, guint8 framing, g  		fr->hdr.flap.type = chan;  	} else  -		do_error_dialog(sess->aux_data, "unknown framing", "Gaim"); +		imc_error(sess->aux_data, "unknown framing");  	if (datalen > 0) {  		guint8 *data; @@ -79,7 +79,7 @@ static int aim_tx_enqueue__queuebased(aim_session_t *sess, aim_frame_t *fr)  {  	if (!fr->conn) { -		do_error_dialog(sess->aux_data, "WARNING: enqueueing packet with no connection", "Gaim"); +		imc_error(sess->aux_data, "WARNING: enqueueing packet with no connection");  		fr->conn = aim_getconn_type(sess, AIM_CONN_TYPE_BOS);  	} @@ -119,7 +119,7 @@ static int aim_tx_enqueue__immediate(aim_session_t *sess, aim_frame_t *fr)  {  	if (!fr->conn) { -		do_error_dialog(sess->aux_data, "packet has no connection", "Gaim"); +		imc_error(sess->aux_data, "packet has no connection");  		aim_frame_destroy(fr);  		return 0;  	} diff --git a/protocols/yahoo/yahoo.c b/protocols/yahoo/yahoo.c index 52db9007..424a0ad1 100644 --- a/protocols/yahoo/yahoo.c +++ b/protocols/yahoo/yahoo.c @@ -122,13 +122,13 @@ static char *byahoo_strip( char *in )  static void byahoo_login( account_t *acc )  { -	struct im_connection *ic = new_gaim_conn( acc ); +	struct im_connection *ic = imc_new( 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( ic, 1, "Connecting" ); +	imc_log( ic, "Connecting" );  	yd->y2_id = yahoo_init( acc->user, acc->pass );  	yahoo_login( yd->y2_id, yd->current_status );  } @@ -162,7 +162,7 @@ static void byahoo_logout( struct im_connection *ic )  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(ic, "%s\n%s: %s%s", _("User Info"),  +	imc_log(ic, "%s\n%s: %s%s", _("User Info"),   			_("For now, fetch yourself"), yahoo_get_profile_url(),  			who);  } @@ -510,7 +510,7 @@ void ext_yahoo_login_response( int id, int succ, char *url )  	if( succ == YAHOO_LOGIN_OK )  	{ -		account_online( ic ); +		imc_connected( ic );  		yd->logged_in = TRUE;  	} @@ -549,13 +549,13 @@ void ext_yahoo_login_response( int id, int succ, char *url )  		}  		if( yd->logged_in ) -			hide_login_progress_error( ic, s ); +			imc_error( ic, s );  		else -			hide_login_progress( ic, s ); +			imc_error( ic, s );  		g_free( s ); -		signoff( ic ); +		imc_logout( ic );  	}  } @@ -618,7 +618,7 @@ void ext_yahoo_got_file( int id, char *who, char *url, long expires, char *msg,  {  	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 ); +	imc_log( 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 ) @@ -638,29 +638,24 @@ void ext_yahoo_system_message( int id, char *msg )  {  	struct im_connection *ic = byahoo_get_ic_by_id( id ); -	serv_got_crap( ic, "Yahoo! system message: %s", msg ); +	imc_log( ic, "Yahoo! system message: %s", msg );  }  void ext_yahoo_webcam_invite( int id, char *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 ); +	imc_log( 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 im_connection *ic = byahoo_get_ic_by_id( id ); +	imc_error( ic, "%s", err ); +	  	if( fatal ) -	{ -		hide_login_progress_error( ic, err ); -		signoff( ic ); -	} -	else -	{ -		do_error_dialog( ic, err, "Yahoo! error" ); -	} +		imc_logout( ic );  }  /* TODO: Clear up the mess of inp and d structures */ @@ -828,7 +823,7 @@ void ext_yahoo_conf_userdecline( int id, char *who, char *room, char *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 ); +	imc_log( ic, "Invite to chatroom %s rejected by %s: %s", room, who, msg );  }  void ext_yahoo_conf_userjoin( int id, char *who, char *room ) @@ -911,9 +906,9 @@ void ext_yahoo_mail_notify( int id, char *from, char *subj, int cnt )  	struct im_connection *ic = byahoo_get_ic_by_id( id );  	if( from && subj ) -		serv_got_crap( ic, "Received e-mail message from %s with subject `%s'", from, subj ); +		imc_log( ic, "Received e-mail message from %s with subject `%s'", from, subj );  	else if( cnt > 0 ) -		serv_got_crap( ic, "Received %d new e-mails", cnt ); +		imc_log( ic, "Received %d new e-mails", cnt );  }  void ext_yahoo_webcam_invite_reply( int id, char *from, int accept ) @@ -121,7 +121,7 @@ void query_del_by_conn( irc_t *irc, struct im_connection *ic )  	}  	if( count > 0 ) -		serv_got_crap( ic, "Flushed %d unanswered question(s) for this connection.", count ); +		imc_log( ic, "Flushed %d unanswered question(s) for this connection.", count );  	q = query_default( irc );  	if( q && q != def ) @@ -139,12 +139,12 @@ void query_answer( irc_t *irc, query_t *q, int ans )  	}  	if( ans )  	{ -		serv_got_crap( q->ic, "Accepted: %s", q->question ); +		imc_log( q->ic, "Accepted: %s", q->question );  		q->yes( NULL, q->data );  	}  	else  	{ -		serv_got_crap( q->ic, "Rejected: %s", q->question ); +		imc_log( q->ic, "Rejected: %s", q->question );  		q->no( NULL, q->data );  	}  	q->data = NULL; @@ -159,7 +159,7 @@ static void query_display( irc_t *irc, query_t *q )  {  	if( q->ic )  	{ -		serv_got_crap( q->ic, "New request: %s\nYou can use the \2yes\2/\2no\2 commands to accept/reject this request.", q->question ); +		imc_log( q->ic, "New request: %s\nYou can use the \2yes\2/\2no\2 commands to accept/reject this request.", q->question );  	}  	else  	{ | 
