core, memory, plugins, stdui, frontends: look for DNS SRV records when server is not specified:
- fix bug 3
- modify "Connection" params:
- rename "Server" to "Force server" and "Port" to "Force port"
- set the default value to empty string for both
This commit is contained in:
parent
0cbc88ac39
commit
d4eff5b99c
3 changed files with 26 additions and 19 deletions
|
|
@ -40,6 +40,9 @@ class Const(object):
|
|||
NO_SECURITY_LIMIT = -1
|
||||
INDIVIDUAL = "individual"
|
||||
GENERAL = "general"
|
||||
# Parameters related to connection
|
||||
FORCE_SERVER_PARAM = "Force server"
|
||||
FORCE_PORT_PARAM = "Force port"
|
||||
# Parameters related to encryption
|
||||
PROFILE_PASS_PATH = ('General', 'Password')
|
||||
MEMORY_CRYPTO_NAMESPACE = 'crypto' # for the private persistent binary dict
|
||||
|
|
|
|||
|
|
@ -220,7 +220,7 @@ class SAT(service.Service):
|
|||
def _connectXMPPClient(self, profile):
|
||||
"""This part is called from asyncConnect when we have loaded individual parameters from memory"""
|
||||
try:
|
||||
port = int(self.memory.getParamA("Port", "Connection", profile_key=profile))
|
||||
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
|
||||
|
|
@ -228,7 +228,7 @@ class SAT(service.Service):
|
|||
password = yield self.memory.asyncGetParamA("Password", "Connection", profile_key=profile)
|
||||
current = self.profiles[profile] = xmpp.SatXMPPClient(self, profile,
|
||||
jid.JID(self.memory.getParamA("JabberID", "Connection", profile_key=profile)),
|
||||
password, self.memory.getParamA("Server", "Connection", profile_key=profile), port)
|
||||
password, self.memory.getParamA(C.FORCE_SERVER_PARAM, "Connection", profile_key=profile), port)
|
||||
|
||||
current.messageProt = xmpp.SatMessageProtocol(self)
|
||||
current.messageProt.setHandlerParent(current)
|
||||
|
|
|
|||
|
|
@ -37,7 +37,9 @@ class SatXMPPClient(client.XMPPClient):
|
|||
implements(iwokkel.IDisco)
|
||||
|
||||
def __init__(self, host_app, profile, user_jid, password, host=None, port=5222):
|
||||
client.XMPPClient.__init__(self, user_jid, password, host, 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)
|
||||
self.factory.clientConnectionLost = self.connectionLost
|
||||
self.__connected = False
|
||||
self.profile = profile
|
||||
|
|
|
|||
Loading…
Reference in a new issue