core (xmpp), stdui (profile_manager), bridge, frontends: raise an exception if the XMPP connection failed instead of sending a signal

This commit is contained in:
souliane 2014-05-23 09:59:35 +02:00
commit 244a33d2c7

View file

@ -83,26 +83,26 @@ class SatXMPPClient(client.XMPPClient):
def initializationFailed(self, reason):
log.error(_("ERROR: XMPP connection failed for profile '%(profile)s': %(reason)s" % {'profile': self.profile, 'reason': reason}))
self.host_app.bridge.connectionError("AUTH_ERROR", self.profile)
self.conn_deferred.errback(reason.value)
try:
client.XMPPClient.initializationFailed(self, reason)
except:
# we already send an error signal, no need to raise an exception
# we already chained an errback, no need to raise an exception
pass
self.conn_deferred.errback()
def isConnected(self):
return self.__connected
def connectionLost(self, connector, unused_reason):
self.__connected = False
log.info(_("********** [%s] DISCONNECTED **********") % self.profile)
try:
self.keep_alife.stop()
except AttributeError:
log.debug(_("No keep_alife"))
self.host_app.bridge.disconnected(self.profile) # we send the signal to the clients
self.host_app.purgeClient(self.profile) # and we remove references to this client
if self.__connected:
log.info(_("********** [%s] DISCONNECTED **********") % self.profile)
self.host_app.bridge.disconnected(self.profile) # we send the signal to the clients
self.host_app.purgeClient(self.profile) # and we remove references to this client
self.__connected = False
class SatMessageProtocol(xmppim.MessageProtocol):