parent
9a6913053d
commit
16fa30a1e7
4 changed files with 12 additions and 4 deletions
|
@ -178,6 +178,7 @@ class Connection(ConnectionHandlers):
|
|||
# server {'icq': ['icq.server.com', 'icq2.server.com'], }
|
||||
self.vcard_supported = True
|
||||
self.private_storage_supported = True
|
||||
self.streamError = ''
|
||||
# END __init__
|
||||
|
||||
def put_event(self, ev):
|
||||
|
@ -515,7 +516,7 @@ class Connection(ConnectionHandlers):
|
|||
self._connect_to_next_host()
|
||||
|
||||
|
||||
def _connect_to_next_host(self, retry = False):
|
||||
def _connect_to_next_host(self, retry=False):
|
||||
log.debug('Connection to next host')
|
||||
if len(self._hosts):
|
||||
# No config option exist when creating a new account
|
||||
|
@ -618,15 +619,18 @@ class Connection(ConnectionHandlers):
|
|||
msg = '%s over proxy %s:%s' % (msg, self._proxy['host'], self._proxy['port'])
|
||||
log.info(msg)
|
||||
|
||||
def _connect_failure(self, con_type = None):
|
||||
def _connect_failure(self, con_type=None):
|
||||
if not con_type:
|
||||
# we are not retrying, and not conecting
|
||||
if not self.retrycount and self.connected != 0:
|
||||
self.disconnect(on_purpose = True)
|
||||
self.dispatch('STATUS', 'offline')
|
||||
sectxt = ''
|
||||
if self.streamError:
|
||||
sectxt = _('Server replied: %s\n') % self.streamError
|
||||
self.dispatch('CONNECTION_LOST',
|
||||
(_('Could not connect to "%s"') % self._hostname,
|
||||
_('Check your connection or try again later.')))
|
||||
_('%sCheck your connection or try again later.') % sectxt))
|
||||
|
||||
def on_proxy_failure(self, reason):
|
||||
log.error('Connection to proxy failed: %s' % reason)
|
||||
|
|
|
@ -122,6 +122,7 @@ class NonBlockingClient:
|
|||
# proper connection is not established yet and it's not a proxy
|
||||
# issue
|
||||
log.debug('calling on_connect_failure cb')
|
||||
self._caller.streamError = message
|
||||
self.on_connect_failure()
|
||||
else:
|
||||
# with open connection, we are calling the disconnect handlers
|
||||
|
|
|
@ -193,7 +193,7 @@ class XMPPDispatcher(PlugIn):
|
|||
self.Stream.Parse(data)
|
||||
# end stream:stream tag received
|
||||
if self.Stream and self.Stream.has_received_endtag():
|
||||
self._owner.disconnect()
|
||||
self._owner.disconnect(self.Stream.streamError)
|
||||
return 0
|
||||
except ExpatError:
|
||||
log.error('Invalid XML received from server. Forcing disconnect.')
|
||||
|
|
|
@ -355,6 +355,7 @@ class NodeBuilder:
|
|||
self.last_is_data = 1
|
||||
self._ptr=None
|
||||
self.data_buffer = None
|
||||
self.streamError = ''
|
||||
if data:
|
||||
self._parser.Parse(data,1)
|
||||
|
||||
|
@ -411,6 +412,8 @@ class NodeBuilder:
|
|||
log.info("DEPTH -> %i , tag -> %s" % (self.__depth, tag))
|
||||
self.check_data_buffer()
|
||||
if self.__depth == self._dispatch_depth:
|
||||
if self._mini_dom.getName() == 'error':
|
||||
self.streamError = self._mini_dom.getChildren()[0].getName()
|
||||
self.dispatch(self._mini_dom)
|
||||
elif self.__depth > self._dispatch_depth:
|
||||
self._ptr = self._ptr.parent
|
||||
|
|
Loading…
Add table
Reference in a new issue