changeset 1059:b2b9c184033f

core, frontends: remove bridge method "connect" (always use asyncConnect)
author souliane <souliane@mailoo.org>
date Fri, 23 May 2014 10:40:54 +0200
parents 0a9986452bba
children aa15453ec54d
files frontends/src/bridge/DBus.py frontends/src/primitivus/primitivus frontends/src/wix/main_window.py src/bridge/DBus.py src/bridge/bridge_constructor/bridge_template.ini src/core/sat_main.py
diffstat 6 files changed, 2 insertions(+), 38 deletions(-) [+]
line wrap: on
line diff
--- a/frontends/src/bridge/DBus.py	Thu May 29 14:34:01 2014 +0200
+++ b/frontends/src/bridge/DBus.py	Fri May 23 10:40:54 2014 +0200
@@ -114,9 +114,6 @@
     def confirmationAnswer(self, id, accepted, data, profile):
         return self.db_core_iface.confirmationAnswer(id, accepted, data, profile)
 
-    def connect(self, profile_key="@DEFAULT@", password=''):
-        return self.db_core_iface.connect(profile_key, password)
-
     def delContact(self, entity_jid, profile_key="@DEFAULT@"):
         return self.db_core_iface.delContact(entity_jid, profile_key)
 
--- a/frontends/src/primitivus/primitivus	Thu May 29 14:34:01 2014 +0200
+++ b/frontends/src/primitivus/primitivus	Fri May 23 10:40:54 2014 +0200
@@ -561,7 +561,7 @@
 
     #MENU EVENTS#
     def onConnectRequest(self, menu):
-        self.bridge.connect(self.profile)
+        self.bridge.asyncConnect(self.profile, callback=lambda dummy: None)
 
     def onDisconnectRequest(self, menu):
         self.bridge.disconnect(self.profile)
--- a/frontends/src/wix/main_window.py	Thu May 29 14:34:01 2014 +0200
+++ b/frontends/src/wix/main_window.py	Fri May 23 10:40:54 2014 +0200
@@ -391,7 +391,7 @@
             self.chat_wins[jid.bare].Show()
 
     def onConnectRequest(self, e):
-        self.bridge.connect(self.profile)
+        self.bridge.asyncConnect(self.profile, callback=lambda dummy: None)
 
     def onDisconnectRequest(self, e):
         self.bridge.disconnect(self.profile)
--- a/src/bridge/DBus.py	Thu May 29 14:34:01 2014 +0200
+++ b/src/bridge/DBus.py	Fri May 23 10:40:54 2014 +0200
@@ -224,12 +224,6 @@
         return self._callback("confirmationAnswer", unicode(id), accepted, data, unicode(profile))
 
     @dbus.service.method(const_INT_PREFIX+const_CORE_SUFFIX,
-                         in_signature='ss', out_signature='b',
-                         async_callbacks=None)
-    def connect(self, profile_key="@DEFAULT@", password=''):
-        return self._callback("connect", unicode(profile_key), unicode(password))
-
-    @dbus.service.method(const_INT_PREFIX+const_CORE_SUFFIX,
                          in_signature='ss', out_signature='',
                          async_callbacks=None)
     def delContact(self, entity_jid, profile_key="@DEFAULT@"):
--- a/src/bridge/bridge_constructor/bridge_template.ini	Thu May 29 14:34:01 2014 +0200
+++ b/src/bridge/bridge_constructor/bridge_template.ini	Fri May 23 10:40:54 2014 +0200
@@ -228,22 +228,6 @@
  - ProfileUnknownError: the profile name is unknown
  - ConnectedProfileError: a connected profile would not be deleted
 
-[connect]
-type=method
-category=core
-sig_in=ss
-sig_out=b
-param_0_default="@DEFAULT@"
-param_1_default=''
-doc=Connect a profile
-doc_param_0=%(doc_profile_key)s
-doc_param_1=password: the SàT profile password
-doc_return=a deferred boolean or failure:
-    - boolean if the profile authentication succeed:
-        - True if the XMPP connection was already established
-        - False if the XMPP connection has been initiated (it may still fail)
-    - failure if the profile authentication failed
-
 [asyncConnect]
 async=
 type=method
--- a/src/core/sat_main.py	Thu May 29 14:34:01 2014 +0200
+++ b/src/core/sat_main.py	Fri May 23 10:40:54 2014 +0200
@@ -86,7 +86,6 @@
         self.bridge.register("getEntityData", lambda _jid, keys, profile: self.memory.getEntityData(jid.JID(_jid), keys, profile))
         self.bridge.register("asyncCreateProfile", self.memory.asyncCreateProfile)
         self.bridge.register("asyncDeleteProfile", self.memory.asyncDeleteProfile)
-        self.bridge.register("connect", self.connect)
         self.bridge.register("asyncConnect", self.asyncConnect)
         self.bridge.register("disconnect", self.disconnect)
         self.bridge.register("getContacts", self.getContacts)
@@ -183,14 +182,6 @@
             self.plugins[import_name].is_handler = False
         #TODO: test xmppclient presence and register handler parent
 
-    def connect(self, profile_key=C.PROF_KEY_NONE, password=''):
-        """Connect to jabber server
-
-        @param password (string): the SàT profile password
-        @param profile_key: %(doc_profile_key)s
-        """
-        self.asyncConnect(profile_key, password)
-
     def asyncConnect(self, profile_key=C.PROF_KEY_NONE, password=''):
         """Retrieve the individual parameters, authenticate the profile
         and initiate the connection to the associated XMPP server.
@@ -352,8 +343,6 @@
 
     def startService(self):
         log.info(u"Salut à toi ô mon frère !")
-        #TODO: manage autoconnect
-        #self.connect()
 
     def stopService(self):
         log.info(u"Salut aussi à Rantanplan")