annotate libervia/frontends/bridge/dbus_bridge.py @ 4322:00837fa13e5a default tip @

tools (common/template), cli (call/gui): use font-awesome instead of fontello: following change in Libervia Media, code has been updated to use font-awesome now instead of fontello.
author Goffi <goffi@goffi.org>
date Sat, 26 Oct 2024 22:42:17 +0200
parents 3a550e9a2b55
children
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
3143
830fce0db15d bridge (dbus): new `bridge_dbus_int_prefix` option (in `[DEFAULT]` settings) to change interface prefix
Goffi <goffi@goffi.org>
parents: 3136
diff changeset
3 # SàT communication bridge
3479
be6d91572633 date update
Goffi <goffi@goffi.org>
parents: 3259
diff changeset
4 # Copyright (C) 2009-2021 Jérôme Poisson (goffi@goffi.org)
0
goffi@necton2
parents:
diff changeset
5
609
84a6e83157c2 fixed licences in docstrings (they are now in comments)
Goffi <goffi@goffi.org>
parents: 595
diff changeset
6 # 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
7 # 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
8 # 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
9 # (at your option) any later version.
0
goffi@necton2
parents:
diff changeset
10
609
84a6e83157c2 fixed licences in docstrings (they are now in comments)
Goffi <goffi@goffi.org>
parents: 595
diff changeset
11 # 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
12 # 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
13 # 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
14 # GNU Affero General Public License for more details.
0
goffi@necton2
parents:
diff changeset
15
609
84a6e83157c2 fixed licences in docstrings (they are now in comments)
Goffi <goffi@goffi.org>
parents: 595
diff changeset
16 # 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
17 # along with this program. If not, see <http://www.gnu.org/licenses/>.
0
goffi@necton2
parents:
diff changeset
18
3042
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
19 import asyncio
535
790be337cc41 bridge: fixed D-Bus warning in frontend side of bridge
Goffi <goffi@goffi.org>
parents: 504
diff changeset
20 import dbus
3042
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
21 import ast
4071
4b842c1fb686 refactoring: renamed `sat` package to `libervia.backend`
Goffi <goffi@goffi.org>
parents: 4041
diff changeset
22 from libervia.backend.core.i18n import _
4b842c1fb686 refactoring: renamed `sat` package to `libervia.backend`
Goffi <goffi@goffi.org>
parents: 4041
diff changeset
23 from libervia.backend.tools import config
4b842c1fb686 refactoring: renamed `sat` package to `libervia.backend`
Goffi <goffi@goffi.org>
parents: 4041
diff changeset
24 from libervia.backend.core.log import getLogger
4b842c1fb686 refactoring: renamed `sat` package to `libervia.backend`
Goffi <goffi@goffi.org>
parents: 4041
diff changeset
25 from libervia.backend.core.exceptions import BridgeExceptionNoService, BridgeInitError
3042
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
26 from dbus.mainloop.glib import DBusGMainLoop
3143
830fce0db15d bridge (dbus): new `bridge_dbus_int_prefix` option (in `[DEFAULT]` settings) to change interface prefix
Goffi <goffi@goffi.org>
parents: 3136
diff changeset
27 from .bridge_frontend import BridgeException
830fce0db15d bridge (dbus): new `bridge_dbus_int_prefix` option (in `[DEFAULT]` settings) to change interface prefix
Goffi <goffi@goffi.org>
parents: 3136
diff changeset
28
0
goffi@necton2
parents:
diff changeset
29
535
790be337cc41 bridge: fixed D-Bus warning in frontend side of bridge
Goffi <goffi@goffi.org>
parents: 504
diff changeset
30 DBusGMainLoop(set_as_default=True)
3042
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
31 log = getLogger(__name__)
535
790be337cc41 bridge: fixed D-Bus warning in frontend side of bridge
Goffi <goffi@goffi.org>
parents: 504
diff changeset
32
1073
f094583732de bridge: DBusException also transports the twisted failure condition
souliane <souliane@mailoo.org>
parents: 1072
diff changeset
33
3143
830fce0db15d bridge (dbus): new `bridge_dbus_int_prefix` option (in `[DEFAULT]` settings) to change interface prefix
Goffi <goffi@goffi.org>
parents: 3136
diff changeset
34 # Interface prefix
4037
524856bd7b19 massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents: 3648
diff changeset
35 const_INT_PREFIX = config.config_get(
4270
0d7bb4df2343 Reformatted code base using black.
Goffi <goffi@goffi.org>
parents: 4193
diff changeset
36 config.parse_main_conf(), "", "bridge_dbus_int_prefix", "org.libervia.Libervia"
0d7bb4df2343 Reformatted code base using black.
Goffi <goffi@goffi.org>
parents: 4193
diff changeset
37 )
595
1f160467f5de Fix pep8 support in src/bridge.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents: 587
diff changeset
38 const_ERROR_PREFIX = const_INT_PREFIX + ".error"
4270
0d7bb4df2343 Reformatted code base using black.
Goffi <goffi@goffi.org>
parents: 4193
diff changeset
39 const_OBJ_PATH = "/org/libervia/Libervia/bridge"
372
f964dcec1611 core: plugins refactored according to bridge + updatedValue now use profile
Goffi <goffi@goffi.org>
parents: 365
diff changeset
40 const_CORE_SUFFIX = ".core"
f964dcec1611 core: plugins refactored according to bridge + updatedValue now use profile
Goffi <goffi@goffi.org>
parents: 365
diff changeset
41 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
42 const_TIMEOUT = 120
360
6b5626c37909 bridge: regenerated DBus bridge
Goffi <goffi@goffi.org>
parents: 345
diff changeset
43
595
1f160467f5de Fix pep8 support in src/bridge.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents: 587
diff changeset
44
1062
95758ef3faa8 bridge: async failures are more detailed (full class name + error message)
souliane <souliane@mailoo.org>
parents: 1059
diff changeset
45 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
46 """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
47
95758ef3faa8 bridge: async failures are more detailed (full class name + error message)
souliane <souliane@mailoo.org>
parents: 1059
diff changeset
48 @param dbus_e (DBusException)
95758ef3faa8 bridge: async failures are more detailed (full class name + error message)
souliane <souliane@mailoo.org>
parents: 1059
diff changeset
49 @return: BridgeException
95758ef3faa8 bridge: async failures are more detailed (full class name + error message)
souliane <souliane@mailoo.org>
parents: 1059
diff changeset
50 """
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
51 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
52 if full_name.startswith(const_ERROR_PREFIX):
4270
0d7bb4df2343 Reformatted code base using black.
Goffi <goffi@goffi.org>
parents: 4193
diff changeset
53 name = dbus_e.get_dbus_name()[len(const_ERROR_PREFIX) + 1 :]
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
54 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
55 name = full_name
1073
f094583732de bridge: DBusException also transports the twisted failure condition
souliane <souliane@mailoo.org>
parents: 1072
diff changeset
56 # 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
57 # 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
58 # 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
59 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
60 try:
f094583732de bridge: DBusException also transports the twisted failure condition
souliane <souliane@mailoo.org>
parents: 1072
diff changeset
61 message, condition = ast.literal_eval(message)
f094583732de bridge: DBusException also transports the twisted failure condition
souliane <souliane@mailoo.org>
parents: 1072
diff changeset
62 except (SyntaxError, ValueError, TypeError):
4270
0d7bb4df2343 Reformatted code base using black.
Goffi <goffi@goffi.org>
parents: 4193
diff changeset
63 condition = ""
1073
f094583732de bridge: DBusException also transports the twisted failure condition
souliane <souliane@mailoo.org>
parents: 1072
diff changeset
64 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
65
95758ef3faa8 bridge: async failures are more detailed (full class name + error message)
souliane <souliane@mailoo.org>
parents: 1059
diff changeset
66
4037
524856bd7b19 massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents: 3648
diff changeset
67 class bridge:
2091
f413bfc24458 bridge, quick_frontend: preparation for async bridge
Goffi <goffi@goffi.org>
parents: 2086
diff changeset
68
4037
524856bd7b19 massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents: 3648
diff changeset
69 def bridge_connect(self, callback, errback):
165
8a2053de6f8c Frontends: management of unlaunched SàT Backend (information message and exit)
Goffi <goffi@goffi.org>
parents: 136
diff changeset
70 try:
8a2053de6f8c Frontends: management of unlaunched SàT Backend (information message and exit)
Goffi <goffi@goffi.org>
parents: 136
diff changeset
71 self.sessions_bus = dbus.SessionBus()
4270
0d7bb4df2343 Reformatted code base using black.
Goffi <goffi@goffi.org>
parents: 4193
diff changeset
72 self.db_object = self.sessions_bus.get_object(
0d7bb4df2343 Reformatted code base using black.
Goffi <goffi@goffi.org>
parents: 4193
diff changeset
73 const_INT_PREFIX, const_OBJ_PATH
0d7bb4df2343 Reformatted code base using black.
Goffi <goffi@goffi.org>
parents: 4193
diff changeset
74 )
0d7bb4df2343 Reformatted code base using black.
Goffi <goffi@goffi.org>
parents: 4193
diff changeset
75 self.db_core_iface = dbus.Interface(
0d7bb4df2343 Reformatted code base using black.
Goffi <goffi@goffi.org>
parents: 4193
diff changeset
76 self.db_object, dbus_interface=const_INT_PREFIX + const_CORE_SUFFIX
0d7bb4df2343 Reformatted code base using black.
Goffi <goffi@goffi.org>
parents: 4193
diff changeset
77 )
0d7bb4df2343 Reformatted code base using black.
Goffi <goffi@goffi.org>
parents: 4193
diff changeset
78 self.db_plugin_iface = dbus.Interface(
0d7bb4df2343 Reformatted code base using black.
Goffi <goffi@goffi.org>
parents: 4193
diff changeset
79 self.db_object, dbus_interface=const_INT_PREFIX + const_PLUGIN_SUFFIX
0d7bb4df2343 Reformatted code base using black.
Goffi <goffi@goffi.org>
parents: 4193
diff changeset
80 )
3028
ab2696e34d29 Python 3 port:
Goffi <goffi@goffi.org>
parents: 2892
diff changeset
81 except dbus.exceptions.DBusException as e:
4270
0d7bb4df2343 Reformatted code base using black.
Goffi <goffi@goffi.org>
parents: 4193
diff changeset
82 if e._dbus_error_name in (
0d7bb4df2343 Reformatted code base using black.
Goffi <goffi@goffi.org>
parents: 4193
diff changeset
83 "org.freedesktop.DBus.Error.ServiceUnknown",
0d7bb4df2343 Reformatted code base using black.
Goffi <goffi@goffi.org>
parents: 4193
diff changeset
84 "org.freedesktop.DBus.Error.Spawn.ExecFailed",
0d7bb4df2343 Reformatted code base using black.
Goffi <goffi@goffi.org>
parents: 4193
diff changeset
85 ):
2091
f413bfc24458 bridge, quick_frontend: preparation for async bridge
Goffi <goffi@goffi.org>
parents: 2086
diff changeset
86 errback(BridgeExceptionNoService())
4270
0d7bb4df2343 Reformatted code base using black.
Goffi <goffi@goffi.org>
parents: 4193
diff changeset
87 elif e._dbus_error_name == "org.freedesktop.DBus.Error.NotSupported":
0d7bb4df2343 Reformatted code base using black.
Goffi <goffi@goffi.org>
parents: 4193
diff changeset
88 log.error(
0d7bb4df2343 Reformatted code base using black.
Goffi <goffi@goffi.org>
parents: 4193
diff changeset
89 _(
0d7bb4df2343 Reformatted code base using black.
Goffi <goffi@goffi.org>
parents: 4193
diff changeset
90 "D-Bus is not launched, please see README to see instructions on how to launch it"
0d7bb4df2343 Reformatted code base using black.
Goffi <goffi@goffi.org>
parents: 4193
diff changeset
91 )
0d7bb4df2343 Reformatted code base using black.
Goffi <goffi@goffi.org>
parents: 4193
diff changeset
92 )
2091
f413bfc24458 bridge, quick_frontend: preparation for async bridge
Goffi <goffi@goffi.org>
parents: 2086
diff changeset
93 errback(BridgeInitError)
165
8a2053de6f8c Frontends: management of unlaunched SàT Backend (information message and exit)
Goffi <goffi@goffi.org>
parents: 136
diff changeset
94 else:
2091
f413bfc24458 bridge, quick_frontend: preparation for async bridge
Goffi <goffi@goffi.org>
parents: 2086
diff changeset
95 errback(e)
3042
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
96 else:
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
97 callback()
4270
0d7bb4df2343 Reformatted code base using black.
Goffi <goffi@goffi.org>
parents: 4193
diff changeset
98 # props = self.db_core_iface.getProperties()
0
goffi@necton2
parents:
diff changeset
99
2086
4633cfcbcccb bridge (D-Bus): bad design fixes:
Goffi <goffi@goffi.org>
parents: 2083
diff changeset
100 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
101 if iface == "core":
f964dcec1611 core: plugins refactored according to bridge + updatedValue now use profile
Goffi <goffi@goffi.org>
parents: 365
diff changeset
102 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
103 elif iface == "plugin":
f964dcec1611 core: plugins refactored according to bridge + updatedValue now use profile
Goffi <goffi@goffi.org>
parents: 365
diff changeset
104 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
105 else:
4270
0d7bb4df2343 Reformatted code base using black.
Goffi <goffi@goffi.org>
parents: 4193
diff changeset
106 log.error(_("Unknown interface"))
0
goffi@necton2
parents:
diff changeset
107
568
239abc5484c9 bridge: generic plugin methods handling for frontend side in D-Bus Bridge \o/
Goffi <goffi@goffi.org>
parents: 562
diff changeset
108 def __getattribute__(self, name):
4270
0d7bb4df2343 Reformatted code base using black.
Goffi <goffi@goffi.org>
parents: 4193
diff changeset
109 """usual __getattribute__ if the method exists, else try to find a plugin method"""
568
239abc5484c9 bridge: generic plugin methods handling for frontend side in D-Bus Bridge \o/
Goffi <goffi@goffi.org>
parents: 562
diff changeset
110 try:
239abc5484c9 bridge: generic plugin methods handling for frontend side in D-Bus Bridge \o/
Goffi <goffi@goffi.org>
parents: 562
diff changeset
111 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
112 except AttributeError:
239abc5484c9 bridge: generic plugin methods handling for frontend side in D-Bus Bridge \o/
Goffi <goffi@goffi.org>
parents: 562
diff changeset
113 # 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
114
4037
524856bd7b19 massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents: 3648
diff changeset
115 def get_plugin_method(*args, **kwargs):
568
239abc5484c9 bridge: generic plugin methods handling for frontend side in D-Bus Bridge \o/
Goffi <goffi@goffi.org>
parents: 562
diff changeset
116 # 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
117 # - 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
118 # - 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
119
3028
ab2696e34d29 Python 3 port:
Goffi <goffi@goffi.org>
parents: 2892
diff changeset
120 async_ = False
1794
b0ed4863dbc7 bridge (D-Bus): fixed handling of profile in kwargs:
Goffi <goffi@goffi.org>
parents: 1766
diff changeset
121 args = list(args)
587
952322b1d490 Remove trailing whitespaces.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents: 572
diff changeset
122
568
239abc5484c9 bridge: generic plugin methods handling for frontend side in D-Bus Bridge \o/
Goffi <goffi@goffi.org>
parents: 562
diff changeset
123 if kwargs:
4270
0d7bb4df2343 Reformatted code base using black.
Goffi <goffi@goffi.org>
parents: 4193
diff changeset
124 if "callback" in kwargs:
3028
ab2696e34d29 Python 3 port:
Goffi <goffi@goffi.org>
parents: 2892
diff changeset
125 async_ = True
4270
0d7bb4df2343 Reformatted code base using black.
Goffi <goffi@goffi.org>
parents: 4193
diff changeset
126 _callback = kwargs.pop("callback")
0d7bb4df2343 Reformatted code base using black.
Goffi <goffi@goffi.org>
parents: 4193
diff changeset
127 _errback = kwargs.pop(
0d7bb4df2343 Reformatted code base using black.
Goffi <goffi@goffi.org>
parents: 4193
diff changeset
128 "errback", lambda failure: log.error(str(failure))
0d7bb4df2343 Reformatted code base using black.
Goffi <goffi@goffi.org>
parents: 4193
diff changeset
129 )
1794
b0ed4863dbc7 bridge (D-Bus): fixed handling of profile in kwargs:
Goffi <goffi@goffi.org>
parents: 1766
diff changeset
130 try:
4270
0d7bb4df2343 Reformatted code base using black.
Goffi <goffi@goffi.org>
parents: 4193
diff changeset
131 args.append(kwargs.pop("profile"))
1794
b0ed4863dbc7 bridge (D-Bus): fixed handling of profile in kwargs:
Goffi <goffi@goffi.org>
parents: 1766
diff changeset
132 except KeyError:
b0ed4863dbc7 bridge (D-Bus): fixed handling of profile in kwargs:
Goffi <goffi@goffi.org>
parents: 1766
diff changeset
133 try:
4270
0d7bb4df2343 Reformatted code base using black.
Goffi <goffi@goffi.org>
parents: 4193
diff changeset
134 args.append(kwargs.pop("profile_key"))
1794
b0ed4863dbc7 bridge (D-Bus): fixed handling of profile in kwargs:
Goffi <goffi@goffi.org>
parents: 1766
diff changeset
135 except KeyError:
b0ed4863dbc7 bridge (D-Bus): fixed handling of profile in kwargs:
Goffi <goffi@goffi.org>
parents: 1766
diff changeset
136 pass
b0ed4863dbc7 bridge (D-Bus): fixed handling of profile in kwargs:
Goffi <goffi@goffi.org>
parents: 1766
diff changeset
137 # 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
138 if kwargs:
4270
0d7bb4df2343 Reformatted code base using black.
Goffi <goffi@goffi.org>
parents: 4193
diff changeset
139 log.warning(
0d7bb4df2343 Reformatted code base using black.
Goffi <goffi@goffi.org>
parents: 4193
diff changeset
140 "unexpected keyword arguments, they will be ignored: {}".format(
0d7bb4df2343 Reformatted code base using black.
Goffi <goffi@goffi.org>
parents: 4193
diff changeset
141 kwargs
0d7bb4df2343 Reformatted code base using black.
Goffi <goffi@goffi.org>
parents: 4193
diff changeset
142 )
0d7bb4df2343 Reformatted code base using black.
Goffi <goffi@goffi.org>
parents: 4193
diff changeset
143 )
595
1f160467f5de Fix pep8 support in src/bridge.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents: 587
diff changeset
144 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
145 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
146 _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
147 _callback = args.pop()
587
952322b1d490 Remove trailing whitespaces.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents: 572
diff changeset
148
568
239abc5484c9 bridge: generic plugin methods handling for frontend side in D-Bus Bridge \o/
Goffi <goffi@goffi.org>
parents: 562
diff changeset
149 method = getattr(self.db_plugin_iface, name)
587
952322b1d490 Remove trailing whitespaces.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents: 572
diff changeset
150
3028
ab2696e34d29 Python 3 port:
Goffi <goffi@goffi.org>
parents: 2892
diff changeset
151 if async_:
4270
0d7bb4df2343 Reformatted code base using black.
Goffi <goffi@goffi.org>
parents: 4193
diff changeset
152 kwargs["timeout"] = const_TIMEOUT
0d7bb4df2343 Reformatted code base using black.
Goffi <goffi@goffi.org>
parents: 4193
diff changeset
153 kwargs["reply_handler"] = _callback
0d7bb4df2343 Reformatted code base using black.
Goffi <goffi@goffi.org>
parents: 4193
diff changeset
154 kwargs["error_handler"] = lambda err: _errback(
0d7bb4df2343 Reformatted code base using black.
Goffi <goffi@goffi.org>
parents: 4193
diff changeset
155 dbus_to_bridge_exception(err)
0d7bb4df2343 Reformatted code base using black.
Goffi <goffi@goffi.org>
parents: 4193
diff changeset
156 )
568
239abc5484c9 bridge: generic plugin methods handling for frontend side in D-Bus Bridge \o/
Goffi <goffi@goffi.org>
parents: 562
diff changeset
157
3648
71cfe9334f73 bridge (dbus/frontend): reintrospect signature in case of guess error:
Goffi <goffi@goffi.org>
parents: 3480
diff changeset
158 try:
71cfe9334f73 bridge (dbus/frontend): reintrospect signature in case of guess error:
Goffi <goffi@goffi.org>
parents: 3480
diff changeset
159 return method(*args, **kwargs)
71cfe9334f73 bridge (dbus/frontend): reintrospect signature in case of guess error:
Goffi <goffi@goffi.org>
parents: 3480
diff changeset
160 except ValueError as e:
71cfe9334f73 bridge (dbus/frontend): reintrospect signature in case of guess error:
Goffi <goffi@goffi.org>
parents: 3480
diff changeset
161 if e.args[0].startswith("Unable to guess signature"):
71cfe9334f73 bridge (dbus/frontend): reintrospect signature in case of guess error:
Goffi <goffi@goffi.org>
parents: 3480
diff changeset
162 # XXX: if frontend is started too soon after backend, the
71cfe9334f73 bridge (dbus/frontend): reintrospect signature in case of guess error:
Goffi <goffi@goffi.org>
parents: 3480
diff changeset
163 # inspection misses methods (notably plugin dynamically added
71cfe9334f73 bridge (dbus/frontend): reintrospect signature in case of guess error:
Goffi <goffi@goffi.org>
parents: 3480
diff changeset
164 # methods). The following hack works around that by redoing the
71cfe9334f73 bridge (dbus/frontend): reintrospect signature in case of guess error:
Goffi <goffi@goffi.org>
parents: 3480
diff changeset
165 # cache of introspected methods signatures.
71cfe9334f73 bridge (dbus/frontend): reintrospect signature in case of guess error:
Goffi <goffi@goffi.org>
parents: 3480
diff changeset
166 log.debug("using hack to work around inspection issue")
71cfe9334f73 bridge (dbus/frontend): reintrospect signature in case of guess error:
Goffi <goffi@goffi.org>
parents: 3480
diff changeset
167 proxy = self.db_plugin_iface.proxy_object
71cfe9334f73 bridge (dbus/frontend): reintrospect signature in case of guess error:
Goffi <goffi@goffi.org>
parents: 3480
diff changeset
168 IN_PROGRESS = proxy.INTROSPECT_STATE_INTROSPECT_IN_PROGRESS
71cfe9334f73 bridge (dbus/frontend): reintrospect signature in case of guess error:
Goffi <goffi@goffi.org>
parents: 3480
diff changeset
169 proxy._introspect_state = IN_PROGRESS
71cfe9334f73 bridge (dbus/frontend): reintrospect signature in case of guess error:
Goffi <goffi@goffi.org>
parents: 3480
diff changeset
170 proxy._Introspect()
71cfe9334f73 bridge (dbus/frontend): reintrospect signature in case of guess error:
Goffi <goffi@goffi.org>
parents: 3480
diff changeset
171 return self.db_plugin_iface.get_dbus_method(name)(*args, **kwargs)
71cfe9334f73 bridge (dbus/frontend): reintrospect signature in case of guess error:
Goffi <goffi@goffi.org>
parents: 3480
diff changeset
172 raise e
587
952322b1d490 Remove trailing whitespaces.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents: 572
diff changeset
173
4037
524856bd7b19 massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents: 3648
diff changeset
174 return get_plugin_method
1290
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
175
4284
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
176 def action_launch(
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
177 self, callback_id, data, profile_key="@DEFAULT@", callback=None, errback=None
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
178 ):
4037
524856bd7b19 massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents: 3648
diff changeset
179 if callback is None:
524856bd7b19 massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents: 3648
diff changeset
180 error_handler = None
524856bd7b19 massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents: 3648
diff changeset
181 else:
524856bd7b19 massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents: 3648
diff changeset
182 if errback is None:
524856bd7b19 massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents: 3648
diff changeset
183 errback = log.error
4284
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
184 error_handler = lambda err: errback(dbus_to_bridge_exception(err))
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
185 return str(
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
186 self.db_core_iface.action_launch(
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
187 callback_id,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
188 data,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
189 profile_key,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
190 timeout=const_TIMEOUT,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
191 reply_handler=callback,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
192 error_handler=error_handler,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
193 )
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
194 )
4037
524856bd7b19 massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents: 3648
diff changeset
195
524856bd7b19 massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents: 3648
diff changeset
196 def actions_get(self, profile_key="@DEFAULT@", callback=None, errback=None):
1622
5b24d6bf5d15 core, bridge: actionsGet:
Goffi <goffi@goffi.org>
parents: 1595
diff changeset
197 if callback is None:
5b24d6bf5d15 core, bridge: actionsGet:
Goffi <goffi@goffi.org>
parents: 1595
diff changeset
198 error_handler = None
5b24d6bf5d15 core, bridge: actionsGet:
Goffi <goffi@goffi.org>
parents: 1595
diff changeset
199 else:
5b24d6bf5d15 core, bridge: actionsGet:
Goffi <goffi@goffi.org>
parents: 1595
diff changeset
200 if errback is None:
5b24d6bf5d15 core, bridge: actionsGet:
Goffi <goffi@goffi.org>
parents: 1595
diff changeset
201 errback = log.error
4284
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
202 error_handler = lambda err: errback(dbus_to_bridge_exception(err))
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
203 kwargs = {}
1622
5b24d6bf5d15 core, bridge: actionsGet:
Goffi <goffi@goffi.org>
parents: 1595
diff changeset
204 if callback is not None:
4284
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
205 kwargs["timeout"] = const_TIMEOUT
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
206 kwargs["reply_handler"] = callback
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
207 kwargs["error_handler"] = error_handler
4037
524856bd7b19 massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents: 3648
diff changeset
208 return self.db_core_iface.actions_get(profile_key, **kwargs)
1622
5b24d6bf5d15 core, bridge: actionsGet:
Goffi <goffi@goffi.org>
parents: 1595
diff changeset
209
4037
524856bd7b19 massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents: 3648
diff changeset
210 def config_get(self, section, name, callback=None, errback=None):
524856bd7b19 massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents: 3648
diff changeset
211 if callback is None:
524856bd7b19 massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents: 3648
diff changeset
212 error_handler = None
524856bd7b19 massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents: 3648
diff changeset
213 else:
524856bd7b19 massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents: 3648
diff changeset
214 if errback is None:
524856bd7b19 massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents: 3648
diff changeset
215 errback = log.error
4284
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
216 error_handler = lambda err: errback(dbus_to_bridge_exception(err))
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
217 kwargs = {}
4037
524856bd7b19 massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents: 3648
diff changeset
218 if callback is not None:
4284
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
219 kwargs["timeout"] = const_TIMEOUT
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
220 kwargs["reply_handler"] = callback
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
221 kwargs["error_handler"] = error_handler
4037
524856bd7b19 massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents: 3648
diff changeset
222 return str(self.db_core_iface.config_get(section, name, **kwargs))
524856bd7b19 massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents: 3648
diff changeset
223
4284
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
224 def connect(
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
225 self,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
226 profile_key="@DEFAULT@",
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
227 password="",
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
228 options={},
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
229 callback=None,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
230 errback=None,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
231 ):
4037
524856bd7b19 massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents: 3648
diff changeset
232 if callback is None:
524856bd7b19 massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents: 3648
diff changeset
233 error_handler = None
524856bd7b19 massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents: 3648
diff changeset
234 else:
524856bd7b19 massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents: 3648
diff changeset
235 if errback is None:
524856bd7b19 massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents: 3648
diff changeset
236 errback = log.error
4284
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
237 error_handler = lambda err: errback(dbus_to_bridge_exception(err))
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
238 return self.db_core_iface.connect(
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
239 profile_key,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
240 password,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
241 options,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
242 timeout=const_TIMEOUT,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
243 reply_handler=callback,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
244 error_handler=error_handler,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
245 )
4037
524856bd7b19 massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents: 3648
diff changeset
246
4284
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
247 def contact_add(
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
248 self, entity_jid, profile_key="@DEFAULT@", callback=None, errback=None
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
249 ):
1290
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
250 if callback is None:
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
251 error_handler = None
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
252 else:
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
253 if errback is None:
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
254 errback = log.error
4284
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
255 error_handler = lambda err: errback(dbus_to_bridge_exception(err))
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
256 kwargs = {}
1290
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
257 if callback is not None:
4284
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
258 kwargs["timeout"] = const_TIMEOUT
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
259 kwargs["reply_handler"] = callback
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
260 kwargs["error_handler"] = error_handler
4037
524856bd7b19 massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents: 3648
diff changeset
261 return self.db_core_iface.contact_add(entity_jid, profile_key, **kwargs)
413
dd4caab17008 core: - individual parameters managed through sqlite
Goffi <goffi@goffi.org>
parents: 405
diff changeset
262
4284
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
263 def contact_del(
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
264 self, entity_jid, profile_key="@DEFAULT@", callback=None, errback=None
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
265 ):
3254
6cf4bd6972c2 core, frontends: avatar refactoring:
Goffi <goffi@goffi.org>
parents: 3242
diff changeset
266 if callback is None:
6cf4bd6972c2 core, frontends: avatar refactoring:
Goffi <goffi@goffi.org>
parents: 3242
diff changeset
267 error_handler = None
6cf4bd6972c2 core, frontends: avatar refactoring:
Goffi <goffi@goffi.org>
parents: 3242
diff changeset
268 else:
6cf4bd6972c2 core, frontends: avatar refactoring:
Goffi <goffi@goffi.org>
parents: 3242
diff changeset
269 if errback is None:
6cf4bd6972c2 core, frontends: avatar refactoring:
Goffi <goffi@goffi.org>
parents: 3242
diff changeset
270 errback = log.error
4284
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
271 error_handler = lambda err: errback(dbus_to_bridge_exception(err))
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
272 return self.db_core_iface.contact_del(
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
273 entity_jid,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
274 profile_key,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
275 timeout=const_TIMEOUT,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
276 reply_handler=callback,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
277 error_handler=error_handler,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
278 )
272
1d2e0dfe7114 bridge: core & frontend sides of bridge are now generated
Goffi <goffi@goffi.org>
parents: 267
diff changeset
279
4037
524856bd7b19 massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents: 3648
diff changeset
280 def contact_get(self, arg_0, 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
281 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
282 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
283 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
284 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
285 errback = log.error
4284
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
286 error_handler = lambda err: errback(dbus_to_bridge_exception(err))
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
287 return self.db_core_iface.contact_get(
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
288 arg_0,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
289 profile_key,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
290 timeout=const_TIMEOUT,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
291 reply_handler=callback,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
292 error_handler=error_handler,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
293 )
963
723f28cd15c7 core (disco): added discoInfos and discoItems bridge methods
Goffi <goffi@goffi.org>
parents: 943
diff changeset
294
4284
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
295 def contact_update(
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
296 self,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
297 entity_jid,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
298 name,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
299 groups,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
300 profile_key="@DEFAULT@",
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
301 callback=None,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
302 errback=None,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
303 ):
2733
e347e32aa07f core (memory/encryption): new encryptionNamespaceGet and encryptionTrustUIGet methods:
Goffi <goffi@goffi.org>
parents: 2658
diff changeset
304 if callback is None:
e347e32aa07f core (memory/encryption): new encryptionNamespaceGet and encryptionTrustUIGet methods:
Goffi <goffi@goffi.org>
parents: 2658
diff changeset
305 error_handler = None
e347e32aa07f core (memory/encryption): new encryptionNamespaceGet and encryptionTrustUIGet methods:
Goffi <goffi@goffi.org>
parents: 2658
diff changeset
306 else:
e347e32aa07f core (memory/encryption): new encryptionNamespaceGet and encryptionTrustUIGet methods:
Goffi <goffi@goffi.org>
parents: 2658
diff changeset
307 if errback is None:
e347e32aa07f core (memory/encryption): new encryptionNamespaceGet and encryptionTrustUIGet methods:
Goffi <goffi@goffi.org>
parents: 2658
diff changeset
308 errback = log.error
4284
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
309 error_handler = lambda err: errback(dbus_to_bridge_exception(err))
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
310 kwargs = {}
2733
e347e32aa07f core (memory/encryption): new encryptionNamespaceGet and encryptionTrustUIGet methods:
Goffi <goffi@goffi.org>
parents: 2658
diff changeset
311 if callback is not None:
4284
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
312 kwargs["timeout"] = const_TIMEOUT
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
313 kwargs["reply_handler"] = callback
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
314 kwargs["error_handler"] = error_handler
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
315 return self.db_core_iface.contact_update(
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
316 entity_jid, name, groups, profile_key, **kwargs
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
317 )
4037
524856bd7b19 massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents: 3648
diff changeset
318
524856bd7b19 massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents: 3648
diff changeset
319 def contacts_get(self, profile_key="@DEFAULT@", callback=None, errback=None):
524856bd7b19 massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents: 3648
diff changeset
320 if callback is None:
524856bd7b19 massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents: 3648
diff changeset
321 error_handler = None
524856bd7b19 massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents: 3648
diff changeset
322 else:
524856bd7b19 massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents: 3648
diff changeset
323 if errback is None:
524856bd7b19 massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents: 3648
diff changeset
324 errback = log.error
4284
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
325 error_handler = lambda err: errback(dbus_to_bridge_exception(err))
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
326 return self.db_core_iface.contacts_get(
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
327 profile_key,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
328 timeout=const_TIMEOUT,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
329 reply_handler=callback,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
330 error_handler=error_handler,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
331 )
4037
524856bd7b19 massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents: 3648
diff changeset
332
4284
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
333 def contacts_get_from_group(
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
334 self, group, profile_key="@DEFAULT@", callback=None, errback=None
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
335 ):
4037
524856bd7b19 massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents: 3648
diff changeset
336 if callback is None:
524856bd7b19 massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents: 3648
diff changeset
337 error_handler = None
524856bd7b19 massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents: 3648
diff changeset
338 else:
524856bd7b19 massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents: 3648
diff changeset
339 if errback is None:
524856bd7b19 massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents: 3648
diff changeset
340 errback = log.error
4284
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
341 error_handler = lambda err: errback(dbus_to_bridge_exception(err))
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
342 kwargs = {}
4037
524856bd7b19 massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents: 3648
diff changeset
343 if callback is not None:
4284
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
344 kwargs["timeout"] = const_TIMEOUT
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
345 kwargs["reply_handler"] = callback
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
346 kwargs["error_handler"] = error_handler
4037
524856bd7b19 massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents: 3648
diff changeset
347 return self.db_core_iface.contacts_get_from_group(group, profile_key, **kwargs)
524856bd7b19 massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents: 3648
diff changeset
348
524856bd7b19 massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents: 3648
diff changeset
349 def devices_infos_get(self, bare_jid, profile_key, callback=None, errback=None):
524856bd7b19 massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents: 3648
diff changeset
350 if callback is None:
524856bd7b19 massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents: 3648
diff changeset
351 error_handler = None
524856bd7b19 massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents: 3648
diff changeset
352 else:
524856bd7b19 massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents: 3648
diff changeset
353 if errback is None:
524856bd7b19 massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents: 3648
diff changeset
354 errback = log.error
4284
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
355 error_handler = lambda err: errback(dbus_to_bridge_exception(err))
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
356 return str(
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
357 self.db_core_iface.devices_infos_get(
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
358 bare_jid,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
359 profile_key,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
360 timeout=const_TIMEOUT,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
361 reply_handler=callback,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
362 error_handler=error_handler,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
363 )
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
364 )
2733
e347e32aa07f core (memory/encryption): new encryptionNamespaceGet and encryptionTrustUIGet methods:
Goffi <goffi@goffi.org>
parents: 2658
diff changeset
365
4284
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
366 def disco_find_by_features(
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
367 self,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
368 namespaces,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
369 identities,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
370 bare_jid=False,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
371 service=True,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
372 roster=True,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
373 own_jid=True,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
374 local_device=False,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
375 profile_key="@DEFAULT@",
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
376 callback=None,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
377 errback=None,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
378 ):
4037
524856bd7b19 massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents: 3648
diff changeset
379 if callback is None:
524856bd7b19 massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents: 3648
diff changeset
380 error_handler = None
524856bd7b19 massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents: 3648
diff changeset
381 else:
524856bd7b19 massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents: 3648
diff changeset
382 if errback is None:
524856bd7b19 massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents: 3648
diff changeset
383 errback = log.error
4284
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
384 error_handler = lambda err: errback(dbus_to_bridge_exception(err))
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
385 return self.db_core_iface.disco_find_by_features(
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
386 namespaces,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
387 identities,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
388 bare_jid,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
389 service,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
390 roster,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
391 own_jid,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
392 local_device,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
393 profile_key,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
394 timeout=const_TIMEOUT,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
395 reply_handler=callback,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
396 error_handler=error_handler,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
397 )
4037
524856bd7b19 massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents: 3648
diff changeset
398
4284
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
399 def disco_infos(
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
400 self,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
401 entity_jid,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
402 node="",
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
403 use_cache=True,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
404 profile_key="@DEFAULT@",
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
405 callback=None,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
406 errback=None,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
407 ):
4037
524856bd7b19 massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents: 3648
diff changeset
408 if callback is None:
524856bd7b19 massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents: 3648
diff changeset
409 error_handler = None
524856bd7b19 massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents: 3648
diff changeset
410 else:
524856bd7b19 massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents: 3648
diff changeset
411 if errback is None:
524856bd7b19 massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents: 3648
diff changeset
412 errback = log.error
4284
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
413 error_handler = lambda err: errback(dbus_to_bridge_exception(err))
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
414 return self.db_core_iface.disco_infos(
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
415 entity_jid,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
416 node,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
417 use_cache,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
418 profile_key,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
419 timeout=const_TIMEOUT,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
420 reply_handler=callback,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
421 error_handler=error_handler,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
422 )
4037
524856bd7b19 massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents: 3648
diff changeset
423
4284
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
424 def disco_items(
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
425 self,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
426 entity_jid,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
427 node="",
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
428 use_cache=True,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
429 profile_key="@DEFAULT@",
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
430 callback=None,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
431 errback=None,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
432 ):
4037
524856bd7b19 massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents: 3648
diff changeset
433 if callback is None:
524856bd7b19 massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents: 3648
diff changeset
434 error_handler = None
524856bd7b19 massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents: 3648
diff changeset
435 else:
524856bd7b19 massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents: 3648
diff changeset
436 if errback is None:
524856bd7b19 massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents: 3648
diff changeset
437 errback = log.error
4284
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
438 error_handler = lambda err: errback(dbus_to_bridge_exception(err))
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
439 return self.db_core_iface.disco_items(
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
440 entity_jid,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
441 node,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
442 use_cache,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
443 profile_key,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
444 timeout=const_TIMEOUT,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
445 reply_handler=callback,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
446 error_handler=error_handler,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
447 )
4037
524856bd7b19 massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents: 3648
diff changeset
448
524856bd7b19 massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents: 3648
diff changeset
449 def disconnect(self, profile_key="@DEFAULT@", callback=None, errback=None):
524856bd7b19 massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents: 3648
diff changeset
450 if callback is None:
524856bd7b19 massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents: 3648
diff changeset
451 error_handler = None
524856bd7b19 massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents: 3648
diff changeset
452 else:
524856bd7b19 massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents: 3648
diff changeset
453 if errback is None:
524856bd7b19 massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents: 3648
diff changeset
454 errback = log.error
4284
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
455 error_handler = lambda err: errback(dbus_to_bridge_exception(err))
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
456 return self.db_core_iface.disconnect(
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
457 profile_key,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
458 timeout=const_TIMEOUT,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
459 reply_handler=callback,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
460 error_handler=error_handler,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
461 )
4037
524856bd7b19 massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents: 3648
diff changeset
462
524856bd7b19 massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents: 3648
diff changeset
463 def encryption_namespace_get(self, arg_0, callback=None, errback=None):
2658
4e130cc9bfc0 core (memore/encryption): new methods and checks:
Goffi <goffi@goffi.org>
parents: 2646
diff changeset
464 if callback is None:
4e130cc9bfc0 core (memore/encryption): new methods and checks:
Goffi <goffi@goffi.org>
parents: 2646
diff changeset
465 error_handler = None
4e130cc9bfc0 core (memore/encryption): new methods and checks:
Goffi <goffi@goffi.org>
parents: 2646
diff changeset
466 else:
4e130cc9bfc0 core (memore/encryption): new methods and checks:
Goffi <goffi@goffi.org>
parents: 2646
diff changeset
467 if errback is None:
4e130cc9bfc0 core (memore/encryption): new methods and checks:
Goffi <goffi@goffi.org>
parents: 2646
diff changeset
468 errback = log.error
4284
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
469 error_handler = lambda err: errback(dbus_to_bridge_exception(err))
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
470 kwargs = {}
2658
4e130cc9bfc0 core (memore/encryption): new methods and checks:
Goffi <goffi@goffi.org>
parents: 2646
diff changeset
471 if callback is not None:
4284
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
472 kwargs["timeout"] = const_TIMEOUT
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
473 kwargs["reply_handler"] = callback
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
474 kwargs["error_handler"] = error_handler
4037
524856bd7b19 massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents: 3648
diff changeset
475 return str(self.db_core_iface.encryption_namespace_get(arg_0, **kwargs))
2658
4e130cc9bfc0 core (memore/encryption): new methods and checks:
Goffi <goffi@goffi.org>
parents: 2646
diff changeset
476
4037
524856bd7b19 massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents: 3648
diff changeset
477 def encryption_plugins_get(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
478 if callback is None:
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
479 error_handler = None
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
480 else:
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
481 if errback is None:
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
482 errback = log.error
4284
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
483 error_handler = lambda err: errback(dbus_to_bridge_exception(err))
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
484 kwargs = {}
1290
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
485 if callback is not None:
4284
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
486 kwargs["timeout"] = const_TIMEOUT
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
487 kwargs["reply_handler"] = callback
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
488 kwargs["error_handler"] = error_handler
4037
524856bd7b19 massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents: 3648
diff changeset
489 return str(self.db_core_iface.encryption_plugins_get(**kwargs))
364
312ca6f9d84a core: configuration file
Goffi <goffi@goffi.org>
parents: 362
diff changeset
490
4284
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
491 def encryption_trust_ui_get(
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
492 self, to_jid, namespace, profile_key, callback=None, errback=None
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
493 ):
1290
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
494 if callback is None:
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
495 error_handler = None
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
496 else:
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
497 if errback is None:
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
498 errback = log.error
4284
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
499 error_handler = lambda err: errback(dbus_to_bridge_exception(err))
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
500 return str(
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
501 self.db_core_iface.encryption_trust_ui_get(
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
502 to_jid,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
503 namespace,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
504 profile_key,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
505 timeout=const_TIMEOUT,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
506 reply_handler=callback,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
507 error_handler=error_handler,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
508 )
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
509 )
272
1d2e0dfe7114 bridge: core & frontend sides of bridge are now generated
Goffi <goffi@goffi.org>
parents: 267
diff changeset
510
4037
524856bd7b19 massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents: 3648
diff changeset
511 def entities_data_get(self, jids, keys, 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
512 if callback is None:
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
513 error_handler = None
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
514 else:
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
515 if errback is None:
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
516 errback = log.error
4284
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
517 error_handler = lambda err: errback(dbus_to_bridge_exception(err))
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
518 kwargs = {}
1290
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
519 if callback is not None:
4284
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
520 kwargs["timeout"] = const_TIMEOUT
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
521 kwargs["reply_handler"] = callback
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
522 kwargs["error_handler"] = error_handler
4037
524856bd7b19 massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents: 3648
diff changeset
523 return self.db_core_iface.entities_data_get(jids, keys, profile, **kwargs)
501
e9634d2e7b38 core, quick_frontend, primitivus, wix: Contacts List refactoring phase 1:
Goffi <goffi@goffi.org>
parents: 492
diff changeset
524
4037
524856bd7b19 massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents: 3648
diff changeset
525 def entity_data_get(self, jid, keys, profile, callback=None, errback=None):
1314
bb9c32249778 core: added getEntitiesData which get cache data for several entities at once
Goffi <goffi@goffi.org>
parents: 1290
diff changeset
526 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
527 error_handler = None
bb9c32249778 core: added getEntitiesData which get cache data for several entities at once
Goffi <goffi@goffi.org>
parents: 1290
diff changeset
528 else:
bb9c32249778 core: added getEntitiesData which get cache data for several entities at once
Goffi <goffi@goffi.org>
parents: 1290
diff changeset
529 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
530 errback = log.error
4284
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
531 error_handler = lambda err: errback(dbus_to_bridge_exception(err))
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
532 kwargs = {}
1314
bb9c32249778 core: added getEntitiesData which get cache data for several entities at once
Goffi <goffi@goffi.org>
parents: 1290
diff changeset
533 if callback is not None:
4284
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
534 kwargs["timeout"] = const_TIMEOUT
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
535 kwargs["reply_handler"] = callback
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
536 kwargs["error_handler"] = error_handler
4037
524856bd7b19 massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents: 3648
diff changeset
537 return self.db_core_iface.entity_data_get(jid, keys, profile, **kwargs)
1314
bb9c32249778 core: added getEntitiesData which get cache data for several entities at once
Goffi <goffi@goffi.org>
parents: 1290
diff changeset
538
4037
524856bd7b19 massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents: 3648
diff changeset
539 def features_get(self, profile_key, 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
540 if callback is None:
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
541 error_handler = None
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
542 else:
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
543 if errback is None:
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
544 errback = log.error
4284
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
545 error_handler = lambda err: errback(dbus_to_bridge_exception(err))
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
546 return self.db_core_iface.features_get(
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
547 profile_key,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
548 timeout=const_TIMEOUT,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
549 reply_handler=callback,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
550 error_handler=error_handler,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
551 )
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
552
4284
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
553 def history_get(
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
554 self,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
555 from_jid,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
556 to_jid,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
557 limit,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
558 between=True,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
559 filters="",
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
560 profile="@NONE@",
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
561 callback=None,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
562 errback=None,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
563 ):
1482
80cd55dd5b04 core, bridge: added getFeatures method:
Goffi <goffi@goffi.org>
parents: 1396
diff changeset
564 if callback is None:
80cd55dd5b04 core, bridge: added getFeatures method:
Goffi <goffi@goffi.org>
parents: 1396
diff changeset
565 error_handler = None
80cd55dd5b04 core, bridge: added getFeatures method:
Goffi <goffi@goffi.org>
parents: 1396
diff changeset
566 else:
80cd55dd5b04 core, bridge: added getFeatures method:
Goffi <goffi@goffi.org>
parents: 1396
diff changeset
567 if errback is None:
80cd55dd5b04 core, bridge: added getFeatures method:
Goffi <goffi@goffi.org>
parents: 1396
diff changeset
568 errback = log.error
4284
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
569 error_handler = lambda err: errback(dbus_to_bridge_exception(err))
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
570 return self.db_core_iface.history_get(
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
571 from_jid,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
572 to_jid,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
573 limit,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
574 between,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
575 filters,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
576 profile,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
577 timeout=const_TIMEOUT,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
578 reply_handler=callback,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
579 error_handler=error_handler,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
580 )
1482
80cd55dd5b04 core, bridge: added getFeatures method:
Goffi <goffi@goffi.org>
parents: 1396
diff changeset
581
4037
524856bd7b19 massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents: 3648
diff changeset
582 def image_check(self, arg_0, 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
583 if callback is None:
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
584 error_handler = None
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
585 else:
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
586 if errback is None:
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
587 errback = log.error
4284
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
588 error_handler = lambda err: errback(dbus_to_bridge_exception(err))
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
589 kwargs = {}
1290
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
590 if callback is not None:
4284
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
591 kwargs["timeout"] = const_TIMEOUT
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
592 kwargs["reply_handler"] = callback
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
593 kwargs["error_handler"] = error_handler
4037
524856bd7b19 massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents: 3648
diff changeset
594 return str(self.db_core_iface.image_check(arg_0, **kwargs))
399
3ed53803b3b3 core: added getLastResource method
Goffi <goffi@goffi.org>
parents: 387
diff changeset
595
4037
524856bd7b19 massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents: 3648
diff changeset
596 def image_convert(self, source, dest, arg_2, extra, 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
597 if callback is None:
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
598 error_handler = None
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
599 else:
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
600 if errback is None:
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
601 errback = log.error
4284
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
602 error_handler = lambda err: errback(dbus_to_bridge_exception(err))
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
603 return str(
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
604 self.db_core_iface.image_convert(
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
605 source,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
606 dest,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
607 arg_2,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
608 extra,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
609 timeout=const_TIMEOUT,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
610 reply_handler=callback,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
611 error_handler=error_handler,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
612 )
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
613 )
4037
524856bd7b19 massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents: 3648
diff changeset
614
4284
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
615 def image_generate_preview(
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
616 self, image_path, profile_key, callback=None, errback=None
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
617 ):
4037
524856bd7b19 massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents: 3648
diff changeset
618 if callback is None:
524856bd7b19 massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents: 3648
diff changeset
619 error_handler = None
524856bd7b19 massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents: 3648
diff changeset
620 else:
524856bd7b19 massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents: 3648
diff changeset
621 if errback is None:
524856bd7b19 massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents: 3648
diff changeset
622 errback = log.error
4284
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
623 error_handler = lambda err: errback(dbus_to_bridge_exception(err))
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
624 return str(
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
625 self.db_core_iface.image_generate_preview(
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
626 image_path,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
627 profile_key,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
628 timeout=const_TIMEOUT,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
629 reply_handler=callback,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
630 error_handler=error_handler,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
631 )
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
632 )
272
1d2e0dfe7114 bridge: core & frontend sides of bridge are now generated
Goffi <goffi@goffi.org>
parents: 267
diff changeset
633
4037
524856bd7b19 massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents: 3648
diff changeset
634 def image_resize(self, image_path, width, height, callback=None, errback=None):
524856bd7b19 massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents: 3648
diff changeset
635 if callback is None:
524856bd7b19 massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents: 3648
diff changeset
636 error_handler = None
524856bd7b19 massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents: 3648
diff changeset
637 else:
524856bd7b19 massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents: 3648
diff changeset
638 if errback is None:
524856bd7b19 massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents: 3648
diff changeset
639 errback = log.error
4284
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
640 error_handler = lambda err: errback(dbus_to_bridge_exception(err))
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
641 return str(
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
642 self.db_core_iface.image_resize(
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
643 image_path,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
644 width,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
645 height,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
646 timeout=const_TIMEOUT,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
647 reply_handler=callback,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
648 error_handler=error_handler,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
649 )
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
650 )
4037
524856bd7b19 massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents: 3648
diff changeset
651
4193
730f542e4ad0 core: add new `init_script_path` option:
Goffi <goffi@goffi.org>
parents: 4147
diff changeset
652 def init_pre_script(self, callback=None, errback=None):
730f542e4ad0 core: add new `init_script_path` option:
Goffi <goffi@goffi.org>
parents: 4147
diff changeset
653 if callback is None:
730f542e4ad0 core: add new `init_script_path` option:
Goffi <goffi@goffi.org>
parents: 4147
diff changeset
654 error_handler = None
730f542e4ad0 core: add new `init_script_path` option:
Goffi <goffi@goffi.org>
parents: 4147
diff changeset
655 else:
730f542e4ad0 core: add new `init_script_path` option:
Goffi <goffi@goffi.org>
parents: 4147
diff changeset
656 if errback is None:
730f542e4ad0 core: add new `init_script_path` option:
Goffi <goffi@goffi.org>
parents: 4147
diff changeset
657 errback = log.error
4284
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
658 error_handler = lambda err: errback(dbus_to_bridge_exception(err))
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
659 return self.db_core_iface.init_pre_script(
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
660 timeout=const_TIMEOUT, reply_handler=callback, error_handler=error_handler
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
661 )
4193
730f542e4ad0 core: add new `init_script_path` option:
Goffi <goffi@goffi.org>
parents: 4147
diff changeset
662
4037
524856bd7b19 massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents: 3648
diff changeset
663 def is_connected(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
664 if callback is None:
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
665 error_handler = None
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
666 else:
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
667 if errback is None:
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
668 errback = log.error
4284
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
669 error_handler = lambda err: errback(dbus_to_bridge_exception(err))
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
670 kwargs = {}
1290
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
671 if callback is not None:
4284
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
672 kwargs["timeout"] = const_TIMEOUT
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
673 kwargs["reply_handler"] = callback
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
674 kwargs["error_handler"] = error_handler
4037
524856bd7b19 massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents: 3648
diff changeset
675 return self.db_core_iface.is_connected(profile_key, **kwargs)
272
1d2e0dfe7114 bridge: core & frontend sides of bridge are now generated
Goffi <goffi@goffi.org>
parents: 267
diff changeset
676
4284
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
677 def main_resource_get(
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
678 self, contact_jid, profile_key="@DEFAULT@", callback=None, errback=None
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
679 ):
1290
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
680 if callback is None:
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
681 error_handler = None
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
682 else:
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
683 if errback is None:
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
684 errback = log.error
4284
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
685 error_handler = lambda err: errback(dbus_to_bridge_exception(err))
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
686 kwargs = {}
1290
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
687 if callback is not None:
4284
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
688 kwargs["timeout"] = const_TIMEOUT
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
689 kwargs["reply_handler"] = callback
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
690 kwargs["error_handler"] = error_handler
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
691 return str(
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
692 self.db_core_iface.main_resource_get(contact_jid, profile_key, **kwargs)
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
693 )
272
1d2e0dfe7114 bridge: core & frontend sides of bridge are now generated
Goffi <goffi@goffi.org>
parents: 267
diff changeset
694
4037
524856bd7b19 massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents: 3648
diff changeset
695 def menu_help_get(self, menu_id, language, 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
696 if callback is None:
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
697 error_handler = None
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
698 else:
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
699 if errback is None:
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
700 errback = log.error
4284
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
701 error_handler = lambda err: errback(dbus_to_bridge_exception(err))
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
702 kwargs = {}
1290
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
703 if callback is not None:
4284
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
704 kwargs["timeout"] = const_TIMEOUT
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
705 kwargs["reply_handler"] = callback
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
706 kwargs["error_handler"] = error_handler
4037
524856bd7b19 massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents: 3648
diff changeset
707 return str(self.db_core_iface.menu_help_get(menu_id, language, **kwargs))
272
1d2e0dfe7114 bridge: core & frontend sides of bridge are now generated
Goffi <goffi@goffi.org>
parents: 267
diff changeset
708
4284
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
709 def menu_launch(
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
710 self,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
711 menu_type,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
712 path,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
713 data,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
714 security_limit,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
715 profile_key,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
716 callback=None,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
717 errback=None,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
718 ):
4037
524856bd7b19 massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents: 3648
diff changeset
719 if callback is None:
524856bd7b19 massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents: 3648
diff changeset
720 error_handler = None
524856bd7b19 massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents: 3648
diff changeset
721 else:
524856bd7b19 massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents: 3648
diff changeset
722 if errback is None:
524856bd7b19 massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents: 3648
diff changeset
723 errback = log.error
4284
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
724 error_handler = lambda err: errback(dbus_to_bridge_exception(err))
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
725 return self.db_core_iface.menu_launch(
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
726 menu_type,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
727 path,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
728 data,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
729 security_limit,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
730 profile_key,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
731 timeout=const_TIMEOUT,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
732 reply_handler=callback,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
733 error_handler=error_handler,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
734 )
4037
524856bd7b19 massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents: 3648
diff changeset
735
524856bd7b19 massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents: 3648
diff changeset
736 def menus_get(self, language, security_limit, 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
737 if callback is None:
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
738 error_handler = None
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
739 else:
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
740 if errback is None:
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
741 errback = log.error
4284
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
742 error_handler = lambda err: errback(dbus_to_bridge_exception(err))
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
743 kwargs = {}
1290
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
744 if callback is not None:
4284
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
745 kwargs["timeout"] = const_TIMEOUT
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
746 kwargs["reply_handler"] = callback
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
747 kwargs["error_handler"] = error_handler
4037
524856bd7b19 massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents: 3648
diff changeset
748 return self.db_core_iface.menus_get(language, security_limit, **kwargs)
272
1d2e0dfe7114 bridge: core & frontend sides of bridge are now generated
Goffi <goffi@goffi.org>
parents: 267
diff changeset
749
4037
524856bd7b19 massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents: 3648
diff changeset
750 def message_encryption_get(self, to_jid, profile_key, callback=None, errback=None):
3066
2cc2f65379f7 core: added imageCheck and imageResize methods:
Goffi <goffi@goffi.org>
parents: 3042
diff changeset
751 if callback is None:
2cc2f65379f7 core: added imageCheck and imageResize methods:
Goffi <goffi@goffi.org>
parents: 3042
diff changeset
752 error_handler = None
2cc2f65379f7 core: added imageCheck and imageResize methods:
Goffi <goffi@goffi.org>
parents: 3042
diff changeset
753 else:
2cc2f65379f7 core: added imageCheck and imageResize methods:
Goffi <goffi@goffi.org>
parents: 3042
diff changeset
754 if errback is None:
2cc2f65379f7 core: added imageCheck and imageResize methods:
Goffi <goffi@goffi.org>
parents: 3042
diff changeset
755 errback = log.error
4284
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
756 error_handler = lambda err: errback(dbus_to_bridge_exception(err))
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
757 kwargs = {}
3066
2cc2f65379f7 core: added imageCheck and imageResize methods:
Goffi <goffi@goffi.org>
parents: 3042
diff changeset
758 if callback is not None:
4284
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
759 kwargs["timeout"] = const_TIMEOUT
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
760 kwargs["reply_handler"] = callback
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
761 kwargs["error_handler"] = error_handler
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
762 return str(
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
763 self.db_core_iface.message_encryption_get(to_jid, profile_key, **kwargs)
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
764 )
3066
2cc2f65379f7 core: added imageCheck and imageResize methods:
Goffi <goffi@goffi.org>
parents: 3042
diff changeset
765
4284
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
766 def message_encryption_start(
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
767 self,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
768 to_jid,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
769 namespace="",
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
770 replace=False,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
771 profile_key="@NONE@",
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
772 callback=None,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
773 errback=None,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
774 ):
3259
f300d78f08f3 core: image convertion + SVG support:
Goffi <goffi@goffi.org>
parents: 3254
diff changeset
775 if callback is None:
f300d78f08f3 core: image convertion + SVG support:
Goffi <goffi@goffi.org>
parents: 3254
diff changeset
776 error_handler = None
f300d78f08f3 core: image convertion + SVG support:
Goffi <goffi@goffi.org>
parents: 3254
diff changeset
777 else:
f300d78f08f3 core: image convertion + SVG support:
Goffi <goffi@goffi.org>
parents: 3254
diff changeset
778 if errback is None:
f300d78f08f3 core: image convertion + SVG support:
Goffi <goffi@goffi.org>
parents: 3254
diff changeset
779 errback = log.error
4284
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
780 error_handler = lambda err: errback(dbus_to_bridge_exception(err))
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
781 return self.db_core_iface.message_encryption_start(
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
782 to_jid,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
783 namespace,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
784 replace,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
785 profile_key,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
786 timeout=const_TIMEOUT,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
787 reply_handler=callback,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
788 error_handler=error_handler,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
789 )
3259
f300d78f08f3 core: image convertion + SVG support:
Goffi <goffi@goffi.org>
parents: 3254
diff changeset
790
4037
524856bd7b19 massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents: 3648
diff changeset
791 def message_encryption_stop(self, to_jid, profile_key, callback=None, errback=None):
3201
439e2f88c3a9 core, bridge: new `imageGeneratePreview` helped method to generate a thumbnail
Goffi <goffi@goffi.org>
parents: 3163
diff changeset
792 if callback is None:
439e2f88c3a9 core, bridge: new `imageGeneratePreview` helped method to generate a thumbnail
Goffi <goffi@goffi.org>
parents: 3163
diff changeset
793 error_handler = None
439e2f88c3a9 core, bridge: new `imageGeneratePreview` helped method to generate a thumbnail
Goffi <goffi@goffi.org>
parents: 3163
diff changeset
794 else:
439e2f88c3a9 core, bridge: new `imageGeneratePreview` helped method to generate a thumbnail
Goffi <goffi@goffi.org>
parents: 3163
diff changeset
795 if errback is None:
439e2f88c3a9 core, bridge: new `imageGeneratePreview` helped method to generate a thumbnail
Goffi <goffi@goffi.org>
parents: 3163
diff changeset
796 errback = log.error
4284
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
797 error_handler = lambda err: errback(dbus_to_bridge_exception(err))
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
798 return self.db_core_iface.message_encryption_stop(
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
799 to_jid,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
800 profile_key,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
801 timeout=const_TIMEOUT,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
802 reply_handler=callback,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
803 error_handler=error_handler,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
804 )
3201
439e2f88c3a9 core, bridge: new `imageGeneratePreview` helped method to generate a thumbnail
Goffi <goffi@goffi.org>
parents: 3163
diff changeset
805
4284
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
806 def message_send(
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
807 self,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
808 to_jid,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
809 message,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
810 subject={},
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
811 mess_type="auto",
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
812 extra={},
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
813 profile_key="@NONE@",
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
814 callback=None,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
815 errback=None,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
816 ):
3066
2cc2f65379f7 core: added imageCheck and imageResize methods:
Goffi <goffi@goffi.org>
parents: 3042
diff changeset
817 if callback is None:
2cc2f65379f7 core: added imageCheck and imageResize methods:
Goffi <goffi@goffi.org>
parents: 3042
diff changeset
818 error_handler = None
2cc2f65379f7 core: added imageCheck and imageResize methods:
Goffi <goffi@goffi.org>
parents: 3042
diff changeset
819 else:
2cc2f65379f7 core: added imageCheck and imageResize methods:
Goffi <goffi@goffi.org>
parents: 3042
diff changeset
820 if errback is None:
2cc2f65379f7 core: added imageCheck and imageResize methods:
Goffi <goffi@goffi.org>
parents: 3042
diff changeset
821 errback = log.error
4284
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
822 error_handler = lambda err: errback(dbus_to_bridge_exception(err))
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
823 return self.db_core_iface.message_send(
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
824 to_jid,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
825 message,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
826 subject,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
827 mess_type,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
828 extra,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
829 profile_key,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
830 timeout=const_TIMEOUT,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
831 reply_handler=callback,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
832 error_handler=error_handler,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
833 )
3066
2cc2f65379f7 core: added imageCheck and imageResize methods:
Goffi <goffi@goffi.org>
parents: 3042
diff changeset
834
4037
524856bd7b19 massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents: 3648
diff changeset
835 def namespaces_get(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
836 if callback is None:
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
837 error_handler = None
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
838 else:
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
839 if errback is None:
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
840 errback = log.error
4284
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
841 error_handler = lambda err: errback(dbus_to_bridge_exception(err))
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
842 kwargs = {}
1290
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
843 if callback is not None:
4284
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
844 kwargs["timeout"] = const_TIMEOUT
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
845 kwargs["reply_handler"] = callback
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
846 kwargs["error_handler"] = error_handler
4037
524856bd7b19 massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents: 3648
diff changeset
847 return self.db_core_iface.namespaces_get(**kwargs)
272
1d2e0dfe7114 bridge: core & frontend sides of bridge are now generated
Goffi <goffi@goffi.org>
parents: 267
diff changeset
848
4284
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
849 def notification_add(
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
850 self,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
851 type_,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
852 body_plain,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
853 body_rich,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
854 title,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
855 is_global,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
856 requires_action,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
857 arg_6,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
858 priority,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
859 expire_at,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
860 extra,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
861 callback=None,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
862 errback=None,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
863 ):
4130
02f0adc745c6 core: notifications implementation, first draft:
Goffi <goffi@goffi.org>
parents: 4074
diff changeset
864 if callback is None:
02f0adc745c6 core: notifications implementation, first draft:
Goffi <goffi@goffi.org>
parents: 4074
diff changeset
865 error_handler = None
02f0adc745c6 core: notifications implementation, first draft:
Goffi <goffi@goffi.org>
parents: 4074
diff changeset
866 else:
02f0adc745c6 core: notifications implementation, first draft:
Goffi <goffi@goffi.org>
parents: 4074
diff changeset
867 if errback is None:
02f0adc745c6 core: notifications implementation, first draft:
Goffi <goffi@goffi.org>
parents: 4074
diff changeset
868 errback = log.error
4284
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
869 error_handler = lambda err: errback(dbus_to_bridge_exception(err))
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
870 kwargs = {}
4130
02f0adc745c6 core: notifications implementation, first draft:
Goffi <goffi@goffi.org>
parents: 4074
diff changeset
871 if callback is not None:
4284
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
872 kwargs["timeout"] = const_TIMEOUT
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
873 kwargs["reply_handler"] = callback
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
874 kwargs["error_handler"] = error_handler
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
875 return self.db_core_iface.notification_add(
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
876 type_,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
877 body_plain,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
878 body_rich,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
879 title,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
880 is_global,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
881 requires_action,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
882 arg_6,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
883 priority,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
884 expire_at,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
885 extra,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
886 **kwargs,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
887 )
4130
02f0adc745c6 core: notifications implementation, first draft:
Goffi <goffi@goffi.org>
parents: 4074
diff changeset
888
4284
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
889 def notification_delete(
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
890 self, id_, is_global, profile_key, callback=None, errback=None
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
891 ):
4130
02f0adc745c6 core: notifications implementation, first draft:
Goffi <goffi@goffi.org>
parents: 4074
diff changeset
892 if callback is None:
02f0adc745c6 core: notifications implementation, first draft:
Goffi <goffi@goffi.org>
parents: 4074
diff changeset
893 error_handler = None
02f0adc745c6 core: notifications implementation, first draft:
Goffi <goffi@goffi.org>
parents: 4074
diff changeset
894 else:
02f0adc745c6 core: notifications implementation, first draft:
Goffi <goffi@goffi.org>
parents: 4074
diff changeset
895 if errback is None:
02f0adc745c6 core: notifications implementation, first draft:
Goffi <goffi@goffi.org>
parents: 4074
diff changeset
896 errback = log.error
4284
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
897 error_handler = lambda err: errback(dbus_to_bridge_exception(err))
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
898 kwargs = {}
4130
02f0adc745c6 core: notifications implementation, first draft:
Goffi <goffi@goffi.org>
parents: 4074
diff changeset
899 if callback is not None:
4284
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
900 kwargs["timeout"] = const_TIMEOUT
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
901 kwargs["reply_handler"] = callback
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
902 kwargs["error_handler"] = error_handler
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
903 return self.db_core_iface.notification_delete(
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
904 id_, is_global, profile_key, **kwargs
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
905 )
4130
02f0adc745c6 core: notifications implementation, first draft:
Goffi <goffi@goffi.org>
parents: 4074
diff changeset
906
4284
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
907 def notifications_expired_clean(
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
908 self, limit_timestamp, profile_key, callback=None, errback=None
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
909 ):
4130
02f0adc745c6 core: notifications implementation, first draft:
Goffi <goffi@goffi.org>
parents: 4074
diff changeset
910 if callback is None:
02f0adc745c6 core: notifications implementation, first draft:
Goffi <goffi@goffi.org>
parents: 4074
diff changeset
911 error_handler = None
02f0adc745c6 core: notifications implementation, first draft:
Goffi <goffi@goffi.org>
parents: 4074
diff changeset
912 else:
02f0adc745c6 core: notifications implementation, first draft:
Goffi <goffi@goffi.org>
parents: 4074
diff changeset
913 if errback is None:
02f0adc745c6 core: notifications implementation, first draft:
Goffi <goffi@goffi.org>
parents: 4074
diff changeset
914 errback = log.error
4284
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
915 error_handler = lambda err: errback(dbus_to_bridge_exception(err))
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
916 kwargs = {}
4130
02f0adc745c6 core: notifications implementation, first draft:
Goffi <goffi@goffi.org>
parents: 4074
diff changeset
917 if callback is not None:
4284
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
918 kwargs["timeout"] = const_TIMEOUT
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
919 kwargs["reply_handler"] = callback
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
920 kwargs["error_handler"] = error_handler
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
921 return self.db_core_iface.notifications_expired_clean(
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
922 limit_timestamp, profile_key, **kwargs
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
923 )
4130
02f0adc745c6 core: notifications implementation, first draft:
Goffi <goffi@goffi.org>
parents: 4074
diff changeset
924
02f0adc745c6 core: notifications implementation, first draft:
Goffi <goffi@goffi.org>
parents: 4074
diff changeset
925 def notifications_get(self, filters, profile_key, callback=None, errback=None):
02f0adc745c6 core: notifications implementation, first draft:
Goffi <goffi@goffi.org>
parents: 4074
diff changeset
926 if callback is None:
02f0adc745c6 core: notifications implementation, first draft:
Goffi <goffi@goffi.org>
parents: 4074
diff changeset
927 error_handler = None
02f0adc745c6 core: notifications implementation, first draft:
Goffi <goffi@goffi.org>
parents: 4074
diff changeset
928 else:
02f0adc745c6 core: notifications implementation, first draft:
Goffi <goffi@goffi.org>
parents: 4074
diff changeset
929 if errback is None:
02f0adc745c6 core: notifications implementation, first draft:
Goffi <goffi@goffi.org>
parents: 4074
diff changeset
930 errback = log.error
4284
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
931 error_handler = lambda err: errback(dbus_to_bridge_exception(err))
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
932 kwargs = {}
4130
02f0adc745c6 core: notifications implementation, first draft:
Goffi <goffi@goffi.org>
parents: 4074
diff changeset
933 if callback is not None:
4284
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
934 kwargs["timeout"] = const_TIMEOUT
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
935 kwargs["reply_handler"] = callback
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
936 kwargs["error_handler"] = error_handler
4130
02f0adc745c6 core: notifications implementation, first draft:
Goffi <goffi@goffi.org>
parents: 4074
diff changeset
937 return str(self.db_core_iface.notifications_get(filters, profile_key, **kwargs))
02f0adc745c6 core: notifications implementation, first draft:
Goffi <goffi@goffi.org>
parents: 4074
diff changeset
938
4284
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
939 def param_get_a(
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
940 self,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
941 name,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
942 category,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
943 attribute="value",
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
944 profile_key="@DEFAULT@",
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
945 callback=None,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
946 errback=None,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
947 ):
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
948 if callback is None:
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
949 error_handler = None
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
950 else:
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
951 if errback is None:
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
952 errback = log.error
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
953 error_handler = lambda err: errback(dbus_to_bridge_exception(err))
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
954 kwargs = {}
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
955 if callback is not None:
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
956 kwargs["timeout"] = const_TIMEOUT
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
957 kwargs["reply_handler"] = callback
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
958 kwargs["error_handler"] = error_handler
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
959 return str(
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
960 self.db_core_iface.param_get_a(
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
961 name, category, attribute, profile_key, **kwargs
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
962 )
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
963 )
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
964
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
965 def param_get_a_async(
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
966 self,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
967 name,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
968 category,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
969 attribute="value",
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
970 security_limit=-1,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
971 profile_key="@DEFAULT@",
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
972 callback=None,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
973 errback=None,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
974 ):
1290
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
975 if callback is None:
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
976 error_handler = None
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
977 else:
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
978 if errback is None:
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
979 errback = log.error
4284
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
980 error_handler = lambda err: errback(dbus_to_bridge_exception(err))
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
981 return str(
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
982 self.db_core_iface.param_get_a_async(
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
983 name,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
984 category,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
985 attribute,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
986 security_limit,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
987 profile_key,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
988 timeout=const_TIMEOUT,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
989 reply_handler=callback,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
990 error_handler=error_handler,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
991 )
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
992 )
1015
fee00f2e11c2 memory, jp: added jp commands to load/save parameters template
souliane <souliane@mailoo.org>
parents: 993
diff changeset
993
4284
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
994 def param_set(
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
995 self,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
996 name,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
997 value,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
998 category,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
999 security_limit=-1,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
1000 profile_key="@DEFAULT@",
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
1001 callback=None,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
1002 errback=None,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
1003 ):
4037
524856bd7b19 massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents: 3648
diff changeset
1004 if callback is None:
524856bd7b19 massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents: 3648
diff changeset
1005 error_handler = None
524856bd7b19 massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents: 3648
diff changeset
1006 else:
524856bd7b19 massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents: 3648
diff changeset
1007 if errback is None:
524856bd7b19 massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents: 3648
diff changeset
1008 errback = log.error
4284
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
1009 error_handler = lambda err: errback(dbus_to_bridge_exception(err))
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
1010 kwargs = {}
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
1011 if callback is not None:
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
1012 kwargs["timeout"] = const_TIMEOUT
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
1013 kwargs["reply_handler"] = callback
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
1014 kwargs["error_handler"] = error_handler
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
1015 return self.db_core_iface.param_set(
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
1016 name, value, category, security_limit, profile_key, **kwargs
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
1017 )
4037
524856bd7b19 massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents: 3648
diff changeset
1018
4284
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
1019 def param_ui_get(
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
1020 self,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
1021 security_limit=-1,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
1022 app="",
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
1023 extra="",
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
1024 profile_key="@DEFAULT@",
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
1025 callback=None,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
1026 errback=None,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
1027 ):
2126
2f264f3df280 core (menus): improvments:
Goffi <goffi@goffi.org>
parents: 2113
diff changeset
1028 if callback is None:
2f264f3df280 core (menus): improvments:
Goffi <goffi@goffi.org>
parents: 2113
diff changeset
1029 error_handler = None
2f264f3df280 core (menus): improvments:
Goffi <goffi@goffi.org>
parents: 2113
diff changeset
1030 else:
2f264f3df280 core (menus): improvments:
Goffi <goffi@goffi.org>
parents: 2113
diff changeset
1031 if errback is None:
2f264f3df280 core (menus): improvments:
Goffi <goffi@goffi.org>
parents: 2113
diff changeset
1032 errback = log.error
4284
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
1033 error_handler = lambda err: errback(dbus_to_bridge_exception(err))
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
1034 return str(
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
1035 self.db_core_iface.param_ui_get(
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
1036 security_limit,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
1037 app,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
1038 extra,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
1039 profile_key,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
1040 timeout=const_TIMEOUT,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
1041 reply_handler=callback,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
1042 error_handler=error_handler,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
1043 )
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
1044 )
2126
2f264f3df280 core (menus): improvments:
Goffi <goffi@goffi.org>
parents: 2113
diff changeset
1045
4037
524856bd7b19 massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents: 3648
diff changeset
1046 def params_categories_get(self, callback=None, errback=None):
2126
2f264f3df280 core (menus): improvments:
Goffi <goffi@goffi.org>
parents: 2113
diff changeset
1047 if callback is None:
2f264f3df280 core (menus): improvments:
Goffi <goffi@goffi.org>
parents: 2113
diff changeset
1048 error_handler = None
2f264f3df280 core (menus): improvments:
Goffi <goffi@goffi.org>
parents: 2113
diff changeset
1049 else:
2f264f3df280 core (menus): improvments:
Goffi <goffi@goffi.org>
parents: 2113
diff changeset
1050 if errback is None:
2f264f3df280 core (menus): improvments:
Goffi <goffi@goffi.org>
parents: 2113
diff changeset
1051 errback = log.error
4284
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
1052 error_handler = lambda err: errback(dbus_to_bridge_exception(err))
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
1053 kwargs = {}
2126
2f264f3df280 core (menus): improvments:
Goffi <goffi@goffi.org>
parents: 2113
diff changeset
1054 if callback is not None:
4284
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
1055 kwargs["timeout"] = const_TIMEOUT
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
1056 kwargs["reply_handler"] = callback
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
1057 kwargs["error_handler"] = error_handler
4037
524856bd7b19 massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents: 3648
diff changeset
1058 return self.db_core_iface.params_categories_get(**kwargs)
2126
2f264f3df280 core (menus): improvments:
Goffi <goffi@goffi.org>
parents: 2113
diff changeset
1059
4284
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
1060 def params_register_app(
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
1061 self, xml, security_limit=-1, app="", callback=None, errback=None
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
1062 ):
2646
712cb4ff3e13 core: new EncryptionHandler class which manage encrypted session as a core feature:
Goffi <goffi@goffi.org>
parents: 2628
diff changeset
1063 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
1064 error_handler = None
712cb4ff3e13 core: new EncryptionHandler class which manage encrypted session as a core feature:
Goffi <goffi@goffi.org>
parents: 2628
diff changeset
1065 else:
712cb4ff3e13 core: new EncryptionHandler class which manage encrypted session as a core feature:
Goffi <goffi@goffi.org>
parents: 2628
diff changeset
1066 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
1067 errback = log.error
4284
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
1068 error_handler = lambda err: errback(dbus_to_bridge_exception(err))
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
1069 kwargs = {}
2646
712cb4ff3e13 core: new EncryptionHandler class which manage encrypted session as a core feature:
Goffi <goffi@goffi.org>
parents: 2628
diff changeset
1070 if callback is not None:
4284
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
1071 kwargs["timeout"] = const_TIMEOUT
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
1072 kwargs["reply_handler"] = callback
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
1073 kwargs["error_handler"] = error_handler
4037
524856bd7b19 massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents: 3648
diff changeset
1074 return self.db_core_iface.params_register_app(xml, security_limit, app, **kwargs)
2658
4e130cc9bfc0 core (memore/encryption): new methods and checks:
Goffi <goffi@goffi.org>
parents: 2646
diff changeset
1075
4037
524856bd7b19 massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents: 3648
diff changeset
1076 def params_template_load(self, filename, callback=None, errback=None):
2443
81a45e7886c9 core: added a mechanism to associate short names to namespaces:
Goffi <goffi@goffi.org>
parents: 2414
diff changeset
1077 if callback is None:
81a45e7886c9 core: added a mechanism to associate short names to namespaces:
Goffi <goffi@goffi.org>
parents: 2414
diff changeset
1078 error_handler = None
81a45e7886c9 core: added a mechanism to associate short names to namespaces:
Goffi <goffi@goffi.org>
parents: 2414
diff changeset
1079 else:
81a45e7886c9 core: added a mechanism to associate short names to namespaces:
Goffi <goffi@goffi.org>
parents: 2414
diff changeset
1080 if errback is None:
81a45e7886c9 core: added a mechanism to associate short names to namespaces:
Goffi <goffi@goffi.org>
parents: 2414
diff changeset
1081 errback = log.error
4284
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
1082 error_handler = lambda err: errback(dbus_to_bridge_exception(err))
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
1083 kwargs = {}
2443
81a45e7886c9 core: added a mechanism to associate short names to namespaces:
Goffi <goffi@goffi.org>
parents: 2414
diff changeset
1084 if callback is not None:
4284
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
1085 kwargs["timeout"] = const_TIMEOUT
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
1086 kwargs["reply_handler"] = callback
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
1087 kwargs["error_handler"] = error_handler
4037
524856bd7b19 massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents: 3648
diff changeset
1088 return self.db_core_iface.params_template_load(filename, **kwargs)
524856bd7b19 massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents: 3648
diff changeset
1089
524856bd7b19 massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents: 3648
diff changeset
1090 def params_template_save(self, filename, callback=None, errback=None):
524856bd7b19 massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents: 3648
diff changeset
1091 if callback is None:
524856bd7b19 massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents: 3648
diff changeset
1092 error_handler = None
524856bd7b19 massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents: 3648
diff changeset
1093 else:
524856bd7b19 massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents: 3648
diff changeset
1094 if errback is None:
524856bd7b19 massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents: 3648
diff changeset
1095 errback = log.error
4284
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
1096 error_handler = lambda err: errback(dbus_to_bridge_exception(err))
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
1097 kwargs = {}
4037
524856bd7b19 massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents: 3648
diff changeset
1098 if callback is not None:
4284
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
1099 kwargs["timeout"] = const_TIMEOUT
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
1100 kwargs["reply_handler"] = callback
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
1101 kwargs["error_handler"] = error_handler
4037
524856bd7b19 massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents: 3648
diff changeset
1102 return self.db_core_iface.params_template_save(filename, **kwargs)
2443
81a45e7886c9 core: added a mechanism to associate short names to namespaces:
Goffi <goffi@goffi.org>
parents: 2414
diff changeset
1103
4284
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
1104 def params_values_from_category_get_async(
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
1105 self,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
1106 category,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
1107 security_limit=-1,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
1108 app="",
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
1109 extra="",
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
1110 profile_key="@DEFAULT@",
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
1111 callback=None,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
1112 errback=None,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
1113 ):
4037
524856bd7b19 massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents: 3648
diff changeset
1114 if callback is None:
524856bd7b19 massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents: 3648
diff changeset
1115 error_handler = None
524856bd7b19 massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents: 3648
diff changeset
1116 else:
524856bd7b19 massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents: 3648
diff changeset
1117 if errback is None:
524856bd7b19 massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents: 3648
diff changeset
1118 errback = log.error
4284
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
1119 error_handler = lambda err: errback(dbus_to_bridge_exception(err))
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
1120 return self.db_core_iface.params_values_from_category_get_async(
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
1121 category,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
1122 security_limit,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
1123 app,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
1124 extra,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
1125 profile_key,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
1126 timeout=const_TIMEOUT,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
1127 reply_handler=callback,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
1128 error_handler=error_handler,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
1129 )
4037
524856bd7b19 massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents: 3648
diff changeset
1130
4284
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
1131 def presence_set(
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
1132 self,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
1133 to_jid="",
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
1134 show="",
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
1135 statuses={},
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
1136 profile_key="@DEFAULT@",
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
1137 callback=None,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
1138 errback=None,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
1139 ):
4037
524856bd7b19 massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents: 3648
diff changeset
1140 if callback is None:
524856bd7b19 massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents: 3648
diff changeset
1141 error_handler = None
524856bd7b19 massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents: 3648
diff changeset
1142 else:
524856bd7b19 massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents: 3648
diff changeset
1143 if errback is None:
524856bd7b19 massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents: 3648
diff changeset
1144 errback = log.error
4284
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
1145 error_handler = lambda err: errback(dbus_to_bridge_exception(err))
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
1146 kwargs = {}
4037
524856bd7b19 massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents: 3648
diff changeset
1147 if callback is not None:
4284
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
1148 kwargs["timeout"] = const_TIMEOUT
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
1149 kwargs["reply_handler"] = callback
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
1150 kwargs["error_handler"] = error_handler
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
1151 return self.db_core_iface.presence_set(
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
1152 to_jid, show, statuses, profile_key, **kwargs
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
1153 )
4037
524856bd7b19 massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents: 3648
diff changeset
1154
524856bd7b19 massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents: 3648
diff changeset
1155 def presence_statuses_get(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
1156 if callback is None:
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
1157 error_handler = None
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
1158 else:
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
1159 if errback is None:
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
1160 errback = log.error
4284
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
1161 error_handler = lambda err: errback(dbus_to_bridge_exception(err))
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
1162 kwargs = {}
1290
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
1163 if callback is not None:
4284
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
1164 kwargs["timeout"] = const_TIMEOUT
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
1165 kwargs["reply_handler"] = callback
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
1166 kwargs["error_handler"] = error_handler
4037
524856bd7b19 massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents: 3648
diff changeset
1167 return self.db_core_iface.presence_statuses_get(profile_key, **kwargs)
777
5642939d254e core, bridge: new method paramsRegisterApp to register frontend's specific parameters
souliane <souliane@mailoo.org>
parents: 773
diff changeset
1168
4037
524856bd7b19 massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents: 3648
diff changeset
1169 def private_data_delete(self, namespace, key, arg_2, callback=None, errback=None):
3163
d10b2368684e bridge: added methods to let frontends store/retrieve/delete private data
Goffi <goffi@goffi.org>
parents: 3143
diff changeset
1170 if callback is None:
d10b2368684e bridge: added methods to let frontends store/retrieve/delete private data
Goffi <goffi@goffi.org>
parents: 3143
diff changeset
1171 error_handler = None
d10b2368684e bridge: added methods to let frontends store/retrieve/delete private data
Goffi <goffi@goffi.org>
parents: 3143
diff changeset
1172 else:
d10b2368684e bridge: added methods to let frontends store/retrieve/delete private data
Goffi <goffi@goffi.org>
parents: 3143
diff changeset
1173 if errback is None:
d10b2368684e bridge: added methods to let frontends store/retrieve/delete private data
Goffi <goffi@goffi.org>
parents: 3143
diff changeset
1174 errback = log.error
4284
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
1175 error_handler = lambda err: errback(dbus_to_bridge_exception(err))
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
1176 return self.db_core_iface.private_data_delete(
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
1177 namespace,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
1178 key,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
1179 arg_2,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
1180 timeout=const_TIMEOUT,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
1181 reply_handler=callback,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
1182 error_handler=error_handler,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
1183 )
3163
d10b2368684e bridge: added methods to let frontends store/retrieve/delete private data
Goffi <goffi@goffi.org>
parents: 3143
diff changeset
1184
4037
524856bd7b19 massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents: 3648
diff changeset
1185 def private_data_get(self, namespace, key, profile_key, callback=None, errback=None):
3163
d10b2368684e bridge: added methods to let frontends store/retrieve/delete private data
Goffi <goffi@goffi.org>
parents: 3143
diff changeset
1186 if callback is None:
d10b2368684e bridge: added methods to let frontends store/retrieve/delete private data
Goffi <goffi@goffi.org>
parents: 3143
diff changeset
1187 error_handler = None
d10b2368684e bridge: added methods to let frontends store/retrieve/delete private data
Goffi <goffi@goffi.org>
parents: 3143
diff changeset
1188 else:
d10b2368684e bridge: added methods to let frontends store/retrieve/delete private data
Goffi <goffi@goffi.org>
parents: 3143
diff changeset
1189 if errback is None:
d10b2368684e bridge: added methods to let frontends store/retrieve/delete private data
Goffi <goffi@goffi.org>
parents: 3143
diff changeset
1190 errback = log.error
4284
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
1191 error_handler = lambda err: errback(dbus_to_bridge_exception(err))
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
1192 return str(
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
1193 self.db_core_iface.private_data_get(
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
1194 namespace,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
1195 key,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
1196 profile_key,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
1197 timeout=const_TIMEOUT,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
1198 reply_handler=callback,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
1199 error_handler=error_handler,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
1200 )
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
1201 )
3163
d10b2368684e bridge: added methods to let frontends store/retrieve/delete private data
Goffi <goffi@goffi.org>
parents: 3143
diff changeset
1202
4284
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
1203 def private_data_set(
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
1204 self, namespace, key, data, profile_key, callback=None, errback=None
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
1205 ):
3163
d10b2368684e bridge: added methods to let frontends store/retrieve/delete private data
Goffi <goffi@goffi.org>
parents: 3143
diff changeset
1206 if callback is None:
d10b2368684e bridge: added methods to let frontends store/retrieve/delete private data
Goffi <goffi@goffi.org>
parents: 3143
diff changeset
1207 error_handler = None
d10b2368684e bridge: added methods to let frontends store/retrieve/delete private data
Goffi <goffi@goffi.org>
parents: 3143
diff changeset
1208 else:
d10b2368684e bridge: added methods to let frontends store/retrieve/delete private data
Goffi <goffi@goffi.org>
parents: 3143
diff changeset
1209 if errback is None:
d10b2368684e bridge: added methods to let frontends store/retrieve/delete private data
Goffi <goffi@goffi.org>
parents: 3143
diff changeset
1210 errback = log.error
4284
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
1211 error_handler = lambda err: errback(dbus_to_bridge_exception(err))
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
1212 return self.db_core_iface.private_data_set(
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
1213 namespace,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
1214 key,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
1215 data,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
1216 profile_key,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
1217 timeout=const_TIMEOUT,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
1218 reply_handler=callback,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
1219 error_handler=error_handler,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
1220 )
3163
d10b2368684e bridge: added methods to let frontends store/retrieve/delete private data
Goffi <goffi@goffi.org>
parents: 3143
diff changeset
1221
4284
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
1222 def profile_create(
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
1223 self, profile, password="", component="", callback=None, errback=None
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
1224 ):
2144
1d3f73e065e1 core, jp: component handling + client handling refactoring:
Goffi <goffi@goffi.org>
parents: 2142
diff changeset
1225 if callback is None:
1d3f73e065e1 core, jp: component handling + client handling refactoring:
Goffi <goffi@goffi.org>
parents: 2142
diff changeset
1226 error_handler = None
1d3f73e065e1 core, jp: component handling + client handling refactoring:
Goffi <goffi@goffi.org>
parents: 2142
diff changeset
1227 else:
1d3f73e065e1 core, jp: component handling + client handling refactoring:
Goffi <goffi@goffi.org>
parents: 2142
diff changeset
1228 if errback is None:
1d3f73e065e1 core, jp: component handling + client handling refactoring:
Goffi <goffi@goffi.org>
parents: 2142
diff changeset
1229 errback = log.error
4284
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
1230 error_handler = lambda err: errback(dbus_to_bridge_exception(err))
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
1231 return self.db_core_iface.profile_create(
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
1232 profile,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
1233 password,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
1234 component,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
1235 timeout=const_TIMEOUT,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
1236 reply_handler=callback,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
1237 error_handler=error_handler,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
1238 )
2144
1d3f73e065e1 core, jp: component handling + client handling refactoring:
Goffi <goffi@goffi.org>
parents: 2142
diff changeset
1239
4037
524856bd7b19 massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents: 3648
diff changeset
1240 def profile_delete_async(self, profile, callback=None, errback=None):
524856bd7b19 massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents: 3648
diff changeset
1241 if callback is None:
524856bd7b19 massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents: 3648
diff changeset
1242 error_handler = None
524856bd7b19 massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents: 3648
diff changeset
1243 else:
524856bd7b19 massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents: 3648
diff changeset
1244 if errback is None:
524856bd7b19 massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents: 3648
diff changeset
1245 errback = log.error
4284
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
1246 error_handler = lambda err: errback(dbus_to_bridge_exception(err))
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
1247 return self.db_core_iface.profile_delete_async(
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
1248 profile,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
1249 timeout=const_TIMEOUT,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
1250 reply_handler=callback,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
1251 error_handler=error_handler,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
1252 )
4037
524856bd7b19 massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents: 3648
diff changeset
1253
4284
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
1254 def profile_is_session_started(
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
1255 self, profile_key="@DEFAULT@", callback=None, errback=None
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
1256 ):
1592
d6d655238a93 bridge: new core method profileStartSession to start a session without connecting the profile
Goffi <goffi@goffi.org>
parents: 1587
diff changeset
1257 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
1258 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
1259 else:
d6d655238a93 bridge: new core method profileStartSession to start a session without connecting the profile
Goffi <goffi@goffi.org>
parents: 1587
diff changeset
1260 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
1261 errback = log.error
4284
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
1262 error_handler = lambda err: errback(dbus_to_bridge_exception(err))
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
1263 kwargs = {}
1592
d6d655238a93 bridge: new core method profileStartSession to start a session without connecting the profile
Goffi <goffi@goffi.org>
parents: 1587
diff changeset
1264 if callback is not None:
4284
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
1265 kwargs["timeout"] = const_TIMEOUT
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
1266 kwargs["reply_handler"] = callback
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
1267 kwargs["error_handler"] = error_handler
4037
524856bd7b19 massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents: 3648
diff changeset
1268 return self.db_core_iface.profile_is_session_started(profile_key, **kwargs)
1592
d6d655238a93 bridge: new core method profileStartSession to start a session without connecting the profile
Goffi <goffi@goffi.org>
parents: 1587
diff changeset
1269
4037
524856bd7b19 massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents: 3648
diff changeset
1270 def profile_name_get(self, profile_key="@DEFAULT@", callback=None, errback=None):
2168
255830fdb80b core, bridge: renamed getProfileName to profileNameGet according to new conventions
Goffi <goffi@goffi.org>
parents: 2167
diff changeset
1271 if callback is None:
255830fdb80b core, bridge: renamed getProfileName to profileNameGet according to new conventions
Goffi <goffi@goffi.org>
parents: 2167
diff changeset
1272 error_handler = None
255830fdb80b core, bridge: renamed getProfileName to profileNameGet according to new conventions
Goffi <goffi@goffi.org>
parents: 2167
diff changeset
1273 else:
255830fdb80b core, bridge: renamed getProfileName to profileNameGet according to new conventions
Goffi <goffi@goffi.org>
parents: 2167
diff changeset
1274 if errback is None:
255830fdb80b core, bridge: renamed getProfileName to profileNameGet according to new conventions
Goffi <goffi@goffi.org>
parents: 2167
diff changeset
1275 errback = log.error
4284
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
1276 error_handler = lambda err: errback(dbus_to_bridge_exception(err))
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
1277 kwargs = {}
2168
255830fdb80b core, bridge: renamed getProfileName to profileNameGet according to new conventions
Goffi <goffi@goffi.org>
parents: 2167
diff changeset
1278 if callback is not None:
4284
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
1279 kwargs["timeout"] = const_TIMEOUT
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
1280 kwargs["reply_handler"] = callback
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
1281 kwargs["error_handler"] = error_handler
4037
524856bd7b19 massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents: 3648
diff changeset
1282 return str(self.db_core_iface.profile_name_get(profile_key, **kwargs))
2168
255830fdb80b core, bridge: renamed getProfileName to profileNameGet according to new conventions
Goffi <goffi@goffi.org>
parents: 2167
diff changeset
1283
4037
524856bd7b19 massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents: 3648
diff changeset
1284 def profile_set_default(self, profile, callback=None, errback=None):
2146
1bb9bf1b4150 core, frontends: getProfilesList renamed to profilesGetList + behaviour change:
Goffi <goffi@goffi.org>
parents: 2144
diff changeset
1285 if callback is None:
1bb9bf1b4150 core, frontends: getProfilesList renamed to profilesGetList + behaviour change:
Goffi <goffi@goffi.org>
parents: 2144
diff changeset
1286 error_handler = None
1bb9bf1b4150 core, frontends: getProfilesList renamed to profilesGetList + behaviour change:
Goffi <goffi@goffi.org>
parents: 2144
diff changeset
1287 else:
1bb9bf1b4150 core, frontends: getProfilesList renamed to profilesGetList + behaviour change:
Goffi <goffi@goffi.org>
parents: 2144
diff changeset
1288 if errback is None:
1bb9bf1b4150 core, frontends: getProfilesList renamed to profilesGetList + behaviour change:
Goffi <goffi@goffi.org>
parents: 2144
diff changeset
1289 errback = log.error
4284
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
1290 error_handler = lambda err: errback(dbus_to_bridge_exception(err))
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
1291 kwargs = {}
2146
1bb9bf1b4150 core, frontends: getProfilesList renamed to profilesGetList + behaviour change:
Goffi <goffi@goffi.org>
parents: 2144
diff changeset
1292 if callback is not None:
4284
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
1293 kwargs["timeout"] = const_TIMEOUT
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
1294 kwargs["reply_handler"] = callback
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
1295 kwargs["error_handler"] = error_handler
4037
524856bd7b19 massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents: 3648
diff changeset
1296 return self.db_core_iface.profile_set_default(profile, **kwargs)
2146
1bb9bf1b4150 core, frontends: getProfilesList renamed to profilesGetList + behaviour change:
Goffi <goffi@goffi.org>
parents: 2144
diff changeset
1297
4284
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
1298 def profile_start_session(
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
1299 self, password="", profile_key="@DEFAULT@", callback=None, errback=None
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
1300 ):
4037
524856bd7b19 massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents: 3648
diff changeset
1301 if callback is None:
524856bd7b19 massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents: 3648
diff changeset
1302 error_handler = None
524856bd7b19 massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents: 3648
diff changeset
1303 else:
524856bd7b19 massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents: 3648
diff changeset
1304 if errback is None:
524856bd7b19 massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents: 3648
diff changeset
1305 errback = log.error
4284
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
1306 error_handler = lambda err: errback(dbus_to_bridge_exception(err))
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
1307 return self.db_core_iface.profile_start_session(
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
1308 password,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
1309 profile_key,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
1310 timeout=const_TIMEOUT,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
1311 reply_handler=callback,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
1312 error_handler=error_handler,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
1313 )
4037
524856bd7b19 massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents: 3648
diff changeset
1314
4284
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
1315 def profiles_list_get(
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
1316 self, clients=True, components=False, callback=None, errback=None
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
1317 ):
1522
7d7e57a84792 core: progression handling improvments:
Goffi <goffi@goffi.org>
parents: 1482
diff changeset
1318 if callback is None:
7d7e57a84792 core: progression handling improvments:
Goffi <goffi@goffi.org>
parents: 1482
diff changeset
1319 error_handler = None
7d7e57a84792 core: progression handling improvments:
Goffi <goffi@goffi.org>
parents: 1482
diff changeset
1320 else:
7d7e57a84792 core: progression handling improvments:
Goffi <goffi@goffi.org>
parents: 1482
diff changeset
1321 if errback is None:
7d7e57a84792 core: progression handling improvments:
Goffi <goffi@goffi.org>
parents: 1482
diff changeset
1322 errback = log.error
4284
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
1323 error_handler = lambda err: errback(dbus_to_bridge_exception(err))
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
1324 kwargs = {}
1522
7d7e57a84792 core: progression handling improvments:
Goffi <goffi@goffi.org>
parents: 1482
diff changeset
1325 if callback is not None:
4284
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
1326 kwargs["timeout"] = const_TIMEOUT
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
1327 kwargs["reply_handler"] = callback
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
1328 kwargs["error_handler"] = error_handler
4037
524856bd7b19 massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents: 3648
diff changeset
1329 return self.db_core_iface.profiles_list_get(clients, components, **kwargs)
1522
7d7e57a84792 core: progression handling improvments:
Goffi <goffi@goffi.org>
parents: 1482
diff changeset
1330
4037
524856bd7b19 massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents: 3648
diff changeset
1331 def progress_get(self, id, profile, callback=None, errback=None):
1522
7d7e57a84792 core: progression handling improvments:
Goffi <goffi@goffi.org>
parents: 1482
diff changeset
1332 if callback is None:
7d7e57a84792 core: progression handling improvments:
Goffi <goffi@goffi.org>
parents: 1482
diff changeset
1333 error_handler = None
7d7e57a84792 core: progression handling improvments:
Goffi <goffi@goffi.org>
parents: 1482
diff changeset
1334 else:
7d7e57a84792 core: progression handling improvments:
Goffi <goffi@goffi.org>
parents: 1482
diff changeset
1335 if errback is None:
7d7e57a84792 core: progression handling improvments:
Goffi <goffi@goffi.org>
parents: 1482
diff changeset
1336 errback = log.error
4284
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
1337 error_handler = lambda err: errback(dbus_to_bridge_exception(err))
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
1338 kwargs = {}
1522
7d7e57a84792 core: progression handling improvments:
Goffi <goffi@goffi.org>
parents: 1482
diff changeset
1339 if callback is not None:
4284
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
1340 kwargs["timeout"] = const_TIMEOUT
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
1341 kwargs["reply_handler"] = callback
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
1342 kwargs["error_handler"] = error_handler
4037
524856bd7b19 massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents: 3648
diff changeset
1343 return self.db_core_iface.progress_get(id, profile, **kwargs)
1522
7d7e57a84792 core: progression handling improvments:
Goffi <goffi@goffi.org>
parents: 1482
diff changeset
1344
4037
524856bd7b19 massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents: 3648
diff changeset
1345 def progress_get_all(self, profile, callback=None, errback=None):
1626
63cef4dbf2a4 core, plugins file, XEP-0234, bridge: progression api enhancement:
Goffi <goffi@goffi.org>
parents: 1622
diff changeset
1346 if callback is None:
63cef4dbf2a4 core, plugins file, XEP-0234, bridge: progression api enhancement:
Goffi <goffi@goffi.org>
parents: 1622
diff changeset
1347 error_handler = None
63cef4dbf2a4 core, plugins file, XEP-0234, bridge: progression api enhancement:
Goffi <goffi@goffi.org>
parents: 1622
diff changeset
1348 else:
63cef4dbf2a4 core, plugins file, XEP-0234, bridge: progression api enhancement:
Goffi <goffi@goffi.org>
parents: 1622
diff changeset
1349 if errback is None:
63cef4dbf2a4 core, plugins file, XEP-0234, bridge: progression api enhancement:
Goffi <goffi@goffi.org>
parents: 1622
diff changeset
1350 errback = log.error
4284
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
1351 error_handler = lambda err: errback(dbus_to_bridge_exception(err))
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
1352 kwargs = {}
1626
63cef4dbf2a4 core, plugins file, XEP-0234, bridge: progression api enhancement:
Goffi <goffi@goffi.org>
parents: 1622
diff changeset
1353 if callback is not None:
4284
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
1354 kwargs["timeout"] = const_TIMEOUT
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
1355 kwargs["reply_handler"] = callback
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
1356 kwargs["error_handler"] = error_handler
4037
524856bd7b19 massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents: 3648
diff changeset
1357 return self.db_core_iface.progress_get_all(profile, **kwargs)
1626
63cef4dbf2a4 core, plugins file, XEP-0234, bridge: progression api enhancement:
Goffi <goffi@goffi.org>
parents: 1622
diff changeset
1358
4037
524856bd7b19 massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents: 3648
diff changeset
1359 def progress_get_all_metadata(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
1360 if callback is None:
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
1361 error_handler = None
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
1362 else:
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
1363 if errback is None:
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
1364 errback = log.error
4284
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
1365 error_handler = lambda err: errback(dbus_to_bridge_exception(err))
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
1366 kwargs = {}
1290
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
1367 if callback is not None:
4284
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
1368 kwargs["timeout"] = const_TIMEOUT
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
1369 kwargs["reply_handler"] = callback
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
1370 kwargs["error_handler"] = error_handler
4037
524856bd7b19 massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents: 3648
diff changeset
1371 return self.db_core_iface.progress_get_all_metadata(profile, **kwargs)
1015
fee00f2e11c2 memory, jp: added jp commands to load/save parameters template
souliane <souliane@mailoo.org>
parents: 993
diff changeset
1372
4037
524856bd7b19 massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents: 3648
diff changeset
1373 def ready_get(self, callback=None, errback=None):
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
1374 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
1375 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
1376 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
1377 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
1378 errback = log.error
4284
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
1379 error_handler = lambda err: errback(dbus_to_bridge_exception(err))
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
1380 return self.db_core_iface.ready_get(
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
1381 timeout=const_TIMEOUT, reply_handler=callback, error_handler=error_handler
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
1382 )
4037
524856bd7b19 massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents: 3648
diff changeset
1383
524856bd7b19 massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents: 3648
diff changeset
1384 def roster_resync(self, profile_key="@DEFAULT@", callback=None, errback=None):
524856bd7b19 massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents: 3648
diff changeset
1385 if callback is None:
524856bd7b19 massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents: 3648
diff changeset
1386 error_handler = None
524856bd7b19 massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents: 3648
diff changeset
1387 else:
524856bd7b19 massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents: 3648
diff changeset
1388 if errback is None:
524856bd7b19 massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents: 3648
diff changeset
1389 errback = log.error
4284
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
1390 error_handler = lambda err: errback(dbus_to_bridge_exception(err))
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
1391 return self.db_core_iface.roster_resync(
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
1392 profile_key,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
1393 timeout=const_TIMEOUT,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
1394 reply_handler=callback,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
1395 error_handler=error_handler,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
1396 )
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
1397
4037
524856bd7b19 massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents: 3648
diff changeset
1398 def session_infos_get(self, profile_key, callback=None, errback=None):
524856bd7b19 massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents: 3648
diff changeset
1399 if callback is None:
524856bd7b19 massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents: 3648
diff changeset
1400 error_handler = None
524856bd7b19 massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents: 3648
diff changeset
1401 else:
524856bd7b19 massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents: 3648
diff changeset
1402 if errback is None:
524856bd7b19 massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents: 3648
diff changeset
1403 errback = log.error
4284
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
1404 error_handler = lambda err: errback(dbus_to_bridge_exception(err))
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
1405 return self.db_core_iface.session_infos_get(
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
1406 profile_key,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
1407 timeout=const_TIMEOUT,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
1408 reply_handler=callback,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
1409 error_handler=error_handler,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
1410 )
4037
524856bd7b19 massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents: 3648
diff changeset
1411
524856bd7b19 massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents: 3648
diff changeset
1412 def sub_waiting_get(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
1413 if callback is None:
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
1414 error_handler = None
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
1415 else:
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
1416 if errback is None:
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
1417 errback = log.error
4284
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
1418 error_handler = lambda err: errback(dbus_to_bridge_exception(err))
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
1419 kwargs = {}
1290
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
1420 if callback is not None:
4284
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
1421 kwargs["timeout"] = const_TIMEOUT
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
1422 kwargs["reply_handler"] = callback
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
1423 kwargs["error_handler"] = error_handler
4037
524856bd7b19 massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents: 3648
diff changeset
1424 return self.db_core_iface.sub_waiting_get(profile_key, **kwargs)
272
1d2e0dfe7114 bridge: core & frontend sides of bridge are now generated
Goffi <goffi@goffi.org>
parents: 267
diff changeset
1425
4284
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
1426 def subscription(
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
1427 self, sub_type, entity, profile_key="@DEFAULT@", callback=None, errback=None
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
1428 ):
1290
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
1429 if callback is None:
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
1430 error_handler = None
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
1431 else:
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
1432 if errback is None:
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
1433 errback = log.error
4284
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
1434 error_handler = lambda err: errback(dbus_to_bridge_exception(err))
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
1435 kwargs = {}
1290
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
1436 if callback is not None:
4284
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
1437 kwargs["timeout"] = const_TIMEOUT
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
1438 kwargs["reply_handler"] = callback
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
1439 kwargs["error_handler"] = error_handler
1290
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
1440 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
1441
4037
524856bd7b19 massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents: 3648
diff changeset
1442 def version_get(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
1443 if callback is None:
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
1444 error_handler = None
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
1445 else:
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
1446 if errback is None:
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
1447 errback = log.error
4284
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
1448 error_handler = lambda err: errback(dbus_to_bridge_exception(err))
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
1449 kwargs = {}
3254
6cf4bd6972c2 core, frontends: avatar refactoring:
Goffi <goffi@goffi.org>
parents: 3242
diff changeset
1450 if callback is not None:
4284
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
1451 kwargs["timeout"] = const_TIMEOUT
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
1452 kwargs["reply_handler"] = callback
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
1453 kwargs["error_handler"] = error_handler
4037
524856bd7b19 massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents: 3648
diff changeset
1454 return str(self.db_core_iface.version_get(**kwargs))
3042
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
1455
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
1456
4037
524856bd7b19 massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents: 3648
diff changeset
1457 class AIOBridge(bridge):
3042
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
1458
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
1459 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
1460 loop = asyncio.get_running_loop()
4270
0d7bb4df2343 Reformatted code base using black.
Goffi <goffi@goffi.org>
parents: 4193
diff changeset
1461 async_handler = lambda *args: asyncio.run_coroutine_threadsafe(
0d7bb4df2343 Reformatted code base using black.
Goffi <goffi@goffi.org>
parents: 4193
diff changeset
1462 handler(*args), loop
0d7bb4df2343 Reformatted code base using black.
Goffi <goffi@goffi.org>
parents: 4193
diff changeset
1463 )
3042
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
1464 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
1465
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
1466 def __getattribute__(self, name):
4270
0d7bb4df2343 Reformatted code base using black.
Goffi <goffi@goffi.org>
parents: 4193
diff changeset
1467 """usual __getattribute__ if the method exists, else try to find a plugin method"""
3042
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
1468 try:
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
1469 return object.__getattribute__(self, name)
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
1470 except AttributeError:
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
1471 # The attribute is not found, we try the plugin proxy to find the requested method
4037
524856bd7b19 massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents: 3648
diff changeset
1472 def get_plugin_method(*args, **kwargs):
3042
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
1473 loop = asyncio.get_running_loop()
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
1474 fut = loop.create_future()
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
1475 method = getattr(self.db_plugin_iface, name)
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
1476 reply_handler = lambda ret=None: loop.call_soon_threadsafe(
4270
0d7bb4df2343 Reformatted code base using black.
Goffi <goffi@goffi.org>
parents: 4193
diff changeset
1477 fut.set_result, ret
0d7bb4df2343 Reformatted code base using black.
Goffi <goffi@goffi.org>
parents: 4193
diff changeset
1478 )
3042
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
1479 error_handler = lambda err: loop.call_soon_threadsafe(
4270
0d7bb4df2343 Reformatted code base using black.
Goffi <goffi@goffi.org>
parents: 4193
diff changeset
1480 fut.set_exception, dbus_to_bridge_exception(err)
0d7bb4df2343 Reformatted code base using black.
Goffi <goffi@goffi.org>
parents: 4193
diff changeset
1481 )
3648
71cfe9334f73 bridge (dbus/frontend): reintrospect signature in case of guess error:
Goffi <goffi@goffi.org>
parents: 3480
diff changeset
1482 try:
71cfe9334f73 bridge (dbus/frontend): reintrospect signature in case of guess error:
Goffi <goffi@goffi.org>
parents: 3480
diff changeset
1483 method(
71cfe9334f73 bridge (dbus/frontend): reintrospect signature in case of guess error:
Goffi <goffi@goffi.org>
parents: 3480
diff changeset
1484 *args,
71cfe9334f73 bridge (dbus/frontend): reintrospect signature in case of guess error:
Goffi <goffi@goffi.org>
parents: 3480
diff changeset
1485 **kwargs,
71cfe9334f73 bridge (dbus/frontend): reintrospect signature in case of guess error:
Goffi <goffi@goffi.org>
parents: 3480
diff changeset
1486 timeout=const_TIMEOUT,
71cfe9334f73 bridge (dbus/frontend): reintrospect signature in case of guess error:
Goffi <goffi@goffi.org>
parents: 3480
diff changeset
1487 reply_handler=reply_handler,
4270
0d7bb4df2343 Reformatted code base using black.
Goffi <goffi@goffi.org>
parents: 4193
diff changeset
1488 error_handler=error_handler,
3648
71cfe9334f73 bridge (dbus/frontend): reintrospect signature in case of guess error:
Goffi <goffi@goffi.org>
parents: 3480
diff changeset
1489 )
71cfe9334f73 bridge (dbus/frontend): reintrospect signature in case of guess error:
Goffi <goffi@goffi.org>
parents: 3480
diff changeset
1490 except ValueError as e:
71cfe9334f73 bridge (dbus/frontend): reintrospect signature in case of guess error:
Goffi <goffi@goffi.org>
parents: 3480
diff changeset
1491 if e.args[0].startswith("Unable to guess signature"):
4037
524856bd7b19 massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents: 3648
diff changeset
1492 # same hack as for bridge.__getattribute__
3648
71cfe9334f73 bridge (dbus/frontend): reintrospect signature in case of guess error:
Goffi <goffi@goffi.org>
parents: 3480
diff changeset
1493 log.warning("using hack to work around inspection issue")
71cfe9334f73 bridge (dbus/frontend): reintrospect signature in case of guess error:
Goffi <goffi@goffi.org>
parents: 3480
diff changeset
1494 proxy = self.db_plugin_iface.proxy_object
71cfe9334f73 bridge (dbus/frontend): reintrospect signature in case of guess error:
Goffi <goffi@goffi.org>
parents: 3480
diff changeset
1495 IN_PROGRESS = proxy.INTROSPECT_STATE_INTROSPECT_IN_PROGRESS
71cfe9334f73 bridge (dbus/frontend): reintrospect signature in case of guess error:
Goffi <goffi@goffi.org>
parents: 3480
diff changeset
1496 proxy._introspect_state = IN_PROGRESS
71cfe9334f73 bridge (dbus/frontend): reintrospect signature in case of guess error:
Goffi <goffi@goffi.org>
parents: 3480
diff changeset
1497 proxy._Introspect()
71cfe9334f73 bridge (dbus/frontend): reintrospect signature in case of guess error:
Goffi <goffi@goffi.org>
parents: 3480
diff changeset
1498 self.db_plugin_iface.get_dbus_method(name)(
71cfe9334f73 bridge (dbus/frontend): reintrospect signature in case of guess error:
Goffi <goffi@goffi.org>
parents: 3480
diff changeset
1499 *args,
71cfe9334f73 bridge (dbus/frontend): reintrospect signature in case of guess error:
Goffi <goffi@goffi.org>
parents: 3480
diff changeset
1500 **kwargs,
71cfe9334f73 bridge (dbus/frontend): reintrospect signature in case of guess error:
Goffi <goffi@goffi.org>
parents: 3480
diff changeset
1501 timeout=const_TIMEOUT,
71cfe9334f73 bridge (dbus/frontend): reintrospect signature in case of guess error:
Goffi <goffi@goffi.org>
parents: 3480
diff changeset
1502 reply_handler=reply_handler,
4270
0d7bb4df2343 Reformatted code base using black.
Goffi <goffi@goffi.org>
parents: 4193
diff changeset
1503 error_handler=error_handler,
3648
71cfe9334f73 bridge (dbus/frontend): reintrospect signature in case of guess error:
Goffi <goffi@goffi.org>
parents: 3480
diff changeset
1504 )
71cfe9334f73 bridge (dbus/frontend): reintrospect signature in case of guess error:
Goffi <goffi@goffi.org>
parents: 3480
diff changeset
1505
71cfe9334f73 bridge (dbus/frontend): reintrospect signature in case of guess error:
Goffi <goffi@goffi.org>
parents: 3480
diff changeset
1506 else:
71cfe9334f73 bridge (dbus/frontend): reintrospect signature in case of guess error:
Goffi <goffi@goffi.org>
parents: 3480
diff changeset
1507 raise e
3042
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
1508 return fut
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
1509
4037
524856bd7b19 massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents: 3648
diff changeset
1510 return get_plugin_method
3042
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
1511
4037
524856bd7b19 massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents: 3648
diff changeset
1512 def bridge_connect(self):
3042
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
1513 loop = asyncio.get_running_loop()
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
1514 fut = loop.create_future()
4037
524856bd7b19 massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents: 3648
diff changeset
1515 super().bridge_connect(
3042
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
1516 callback=lambda: loop.call_soon_threadsafe(fut.set_result, None),
4270
0d7bb4df2343 Reformatted code base using black.
Goffi <goffi@goffi.org>
parents: 4193
diff changeset
1517 errback=lambda e: loop.call_soon_threadsafe(fut.set_exception, e),
3042
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
1518 )
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
1519 return fut
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
1520
4037
524856bd7b19 massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents: 3648
diff changeset
1521 def action_launch(self, callback_id, data, profile_key="@DEFAULT@"):
3042
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
1522 loop = asyncio.get_running_loop()
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
1523 fut = loop.create_future()
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
1524 reply_handler = lambda ret=None: loop.call_soon_threadsafe(fut.set_result, ret)
4284
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
1525 error_handler = lambda err: loop.call_soon_threadsafe(
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
1526 fut.set_exception, dbus_to_bridge_exception(err)
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
1527 )
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
1528 self.db_core_iface.action_launch(
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
1529 callback_id,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
1530 data,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
1531 profile_key,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
1532 timeout=const_TIMEOUT,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
1533 reply_handler=reply_handler,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
1534 error_handler=error_handler,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
1535 )
3042
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
1536 return fut
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
1537
4037
524856bd7b19 massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents: 3648
diff changeset
1538 def actions_get(self, profile_key="@DEFAULT@"):
3042
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
1539 loop = asyncio.get_running_loop()
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
1540 fut = loop.create_future()
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
1541 reply_handler = lambda ret=None: loop.call_soon_threadsafe(fut.set_result, ret)
4284
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
1542 error_handler = lambda err: loop.call_soon_threadsafe(
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
1543 fut.set_exception, dbus_to_bridge_exception(err)
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
1544 )
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
1545 self.db_core_iface.actions_get(
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
1546 profile_key,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
1547 timeout=const_TIMEOUT,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
1548 reply_handler=reply_handler,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
1549 error_handler=error_handler,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
1550 )
3042
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
1551 return fut
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
1552
4037
524856bd7b19 massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents: 3648
diff changeset
1553 def config_get(self, section, name):
3042
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
1554 loop = asyncio.get_running_loop()
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
1555 fut = loop.create_future()
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
1556 reply_handler = lambda ret=None: loop.call_soon_threadsafe(fut.set_result, ret)
4284
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
1557 error_handler = lambda err: loop.call_soon_threadsafe(
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
1558 fut.set_exception, dbus_to_bridge_exception(err)
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
1559 )
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
1560 self.db_core_iface.config_get(
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
1561 section,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
1562 name,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
1563 timeout=const_TIMEOUT,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
1564 reply_handler=reply_handler,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
1565 error_handler=error_handler,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
1566 )
3042
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
1567 return fut
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
1568
4284
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
1569 def connect(self, profile_key="@DEFAULT@", password="", options={}):
3042
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
1570 loop = asyncio.get_running_loop()
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
1571 fut = loop.create_future()
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
1572 reply_handler = lambda ret=None: loop.call_soon_threadsafe(fut.set_result, ret)
4284
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
1573 error_handler = lambda err: loop.call_soon_threadsafe(
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
1574 fut.set_exception, dbus_to_bridge_exception(err)
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
1575 )
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
1576 self.db_core_iface.connect(
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
1577 profile_key,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
1578 password,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
1579 options,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
1580 timeout=const_TIMEOUT,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
1581 reply_handler=reply_handler,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
1582 error_handler=error_handler,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
1583 )
3042
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
1584 return fut
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
1585
4037
524856bd7b19 massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents: 3648
diff changeset
1586 def contact_add(self, entity_jid, profile_key="@DEFAULT@"):
524856bd7b19 massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents: 3648
diff changeset
1587 loop = asyncio.get_running_loop()
524856bd7b19 massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents: 3648
diff changeset
1588 fut = loop.create_future()
524856bd7b19 massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents: 3648
diff changeset
1589 reply_handler = lambda ret=None: loop.call_soon_threadsafe(fut.set_result, ret)
4284
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
1590 error_handler = lambda err: loop.call_soon_threadsafe(
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
1591 fut.set_exception, dbus_to_bridge_exception(err)
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
1592 )
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
1593 self.db_core_iface.contact_add(
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
1594 entity_jid,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
1595 profile_key,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
1596 timeout=const_TIMEOUT,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
1597 reply_handler=reply_handler,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
1598 error_handler=error_handler,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
1599 )
4037
524856bd7b19 massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents: 3648
diff changeset
1600 return fut
524856bd7b19 massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents: 3648
diff changeset
1601
524856bd7b19 massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents: 3648
diff changeset
1602 def contact_del(self, entity_jid, profile_key="@DEFAULT@"):
3254
6cf4bd6972c2 core, frontends: avatar refactoring:
Goffi <goffi@goffi.org>
parents: 3242
diff changeset
1603 loop = asyncio.get_running_loop()
6cf4bd6972c2 core, frontends: avatar refactoring:
Goffi <goffi@goffi.org>
parents: 3242
diff changeset
1604 fut = loop.create_future()
6cf4bd6972c2 core, frontends: avatar refactoring:
Goffi <goffi@goffi.org>
parents: 3242
diff changeset
1605 reply_handler = lambda ret=None: loop.call_soon_threadsafe(fut.set_result, ret)
4284
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
1606 error_handler = lambda err: loop.call_soon_threadsafe(
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
1607 fut.set_exception, dbus_to_bridge_exception(err)
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
1608 )
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
1609 self.db_core_iface.contact_del(
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
1610 entity_jid,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
1611 profile_key,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
1612 timeout=const_TIMEOUT,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
1613 reply_handler=reply_handler,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
1614 error_handler=error_handler,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
1615 )
3254
6cf4bd6972c2 core, frontends: avatar refactoring:
Goffi <goffi@goffi.org>
parents: 3242
diff changeset
1616 return fut
6cf4bd6972c2 core, frontends: avatar refactoring:
Goffi <goffi@goffi.org>
parents: 3242
diff changeset
1617
4037
524856bd7b19 massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents: 3648
diff changeset
1618 def contact_get(self, arg_0, profile_key="@DEFAULT@"):
3042
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
1619 loop = asyncio.get_running_loop()
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
1620 fut = loop.create_future()
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
1621 reply_handler = lambda ret=None: loop.call_soon_threadsafe(fut.set_result, ret)
4284
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
1622 error_handler = lambda err: loop.call_soon_threadsafe(
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
1623 fut.set_exception, dbus_to_bridge_exception(err)
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
1624 )
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
1625 self.db_core_iface.contact_get(
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
1626 arg_0,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
1627 profile_key,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
1628 timeout=const_TIMEOUT,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
1629 reply_handler=reply_handler,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
1630 error_handler=error_handler,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
1631 )
3042
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
1632 return fut
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
1633
4037
524856bd7b19 massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents: 3648
diff changeset
1634 def contact_update(self, entity_jid, name, groups, profile_key="@DEFAULT@"):
524856bd7b19 massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents: 3648
diff changeset
1635 loop = asyncio.get_running_loop()
524856bd7b19 massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents: 3648
diff changeset
1636 fut = loop.create_future()
524856bd7b19 massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents: 3648
diff changeset
1637 reply_handler = lambda ret=None: loop.call_soon_threadsafe(fut.set_result, ret)
4284
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
1638 error_handler = lambda err: loop.call_soon_threadsafe(
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
1639 fut.set_exception, dbus_to_bridge_exception(err)
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
1640 )
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
1641 self.db_core_iface.contact_update(
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
1642 entity_jid,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
1643 name,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
1644 groups,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
1645 profile_key,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
1646 timeout=const_TIMEOUT,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
1647 reply_handler=reply_handler,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
1648 error_handler=error_handler,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
1649 )
4037
524856bd7b19 massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents: 3648
diff changeset
1650 return fut
524856bd7b19 massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents: 3648
diff changeset
1651
524856bd7b19 massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents: 3648
diff changeset
1652 def contacts_get(self, profile_key="@DEFAULT@"):
3206
ae09989e9feb core, bridge: new `devicesInfosGet` method to get infos on known devices of an entity
Goffi <goffi@goffi.org>
parents: 3201
diff changeset
1653 loop = asyncio.get_running_loop()
ae09989e9feb core, bridge: new `devicesInfosGet` method to get infos on known devices of an entity
Goffi <goffi@goffi.org>
parents: 3201
diff changeset
1654 fut = loop.create_future()
ae09989e9feb core, bridge: new `devicesInfosGet` method to get infos on known devices of an entity
Goffi <goffi@goffi.org>
parents: 3201
diff changeset
1655 reply_handler = lambda ret=None: loop.call_soon_threadsafe(fut.set_result, ret)
4284
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
1656 error_handler = lambda err: loop.call_soon_threadsafe(
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
1657 fut.set_exception, dbus_to_bridge_exception(err)
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
1658 )
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
1659 self.db_core_iface.contacts_get(
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
1660 profile_key,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
1661 timeout=const_TIMEOUT,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
1662 reply_handler=reply_handler,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
1663 error_handler=error_handler,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
1664 )
3206
ae09989e9feb core, bridge: new `devicesInfosGet` method to get infos on known devices of an entity
Goffi <goffi@goffi.org>
parents: 3201
diff changeset
1665 return fut
ae09989e9feb core, bridge: new `devicesInfosGet` method to get infos on known devices of an entity
Goffi <goffi@goffi.org>
parents: 3201
diff changeset
1666
4037
524856bd7b19 massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents: 3648
diff changeset
1667 def contacts_get_from_group(self, group, profile_key="@DEFAULT@"):
524856bd7b19 massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents: 3648
diff changeset
1668 loop = asyncio.get_running_loop()
524856bd7b19 massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents: 3648
diff changeset
1669 fut = loop.create_future()
524856bd7b19 massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents: 3648
diff changeset
1670 reply_handler = lambda ret=None: loop.call_soon_threadsafe(fut.set_result, ret)
4284
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
1671 error_handler = lambda err: loop.call_soon_threadsafe(
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
1672 fut.set_exception, dbus_to_bridge_exception(err)
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
1673 )
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
1674 self.db_core_iface.contacts_get_from_group(
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
1675 group,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
1676 profile_key,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
1677 timeout=const_TIMEOUT,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
1678 reply_handler=reply_handler,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
1679 error_handler=error_handler,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
1680 )
4037
524856bd7b19 massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents: 3648
diff changeset
1681 return fut
524856bd7b19 massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents: 3648
diff changeset
1682
524856bd7b19 massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents: 3648
diff changeset
1683 def devices_infos_get(self, bare_jid, profile_key):
3042
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
1684 loop = asyncio.get_running_loop()
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
1685 fut = loop.create_future()
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
1686 reply_handler = lambda ret=None: loop.call_soon_threadsafe(fut.set_result, ret)
4284
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
1687 error_handler = lambda err: loop.call_soon_threadsafe(
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
1688 fut.set_exception, dbus_to_bridge_exception(err)
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
1689 )
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
1690 self.db_core_iface.devices_infos_get(
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
1691 bare_jid,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
1692 profile_key,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
1693 timeout=const_TIMEOUT,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
1694 reply_handler=reply_handler,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
1695 error_handler=error_handler,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
1696 )
3042
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
1697 return fut
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
1698
4284
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
1699 def disco_find_by_features(
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
1700 self,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
1701 namespaces,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
1702 identities,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
1703 bare_jid=False,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
1704 service=True,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
1705 roster=True,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
1706 own_jid=True,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
1707 local_device=False,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
1708 profile_key="@DEFAULT@",
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
1709 ):
3042
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
1710 loop = asyncio.get_running_loop()
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
1711 fut = loop.create_future()
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
1712 reply_handler = lambda ret=None: loop.call_soon_threadsafe(fut.set_result, ret)
4284
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
1713 error_handler = lambda err: loop.call_soon_threadsafe(
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
1714 fut.set_exception, dbus_to_bridge_exception(err)
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
1715 )
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
1716 self.db_core_iface.disco_find_by_features(
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
1717 namespaces,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
1718 identities,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
1719 bare_jid,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
1720 service,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
1721 roster,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
1722 own_jid,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
1723 local_device,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
1724 profile_key,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
1725 timeout=const_TIMEOUT,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
1726 reply_handler=reply_handler,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
1727 error_handler=error_handler,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
1728 )
3042
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
1729 return fut
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
1730
4284
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
1731 def disco_infos(self, entity_jid, node="", use_cache=True, profile_key="@DEFAULT@"):
3042
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
1732 loop = asyncio.get_running_loop()
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
1733 fut = loop.create_future()
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
1734 reply_handler = lambda ret=None: loop.call_soon_threadsafe(fut.set_result, ret)
4284
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
1735 error_handler = lambda err: loop.call_soon_threadsafe(
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
1736 fut.set_exception, dbus_to_bridge_exception(err)
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
1737 )
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
1738 self.db_core_iface.disco_infos(
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
1739 entity_jid,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
1740 node,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
1741 use_cache,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
1742 profile_key,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
1743 timeout=const_TIMEOUT,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
1744 reply_handler=reply_handler,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
1745 error_handler=error_handler,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
1746 )
4037
524856bd7b19 massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents: 3648
diff changeset
1747 return fut
524856bd7b19 massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents: 3648
diff changeset
1748
4284
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
1749 def disco_items(self, entity_jid, node="", use_cache=True, profile_key="@DEFAULT@"):
4037
524856bd7b19 massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents: 3648
diff changeset
1750 loop = asyncio.get_running_loop()
524856bd7b19 massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents: 3648
diff changeset
1751 fut = loop.create_future()
524856bd7b19 massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents: 3648
diff changeset
1752 reply_handler = lambda ret=None: loop.call_soon_threadsafe(fut.set_result, ret)
4284
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
1753 error_handler = lambda err: loop.call_soon_threadsafe(
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
1754 fut.set_exception, dbus_to_bridge_exception(err)
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
1755 )
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
1756 self.db_core_iface.disco_items(
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
1757 entity_jid,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
1758 node,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
1759 use_cache,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
1760 profile_key,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
1761 timeout=const_TIMEOUT,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
1762 reply_handler=reply_handler,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
1763 error_handler=error_handler,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
1764 )
3042
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
1765 return fut
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
1766
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
1767 def disconnect(self, profile_key="@DEFAULT@"):
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
1768 loop = asyncio.get_running_loop()
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
1769 fut = loop.create_future()
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
1770 reply_handler = lambda ret=None: loop.call_soon_threadsafe(fut.set_result, ret)
4284
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
1771 error_handler = lambda err: loop.call_soon_threadsafe(
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
1772 fut.set_exception, dbus_to_bridge_exception(err)
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
1773 )
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
1774 self.db_core_iface.disconnect(
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
1775 profile_key,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
1776 timeout=const_TIMEOUT,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
1777 reply_handler=reply_handler,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
1778 error_handler=error_handler,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
1779 )
3042
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
1780 return fut
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
1781
4037
524856bd7b19 massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents: 3648
diff changeset
1782 def encryption_namespace_get(self, arg_0):
3042
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
1783 loop = asyncio.get_running_loop()
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
1784 fut = loop.create_future()
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
1785 reply_handler = lambda ret=None: loop.call_soon_threadsafe(fut.set_result, ret)
4284
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
1786 error_handler = lambda err: loop.call_soon_threadsafe(
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
1787 fut.set_exception, dbus_to_bridge_exception(err)
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
1788 )
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
1789 self.db_core_iface.encryption_namespace_get(
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
1790 arg_0,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
1791 timeout=const_TIMEOUT,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
1792 reply_handler=reply_handler,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
1793 error_handler=error_handler,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
1794 )
3042
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
1795 return fut
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
1796
4037
524856bd7b19 massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents: 3648
diff changeset
1797 def encryption_plugins_get(self):
3042
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
1798 loop = asyncio.get_running_loop()
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
1799 fut = loop.create_future()
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
1800 reply_handler = lambda ret=None: loop.call_soon_threadsafe(fut.set_result, ret)
4284
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
1801 error_handler = lambda err: loop.call_soon_threadsafe(
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
1802 fut.set_exception, dbus_to_bridge_exception(err)
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
1803 )
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
1804 self.db_core_iface.encryption_plugins_get(
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
1805 timeout=const_TIMEOUT,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
1806 reply_handler=reply_handler,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
1807 error_handler=error_handler,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
1808 )
3042
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
1809 return fut
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
1810
4037
524856bd7b19 massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents: 3648
diff changeset
1811 def encryption_trust_ui_get(self, to_jid, namespace, profile_key):
3042
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
1812 loop = asyncio.get_running_loop()
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
1813 fut = loop.create_future()
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
1814 reply_handler = lambda ret=None: loop.call_soon_threadsafe(fut.set_result, ret)
4284
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
1815 error_handler = lambda err: loop.call_soon_threadsafe(
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
1816 fut.set_exception, dbus_to_bridge_exception(err)
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
1817 )
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
1818 self.db_core_iface.encryption_trust_ui_get(
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
1819 to_jid,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
1820 namespace,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
1821 profile_key,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
1822 timeout=const_TIMEOUT,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
1823 reply_handler=reply_handler,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
1824 error_handler=error_handler,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
1825 )
3042
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
1826 return fut
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
1827
4037
524856bd7b19 massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents: 3648
diff changeset
1828 def entities_data_get(self, jids, keys, profile):
3042
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
1829 loop = asyncio.get_running_loop()
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
1830 fut = loop.create_future()
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
1831 reply_handler = lambda ret=None: loop.call_soon_threadsafe(fut.set_result, ret)
4284
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
1832 error_handler = lambda err: loop.call_soon_threadsafe(
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
1833 fut.set_exception, dbus_to_bridge_exception(err)
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
1834 )
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
1835 self.db_core_iface.entities_data_get(
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
1836 jids,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
1837 keys,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
1838 profile,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
1839 timeout=const_TIMEOUT,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
1840 reply_handler=reply_handler,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
1841 error_handler=error_handler,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
1842 )
3042
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
1843 return fut
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
1844
4037
524856bd7b19 massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents: 3648
diff changeset
1845 def entity_data_get(self, jid, keys, profile):
3042
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
1846 loop = asyncio.get_running_loop()
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
1847 fut = loop.create_future()
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
1848 reply_handler = lambda ret=None: loop.call_soon_threadsafe(fut.set_result, ret)
4284
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
1849 error_handler = lambda err: loop.call_soon_threadsafe(
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
1850 fut.set_exception, dbus_to_bridge_exception(err)
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
1851 )
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
1852 self.db_core_iface.entity_data_get(
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
1853 jid,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
1854 keys,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
1855 profile,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
1856 timeout=const_TIMEOUT,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
1857 reply_handler=reply_handler,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
1858 error_handler=error_handler,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
1859 )
3042
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
1860 return fut
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
1861
4037
524856bd7b19 massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents: 3648
diff changeset
1862 def features_get(self, profile_key):
3042
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
1863 loop = asyncio.get_running_loop()
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
1864 fut = loop.create_future()
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
1865 reply_handler = lambda ret=None: loop.call_soon_threadsafe(fut.set_result, ret)
4284
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
1866 error_handler = lambda err: loop.call_soon_threadsafe(
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
1867 fut.set_exception, dbus_to_bridge_exception(err)
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
1868 )
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
1869 self.db_core_iface.features_get(
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
1870 profile_key,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
1871 timeout=const_TIMEOUT,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
1872 reply_handler=reply_handler,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
1873 error_handler=error_handler,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
1874 )
3042
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
1875 return fut
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
1876
4284
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
1877 def history_get(
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
1878 self, from_jid, to_jid, limit, between=True, filters="", profile="@NONE@"
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
1879 ):
3042
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
1880 loop = asyncio.get_running_loop()
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
1881 fut = loop.create_future()
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
1882 reply_handler = lambda ret=None: loop.call_soon_threadsafe(fut.set_result, ret)
4284
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
1883 error_handler = lambda err: loop.call_soon_threadsafe(
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
1884 fut.set_exception, dbus_to_bridge_exception(err)
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
1885 )
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
1886 self.db_core_iface.history_get(
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
1887 from_jid,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
1888 to_jid,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
1889 limit,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
1890 between,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
1891 filters,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
1892 profile,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
1893 timeout=const_TIMEOUT,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
1894 reply_handler=reply_handler,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
1895 error_handler=error_handler,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
1896 )
3042
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
1897 return fut
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
1898
4037
524856bd7b19 massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents: 3648
diff changeset
1899 def image_check(self, arg_0):
3042
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
1900 loop = asyncio.get_running_loop()
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
1901 fut = loop.create_future()
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
1902 reply_handler = lambda ret=None: loop.call_soon_threadsafe(fut.set_result, ret)
4284
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
1903 error_handler = lambda err: loop.call_soon_threadsafe(
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
1904 fut.set_exception, dbus_to_bridge_exception(err)
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
1905 )
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
1906 self.db_core_iface.image_check(
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
1907 arg_0,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
1908 timeout=const_TIMEOUT,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
1909 reply_handler=reply_handler,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
1910 error_handler=error_handler,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
1911 )
3042
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
1912 return fut
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
1913
4037
524856bd7b19 massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents: 3648
diff changeset
1914 def image_convert(self, source, dest, arg_2, extra):
3042
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
1915 loop = asyncio.get_running_loop()
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
1916 fut = loop.create_future()
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
1917 reply_handler = lambda ret=None: loop.call_soon_threadsafe(fut.set_result, ret)
4284
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
1918 error_handler = lambda err: loop.call_soon_threadsafe(
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
1919 fut.set_exception, dbus_to_bridge_exception(err)
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
1920 )
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
1921 self.db_core_iface.image_convert(
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
1922 source,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
1923 dest,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
1924 arg_2,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
1925 extra,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
1926 timeout=const_TIMEOUT,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
1927 reply_handler=reply_handler,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
1928 error_handler=error_handler,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
1929 )
3042
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
1930 return fut
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
1931
4037
524856bd7b19 massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents: 3648
diff changeset
1932 def image_generate_preview(self, image_path, profile_key):
3042
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
1933 loop = asyncio.get_running_loop()
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
1934 fut = loop.create_future()
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
1935 reply_handler = lambda ret=None: loop.call_soon_threadsafe(fut.set_result, ret)
4284
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
1936 error_handler = lambda err: loop.call_soon_threadsafe(
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
1937 fut.set_exception, dbus_to_bridge_exception(err)
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
1938 )
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
1939 self.db_core_iface.image_generate_preview(
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
1940 image_path,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
1941 profile_key,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
1942 timeout=const_TIMEOUT,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
1943 reply_handler=reply_handler,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
1944 error_handler=error_handler,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
1945 )
3042
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
1946 return fut
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
1947
4037
524856bd7b19 massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents: 3648
diff changeset
1948 def image_resize(self, image_path, width, height):
3042
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
1949 loop = asyncio.get_running_loop()
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
1950 fut = loop.create_future()
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
1951 reply_handler = lambda ret=None: loop.call_soon_threadsafe(fut.set_result, ret)
4284
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
1952 error_handler = lambda err: loop.call_soon_threadsafe(
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
1953 fut.set_exception, dbus_to_bridge_exception(err)
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
1954 )
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
1955 self.db_core_iface.image_resize(
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
1956 image_path,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
1957 width,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
1958 height,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
1959 timeout=const_TIMEOUT,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
1960 reply_handler=reply_handler,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
1961 error_handler=error_handler,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
1962 )
3042
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
1963 return fut
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
1964
4193
730f542e4ad0 core: add new `init_script_path` option:
Goffi <goffi@goffi.org>
parents: 4147
diff changeset
1965 def init_pre_script(self):
730f542e4ad0 core: add new `init_script_path` option:
Goffi <goffi@goffi.org>
parents: 4147
diff changeset
1966 loop = asyncio.get_running_loop()
730f542e4ad0 core: add new `init_script_path` option:
Goffi <goffi@goffi.org>
parents: 4147
diff changeset
1967 fut = loop.create_future()
730f542e4ad0 core: add new `init_script_path` option:
Goffi <goffi@goffi.org>
parents: 4147
diff changeset
1968 reply_handler = lambda ret=None: loop.call_soon_threadsafe(fut.set_result, ret)
4284
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
1969 error_handler = lambda err: loop.call_soon_threadsafe(
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
1970 fut.set_exception, dbus_to_bridge_exception(err)
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
1971 )
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
1972 self.db_core_iface.init_pre_script(
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
1973 timeout=const_TIMEOUT,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
1974 reply_handler=reply_handler,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
1975 error_handler=error_handler,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
1976 )
4193
730f542e4ad0 core: add new `init_script_path` option:
Goffi <goffi@goffi.org>
parents: 4147
diff changeset
1977 return fut
730f542e4ad0 core: add new `init_script_path` option:
Goffi <goffi@goffi.org>
parents: 4147
diff changeset
1978
4037
524856bd7b19 massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents: 3648
diff changeset
1979 def is_connected(self, profile_key="@DEFAULT@"):
3042
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
1980 loop = asyncio.get_running_loop()
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
1981 fut = loop.create_future()
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
1982 reply_handler = lambda ret=None: loop.call_soon_threadsafe(fut.set_result, ret)
4284
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
1983 error_handler = lambda err: loop.call_soon_threadsafe(
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
1984 fut.set_exception, dbus_to_bridge_exception(err)
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
1985 )
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
1986 self.db_core_iface.is_connected(
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
1987 profile_key,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
1988 timeout=const_TIMEOUT,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
1989 reply_handler=reply_handler,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
1990 error_handler=error_handler,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
1991 )
3042
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
1992 return fut
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
1993
4037
524856bd7b19 massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents: 3648
diff changeset
1994 def main_resource_get(self, contact_jid, profile_key="@DEFAULT@"):
3042
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
1995 loop = asyncio.get_running_loop()
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
1996 fut = loop.create_future()
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
1997 reply_handler = lambda ret=None: loop.call_soon_threadsafe(fut.set_result, ret)
4284
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
1998 error_handler = lambda err: loop.call_soon_threadsafe(
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
1999 fut.set_exception, dbus_to_bridge_exception(err)
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
2000 )
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
2001 self.db_core_iface.main_resource_get(
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
2002 contact_jid,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
2003 profile_key,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
2004 timeout=const_TIMEOUT,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
2005 reply_handler=reply_handler,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
2006 error_handler=error_handler,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
2007 )
3042
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
2008 return fut
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
2009
4037
524856bd7b19 massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents: 3648
diff changeset
2010 def menu_help_get(self, menu_id, language):
3042
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
2011 loop = asyncio.get_running_loop()
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
2012 fut = loop.create_future()
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
2013 reply_handler = lambda ret=None: loop.call_soon_threadsafe(fut.set_result, ret)
4284
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
2014 error_handler = lambda err: loop.call_soon_threadsafe(
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
2015 fut.set_exception, dbus_to_bridge_exception(err)
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
2016 )
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
2017 self.db_core_iface.menu_help_get(
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
2018 menu_id,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
2019 language,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
2020 timeout=const_TIMEOUT,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
2021 reply_handler=reply_handler,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
2022 error_handler=error_handler,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
2023 )
3042
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
2024 return fut
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
2025
4037
524856bd7b19 massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents: 3648
diff changeset
2026 def menu_launch(self, menu_type, path, data, security_limit, profile_key):
3042
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
2027 loop = asyncio.get_running_loop()
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
2028 fut = loop.create_future()
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
2029 reply_handler = lambda ret=None: loop.call_soon_threadsafe(fut.set_result, ret)
4284
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
2030 error_handler = lambda err: loop.call_soon_threadsafe(
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
2031 fut.set_exception, dbus_to_bridge_exception(err)
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
2032 )
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
2033 self.db_core_iface.menu_launch(
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
2034 menu_type,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
2035 path,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
2036 data,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
2037 security_limit,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
2038 profile_key,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
2039 timeout=const_TIMEOUT,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
2040 reply_handler=reply_handler,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
2041 error_handler=error_handler,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
2042 )
3042
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
2043 return fut
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
2044
4037
524856bd7b19 massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents: 3648
diff changeset
2045 def menus_get(self, language, security_limit):
3042
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
2046 loop = asyncio.get_running_loop()
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
2047 fut = loop.create_future()
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
2048 reply_handler = lambda ret=None: loop.call_soon_threadsafe(fut.set_result, ret)
4284
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
2049 error_handler = lambda err: loop.call_soon_threadsafe(
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
2050 fut.set_exception, dbus_to_bridge_exception(err)
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
2051 )
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
2052 self.db_core_iface.menus_get(
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
2053 language,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
2054 security_limit,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
2055 timeout=const_TIMEOUT,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
2056 reply_handler=reply_handler,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
2057 error_handler=error_handler,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
2058 )
3042
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
2059 return fut
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
2060
4037
524856bd7b19 massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents: 3648
diff changeset
2061 def message_encryption_get(self, to_jid, profile_key):
3042
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
2062 loop = asyncio.get_running_loop()
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
2063 fut = loop.create_future()
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
2064 reply_handler = lambda ret=None: loop.call_soon_threadsafe(fut.set_result, ret)
4284
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
2065 error_handler = lambda err: loop.call_soon_threadsafe(
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
2066 fut.set_exception, dbus_to_bridge_exception(err)
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
2067 )
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
2068 self.db_core_iface.message_encryption_get(
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
2069 to_jid,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
2070 profile_key,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
2071 timeout=const_TIMEOUT,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
2072 reply_handler=reply_handler,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
2073 error_handler=error_handler,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
2074 )
3042
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
2075 return fut
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
2076
4284
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
2077 def message_encryption_start(
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
2078 self, to_jid, namespace="", replace=False, profile_key="@NONE@"
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
2079 ):
3066
2cc2f65379f7 core: added imageCheck and imageResize methods:
Goffi <goffi@goffi.org>
parents: 3042
diff changeset
2080 loop = asyncio.get_running_loop()
2cc2f65379f7 core: added imageCheck and imageResize methods:
Goffi <goffi@goffi.org>
parents: 3042
diff changeset
2081 fut = loop.create_future()
2cc2f65379f7 core: added imageCheck and imageResize methods:
Goffi <goffi@goffi.org>
parents: 3042
diff changeset
2082 reply_handler = lambda ret=None: loop.call_soon_threadsafe(fut.set_result, ret)
4284
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
2083 error_handler = lambda err: loop.call_soon_threadsafe(
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
2084 fut.set_exception, dbus_to_bridge_exception(err)
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
2085 )
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
2086 self.db_core_iface.message_encryption_start(
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
2087 to_jid,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
2088 namespace,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
2089 replace,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
2090 profile_key,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
2091 timeout=const_TIMEOUT,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
2092 reply_handler=reply_handler,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
2093 error_handler=error_handler,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
2094 )
3066
2cc2f65379f7 core: added imageCheck and imageResize methods:
Goffi <goffi@goffi.org>
parents: 3042
diff changeset
2095 return fut
2cc2f65379f7 core: added imageCheck and imageResize methods:
Goffi <goffi@goffi.org>
parents: 3042
diff changeset
2096
4037
524856bd7b19 massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents: 3648
diff changeset
2097 def message_encryption_stop(self, to_jid, profile_key):
3259
f300d78f08f3 core: image convertion + SVG support:
Goffi <goffi@goffi.org>
parents: 3254
diff changeset
2098 loop = asyncio.get_running_loop()
f300d78f08f3 core: image convertion + SVG support:
Goffi <goffi@goffi.org>
parents: 3254
diff changeset
2099 fut = loop.create_future()
f300d78f08f3 core: image convertion + SVG support:
Goffi <goffi@goffi.org>
parents: 3254
diff changeset
2100 reply_handler = lambda ret=None: loop.call_soon_threadsafe(fut.set_result, ret)
4284
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
2101 error_handler = lambda err: loop.call_soon_threadsafe(
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
2102 fut.set_exception, dbus_to_bridge_exception(err)
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
2103 )
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
2104 self.db_core_iface.message_encryption_stop(
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
2105 to_jid,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
2106 profile_key,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
2107 timeout=const_TIMEOUT,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
2108 reply_handler=reply_handler,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
2109 error_handler=error_handler,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
2110 )
3259
f300d78f08f3 core: image convertion + SVG support:
Goffi <goffi@goffi.org>
parents: 3254
diff changeset
2111 return fut
f300d78f08f3 core: image convertion + SVG support:
Goffi <goffi@goffi.org>
parents: 3254
diff changeset
2112
4284
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
2113 def message_send(
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
2114 self,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
2115 to_jid,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
2116 message,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
2117 subject={},
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
2118 mess_type="auto",
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
2119 extra={},
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
2120 profile_key="@NONE@",
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
2121 ):
3201
439e2f88c3a9 core, bridge: new `imageGeneratePreview` helped method to generate a thumbnail
Goffi <goffi@goffi.org>
parents: 3163
diff changeset
2122 loop = asyncio.get_running_loop()
439e2f88c3a9 core, bridge: new `imageGeneratePreview` helped method to generate a thumbnail
Goffi <goffi@goffi.org>
parents: 3163
diff changeset
2123 fut = loop.create_future()
439e2f88c3a9 core, bridge: new `imageGeneratePreview` helped method to generate a thumbnail
Goffi <goffi@goffi.org>
parents: 3163
diff changeset
2124 reply_handler = lambda ret=None: loop.call_soon_threadsafe(fut.set_result, ret)
4284
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
2125 error_handler = lambda err: loop.call_soon_threadsafe(
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
2126 fut.set_exception, dbus_to_bridge_exception(err)
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
2127 )
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
2128 self.db_core_iface.message_send(
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
2129 to_jid,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
2130 message,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
2131 subject,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
2132 mess_type,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
2133 extra,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
2134 profile_key,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
2135 timeout=const_TIMEOUT,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
2136 reply_handler=reply_handler,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
2137 error_handler=error_handler,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
2138 )
3201
439e2f88c3a9 core, bridge: new `imageGeneratePreview` helped method to generate a thumbnail
Goffi <goffi@goffi.org>
parents: 3163
diff changeset
2139 return fut
439e2f88c3a9 core, bridge: new `imageGeneratePreview` helped method to generate a thumbnail
Goffi <goffi@goffi.org>
parents: 3163
diff changeset
2140
4037
524856bd7b19 massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents: 3648
diff changeset
2141 def namespaces_get(self):
3066
2cc2f65379f7 core: added imageCheck and imageResize methods:
Goffi <goffi@goffi.org>
parents: 3042
diff changeset
2142 loop = asyncio.get_running_loop()
2cc2f65379f7 core: added imageCheck and imageResize methods:
Goffi <goffi@goffi.org>
parents: 3042
diff changeset
2143 fut = loop.create_future()
2cc2f65379f7 core: added imageCheck and imageResize methods:
Goffi <goffi@goffi.org>
parents: 3042
diff changeset
2144 reply_handler = lambda ret=None: loop.call_soon_threadsafe(fut.set_result, ret)
4284
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
2145 error_handler = lambda err: loop.call_soon_threadsafe(
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
2146 fut.set_exception, dbus_to_bridge_exception(err)
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
2147 )
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
2148 self.db_core_iface.namespaces_get(
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
2149 timeout=const_TIMEOUT,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
2150 reply_handler=reply_handler,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
2151 error_handler=error_handler,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
2152 )
3066
2cc2f65379f7 core: added imageCheck and imageResize methods:
Goffi <goffi@goffi.org>
parents: 3042
diff changeset
2153 return fut
2cc2f65379f7 core: added imageCheck and imageResize methods:
Goffi <goffi@goffi.org>
parents: 3042
diff changeset
2154
4284
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
2155 def notification_add(
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
2156 self,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
2157 type_,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
2158 body_plain,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
2159 body_rich,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
2160 title,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
2161 is_global,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
2162 requires_action,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
2163 arg_6,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
2164 priority,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
2165 expire_at,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
2166 extra,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
2167 ):
4130
02f0adc745c6 core: notifications implementation, first draft:
Goffi <goffi@goffi.org>
parents: 4074
diff changeset
2168 loop = asyncio.get_running_loop()
02f0adc745c6 core: notifications implementation, first draft:
Goffi <goffi@goffi.org>
parents: 4074
diff changeset
2169 fut = loop.create_future()
02f0adc745c6 core: notifications implementation, first draft:
Goffi <goffi@goffi.org>
parents: 4074
diff changeset
2170 reply_handler = lambda ret=None: loop.call_soon_threadsafe(fut.set_result, ret)
4284
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
2171 error_handler = lambda err: loop.call_soon_threadsafe(
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
2172 fut.set_exception, dbus_to_bridge_exception(err)
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
2173 )
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
2174 self.db_core_iface.notification_add(
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
2175 type_,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
2176 body_plain,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
2177 body_rich,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
2178 title,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
2179 is_global,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
2180 requires_action,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
2181 arg_6,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
2182 priority,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
2183 expire_at,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
2184 extra,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
2185 timeout=const_TIMEOUT,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
2186 reply_handler=reply_handler,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
2187 error_handler=error_handler,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
2188 )
4130
02f0adc745c6 core: notifications implementation, first draft:
Goffi <goffi@goffi.org>
parents: 4074
diff changeset
2189 return fut
02f0adc745c6 core: notifications implementation, first draft:
Goffi <goffi@goffi.org>
parents: 4074
diff changeset
2190
02f0adc745c6 core: notifications implementation, first draft:
Goffi <goffi@goffi.org>
parents: 4074
diff changeset
2191 def notification_delete(self, id_, is_global, profile_key):
02f0adc745c6 core: notifications implementation, first draft:
Goffi <goffi@goffi.org>
parents: 4074
diff changeset
2192 loop = asyncio.get_running_loop()
02f0adc745c6 core: notifications implementation, first draft:
Goffi <goffi@goffi.org>
parents: 4074
diff changeset
2193 fut = loop.create_future()
02f0adc745c6 core: notifications implementation, first draft:
Goffi <goffi@goffi.org>
parents: 4074
diff changeset
2194 reply_handler = lambda ret=None: loop.call_soon_threadsafe(fut.set_result, ret)
4284
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
2195 error_handler = lambda err: loop.call_soon_threadsafe(
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
2196 fut.set_exception, dbus_to_bridge_exception(err)
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
2197 )
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
2198 self.db_core_iface.notification_delete(
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
2199 id_,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
2200 is_global,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
2201 profile_key,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
2202 timeout=const_TIMEOUT,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
2203 reply_handler=reply_handler,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
2204 error_handler=error_handler,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
2205 )
4130
02f0adc745c6 core: notifications implementation, first draft:
Goffi <goffi@goffi.org>
parents: 4074
diff changeset
2206 return fut
02f0adc745c6 core: notifications implementation, first draft:
Goffi <goffi@goffi.org>
parents: 4074
diff changeset
2207
02f0adc745c6 core: notifications implementation, first draft:
Goffi <goffi@goffi.org>
parents: 4074
diff changeset
2208 def notifications_expired_clean(self, limit_timestamp, profile_key):
02f0adc745c6 core: notifications implementation, first draft:
Goffi <goffi@goffi.org>
parents: 4074
diff changeset
2209 loop = asyncio.get_running_loop()
02f0adc745c6 core: notifications implementation, first draft:
Goffi <goffi@goffi.org>
parents: 4074
diff changeset
2210 fut = loop.create_future()
02f0adc745c6 core: notifications implementation, first draft:
Goffi <goffi@goffi.org>
parents: 4074
diff changeset
2211 reply_handler = lambda ret=None: loop.call_soon_threadsafe(fut.set_result, ret)
4284
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
2212 error_handler = lambda err: loop.call_soon_threadsafe(
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
2213 fut.set_exception, dbus_to_bridge_exception(err)
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
2214 )
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
2215 self.db_core_iface.notifications_expired_clean(
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
2216 limit_timestamp,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
2217 profile_key,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
2218 timeout=const_TIMEOUT,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
2219 reply_handler=reply_handler,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
2220 error_handler=error_handler,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
2221 )
4130
02f0adc745c6 core: notifications implementation, first draft:
Goffi <goffi@goffi.org>
parents: 4074
diff changeset
2222 return fut
02f0adc745c6 core: notifications implementation, first draft:
Goffi <goffi@goffi.org>
parents: 4074
diff changeset
2223
02f0adc745c6 core: notifications implementation, first draft:
Goffi <goffi@goffi.org>
parents: 4074
diff changeset
2224 def notifications_get(self, filters, profile_key):
02f0adc745c6 core: notifications implementation, first draft:
Goffi <goffi@goffi.org>
parents: 4074
diff changeset
2225 loop = asyncio.get_running_loop()
02f0adc745c6 core: notifications implementation, first draft:
Goffi <goffi@goffi.org>
parents: 4074
diff changeset
2226 fut = loop.create_future()
02f0adc745c6 core: notifications implementation, first draft:
Goffi <goffi@goffi.org>
parents: 4074
diff changeset
2227 reply_handler = lambda ret=None: loop.call_soon_threadsafe(fut.set_result, ret)
4284
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
2228 error_handler = lambda err: loop.call_soon_threadsafe(
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
2229 fut.set_exception, dbus_to_bridge_exception(err)
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
2230 )
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
2231 self.db_core_iface.notifications_get(
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
2232 filters,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
2233 profile_key,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
2234 timeout=const_TIMEOUT,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
2235 reply_handler=reply_handler,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
2236 error_handler=error_handler,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
2237 )
4130
02f0adc745c6 core: notifications implementation, first draft:
Goffi <goffi@goffi.org>
parents: 4074
diff changeset
2238 return fut
02f0adc745c6 core: notifications implementation, first draft:
Goffi <goffi@goffi.org>
parents: 4074
diff changeset
2239
4037
524856bd7b19 massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents: 3648
diff changeset
2240 def param_get_a(self, name, category, attribute="value", profile_key="@DEFAULT@"):
3042
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
2241 loop = asyncio.get_running_loop()
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
2242 fut = loop.create_future()
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
2243 reply_handler = lambda ret=None: loop.call_soon_threadsafe(fut.set_result, ret)
4284
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
2244 error_handler = lambda err: loop.call_soon_threadsafe(
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
2245 fut.set_exception, dbus_to_bridge_exception(err)
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
2246 )
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
2247 self.db_core_iface.param_get_a(
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
2248 name,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
2249 category,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
2250 attribute,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
2251 profile_key,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
2252 timeout=const_TIMEOUT,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
2253 reply_handler=reply_handler,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
2254 error_handler=error_handler,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
2255 )
3042
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
2256 return fut
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
2257
4284
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
2258 def param_get_a_async(
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
2259 self,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
2260 name,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
2261 category,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
2262 attribute="value",
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
2263 security_limit=-1,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
2264 profile_key="@DEFAULT@",
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
2265 ):
3042
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
2266 loop = asyncio.get_running_loop()
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
2267 fut = loop.create_future()
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
2268 reply_handler = lambda ret=None: loop.call_soon_threadsafe(fut.set_result, ret)
4284
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
2269 error_handler = lambda err: loop.call_soon_threadsafe(
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
2270 fut.set_exception, dbus_to_bridge_exception(err)
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
2271 )
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
2272 self.db_core_iface.param_get_a_async(
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
2273 name,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
2274 category,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
2275 attribute,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
2276 security_limit,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
2277 profile_key,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
2278 timeout=const_TIMEOUT,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
2279 reply_handler=reply_handler,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
2280 error_handler=error_handler,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
2281 )
3042
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
2282 return fut
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
2283
4284
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
2284 def param_set(
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
2285 self, name, value, category, security_limit=-1, profile_key="@DEFAULT@"
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
2286 ):
3042
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
2287 loop = asyncio.get_running_loop()
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
2288 fut = loop.create_future()
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
2289 reply_handler = lambda ret=None: loop.call_soon_threadsafe(fut.set_result, ret)
4284
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
2290 error_handler = lambda err: loop.call_soon_threadsafe(
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
2291 fut.set_exception, dbus_to_bridge_exception(err)
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
2292 )
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
2293 self.db_core_iface.param_set(
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
2294 name,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
2295 value,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
2296 category,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
2297 security_limit,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
2298 profile_key,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
2299 timeout=const_TIMEOUT,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
2300 reply_handler=reply_handler,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
2301 error_handler=error_handler,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
2302 )
3042
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
2303 return fut
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
2304
4284
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
2305 def param_ui_get(self, security_limit=-1, app="", extra="", profile_key="@DEFAULT@"):
3042
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
2306 loop = asyncio.get_running_loop()
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
2307 fut = loop.create_future()
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
2308 reply_handler = lambda ret=None: loop.call_soon_threadsafe(fut.set_result, ret)
4284
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
2309 error_handler = lambda err: loop.call_soon_threadsafe(
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
2310 fut.set_exception, dbus_to_bridge_exception(err)
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
2311 )
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
2312 self.db_core_iface.param_ui_get(
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
2313 security_limit,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
2314 app,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
2315 extra,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
2316 profile_key,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
2317 timeout=const_TIMEOUT,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
2318 reply_handler=reply_handler,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
2319 error_handler=error_handler,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
2320 )
3042
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
2321 return fut
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
2322
4037
524856bd7b19 massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents: 3648
diff changeset
2323 def params_categories_get(self):
3042
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
2324 loop = asyncio.get_running_loop()
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
2325 fut = loop.create_future()
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
2326 reply_handler = lambda ret=None: loop.call_soon_threadsafe(fut.set_result, ret)
4284
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
2327 error_handler = lambda err: loop.call_soon_threadsafe(
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
2328 fut.set_exception, dbus_to_bridge_exception(err)
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
2329 )
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
2330 self.db_core_iface.params_categories_get(
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
2331 timeout=const_TIMEOUT,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
2332 reply_handler=reply_handler,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
2333 error_handler=error_handler,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
2334 )
3042
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
2335 return fut
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
2336
4284
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
2337 def params_register_app(self, xml, security_limit=-1, app=""):
3042
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
2338 loop = asyncio.get_running_loop()
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
2339 fut = loop.create_future()
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
2340 reply_handler = lambda ret=None: loop.call_soon_threadsafe(fut.set_result, ret)
4284
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
2341 error_handler = lambda err: loop.call_soon_threadsafe(
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
2342 fut.set_exception, dbus_to_bridge_exception(err)
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
2343 )
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
2344 self.db_core_iface.params_register_app(
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
2345 xml,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
2346 security_limit,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
2347 app,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
2348 timeout=const_TIMEOUT,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
2349 reply_handler=reply_handler,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
2350 error_handler=error_handler,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
2351 )
3042
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
2352 return fut
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
2353
4037
524856bd7b19 massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents: 3648
diff changeset
2354 def params_template_load(self, filename):
3042
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
2355 loop = asyncio.get_running_loop()
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
2356 fut = loop.create_future()
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
2357 reply_handler = lambda ret=None: loop.call_soon_threadsafe(fut.set_result, ret)
4284
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
2358 error_handler = lambda err: loop.call_soon_threadsafe(
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
2359 fut.set_exception, dbus_to_bridge_exception(err)
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
2360 )
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
2361 self.db_core_iface.params_template_load(
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
2362 filename,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
2363 timeout=const_TIMEOUT,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
2364 reply_handler=reply_handler,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
2365 error_handler=error_handler,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
2366 )
3042
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
2367 return fut
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
2368
4037
524856bd7b19 massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents: 3648
diff changeset
2369 def params_template_save(self, filename):
3042
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
2370 loop = asyncio.get_running_loop()
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
2371 fut = loop.create_future()
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
2372 reply_handler = lambda ret=None: loop.call_soon_threadsafe(fut.set_result, ret)
4284
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
2373 error_handler = lambda err: loop.call_soon_threadsafe(
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
2374 fut.set_exception, dbus_to_bridge_exception(err)
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
2375 )
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
2376 self.db_core_iface.params_template_save(
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
2377 filename,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
2378 timeout=const_TIMEOUT,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
2379 reply_handler=reply_handler,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
2380 error_handler=error_handler,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
2381 )
3042
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
2382 return fut
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
2383
4284
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
2384 def params_values_from_category_get_async(
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
2385 self, category, security_limit=-1, app="", extra="", profile_key="@DEFAULT@"
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
2386 ):
3042
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
2387 loop = asyncio.get_running_loop()
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
2388 fut = loop.create_future()
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
2389 reply_handler = lambda ret=None: loop.call_soon_threadsafe(fut.set_result, ret)
4284
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
2390 error_handler = lambda err: loop.call_soon_threadsafe(
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
2391 fut.set_exception, dbus_to_bridge_exception(err)
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
2392 )
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
2393 self.db_core_iface.params_values_from_category_get_async(
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
2394 category,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
2395 security_limit,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
2396 app,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
2397 extra,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
2398 profile_key,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
2399 timeout=const_TIMEOUT,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
2400 reply_handler=reply_handler,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
2401 error_handler=error_handler,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
2402 )
3042
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
2403 return fut
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
2404
4284
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
2405 def presence_set(self, to_jid="", show="", statuses={}, profile_key="@DEFAULT@"):
3042
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
2406 loop = asyncio.get_running_loop()
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
2407 fut = loop.create_future()
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
2408 reply_handler = lambda ret=None: loop.call_soon_threadsafe(fut.set_result, ret)
4284
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
2409 error_handler = lambda err: loop.call_soon_threadsafe(
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
2410 fut.set_exception, dbus_to_bridge_exception(err)
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
2411 )
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
2412 self.db_core_iface.presence_set(
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
2413 to_jid,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
2414 show,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
2415 statuses,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
2416 profile_key,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
2417 timeout=const_TIMEOUT,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
2418 reply_handler=reply_handler,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
2419 error_handler=error_handler,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
2420 )
3042
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
2421 return fut
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
2422
4037
524856bd7b19 massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents: 3648
diff changeset
2423 def presence_statuses_get(self, profile_key="@DEFAULT@"):
3042
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
2424 loop = asyncio.get_running_loop()
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
2425 fut = loop.create_future()
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
2426 reply_handler = lambda ret=None: loop.call_soon_threadsafe(fut.set_result, ret)
4284
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
2427 error_handler = lambda err: loop.call_soon_threadsafe(
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
2428 fut.set_exception, dbus_to_bridge_exception(err)
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
2429 )
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
2430 self.db_core_iface.presence_statuses_get(
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
2431 profile_key,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
2432 timeout=const_TIMEOUT,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
2433 reply_handler=reply_handler,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
2434 error_handler=error_handler,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
2435 )
3042
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
2436 return fut
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
2437
4037
524856bd7b19 massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents: 3648
diff changeset
2438 def private_data_delete(self, namespace, key, arg_2):
3163
d10b2368684e bridge: added methods to let frontends store/retrieve/delete private data
Goffi <goffi@goffi.org>
parents: 3143
diff changeset
2439 loop = asyncio.get_running_loop()
d10b2368684e bridge: added methods to let frontends store/retrieve/delete private data
Goffi <goffi@goffi.org>
parents: 3143
diff changeset
2440 fut = loop.create_future()
d10b2368684e bridge: added methods to let frontends store/retrieve/delete private data
Goffi <goffi@goffi.org>
parents: 3143
diff changeset
2441 reply_handler = lambda ret=None: loop.call_soon_threadsafe(fut.set_result, ret)
4284
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
2442 error_handler = lambda err: loop.call_soon_threadsafe(
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
2443 fut.set_exception, dbus_to_bridge_exception(err)
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
2444 )
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
2445 self.db_core_iface.private_data_delete(
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
2446 namespace,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
2447 key,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
2448 arg_2,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
2449 timeout=const_TIMEOUT,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
2450 reply_handler=reply_handler,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
2451 error_handler=error_handler,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
2452 )
3163
d10b2368684e bridge: added methods to let frontends store/retrieve/delete private data
Goffi <goffi@goffi.org>
parents: 3143
diff changeset
2453 return fut
d10b2368684e bridge: added methods to let frontends store/retrieve/delete private data
Goffi <goffi@goffi.org>
parents: 3143
diff changeset
2454
4037
524856bd7b19 massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents: 3648
diff changeset
2455 def private_data_get(self, namespace, key, profile_key):
3163
d10b2368684e bridge: added methods to let frontends store/retrieve/delete private data
Goffi <goffi@goffi.org>
parents: 3143
diff changeset
2456 loop = asyncio.get_running_loop()
d10b2368684e bridge: added methods to let frontends store/retrieve/delete private data
Goffi <goffi@goffi.org>
parents: 3143
diff changeset
2457 fut = loop.create_future()
d10b2368684e bridge: added methods to let frontends store/retrieve/delete private data
Goffi <goffi@goffi.org>
parents: 3143
diff changeset
2458 reply_handler = lambda ret=None: loop.call_soon_threadsafe(fut.set_result, ret)
4284
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
2459 error_handler = lambda err: loop.call_soon_threadsafe(
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
2460 fut.set_exception, dbus_to_bridge_exception(err)
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
2461 )
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
2462 self.db_core_iface.private_data_get(
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
2463 namespace,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
2464 key,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
2465 profile_key,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
2466 timeout=const_TIMEOUT,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
2467 reply_handler=reply_handler,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
2468 error_handler=error_handler,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
2469 )
3163
d10b2368684e bridge: added methods to let frontends store/retrieve/delete private data
Goffi <goffi@goffi.org>
parents: 3143
diff changeset
2470 return fut
d10b2368684e bridge: added methods to let frontends store/retrieve/delete private data
Goffi <goffi@goffi.org>
parents: 3143
diff changeset
2471
4037
524856bd7b19 massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents: 3648
diff changeset
2472 def private_data_set(self, namespace, key, data, profile_key):
3163
d10b2368684e bridge: added methods to let frontends store/retrieve/delete private data
Goffi <goffi@goffi.org>
parents: 3143
diff changeset
2473 loop = asyncio.get_running_loop()
d10b2368684e bridge: added methods to let frontends store/retrieve/delete private data
Goffi <goffi@goffi.org>
parents: 3143
diff changeset
2474 fut = loop.create_future()
d10b2368684e bridge: added methods to let frontends store/retrieve/delete private data
Goffi <goffi@goffi.org>
parents: 3143
diff changeset
2475 reply_handler = lambda ret=None: loop.call_soon_threadsafe(fut.set_result, ret)
4284
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
2476 error_handler = lambda err: loop.call_soon_threadsafe(
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
2477 fut.set_exception, dbus_to_bridge_exception(err)
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
2478 )
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
2479 self.db_core_iface.private_data_set(
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
2480 namespace,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
2481 key,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
2482 data,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
2483 profile_key,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
2484 timeout=const_TIMEOUT,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
2485 reply_handler=reply_handler,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
2486 error_handler=error_handler,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
2487 )
3163
d10b2368684e bridge: added methods to let frontends store/retrieve/delete private data
Goffi <goffi@goffi.org>
parents: 3143
diff changeset
2488 return fut
d10b2368684e bridge: added methods to let frontends store/retrieve/delete private data
Goffi <goffi@goffi.org>
parents: 3143
diff changeset
2489
4284
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
2490 def profile_create(self, profile, password="", component=""):
3042
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
2491 loop = asyncio.get_running_loop()
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
2492 fut = loop.create_future()
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
2493 reply_handler = lambda ret=None: loop.call_soon_threadsafe(fut.set_result, ret)
4284
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
2494 error_handler = lambda err: loop.call_soon_threadsafe(
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
2495 fut.set_exception, dbus_to_bridge_exception(err)
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
2496 )
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
2497 self.db_core_iface.profile_create(
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
2498 profile,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
2499 password,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
2500 component,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
2501 timeout=const_TIMEOUT,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
2502 reply_handler=reply_handler,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
2503 error_handler=error_handler,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
2504 )
3042
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
2505 return fut
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
2506
4037
524856bd7b19 massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents: 3648
diff changeset
2507 def profile_delete_async(self, profile):
3042
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
2508 loop = asyncio.get_running_loop()
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
2509 fut = loop.create_future()
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
2510 reply_handler = lambda ret=None: loop.call_soon_threadsafe(fut.set_result, ret)
4284
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
2511 error_handler = lambda err: loop.call_soon_threadsafe(
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
2512 fut.set_exception, dbus_to_bridge_exception(err)
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
2513 )
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
2514 self.db_core_iface.profile_delete_async(
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
2515 profile,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
2516 timeout=const_TIMEOUT,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
2517 reply_handler=reply_handler,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
2518 error_handler=error_handler,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
2519 )
3042
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
2520 return fut
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
2521
4037
524856bd7b19 massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents: 3648
diff changeset
2522 def profile_is_session_started(self, profile_key="@DEFAULT@"):
3042
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
2523 loop = asyncio.get_running_loop()
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
2524 fut = loop.create_future()
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
2525 reply_handler = lambda ret=None: loop.call_soon_threadsafe(fut.set_result, ret)
4284
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
2526 error_handler = lambda err: loop.call_soon_threadsafe(
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
2527 fut.set_exception, dbus_to_bridge_exception(err)
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
2528 )
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
2529 self.db_core_iface.profile_is_session_started(
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
2530 profile_key,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
2531 timeout=const_TIMEOUT,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
2532 reply_handler=reply_handler,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
2533 error_handler=error_handler,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
2534 )
3042
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
2535 return fut
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
2536
4037
524856bd7b19 massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents: 3648
diff changeset
2537 def profile_name_get(self, profile_key="@DEFAULT@"):
3042
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
2538 loop = asyncio.get_running_loop()
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
2539 fut = loop.create_future()
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
2540 reply_handler = lambda ret=None: loop.call_soon_threadsafe(fut.set_result, ret)
4284
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
2541 error_handler = lambda err: loop.call_soon_threadsafe(
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
2542 fut.set_exception, dbus_to_bridge_exception(err)
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
2543 )
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
2544 self.db_core_iface.profile_name_get(
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
2545 profile_key,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
2546 timeout=const_TIMEOUT,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
2547 reply_handler=reply_handler,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
2548 error_handler=error_handler,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
2549 )
3042
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
2550 return fut
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
2551
4037
524856bd7b19 massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents: 3648
diff changeset
2552 def profile_set_default(self, profile):
3042
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
2553 loop = asyncio.get_running_loop()
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
2554 fut = loop.create_future()
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
2555 reply_handler = lambda ret=None: loop.call_soon_threadsafe(fut.set_result, ret)
4284
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
2556 error_handler = lambda err: loop.call_soon_threadsafe(
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
2557 fut.set_exception, dbus_to_bridge_exception(err)
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
2558 )
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
2559 self.db_core_iface.profile_set_default(
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
2560 profile,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
2561 timeout=const_TIMEOUT,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
2562 reply_handler=reply_handler,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
2563 error_handler=error_handler,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
2564 )
3042
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
2565 return fut
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
2566
4284
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
2567 def profile_start_session(self, password="", profile_key="@DEFAULT@"):
3042
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
2568 loop = asyncio.get_running_loop()
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
2569 fut = loop.create_future()
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
2570 reply_handler = lambda ret=None: loop.call_soon_threadsafe(fut.set_result, ret)
4284
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
2571 error_handler = lambda err: loop.call_soon_threadsafe(
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
2572 fut.set_exception, dbus_to_bridge_exception(err)
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
2573 )
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
2574 self.db_core_iface.profile_start_session(
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
2575 password,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
2576 profile_key,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
2577 timeout=const_TIMEOUT,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
2578 reply_handler=reply_handler,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
2579 error_handler=error_handler,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
2580 )
3042
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
2581 return fut
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
2582
4037
524856bd7b19 massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents: 3648
diff changeset
2583 def profiles_list_get(self, clients=True, components=False):
3042
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
2584 loop = asyncio.get_running_loop()
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
2585 fut = loop.create_future()
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
2586 reply_handler = lambda ret=None: loop.call_soon_threadsafe(fut.set_result, ret)
4284
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
2587 error_handler = lambda err: loop.call_soon_threadsafe(
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
2588 fut.set_exception, dbus_to_bridge_exception(err)
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
2589 )
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
2590 self.db_core_iface.profiles_list_get(
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
2591 clients,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
2592 components,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
2593 timeout=const_TIMEOUT,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
2594 reply_handler=reply_handler,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
2595 error_handler=error_handler,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
2596 )
3042
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
2597 return fut
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
2598
4037
524856bd7b19 massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents: 3648
diff changeset
2599 def progress_get(self, id, profile):
3042
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
2600 loop = asyncio.get_running_loop()
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
2601 fut = loop.create_future()
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
2602 reply_handler = lambda ret=None: loop.call_soon_threadsafe(fut.set_result, ret)
4284
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
2603 error_handler = lambda err: loop.call_soon_threadsafe(
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
2604 fut.set_exception, dbus_to_bridge_exception(err)
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
2605 )
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
2606 self.db_core_iface.progress_get(
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
2607 id,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
2608 profile,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
2609 timeout=const_TIMEOUT,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
2610 reply_handler=reply_handler,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
2611 error_handler=error_handler,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
2612 )
3042
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
2613 return fut
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
2614
4037
524856bd7b19 massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents: 3648
diff changeset
2615 def progress_get_all(self, profile):
3042
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
2616 loop = asyncio.get_running_loop()
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
2617 fut = loop.create_future()
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
2618 reply_handler = lambda ret=None: loop.call_soon_threadsafe(fut.set_result, ret)
4284
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
2619 error_handler = lambda err: loop.call_soon_threadsafe(
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
2620 fut.set_exception, dbus_to_bridge_exception(err)
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
2621 )
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
2622 self.db_core_iface.progress_get_all(
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
2623 profile,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
2624 timeout=const_TIMEOUT,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
2625 reply_handler=reply_handler,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
2626 error_handler=error_handler,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
2627 )
3042
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
2628 return fut
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
2629
4037
524856bd7b19 massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents: 3648
diff changeset
2630 def progress_get_all_metadata(self, profile):
3042
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
2631 loop = asyncio.get_running_loop()
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
2632 fut = loop.create_future()
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
2633 reply_handler = lambda ret=None: loop.call_soon_threadsafe(fut.set_result, ret)
4284
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
2634 error_handler = lambda err: loop.call_soon_threadsafe(
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
2635 fut.set_exception, dbus_to_bridge_exception(err)
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
2636 )
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
2637 self.db_core_iface.progress_get_all_metadata(
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
2638 profile,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
2639 timeout=const_TIMEOUT,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
2640 reply_handler=reply_handler,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
2641 error_handler=error_handler,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
2642 )
3042
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
2643 return fut
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
2644
4037
524856bd7b19 massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents: 3648
diff changeset
2645 def ready_get(self):
3042
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
2646 loop = asyncio.get_running_loop()
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
2647 fut = loop.create_future()
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
2648 reply_handler = lambda ret=None: loop.call_soon_threadsafe(fut.set_result, ret)
4284
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
2649 error_handler = lambda err: loop.call_soon_threadsafe(
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
2650 fut.set_exception, dbus_to_bridge_exception(err)
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
2651 )
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
2652 self.db_core_iface.ready_get(
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
2653 timeout=const_TIMEOUT,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
2654 reply_handler=reply_handler,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
2655 error_handler=error_handler,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
2656 )
3042
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
2657 return fut
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
2658
4037
524856bd7b19 massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents: 3648
diff changeset
2659 def roster_resync(self, profile_key="@DEFAULT@"):
3042
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
2660 loop = asyncio.get_running_loop()
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
2661 fut = loop.create_future()
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
2662 reply_handler = lambda ret=None: loop.call_soon_threadsafe(fut.set_result, ret)
4284
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
2663 error_handler = lambda err: loop.call_soon_threadsafe(
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
2664 fut.set_exception, dbus_to_bridge_exception(err)
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
2665 )
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
2666 self.db_core_iface.roster_resync(
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
2667 profile_key,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
2668 timeout=const_TIMEOUT,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
2669 reply_handler=reply_handler,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
2670 error_handler=error_handler,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
2671 )
3042
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
2672 return fut
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
2673
4037
524856bd7b19 massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents: 3648
diff changeset
2674 def session_infos_get(self, profile_key):
3042
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
2675 loop = asyncio.get_running_loop()
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
2676 fut = loop.create_future()
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
2677 reply_handler = lambda ret=None: loop.call_soon_threadsafe(fut.set_result, ret)
4284
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
2678 error_handler = lambda err: loop.call_soon_threadsafe(
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
2679 fut.set_exception, dbus_to_bridge_exception(err)
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
2680 )
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
2681 self.db_core_iface.session_infos_get(
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
2682 profile_key,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
2683 timeout=const_TIMEOUT,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
2684 reply_handler=reply_handler,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
2685 error_handler=error_handler,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
2686 )
3042
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
2687 return fut
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
2688
4037
524856bd7b19 massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents: 3648
diff changeset
2689 def sub_waiting_get(self, profile_key="@DEFAULT@"):
3042
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
2690 loop = asyncio.get_running_loop()
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
2691 fut = loop.create_future()
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
2692 reply_handler = lambda ret=None: loop.call_soon_threadsafe(fut.set_result, ret)
4284
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
2693 error_handler = lambda err: loop.call_soon_threadsafe(
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
2694 fut.set_exception, dbus_to_bridge_exception(err)
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
2695 )
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
2696 self.db_core_iface.sub_waiting_get(
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
2697 profile_key,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
2698 timeout=const_TIMEOUT,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
2699 reply_handler=reply_handler,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
2700 error_handler=error_handler,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
2701 )
3042
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
2702 return fut
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
2703
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
2704 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
2705 loop = asyncio.get_running_loop()
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
2706 fut = loop.create_future()
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
2707 reply_handler = lambda ret=None: loop.call_soon_threadsafe(fut.set_result, ret)
4284
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
2708 error_handler = lambda err: loop.call_soon_threadsafe(
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
2709 fut.set_exception, dbus_to_bridge_exception(err)
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
2710 )
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
2711 self.db_core_iface.subscription(
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
2712 sub_type,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
2713 entity,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
2714 profile_key,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
2715 timeout=const_TIMEOUT,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
2716 reply_handler=reply_handler,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
2717 error_handler=error_handler,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
2718 )
3042
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
2719 return fut
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
2720
4037
524856bd7b19 massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents: 3648
diff changeset
2721 def version_get(self):
3042
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
2722 loop = asyncio.get_running_loop()
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
2723 fut = loop.create_future()
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
2724 reply_handler = lambda ret=None: loop.call_soon_threadsafe(fut.set_result, ret)
4284
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
2725 error_handler = lambda err: loop.call_soon_threadsafe(
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
2726 fut.set_exception, dbus_to_bridge_exception(err)
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
2727 )
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
2728 self.db_core_iface.version_get(
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
2729 timeout=const_TIMEOUT,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
2730 reply_handler=reply_handler,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
2731 error_handler=error_handler,
3a550e9a2b55 black reformatting
Goffi <goffi@goffi.org>
parents: 4280
diff changeset
2732 )
3042
964abd07dc03 bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3039
diff changeset
2733 return fut