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