diff options
| author | Wilmer van der Gaast <wilmer@gaast.net> | 2010-05-11 22:33:37 +0100 | 
|---|---|---|
| committer | Wilmer van der Gaast <wilmer@gaast.net> | 2010-05-11 22:33:37 +0100 | 
| commit | f8cb76dea3554fd82c01c5cae61f35d2b6cb0936 (patch) | |
| tree | eeb8517f3c04d5d9205b1e4ec2c679893e1f5202 | |
| parent | e73a501ce0cf49d8073d7d25656561400f2aca79 (diff) | |
Stop those "Many switchboard failures" messages. No point in showing them
unless the lost switchboard actually had something queued.
| -rw-r--r-- | protocols/msn/sb.c | 49 | 
1 files changed, 22 insertions, 27 deletions
| diff --git a/protocols/msn/sb.c b/protocols/msn/sb.c index e2ee8570..49eed601 100644 --- a/protocols/msn/sb.c +++ b/protocols/msn/sb.c @@ -327,9 +327,13 @@ static gboolean msn_sb_callback( gpointer data, gint source, b_input_condition c  	struct im_connection *ic = sb->ic;  	struct msn_data *md = ic->proto_data; -	if( msn_handler( sb->handler ) == -1 ) +	if( msn_handler( sb->handler ) != -1 ) +		return TRUE; +	 +	if( sb->msgq != NULL )  	{  		time_t now = time( NULL ); +		char buf[1024];  		if( now - md->first_sb_failure > 600 )  		{ @@ -346,37 +350,28 @@ static gboolean msn_sb_callback( gpointer data, gint source, b_input_condition c  			imcb_log( ic, "Warning: Many switchboard failures on MSN connection. "  			              "There might be problems delivering your messages." ); -		if( sb->msgq != NULL ) +		if( md->msgq == NULL )  		{ -			char buf[1024]; -			 -			if( md->msgq == NULL ) -			{ -				md->msgq = sb->msgq; -			} -			else -			{ -				GSList *l; -				 -				for( l = md->msgq; l->next; l = l->next ); -				l->next = sb->msgq; -			} -			sb->msgq = NULL; +			md->msgq = sb->msgq; +		} +		else +		{ +			GSList *l; -			debug( "Moved queued messages back to the main queue, creating a new switchboard to retry." ); -			g_snprintf( buf, sizeof( buf ), "XFR %d SB\r\n", ++md->trId ); -			if( !msn_write( ic, buf, strlen( buf ) ) ) -				return FALSE; +			for( l = md->msgq; l->next; l = l->next ); +			l->next = sb->msgq;  		} +		sb->msgq = NULL; -		msn_sb_destroy( sb ); -		 -		return FALSE; -	} -	else -	{ -		return TRUE; +		debug( "Moved queued messages back to the main queue, " +		       "creating a new switchboard to retry." ); +		g_snprintf( buf, sizeof( buf ), "XFR %d SB\r\n", ++md->trId ); +		if( !msn_write( ic, buf, strlen( buf ) ) ) +			return FALSE;  	} +	 +	msn_sb_destroy( sb ); +	return FALSE;  }  static int msn_sb_command( gpointer data, char **cmd, int num_parts ) | 
