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:
parent
f719875f0b
commit
244a33d2c7
4 changed files with 32 additions and 41 deletions
|
|
@ -135,11 +135,6 @@ class DbusObject(dbus.service.Object):
|
|||
def connected(self, profile):
|
||||
pass
|
||||
|
||||
@dbus.service.signal(const_INT_PREFIX+const_CORE_SUFFIX,
|
||||
signature='ss')
|
||||
def connectionError(self, error_type, profile):
|
||||
pass
|
||||
|
||||
@dbus.service.signal(const_INT_PREFIX+const_CORE_SUFFIX,
|
||||
signature='ss')
|
||||
def contactDeleted(self, entity_jid, profile):
|
||||
|
|
@ -547,9 +542,6 @@ class DBusBridge(Bridge):
|
|||
def connected(self, profile):
|
||||
self.dbus_bridge.connected(profile)
|
||||
|
||||
def connectionError(self, error_type, profile):
|
||||
self.dbus_bridge.connectionError(error_type, profile)
|
||||
|
||||
def contactDeleted(self, entity_jid, profile):
|
||||
self.dbus_bridge.contactDeleted(entity_jid, profile)
|
||||
|
||||
|
|
|
|||
|
|
@ -19,15 +19,6 @@ sig_in=s
|
|||
doc=Connection is finished or lost
|
||||
doc_param_0=%(doc_profile)s
|
||||
|
||||
[connectionError]
|
||||
type=signal
|
||||
category=core
|
||||
sig_in=ss
|
||||
doc=Something went wront with the connection
|
||||
doc_param_0=error_type: Why the connection got wrong, can be
|
||||
- AUTH_ERROR: Authentification error
|
||||
doc_param_1=%(doc_profile)s
|
||||
|
||||
[newContact]
|
||||
type=signal
|
||||
category=core
|
||||
|
|
|
|||
|
|
@ -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):
|
||||
|
|
|
|||
|
|
@ -129,4 +129,6 @@ class ProfileManager(object):
|
|||
xmpp_password = data[xml_tools.formEscape('xmpp_password')]
|
||||
d = self.host.memory.setParam("Password", xmpp_password, "Connection", profile_key=profile)
|
||||
d.addCallback(lambda dummy: self.host.asyncConnect(profile))
|
||||
return {}
|
||||
d.addCallback(lambda dummy: {})
|
||||
d.addErrback(lambda dummy: self._changeXMPPPassword({}, profile))
|
||||
return d
|
||||
|
|
|
|||
Loading…
Reference in a new issue