diff src/core/sat_main.py @ 558:626e85e46d7c

core: port parameter is used
author Goffi <goffi@goffi.org>
date Sun, 16 Dec 2012 18:01:50 +0100
parents f25eef861b43
children ca13633d3b6b
line wrap: on
line diff
--- a/src/core/sat_main.py	Sun Dec 16 18:01:06 2012 +0100
+++ b/src/core/sat_main.py	Sun Dec 16 18:01:50 2012 +0100
@@ -26,7 +26,6 @@
 
 from twisted.application import service
 from twisted.internet import defer
-from twisted.internet.defer import inlineCallbacks, returnValue
 
 from twisted.words.protocols.jabber import jid, xmlstream
 from twisted.words.xish import domish
@@ -224,10 +223,16 @@
 
         def afterMemoryInit(ignore):
             """This part must be called when we have loaded individual parameters from memory"""
+            try:
+                port = int(self.memory.getParamA("Port", "Connection", profile_key = profile))
+            except ValueError:
+                error(_("Can't parse port value, using default value"))
+                port = 5222
             current = self.profiles[profile] = xmpp.SatXMPPClient(self, profile,
                 jid.JID(self.memory.getParamA("JabberID", "Connection", profile_key = profile), profile),
                 self.memory.getParamA("Password", "Connection", profile_key = profile),
-                self.memory.getParamA("Server", "Connection", profile_key = profile), 5222)
+                self.memory.getParamA("Server", "Connection", profile_key = profile), 
+                port)
 
             current.messageProt = xmpp.SatMessageProtocol(self)
             current.messageProt.setHandlerParent(current)