when unregistering an account, wait server answer before closing connection.

This commit is contained in:
Yann Leboulanger 2009-09-09 10:13:03 +02:00
parent ff49ce0f0d
commit bad4297952
1 changed files with 9 additions and 2 deletions

View File

@ -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: