core, bridge, frontends: renamed asyncConnect to connect, and added options parameters (not used yet)
This commit is contained in:
parent
6a8102b109
commit
b5f1e45d4e
4 changed files with 34 additions and 29 deletions
|
|
@ -164,15 +164,6 @@ class Bridge(BridgeFrontend):
|
|||
kwargs['error_handler'] = error_handler
|
||||
return self.db_core_iface.addContact(entity_jid, profile_key, **kwargs)
|
||||
|
||||
def asyncConnect(self, profile_key="@DEFAULT@", password='', callback=None, errback=None):
|
||||
if callback is None:
|
||||
error_handler = None
|
||||
else:
|
||||
if errback is None:
|
||||
errback = log.error
|
||||
error_handler = lambda err:errback(dbus_to_bridge_exception(err))
|
||||
return self.db_core_iface.asyncConnect(profile_key, password, timeout=const_TIMEOUT, reply_handler=callback, error_handler=error_handler)
|
||||
|
||||
def asyncCreateProfile(self, profile, password='', callback=None, errback=None):
|
||||
if callback is None:
|
||||
error_handler = None
|
||||
|
|
@ -209,6 +200,15 @@ class Bridge(BridgeFrontend):
|
|||
error_handler = lambda err:errback(dbus_to_bridge_exception(err))
|
||||
return self.db_core_iface.asyncGetParamsValuesFromCategory(category, security_limit, profile_key, timeout=const_TIMEOUT, reply_handler=callback, error_handler=error_handler)
|
||||
|
||||
def connect(self, profile_key="@DEFAULT@", password='', options={}, callback=None, errback=None):
|
||||
if callback is None:
|
||||
error_handler = None
|
||||
else:
|
||||
if errback is None:
|
||||
errback = log.error
|
||||
error_handler = lambda err:errback(dbus_to_bridge_exception(err))
|
||||
return self.db_core_iface.connect(profile_key, password, options, timeout=const_TIMEOUT, reply_handler=callback, error_handler=error_handler)
|
||||
|
||||
def delContact(self, entity_jid, profile_key="@DEFAULT@", callback=None, errback=None):
|
||||
if callback is None:
|
||||
error_handler = None
|
||||
|
|
|
|||
|
|
@ -482,7 +482,7 @@ class Jp(object):
|
|||
# a profile can be present without connect option (e.g. on profile creation/deletion)
|
||||
return
|
||||
elif self.args.connect is True: # if connection is asked, we connect the profile
|
||||
self.bridge.asyncConnect(self.profile, self.args.pwd, lambda dummy: callback(), cant_connect)
|
||||
self.bridge.connect(self.profile, self.args.pwd, {}, lambda dummy: callback(), cant_connect)
|
||||
self._auto_loop = True
|
||||
return
|
||||
else:
|
||||
|
|
|
|||
|
|
@ -787,7 +787,7 @@ class PrimitivusApp(QuickApp, InputHistory):
|
|||
|
||||
#MENU EVENTS#
|
||||
def onConnectRequest(self, menu):
|
||||
QuickApp.asyncConnect(self, self.current_profile)
|
||||
QuickApp.connect(self, self.current_profile)
|
||||
|
||||
def onDisconnectRequest(self, menu):
|
||||
self.disconnect(self.current_profile)
|
||||
|
|
|
|||
|
|
@ -90,7 +90,7 @@ class ProfileManager(object):
|
|||
def _plug_profile_autoconnect(self, value_str):
|
||||
autoconnect = C.bool(value_str)
|
||||
if autoconnect and not self.connected:
|
||||
self.host.asyncConnect(self.profile, callback=lambda dummy: self._plug_profile_afterconnect())
|
||||
self.host.connect(self.profile, callback=lambda dummy: self._plug_profile_afterconnect())
|
||||
else:
|
||||
self._plug_profile_afterconnect()
|
||||
|
||||
|
|
@ -440,7 +440,7 @@ class QuickApp(object):
|
|||
if not self._plugs_in_progress:
|
||||
self.contact_lists.lockUpdate(False)
|
||||
|
||||
def asyncConnect(self, profile, callback=None, errback=None):
|
||||
def connect(self, profile, callback=None, errback=None):
|
||||
if not callback:
|
||||
callback = lambda dummy: None
|
||||
if not errback:
|
||||
|
|
@ -462,7 +462,7 @@ class QuickApp(object):
|
|||
self.launchAction(C.CHANGE_XMPP_PASSWD_ID, {}, profile=profile)
|
||||
else:
|
||||
self.showDialog(message, fullname, 'error')
|
||||
self.bridge.asyncConnect(profile, callback=callback, errback=errback)
|
||||
self.bridge.connect(profile, callback=callback, errback=errback)
|
||||
|
||||
def plug_profiles(self, profiles):
|
||||
"""Tell application which profiles must be used
|
||||
|
|
|
|||
Loading…
Reference in a new issue