diff options
Diffstat (limited to 'protocols/msn')
| -rw-r--r-- | protocols/msn/msn.c | 6 | ||||
| -rw-r--r-- | protocols/msn/msn_util.c | 2 | ||||
| -rw-r--r-- | protocols/msn/ns.c | 62 | ||||
| -rw-r--r-- | protocols/msn/sb.c | 16 | 
4 files changed, 44 insertions, 42 deletions
| 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 ) | 
