aboutsummaryrefslogtreecommitdiffstats
path: root/protocols/jabber
diff options
context:
space:
mode:
Diffstat (limited to 'protocols/jabber')
-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
4 files changed, 29 insertions, 26 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;
}