core, plugins, stdui, frontends: fixes handling of "Force server" and "Force port" parameters:

- do not save a "guessed" value, they must stay empty until the user explicitely sets them
    - add constant XMPP_C2S_PORT (default value 5222)
This commit is contained in:
souliane 2014-06-23 10:23:13 +02:00
commit 83ed5f319c
3 changed files with 20 additions and 26 deletions

View file

@ -36,6 +36,10 @@ class Const(object):
APP_URL = 'http://salut-a-toi.org'
# Protocol
XMPP_C2S_PORT = 5222
## Parameters ##
NO_SECURITY_LIMIT = -1
INDIVIDUAL = "individual"

View file

@ -223,7 +223,7 @@ class SAT(service.Service):
port = int(self.memory.getParamA(C.FORCE_PORT_PARAM, "Connection", profile_key=profile))
except ValueError:
log.error(_("Can't parse port value, using default value"))
port = 5222
port = None # will use default value 5222 or be retrieved from a DNS SRV record
password = yield self.memory.asyncGetParamA("Password", "Connection", profile_key=profile)
current = self.profiles[profile] = xmpp.SatXMPPClient(self, profile,

View file

@ -36,10 +36,10 @@ except ImportError:
class SatXMPPClient(client.XMPPClient):
implements(iwokkel.IDisco)
def __init__(self, host_app, profile, user_jid, password, host=None, port=5222):
def __init__(self, host_app, profile, user_jid, password, host=None, port=C.XMPP_C2S_PORT):
# XXX: DNS SRV records are checked when the host is not specified.
# If no SRV record is found, the host is directly extracted from the JID.
client.XMPPClient.__init__(self, user_jid, password, host or None, port or 5222)
client.XMPPClient.__init__(self, user_jid, password, host or None, port or C.XMPP_C2S_PORT)
self.factory.clientConnectionLost = self.connectionLost
self.__connected = False
self.profile = profile