summaryrefslogtreecommitdiff
path: root/src/connection.py
diff options
context:
space:
mode:
authorlouiz@4325f9fc-e183-4c21-96ce-0ab188b42d13 <louiz@4325f9fc-e183-4c21-96ce-0ab188b42d13>2011-01-08 23:20:27 +0000
committerlouiz@4325f9fc-e183-4c21-96ce-0ab188b42d13 <louiz@4325f9fc-e183-4c21-96ce-0ab188b42d13>2011-01-08 23:20:27 +0000
commit8017b2d9f1eceaf31aa95f87ee356ab8c114cde3 (patch)
tree8a4df03f24a7c785a37c1a947b7b05486894af0b /src/connection.py
parentaf651cbc46e5227ff815689ee7cf3ce4b3ffe0be (diff)
downloadpoezio-8017b2d9f1eceaf31aa95f87ee356ab8c114cde3.tar.gz
poezio-8017b2d9f1eceaf31aa95f87ee356ab8c114cde3.tar.bz2
poezio-8017b2d9f1eceaf31aa95f87ee356ab8c114cde3.tar.xz
poezio-8017b2d9f1eceaf31aa95f87ee356ab8c114cde3.zip
Handle authentication and connection errors. fixed #1994
Diffstat (limited to 'src/connection.py')
-rw-r--r--src/connection.py9
1 files changed, 6 insertions, 3 deletions
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()