From 80edd248ecbf1d983c796c6436c80e9e8c6726e9 Mon Sep 17 00:00:00 2001
From: mathieui <mathieui@mathieui.net>
Date: Thu, 10 Nov 2011 17:20:25 +0100
Subject: Make custom_host and custom_port work better

---
 src/connection.py | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/src/connection.py b/src/connection.py
index dfc8ba85..0be94097 100644
--- a/src/connection.py
+++ b/src/connection.py
@@ -63,9 +63,11 @@ class Connection(sleekxmpp.ClientXMPP):
         # With anon auth.
         # (domain, config.get('port', 5222))
         custom_host = config.get('custom_host', '')
-        custom_port = config.get('custom_port', -1)
-        if custom_host and custom_port != -1:
+        custom_port = config.get('custom_port', 5222)
+        if custom_host:
             res = self.connect((custom_host, custom_port), reattempt=False)
+        elif custom_port != 5222:
+            res = self.connect((self.boundjid.host, custom_port), reattempt=False)
         else:
             res = self.connect(reattempt=False)
         if not res:
-- 
cgit v1.2.3