diff src/core/sat_main.py @ 2142:be96beb7ca14

core, bridge, frontends: renamed asyncConnect to connect, and added options parameters (not used yet)
author Goffi <goffi@goffi.org>
date Mon, 06 Feb 2017 22:54:43 +0100
parents 6e509ee853a8
children 1d3f73e065e1
line wrap: on
line diff
--- a/src/core/sat_main.py	Mon Feb 06 20:51:56 2017 +0100
+++ b/src/core/sat_main.py	Mon Feb 06 22:54:43 2017 +0100
@@ -86,7 +86,7 @@
         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 @@
                 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 @@
 
     @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: