aboutsummaryrefslogtreecommitdiffstats
path: root/protocols
diff options
context:
space:
mode:
Diffstat (limited to 'protocols')
-rw-r--r--protocols/jabber/io.c27
-rw-r--r--protocols/jabber/iq.c10
-rw-r--r--protocols/jabber/jabber.c6
-rw-r--r--protocols/jabber/sasl.c12
-rw-r--r--protocols/msn/msn.c6
-rw-r--r--protocols/msn/msn_util.c2
-rw-r--r--protocols/msn/ns.c62
-rw-r--r--protocols/msn/sb.c16
-rw-r--r--protocols/nogaim.c22
-rw-r--r--protocols/nogaim.h6
-rw-r--r--protocols/oscar/oscar.c33
-rw-r--r--protocols/yahoo/yahoo.c16
12 files changed, 105 insertions, 113 deletions
diff --git a/protocols/jabber/io.c b/protocols/jabber/io.c
index bf52fb4e..c64901f7 100644
--- a/protocols/jabber/io.c
+++ b/protocols/jabber/io.c
@@ -117,7 +117,7 @@ static gboolean jabber_write_queue( struct im_connection *ic )
jd->fd = -1;
imc_error( ic, "Short write() to server" );
- imc_logout( ic );
+ imc_logout( ic, TRUE );
return FALSE;
}
else if( st > 0 )
@@ -160,7 +160,7 @@ static gboolean jabber_read_callback( gpointer data, gint fd, b_input_condition
if( xt_feed( jd->xt, buf, st ) < 0 )
{
imc_error( ic, "XML stream error" );
- imc_logout( ic );
+ imc_logout( ic, TRUE );
return FALSE;
}
@@ -204,7 +204,7 @@ static gboolean jabber_read_callback( gpointer data, gint fd, b_input_condition
{
imc_error( ic, "TLS is turned on for this "
"account, but is not supported by this server" );
- imc_logout( ic );
+ imc_logout( ic, FALSE );
return FALSE;
}
else
@@ -216,7 +216,7 @@ static gboolean jabber_read_callback( gpointer data, gint fd, b_input_condition
else
{
imc_error( ic, "XML stream error" );
- imc_logout( ic );
+ imc_logout( ic, TRUE );
return FALSE;
}
}
@@ -227,7 +227,7 @@ static gboolean jabber_read_callback( gpointer data, gint fd, b_input_condition
jd->fd = -1;
imc_error( ic, "Error while reading from server" );
- imc_logout( ic );
+ imc_logout( ic, TRUE );
return FALSE;
}
@@ -242,7 +242,7 @@ gboolean jabber_connected_plain( gpointer data, gint source, b_input_condition c
if( source == -1 )
{
imc_error( ic, "Could not connect to server" );
- imc_logout( ic );
+ imc_logout( ic, TRUE );
return FALSE;
}
@@ -263,7 +263,7 @@ gboolean jabber_connected_ssl( gpointer data, void *source, b_input_condition co
jd->ssl = NULL;
imc_error( ic, "Could not connect to server" );
- imc_logout( ic );
+ imc_logout( ic, TRUE );
return FALSE;
}
@@ -274,7 +274,7 @@ gboolean jabber_connected_ssl( gpointer data, void *source, b_input_condition co
static xt_status jabber_end_of_stream( struct xt_node *node, gpointer data )
{
- imc_logout( data );
+ imc_logout( data, TRUE );
return XT_ABORT;
}
@@ -297,7 +297,7 @@ static xt_status jabber_pkt_features( struct xt_node *node, gpointer data )
if( c && ( !trytls && !set_getbool( &ic->acc->set, "tls" ) ) )
{
imc_error( ic, "Server requires TLS connections, but TLS is turned off for this account" );
- imc_logout( ic );
+ imc_logout( ic, FALSE );
return XT_ABORT;
}
@@ -327,7 +327,7 @@ static xt_status jabber_pkt_features( struct xt_node *node, gpointer data )
if( !trytls && set_getbool( &ic->acc->set, "tls" ) )
{
imc_error( ic, "TLS is turned on for this account, but is not supported by this server" );
- imc_logout( ic );
+ imc_logout( ic, FALSE );
return XT_ABORT;
}
@@ -428,6 +428,7 @@ static xt_status jabber_pkt_stream_error( struct xt_node *node, gpointer data )
struct im_connection *ic = data;
struct xt_node *c;
char *s, *type = NULL, *text = NULL;
+ int allow_reconnect = TRUE;
for( c = node->children; c; c = c->next )
{
@@ -452,7 +453,7 @@ static xt_status jabber_pkt_stream_error( struct xt_node *node, gpointer data )
if( type == NULL )
{
imc_error( ic, "Unknown stream error reported by server" );
- imc_logout( ic );
+ imc_logout( ic, allow_reconnect );
return XT_ABORT;
}
@@ -462,14 +463,14 @@ static xt_status jabber_pkt_stream_error( struct xt_node *node, gpointer data )
if( strcmp( type, "conflict" ) == 0 )
{
imc_error( ic, "Account and resource used from a different location" );
- ic->wants_to_die = TRUE;
+ allow_reconnect = FALSE;
}
else
{
imc_error( ic, "Stream error: %s%s%s", type, text ? ": " : "", text ? text : "" );
}
- imc_logout( ic );
+ imc_logout( ic, allow_reconnect );
return XT_ABORT;
}
diff --git a/protocols/jabber/iq.c b/protocols/jabber/iq.c
index 86dca30a..fc6f223d 100644
--- a/protocols/jabber/iq.c
+++ b/protocols/jabber/iq.c
@@ -39,7 +39,7 @@ xt_status jabber_pkt_iq( struct xt_node *node, gpointer data )
if( !type )
{
imc_error( ic, "Received IQ packet without type." );
- imc_logout( ic );
+ imc_logout( ic, TRUE );
return XT_ABORT;
}
@@ -219,7 +219,7 @@ static xt_status jabber_do_iq_auth( struct im_connection *ic, struct xt_node *no
if( !( query = xt_find_node( node->children, "query" ) ) )
{
imc_log( ic, "WARNING: Received incomplete IQ packet while authenticating" );
- imc_logout( ic );
+ imc_logout( ic, FALSE );
return XT_HANDLED;
}
@@ -258,7 +258,7 @@ static xt_status jabber_do_iq_auth( struct im_connection *ic, struct xt_node *no
xt_free_node( reply );
imc_error( ic, "Can't find suitable authentication method" );
- imc_logout( ic );
+ imc_logout( ic, FALSE );
return XT_ABORT;
}
@@ -277,14 +277,14 @@ static xt_status jabber_finish_iq_auth( struct im_connection *ic, struct xt_node
if( !( type = xt_find_attr( node, "type" ) ) )
{
imc_log( ic, "WARNING: Received incomplete IQ packet while authenticating" );
- imc_logout( ic );
+ imc_logout( ic, FALSE );
return XT_HANDLED;
}
if( strcmp( type, "error" ) == 0 )
{
imc_error( ic, "Authentication failure" );
- imc_logout( ic );
+ imc_logout( ic, FALSE );
return XT_ABORT;
}
else if( strcmp( type, "result" ) == 0 )
diff --git a/protocols/jabber/jabber.c b/protocols/jabber/jabber.c
index ec0df487..af294d90 100644
--- a/protocols/jabber/jabber.c
+++ b/protocols/jabber/jabber.c
@@ -72,7 +72,7 @@ static void jabber_login( account_t *acc )
if( jd->server == NULL )
{
imc_error( ic, "Incomplete account name (format it like <username@jabberserver.name>)" );
- imc_logout( ic );
+ imc_logout( ic, FALSE );
return;
}
@@ -165,7 +165,7 @@ static void jabber_login( account_t *acc )
{
imc_log( ic, "Incorrect port number, must be in the %d-%d range",
JABBER_PORT_MIN, JABBER_PORT_MAX );
- imc_logout( ic );
+ imc_logout( ic, FALSE );
return;
}
@@ -186,7 +186,7 @@ static void jabber_login( account_t *acc )
if( jd->fd == -1 )
{
imc_error( ic, "Could not connect to server" );
- imc_logout( ic );
+ imc_logout( ic, TRUE );
}
}
diff --git a/protocols/jabber/sasl.c b/protocols/jabber/sasl.c
index ab6f6c00..cbd40fb1 100644
--- a/protocols/jabber/sasl.c
+++ b/protocols/jabber/sasl.c
@@ -44,7 +44,8 @@ xt_status sasl_pkt_mechanisms( struct xt_node *node, gpointer data )
s = xt_find_attr( node, "xmlns" );
if( !s || strcmp( s, XMLNS_SASL ) != 0 )
{
- imc_logout( ic );
+ imc_log( ic, "Stream error while authenticating" );
+ imc_logout( ic, FALSE );
return XT_ABORT;
}
@@ -62,7 +63,7 @@ xt_status sasl_pkt_mechanisms( struct xt_node *node, gpointer data )
if( !sup_plain && !sup_digest )
{
imc_error( ic, "No known SASL authentication schemes supported" );
- imc_logout( ic );
+ imc_logout( ic, FALSE );
return XT_ABORT;
}
@@ -279,7 +280,7 @@ xt_status sasl_pkt_challenge( struct xt_node *node, gpointer data )
error:
imc_error( ic, "Incorrect SASL challenge received" );
- imc_logout( ic );
+ imc_logout( ic, FALSE );
silent_error:
g_free( digest_uri );
@@ -302,7 +303,8 @@ xt_status sasl_pkt_result( struct xt_node *node, gpointer data )
s = xt_find_attr( node, "xmlns" );
if( !s || strcmp( s, XMLNS_SASL ) != 0 )
{
- imc_logout( ic );
+ imc_log( ic, "Stream error while authenticating" );
+ imc_logout( ic, FALSE );
return XT_ABORT;
}
@@ -314,7 +316,7 @@ xt_status sasl_pkt_result( struct xt_node *node, gpointer data )
else if( strcmp( node->name, "failure" ) == 0 )
{
imc_error( ic, "Authentication failure" );
- imc_logout( ic );
+ imc_logout( ic, FALSE );
return XT_ABORT;
}
diff --git a/protocols/msn/msn.c b/protocols/msn/msn.c
index 860be01b..74a41322 100644
--- a/protocols/msn/msn.c
+++ b/protocols/msn/msn.c
@@ -47,7 +47,7 @@ static void msn_login( account_t *acc )
if( strchr( acc->user, '@' ) == NULL )
{
imc_error( ic, "Invalid account name" );
- imc_logout( ic );
+ imc_logout( ic, FALSE );
return;
}
@@ -57,7 +57,7 @@ static void msn_login( account_t *acc )
if( md->fd < 0 )
{
imc_error( ic, "Could not connect to server" );
- imc_logout( ic );
+ imc_logout( ic, TRUE );
return;
}
@@ -378,7 +378,7 @@ static char *msn_set_display_name( set_t *set, char *value )
fn = msn_http_encode( value );
- g_snprintf( buf, sizeof( buf ), "REA %d %s %s\r\n", ++md->trId, ic->username, fn );
+ g_snprintf( buf, sizeof( buf ), "REA %d %s %s\r\n", ++md->trId, ic->acc->user, fn );
msn_write( ic, buf, strlen( buf ) );
g_free( fn );
diff --git a/protocols/msn/msn_util.c b/protocols/msn/msn_util.c
index 72411095..67e17b08 100644
--- a/protocols/msn/msn_util.c
+++ b/protocols/msn/msn_util.c
@@ -36,7 +36,7 @@ int msn_write( struct im_connection *ic, char *s, int len )
if( st != len )
{
imc_error( ic, "Short write() to main server" );
- imc_logout( ic );
+ imc_logout( ic, TRUE );
return( 0 );
}
diff --git a/protocols/msn/ns.c b/protocols/msn/ns.c
index 81ad1941..77bb4939 100644
--- a/protocols/msn/ns.c
+++ b/protocols/msn/ns.c
@@ -47,7 +47,7 @@ gboolean msn_ns_connected( gpointer data, gint source, b_input_condition cond )
if( source == -1 )
{
imc_error( ic, "Could not connect to server" );
- imc_logout( ic );
+ imc_logout( ic, TRUE );
return FALSE;
}
@@ -89,7 +89,7 @@ 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. */
{
imc_error( ic, "Error while reading from server" );
- imc_logout( ic );
+ imc_logout( ic, TRUE );
return FALSE;
}
@@ -114,18 +114,18 @@ static int msn_ns_command( gpointer data, char **cmd, int num_parts )
if( cmd[2] && strncmp( cmd[2], "MSNP8", 5 ) != 0 )
{
imc_error( ic, "Unsupported protocol" );
- imc_logout( ic );
+ imc_logout( ic, FALSE );
return( 0 );
}
g_snprintf( buf, sizeof( buf ), "CVR %d 0x0409 mac 10.2.0 ppc macmsgs 3.5.1 macmsgs %s\r\n",
- ++md->trId, ic->username );
+ ++md->trId, ic->acc->user );
return( msn_write( ic, buf, strlen( buf ) ) );
}
else if( strcmp( cmd[0], "CVR" ) == 0 )
{
/* We don't give a damn about the information we just received */
- g_snprintf( buf, sizeof( buf ), "USR %d TWN I %s\r\n", ++md->trId, ic->username );
+ g_snprintf( buf, sizeof( buf ), "USR %d TWN I %s\r\n", ++md->trId, ic->acc->user );
return( msn_write( ic, buf, strlen( buf ) ) );
}
else if( strcmp( cmd[0], "XFR" ) == 0 )
@@ -143,7 +143,7 @@ static int msn_ns_command( gpointer data, char **cmd, int num_parts )
if( !server )
{
imc_error( ic, "Syntax error" );
- imc_logout( ic );
+ imc_logout( ic, TRUE );
return( 0 );
}
*server = 0;
@@ -162,7 +162,7 @@ static int msn_ns_command( gpointer data, char **cmd, int num_parts )
if( !server )
{
imc_error( ic, "Syntax error" );
- imc_logout( ic );
+ imc_logout( ic, TRUE );
return( 0 );
}
*server = 0;
@@ -172,7 +172,7 @@ static int msn_ns_command( gpointer data, char **cmd, int num_parts )
if( strcmp( cmd[4], "CKI" ) != 0 )
{
imc_error( ic, "Unknown authentication method for switchboard" );
- imc_logout( ic );
+ imc_logout( ic, TRUE );
return( 0 );
}
@@ -204,7 +204,7 @@ static int msn_ns_command( gpointer data, char **cmd, int num_parts )
else
{
imc_error( ic, "Syntax error" );
- imc_logout( ic );
+ imc_logout( ic, TRUE );
return( 0 );
}
}
@@ -213,10 +213,10 @@ static int msn_ns_command( gpointer data, char **cmd, int num_parts )
if( num_parts == 5 && strcmp( cmd[2], "TWN" ) == 0 && strcmp( cmd[3], "S" ) == 0 )
{
/* Time for some Passport black magic... */
- if( !passport_get_id( msn_auth_got_passport_id, ic, ic->username, ic->password, cmd[4] ) )
+ if( !passport_get_id( msn_auth_got_passport_id, ic, ic->acc->user, ic->acc->pass, cmd[4] ) )
{
imc_error( ic, "Error while contacting Passport server" );
- imc_logout( ic );
+ imc_logout( ic, TRUE );
return( 0 );
}
}
@@ -243,7 +243,7 @@ static int msn_ns_command( gpointer data, char **cmd, int num_parts )
else
{
imc_error( ic, "Unknown authentication type" );
- imc_logout( ic );
+ imc_logout( ic, FALSE );
return( 0 );
}
}
@@ -252,7 +252,7 @@ static int msn_ns_command( gpointer data, char **cmd, int num_parts )
if( num_parts != 4 )
{
imc_error( ic, "Syntax error" );
- imc_logout( ic );
+ imc_logout( ic, TRUE );
return( 0 );
}
@@ -261,7 +261,7 @@ static int msn_ns_command( gpointer data, char **cmd, int num_parts )
if( md->handler->msglen <= 0 )
{
imc_error( ic, "Syntax error" );
- imc_logout( ic );
+ imc_logout( ic, TRUE );
return( 0 );
}
}
@@ -292,7 +292,7 @@ static int msn_ns_command( gpointer data, char **cmd, int num_parts )
if( num_parts != 4 && num_parts != 5 )
{
imc_error( ic, "Syntax error" );
- imc_logout( ic );
+ imc_logout( ic, TRUE );
return( 0 );
}
@@ -344,7 +344,7 @@ static int msn_ns_command( gpointer data, char **cmd, int num_parts )
if( num_parts != 4 )
{
imc_error( ic, "Syntax error" );
- imc_logout( ic );
+ imc_logout( ic, TRUE );
return( 0 );
}
@@ -363,7 +363,7 @@ static int msn_ns_command( gpointer data, char **cmd, int num_parts )
if( num_parts != 3 )
{
imc_error( ic, "Syntax error" );
- imc_logout( ic );
+ imc_logout( ic, TRUE );
return( 0 );
}
@@ -385,7 +385,7 @@ static int msn_ns_command( gpointer data, char **cmd, int num_parts )
if( num_parts != 6 )
{
imc_error( ic, "Syntax error" );
- imc_logout( ic );
+ imc_logout( ic, TRUE );
return( 0 );
}
@@ -413,7 +413,7 @@ static int msn_ns_command( gpointer data, char **cmd, int num_parts )
if( num_parts != 5 )
{
imc_error( ic, "Syntax error" );
- imc_logout( ic );
+ imc_logout( ic, TRUE );
return( 0 );
}
@@ -438,7 +438,7 @@ static int msn_ns_command( gpointer data, char **cmd, int num_parts )
if( num_parts != 7 )
{
imc_error( ic, "Syntax error" );
- imc_logout( ic );
+ imc_logout( ic, TRUE );
return( 0 );
}
@@ -448,7 +448,7 @@ static int msn_ns_command( gpointer data, char **cmd, int num_parts )
if( !server )
{
imc_error( ic, "Syntax error" );
- imc_logout( ic );
+ imc_logout( ic, TRUE );
return( 0 );
}
*server = 0;
@@ -458,7 +458,7 @@ static int msn_ns_command( gpointer data, char **cmd, int num_parts )
if( strcmp( cmd[3], "CKI" ) != 0 )
{
imc_error( ic, "Unknown authentication method for switchboard" );
- imc_logout( ic );
+ imc_logout( ic, TRUE );
return( 0 );
}
@@ -478,7 +478,7 @@ static int msn_ns_command( gpointer data, char **cmd, int num_parts )
if( strchr( cmd[4], '@' ) == NULL )
{
imc_error( ic, "Syntax error" );
- imc_logout( ic );
+ imc_logout( ic, TRUE );
return( 0 );
}
@@ -496,10 +496,12 @@ static int msn_ns_command( gpointer data, char **cmd, int num_parts )
}
else if( strcmp( cmd[0], "OUT" ) == 0 )
{
+ int allow_reconnect = TRUE;
+
if( cmd[1] && strcmp( cmd[1], "OTH" ) == 0 )
{
imc_error( ic, "Someone else logged in with your account" );
- ic->wants_to_die = 1;
+ allow_reconnect = FALSE;
}
else if( cmd[1] && strcmp( cmd[1], "SSD" ) == 0 )
{
@@ -510,7 +512,7 @@ static int msn_ns_command( gpointer data, char **cmd, int num_parts )
imc_error( ic, "Session terminated by remote server (reason unknown)" );
}
- imc_logout( ic );
+ imc_logout( ic, allow_reconnect );
return( 0 );
}
else if( strcmp( cmd[0], "REA" ) == 0 )
@@ -518,11 +520,11 @@ static int msn_ns_command( gpointer data, char **cmd, int num_parts )
if( num_parts != 5 )
{
imc_error( ic, "Syntax error" );
- imc_logout( ic );
+ imc_logout( ic, TRUE );
return( 0 );
}
- if( g_strcasecmp( cmd[3], ic->username ) == 0 )
+ if( g_strcasecmp( cmd[3], ic->acc->user ) == 0 )
{
set_t *s;
@@ -552,7 +554,7 @@ static int msn_ns_command( gpointer data, char **cmd, int num_parts )
if( md->handler->msglen <= 0 )
{
imc_error( ic, "Syntax error" );
- imc_logout( ic );
+ imc_logout( ic, TRUE );
return( 0 );
}
}
@@ -565,7 +567,7 @@ static int msn_ns_command( gpointer data, char **cmd, int num_parts )
if( err->flags & STATUS_FATAL )
{
- imc_logout( ic );
+ imc_logout( ic, TRUE );
return( 0 );
}
}
@@ -672,7 +674,7 @@ static void msn_auth_got_passport_id( struct passport_reply *rep )
{
imc_error( ic, "Error during Passport authentication (%s)",
rep->error_string ? rep->error_string : "Unknown error" );
- imc_logout( ic );
+ imc_logout( ic, TRUE );
}
else
{
diff --git a/protocols/msn/sb.c b/protocols/msn/sb.c
index f7007d32..f8413856 100644
--- a/protocols/msn/sb.c
+++ b/protocols/msn/sb.c
@@ -141,9 +141,9 @@ int msn_sb_sendmessage( struct msn_switchboard *sb, char *text )
}
else
{
- i = strlen( MSN_TYPING_HEADERS ) + strlen( sb->ic->username );
+ i = strlen( MSN_TYPING_HEADERS ) + strlen( sb->ic->acc->user );
buf = g_new0( char, i );
- i = g_snprintf( buf, i, MSN_TYPING_HEADERS, sb->ic->username );
+ i = g_snprintf( buf, i, MSN_TYPING_HEADERS, sb->ic->acc->user );
}
/* Build the final packet (MSG command + the message). */
@@ -187,7 +187,7 @@ struct groupchat *msn_sb_to_chat( struct msn_switchboard *sb )
/* Populate the channel. */
if( sb->who ) add_chat_buddy( sb->chat, sb->who );
- add_chat_buddy( sb->chat, ic->username );
+ add_chat_buddy( sb->chat, ic->acc->user );
/* And make sure the switchboard doesn't look like a regular chat anymore. */
if( sb->who )
@@ -279,9 +279,9 @@ gboolean msn_sb_connected( gpointer data, gint source, b_input_condition cond )
sb->handler->exec_message = msn_sb_message;
if( sb->session == MSN_SB_NEW )
- g_snprintf( buf, sizeof( buf ), "USR %d %s %s\r\n", ++sb->trId, ic->username, sb->key );
+ g_snprintf( buf, sizeof( buf ), "USR %d %s %s\r\n", ++sb->trId, ic->acc->user, sb->key );
else
- g_snprintf( buf, sizeof( buf ), "ANS %d %s %s %d\r\n", ++sb->trId, ic->username, sb->key, sb->session );
+ g_snprintf( buf, sizeof( buf ), "ANS %d %s %s %d\r\n", ++sb->trId, ic->acc->user, sb->key, sb->session );
if( msn_sb_write( sb, buf, strlen( buf ) ) )
sb->inp = b_input_add( sb->fd, GAIM_INPUT_READ, msn_sb_callback, sb );
@@ -321,7 +321,7 @@ static int msn_sb_command( gpointer data, char **cmd, int num_parts )
if( strcmp( cmd[0], "XFR" ) == 0 )
{
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 );
+ imc_logout( ic, TRUE );
return( 0 );
}
else if( strcmp( cmd[0], "USR" ) == 0 )
@@ -383,7 +383,7 @@ static int msn_sb_command( gpointer data, char **cmd, int num_parts )
if( num == tot )
{
- add_chat_buddy( sb->chat, ic->username );
+ add_chat_buddy( sb->chat, ic->acc->user );
}
}
}
@@ -536,7 +536,7 @@ static int msn_sb_command( gpointer data, char **cmd, int num_parts )
}
else if( err->flags & STATUS_FATAL )
{
- imc_logout( ic );
+ imc_logout( ic, TRUE );
return 0;
}
else if( err->flags & STATUS_SB_IM_SPARE )
diff --git a/protocols/nogaim.c b/protocols/nogaim.c
index 0c042bac..273cc6c8 100644
--- a/protocols/nogaim.c
+++ b/protocols/nogaim.c
@@ -150,10 +150,6 @@ struct im_connection *imc_new( account_t *acc )
ic = g_new0( struct im_connection, 1 );
- /* Maybe we should get rid of this memory waste later. ;-) */
- g_snprintf( ic->username, sizeof( ic->username ), "%s", acc->user );
- g_snprintf( ic->password, sizeof( ic->password ), "%s", acc->pass );
-
ic->irc = acc->irc;
ic->acc = acc;
acc->ic = ic;
@@ -200,7 +196,7 @@ static void serv_got_crap( struct im_connection *ic, char *format, ... )
/* If we found one, include the screenname in the message. */
if( a )
- irc_usermsg( ic->irc, "%s(%s) - %s", ic->acc->prpl->name, ic->username, text );
+ irc_usermsg( ic->irc, "%s(%s) - %s", ic->acc->prpl->name, ic->acc->user, text );
else
irc_usermsg( ic->irc, "%s - %s", ic->acc->prpl->name, text );
@@ -290,7 +286,7 @@ void cancel_auto_reconnect( account_t *a )
a->reconnect = 0;
}
-void imc_logout( struct im_connection *ic )
+void imc_logout( struct im_connection *ic, int allow_reconnect )
{
irc_t *irc = ic->irc;
user_t *t, *u = irc->users;
@@ -332,7 +328,7 @@ void imc_logout( struct im_connection *ic )
{
/* Uhm... This is very sick. */
}
- else if( !ic->wants_to_die && set_getbool( &irc->set, "auto_reconnect" ) &&
+ else if( allow_reconnect && set_getbool( &irc->set, "auto_reconnect" ) &&
set_getbool( &a->set, "auto_reconnect" ) )
{
int delay = set_getint( &irc->set, "auto_reconnect_delay" );
@@ -437,11 +433,6 @@ struct buddy *find_buddy( struct im_connection *ic, char *handle )
return( b );
}
-void signoff_blocked( struct im_connection *ic )
-{
- return; /* Make all blocked users look invisible (TODO?) */
-}
-
void serv_buddy_rename( struct im_connection *ic, char *handle, char *realname )
{
@@ -729,7 +720,7 @@ void serv_got_chat_in( struct groupchat *c, char *who, int whisper, char *msg, t
user_t *u;
/* Gaim sends own messages through this too. IRC doesn't want this, so kill them */
- if( g_strcasecmp( who, ic->username ) == 0 )
+ if( g_strcasecmp( who, ic->acc->user ) == 0 )
return;
u = user_findhandle( ic, who );
@@ -780,7 +771,7 @@ void add_chat_buddy( struct groupchat *b, char *handle )
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 )
+ if( b->ic->acc->prpl->handle_cmp( handle, b->ic->acc->user ) == 0 )
{
u = user_find( b->ic->irc, b->ic->irc->nick );
if( !b->joined )
@@ -814,7 +805,7 @@ void remove_chat_buddy( struct groupchat *b, char *handle, char *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 )
+ if( g_strcasecmp( handle, b->ic->acc->user ) == 0 )
{
u = user_find( b->ic->irc, b->ic->irc->nick );
b->joined = 0;
@@ -957,7 +948,6 @@ int bim_buddy_msg( struct im_connection *ic, char *handle, char *msg, int flags
int bim_chat_msg( struct groupchat *c, char *msg, int flags )
{
char *buf = NULL;
- int st;
if( ( c->ic->flags & OPT_CONN_HTML ) && ( g_strncasecmp( msg, "<html>", 6 ) != 0 ) )
{
diff --git a/protocols/nogaim.h b/protocols/nogaim.h
index 53e3b23b..08df1750 100644
--- a/protocols/nogaim.h
+++ b/protocols/nogaim.h
@@ -79,14 +79,10 @@ struct im_connection
GSList *deny;
int permdeny;
- char username[64];
char displayname[128];
- char password[32];
-
char *away;
int evil;
- gboolean wants_to_die; /* defaults to FALSE */
/* BitlBee */
irc_t *irc;
@@ -210,7 +206,7 @@ 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 );
+G_MODULE_EXPORT void imc_logout( struct im_connection *ic, int allow_reconnect );
/* dialogs.c */
G_MODULE_EXPORT void do_ask_dialog( struct im_connection *ic, char *msg, void *data, void *doit, void *dont );
diff --git a/protocols/oscar/oscar.c b/protocols/oscar/oscar.c
index abc2f4be..d95c7068 100644
--- a/protocols/oscar/oscar.c
+++ b/protocols/oscar/oscar.c
@@ -262,12 +262,12 @@ static gboolean oscar_callback(gpointer data, gint source,
if (aim_get_command(odata->sess, conn) >= 0) {
aim_rxdispatch(odata->sess);
if (odata->killme)
- imc_logout(ic);
+ imc_logout(ic, TRUE);
} else {
if ((conn->type == AIM_CONN_TYPE_BOS) ||
!(aim_getconn_type(odata->sess, AIM_CONN_TYPE_BOS))) {
imc_error(ic, _("Disconnected."));
- imc_logout(ic);
+ imc_logout(ic, TRUE);
} else if (conn->type == AIM_CONN_TYPE_CHAT) {
struct chat_connection *c = find_oscar_chat_by_conn(ic, conn);
c->conn = NULL;
@@ -325,7 +325,7 @@ static gboolean oscar_login_connect(gpointer data, gint source, b_input_conditio
if (source < 0) {
imc_error(ic, _("Couldn't connect to host"));
- imc_logout(ic);
+ imc_logout(ic, TRUE);
return FALSE;
}
@@ -360,7 +360,9 @@ static void oscar_login(account_t *acc) {
/* This is odd but it's necessary for a proper do_import and do_export.
We don't do those anymore, but let's stick with it, just in case
it accidentally fixes something else too... </bitlbee> */
- ic->password[8] = 0;
+ /* ic->acc->pass[8] = 0;
+ Not touching this anymore now that it belongs to account_t!
+ Let's hope nothing will break. ;-) */
} else {
ic->flags |= OPT_CONN_HTML;
}
@@ -378,13 +380,13 @@ static void oscar_login(account_t *acc) {
conn = aim_newconn(sess, AIM_CONN_TYPE_AUTH, NULL);
if (conn == NULL) {
imc_error(ic, _("Unable to login to AIM"));
- imc_logout(ic);
+ imc_logout(ic, TRUE);
return;
}
if (acc->server == NULL) {
imc_error(ic, "No servername specified");
- imc_logout(ic);
+ imc_logout(ic, FALSE);
return;
}
@@ -393,7 +395,7 @@ static void oscar_login(account_t *acc) {
imc_log(ic, "Warning: Unknown OSCAR server: `%s'. Please review your configuration if the connection fails.",acc->server);
}
- imc_log(ic, _("Signon: %s"), ic->username);
+ imc_log(ic, _("Signon: %s"), ic->acc->user);
aim_conn_addhandler(sess, conn, 0x0017, 0x0007, gaim_parse_login, 0);
aim_conn_addhandler(sess, conn, 0x0017, 0x0003, gaim_parse_auth_resp, 0);
@@ -402,10 +404,10 @@ static void oscar_login(account_t *acc) {
conn->fd = proxy_connect(acc->server, AIM_LOGIN_PORT, oscar_login_connect, ic);
if (conn->fd < 0) {
imc_error(ic, _("Couldn't connect to host"));
- imc_logout(ic);
+ imc_logout(ic, TRUE);
return;
}
- aim_request_login(sess, conn, ic->username);
+ aim_request_login(sess, conn, ic->acc->user);
}
static void oscar_logout(struct im_connection *ic) {
@@ -462,7 +464,7 @@ static gboolean oscar_bos_connect(gpointer data, gint source, b_input_condition
if (source < 0) {
imc_error(ic, _("Could Not Connect"));
- imc_logout(ic);
+ imc_logout(ic, TRUE);
return FALSE;
}
@@ -727,7 +729,7 @@ static int gaim_parse_login(aim_session_t *sess, aim_frame_t *fr, ...) {
key = va_arg(ap, char *);
va_end(ap);
- aim_send_login(sess, fr->conn, ic->username, ic->password, &info, key);
+ aim_send_login(sess, fr->conn, ic->acc->user, ic->acc->pass, &info, key);
return 1;
}
@@ -1012,7 +1014,7 @@ static int gaim_parse_oncoming(aim_session_t *sess, aim_frame_t *fr, ...) {
if (info->present & AIM_USERINFO_PRESENT_SESSIONLEN)
signon = time(NULL) - info->sessionlen;
- tmp = g_strdup(normalize(ic->username));
+ tmp = g_strdup(normalize(ic->acc->user));
if (!strcmp(tmp, normalize(info->sn)))
g_snprintf(ic->displayname, sizeof(ic->displayname), "%s", info->sn);
g_free(tmp);
@@ -2135,10 +2137,10 @@ static void oscar_set_permit_deny(struct im_connection *ic) {
switch(ic->permdeny) {
case 1:
- aim_bos_changevisibility(od->sess, od->conn, AIM_VISIBILITYCHANGE_DENYADD, ic->username);
+ aim_bos_changevisibility(od->sess, od->conn, AIM_VISIBILITYCHANGE_DENYADD, ic->acc->user);
break;
case 2:
- aim_bos_changevisibility(od->sess, od->conn, AIM_VISIBILITYCHANGE_PERMITADD, ic->username);
+ aim_bos_changevisibility(od->sess, od->conn, AIM_VISIBILITYCHANGE_PERMITADD, ic->acc->user);
break;
case 3:
list = ic->permit;
@@ -2161,7 +2163,6 @@ static void oscar_set_permit_deny(struct im_connection *ic) {
default:
break;
}
- signoff_blocked(ic);
} else {
if (od->sess->ssi.received_data)
aim_ssi_setpermdeny(od->sess, od->conn, ic->permdeny, 0xffffffff);
@@ -2583,7 +2584,7 @@ struct groupchat *oscar_chat_with(struct im_connection * ic, char *who)
static int chat_id = 0;
char * chatname;
- chatname = g_strdup_printf("%s%d", ic->username, chat_id++);
+ chatname = g_strdup_printf("%s%d", ic->acc->user, chat_id++);
ret = oscar_chat_join(ic, chatname);
diff --git a/protocols/yahoo/yahoo.c b/protocols/yahoo/yahoo.c
index c10c3103..ae66b209 100644
--- a/protocols/yahoo/yahoo.c
+++ b/protocols/yahoo/yahoo.c
@@ -360,11 +360,10 @@ static struct groupchat *byahoo_chat_with( struct im_connection *ic, char *who )
char *roomname;
YList *members;
- roomname = g_new0( char, strlen( ic->username ) + 16 );
- g_snprintf( roomname, strlen( ic->username ) + 16, "%s-Bee-%d", ic->username, byahoo_chat_id );
+ roomname = g_strdup_printf( "%s-Bee-%d", ic->acc->user, byahoo_chat_id );
c = serv_got_joined_chat( ic, roomname );
- add_chat_buddy( c, ic->username );
+ add_chat_buddy( c, ic->acc->user );
/* FIXME: Free this thing when the chat's destroyed. We can't *always*
do this because it's not always created here. */
@@ -517,6 +516,7 @@ void ext_yahoo_login_response( int id, int succ, char *url )
else
{
char *errstr;
+ int allow_reconnect = TRUE;
yd->logged_in = FALSE;
@@ -529,7 +529,7 @@ void ext_yahoo_login_response( int id, int succ, char *url )
else if( succ == YAHOO_LOGIN_DUPL )
{
errstr = "Logged in on a different machine or device";
- ic->wants_to_die = TRUE;
+ allow_reconnect = FALSE;
}
else if( succ == YAHOO_LOGIN_SOCK )
errstr = "Socket problem";
@@ -541,7 +541,7 @@ void ext_yahoo_login_response( int id, int succ, char *url )
else
imc_error( ic, "Error %d (%s)", succ, errstr );
- imc_logout( ic );
+ imc_logout( ic, allow_reconnect );
}
}
@@ -641,7 +641,7 @@ void ext_yahoo_error( int id, char *err, int fatal )
imc_error( ic, "%s", err );
if( fatal )
- imc_logout( ic );
+ imc_logout( ic, TRUE );
}
/* TODO: Clear up the mess of inp and d structures */
@@ -767,7 +767,7 @@ int ext_yahoo_connect(char *host, int port)
static void byahoo_accept_conf( gpointer w, struct byahoo_conf_invitation *inv )
{
yahoo_conference_logon( inv->yid, NULL, inv->members, inv->name );
- add_chat_buddy( inv->c, inv->ic->username );
+ add_chat_buddy( inv->c, inv->ic->acc->user );
g_free( inv->name );
g_free( inv );
}
@@ -797,7 +797,7 @@ void ext_yahoo_got_conf_invite( int id, char *who, char *room, char *msg, YList
inv->ic = ic;
for( m = members; m; m = m->next )
- if( g_strcasecmp( m->data, ic->username ) != 0 )
+ if( g_strcasecmp( m->data, ic->acc->user ) != 0 )
add_chat_buddy( inv->c, m->data );
g_snprintf( txt, 1024, "Got an invitation to chatroom %s from %s: %s", room, who, msg );