summaryrefslogtreecommitdiff
path: root/src/core/handlers.py
diff options
context:
space:
mode:
Diffstat (limited to 'src/core/handlers.py')
-rw-r--r--src/core/handlers.py11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/core/handlers.py b/src/core/handlers.py
index 39c37e8f..589b2a48 100644
--- a/src/core/handlers.py
+++ b/src/core/handlers.py
@@ -828,6 +828,9 @@ def on_disconnected(self, event):
for tab in self.get_tabs(tabs.MucTab):
tab.disconnect()
self.information(_("Disconnected from server."), _('Error'))
+ if not self.legitimate_disconnect and config.get('auto_reconnect', False):
+ self.information(_("Auto-reconnecting."), _('Info'))
+ self.xmpp.connect()
def on_failed_all_auth(self, event):
"""
@@ -835,6 +838,7 @@ def on_failed_all_auth(self, event):
"""
self.information(_("Authentication failed (bad credentials?)."),
_('Error'))
+ self.legitimate_disconnect = True
def on_no_auth(self, event):
"""
@@ -842,6 +846,7 @@ def on_no_auth(self, event):
"""
self.information(_("Authentication failed, no login method available."),
_('Error'))
+ self.legitimate_disconnect = True
def on_connected(self, event):
"""
@@ -849,6 +854,12 @@ def on_connected(self, event):
"""
self.information(_("Connected to server."), 'Info')
+def on_connecting(self, event):
+ """
+ Just before we try to connect to the server
+ """
+ self.legitimate_disconnect = False
+
def on_session_start(self, event):
"""
Called when we are connected and authenticated