From f719875f0b8e613db95861672fede34dab06badd Mon Sep 17 00:00:00 2001 From: souliane Date: Fri, 23 May 2014 10:40:54 +0200 Subject: [PATCH] core, frontends: remove bridge method "connect" (always use asyncConnect) --- frontends/src/bridge/DBus.py | 3 --- frontends/src/primitivus/primitivus | 2 +- frontends/src/wix/main_window.py | 2 +- src/bridge/DBus.py | 6 ------ .../bridge_constructor/bridge_template.ini | 16 ---------------- src/core/sat_main.py | 11 ----------- 6 files changed, 2 insertions(+), 38 deletions(-) diff --git a/frontends/src/bridge/DBus.py b/frontends/src/bridge/DBus.py index 907e4697..dadd4110 100644 --- a/frontends/src/bridge/DBus.py +++ b/frontends/src/bridge/DBus.py @@ -114,9 +114,6 @@ class DBusBridgeFrontend(BridgeFrontend): 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) diff --git a/frontends/src/primitivus/primitivus b/frontends/src/primitivus/primitivus index 6a0a506f..0bb5acef 100755 --- a/frontends/src/primitivus/primitivus +++ b/frontends/src/primitivus/primitivus @@ -561,7 +561,7 @@ class PrimitivusApp(QuickApp, InputHistory): #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) diff --git a/frontends/src/wix/main_window.py b/frontends/src/wix/main_window.py index 9159d691..3a6e1153 100644 --- a/frontends/src/wix/main_window.py +++ b/frontends/src/wix/main_window.py @@ -391,7 +391,7 @@ class MainWindow(wx.Frame, QuickApp): 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) diff --git a/src/bridge/DBus.py b/src/bridge/DBus.py index 964e4e3e..8c017aca 100755 --- a/src/bridge/DBus.py +++ b/src/bridge/DBus.py @@ -223,12 +223,6 @@ class DbusObject(dbus.service.Object): def confirmationAnswer(self, id, accepted, data, profile): 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) diff --git a/src/bridge/bridge_constructor/bridge_template.ini b/src/bridge/bridge_constructor/bridge_template.ini index 349e19c4..ad13720c 100644 --- a/src/bridge/bridge_constructor/bridge_template.ini +++ b/src/bridge/bridge_constructor/bridge_template.ini @@ -228,22 +228,6 @@ errback is called with error constant as parameter: - 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 diff --git a/src/core/sat_main.py b/src/core/sat_main.py index 0349f6a1..ee1f9244 100644 --- a/src/core/sat_main.py +++ b/src/core/sat_main.py @@ -86,7 +86,6 @@ class SAT(service.Service): 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 @@ class SAT(service.Service): 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 @@ class SAT(service.Service): 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")