summaryrefslogtreecommitdiff
path: root/src/core
diff options
context:
space:
mode:
authormathieui <mathieui@mathieui.net>2014-11-02 17:57:03 +0100
committermathieui <mathieui@mathieui.net>2014-11-02 17:57:03 +0100
commit5cd854f7ccd888cff08f64bad418f7ddea32291a (patch)
treed7b5fdbc0fe141760cb98c2e93d7504505602bed /src/core
parent1c1ab3cb839e5509db52770e10c7190f844eb2e5 (diff)
downloadpoezio-5cd854f7ccd888cff08f64bad418f7ddea32291a.tar.gz
poezio-5cd854f7ccd888cff08f64bad418f7ddea32291a.tar.bz2
poezio-5cd854f7ccd888cff08f64bad418f7ddea32291a.tar.xz
poezio-5cd854f7ccd888cff08f64bad418f7ddea32291a.zip
Add a stream error handler in order to display error messages
Diffstat (limited to 'src/core')
-rw-r--r--src/core/core.py2
-rw-r--r--src/core/handlers.py7
2 files changed, 9 insertions, 0 deletions
diff --git a/src/core/core.py b/src/core/core.py
index 70136250..4daeed6c 100644
--- a/src/core/core.py
+++ b/src/core/core.py
@@ -205,6 +205,7 @@ class Core(object):
self.xmpp.add_event_handler('connected', self.on_connected)
self.xmpp.add_event_handler('connection_failed', self.on_failed_connection)
self.xmpp.add_event_handler('disconnected', self.on_disconnected)
+ self.xmpp.add_event_handler('stream_error', self.on_stream_error)
self.xmpp.add_event_handler('failed_all_auth', self.on_failed_all_auth)
self.xmpp.add_event_handler('no_auth', self.on_no_auth)
self.xmpp.add_event_handler("session_start", self.on_session_start)
@@ -1930,6 +1931,7 @@ class Core(object):
on_groupchat_presence = handlers.on_groupchat_presence
on_failed_connection = handlers.on_failed_connection
on_disconnected = handlers.on_disconnected
+ on_stream_error = handlers.on_stream_error
on_failed_all_auth = handlers.on_failed_all_auth
on_no_auth = handlers.on_no_auth
on_connected = handlers.on_connected
diff --git a/src/core/handlers.py b/src/core/handlers.py
index 648c3e4d..50dca216 100644
--- a/src/core/handlers.py
+++ b/src/core/handlers.py
@@ -859,6 +859,13 @@ def on_disconnected(self, event):
self.information(_("Auto-reconnecting."), _('Info'))
self.xmpp.connect()
+def on_stream_error(self, event):
+ """
+ When we receive a stream error
+ """
+ if event and event['text']:
+ self.information(_('Stream error: %s') % event['text'], _('Error'))
+
def on_failed_all_auth(self, event):
"""
Authentication failed