static xt_status jabber_pkt_stream_error( struct xt_node *node, gpointer data ) { struct im_connection *ic = data; int allow_reconnect = TRUE; struct jabber_error *err; err = jabber_error_parse( node, XMLNS_STREAM_ERROR ); /* Tssk... */ if( err->code == NULL ) { imcb_error( ic, "Unknown stream error reported by server" ); imc_logout( ic, allow_reconnect ); jabber_error_free( err ); return XT_ABORT; } /* We know that this is a fatal error. If it's a "conflict" error, we should turn off auto-reconnect to make sure we won't get some nasty infinite loop! */ if( strcmp( err->code, "conflict" ) == 0 ) { imcb_error( ic, "Account and resource used from a different location" ); allow_reconnect = FALSE; } else { imcb_error( ic, "Stream error: %s%s%s", err->code, err->text ? ": " : "", err->text ? err->text : "" ); } jabber_error_free( err ); imc_logout( ic, allow_reconnect ); return XT_ABORT; }
static xt_status jabber_chat_join_failed(struct im_connection *ic, struct xt_node *node, struct xt_node *orig) { struct jabber_error *err; struct jabber_buddy *bud; char *room; room = xt_find_attr(orig, "to"); bud = jabber_buddy_by_jid(ic, room, 0); err = jabber_error_parse(xt_find_node(node->children, "error"), XMLNS_STANZA_ERROR); if (err) { imcb_error(ic, "Error joining groupchat %s: %s%s%s", room, err->code, err->text ? ": " : "", err->text ? err->text : ""); jabber_error_free(err); } if (bud) { jabber_chat_free(jabber_chat_by_jid(ic, bud->bare_jid)); } return XT_HANDLED; }