From 8017b2d9f1eceaf31aa95f87ee356ab8c114cde3 Mon Sep 17 00:00:00 2001 From: "louiz@4325f9fc-e183-4c21-96ce-0ab188b42d13" Date: Sat, 8 Jan 2011 23:20:27 +0000 Subject: Handle authentication and connection errors. fixed #1994 --- src/connection.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'src/connection.py') diff --git a/src/connection.py b/src/connection.py index 8e082087..66ae9e55 100644 --- a/src/connection.py +++ b/src/connection.py @@ -50,7 +50,7 @@ class Connection(sleekxmpp.ClientXMPP): sleekxmpp.ClientXMPP.__init__(self, jid, password, ssl=True) self.registerPlugin('xep_0030') self.registerPlugin('xep_0045') - + def start(self): # TODO, try multiple servers # With anon auth. @@ -58,10 +58,13 @@ class Connection(sleekxmpp.ClientXMPP): custom_host = config.get('custom_host', '') custom_port = config.get('custom_port', -1) if custom_host and custom_port != -1: - self.connect((custom_host, custom_port)) + res = self.connect((custom_host, custom_port), reattempt=False) else: - self.connect() + res = self.connect(reattempt=False) + if not res: + return False self.process(threaded=True) + return True # Global connection object connection = Connection() -- cgit v1.2.3