annotate sat_frontends/bridge/dbus_bridge.py @ 3047:cf843dd7c345

jp (debug): new "theme" command to print colour theme according to `background` value: fix 321
author Goffi <goffi@goffi.org>
date Tue, 01 Oct 2019 22:49:11 +0200
parents 964abd07dc03
children 2cc2f65379f7
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
3028
ab2696e34d29 Python 3 port:
Goffi <goffi@goffi.org>
parents: 2892
diff changeset
1 #!/usr/bin/env python3
0
goffi@necton2
parents:
diff changeset
2 #-*- coding: utf-8 -*-
goffi@necton2
parents:
diff changeset
3
609
84a6e83157c2 fixed licences in docstrings (they are now in comments)
Goffi <goffi@goffi.org>
parents: 595
diff changeset
4 # SAT communication bridge
2771
003b8b4b56a7 date update
Goffi <goffi@goffi.org>
parents: 2743
diff changeset
5 # Copyright (C) 2009-2019 Jérôme Poisson (goffi@goffi.org)
0
goffi@necton2
parents:
diff changeset
6
609
84a6e83157c2 fixed licences in docstrings (they are now in comments)
Goffi <goffi@goffi.org>
parents: 595
diff changeset
7 # This program is free software: you can redistribute it and/or modify
84a6e83157c2 fixed licences in docstrings (they are now in comments)
Goffi <goffi@goffi.org>
parents: 595
diff changeset
8 # it under the terms of the GNU Affero General Public License as published by
84a6e83157c2 fixed licences in docstrings (they are now in comments)
Goffi <goffi@goffi.org>
parents: 595
diff changeset
9 # the Free Software Foundation, either version 3 of the License, or
84a6e83157c2 fixed licences in docstrings (they are now in comments)
Goffi <goffi@goffi.org>
parents: 595
diff changeset
10 # (at your option) any later version.
0
goffi@necton2
parents:
diff changeset
11
609
84a6e83157c2 fixed licences in docstrings (they are now in comments)
Goffi <goffi@goffi.org>
parents: 595
diff changeset
12 # This program is distributed in the hope that it will be useful,
84a6e83157c2 fixed licences in docstrings (they are now in comments)
Goffi <goffi@goffi.org>
parents: 595
diff changeset
13 # but WITHOUT ANY WARRANTY; without even the implied warranty of
84a6e83157c2 fixed licences in docstrings (they are now in comments)
Goffi <goffi@goffi.org>
parents: 595
diff changeset
14 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
84a6e83157c2 fixed licences in docstrings (they are now in comments)
Goffi <goffi@goffi.org>
parents: 595
diff changeset
15 # GNU Affero General Public License for more details.
0
goffi@necton2
parents:
diff changeset
16
609
84a6e83157c2 fixed licences in docstrings (they are now in comments)
Goffi <goffi@goffi.org>
parents: 595
diff changeset
17 # You should have received a copy of the GNU Affero General Public License
84a6e83157c2 fixed licences in docstrings (they are now in comments)
Goffi <goffi@goffi.org>
parents: 595
diff changeset
18 # along with this program. If not, see <http://www.gnu.org/licenses/>.
0
goffi@necton2
parents:
diff changeset
19
3042
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
20 import asyncio
535
790be337cc41 bridge: fixed D-Bus warning in frontend side of bridge
Goffi <goffi@goffi.org>
parents: 504
diff changeset
21 import dbus
3042
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
22 import ast
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
23 from sat.core.i18n import _
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
24 from .bridge_frontend import BridgeException
993
301b342c697a core: use of the new core.log module:
Goffi <goffi@goffi.org>
parents: 963
diff changeset
25 from sat.core.log import getLogger
627
d207c2186519 core, bridge, jp, quick_frontend: SàT stop more gracefully if bridge can't be initialised:
Goffi <goffi@goffi.org>
parents: 609
diff changeset
26 from sat.core.exceptions import BridgeExceptionNoService, BridgeInitError
3042
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
27 from dbus.mainloop.glib import DBusGMainLoop
0
goffi@necton2
parents:
diff changeset
28
535
790be337cc41 bridge: fixed D-Bus warning in frontend side of bridge
Goffi <goffi@goffi.org>
parents: 504
diff changeset
29 DBusGMainLoop(set_as_default=True)
3042
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
30 log = getLogger(__name__)
535
790be337cc41 bridge: fixed D-Bus warning in frontend side of bridge
Goffi <goffi@goffi.org>
parents: 504
diff changeset
31
1073
f094583732de bridge: DBusException also transports the twisted failure condition
souliane <souliane@mailoo.org>
parents: 1072
diff changeset
32
2628
779351da2c13 core, frontends: replaced org\.goffi namespaces by org.salutatoi + fixed generation:
Goffi <goffi@goffi.org>
parents: 2595
diff changeset
33 const_INT_PREFIX = "org.salutatoi.SAT" # Interface prefix
595
1f160467f5de Fix pep8 support in src/bridge.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents: 587
diff changeset
34 const_ERROR_PREFIX = const_INT_PREFIX + ".error"
2628
779351da2c13 core, frontends: replaced org\.goffi namespaces by org.salutatoi + fixed generation:
Goffi <goffi@goffi.org>
parents: 2595
diff changeset
35 const_OBJ_PATH = '/org/salutatoi/SAT/bridge'
372
f964dcec1611 core: plugins refactored according to bridge + updatedValue now use profile
Goffi <goffi@goffi.org>
parents: 365
diff changeset
36 const_CORE_SUFFIX = ".core"
f964dcec1611 core: plugins refactored according to bridge + updatedValue now use profile
Goffi <goffi@goffi.org>
parents: 365
diff changeset
37 const_PLUGIN_SUFFIX = ".plugin"
1072
d123d61976c8 bridge (D-Bus): frontend side now use a 120 s timeout for async calls
Goffi <goffi@goffi.org>
parents: 1062
diff changeset
38 const_TIMEOUT = 120
360
6b5626c37909 bridge: regenerated DBus bridge
Goffi <goffi@goffi.org>
parents: 345
diff changeset
39
595
1f160467f5de Fix pep8 support in src/bridge.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents: 587
diff changeset
40
1062
95758ef3faa8 bridge: async failures are more detailed (full class name + error message)
souliane <souliane@mailoo.org>
parents: 1059
diff changeset
41 def dbus_to_bridge_exception(dbus_e):
95758ef3faa8 bridge: async failures are more detailed (full class name + error message)
souliane <souliane@mailoo.org>
parents: 1059
diff changeset
42 """Convert a DBusException to a BridgeException.
95758ef3faa8 bridge: async failures are more detailed (full class name + error message)
souliane <souliane@mailoo.org>
parents: 1059
diff changeset
43
95758ef3faa8 bridge: async failures are more detailed (full class name + error message)
souliane <souliane@mailoo.org>
parents: 1059
diff changeset
44 @param dbus_e (DBusException)
95758ef3faa8 bridge: async failures are more detailed (full class name + error message)
souliane <souliane@mailoo.org>
parents: 1059
diff changeset
45 @return: BridgeException
95758ef3faa8 bridge: async failures are more detailed (full class name + error message)
souliane <souliane@mailoo.org>
parents: 1059
diff changeset
46 """
1188
bf2927e6a0f5 frontends (dbus): error is not truncated anymore if it's not a SàT error.
Goffi <goffi@goffi.org>
parents: 1073
diff changeset
47 full_name = dbus_e.get_dbus_name()
bf2927e6a0f5 frontends (dbus): error is not truncated anymore if it's not a SàT error.
Goffi <goffi@goffi.org>
parents: 1073
diff changeset
48 if full_name.startswith(const_ERROR_PREFIX):
bf2927e6a0f5 frontends (dbus): error is not truncated anymore if it's not a SàT error.
Goffi <goffi@goffi.org>
parents: 1073
diff changeset
49 name = dbus_e.get_dbus_name()[len(const_ERROR_PREFIX) + 1:]
bf2927e6a0f5 frontends (dbus): error is not truncated anymore if it's not a SàT error.
Goffi <goffi@goffi.org>
parents: 1073
diff changeset
50 else:
bf2927e6a0f5 frontends (dbus): error is not truncated anymore if it's not a SàT error.
Goffi <goffi@goffi.org>
parents: 1073
diff changeset
51 name = full_name
1073
f094583732de bridge: DBusException also transports the twisted failure condition
souliane <souliane@mailoo.org>
parents: 1072
diff changeset
52 # XXX: dbus_e.args doesn't contain the original DBusException args, but we
f094583732de bridge: DBusException also transports the twisted failure condition
souliane <souliane@mailoo.org>
parents: 1072
diff changeset
53 # receive its serialized form in dbus_e.args[0]. From that we can rebuild
f094583732de bridge: DBusException also transports the twisted failure condition
souliane <souliane@mailoo.org>
parents: 1072
diff changeset
54 # the original arguments list thanks to ast.literal_eval (secure eval).
f094583732de bridge: DBusException also transports the twisted failure condition
souliane <souliane@mailoo.org>
parents: 1072
diff changeset
55 message = dbus_e.get_dbus_message() # similar to dbus_e.args[0]
f094583732de bridge: DBusException also transports the twisted failure condition
souliane <souliane@mailoo.org>
parents: 1072
diff changeset
56 try:
f094583732de bridge: DBusException also transports the twisted failure condition
souliane <souliane@mailoo.org>
parents: 1072
diff changeset
57 message, condition = ast.literal_eval(message)
f094583732de bridge: DBusException also transports the twisted failure condition
souliane <souliane@mailoo.org>
parents: 1072
diff changeset
58 except (SyntaxError, ValueError, TypeError):
f094583732de bridge: DBusException also transports the twisted failure condition
souliane <souliane@mailoo.org>
parents: 1072
diff changeset
59 condition = ''
f094583732de bridge: DBusException also transports the twisted failure condition
souliane <souliane@mailoo.org>
parents: 1072
diff changeset
60 return BridgeException(name, message, condition)
1062
95758ef3faa8 bridge: async failures are more detailed (full class name + error message)
souliane <souliane@mailoo.org>
parents: 1059
diff changeset
61
95758ef3faa8 bridge: async failures are more detailed (full class name + error message)
souliane <souliane@mailoo.org>
parents: 1059
diff changeset
62
3042
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
63 class Bridge:
2091
f413bfc24458 bridge, quick_frontend: preparation for async bridge
Goffi <goffi@goffi.org>
parents: 2086
diff changeset
64
f413bfc24458 bridge, quick_frontend: preparation for async bridge
Goffi <goffi@goffi.org>
parents: 2086
diff changeset
65 def bridgeConnect(self, callback, errback):
165
8a2053de6f8c Frontends: management of unlaunched SàT Backend (information message and exit)
Goffi <goffi@goffi.org>
parents: 136
diff changeset
66 try:
8a2053de6f8c Frontends: management of unlaunched SàT Backend (information message and exit)
Goffi <goffi@goffi.org>
parents: 136
diff changeset
67 self.sessions_bus = dbus.SessionBus()
360
6b5626c37909 bridge: regenerated DBus bridge
Goffi <goffi@goffi.org>
parents: 345
diff changeset
68 self.db_object = self.sessions_bus.get_object(const_INT_PREFIX,
595
1f160467f5de Fix pep8 support in src/bridge.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents: 587
diff changeset
69 const_OBJ_PATH)
372
f964dcec1611 core: plugins refactored according to bridge + updatedValue now use profile
Goffi <goffi@goffi.org>
parents: 365
diff changeset
70 self.db_core_iface = dbus.Interface(self.db_object,
595
1f160467f5de Fix pep8 support in src/bridge.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents: 587
diff changeset
71 dbus_interface=const_INT_PREFIX + const_CORE_SUFFIX)
372
f964dcec1611 core: plugins refactored according to bridge + updatedValue now use profile
Goffi <goffi@goffi.org>
parents: 365
diff changeset
72 self.db_plugin_iface = dbus.Interface(self.db_object,
595
1f160467f5de Fix pep8 support in src/bridge.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents: 587
diff changeset
73 dbus_interface=const_INT_PREFIX + const_PLUGIN_SUFFIX)
3028
ab2696e34d29 Python 3 port:
Goffi <goffi@goffi.org>
parents: 2892
diff changeset
74 except dbus.exceptions.DBusException as e:
1917
05a5a125a238 bridge (frontend): raise a BridgeExceptionNoService on org.freedesktop.DBus.Error.Spawn.ExecFailed D-Bus error
Goffi <goffi@goffi.org>
parents: 1794
diff changeset
75 if e._dbus_error_name in ('org.freedesktop.DBus.Error.ServiceUnknown',
05a5a125a238 bridge (frontend): raise a BridgeExceptionNoService on org.freedesktop.DBus.Error.Spawn.ExecFailed D-Bus error
Goffi <goffi@goffi.org>
parents: 1794
diff changeset
76 'org.freedesktop.DBus.Error.Spawn.ExecFailed'):
2091
f413bfc24458 bridge, quick_frontend: preparation for async bridge
Goffi <goffi@goffi.org>
parents: 2086
diff changeset
77 errback(BridgeExceptionNoService())
627
d207c2186519 core, bridge, jp, quick_frontend: SàT stop more gracefully if bridge can't be initialised:
Goffi <goffi@goffi.org>
parents: 609
diff changeset
78 elif e._dbus_error_name == 'org.freedesktop.DBus.Error.NotSupported':
3028
ab2696e34d29 Python 3 port:
Goffi <goffi@goffi.org>
parents: 2892
diff changeset
79 log.error(_("D-Bus is not launched, please see README to see instructions on how to launch it"))
2091
f413bfc24458 bridge, quick_frontend: preparation for async bridge
Goffi <goffi@goffi.org>
parents: 2086
diff changeset
80 errback(BridgeInitError)
165
8a2053de6f8c Frontends: management of unlaunched SàT Backend (information message and exit)
Goffi <goffi@goffi.org>
parents: 136
diff changeset
81 else:
2091
f413bfc24458 bridge, quick_frontend: preparation for async bridge
Goffi <goffi@goffi.org>
parents: 2086
diff changeset
82 errback(e)
3042
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
83 else:
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
84 callback()
372
f964dcec1611 core: plugins refactored according to bridge + updatedValue now use profile
Goffi <goffi@goffi.org>
parents: 365
diff changeset
85 #props = self.db_core_iface.getProperties()
0
goffi@necton2
parents:
diff changeset
86
2086
4633cfcbcccb bridge (D-Bus): bad design fixes:
Goffi <goffi@goffi.org>
parents: 2083
diff changeset
87 def register_signal(self, functionName, handler, iface="core"):
372
f964dcec1611 core: plugins refactored according to bridge + updatedValue now use profile
Goffi <goffi@goffi.org>
parents: 365
diff changeset
88 if iface == "core":
f964dcec1611 core: plugins refactored according to bridge + updatedValue now use profile
Goffi <goffi@goffi.org>
parents: 365
diff changeset
89 self.db_core_iface.connect_to_signal(functionName, handler)
f964dcec1611 core: plugins refactored according to bridge + updatedValue now use profile
Goffi <goffi@goffi.org>
parents: 365
diff changeset
90 elif iface == "plugin":
f964dcec1611 core: plugins refactored according to bridge + updatedValue now use profile
Goffi <goffi@goffi.org>
parents: 365
diff changeset
91 self.db_plugin_iface.connect_to_signal(functionName, handler)
f964dcec1611 core: plugins refactored according to bridge + updatedValue now use profile
Goffi <goffi@goffi.org>
parents: 365
diff changeset
92 else:
993
301b342c697a core: use of the new core.log module:
Goffi <goffi@goffi.org>
parents: 963
diff changeset
93 log.error(_('Unknown interface'))
0
goffi@necton2
parents:
diff changeset
94
568
239abc5484c9 bridge: generic plugin methods handling for frontend side in D-Bus Bridge \o/
Goffi <goffi@goffi.org>
parents: 562
diff changeset
95 def __getattribute__(self, name):
239abc5484c9 bridge: generic plugin methods handling for frontend side in D-Bus Bridge \o/
Goffi <goffi@goffi.org>
parents: 562
diff changeset
96 """ usual __getattribute__ if the method exists, else try to find a plugin method """
239abc5484c9 bridge: generic plugin methods handling for frontend side in D-Bus Bridge \o/
Goffi <goffi@goffi.org>
parents: 562
diff changeset
97 try:
239abc5484c9 bridge: generic plugin methods handling for frontend side in D-Bus Bridge \o/
Goffi <goffi@goffi.org>
parents: 562
diff changeset
98 return object.__getattribute__(self, name)
239abc5484c9 bridge: generic plugin methods handling for frontend side in D-Bus Bridge \o/
Goffi <goffi@goffi.org>
parents: 562
diff changeset
99 except AttributeError:
239abc5484c9 bridge: generic plugin methods handling for frontend side in D-Bus Bridge \o/
Goffi <goffi@goffi.org>
parents: 562
diff changeset
100 # The attribute is not found, we try the plugin proxy to find the requested method
239abc5484c9 bridge: generic plugin methods handling for frontend side in D-Bus Bridge \o/
Goffi <goffi@goffi.org>
parents: 562
diff changeset
101
239abc5484c9 bridge: generic plugin methods handling for frontend side in D-Bus Bridge \o/
Goffi <goffi@goffi.org>
parents: 562
diff changeset
102 def getPluginMethod(*args, **kwargs):
239abc5484c9 bridge: generic plugin methods handling for frontend side in D-Bus Bridge \o/
Goffi <goffi@goffi.org>
parents: 562
diff changeset
103 # We first check if we have an async call. We detect this in two ways:
239abc5484c9 bridge: generic plugin methods handling for frontend side in D-Bus Bridge \o/
Goffi <goffi@goffi.org>
parents: 562
diff changeset
104 # - if we have the 'callback' and 'errback' keyword arguments
239abc5484c9 bridge: generic plugin methods handling for frontend side in D-Bus Bridge \o/
Goffi <goffi@goffi.org>
parents: 562
diff changeset
105 # - or if the last two arguments are callable
239abc5484c9 bridge: generic plugin methods handling for frontend side in D-Bus Bridge \o/
Goffi <goffi@goffi.org>
parents: 562
diff changeset
106
3028
ab2696e34d29 Python 3 port:
Goffi <goffi@goffi.org>
parents: 2892
diff changeset
107 async_ = False
1794
b0ed4863dbc7 bridge (D-Bus): fixed handling of profile in kwargs:
Goffi <goffi@goffi.org>
parents: 1766
diff changeset
108 args = list(args)
587
952322b1d490 Remove trailing whitespaces.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents: 572
diff changeset
109
568
239abc5484c9 bridge: generic plugin methods handling for frontend side in D-Bus Bridge \o/
Goffi <goffi@goffi.org>
parents: 562
diff changeset
110 if kwargs:
1290
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
111 if 'callback' in kwargs:
3028
ab2696e34d29 Python 3 port:
Goffi <goffi@goffi.org>
parents: 2892
diff changeset
112 async_ = True
568
239abc5484c9 bridge: generic plugin methods handling for frontend side in D-Bus Bridge \o/
Goffi <goffi@goffi.org>
parents: 562
diff changeset
113 _callback = kwargs.pop('callback')
3028
ab2696e34d29 Python 3 port:
Goffi <goffi@goffi.org>
parents: 2892
diff changeset
114 _errback = kwargs.pop('errback', lambda failure: log.error(str(failure)))
1794
b0ed4863dbc7 bridge (D-Bus): fixed handling of profile in kwargs:
Goffi <goffi@goffi.org>
parents: 1766
diff changeset
115 try:
b0ed4863dbc7 bridge (D-Bus): fixed handling of profile in kwargs:
Goffi <goffi@goffi.org>
parents: 1766
diff changeset
116 args.append(kwargs.pop('profile'))
b0ed4863dbc7 bridge (D-Bus): fixed handling of profile in kwargs:
Goffi <goffi@goffi.org>
parents: 1766
diff changeset
117 except KeyError:
b0ed4863dbc7 bridge (D-Bus): fixed handling of profile in kwargs:
Goffi <goffi@goffi.org>
parents: 1766
diff changeset
118 try:
b0ed4863dbc7 bridge (D-Bus): fixed handling of profile in kwargs:
Goffi <goffi@goffi.org>
parents: 1766
diff changeset
119 args.append(kwargs.pop('profile_key'))
b0ed4863dbc7 bridge (D-Bus): fixed handling of profile in kwargs:
Goffi <goffi@goffi.org>
parents: 1766
diff changeset
120 except KeyError:
b0ed4863dbc7 bridge (D-Bus): fixed handling of profile in kwargs:
Goffi <goffi@goffi.org>
parents: 1766
diff changeset
121 pass
b0ed4863dbc7 bridge (D-Bus): fixed handling of profile in kwargs:
Goffi <goffi@goffi.org>
parents: 1766
diff changeset
122 # at this point, kwargs should be empty
b0ed4863dbc7 bridge (D-Bus): fixed handling of profile in kwargs:
Goffi <goffi@goffi.org>
parents: 1766
diff changeset
123 if kwargs:
3028
ab2696e34d29 Python 3 port:
Goffi <goffi@goffi.org>
parents: 2892
diff changeset
124 log.warnings("unexpected keyword arguments, they will be ignored: {}".format(kwargs))
595
1f160467f5de Fix pep8 support in src/bridge.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents: 587
diff changeset
125 elif len(args) >= 2 and callable(args[-1]) and callable(args[-2]):
3028
ab2696e34d29 Python 3 port:
Goffi <goffi@goffi.org>
parents: 2892
diff changeset
126 async_ = True
568
239abc5484c9 bridge: generic plugin methods handling for frontend side in D-Bus Bridge \o/
Goffi <goffi@goffi.org>
parents: 562
diff changeset
127 _errback = args.pop()
239abc5484c9 bridge: generic plugin methods handling for frontend side in D-Bus Bridge \o/
Goffi <goffi@goffi.org>
parents: 562
diff changeset
128 _callback = args.pop()
587
952322b1d490 Remove trailing whitespaces.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents: 572
diff changeset
129
568
239abc5484c9 bridge: generic plugin methods handling for frontend side in D-Bus Bridge \o/
Goffi <goffi@goffi.org>
parents: 562
diff changeset
130 method = getattr(self.db_plugin_iface, name)
587
952322b1d490 Remove trailing whitespaces.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents: 572
diff changeset
131
3028
ab2696e34d29 Python 3 port:
Goffi <goffi@goffi.org>
parents: 2892
diff changeset
132 if async_:
1072
d123d61976c8 bridge (D-Bus): frontend side now use a 120 s timeout for async calls
Goffi <goffi@goffi.org>
parents: 1062
diff changeset
133 kwargs['timeout'] = const_TIMEOUT
568
239abc5484c9 bridge: generic plugin methods handling for frontend side in D-Bus Bridge \o/
Goffi <goffi@goffi.org>
parents: 562
diff changeset
134 kwargs['reply_handler'] = _callback
1062
95758ef3faa8 bridge: async failures are more detailed (full class name + error message)
souliane <souliane@mailoo.org>
parents: 1059
diff changeset
135 kwargs['error_handler'] = lambda err: _errback(dbus_to_bridge_exception(err))
568
239abc5484c9 bridge: generic plugin methods handling for frontend side in D-Bus Bridge \o/
Goffi <goffi@goffi.org>
parents: 562
diff changeset
136
239abc5484c9 bridge: generic plugin methods handling for frontend side in D-Bus Bridge \o/
Goffi <goffi@goffi.org>
parents: 562
diff changeset
137 return method(*args, **kwargs)
587
952322b1d490 Remove trailing whitespaces.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents: 572
diff changeset
138
568
239abc5484c9 bridge: generic plugin methods handling for frontend side in D-Bus Bridge \o/
Goffi <goffi@goffi.org>
parents: 562
diff changeset
139 return getPluginMethod
1290
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
140
1622
5b24d6bf5d15 core, bridge: actionsGet:
Goffi <goffi@goffi.org>
parents: 1595
diff changeset
141 def actionsGet(self, profile_key="@DEFAULT@", callback=None, errback=None):
5b24d6bf5d15 core, bridge: actionsGet:
Goffi <goffi@goffi.org>
parents: 1595
diff changeset
142 if callback is None:
5b24d6bf5d15 core, bridge: actionsGet:
Goffi <goffi@goffi.org>
parents: 1595
diff changeset
143 error_handler = None
5b24d6bf5d15 core, bridge: actionsGet:
Goffi <goffi@goffi.org>
parents: 1595
diff changeset
144 else:
5b24d6bf5d15 core, bridge: actionsGet:
Goffi <goffi@goffi.org>
parents: 1595
diff changeset
145 if errback is None:
5b24d6bf5d15 core, bridge: actionsGet:
Goffi <goffi@goffi.org>
parents: 1595
diff changeset
146 errback = log.error
5b24d6bf5d15 core, bridge: actionsGet:
Goffi <goffi@goffi.org>
parents: 1595
diff changeset
147 error_handler = lambda err:errback(dbus_to_bridge_exception(err))
5b24d6bf5d15 core, bridge: actionsGet:
Goffi <goffi@goffi.org>
parents: 1595
diff changeset
148 kwargs={}
5b24d6bf5d15 core, bridge: actionsGet:
Goffi <goffi@goffi.org>
parents: 1595
diff changeset
149 if callback is not None:
5b24d6bf5d15 core, bridge: actionsGet:
Goffi <goffi@goffi.org>
parents: 1595
diff changeset
150 kwargs['timeout'] = const_TIMEOUT
5b24d6bf5d15 core, bridge: actionsGet:
Goffi <goffi@goffi.org>
parents: 1595
diff changeset
151 kwargs['reply_handler'] = callback
5b24d6bf5d15 core, bridge: actionsGet:
Goffi <goffi@goffi.org>
parents: 1595
diff changeset
152 kwargs['error_handler'] = error_handler
5b24d6bf5d15 core, bridge: actionsGet:
Goffi <goffi@goffi.org>
parents: 1595
diff changeset
153 return self.db_core_iface.actionsGet(profile_key, **kwargs)
5b24d6bf5d15 core, bridge: actionsGet:
Goffi <goffi@goffi.org>
parents: 1595
diff changeset
154
1290
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
155 def addContact(self, entity_jid, profile_key="@DEFAULT@", callback=None, errback=None):
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
156 if callback is None:
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
157 error_handler = None
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
158 else:
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
159 if errback is None:
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
160 errback = log.error
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
161 error_handler = lambda err:errback(dbus_to_bridge_exception(err))
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
162 kwargs={}
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
163 if callback is not None:
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
164 kwargs['timeout'] = const_TIMEOUT
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
165 kwargs['reply_handler'] = callback
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
166 kwargs['error_handler'] = error_handler
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
167 return self.db_core_iface.addContact(entity_jid, profile_key, **kwargs)
272
1d2e0dfe7114 bridge: core & frontend sides of bridge are now generated
Goffi <goffi@goffi.org>
parents: 267
diff changeset
168
893
308a96bc7c1b core, frontends: add method asyncDeleteProfile, remove synchronous methods createProfile and deleteProfile
souliane <souliane@mailoo.org>
parents: 811
diff changeset
169 def asyncDeleteProfile(self, profile, callback=None, errback=None):
1290
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
170 if callback is None:
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
171 error_handler = None
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
172 else:
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
173 if errback is None:
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
174 errback = log.error
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
175 error_handler = lambda err:errback(dbus_to_bridge_exception(err))
1237
c1e916594e09 bridge (frontends side): fixed call of async method in blocking context
Goffi <goffi@goffi.org>
parents: 1224
diff changeset
176 return self.db_core_iface.asyncDeleteProfile(profile, timeout=const_TIMEOUT, reply_handler=callback, error_handler=error_handler)
893
308a96bc7c1b core, frontends: add method asyncDeleteProfile, remove synchronous methods createProfile and deleteProfile
souliane <souliane@mailoo.org>
parents: 811
diff changeset
177
656
7d6e5807504a bridge, memory: added the parameter security_limit to asyncGetParamA so it can be used from libervia. refactorization in memory.py are related to that.
souliane <souliane@mailoo.org>
parents: 641
diff changeset
178 def asyncGetParamA(self, name, category, attribute="value", security_limit=-1, profile_key="@DEFAULT@", callback=None, errback=None):
1290
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
179 if callback is None:
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
180 error_handler = None
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
181 else:
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
182 if errback is None:
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
183 errback = log.error
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
184 error_handler = lambda err:errback(dbus_to_bridge_exception(err))
3028
ab2696e34d29 Python 3 port:
Goffi <goffi@goffi.org>
parents: 2892
diff changeset
185 return str(self.db_core_iface.asyncGetParamA(name, category, attribute, security_limit, profile_key, timeout=const_TIMEOUT, reply_handler=callback, error_handler=error_handler))
413
dd4caab17008 core: - individual parameters managed through sqlite
Goffi <goffi@goffi.org>
parents: 405
diff changeset
186
1587
698d6755d62a core, bridge (params): added asyncGetParamsValuesFromCategory (yes that's a long name!) method to retrive params names and values for a given category
Goffi <goffi@goffi.org>
parents: 1586
diff changeset
187 def asyncGetParamsValuesFromCategory(self, category, security_limit=-1, profile_key="@DEFAULT@", callback=None, errback=None):
698d6755d62a core, bridge (params): added asyncGetParamsValuesFromCategory (yes that's a long name!) method to retrive params names and values for a given category
Goffi <goffi@goffi.org>
parents: 1586
diff changeset
188 if callback is None:
698d6755d62a core, bridge (params): added asyncGetParamsValuesFromCategory (yes that's a long name!) method to retrive params names and values for a given category
Goffi <goffi@goffi.org>
parents: 1586
diff changeset
189 error_handler = None
698d6755d62a core, bridge (params): added asyncGetParamsValuesFromCategory (yes that's a long name!) method to retrive params names and values for a given category
Goffi <goffi@goffi.org>
parents: 1586
diff changeset
190 else:
698d6755d62a core, bridge (params): added asyncGetParamsValuesFromCategory (yes that's a long name!) method to retrive params names and values for a given category
Goffi <goffi@goffi.org>
parents: 1586
diff changeset
191 if errback is None:
698d6755d62a core, bridge (params): added asyncGetParamsValuesFromCategory (yes that's a long name!) method to retrive params names and values for a given category
Goffi <goffi@goffi.org>
parents: 1586
diff changeset
192 errback = log.error
698d6755d62a core, bridge (params): added asyncGetParamsValuesFromCategory (yes that's a long name!) method to retrive params names and values for a given category
Goffi <goffi@goffi.org>
parents: 1586
diff changeset
193 error_handler = lambda err:errback(dbus_to_bridge_exception(err))
698d6755d62a core, bridge (params): added asyncGetParamsValuesFromCategory (yes that's a long name!) method to retrive params names and values for a given category
Goffi <goffi@goffi.org>
parents: 1586
diff changeset
194 return self.db_core_iface.asyncGetParamsValuesFromCategory(category, security_limit, profile_key, timeout=const_TIMEOUT, reply_handler=callback, error_handler=error_handler)
698d6755d62a core, bridge (params): added asyncGetParamsValuesFromCategory (yes that's a long name!) method to retrive params names and values for a given category
Goffi <goffi@goffi.org>
parents: 1586
diff changeset
195
2142
be96beb7ca14 core, bridge, frontends: renamed asyncConnect to connect, and added options parameters (not used yet)
Goffi <goffi@goffi.org>
parents: 2126
diff changeset
196 def connect(self, profile_key="@DEFAULT@", password='', options={}, callback=None, errback=None):
be96beb7ca14 core, bridge, frontends: renamed asyncConnect to connect, and added options parameters (not used yet)
Goffi <goffi@goffi.org>
parents: 2126
diff changeset
197 if callback is None:
be96beb7ca14 core, bridge, frontends: renamed asyncConnect to connect, and added options parameters (not used yet)
Goffi <goffi@goffi.org>
parents: 2126
diff changeset
198 error_handler = None
be96beb7ca14 core, bridge, frontends: renamed asyncConnect to connect, and added options parameters (not used yet)
Goffi <goffi@goffi.org>
parents: 2126
diff changeset
199 else:
be96beb7ca14 core, bridge, frontends: renamed asyncConnect to connect, and added options parameters (not used yet)
Goffi <goffi@goffi.org>
parents: 2126
diff changeset
200 if errback is None:
be96beb7ca14 core, bridge, frontends: renamed asyncConnect to connect, and added options parameters (not used yet)
Goffi <goffi@goffi.org>
parents: 2126
diff changeset
201 errback = log.error
be96beb7ca14 core, bridge, frontends: renamed asyncConnect to connect, and added options parameters (not used yet)
Goffi <goffi@goffi.org>
parents: 2126
diff changeset
202 error_handler = lambda err:errback(dbus_to_bridge_exception(err))
be96beb7ca14 core, bridge, frontends: renamed asyncConnect to connect, and added options parameters (not used yet)
Goffi <goffi@goffi.org>
parents: 2126
diff changeset
203 return self.db_core_iface.connect(profile_key, password, options, timeout=const_TIMEOUT, reply_handler=callback, error_handler=error_handler)
be96beb7ca14 core, bridge, frontends: renamed asyncConnect to connect, and added options parameters (not used yet)
Goffi <goffi@goffi.org>
parents: 2126
diff changeset
204
1265
e3a9ea76de35 quick_frontend, primitivus: multi-profiles refactoring part 1 (big commit, sorry :p):
Goffi <goffi@goffi.org>
parents: 1237
diff changeset
205 def delContact(self, entity_jid, profile_key="@DEFAULT@", callback=None, errback=None):
1290
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
206 if callback is None:
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
207 error_handler = None
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
208 else:
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
209 if errback is None:
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
210 errback = log.error
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
211 error_handler = lambda err:errback(dbus_to_bridge_exception(err))
1265
e3a9ea76de35 quick_frontend, primitivus: multi-profiles refactoring part 1 (big commit, sorry :p):
Goffi <goffi@goffi.org>
parents: 1237
diff changeset
212 return self.db_core_iface.delContact(entity_jid, profile_key, timeout=const_TIMEOUT, reply_handler=callback, error_handler=error_handler)
272
1d2e0dfe7114 bridge: core & frontend sides of bridge are now generated
Goffi <goffi@goffi.org>
parents: 267
diff changeset
213
3028
ab2696e34d29 Python 3 port:
Goffi <goffi@goffi.org>
parents: 2892
diff changeset
214 def discoFindByFeatures(self, namespaces, identities, bare_jid=False, service=True, roster=True, own_jid=True, local_device=False, profile_key="@DEFAULT@", callback=None, errback=None):
2534
7da86e1633a5 core: new discoFindFeatures method which return all server services/roster entities implementing a set of features.
Goffi <goffi@goffi.org>
parents: 2483
diff changeset
215 if callback is None:
7da86e1633a5 core: new discoFindFeatures method which return all server services/roster entities implementing a set of features.
Goffi <goffi@goffi.org>
parents: 2483
diff changeset
216 error_handler = None
7da86e1633a5 core: new discoFindFeatures method which return all server services/roster entities implementing a set of features.
Goffi <goffi@goffi.org>
parents: 2483
diff changeset
217 else:
7da86e1633a5 core: new discoFindFeatures method which return all server services/roster entities implementing a set of features.
Goffi <goffi@goffi.org>
parents: 2483
diff changeset
218 if errback is None:
7da86e1633a5 core: new discoFindFeatures method which return all server services/roster entities implementing a set of features.
Goffi <goffi@goffi.org>
parents: 2483
diff changeset
219 errback = log.error
7da86e1633a5 core: new discoFindFeatures method which return all server services/roster entities implementing a set of features.
Goffi <goffi@goffi.org>
parents: 2483
diff changeset
220 error_handler = lambda err:errback(dbus_to_bridge_exception(err))
2595
973d4551ffae core: added local_device argument to discoFindByFeatures
Goffi <goffi@goffi.org>
parents: 2562
diff changeset
221 return self.db_core_iface.discoFindByFeatures(namespaces, identities, bare_jid, service, roster, own_jid, local_device, profile_key, timeout=const_TIMEOUT, reply_handler=callback, error_handler=error_handler)
2534
7da86e1633a5 core: new discoFindFeatures method which return all server services/roster entities implementing a set of features.
Goffi <goffi@goffi.org>
parents: 2483
diff changeset
222
3039
a1bc34f90fa5 bridge (pb): implemented an asyncio compatible bridge:
Goffi <goffi@goffi.org>
parents: 3028
diff changeset
223 def discoInfos(self, entity_jid, node=u'', use_cache=True, profile_key="@DEFAULT@", callback=None, errback=None):
1290
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
224 if callback is None:
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
225 error_handler = None
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
226 else:
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
227 if errback is None:
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
228 errback = log.error
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
229 error_handler = lambda err:errback(dbus_to_bridge_exception(err))
2342
f047d5410040 core (memory/disco): added use_cache parameter to discoInfos/discoItems (set to False to ignore cache)
Goffi <goffi@goffi.org>
parents: 2168
diff changeset
230 return self.db_core_iface.discoInfos(entity_jid, node, use_cache, profile_key, timeout=const_TIMEOUT, reply_handler=callback, error_handler=error_handler)
963
723f28cd15c7 core (disco): added discoInfos and discoItems bridge methods
Goffi <goffi@goffi.org>
parents: 943
diff changeset
231
3039
a1bc34f90fa5 bridge (pb): implemented an asyncio compatible bridge:
Goffi <goffi@goffi.org>
parents: 3028
diff changeset
232 def discoItems(self, entity_jid, node=u'', use_cache=True, profile_key="@DEFAULT@", callback=None, errback=None):
1290
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
233 if callback is None:
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
234 error_handler = None
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
235 else:
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
236 if errback is None:
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
237 errback = log.error
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
238 error_handler = lambda err:errback(dbus_to_bridge_exception(err))
2342
f047d5410040 core (memory/disco): added use_cache parameter to discoInfos/discoItems (set to False to ignore cache)
Goffi <goffi@goffi.org>
parents: 2168
diff changeset
239 return self.db_core_iface.discoItems(entity_jid, node, use_cache, profile_key, timeout=const_TIMEOUT, reply_handler=callback, error_handler=error_handler)
963
723f28cd15c7 core (disco): added discoInfos and discoItems bridge methods
Goffi <goffi@goffi.org>
parents: 943
diff changeset
240
1290
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
241 def disconnect(self, profile_key="@DEFAULT@", callback=None, errback=None):
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
242 if callback is None:
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
243 error_handler = None
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
244 else:
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
245 if errback is None:
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
246 errback = log.error
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
247 error_handler = lambda err:errback(dbus_to_bridge_exception(err))
2144
1d3f73e065e1 core, jp: component handling + client handling refactoring:
Goffi <goffi@goffi.org>
parents: 2142
diff changeset
248 return self.db_core_iface.disconnect(profile_key, timeout=const_TIMEOUT, reply_handler=callback, error_handler=error_handler)
272
1d2e0dfe7114 bridge: core & frontend sides of bridge are now generated
Goffi <goffi@goffi.org>
parents: 267
diff changeset
249
2733
e347e32aa07f core (memory/encryption): new encryptionNamespaceGet and encryptionTrustUIGet methods:
Goffi <goffi@goffi.org>
parents: 2658
diff changeset
250 def encryptionNamespaceGet(self, arg_0, callback=None, errback=None):
e347e32aa07f core (memory/encryption): new encryptionNamespaceGet and encryptionTrustUIGet methods:
Goffi <goffi@goffi.org>
parents: 2658
diff changeset
251 if callback is None:
e347e32aa07f core (memory/encryption): new encryptionNamespaceGet and encryptionTrustUIGet methods:
Goffi <goffi@goffi.org>
parents: 2658
diff changeset
252 error_handler = None
e347e32aa07f core (memory/encryption): new encryptionNamespaceGet and encryptionTrustUIGet methods:
Goffi <goffi@goffi.org>
parents: 2658
diff changeset
253 else:
e347e32aa07f core (memory/encryption): new encryptionNamespaceGet and encryptionTrustUIGet methods:
Goffi <goffi@goffi.org>
parents: 2658
diff changeset
254 if errback is None:
e347e32aa07f core (memory/encryption): new encryptionNamespaceGet and encryptionTrustUIGet methods:
Goffi <goffi@goffi.org>
parents: 2658
diff changeset
255 errback = log.error
e347e32aa07f core (memory/encryption): new encryptionNamespaceGet and encryptionTrustUIGet methods:
Goffi <goffi@goffi.org>
parents: 2658
diff changeset
256 error_handler = lambda err:errback(dbus_to_bridge_exception(err))
e347e32aa07f core (memory/encryption): new encryptionNamespaceGet and encryptionTrustUIGet methods:
Goffi <goffi@goffi.org>
parents: 2658
diff changeset
257 kwargs={}
e347e32aa07f core (memory/encryption): new encryptionNamespaceGet and encryptionTrustUIGet methods:
Goffi <goffi@goffi.org>
parents: 2658
diff changeset
258 if callback is not None:
e347e32aa07f core (memory/encryption): new encryptionNamespaceGet and encryptionTrustUIGet methods:
Goffi <goffi@goffi.org>
parents: 2658
diff changeset
259 kwargs['timeout'] = const_TIMEOUT
e347e32aa07f core (memory/encryption): new encryptionNamespaceGet and encryptionTrustUIGet methods:
Goffi <goffi@goffi.org>
parents: 2658
diff changeset
260 kwargs['reply_handler'] = callback
e347e32aa07f core (memory/encryption): new encryptionNamespaceGet and encryptionTrustUIGet methods:
Goffi <goffi@goffi.org>
parents: 2658
diff changeset
261 kwargs['error_handler'] = error_handler
3028
ab2696e34d29 Python 3 port:
Goffi <goffi@goffi.org>
parents: 2892
diff changeset
262 return str(self.db_core_iface.encryptionNamespaceGet(arg_0, **kwargs))
2733
e347e32aa07f core (memory/encryption): new encryptionNamespaceGet and encryptionTrustUIGet methods:
Goffi <goffi@goffi.org>
parents: 2658
diff changeset
263
2658
4e130cc9bfc0 core (memore/encryption): new methods and checks:
Goffi <goffi@goffi.org>
parents: 2646
diff changeset
264 def encryptionPluginsGet(self, callback=None, errback=None):
4e130cc9bfc0 core (memore/encryption): new methods and checks:
Goffi <goffi@goffi.org>
parents: 2646
diff changeset
265 if callback is None:
4e130cc9bfc0 core (memore/encryption): new methods and checks:
Goffi <goffi@goffi.org>
parents: 2646
diff changeset
266 error_handler = None
4e130cc9bfc0 core (memore/encryption): new methods and checks:
Goffi <goffi@goffi.org>
parents: 2646
diff changeset
267 else:
4e130cc9bfc0 core (memore/encryption): new methods and checks:
Goffi <goffi@goffi.org>
parents: 2646
diff changeset
268 if errback is None:
4e130cc9bfc0 core (memore/encryption): new methods and checks:
Goffi <goffi@goffi.org>
parents: 2646
diff changeset
269 errback = log.error
4e130cc9bfc0 core (memore/encryption): new methods and checks:
Goffi <goffi@goffi.org>
parents: 2646
diff changeset
270 error_handler = lambda err:errback(dbus_to_bridge_exception(err))
4e130cc9bfc0 core (memore/encryption): new methods and checks:
Goffi <goffi@goffi.org>
parents: 2646
diff changeset
271 kwargs={}
4e130cc9bfc0 core (memore/encryption): new methods and checks:
Goffi <goffi@goffi.org>
parents: 2646
diff changeset
272 if callback is not None:
4e130cc9bfc0 core (memore/encryption): new methods and checks:
Goffi <goffi@goffi.org>
parents: 2646
diff changeset
273 kwargs['timeout'] = const_TIMEOUT
4e130cc9bfc0 core (memore/encryption): new methods and checks:
Goffi <goffi@goffi.org>
parents: 2646
diff changeset
274 kwargs['reply_handler'] = callback
4e130cc9bfc0 core (memore/encryption): new methods and checks:
Goffi <goffi@goffi.org>
parents: 2646
diff changeset
275 kwargs['error_handler'] = error_handler
4e130cc9bfc0 core (memore/encryption): new methods and checks:
Goffi <goffi@goffi.org>
parents: 2646
diff changeset
276 return self.db_core_iface.encryptionPluginsGet(**kwargs)
4e130cc9bfc0 core (memore/encryption): new methods and checks:
Goffi <goffi@goffi.org>
parents: 2646
diff changeset
277
3028
ab2696e34d29 Python 3 port:
Goffi <goffi@goffi.org>
parents: 2892
diff changeset
278 def encryptionTrustUIGet(self, to_jid, namespace, profile_key, callback=None, errback=None):
2733
e347e32aa07f core (memory/encryption): new encryptionNamespaceGet and encryptionTrustUIGet methods:
Goffi <goffi@goffi.org>
parents: 2658
diff changeset
279 if callback is None:
e347e32aa07f core (memory/encryption): new encryptionNamespaceGet and encryptionTrustUIGet methods:
Goffi <goffi@goffi.org>
parents: 2658
diff changeset
280 error_handler = None
e347e32aa07f core (memory/encryption): new encryptionNamespaceGet and encryptionTrustUIGet methods:
Goffi <goffi@goffi.org>
parents: 2658
diff changeset
281 else:
e347e32aa07f core (memory/encryption): new encryptionNamespaceGet and encryptionTrustUIGet methods:
Goffi <goffi@goffi.org>
parents: 2658
diff changeset
282 if errback is None:
e347e32aa07f core (memory/encryption): new encryptionNamespaceGet and encryptionTrustUIGet methods:
Goffi <goffi@goffi.org>
parents: 2658
diff changeset
283 errback = log.error
e347e32aa07f core (memory/encryption): new encryptionNamespaceGet and encryptionTrustUIGet methods:
Goffi <goffi@goffi.org>
parents: 2658
diff changeset
284 error_handler = lambda err:errback(dbus_to_bridge_exception(err))
3028
ab2696e34d29 Python 3 port:
Goffi <goffi@goffi.org>
parents: 2892
diff changeset
285 return str(self.db_core_iface.encryptionTrustUIGet(to_jid, namespace, profile_key, timeout=const_TIMEOUT, reply_handler=callback, error_handler=error_handler))
2733
e347e32aa07f core (memory/encryption): new encryptionNamespaceGet and encryptionTrustUIGet methods:
Goffi <goffi@goffi.org>
parents: 2658
diff changeset
286
1290
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
287 def getConfig(self, section, name, callback=None, errback=None):
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
288 if callback is None:
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
289 error_handler = None
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
290 else:
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
291 if errback is None:
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
292 errback = log.error
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
293 error_handler = lambda err:errback(dbus_to_bridge_exception(err))
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
294 kwargs={}
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
295 if callback is not None:
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
296 kwargs['timeout'] = const_TIMEOUT
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
297 kwargs['reply_handler'] = callback
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
298 kwargs['error_handler'] = error_handler
3028
ab2696e34d29 Python 3 port:
Goffi <goffi@goffi.org>
parents: 2892
diff changeset
299 return str(self.db_core_iface.getConfig(section, name, **kwargs))
364
312ca6f9d84a core: configuration file
Goffi <goffi@goffi.org>
parents: 362
diff changeset
300
1265
e3a9ea76de35 quick_frontend, primitivus: multi-profiles refactoring part 1 (big commit, sorry :p):
Goffi <goffi@goffi.org>
parents: 1237
diff changeset
301 def getContacts(self, profile_key="@DEFAULT@", callback=None, errback=None):
1290
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
302 if callback is None:
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
303 error_handler = None
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
304 else:
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
305 if errback is None:
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
306 errback = log.error
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
307 error_handler = lambda err:errback(dbus_to_bridge_exception(err))
1265
e3a9ea76de35 quick_frontend, primitivus: multi-profiles refactoring part 1 (big commit, sorry :p):
Goffi <goffi@goffi.org>
parents: 1237
diff changeset
308 return self.db_core_iface.getContacts(profile_key, timeout=const_TIMEOUT, reply_handler=callback, error_handler=error_handler)
272
1d2e0dfe7114 bridge: core & frontend sides of bridge are now generated
Goffi <goffi@goffi.org>
parents: 267
diff changeset
309
1290
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
310 def getContactsFromGroup(self, group, profile_key="@DEFAULT@", callback=None, errback=None):
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
311 if callback is None:
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
312 error_handler = None
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
313 else:
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
314 if errback is None:
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
315 errback = log.error
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
316 error_handler = lambda err:errback(dbus_to_bridge_exception(err))
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
317 kwargs={}
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
318 if callback is not None:
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
319 kwargs['timeout'] = const_TIMEOUT
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
320 kwargs['reply_handler'] = callback
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
321 kwargs['error_handler'] = error_handler
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
322 return self.db_core_iface.getContactsFromGroup(group, profile_key, **kwargs)
501
e9634d2e7b38 core, quick_frontend, primitivus, wix: Contacts List refactoring phase 1:
Goffi <goffi@goffi.org>
parents: 492
diff changeset
323
1314
bb9c32249778 core: added getEntitiesData which get cache data for several entities at once
Goffi <goffi@goffi.org>
parents: 1290
diff changeset
324 def getEntitiesData(self, jids, keys, profile, callback=None, errback=None):
bb9c32249778 core: added getEntitiesData which get cache data for several entities at once
Goffi <goffi@goffi.org>
parents: 1290
diff changeset
325 if callback is None:
bb9c32249778 core: added getEntitiesData which get cache data for several entities at once
Goffi <goffi@goffi.org>
parents: 1290
diff changeset
326 error_handler = None
bb9c32249778 core: added getEntitiesData which get cache data for several entities at once
Goffi <goffi@goffi.org>
parents: 1290
diff changeset
327 else:
bb9c32249778 core: added getEntitiesData which get cache data for several entities at once
Goffi <goffi@goffi.org>
parents: 1290
diff changeset
328 if errback is None:
bb9c32249778 core: added getEntitiesData which get cache data for several entities at once
Goffi <goffi@goffi.org>
parents: 1290
diff changeset
329 errback = log.error
bb9c32249778 core: added getEntitiesData which get cache data for several entities at once
Goffi <goffi@goffi.org>
parents: 1290
diff changeset
330 error_handler = lambda err:errback(dbus_to_bridge_exception(err))
bb9c32249778 core: added getEntitiesData which get cache data for several entities at once
Goffi <goffi@goffi.org>
parents: 1290
diff changeset
331 kwargs={}
bb9c32249778 core: added getEntitiesData which get cache data for several entities at once
Goffi <goffi@goffi.org>
parents: 1290
diff changeset
332 if callback is not None:
bb9c32249778 core: added getEntitiesData which get cache data for several entities at once
Goffi <goffi@goffi.org>
parents: 1290
diff changeset
333 kwargs['timeout'] = const_TIMEOUT
bb9c32249778 core: added getEntitiesData which get cache data for several entities at once
Goffi <goffi@goffi.org>
parents: 1290
diff changeset
334 kwargs['reply_handler'] = callback
bb9c32249778 core: added getEntitiesData which get cache data for several entities at once
Goffi <goffi@goffi.org>
parents: 1290
diff changeset
335 kwargs['error_handler'] = error_handler
bb9c32249778 core: added getEntitiesData which get cache data for several entities at once
Goffi <goffi@goffi.org>
parents: 1290
diff changeset
336 return self.db_core_iface.getEntitiesData(jids, keys, profile, **kwargs)
bb9c32249778 core: added getEntitiesData which get cache data for several entities at once
Goffi <goffi@goffi.org>
parents: 1290
diff changeset
337
1290
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
338 def getEntityData(self, jid, keys, profile, callback=None, errback=None):
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
339 if callback is None:
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
340 error_handler = None
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
341 else:
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
342 if errback is None:
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
343 errback = log.error
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
344 error_handler = lambda err:errback(dbus_to_bridge_exception(err))
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
345 kwargs={}
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
346 if callback is not None:
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
347 kwargs['timeout'] = const_TIMEOUT
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
348 kwargs['reply_handler'] = callback
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
349 kwargs['error_handler'] = error_handler
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
350 return self.db_core_iface.getEntityData(jid, keys, profile, **kwargs)
504
65ecbb473cbb core, quick frontend, plugin xep-0054, bridge: use of memory's entities data for vcard:
Goffi <goffi@goffi.org>
parents: 501
diff changeset
351
1482
80cd55dd5b04 core, bridge: added getFeatures method:
Goffi <goffi@goffi.org>
parents: 1396
diff changeset
352 def getFeatures(self, profile_key, callback=None, errback=None):
80cd55dd5b04 core, bridge: added getFeatures method:
Goffi <goffi@goffi.org>
parents: 1396
diff changeset
353 if callback is None:
80cd55dd5b04 core, bridge: added getFeatures method:
Goffi <goffi@goffi.org>
parents: 1396
diff changeset
354 error_handler = None
80cd55dd5b04 core, bridge: added getFeatures method:
Goffi <goffi@goffi.org>
parents: 1396
diff changeset
355 else:
80cd55dd5b04 core, bridge: added getFeatures method:
Goffi <goffi@goffi.org>
parents: 1396
diff changeset
356 if errback is None:
80cd55dd5b04 core, bridge: added getFeatures method:
Goffi <goffi@goffi.org>
parents: 1396
diff changeset
357 errback = log.error
80cd55dd5b04 core, bridge: added getFeatures method:
Goffi <goffi@goffi.org>
parents: 1396
diff changeset
358 error_handler = lambda err:errback(dbus_to_bridge_exception(err))
80cd55dd5b04 core, bridge: added getFeatures method:
Goffi <goffi@goffi.org>
parents: 1396
diff changeset
359 return self.db_core_iface.getFeatures(profile_key, timeout=const_TIMEOUT, reply_handler=callback, error_handler=error_handler)
80cd55dd5b04 core, bridge: added getFeatures method:
Goffi <goffi@goffi.org>
parents: 1396
diff changeset
360
1290
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
361 def getMainResource(self, contact_jid, profile_key="@DEFAULT@", callback=None, errback=None):
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
362 if callback is None:
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
363 error_handler = None
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
364 else:
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
365 if errback is None:
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
366 errback = log.error
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
367 error_handler = lambda err:errback(dbus_to_bridge_exception(err))
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
368 kwargs={}
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
369 if callback is not None:
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
370 kwargs['timeout'] = const_TIMEOUT
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
371 kwargs['reply_handler'] = callback
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
372 kwargs['error_handler'] = error_handler
3028
ab2696e34d29 Python 3 port:
Goffi <goffi@goffi.org>
parents: 2892
diff changeset
373 return str(self.db_core_iface.getMainResource(contact_jid, profile_key, **kwargs))
399
3ed53803b3b3 core: added getLastResource method
Goffi <goffi@goffi.org>
parents: 387
diff changeset
374
1290
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
375 def getParamA(self, name, category, attribute="value", profile_key="@DEFAULT@", callback=None, errback=None):
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
376 if callback is None:
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
377 error_handler = None
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
378 else:
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
379 if errback is None:
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
380 errback = log.error
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
381 error_handler = lambda err:errback(dbus_to_bridge_exception(err))
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
382 kwargs={}
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
383 if callback is not None:
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
384 kwargs['timeout'] = const_TIMEOUT
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
385 kwargs['reply_handler'] = callback
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
386 kwargs['error_handler'] = error_handler
3028
ab2696e34d29 Python 3 port:
Goffi <goffi@goffi.org>
parents: 2892
diff changeset
387 return str(self.db_core_iface.getParamA(name, category, attribute, profile_key, **kwargs))
272
1d2e0dfe7114 bridge: core & frontend sides of bridge are now generated
Goffi <goffi@goffi.org>
parents: 267
diff changeset
388
1290
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
389 def getParamsCategories(self, callback=None, errback=None):
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
390 if callback is None:
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
391 error_handler = None
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
392 else:
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
393 if errback is None:
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
394 errback = log.error
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
395 error_handler = lambda err:errback(dbus_to_bridge_exception(err))
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
396 kwargs={}
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
397 if callback is not None:
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
398 kwargs['timeout'] = const_TIMEOUT
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
399 kwargs['reply_handler'] = callback
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
400 kwargs['error_handler'] = error_handler
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
401 return self.db_core_iface.getParamsCategories(**kwargs)
272
1d2e0dfe7114 bridge: core & frontend sides of bridge are now generated
Goffi <goffi@goffi.org>
parents: 267
diff changeset
402
777
5642939d254e core, bridge: new method paramsRegisterApp to register frontend's specific parameters
souliane <souliane@mailoo.org>
parents: 773
diff changeset
403 def getParamsUI(self, security_limit=-1, app='', profile_key="@DEFAULT@", callback=None, errback=None):
1290
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
404 if callback is None:
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
405 error_handler = None
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
406 else:
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
407 if errback is None:
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
408 errback = log.error
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
409 error_handler = lambda err:errback(dbus_to_bridge_exception(err))
3028
ab2696e34d29 Python 3 port:
Goffi <goffi@goffi.org>
parents: 2892
diff changeset
410 return str(self.db_core_iface.getParamsUI(security_limit, app, profile_key, timeout=const_TIMEOUT, reply_handler=callback, error_handler=error_handler))
272
1d2e0dfe7114 bridge: core & frontend sides of bridge are now generated
Goffi <goffi@goffi.org>
parents: 267
diff changeset
411
1290
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
412 def getPresenceStatuses(self, profile_key="@DEFAULT@", callback=None, errback=None):
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
413 if callback is None:
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
414 error_handler = None
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
415 else:
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
416 if errback is None:
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
417 errback = log.error
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
418 error_handler = lambda err:errback(dbus_to_bridge_exception(err))
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
419 kwargs={}
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
420 if callback is not None:
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
421 kwargs['timeout'] = const_TIMEOUT
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
422 kwargs['reply_handler'] = callback
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
423 kwargs['error_handler'] = error_handler
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
424 return self.db_core_iface.getPresenceStatuses(profile_key, **kwargs)
272
1d2e0dfe7114 bridge: core & frontend sides of bridge are now generated
Goffi <goffi@goffi.org>
parents: 267
diff changeset
425
1024
7e43ea75cce8 bridge (constructor): fixed D-Bus frontend generator for async method without sig_in + fixed --debug option + regenerated bridge to fix bad frontend D-Bus bridge.
Goffi <goffi@goffi.org>
parents: 1023
diff changeset
426 def getReady(self, callback=None, errback=None):
1290
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
427 if callback is None:
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
428 error_handler = None
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
429 else:
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
430 if errback is None:
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
431 errback = log.error
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
432 error_handler = lambda err:errback(dbus_to_bridge_exception(err))
1237
c1e916594e09 bridge (frontends side): fixed call of async method in blocking context
Goffi <goffi@goffi.org>
parents: 1224
diff changeset
433 return self.db_core_iface.getReady(timeout=const_TIMEOUT, reply_handler=callback, error_handler=error_handler)
1023
8bae81e254a2 core: added a getReady method which can be called by frontends to ensure that backend is fully initialised before doing anything + this ckeck is automatically done in asyncConnect
Goffi <goffi@goffi.org>
parents: 1015
diff changeset
434
1290
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
435 def getVersion(self, callback=None, errback=None):
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
436 if callback is None:
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
437 error_handler = None
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
438 else:
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
439 if errback is None:
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
440 errback = log.error
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
441 error_handler = lambda err:errback(dbus_to_bridge_exception(err))
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
442 kwargs={}
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
443 if callback is not None:
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
444 kwargs['timeout'] = const_TIMEOUT
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
445 kwargs['reply_handler'] = callback
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
446 kwargs['error_handler'] = error_handler
3028
ab2696e34d29 Python 3 port:
Goffi <goffi@goffi.org>
parents: 2892
diff changeset
447 return str(self.db_core_iface.getVersion(**kwargs))
272
1d2e0dfe7114 bridge: core & frontend sides of bridge are now generated
Goffi <goffi@goffi.org>
parents: 267
diff changeset
448
1290
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
449 def getWaitingSub(self, profile_key="@DEFAULT@", callback=None, errback=None):
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
450 if callback is None:
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
451 error_handler = None
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
452 else:
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
453 if errback is None:
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
454 errback = log.error
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
455 error_handler = lambda err:errback(dbus_to_bridge_exception(err))
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
456 kwargs={}
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
457 if callback is not None:
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
458 kwargs['timeout'] = const_TIMEOUT
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
459 kwargs['reply_handler'] = callback
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
460 kwargs['error_handler'] = error_handler
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
461 return self.db_core_iface.getWaitingSub(profile_key, **kwargs)
272
1d2e0dfe7114 bridge: core & frontend sides of bridge are now generated
Goffi <goffi@goffi.org>
parents: 267
diff changeset
462
2013
b536dd121da1 backend (memory), frontends: improved history filtering:
Goffi <goffi@goffi.org>
parents: 1963
diff changeset
463 def historyGet(self, from_jid, to_jid, limit, between=True, filters='', profile="@NONE@", callback=None, errback=None):
1955
633b5c21aefd backend, frontend: messages refactoring (huge commit, not finished):
Goffi <goffi@goffi.org>
parents: 1934
diff changeset
464 if callback is None:
633b5c21aefd backend, frontend: messages refactoring (huge commit, not finished):
Goffi <goffi@goffi.org>
parents: 1934
diff changeset
465 error_handler = None
633b5c21aefd backend, frontend: messages refactoring (huge commit, not finished):
Goffi <goffi@goffi.org>
parents: 1934
diff changeset
466 else:
633b5c21aefd backend, frontend: messages refactoring (huge commit, not finished):
Goffi <goffi@goffi.org>
parents: 1934
diff changeset
467 if errback is None:
633b5c21aefd backend, frontend: messages refactoring (huge commit, not finished):
Goffi <goffi@goffi.org>
parents: 1934
diff changeset
468 errback = log.error
633b5c21aefd backend, frontend: messages refactoring (huge commit, not finished):
Goffi <goffi@goffi.org>
parents: 1934
diff changeset
469 error_handler = lambda err:errback(dbus_to_bridge_exception(err))
2013
b536dd121da1 backend (memory), frontends: improved history filtering:
Goffi <goffi@goffi.org>
parents: 1963
diff changeset
470 return self.db_core_iface.historyGet(from_jid, to_jid, limit, between, filters, profile, timeout=const_TIMEOUT, reply_handler=callback, error_handler=error_handler)
1955
633b5c21aefd backend, frontend: messages refactoring (huge commit, not finished):
Goffi <goffi@goffi.org>
parents: 1934
diff changeset
471
1290
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
472 def isConnected(self, profile_key="@DEFAULT@", callback=None, errback=None):
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
473 if callback is None:
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
474 error_handler = None
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
475 else:
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
476 if errback is None:
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
477 errback = log.error
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
478 error_handler = lambda err:errback(dbus_to_bridge_exception(err))
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
479 kwargs={}
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
480 if callback is not None:
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
481 kwargs['timeout'] = const_TIMEOUT
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
482 kwargs['reply_handler'] = callback
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
483 kwargs['error_handler'] = error_handler
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
484 return self.db_core_iface.isConnected(profile_key, **kwargs)
272
1d2e0dfe7114 bridge: core & frontend sides of bridge are now generated
Goffi <goffi@goffi.org>
parents: 267
diff changeset
485
759
93bd868b8fb6 backend, frontends: callbacks refactoring:
Goffi <goffi@goffi.org>
parents: 755
diff changeset
486 def launchAction(self, callback_id, data, profile_key="@DEFAULT@", callback=None, errback=None):
1290
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
487 if callback is None:
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
488 error_handler = None
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
489 else:
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
490 if errback is None:
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
491 errback = log.error
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
492 error_handler = lambda err:errback(dbus_to_bridge_exception(err))
1237
c1e916594e09 bridge (frontends side): fixed call of async method in blocking context
Goffi <goffi@goffi.org>
parents: 1224
diff changeset
493 return self.db_core_iface.launchAction(callback_id, data, profile_key, timeout=const_TIMEOUT, reply_handler=callback, error_handler=error_handler)
272
1d2e0dfe7114 bridge: core & frontend sides of bridge are now generated
Goffi <goffi@goffi.org>
parents: 267
diff changeset
494
1290
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
495 def loadParamsTemplate(self, filename, callback=None, errback=None):
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
496 if callback is None:
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
497 error_handler = None
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
498 else:
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
499 if errback is None:
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
500 errback = log.error
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
501 error_handler = lambda err:errback(dbus_to_bridge_exception(err))
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
502 kwargs={}
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
503 if callback is not None:
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
504 kwargs['timeout'] = const_TIMEOUT
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
505 kwargs['reply_handler'] = callback
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
506 kwargs['error_handler'] = error_handler
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
507 return self.db_core_iface.loadParamsTemplate(filename, **kwargs)
1015
fee00f2e11c2 memory, jp: added jp commands to load/save parameters template
souliane <souliane@mailoo.org>
parents: 993
diff changeset
508
2126
2f264f3df280 core (menus): improvments:
Goffi <goffi@goffi.org>
parents: 2113
diff changeset
509 def menuHelpGet(self, menu_id, language, callback=None, errback=None):
2f264f3df280 core (menus): improvments:
Goffi <goffi@goffi.org>
parents: 2113
diff changeset
510 if callback is None:
2f264f3df280 core (menus): improvments:
Goffi <goffi@goffi.org>
parents: 2113
diff changeset
511 error_handler = None
2f264f3df280 core (menus): improvments:
Goffi <goffi@goffi.org>
parents: 2113
diff changeset
512 else:
2f264f3df280 core (menus): improvments:
Goffi <goffi@goffi.org>
parents: 2113
diff changeset
513 if errback is None:
2f264f3df280 core (menus): improvments:
Goffi <goffi@goffi.org>
parents: 2113
diff changeset
514 errback = log.error
2f264f3df280 core (menus): improvments:
Goffi <goffi@goffi.org>
parents: 2113
diff changeset
515 error_handler = lambda err:errback(dbus_to_bridge_exception(err))
2f264f3df280 core (menus): improvments:
Goffi <goffi@goffi.org>
parents: 2113
diff changeset
516 kwargs={}
2f264f3df280 core (menus): improvments:
Goffi <goffi@goffi.org>
parents: 2113
diff changeset
517 if callback is not None:
2f264f3df280 core (menus): improvments:
Goffi <goffi@goffi.org>
parents: 2113
diff changeset
518 kwargs['timeout'] = const_TIMEOUT
2f264f3df280 core (menus): improvments:
Goffi <goffi@goffi.org>
parents: 2113
diff changeset
519 kwargs['reply_handler'] = callback
2f264f3df280 core (menus): improvments:
Goffi <goffi@goffi.org>
parents: 2113
diff changeset
520 kwargs['error_handler'] = error_handler
3028
ab2696e34d29 Python 3 port:
Goffi <goffi@goffi.org>
parents: 2892
diff changeset
521 return str(self.db_core_iface.menuHelpGet(menu_id, language, **kwargs))
2126
2f264f3df280 core (menus): improvments:
Goffi <goffi@goffi.org>
parents: 2113
diff changeset
522
2f264f3df280 core (menus): improvments:
Goffi <goffi@goffi.org>
parents: 2113
diff changeset
523 def menuLaunch(self, menu_type, path, data, security_limit, profile_key, callback=None, errback=None):
2f264f3df280 core (menus): improvments:
Goffi <goffi@goffi.org>
parents: 2113
diff changeset
524 if callback is None:
2f264f3df280 core (menus): improvments:
Goffi <goffi@goffi.org>
parents: 2113
diff changeset
525 error_handler = None
2f264f3df280 core (menus): improvments:
Goffi <goffi@goffi.org>
parents: 2113
diff changeset
526 else:
2f264f3df280 core (menus): improvments:
Goffi <goffi@goffi.org>
parents: 2113
diff changeset
527 if errback is None:
2f264f3df280 core (menus): improvments:
Goffi <goffi@goffi.org>
parents: 2113
diff changeset
528 errback = log.error
2f264f3df280 core (menus): improvments:
Goffi <goffi@goffi.org>
parents: 2113
diff changeset
529 error_handler = lambda err:errback(dbus_to_bridge_exception(err))
2f264f3df280 core (menus): improvments:
Goffi <goffi@goffi.org>
parents: 2113
diff changeset
530 return self.db_core_iface.menuLaunch(menu_type, path, data, security_limit, profile_key, timeout=const_TIMEOUT, reply_handler=callback, error_handler=error_handler)
2f264f3df280 core (menus): improvments:
Goffi <goffi@goffi.org>
parents: 2113
diff changeset
531
2f264f3df280 core (menus): improvments:
Goffi <goffi@goffi.org>
parents: 2113
diff changeset
532 def menusGet(self, language, security_limit, callback=None, errback=None):
2f264f3df280 core (menus): improvments:
Goffi <goffi@goffi.org>
parents: 2113
diff changeset
533 if callback is None:
2f264f3df280 core (menus): improvments:
Goffi <goffi@goffi.org>
parents: 2113
diff changeset
534 error_handler = None
2f264f3df280 core (menus): improvments:
Goffi <goffi@goffi.org>
parents: 2113
diff changeset
535 else:
2f264f3df280 core (menus): improvments:
Goffi <goffi@goffi.org>
parents: 2113
diff changeset
536 if errback is None:
2f264f3df280 core (menus): improvments:
Goffi <goffi@goffi.org>
parents: 2113
diff changeset
537 errback = log.error
2f264f3df280 core (menus): improvments:
Goffi <goffi@goffi.org>
parents: 2113
diff changeset
538 error_handler = lambda err:errback(dbus_to_bridge_exception(err))
2f264f3df280 core (menus): improvments:
Goffi <goffi@goffi.org>
parents: 2113
diff changeset
539 kwargs={}
2f264f3df280 core (menus): improvments:
Goffi <goffi@goffi.org>
parents: 2113
diff changeset
540 if callback is not None:
2f264f3df280 core (menus): improvments:
Goffi <goffi@goffi.org>
parents: 2113
diff changeset
541 kwargs['timeout'] = const_TIMEOUT
2f264f3df280 core (menus): improvments:
Goffi <goffi@goffi.org>
parents: 2113
diff changeset
542 kwargs['reply_handler'] = callback
2f264f3df280 core (menus): improvments:
Goffi <goffi@goffi.org>
parents: 2113
diff changeset
543 kwargs['error_handler'] = error_handler
2f264f3df280 core (menus): improvments:
Goffi <goffi@goffi.org>
parents: 2113
diff changeset
544 return self.db_core_iface.menusGet(language, security_limit, **kwargs)
2f264f3df280 core (menus): improvments:
Goffi <goffi@goffi.org>
parents: 2113
diff changeset
545
2658
4e130cc9bfc0 core (memore/encryption): new methods and checks:
Goffi <goffi@goffi.org>
parents: 2646
diff changeset
546 def messageEncryptionGet(self, to_jid, profile_key, callback=None, errback=None):
2646
712cb4ff3e13 core: new EncryptionHandler class which manage encrypted session as a core feature:
Goffi <goffi@goffi.org>
parents: 2628
diff changeset
547 if callback is None:
712cb4ff3e13 core: new EncryptionHandler class which manage encrypted session as a core feature:
Goffi <goffi@goffi.org>
parents: 2628
diff changeset
548 error_handler = None
712cb4ff3e13 core: new EncryptionHandler class which manage encrypted session as a core feature:
Goffi <goffi@goffi.org>
parents: 2628
diff changeset
549 else:
712cb4ff3e13 core: new EncryptionHandler class which manage encrypted session as a core feature:
Goffi <goffi@goffi.org>
parents: 2628
diff changeset
550 if errback is None:
712cb4ff3e13 core: new EncryptionHandler class which manage encrypted session as a core feature:
Goffi <goffi@goffi.org>
parents: 2628
diff changeset
551 errback = log.error
712cb4ff3e13 core: new EncryptionHandler class which manage encrypted session as a core feature:
Goffi <goffi@goffi.org>
parents: 2628
diff changeset
552 error_handler = lambda err:errback(dbus_to_bridge_exception(err))
712cb4ff3e13 core: new EncryptionHandler class which manage encrypted session as a core feature:
Goffi <goffi@goffi.org>
parents: 2628
diff changeset
553 kwargs={}
712cb4ff3e13 core: new EncryptionHandler class which manage encrypted session as a core feature:
Goffi <goffi@goffi.org>
parents: 2628
diff changeset
554 if callback is not None:
712cb4ff3e13 core: new EncryptionHandler class which manage encrypted session as a core feature:
Goffi <goffi@goffi.org>
parents: 2628
diff changeset
555 kwargs['timeout'] = const_TIMEOUT
712cb4ff3e13 core: new EncryptionHandler class which manage encrypted session as a core feature:
Goffi <goffi@goffi.org>
parents: 2628
diff changeset
556 kwargs['reply_handler'] = callback
712cb4ff3e13 core: new EncryptionHandler class which manage encrypted session as a core feature:
Goffi <goffi@goffi.org>
parents: 2628
diff changeset
557 kwargs['error_handler'] = error_handler
3028
ab2696e34d29 Python 3 port:
Goffi <goffi@goffi.org>
parents: 2892
diff changeset
558 return str(self.db_core_iface.messageEncryptionGet(to_jid, profile_key, **kwargs))
2658
4e130cc9bfc0 core (memore/encryption): new methods and checks:
Goffi <goffi@goffi.org>
parents: 2646
diff changeset
559
2733
e347e32aa07f core (memory/encryption): new encryptionNamespaceGet and encryptionTrustUIGet methods:
Goffi <goffi@goffi.org>
parents: 2658
diff changeset
560 def messageEncryptionStart(self, to_jid, namespace='', replace=False, profile_key="@NONE@", callback=None, errback=None):
2658
4e130cc9bfc0 core (memore/encryption): new methods and checks:
Goffi <goffi@goffi.org>
parents: 2646
diff changeset
561 if callback is None:
4e130cc9bfc0 core (memore/encryption): new methods and checks:
Goffi <goffi@goffi.org>
parents: 2646
diff changeset
562 error_handler = None
4e130cc9bfc0 core (memore/encryption): new methods and checks:
Goffi <goffi@goffi.org>
parents: 2646
diff changeset
563 else:
4e130cc9bfc0 core (memore/encryption): new methods and checks:
Goffi <goffi@goffi.org>
parents: 2646
diff changeset
564 if errback is None:
4e130cc9bfc0 core (memore/encryption): new methods and checks:
Goffi <goffi@goffi.org>
parents: 2646
diff changeset
565 errback = log.error
4e130cc9bfc0 core (memore/encryption): new methods and checks:
Goffi <goffi@goffi.org>
parents: 2646
diff changeset
566 error_handler = lambda err:errback(dbus_to_bridge_exception(err))
2743
da59ff099b32 core (memory/encryption), plugin OTR: finished OTR integration in encryption:
Goffi <goffi@goffi.org>
parents: 2733
diff changeset
567 return self.db_core_iface.messageEncryptionStart(to_jid, namespace, replace, profile_key, timeout=const_TIMEOUT, reply_handler=callback, error_handler=error_handler)
2658
4e130cc9bfc0 core (memore/encryption): new methods and checks:
Goffi <goffi@goffi.org>
parents: 2646
diff changeset
568
4e130cc9bfc0 core (memore/encryption): new methods and checks:
Goffi <goffi@goffi.org>
parents: 2646
diff changeset
569 def messageEncryptionStop(self, to_jid, profile_key, callback=None, errback=None):
4e130cc9bfc0 core (memore/encryption): new methods and checks:
Goffi <goffi@goffi.org>
parents: 2646
diff changeset
570 if callback is None:
4e130cc9bfc0 core (memore/encryption): new methods and checks:
Goffi <goffi@goffi.org>
parents: 2646
diff changeset
571 error_handler = None
4e130cc9bfc0 core (memore/encryption): new methods and checks:
Goffi <goffi@goffi.org>
parents: 2646
diff changeset
572 else:
4e130cc9bfc0 core (memore/encryption): new methods and checks:
Goffi <goffi@goffi.org>
parents: 2646
diff changeset
573 if errback is None:
4e130cc9bfc0 core (memore/encryption): new methods and checks:
Goffi <goffi@goffi.org>
parents: 2646
diff changeset
574 errback = log.error
4e130cc9bfc0 core (memore/encryption): new methods and checks:
Goffi <goffi@goffi.org>
parents: 2646
diff changeset
575 error_handler = lambda err:errback(dbus_to_bridge_exception(err))
2743
da59ff099b32 core (memory/encryption), plugin OTR: finished OTR integration in encryption:
Goffi <goffi@goffi.org>
parents: 2733
diff changeset
576 return self.db_core_iface.messageEncryptionStop(to_jid, profile_key, timeout=const_TIMEOUT, reply_handler=callback, error_handler=error_handler)
2646
712cb4ff3e13 core: new EncryptionHandler class which manage encrypted session as a core feature:
Goffi <goffi@goffi.org>
parents: 2628
diff changeset
577
1963
a2bc5089c2eb backend, frontends: message refactoring (huge commit):
Goffi <goffi@goffi.org>
parents: 1955
diff changeset
578 def messageSend(self, to_jid, message, subject={}, mess_type="auto", extra={}, profile_key="@NONE@", callback=None, errback=None):
1955
633b5c21aefd backend, frontend: messages refactoring (huge commit, not finished):
Goffi <goffi@goffi.org>
parents: 1934
diff changeset
579 if callback is None:
633b5c21aefd backend, frontend: messages refactoring (huge commit, not finished):
Goffi <goffi@goffi.org>
parents: 1934
diff changeset
580 error_handler = None
633b5c21aefd backend, frontend: messages refactoring (huge commit, not finished):
Goffi <goffi@goffi.org>
parents: 1934
diff changeset
581 else:
633b5c21aefd backend, frontend: messages refactoring (huge commit, not finished):
Goffi <goffi@goffi.org>
parents: 1934
diff changeset
582 if errback is None:
633b5c21aefd backend, frontend: messages refactoring (huge commit, not finished):
Goffi <goffi@goffi.org>
parents: 1934
diff changeset
583 errback = log.error
633b5c21aefd backend, frontend: messages refactoring (huge commit, not finished):
Goffi <goffi@goffi.org>
parents: 1934
diff changeset
584 error_handler = lambda err:errback(dbus_to_bridge_exception(err))
633b5c21aefd backend, frontend: messages refactoring (huge commit, not finished):
Goffi <goffi@goffi.org>
parents: 1934
diff changeset
585 return self.db_core_iface.messageSend(to_jid, message, subject, mess_type, extra, profile_key, timeout=const_TIMEOUT, reply_handler=callback, error_handler=error_handler)
633b5c21aefd backend, frontend: messages refactoring (huge commit, not finished):
Goffi <goffi@goffi.org>
parents: 1934
diff changeset
586
2443
81a45e7886c9 core: added a mechanism to associate short names to namespaces:
Goffi <goffi@goffi.org>
parents: 2414
diff changeset
587 def namespacesGet(self, callback=None, errback=None):
81a45e7886c9 core: added a mechanism to associate short names to namespaces:
Goffi <goffi@goffi.org>
parents: 2414
diff changeset
588 if callback is None:
81a45e7886c9 core: added a mechanism to associate short names to namespaces:
Goffi <goffi@goffi.org>
parents: 2414
diff changeset
589 error_handler = None
81a45e7886c9 core: added a mechanism to associate short names to namespaces:
Goffi <goffi@goffi.org>
parents: 2414
diff changeset
590 else:
81a45e7886c9 core: added a mechanism to associate short names to namespaces:
Goffi <goffi@goffi.org>
parents: 2414
diff changeset
591 if errback is None:
81a45e7886c9 core: added a mechanism to associate short names to namespaces:
Goffi <goffi@goffi.org>
parents: 2414
diff changeset
592 errback = log.error
81a45e7886c9 core: added a mechanism to associate short names to namespaces:
Goffi <goffi@goffi.org>
parents: 2414
diff changeset
593 error_handler = lambda err:errback(dbus_to_bridge_exception(err))
81a45e7886c9 core: added a mechanism to associate short names to namespaces:
Goffi <goffi@goffi.org>
parents: 2414
diff changeset
594 kwargs={}
81a45e7886c9 core: added a mechanism to associate short names to namespaces:
Goffi <goffi@goffi.org>
parents: 2414
diff changeset
595 if callback is not None:
81a45e7886c9 core: added a mechanism to associate short names to namespaces:
Goffi <goffi@goffi.org>
parents: 2414
diff changeset
596 kwargs['timeout'] = const_TIMEOUT
81a45e7886c9 core: added a mechanism to associate short names to namespaces:
Goffi <goffi@goffi.org>
parents: 2414
diff changeset
597 kwargs['reply_handler'] = callback
81a45e7886c9 core: added a mechanism to associate short names to namespaces:
Goffi <goffi@goffi.org>
parents: 2414
diff changeset
598 kwargs['error_handler'] = error_handler
81a45e7886c9 core: added a mechanism to associate short names to namespaces:
Goffi <goffi@goffi.org>
parents: 2414
diff changeset
599 return self.db_core_iface.namespacesGet(**kwargs)
81a45e7886c9 core: added a mechanism to associate short names to namespaces:
Goffi <goffi@goffi.org>
parents: 2414
diff changeset
600
1290
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
601 def paramsRegisterApp(self, xml, security_limit=-1, app='', callback=None, errback=None):
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
602 if callback is None:
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
603 error_handler = None
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
604 else:
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
605 if errback is None:
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
606 errback = log.error
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
607 error_handler = lambda err:errback(dbus_to_bridge_exception(err))
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
608 kwargs={}
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
609 if callback is not None:
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
610 kwargs['timeout'] = const_TIMEOUT
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
611 kwargs['reply_handler'] = callback
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
612 kwargs['error_handler'] = error_handler
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
613 return self.db_core_iface.paramsRegisterApp(xml, security_limit, app, **kwargs)
777
5642939d254e core, bridge: new method paramsRegisterApp to register frontend's specific parameters
souliane <souliane@mailoo.org>
parents: 773
diff changeset
614
2144
1d3f73e065e1 core, jp: component handling + client handling refactoring:
Goffi <goffi@goffi.org>
parents: 2142
diff changeset
615 def profileCreate(self, profile, password='', component='', callback=None, errback=None):
1d3f73e065e1 core, jp: component handling + client handling refactoring:
Goffi <goffi@goffi.org>
parents: 2142
diff changeset
616 if callback is None:
1d3f73e065e1 core, jp: component handling + client handling refactoring:
Goffi <goffi@goffi.org>
parents: 2142
diff changeset
617 error_handler = None
1d3f73e065e1 core, jp: component handling + client handling refactoring:
Goffi <goffi@goffi.org>
parents: 2142
diff changeset
618 else:
1d3f73e065e1 core, jp: component handling + client handling refactoring:
Goffi <goffi@goffi.org>
parents: 2142
diff changeset
619 if errback is None:
1d3f73e065e1 core, jp: component handling + client handling refactoring:
Goffi <goffi@goffi.org>
parents: 2142
diff changeset
620 errback = log.error
1d3f73e065e1 core, jp: component handling + client handling refactoring:
Goffi <goffi@goffi.org>
parents: 2142
diff changeset
621 error_handler = lambda err:errback(dbus_to_bridge_exception(err))
1d3f73e065e1 core, jp: component handling + client handling refactoring:
Goffi <goffi@goffi.org>
parents: 2142
diff changeset
622 return self.db_core_iface.profileCreate(profile, password, component, timeout=const_TIMEOUT, reply_handler=callback, error_handler=error_handler)
1d3f73e065e1 core, jp: component handling + client handling refactoring:
Goffi <goffi@goffi.org>
parents: 2142
diff changeset
623
1592
d6d655238a93 bridge: new core method profileStartSession to start a session without connecting the profile
Goffi <goffi@goffi.org>
parents: 1587
diff changeset
624 def profileIsSessionStarted(self, profile_key="@DEFAULT@", callback=None, errback=None):
d6d655238a93 bridge: new core method profileStartSession to start a session without connecting the profile
Goffi <goffi@goffi.org>
parents: 1587
diff changeset
625 if callback is None:
d6d655238a93 bridge: new core method profileStartSession to start a session without connecting the profile
Goffi <goffi@goffi.org>
parents: 1587
diff changeset
626 error_handler = None
d6d655238a93 bridge: new core method profileStartSession to start a session without connecting the profile
Goffi <goffi@goffi.org>
parents: 1587
diff changeset
627 else:
d6d655238a93 bridge: new core method profileStartSession to start a session without connecting the profile
Goffi <goffi@goffi.org>
parents: 1587
diff changeset
628 if errback is None:
d6d655238a93 bridge: new core method profileStartSession to start a session without connecting the profile
Goffi <goffi@goffi.org>
parents: 1587
diff changeset
629 errback = log.error
d6d655238a93 bridge: new core method profileStartSession to start a session without connecting the profile
Goffi <goffi@goffi.org>
parents: 1587
diff changeset
630 error_handler = lambda err:errback(dbus_to_bridge_exception(err))
d6d655238a93 bridge: new core method profileStartSession to start a session without connecting the profile
Goffi <goffi@goffi.org>
parents: 1587
diff changeset
631 kwargs={}
d6d655238a93 bridge: new core method profileStartSession to start a session without connecting the profile
Goffi <goffi@goffi.org>
parents: 1587
diff changeset
632 if callback is not None:
d6d655238a93 bridge: new core method profileStartSession to start a session without connecting the profile
Goffi <goffi@goffi.org>
parents: 1587
diff changeset
633 kwargs['timeout'] = const_TIMEOUT
d6d655238a93 bridge: new core method profileStartSession to start a session without connecting the profile
Goffi <goffi@goffi.org>
parents: 1587
diff changeset
634 kwargs['reply_handler'] = callback
d6d655238a93 bridge: new core method profileStartSession to start a session without connecting the profile
Goffi <goffi@goffi.org>
parents: 1587
diff changeset
635 kwargs['error_handler'] = error_handler
d6d655238a93 bridge: new core method profileStartSession to start a session without connecting the profile
Goffi <goffi@goffi.org>
parents: 1587
diff changeset
636 return self.db_core_iface.profileIsSessionStarted(profile_key, **kwargs)
d6d655238a93 bridge: new core method profileStartSession to start a session without connecting the profile
Goffi <goffi@goffi.org>
parents: 1587
diff changeset
637
2168
255830fdb80b core, bridge: renamed getProfileName to profileNameGet according to new conventions
Goffi <goffi@goffi.org>
parents: 2167
diff changeset
638 def profileNameGet(self, profile_key="@DEFAULT@", callback=None, errback=None):
255830fdb80b core, bridge: renamed getProfileName to profileNameGet according to new conventions
Goffi <goffi@goffi.org>
parents: 2167
diff changeset
639 if callback is None:
255830fdb80b core, bridge: renamed getProfileName to profileNameGet according to new conventions
Goffi <goffi@goffi.org>
parents: 2167
diff changeset
640 error_handler = None
255830fdb80b core, bridge: renamed getProfileName to profileNameGet according to new conventions
Goffi <goffi@goffi.org>
parents: 2167
diff changeset
641 else:
255830fdb80b core, bridge: renamed getProfileName to profileNameGet according to new conventions
Goffi <goffi@goffi.org>
parents: 2167
diff changeset
642 if errback is None:
255830fdb80b core, bridge: renamed getProfileName to profileNameGet according to new conventions
Goffi <goffi@goffi.org>
parents: 2167
diff changeset
643 errback = log.error
255830fdb80b core, bridge: renamed getProfileName to profileNameGet according to new conventions
Goffi <goffi@goffi.org>
parents: 2167
diff changeset
644 error_handler = lambda err:errback(dbus_to_bridge_exception(err))
255830fdb80b core, bridge: renamed getProfileName to profileNameGet according to new conventions
Goffi <goffi@goffi.org>
parents: 2167
diff changeset
645 kwargs={}
255830fdb80b core, bridge: renamed getProfileName to profileNameGet according to new conventions
Goffi <goffi@goffi.org>
parents: 2167
diff changeset
646 if callback is not None:
255830fdb80b core, bridge: renamed getProfileName to profileNameGet according to new conventions
Goffi <goffi@goffi.org>
parents: 2167
diff changeset
647 kwargs['timeout'] = const_TIMEOUT
255830fdb80b core, bridge: renamed getProfileName to profileNameGet according to new conventions
Goffi <goffi@goffi.org>
parents: 2167
diff changeset
648 kwargs['reply_handler'] = callback
255830fdb80b core, bridge: renamed getProfileName to profileNameGet according to new conventions
Goffi <goffi@goffi.org>
parents: 2167
diff changeset
649 kwargs['error_handler'] = error_handler
3028
ab2696e34d29 Python 3 port:
Goffi <goffi@goffi.org>
parents: 2892
diff changeset
650 return str(self.db_core_iface.profileNameGet(profile_key, **kwargs))
2168
255830fdb80b core, bridge: renamed getProfileName to profileNameGet according to new conventions
Goffi <goffi@goffi.org>
parents: 2167
diff changeset
651
2083
7999d5299ddc bridge(D-Bus): minotr argument name fix
Goffi <goffi@goffi.org>
parents: 2050
diff changeset
652 def profileSetDefault(self, profile, callback=None, errback=None):
1595
a3d0cfa5b7a6 core, bridge: added a profileSetDefault method
Goffi <goffi@goffi.org>
parents: 1592
diff changeset
653 if callback is None:
a3d0cfa5b7a6 core, bridge: added a profileSetDefault method
Goffi <goffi@goffi.org>
parents: 1592
diff changeset
654 error_handler = None
a3d0cfa5b7a6 core, bridge: added a profileSetDefault method
Goffi <goffi@goffi.org>
parents: 1592
diff changeset
655 else:
a3d0cfa5b7a6 core, bridge: added a profileSetDefault method
Goffi <goffi@goffi.org>
parents: 1592
diff changeset
656 if errback is None:
a3d0cfa5b7a6 core, bridge: added a profileSetDefault method
Goffi <goffi@goffi.org>
parents: 1592
diff changeset
657 errback = log.error
a3d0cfa5b7a6 core, bridge: added a profileSetDefault method
Goffi <goffi@goffi.org>
parents: 1592
diff changeset
658 error_handler = lambda err:errback(dbus_to_bridge_exception(err))
a3d0cfa5b7a6 core, bridge: added a profileSetDefault method
Goffi <goffi@goffi.org>
parents: 1592
diff changeset
659 kwargs={}
a3d0cfa5b7a6 core, bridge: added a profileSetDefault method
Goffi <goffi@goffi.org>
parents: 1592
diff changeset
660 if callback is not None:
a3d0cfa5b7a6 core, bridge: added a profileSetDefault method
Goffi <goffi@goffi.org>
parents: 1592
diff changeset
661 kwargs['timeout'] = const_TIMEOUT
a3d0cfa5b7a6 core, bridge: added a profileSetDefault method
Goffi <goffi@goffi.org>
parents: 1592
diff changeset
662 kwargs['reply_handler'] = callback
a3d0cfa5b7a6 core, bridge: added a profileSetDefault method
Goffi <goffi@goffi.org>
parents: 1592
diff changeset
663 kwargs['error_handler'] = error_handler
2083
7999d5299ddc bridge(D-Bus): minotr argument name fix
Goffi <goffi@goffi.org>
parents: 2050
diff changeset
664 return self.db_core_iface.profileSetDefault(profile, **kwargs)
1595
a3d0cfa5b7a6 core, bridge: added a profileSetDefault method
Goffi <goffi@goffi.org>
parents: 1592
diff changeset
665
1592
d6d655238a93 bridge: new core method profileStartSession to start a session without connecting the profile
Goffi <goffi@goffi.org>
parents: 1587
diff changeset
666 def profileStartSession(self, password='', profile_key="@DEFAULT@", callback=None, errback=None):
d6d655238a93 bridge: new core method profileStartSession to start a session without connecting the profile
Goffi <goffi@goffi.org>
parents: 1587
diff changeset
667 if callback is None:
d6d655238a93 bridge: new core method profileStartSession to start a session without connecting the profile
Goffi <goffi@goffi.org>
parents: 1587
diff changeset
668 error_handler = None
d6d655238a93 bridge: new core method profileStartSession to start a session without connecting the profile
Goffi <goffi@goffi.org>
parents: 1587
diff changeset
669 else:
d6d655238a93 bridge: new core method profileStartSession to start a session without connecting the profile
Goffi <goffi@goffi.org>
parents: 1587
diff changeset
670 if errback is None:
d6d655238a93 bridge: new core method profileStartSession to start a session without connecting the profile
Goffi <goffi@goffi.org>
parents: 1587
diff changeset
671 errback = log.error
d6d655238a93 bridge: new core method profileStartSession to start a session without connecting the profile
Goffi <goffi@goffi.org>
parents: 1587
diff changeset
672 error_handler = lambda err:errback(dbus_to_bridge_exception(err))
d6d655238a93 bridge: new core method profileStartSession to start a session without connecting the profile
Goffi <goffi@goffi.org>
parents: 1587
diff changeset
673 return self.db_core_iface.profileStartSession(password, profile_key, timeout=const_TIMEOUT, reply_handler=callback, error_handler=error_handler)
d6d655238a93 bridge: new core method profileStartSession to start a session without connecting the profile
Goffi <goffi@goffi.org>
parents: 1587
diff changeset
674
2146
1bb9bf1b4150 core, frontends: getProfilesList renamed to profilesGetList + behaviour change:
Goffi <goffi@goffi.org>
parents: 2144
diff changeset
675 def profilesListGet(self, clients=True, components=False, callback=None, errback=None):
1bb9bf1b4150 core, frontends: getProfilesList renamed to profilesGetList + behaviour change:
Goffi <goffi@goffi.org>
parents: 2144
diff changeset
676 if callback is None:
1bb9bf1b4150 core, frontends: getProfilesList renamed to profilesGetList + behaviour change:
Goffi <goffi@goffi.org>
parents: 2144
diff changeset
677 error_handler = None
1bb9bf1b4150 core, frontends: getProfilesList renamed to profilesGetList + behaviour change:
Goffi <goffi@goffi.org>
parents: 2144
diff changeset
678 else:
1bb9bf1b4150 core, frontends: getProfilesList renamed to profilesGetList + behaviour change:
Goffi <goffi@goffi.org>
parents: 2144
diff changeset
679 if errback is None:
1bb9bf1b4150 core, frontends: getProfilesList renamed to profilesGetList + behaviour change:
Goffi <goffi@goffi.org>
parents: 2144
diff changeset
680 errback = log.error
1bb9bf1b4150 core, frontends: getProfilesList renamed to profilesGetList + behaviour change:
Goffi <goffi@goffi.org>
parents: 2144
diff changeset
681 error_handler = lambda err:errback(dbus_to_bridge_exception(err))
1bb9bf1b4150 core, frontends: getProfilesList renamed to profilesGetList + behaviour change:
Goffi <goffi@goffi.org>
parents: 2144
diff changeset
682 kwargs={}
1bb9bf1b4150 core, frontends: getProfilesList renamed to profilesGetList + behaviour change:
Goffi <goffi@goffi.org>
parents: 2144
diff changeset
683 if callback is not None:
1bb9bf1b4150 core, frontends: getProfilesList renamed to profilesGetList + behaviour change:
Goffi <goffi@goffi.org>
parents: 2144
diff changeset
684 kwargs['timeout'] = const_TIMEOUT
1bb9bf1b4150 core, frontends: getProfilesList renamed to profilesGetList + behaviour change:
Goffi <goffi@goffi.org>
parents: 2144
diff changeset
685 kwargs['reply_handler'] = callback
1bb9bf1b4150 core, frontends: getProfilesList renamed to profilesGetList + behaviour change:
Goffi <goffi@goffi.org>
parents: 2144
diff changeset
686 kwargs['error_handler'] = error_handler
1bb9bf1b4150 core, frontends: getProfilesList renamed to profilesGetList + behaviour change:
Goffi <goffi@goffi.org>
parents: 2144
diff changeset
687 return self.db_core_iface.profilesListGet(clients, components, **kwargs)
1bb9bf1b4150 core, frontends: getProfilesList renamed to profilesGetList + behaviour change:
Goffi <goffi@goffi.org>
parents: 2144
diff changeset
688
1522
7d7e57a84792 core: progression handling improvments:
Goffi <goffi@goffi.org>
parents: 1482
diff changeset
689 def progressGet(self, id, profile, callback=None, errback=None):
7d7e57a84792 core: progression handling improvments:
Goffi <goffi@goffi.org>
parents: 1482
diff changeset
690 if callback is None:
7d7e57a84792 core: progression handling improvments:
Goffi <goffi@goffi.org>
parents: 1482
diff changeset
691 error_handler = None
7d7e57a84792 core: progression handling improvments:
Goffi <goffi@goffi.org>
parents: 1482
diff changeset
692 else:
7d7e57a84792 core: progression handling improvments:
Goffi <goffi@goffi.org>
parents: 1482
diff changeset
693 if errback is None:
7d7e57a84792 core: progression handling improvments:
Goffi <goffi@goffi.org>
parents: 1482
diff changeset
694 errback = log.error
7d7e57a84792 core: progression handling improvments:
Goffi <goffi@goffi.org>
parents: 1482
diff changeset
695 error_handler = lambda err:errback(dbus_to_bridge_exception(err))
7d7e57a84792 core: progression handling improvments:
Goffi <goffi@goffi.org>
parents: 1482
diff changeset
696 kwargs={}
7d7e57a84792 core: progression handling improvments:
Goffi <goffi@goffi.org>
parents: 1482
diff changeset
697 if callback is not None:
7d7e57a84792 core: progression handling improvments:
Goffi <goffi@goffi.org>
parents: 1482
diff changeset
698 kwargs['timeout'] = const_TIMEOUT
7d7e57a84792 core: progression handling improvments:
Goffi <goffi@goffi.org>
parents: 1482
diff changeset
699 kwargs['reply_handler'] = callback
7d7e57a84792 core: progression handling improvments:
Goffi <goffi@goffi.org>
parents: 1482
diff changeset
700 kwargs['error_handler'] = error_handler
7d7e57a84792 core: progression handling improvments:
Goffi <goffi@goffi.org>
parents: 1482
diff changeset
701 return self.db_core_iface.progressGet(id, profile, **kwargs)
7d7e57a84792 core: progression handling improvments:
Goffi <goffi@goffi.org>
parents: 1482
diff changeset
702
7d7e57a84792 core: progression handling improvments:
Goffi <goffi@goffi.org>
parents: 1482
diff changeset
703 def progressGetAll(self, profile, callback=None, errback=None):
7d7e57a84792 core: progression handling improvments:
Goffi <goffi@goffi.org>
parents: 1482
diff changeset
704 if callback is None:
7d7e57a84792 core: progression handling improvments:
Goffi <goffi@goffi.org>
parents: 1482
diff changeset
705 error_handler = None
7d7e57a84792 core: progression handling improvments:
Goffi <goffi@goffi.org>
parents: 1482
diff changeset
706 else:
7d7e57a84792 core: progression handling improvments:
Goffi <goffi@goffi.org>
parents: 1482
diff changeset
707 if errback is None:
7d7e57a84792 core: progression handling improvments:
Goffi <goffi@goffi.org>
parents: 1482
diff changeset
708 errback = log.error
7d7e57a84792 core: progression handling improvments:
Goffi <goffi@goffi.org>
parents: 1482
diff changeset
709 error_handler = lambda err:errback(dbus_to_bridge_exception(err))
7d7e57a84792 core: progression handling improvments:
Goffi <goffi@goffi.org>
parents: 1482
diff changeset
710 kwargs={}
7d7e57a84792 core: progression handling improvments:
Goffi <goffi@goffi.org>
parents: 1482
diff changeset
711 if callback is not None:
7d7e57a84792 core: progression handling improvments:
Goffi <goffi@goffi.org>
parents: 1482
diff changeset
712 kwargs['timeout'] = const_TIMEOUT
7d7e57a84792 core: progression handling improvments:
Goffi <goffi@goffi.org>
parents: 1482
diff changeset
713 kwargs['reply_handler'] = callback
7d7e57a84792 core: progression handling improvments:
Goffi <goffi@goffi.org>
parents: 1482
diff changeset
714 kwargs['error_handler'] = error_handler
7d7e57a84792 core: progression handling improvments:
Goffi <goffi@goffi.org>
parents: 1482
diff changeset
715 return self.db_core_iface.progressGetAll(profile, **kwargs)
7d7e57a84792 core: progression handling improvments:
Goffi <goffi@goffi.org>
parents: 1482
diff changeset
716
1626
63cef4dbf2a4 core, plugins file, XEP-0234, bridge: progression api enhancement:
Goffi <goffi@goffi.org>
parents: 1622
diff changeset
717 def progressGetAllMetadata(self, profile, callback=None, errback=None):
63cef4dbf2a4 core, plugins file, XEP-0234, bridge: progression api enhancement:
Goffi <goffi@goffi.org>
parents: 1622
diff changeset
718 if callback is None:
63cef4dbf2a4 core, plugins file, XEP-0234, bridge: progression api enhancement:
Goffi <goffi@goffi.org>
parents: 1622
diff changeset
719 error_handler = None
63cef4dbf2a4 core, plugins file, XEP-0234, bridge: progression api enhancement:
Goffi <goffi@goffi.org>
parents: 1622
diff changeset
720 else:
63cef4dbf2a4 core, plugins file, XEP-0234, bridge: progression api enhancement:
Goffi <goffi@goffi.org>
parents: 1622
diff changeset
721 if errback is None:
63cef4dbf2a4 core, plugins file, XEP-0234, bridge: progression api enhancement:
Goffi <goffi@goffi.org>
parents: 1622
diff changeset
722 errback = log.error
63cef4dbf2a4 core, plugins file, XEP-0234, bridge: progression api enhancement:
Goffi <goffi@goffi.org>
parents: 1622
diff changeset
723 error_handler = lambda err:errback(dbus_to_bridge_exception(err))
63cef4dbf2a4 core, plugins file, XEP-0234, bridge: progression api enhancement:
Goffi <goffi@goffi.org>
parents: 1622
diff changeset
724 kwargs={}
63cef4dbf2a4 core, plugins file, XEP-0234, bridge: progression api enhancement:
Goffi <goffi@goffi.org>
parents: 1622
diff changeset
725 if callback is not None:
63cef4dbf2a4 core, plugins file, XEP-0234, bridge: progression api enhancement:
Goffi <goffi@goffi.org>
parents: 1622
diff changeset
726 kwargs['timeout'] = const_TIMEOUT
63cef4dbf2a4 core, plugins file, XEP-0234, bridge: progression api enhancement:
Goffi <goffi@goffi.org>
parents: 1622
diff changeset
727 kwargs['reply_handler'] = callback
63cef4dbf2a4 core, plugins file, XEP-0234, bridge: progression api enhancement:
Goffi <goffi@goffi.org>
parents: 1622
diff changeset
728 kwargs['error_handler'] = error_handler
63cef4dbf2a4 core, plugins file, XEP-0234, bridge: progression api enhancement:
Goffi <goffi@goffi.org>
parents: 1622
diff changeset
729 return self.db_core_iface.progressGetAllMetadata(profile, **kwargs)
63cef4dbf2a4 core, plugins file, XEP-0234, bridge: progression api enhancement:
Goffi <goffi@goffi.org>
parents: 1622
diff changeset
730
2892
82b781c46841 core: added a rosterResync method to bridge:
Goffi <goffi@goffi.org>
parents: 2771
diff changeset
731 def rosterResync(self, profile_key="@DEFAULT@", callback=None, errback=None):
82b781c46841 core: added a rosterResync method to bridge:
Goffi <goffi@goffi.org>
parents: 2771
diff changeset
732 if callback is None:
82b781c46841 core: added a rosterResync method to bridge:
Goffi <goffi@goffi.org>
parents: 2771
diff changeset
733 error_handler = None
82b781c46841 core: added a rosterResync method to bridge:
Goffi <goffi@goffi.org>
parents: 2771
diff changeset
734 else:
82b781c46841 core: added a rosterResync method to bridge:
Goffi <goffi@goffi.org>
parents: 2771
diff changeset
735 if errback is None:
82b781c46841 core: added a rosterResync method to bridge:
Goffi <goffi@goffi.org>
parents: 2771
diff changeset
736 errback = log.error
82b781c46841 core: added a rosterResync method to bridge:
Goffi <goffi@goffi.org>
parents: 2771
diff changeset
737 error_handler = lambda err:errback(dbus_to_bridge_exception(err))
82b781c46841 core: added a rosterResync method to bridge:
Goffi <goffi@goffi.org>
parents: 2771
diff changeset
738 return self.db_core_iface.rosterResync(profile_key, timeout=const_TIMEOUT, reply_handler=callback, error_handler=error_handler)
82b781c46841 core: added a rosterResync method to bridge:
Goffi <goffi@goffi.org>
parents: 2771
diff changeset
739
1290
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
740 def saveParamsTemplate(self, filename, callback=None, errback=None):
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
741 if callback is None:
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
742 error_handler = None
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
743 else:
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
744 if errback is None:
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
745 errback = log.error
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
746 error_handler = lambda err:errback(dbus_to_bridge_exception(err))
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
747 kwargs={}
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
748 if callback is not None:
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
749 kwargs['timeout'] = const_TIMEOUT
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
750 kwargs['reply_handler'] = callback
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
751 kwargs['error_handler'] = error_handler
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
752 return self.db_core_iface.saveParamsTemplate(filename, **kwargs)
1015
fee00f2e11c2 memory, jp: added jp commands to load/save parameters template
souliane <souliane@mailoo.org>
parents: 993
diff changeset
753
2113
9c861d07b5b6 core: added sessionGetInfos bridge method to retrieve various data on current profile session + client.started keep start time
Goffi <goffi@goffi.org>
parents: 2091
diff changeset
754 def sessionInfosGet(self, profile_key, callback=None, errback=None):
9c861d07b5b6 core: added sessionGetInfos bridge method to retrieve various data on current profile session + client.started keep start time
Goffi <goffi@goffi.org>
parents: 2091
diff changeset
755 if callback is None:
9c861d07b5b6 core: added sessionGetInfos bridge method to retrieve various data on current profile session + client.started keep start time
Goffi <goffi@goffi.org>
parents: 2091
diff changeset
756 error_handler = None
9c861d07b5b6 core: added sessionGetInfos bridge method to retrieve various data on current profile session + client.started keep start time
Goffi <goffi@goffi.org>
parents: 2091
diff changeset
757 else:
9c861d07b5b6 core: added sessionGetInfos bridge method to retrieve various data on current profile session + client.started keep start time
Goffi <goffi@goffi.org>
parents: 2091
diff changeset
758 if errback is None:
9c861d07b5b6 core: added sessionGetInfos bridge method to retrieve various data on current profile session + client.started keep start time
Goffi <goffi@goffi.org>
parents: 2091
diff changeset
759 errback = log.error
9c861d07b5b6 core: added sessionGetInfos bridge method to retrieve various data on current profile session + client.started keep start time
Goffi <goffi@goffi.org>
parents: 2091
diff changeset
760 error_handler = lambda err:errback(dbus_to_bridge_exception(err))
9c861d07b5b6 core: added sessionGetInfos bridge method to retrieve various data on current profile session + client.started keep start time
Goffi <goffi@goffi.org>
parents: 2091
diff changeset
761 return self.db_core_iface.sessionInfosGet(profile_key, timeout=const_TIMEOUT, reply_handler=callback, error_handler=error_handler)
9c861d07b5b6 core: added sessionGetInfos bridge method to retrieve various data on current profile session + client.started keep start time
Goffi <goffi@goffi.org>
parents: 2091
diff changeset
762
1290
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
763 def setParam(self, name, value, category, security_limit=-1, profile_key="@DEFAULT@", callback=None, errback=None):
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
764 if callback is None:
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
765 error_handler = None
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
766 else:
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
767 if errback is None:
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
768 errback = log.error
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
769 error_handler = lambda err:errback(dbus_to_bridge_exception(err))
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
770 kwargs={}
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
771 if callback is not None:
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
772 kwargs['timeout'] = const_TIMEOUT
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
773 kwargs['reply_handler'] = callback
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
774 kwargs['error_handler'] = error_handler
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
775 return self.db_core_iface.setParam(name, value, category, security_limit, profile_key, **kwargs)
272
1d2e0dfe7114 bridge: core & frontend sides of bridge are now generated
Goffi <goffi@goffi.org>
parents: 267
diff changeset
776
1290
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
777 def setPresence(self, to_jid='', show='', statuses={}, profile_key="@DEFAULT@", callback=None, errback=None):
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
778 if callback is None:
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
779 error_handler = None
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
780 else:
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
781 if errback is None:
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
782 errback = log.error
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
783 error_handler = lambda err:errback(dbus_to_bridge_exception(err))
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
784 kwargs={}
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
785 if callback is not None:
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
786 kwargs['timeout'] = const_TIMEOUT
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
787 kwargs['reply_handler'] = callback
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
788 kwargs['error_handler'] = error_handler
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
789 return self.db_core_iface.setPresence(to_jid, show, statuses, profile_key, **kwargs)
272
1d2e0dfe7114 bridge: core & frontend sides of bridge are now generated
Goffi <goffi@goffi.org>
parents: 267
diff changeset
790
1290
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
791 def subscription(self, sub_type, entity, profile_key="@DEFAULT@", callback=None, errback=None):
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
792 if callback is None:
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
793 error_handler = None
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
794 else:
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
795 if errback is None:
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
796 errback = log.error
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
797 error_handler = lambda err:errback(dbus_to_bridge_exception(err))
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
798 kwargs={}
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
799 if callback is not None:
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
800 kwargs['timeout'] = const_TIMEOUT
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
801 kwargs['reply_handler'] = callback
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
802 kwargs['error_handler'] = error_handler
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
803 return self.db_core_iface.subscription(sub_type, entity, profile_key, **kwargs)
272
1d2e0dfe7114 bridge: core & frontend sides of bridge are now generated
Goffi <goffi@goffi.org>
parents: 267
diff changeset
804
1265
e3a9ea76de35 quick_frontend, primitivus: multi-profiles refactoring part 1 (big commit, sorry :p):
Goffi <goffi@goffi.org>
parents: 1237
diff changeset
805 def updateContact(self, entity_jid, name, groups, profile_key="@DEFAULT@", callback=None, errback=None):
1290
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
806 if callback is None:
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
807 error_handler = None
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
808 else:
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
809 if errback is None:
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
810 errback = log.error
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
811 error_handler = lambda err:errback(dbus_to_bridge_exception(err))
1265
e3a9ea76de35 quick_frontend, primitivus: multi-profiles refactoring part 1 (big commit, sorry :p):
Goffi <goffi@goffi.org>
parents: 1237
diff changeset
812 return self.db_core_iface.updateContact(entity_jid, name, groups, profile_key, timeout=const_TIMEOUT, reply_handler=callback, error_handler=error_handler)
3042
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
813
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
814
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
815 class AIOBridge(Bridge):
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
816
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
817 def register_signal(self, functionName, handler, iface="core"):
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
818 loop = asyncio.get_running_loop()
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
819 async_handler = lambda *args: asyncio.run_coroutine_threadsafe(handler(*args), loop)
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
820 return super().register_signal(functionName, async_handler, iface)
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
821
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
822 def __getattribute__(self, name):
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
823 """ usual __getattribute__ if the method exists, else try to find a plugin method """
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
824 try:
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
825 return object.__getattribute__(self, name)
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
826 except AttributeError:
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
827 # The attribute is not found, we try the plugin proxy to find the requested method
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
828 def getPluginMethod(*args, **kwargs):
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
829 loop = asyncio.get_running_loop()
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
830 fut = loop.create_future()
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
831 method = getattr(self.db_plugin_iface, name)
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
832 reply_handler = lambda ret=None: loop.call_soon_threadsafe(
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
833 fut.set_result, ret)
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
834 error_handler = lambda err: loop.call_soon_threadsafe(
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
835 fut.set_exception, dbus_to_bridge_exception(err))
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
836 method(
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
837 *args,
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
838 **kwargs,
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
839 timeout=const_TIMEOUT,
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
840 reply_handler=reply_handler,
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
841 error_handler=error_handler
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
842 )
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
843 return fut
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
844
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
845 return getPluginMethod
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
846
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
847 def bridgeConnect(self):
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
848 loop = asyncio.get_running_loop()
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
849 fut = loop.create_future()
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
850 super().bridgeConnect(
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
851 callback=lambda: loop.call_soon_threadsafe(fut.set_result, None),
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
852 errback=lambda e: loop.call_soon_threadsafe(fut.set_exception, e)
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
853 )
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
854 return fut
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
855
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
856 def actionsGet(self, profile_key="@DEFAULT@"):
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
857 loop = asyncio.get_running_loop()
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
858 fut = loop.create_future()
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
859 reply_handler = lambda ret=None: loop.call_soon_threadsafe(fut.set_result, ret)
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
860 error_handler = lambda err: loop.call_soon_threadsafe(fut.set_exception, dbus_to_bridge_exception(err))
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
861 self.db_core_iface.actionsGet(profile_key, timeout=const_TIMEOUT, reply_handler=reply_handler, error_handler=error_handler)
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
862 return fut
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
863
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
864 def addContact(self, entity_jid, profile_key="@DEFAULT@"):
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
865 loop = asyncio.get_running_loop()
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
866 fut = loop.create_future()
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
867 reply_handler = lambda ret=None: loop.call_soon_threadsafe(fut.set_result, ret)
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
868 error_handler = lambda err: loop.call_soon_threadsafe(fut.set_exception, dbus_to_bridge_exception(err))
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
869 self.db_core_iface.addContact(entity_jid, profile_key, timeout=const_TIMEOUT, reply_handler=reply_handler, error_handler=error_handler)
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
870 return fut
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
871
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
872 def asyncDeleteProfile(self, profile):
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
873 loop = asyncio.get_running_loop()
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
874 fut = loop.create_future()
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
875 reply_handler = lambda ret=None: loop.call_soon_threadsafe(fut.set_result, ret)
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
876 error_handler = lambda err: loop.call_soon_threadsafe(fut.set_exception, dbus_to_bridge_exception(err))
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
877 self.db_core_iface.asyncDeleteProfile(profile, timeout=const_TIMEOUT, reply_handler=reply_handler, error_handler=error_handler)
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
878 return fut
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
879
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
880 def asyncGetParamA(self, name, category, attribute="value", security_limit=-1, profile_key="@DEFAULT@"):
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
881 loop = asyncio.get_running_loop()
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
882 fut = loop.create_future()
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
883 reply_handler = lambda ret=None: loop.call_soon_threadsafe(fut.set_result, ret)
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
884 error_handler = lambda err: loop.call_soon_threadsafe(fut.set_exception, dbus_to_bridge_exception(err))
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
885 self.db_core_iface.asyncGetParamA(name, category, attribute, security_limit, profile_key, timeout=const_TIMEOUT, reply_handler=reply_handler, error_handler=error_handler)
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
886 return fut
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
887
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
888 def asyncGetParamsValuesFromCategory(self, category, security_limit=-1, profile_key="@DEFAULT@"):
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
889 loop = asyncio.get_running_loop()
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
890 fut = loop.create_future()
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
891 reply_handler = lambda ret=None: loop.call_soon_threadsafe(fut.set_result, ret)
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
892 error_handler = lambda err: loop.call_soon_threadsafe(fut.set_exception, dbus_to_bridge_exception(err))
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
893 self.db_core_iface.asyncGetParamsValuesFromCategory(category, security_limit, profile_key, timeout=const_TIMEOUT, reply_handler=reply_handler, error_handler=error_handler)
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
894 return fut
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
895
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
896 def connect(self, profile_key="@DEFAULT@", password='', options={}):
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
897 loop = asyncio.get_running_loop()
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
898 fut = loop.create_future()
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
899 reply_handler = lambda ret=None: loop.call_soon_threadsafe(fut.set_result, ret)
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
900 error_handler = lambda err: loop.call_soon_threadsafe(fut.set_exception, dbus_to_bridge_exception(err))
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
901 self.db_core_iface.connect(profile_key, password, options, timeout=const_TIMEOUT, reply_handler=reply_handler, error_handler=error_handler)
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
902 return fut
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
903
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
904 def delContact(self, entity_jid, profile_key="@DEFAULT@"):
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
905 loop = asyncio.get_running_loop()
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
906 fut = loop.create_future()
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
907 reply_handler = lambda ret=None: loop.call_soon_threadsafe(fut.set_result, ret)
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
908 error_handler = lambda err: loop.call_soon_threadsafe(fut.set_exception, dbus_to_bridge_exception(err))
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
909 self.db_core_iface.delContact(entity_jid, profile_key, timeout=const_TIMEOUT, reply_handler=reply_handler, error_handler=error_handler)
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
910 return fut
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
911
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
912 def discoFindByFeatures(self, namespaces, identities, bare_jid=False, service=True, roster=True, own_jid=True, local_device=False, profile_key="@DEFAULT@"):
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
913 loop = asyncio.get_running_loop()
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
914 fut = loop.create_future()
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
915 reply_handler = lambda ret=None: loop.call_soon_threadsafe(fut.set_result, ret)
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
916 error_handler = lambda err: loop.call_soon_threadsafe(fut.set_exception, dbus_to_bridge_exception(err))
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
917 self.db_core_iface.discoFindByFeatures(namespaces, identities, bare_jid, service, roster, own_jid, local_device, profile_key, timeout=const_TIMEOUT, reply_handler=reply_handler, error_handler=error_handler)
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
918 return fut
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
919
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
920 def discoInfos(self, entity_jid, node=u'', use_cache=True, profile_key="@DEFAULT@"):
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
921 loop = asyncio.get_running_loop()
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
922 fut = loop.create_future()
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
923 reply_handler = lambda ret=None: loop.call_soon_threadsafe(fut.set_result, ret)
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
924 error_handler = lambda err: loop.call_soon_threadsafe(fut.set_exception, dbus_to_bridge_exception(err))
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
925 self.db_core_iface.discoInfos(entity_jid, node, use_cache, profile_key, timeout=const_TIMEOUT, reply_handler=reply_handler, error_handler=error_handler)
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
926 return fut
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
927
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
928 def discoItems(self, entity_jid, node=u'', use_cache=True, profile_key="@DEFAULT@"):
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
929 loop = asyncio.get_running_loop()
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
930 fut = loop.create_future()
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
931 reply_handler = lambda ret=None: loop.call_soon_threadsafe(fut.set_result, ret)
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
932 error_handler = lambda err: loop.call_soon_threadsafe(fut.set_exception, dbus_to_bridge_exception(err))
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
933 self.db_core_iface.discoItems(entity_jid, node, use_cache, profile_key, timeout=const_TIMEOUT, reply_handler=reply_handler, error_handler=error_handler)
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
934 return fut
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
935
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
936 def disconnect(self, profile_key="@DEFAULT@"):
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
937 loop = asyncio.get_running_loop()
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
938 fut = loop.create_future()
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
939 reply_handler = lambda ret=None: loop.call_soon_threadsafe(fut.set_result, ret)
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
940 error_handler = lambda err: loop.call_soon_threadsafe(fut.set_exception, dbus_to_bridge_exception(err))
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
941 self.db_core_iface.disconnect(profile_key, timeout=const_TIMEOUT, reply_handler=reply_handler, error_handler=error_handler)
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
942 return fut
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
943
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
944 def encryptionNamespaceGet(self, arg_0):
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
945 loop = asyncio.get_running_loop()
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
946 fut = loop.create_future()
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
947 reply_handler = lambda ret=None: loop.call_soon_threadsafe(fut.set_result, ret)
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
948 error_handler = lambda err: loop.call_soon_threadsafe(fut.set_exception, dbus_to_bridge_exception(err))
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
949 self.db_core_iface.encryptionNamespaceGet(arg_0, timeout=const_TIMEOUT, reply_handler=reply_handler, error_handler=error_handler)
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
950 return fut
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
951
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
952 def encryptionPluginsGet(self):
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
953 loop = asyncio.get_running_loop()
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
954 fut = loop.create_future()
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
955 reply_handler = lambda ret=None: loop.call_soon_threadsafe(fut.set_result, ret)
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
956 error_handler = lambda err: loop.call_soon_threadsafe(fut.set_exception, dbus_to_bridge_exception(err))
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
957 self.db_core_iface.encryptionPluginsGet(timeout=const_TIMEOUT, reply_handler=reply_handler, error_handler=error_handler)
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
958 return fut
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
959
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
960 def encryptionTrustUIGet(self, to_jid, namespace, profile_key):
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
961 loop = asyncio.get_running_loop()
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
962 fut = loop.create_future()
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
963 reply_handler = lambda ret=None: loop.call_soon_threadsafe(fut.set_result, ret)
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
964 error_handler = lambda err: loop.call_soon_threadsafe(fut.set_exception, dbus_to_bridge_exception(err))
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
965 self.db_core_iface.encryptionTrustUIGet(to_jid, namespace, profile_key, timeout=const_TIMEOUT, reply_handler=reply_handler, error_handler=error_handler)
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
966 return fut
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
967
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
968 def getConfig(self, section, name):
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
969 loop = asyncio.get_running_loop()
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
970 fut = loop.create_future()
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
971 reply_handler = lambda ret=None: loop.call_soon_threadsafe(fut.set_result, ret)
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
972 error_handler = lambda err: loop.call_soon_threadsafe(fut.set_exception, dbus_to_bridge_exception(err))
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
973 self.db_core_iface.getConfig(section, name, timeout=const_TIMEOUT, reply_handler=reply_handler, error_handler=error_handler)
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
974 return fut
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
975
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
976 def getContacts(self, profile_key="@DEFAULT@"):
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
977 loop = asyncio.get_running_loop()
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
978 fut = loop.create_future()
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
979 reply_handler = lambda ret=None: loop.call_soon_threadsafe(fut.set_result, ret)
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
980 error_handler = lambda err: loop.call_soon_threadsafe(fut.set_exception, dbus_to_bridge_exception(err))
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
981 self.db_core_iface.getContacts(profile_key, timeout=const_TIMEOUT, reply_handler=reply_handler, error_handler=error_handler)
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
982 return fut
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
983
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
984 def getContactsFromGroup(self, group, profile_key="@DEFAULT@"):
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
985 loop = asyncio.get_running_loop()
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
986 fut = loop.create_future()
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
987 reply_handler = lambda ret=None: loop.call_soon_threadsafe(fut.set_result, ret)
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
988 error_handler = lambda err: loop.call_soon_threadsafe(fut.set_exception, dbus_to_bridge_exception(err))
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
989 self.db_core_iface.getContactsFromGroup(group, profile_key, timeout=const_TIMEOUT, reply_handler=reply_handler, error_handler=error_handler)
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
990 return fut
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
991
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
992 def getEntitiesData(self, jids, keys, profile):
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
993 loop = asyncio.get_running_loop()
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
994 fut = loop.create_future()
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
995 reply_handler = lambda ret=None: loop.call_soon_threadsafe(fut.set_result, ret)
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
996 error_handler = lambda err: loop.call_soon_threadsafe(fut.set_exception, dbus_to_bridge_exception(err))
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
997 self.db_core_iface.getEntitiesData(jids, keys, profile, timeout=const_TIMEOUT, reply_handler=reply_handler, error_handler=error_handler)
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
998 return fut
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
999
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
1000 def getEntityData(self, jid, keys, profile):
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
1001 loop = asyncio.get_running_loop()
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
1002 fut = loop.create_future()
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
1003 reply_handler = lambda ret=None: loop.call_soon_threadsafe(fut.set_result, ret)
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
1004 error_handler = lambda err: loop.call_soon_threadsafe(fut.set_exception, dbus_to_bridge_exception(err))
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
1005 self.db_core_iface.getEntityData(jid, keys, profile, timeout=const_TIMEOUT, reply_handler=reply_handler, error_handler=error_handler)
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
1006 return fut
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
1007
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
1008 def getFeatures(self, profile_key):
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
1009 loop = asyncio.get_running_loop()
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
1010 fut = loop.create_future()
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
1011 reply_handler = lambda ret=None: loop.call_soon_threadsafe(fut.set_result, ret)
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
1012 error_handler = lambda err: loop.call_soon_threadsafe(fut.set_exception, dbus_to_bridge_exception(err))
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
1013 self.db_core_iface.getFeatures(profile_key, timeout=const_TIMEOUT, reply_handler=reply_handler, error_handler=error_handler)
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
1014 return fut
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
1015
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
1016 def getMainResource(self, contact_jid, profile_key="@DEFAULT@"):
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
1017 loop = asyncio.get_running_loop()
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
1018 fut = loop.create_future()
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
1019 reply_handler = lambda ret=None: loop.call_soon_threadsafe(fut.set_result, ret)
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
1020 error_handler = lambda err: loop.call_soon_threadsafe(fut.set_exception, dbus_to_bridge_exception(err))
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
1021 self.db_core_iface.getMainResource(contact_jid, profile_key, timeout=const_TIMEOUT, reply_handler=reply_handler, error_handler=error_handler)
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
1022 return fut
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
1023
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
1024 def getParamA(self, name, category, attribute="value", profile_key="@DEFAULT@"):
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
1025 loop = asyncio.get_running_loop()
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
1026 fut = loop.create_future()
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
1027 reply_handler = lambda ret=None: loop.call_soon_threadsafe(fut.set_result, ret)
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
1028 error_handler = lambda err: loop.call_soon_threadsafe(fut.set_exception, dbus_to_bridge_exception(err))
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
1029 self.db_core_iface.getParamA(name, category, attribute, profile_key, timeout=const_TIMEOUT, reply_handler=reply_handler, error_handler=error_handler)
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
1030 return fut
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
1031
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
1032 def getParamsCategories(self):
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
1033 loop = asyncio.get_running_loop()
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
1034 fut = loop.create_future()
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
1035 reply_handler = lambda ret=None: loop.call_soon_threadsafe(fut.set_result, ret)
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
1036 error_handler = lambda err: loop.call_soon_threadsafe(fut.set_exception, dbus_to_bridge_exception(err))
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
1037 self.db_core_iface.getParamsCategories(timeout=const_TIMEOUT, reply_handler=reply_handler, error_handler=error_handler)
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
1038 return fut
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
1039
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
1040 def getParamsUI(self, security_limit=-1, app='', profile_key="@DEFAULT@"):
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
1041 loop = asyncio.get_running_loop()
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
1042 fut = loop.create_future()
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
1043 reply_handler = lambda ret=None: loop.call_soon_threadsafe(fut.set_result, ret)
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
1044 error_handler = lambda err: loop.call_soon_threadsafe(fut.set_exception, dbus_to_bridge_exception(err))
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
1045 self.db_core_iface.getParamsUI(security_limit, app, profile_key, timeout=const_TIMEOUT, reply_handler=reply_handler, error_handler=error_handler)
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
1046 return fut
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
1047
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
1048 def getPresenceStatuses(self, profile_key="@DEFAULT@"):
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
1049 loop = asyncio.get_running_loop()
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
1050 fut = loop.create_future()
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
1051 reply_handler = lambda ret=None: loop.call_soon_threadsafe(fut.set_result, ret)
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
1052 error_handler = lambda err: loop.call_soon_threadsafe(fut.set_exception, dbus_to_bridge_exception(err))
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
1053 self.db_core_iface.getPresenceStatuses(profile_key, timeout=const_TIMEOUT, reply_handler=reply_handler, error_handler=error_handler)
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
1054 return fut
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
1055
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
1056 def getReady(self):
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
1057 loop = asyncio.get_running_loop()
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
1058 fut = loop.create_future()
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
1059 reply_handler = lambda ret=None: loop.call_soon_threadsafe(fut.set_result, ret)
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
1060 error_handler = lambda err: loop.call_soon_threadsafe(fut.set_exception, dbus_to_bridge_exception(err))
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
1061 self.db_core_iface.getReady(timeout=const_TIMEOUT, reply_handler=reply_handler, error_handler=error_handler)
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
1062 return fut
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
1063
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
1064 def getVersion(self):
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
1065 loop = asyncio.get_running_loop()
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
1066 fut = loop.create_future()
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
1067 reply_handler = lambda ret=None: loop.call_soon_threadsafe(fut.set_result, ret)
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
1068 error_handler = lambda err: loop.call_soon_threadsafe(fut.set_exception, dbus_to_bridge_exception(err))
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
1069 self.db_core_iface.getVersion(timeout=const_TIMEOUT, reply_handler=reply_handler, error_handler=error_handler)
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
1070 return fut
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
1071
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
1072 def getWaitingSub(self, profile_key="@DEFAULT@"):
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
1073 loop = asyncio.get_running_loop()
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
1074 fut = loop.create_future()
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
1075 reply_handler = lambda ret=None: loop.call_soon_threadsafe(fut.set_result, ret)
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
1076 error_handler = lambda err: loop.call_soon_threadsafe(fut.set_exception, dbus_to_bridge_exception(err))
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
1077 self.db_core_iface.getWaitingSub(profile_key, timeout=const_TIMEOUT, reply_handler=reply_handler, error_handler=error_handler)
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
1078 return fut
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
1079
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
1080 def historyGet(self, from_jid, to_jid, limit, between=True, filters='', profile="@NONE@"):
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
1081 loop = asyncio.get_running_loop()
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
1082 fut = loop.create_future()
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
1083 reply_handler = lambda ret=None: loop.call_soon_threadsafe(fut.set_result, ret)
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
1084 error_handler = lambda err: loop.call_soon_threadsafe(fut.set_exception, dbus_to_bridge_exception(err))
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
1085 self.db_core_iface.historyGet(from_jid, to_jid, limit, between, filters, profile, timeout=const_TIMEOUT, reply_handler=reply_handler, error_handler=error_handler)
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
1086 return fut
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
1087
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
1088 def isConnected(self, profile_key="@DEFAULT@"):
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
1089 loop = asyncio.get_running_loop()
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
1090 fut = loop.create_future()
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
1091 reply_handler = lambda ret=None: loop.call_soon_threadsafe(fut.set_result, ret)
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
1092 error_handler = lambda err: loop.call_soon_threadsafe(fut.set_exception, dbus_to_bridge_exception(err))
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
1093 self.db_core_iface.isConnected(profile_key, timeout=const_TIMEOUT, reply_handler=reply_handler, error_handler=error_handler)
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
1094 return fut
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
1095
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
1096 def launchAction(self, callback_id, data, profile_key="@DEFAULT@"):
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
1097 loop = asyncio.get_running_loop()
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
1098 fut = loop.create_future()
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
1099 reply_handler = lambda ret=None: loop.call_soon_threadsafe(fut.set_result, ret)
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
1100 error_handler = lambda err: loop.call_soon_threadsafe(fut.set_exception, dbus_to_bridge_exception(err))
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
1101 self.db_core_iface.launchAction(callback_id, data, profile_key, timeout=const_TIMEOUT, reply_handler=reply_handler, error_handler=error_handler)
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
1102 return fut
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
1103
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
1104 def loadParamsTemplate(self, filename):
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
1105 loop = asyncio.get_running_loop()
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
1106 fut = loop.create_future()
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
1107 reply_handler = lambda ret=None: loop.call_soon_threadsafe(fut.set_result, ret)
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
1108 error_handler = lambda err: loop.call_soon_threadsafe(fut.set_exception, dbus_to_bridge_exception(err))
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
1109 self.db_core_iface.loadParamsTemplate(filename, timeout=const_TIMEOUT, reply_handler=reply_handler, error_handler=error_handler)
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
1110 return fut
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
1111
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
1112 def menuHelpGet(self, menu_id, language):
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
1113 loop = asyncio.get_running_loop()
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
1114 fut = loop.create_future()
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
1115 reply_handler = lambda ret=None: loop.call_soon_threadsafe(fut.set_result, ret)
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
1116 error_handler = lambda err: loop.call_soon_threadsafe(fut.set_exception, dbus_to_bridge_exception(err))
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
1117 self.db_core_iface.menuHelpGet(menu_id, language, timeout=const_TIMEOUT, reply_handler=reply_handler, error_handler=error_handler)
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
1118 return fut
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
1119
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
1120 def menuLaunch(self, menu_type, path, data, security_limit, profile_key):
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
1121 loop = asyncio.get_running_loop()
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
1122 fut = loop.create_future()
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
1123 reply_handler = lambda ret=None: loop.call_soon_threadsafe(fut.set_result, ret)
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
1124 error_handler = lambda err: loop.call_soon_threadsafe(fut.set_exception, dbus_to_bridge_exception(err))
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
1125 self.db_core_iface.menuLaunch(menu_type, path, data, security_limit, profile_key, timeout=const_TIMEOUT, reply_handler=reply_handler, error_handler=error_handler)
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
1126 return fut
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
1127
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
1128 def menusGet(self, language, security_limit):
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
1129 loop = asyncio.get_running_loop()
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
1130 fut = loop.create_future()
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
1131 reply_handler = lambda ret=None: loop.call_soon_threadsafe(fut.set_result, ret)
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
1132 error_handler = lambda err: loop.call_soon_threadsafe(fut.set_exception, dbus_to_bridge_exception(err))
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
1133 self.db_core_iface.menusGet(language, security_limit, timeout=const_TIMEOUT, reply_handler=reply_handler, error_handler=error_handler)
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
1134 return fut
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
1135
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
1136 def messageEncryptionGet(self, to_jid, profile_key):
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
1137 loop = asyncio.get_running_loop()
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
1138 fut = loop.create_future()
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
1139 reply_handler = lambda ret=None: loop.call_soon_threadsafe(fut.set_result, ret)
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
1140 error_handler = lambda err: loop.call_soon_threadsafe(fut.set_exception, dbus_to_bridge_exception(err))
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
1141 self.db_core_iface.messageEncryptionGet(to_jid, profile_key, timeout=const_TIMEOUT, reply_handler=reply_handler, error_handler=error_handler)
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
1142 return fut
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
1143
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
1144 def messageEncryptionStart(self, to_jid, namespace='', replace=False, profile_key="@NONE@"):
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
1145 loop = asyncio.get_running_loop()
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
1146 fut = loop.create_future()
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
1147 reply_handler = lambda ret=None: loop.call_soon_threadsafe(fut.set_result, ret)
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
1148 error_handler = lambda err: loop.call_soon_threadsafe(fut.set_exception, dbus_to_bridge_exception(err))
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
1149 self.db_core_iface.messageEncryptionStart(to_jid, namespace, replace, profile_key, timeout=const_TIMEOUT, reply_handler=reply_handler, error_handler=error_handler)
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
1150 return fut
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
1151
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
1152 def messageEncryptionStop(self, to_jid, profile_key):
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
1153 loop = asyncio.get_running_loop()
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
1154 fut = loop.create_future()
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
1155 reply_handler = lambda ret=None: loop.call_soon_threadsafe(fut.set_result, ret)
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
1156 error_handler = lambda err: loop.call_soon_threadsafe(fut.set_exception, dbus_to_bridge_exception(err))
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
1157 self.db_core_iface.messageEncryptionStop(to_jid, profile_key, timeout=const_TIMEOUT, reply_handler=reply_handler, error_handler=error_handler)
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
1158 return fut
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
1159
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
1160 def messageSend(self, to_jid, message, subject={}, mess_type="auto", extra={}, profile_key="@NONE@"):
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
1161 loop = asyncio.get_running_loop()
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
1162 fut = loop.create_future()
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
1163 reply_handler = lambda ret=None: loop.call_soon_threadsafe(fut.set_result, ret)
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
1164 error_handler = lambda err: loop.call_soon_threadsafe(fut.set_exception, dbus_to_bridge_exception(err))
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
1165 self.db_core_iface.messageSend(to_jid, message, subject, mess_type, extra, profile_key, timeout=const_TIMEOUT, reply_handler=reply_handler, error_handler=error_handler)
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
1166 return fut
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
1167
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
1168 def namespacesGet(self):
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
1169 loop = asyncio.get_running_loop()
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
1170 fut = loop.create_future()
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
1171 reply_handler = lambda ret=None: loop.call_soon_threadsafe(fut.set_result, ret)
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
1172 error_handler = lambda err: loop.call_soon_threadsafe(fut.set_exception, dbus_to_bridge_exception(err))
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
1173 self.db_core_iface.namespacesGet(timeout=const_TIMEOUT, reply_handler=reply_handler, error_handler=error_handler)
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
1174 return fut
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
1175
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
1176 def paramsRegisterApp(self, xml, security_limit=-1, app=''):
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
1177 loop = asyncio.get_running_loop()
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
1178 fut = loop.create_future()
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
1179 reply_handler = lambda ret=None: loop.call_soon_threadsafe(fut.set_result, ret)
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
1180 error_handler = lambda err: loop.call_soon_threadsafe(fut.set_exception, dbus_to_bridge_exception(err))
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
1181 self.db_core_iface.paramsRegisterApp(xml, security_limit, app, timeout=const_TIMEOUT, reply_handler=reply_handler, error_handler=error_handler)
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
1182 return fut
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
1183
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
1184 def profileCreate(self, profile, password='', component=''):
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
1185 loop = asyncio.get_running_loop()
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
1186 fut = loop.create_future()
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
1187 reply_handler = lambda ret=None: loop.call_soon_threadsafe(fut.set_result, ret)
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
1188 error_handler = lambda err: loop.call_soon_threadsafe(fut.set_exception, dbus_to_bridge_exception(err))
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
1189 self.db_core_iface.profileCreate(profile, password, component, timeout=const_TIMEOUT, reply_handler=reply_handler, error_handler=error_handler)
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
1190 return fut
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
1191
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
1192 def profileIsSessionStarted(self, profile_key="@DEFAULT@"):
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
1193 loop = asyncio.get_running_loop()
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
1194 fut = loop.create_future()
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
1195 reply_handler = lambda ret=None: loop.call_soon_threadsafe(fut.set_result, ret)
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
1196 error_handler = lambda err: loop.call_soon_threadsafe(fut.set_exception, dbus_to_bridge_exception(err))
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
1197 self.db_core_iface.profileIsSessionStarted(profile_key, timeout=const_TIMEOUT, reply_handler=reply_handler, error_handler=error_handler)
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
1198 return fut
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
1199
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
1200 def profileNameGet(self, profile_key="@DEFAULT@"):
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
1201 loop = asyncio.get_running_loop()
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
1202 fut = loop.create_future()
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
1203 reply_handler = lambda ret=None: loop.call_soon_threadsafe(fut.set_result, ret)
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
1204 error_handler = lambda err: loop.call_soon_threadsafe(fut.set_exception, dbus_to_bridge_exception(err))
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
1205 self.db_core_iface.profileNameGet(profile_key, timeout=const_TIMEOUT, reply_handler=reply_handler, error_handler=error_handler)
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
1206 return fut
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
1207
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
1208 def profileSetDefault(self, profile):
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
1209 loop = asyncio.get_running_loop()
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
1210 fut = loop.create_future()
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
1211 reply_handler = lambda ret=None: loop.call_soon_threadsafe(fut.set_result, ret)
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
1212 error_handler = lambda err: loop.call_soon_threadsafe(fut.set_exception, dbus_to_bridge_exception(err))
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
1213 self.db_core_iface.profileSetDefault(profile, timeout=const_TIMEOUT, reply_handler=reply_handler, error_handler=error_handler)
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
1214 return fut
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
1215
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
1216 def profileStartSession(self, password='', profile_key="@DEFAULT@"):
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
1217 loop = asyncio.get_running_loop()
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
1218 fut = loop.create_future()
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
1219 reply_handler = lambda ret=None: loop.call_soon_threadsafe(fut.set_result, ret)
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
1220 error_handler = lambda err: loop.call_soon_threadsafe(fut.set_exception, dbus_to_bridge_exception(err))
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
1221 self.db_core_iface.profileStartSession(password, profile_key, timeout=const_TIMEOUT, reply_handler=reply_handler, error_handler=error_handler)
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
1222 return fut
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
1223
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
1224 def profilesListGet(self, clients=True, components=False):
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
1225 loop = asyncio.get_running_loop()
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
1226 fut = loop.create_future()
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
1227 reply_handler = lambda ret=None: loop.call_soon_threadsafe(fut.set_result, ret)
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
1228 error_handler = lambda err: loop.call_soon_threadsafe(fut.set_exception, dbus_to_bridge_exception(err))
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
1229 self.db_core_iface.profilesListGet(clients, components, timeout=const_TIMEOUT, reply_handler=reply_handler, error_handler=error_handler)
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
1230 return fut
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
1231
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
1232 def progressGet(self, id, profile):
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
1233 loop = asyncio.get_running_loop()
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
1234 fut = loop.create_future()
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
1235 reply_handler = lambda ret=None: loop.call_soon_threadsafe(fut.set_result, ret)
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
1236 error_handler = lambda err: loop.call_soon_threadsafe(fut.set_exception, dbus_to_bridge_exception(err))
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
1237 self.db_core_iface.progressGet(id, profile, timeout=const_TIMEOUT, reply_handler=reply_handler, error_handler=error_handler)
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
1238 return fut
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
1239
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
1240 def progressGetAll(self, profile):
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
1241 loop = asyncio.get_running_loop()
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
1242 fut = loop.create_future()
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
1243 reply_handler = lambda ret=None: loop.call_soon_threadsafe(fut.set_result, ret)
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
1244 error_handler = lambda err: loop.call_soon_threadsafe(fut.set_exception, dbus_to_bridge_exception(err))
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
1245 self.db_core_iface.progressGetAll(profile, timeout=const_TIMEOUT, reply_handler=reply_handler, error_handler=error_handler)
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
1246 return fut
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
1247
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
1248 def progressGetAllMetadata(self, profile):
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
1249 loop = asyncio.get_running_loop()
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
1250 fut = loop.create_future()
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
1251 reply_handler = lambda ret=None: loop.call_soon_threadsafe(fut.set_result, ret)
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
1252 error_handler = lambda err: loop.call_soon_threadsafe(fut.set_exception, dbus_to_bridge_exception(err))
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
1253 self.db_core_iface.progressGetAllMetadata(profile, timeout=const_TIMEOUT, reply_handler=reply_handler, error_handler=error_handler)
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
1254 return fut
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
1255
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
1256 def rosterResync(self, profile_key="@DEFAULT@"):
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
1257 loop = asyncio.get_running_loop()
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
1258 fut = loop.create_future()
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
1259 reply_handler = lambda ret=None: loop.call_soon_threadsafe(fut.set_result, ret)
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
1260 error_handler = lambda err: loop.call_soon_threadsafe(fut.set_exception, dbus_to_bridge_exception(err))
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
1261 self.db_core_iface.rosterResync(profile_key, timeout=const_TIMEOUT, reply_handler=reply_handler, error_handler=error_handler)
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
1262 return fut
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
1263
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
1264 def saveParamsTemplate(self, filename):
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
1265 loop = asyncio.get_running_loop()
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
1266 fut = loop.create_future()
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
1267 reply_handler = lambda ret=None: loop.call_soon_threadsafe(fut.set_result, ret)
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
1268 error_handler = lambda err: loop.call_soon_threadsafe(fut.set_exception, dbus_to_bridge_exception(err))
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
1269 self.db_core_iface.saveParamsTemplate(filename, timeout=const_TIMEOUT, reply_handler=reply_handler, error_handler=error_handler)
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
1270 return fut
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
1271
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
1272 def sessionInfosGet(self, profile_key):
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
1273 loop = asyncio.get_running_loop()
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
1274 fut = loop.create_future()
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
1275 reply_handler = lambda ret=None: loop.call_soon_threadsafe(fut.set_result, ret)
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
1276 error_handler = lambda err: loop.call_soon_threadsafe(fut.set_exception, dbus_to_bridge_exception(err))
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
1277 self.db_core_iface.sessionInfosGet(profile_key, timeout=const_TIMEOUT, reply_handler=reply_handler, error_handler=error_handler)
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
1278 return fut
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
1279
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
1280 def setParam(self, name, value, category, security_limit=-1, profile_key="@DEFAULT@"):
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
1281 loop = asyncio.get_running_loop()
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
1282 fut = loop.create_future()
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
1283 reply_handler = lambda ret=None: loop.call_soon_threadsafe(fut.set_result, ret)
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
1284 error_handler = lambda err: loop.call_soon_threadsafe(fut.set_exception, dbus_to_bridge_exception(err))
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
1285 self.db_core_iface.setParam(name, value, category, security_limit, profile_key, timeout=const_TIMEOUT, reply_handler=reply_handler, error_handler=error_handler)
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
1286 return fut
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
1287
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
1288 def setPresence(self, to_jid='', show='', statuses={}, profile_key="@DEFAULT@"):
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
1289 loop = asyncio.get_running_loop()
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
1290 fut = loop.create_future()
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
1291 reply_handler = lambda ret=None: loop.call_soon_threadsafe(fut.set_result, ret)
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
1292 error_handler = lambda err: loop.call_soon_threadsafe(fut.set_exception, dbus_to_bridge_exception(err))
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
1293 self.db_core_iface.setPresence(to_jid, show, statuses, profile_key, timeout=const_TIMEOUT, reply_handler=reply_handler, error_handler=error_handler)
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
1294 return fut
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
1295
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
1296 def subscription(self, sub_type, entity, profile_key="@DEFAULT@"):
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
1297 loop = asyncio.get_running_loop()
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
1298 fut = loop.create_future()
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
1299 reply_handler = lambda ret=None: loop.call_soon_threadsafe(fut.set_result, ret)
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
1300 error_handler = lambda err: loop.call_soon_threadsafe(fut.set_exception, dbus_to_bridge_exception(err))
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
1301 self.db_core_iface.subscription(sub_type, entity, profile_key, timeout=const_TIMEOUT, reply_handler=reply_handler, error_handler=error_handler)
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
1302 return fut
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
1303
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
1304 def updateContact(self, entity_jid, name, groups, profile_key="@DEFAULT@"):
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
1305 loop = asyncio.get_running_loop()
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
1306 fut = loop.create_future()
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
1307 reply_handler = lambda ret=None: loop.call_soon_threadsafe(fut.set_result, ret)
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
1308 error_handler = lambda err: loop.call_soon_threadsafe(fut.set_exception, dbus_to_bridge_exception(err))
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
1309 self.db_core_iface.updateContact(entity_jid, name, groups, profile_key, timeout=const_TIMEOUT, reply_handler=reply_handler, error_handler=error_handler)
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
1310 return fut