core, bridge, frontends: renamed asyncConnect to connect, and added options parameters (not used yet)
This commit is contained in:
parent
6a8102b109
commit
b5f1e45d4e
1 changed files with 34 additions and 29 deletions
|
|
@ -86,7 +86,7 @@ class SAT(service.Service):
|
|||
self.bridge.register_method("profileStartSession", self.memory.startSession)
|
||||
self.bridge.register_method("profileIsSessionStarted", self.memory._isSessionStarted)
|
||||
self.bridge.register_method("profileSetDefault", self.memory.profileSetDefault)
|
||||
self.bridge.register_method("asyncConnect", self._asyncConnect)
|
||||
self.bridge.register_method("connect", self._connect)
|
||||
self.bridge.register_method("disconnect", self.disconnect)
|
||||
self.bridge.register_method("getContacts", self.getContacts)
|
||||
self.bridge.register_method("getContactsFromGroup", self.getContactsFromGroup)
|
||||
|
|
@ -263,22 +263,25 @@ class SAT(service.Service):
|
|||
defers_list.append(defer.maybeDeferred(unload))
|
||||
return defers_list
|
||||
|
||||
def _asyncConnect(self, profile_key, password=''):
|
||||
def _connect(self, profile_key, password='', options=None):
|
||||
profile = self.memory.getProfileName(profile_key)
|
||||
return self.asyncConnect(profile, password)
|
||||
return self.connect(profile, password, options)
|
||||
|
||||
def asyncConnect(self, profile, password='', max_retries=C.XMPP_MAX_RETRIES):
|
||||
def connect(self, profile, password='', options=None, max_retries=C.XMPP_MAX_RETRIES):
|
||||
"""Retrieve the individual parameters, authenticate the profile
|
||||
and initiate the connection to the associated XMPP server.
|
||||
|
||||
@param profile: %(doc_profile)s
|
||||
@param password (string): the SàT profile password
|
||||
@param options (dict): connection options
|
||||
@param max_retries (int): max number of connection retries
|
||||
@return (D(bool)):
|
||||
- True if the XMPP connection was already established
|
||||
- False if the XMPP connection has been initiated (it may still fail)
|
||||
@raise exceptions.PasswordError: Profile password is wrong
|
||||
"""
|
||||
if options is None:
|
||||
options={}
|
||||
def connectXMPPClient(dummy=None):
|
||||
if self.isConnected(profile):
|
||||
log.info(_("already connected !"))
|
||||
|
|
@ -292,7 +295,7 @@ class SAT(service.Service):
|
|||
|
||||
@defer.inlineCallbacks
|
||||
def _connectXMPPClient(self, profile, max_retries):
|
||||
"""This part is called from asyncConnect when we have loaded individual parameters from memory"""
|
||||
"""This part is called from connect when we have loaded individual parameters from memory"""
|
||||
try:
|
||||
port = int(self.memory.getParamA(C.FORCE_PORT_PARAM, "Connection", profile_key=profile))
|
||||
except ValueError:
|
||||
|
|
|
|||
Loading…
Reference in a new issue