From bad42979524c67da0f1054c643785c8ac3d7caf7 Mon Sep 17 00:00:00 2001 From: Yann Leboulanger Date: Wed, 9 Sep 2009 10:13:03 +0200 Subject: [PATCH] when unregistering an account, wait server answer before closing connection. --- src/common/connection.py | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/common/connection.py b/src/common/connection.py index d58c6aae5..4f8fdf977 100644 --- a/src/common/connection.py +++ b/src/common/connection.py @@ -1953,8 +1953,15 @@ class Connection(ConnectionHandlers): hostname = gajim.config.get_per('accounts', self.name, 'hostname') iq = common.xmpp.Iq(typ = 'set', to = hostname) iq.setTag(common.xmpp.NS_REGISTER + ' query').setTag('remove') - con.send(iq) - on_remove_success(True) + def _on_answer(result): + if result.getType() == 'result': + on_remove_success(True) + return + self.dispatch('ERROR', (_('Unregister failed'), + _('Unregistration with server %(server)s failed: %(error)s') \ + % {'server': hostname, 'error': result.getErrorMsg()})) + on_remove_success(False) + con.SendAndCallForResponse(iq, _on_answer) return on_remove_success(False) if self.connected == 0: