Mercurial > libervia-backend
annotate libervia/frontends/bridge/dbus_bridge.py @ 4306:94e0968987cd
plugin XEP-0033: code modernisation, improve delivery, data validation:
- Code has been rewritten using Pydantic models and `async` coroutines for data validation
and cleaner element parsing/generation.
- Delivery has been completely rewritten. It now works even if server doesn't support
multicast, and send to local multicast service first. Delivering to local multicast
service first is due to bad support of XEP-0033 in server (notably Prosody which has an
incomplete implementation), and the current impossibility to detect if a sub-domain
service handles fully multicast or only for local domains. This is a workaround to have
a good balance between backward compatilibity and use of bandwith, and to make it work
with the incoming email gateway implementation (the gateway will only deliver to
entities of its own domain).
- disco feature checking now uses `async` corountines. `host` implementation still use
Deferred return values for compatibility with legacy code.
rel 450
author | Goffi <goffi@goffi.org> |
---|---|
date | Thu, 26 Sep 2024 16:12:01 +0200 |
parents | 3a550e9a2b55 |
children |
rev | line source |
---|---|
3028 | 1 #!/usr/bin/env python3 |
0 | 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 | 4 # Copyright (C) 2009-2021 Jérôme Poisson (goffi@goffi.org) |
0 | 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 | 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 | 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 | 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 | 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 | 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 | 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 | 99 |
2086 | 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 | 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 | 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 | 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 | 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 | 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 | 176 def action_launch( |
177 self, callback_id, data, profile_key="@DEFAULT@", callback=None, errback=None | |
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 | 184 error_handler = lambda err: errback(dbus_to_bridge_exception(err)) |
185 return str( | |
186 self.db_core_iface.action_launch( | |
187 callback_id, | |
188 data, | |
189 profile_key, | |
190 timeout=const_TIMEOUT, | |
191 reply_handler=callback, | |
192 error_handler=error_handler, | |
193 ) | |
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 | 197 if callback is None: |
198 error_handler = None | |
199 else: | |
200 if errback is None: | |
201 errback = log.error | |
4284 | 202 error_handler = lambda err: errback(dbus_to_bridge_exception(err)) |
203 kwargs = {} | |
1622 | 204 if callback is not None: |
4284 | 205 kwargs["timeout"] = const_TIMEOUT |
206 kwargs["reply_handler"] = callback | |
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 | 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 | 216 error_handler = lambda err: errback(dbus_to_bridge_exception(err)) |
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 | 219 kwargs["timeout"] = const_TIMEOUT |
220 kwargs["reply_handler"] = callback | |
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 | 224 def connect( |
225 self, | |
226 profile_key="@DEFAULT@", | |
227 password="", | |
228 options={}, | |
229 callback=None, | |
230 errback=None, | |
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 | 237 error_handler = lambda err: errback(dbus_to_bridge_exception(err)) |
238 return self.db_core_iface.connect( | |
239 profile_key, | |
240 password, | |
241 options, | |
242 timeout=const_TIMEOUT, | |
243 reply_handler=callback, | |
244 error_handler=error_handler, | |
245 ) | |
4037
524856bd7b19
massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents:
3648
diff
changeset
|
246 |
4284 | 247 def contact_add( |
248 self, entity_jid, profile_key="@DEFAULT@", callback=None, errback=None | |
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 | 255 error_handler = lambda err: errback(dbus_to_bridge_exception(err)) |
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 | 258 kwargs["timeout"] = const_TIMEOUT |
259 kwargs["reply_handler"] = callback | |
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 | 263 def contact_del( |
264 self, entity_jid, profile_key="@DEFAULT@", callback=None, errback=None | |
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 | 271 error_handler = lambda err: errback(dbus_to_bridge_exception(err)) |
272 return self.db_core_iface.contact_del( | |
273 entity_jid, | |
274 profile_key, | |
275 timeout=const_TIMEOUT, | |
276 reply_handler=callback, | |
277 error_handler=error_handler, | |
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 | 286 error_handler = lambda err: errback(dbus_to_bridge_exception(err)) |
287 return self.db_core_iface.contact_get( | |
288 arg_0, | |
289 profile_key, | |
290 timeout=const_TIMEOUT, | |
291 reply_handler=callback, | |
292 error_handler=error_handler, | |
293 ) | |
963
723f28cd15c7
core (disco): added discoInfos and discoItems bridge methods
Goffi <goffi@goffi.org>
parents:
943
diff
changeset
|
294 |
4284 | 295 def contact_update( |
296 self, | |
297 entity_jid, | |
298 name, | |
299 groups, | |
300 profile_key="@DEFAULT@", | |
301 callback=None, | |
302 errback=None, | |
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 | 309 error_handler = lambda err: errback(dbus_to_bridge_exception(err)) |
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 | 312 kwargs["timeout"] = const_TIMEOUT |
313 kwargs["reply_handler"] = callback | |
314 kwargs["error_handler"] = error_handler | |
315 return self.db_core_iface.contact_update( | |
316 entity_jid, name, groups, profile_key, **kwargs | |
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 | 325 error_handler = lambda err: errback(dbus_to_bridge_exception(err)) |
326 return self.db_core_iface.contacts_get( | |
327 profile_key, | |
328 timeout=const_TIMEOUT, | |
329 reply_handler=callback, | |
330 error_handler=error_handler, | |
331 ) | |
4037
524856bd7b19
massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents:
3648
diff
changeset
|
332 |
4284 | 333 def contacts_get_from_group( |
334 self, group, profile_key="@DEFAULT@", callback=None, errback=None | |
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 | 341 error_handler = lambda err: errback(dbus_to_bridge_exception(err)) |
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 | 344 kwargs["timeout"] = const_TIMEOUT |
345 kwargs["reply_handler"] = callback | |
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 | 355 error_handler = lambda err: errback(dbus_to_bridge_exception(err)) |
356 return str( | |
357 self.db_core_iface.devices_infos_get( | |
358 bare_jid, | |
359 profile_key, | |
360 timeout=const_TIMEOUT, | |
361 reply_handler=callback, | |
362 error_handler=error_handler, | |
363 ) | |
364 ) | |
2733
e347e32aa07f
core (memory/encryption): new encryptionNamespaceGet and encryptionTrustUIGet methods:
Goffi <goffi@goffi.org>
parents:
2658
diff
changeset
|
365 |
4284 | 366 def disco_find_by_features( |
367 self, | |
368 namespaces, | |
369 identities, | |
370 bare_jid=False, | |
371 service=True, | |
372 roster=True, | |
373 own_jid=True, | |
374 local_device=False, | |
375 profile_key="@DEFAULT@", | |
376 callback=None, | |
377 errback=None, | |
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 | 384 error_handler = lambda err: errback(dbus_to_bridge_exception(err)) |
385 return self.db_core_iface.disco_find_by_features( | |
386 namespaces, | |
387 identities, | |
388 bare_jid, | |
389 service, | |
390 roster, | |
391 own_jid, | |
392 local_device, | |
393 profile_key, | |
394 timeout=const_TIMEOUT, | |
395 reply_handler=callback, | |
396 error_handler=error_handler, | |
397 ) | |
4037
524856bd7b19
massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents:
3648
diff
changeset
|
398 |
4284 | 399 def disco_infos( |
400 self, | |
401 entity_jid, | |
402 node="", | |
403 use_cache=True, | |
404 profile_key="@DEFAULT@", | |
405 callback=None, | |
406 errback=None, | |
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 | 413 error_handler = lambda err: errback(dbus_to_bridge_exception(err)) |
414 return self.db_core_iface.disco_infos( | |
415 entity_jid, | |
416 node, | |
417 use_cache, | |
418 profile_key, | |
419 timeout=const_TIMEOUT, | |
420 reply_handler=callback, | |
421 error_handler=error_handler, | |
422 ) | |
4037
524856bd7b19
massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents:
3648
diff
changeset
|
423 |
4284 | 424 def disco_items( |
425 self, | |
426 entity_jid, | |
427 node="", | |
428 use_cache=True, | |
429 profile_key="@DEFAULT@", | |
430 callback=None, | |
431 errback=None, | |
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 | 438 error_handler = lambda err: errback(dbus_to_bridge_exception(err)) |
439 return self.db_core_iface.disco_items( | |
440 entity_jid, | |
441 node, | |
442 use_cache, | |
443 profile_key, | |
444 timeout=const_TIMEOUT, | |
445 reply_handler=callback, | |
446 error_handler=error_handler, | |
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 | 455 error_handler = lambda err: errback(dbus_to_bridge_exception(err)) |
456 return self.db_core_iface.disconnect( | |
457 profile_key, | |
458 timeout=const_TIMEOUT, | |
459 reply_handler=callback, | |
460 error_handler=error_handler, | |
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 | 469 error_handler = lambda err: errback(dbus_to_bridge_exception(err)) |
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 | 472 kwargs["timeout"] = const_TIMEOUT |
473 kwargs["reply_handler"] = callback | |
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 | 483 error_handler = lambda err: errback(dbus_to_bridge_exception(err)) |
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 | 486 kwargs["timeout"] = const_TIMEOUT |
487 kwargs["reply_handler"] = callback | |
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 | 490 |
4284 | 491 def encryption_trust_ui_get( |
492 self, to_jid, namespace, profile_key, callback=None, errback=None | |
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 | 499 error_handler = lambda err: errback(dbus_to_bridge_exception(err)) |
500 return str( | |
501 self.db_core_iface.encryption_trust_ui_get( | |
502 to_jid, | |
503 namespace, | |
504 profile_key, | |
505 timeout=const_TIMEOUT, | |
506 reply_handler=callback, | |
507 error_handler=error_handler, | |
508 ) | |
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 | 517 error_handler = lambda err: errback(dbus_to_bridge_exception(err)) |
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 | 520 kwargs["timeout"] = const_TIMEOUT |
521 kwargs["reply_handler"] = callback | |
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 | 531 error_handler = lambda err: errback(dbus_to_bridge_exception(err)) |
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 | 534 kwargs["timeout"] = const_TIMEOUT |
535 kwargs["reply_handler"] = callback | |
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 | 545 error_handler = lambda err: errback(dbus_to_bridge_exception(err)) |
546 return self.db_core_iface.features_get( | |
547 profile_key, | |
548 timeout=const_TIMEOUT, | |
549 reply_handler=callback, | |
550 error_handler=error_handler, | |
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 | 553 def history_get( |
554 self, | |
555 from_jid, | |
556 to_jid, | |
557 limit, | |
558 between=True, | |
559 filters="", | |
560 profile="@NONE@", | |
561 callback=None, | |
562 errback=None, | |
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 | 569 error_handler = lambda err: errback(dbus_to_bridge_exception(err)) |
570 return self.db_core_iface.history_get( | |
571 from_jid, | |
572 to_jid, | |
573 limit, | |
574 between, | |
575 filters, | |
576 profile, | |
577 timeout=const_TIMEOUT, | |
578 reply_handler=callback, | |
579 error_handler=error_handler, | |
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 | 588 error_handler = lambda err: errback(dbus_to_bridge_exception(err)) |
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 | 591 kwargs["timeout"] = const_TIMEOUT |
592 kwargs["reply_handler"] = callback | |
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 | 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 | 602 error_handler = lambda err: errback(dbus_to_bridge_exception(err)) |
603 return str( | |
604 self.db_core_iface.image_convert( | |
605 source, | |
606 dest, | |
607 arg_2, | |
608 extra, | |
609 timeout=const_TIMEOUT, | |
610 reply_handler=callback, | |
611 error_handler=error_handler, | |
612 ) | |
613 ) | |
4037
524856bd7b19
massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents:
3648
diff
changeset
|
614 |
4284 | 615 def image_generate_preview( |
616 self, image_path, profile_key, callback=None, errback=None | |
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 | 623 error_handler = lambda err: errback(dbus_to_bridge_exception(err)) |
624 return str( | |
625 self.db_core_iface.image_generate_preview( | |
626 image_path, | |
627 profile_key, | |
628 timeout=const_TIMEOUT, | |
629 reply_handler=callback, | |
630 error_handler=error_handler, | |
631 ) | |
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 | 640 error_handler = lambda err: errback(dbus_to_bridge_exception(err)) |
641 return str( | |
642 self.db_core_iface.image_resize( | |
643 image_path, | |
644 width, | |
645 height, | |
646 timeout=const_TIMEOUT, | |
647 reply_handler=callback, | |
648 error_handler=error_handler, | |
649 ) | |
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 | 658 error_handler = lambda err: errback(dbus_to_bridge_exception(err)) |
659 return self.db_core_iface.init_pre_script( | |
660 timeout=const_TIMEOUT, reply_handler=callback, error_handler=error_handler | |
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 | 669 error_handler = lambda err: errback(dbus_to_bridge_exception(err)) |
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 | 672 kwargs["timeout"] = const_TIMEOUT |
673 kwargs["reply_handler"] = callback | |
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 | 677 def main_resource_get( |
678 self, contact_jid, profile_key="@DEFAULT@", callback=None, errback=None | |
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 | 685 error_handler = lambda err: errback(dbus_to_bridge_exception(err)) |
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 | 688 kwargs["timeout"] = const_TIMEOUT |
689 kwargs["reply_handler"] = callback | |
690 kwargs["error_handler"] = error_handler | |
691 return str( | |
692 self.db_core_iface.main_resource_get(contact_jid, profile_key, **kwargs) | |
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 | 701 error_handler = lambda err: errback(dbus_to_bridge_exception(err)) |
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 | 704 kwargs["timeout"] = const_TIMEOUT |
705 kwargs["reply_handler"] = callback | |
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 | 709 def menu_launch( |
710 self, | |
711 menu_type, | |
712 path, | |
713 data, | |
714 security_limit, | |
715 profile_key, | |
716 callback=None, | |
717 errback=None, | |
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 | 724 error_handler = lambda err: errback(dbus_to_bridge_exception(err)) |
725 return self.db_core_iface.menu_launch( | |
726 menu_type, | |
727 path, | |
728 data, | |
729 security_limit, | |
730 profile_key, | |
731 timeout=const_TIMEOUT, | |
732 reply_handler=callback, | |
733 error_handler=error_handler, | |
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 | 742 error_handler = lambda err: errback(dbus_to_bridge_exception(err)) |
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 | 745 kwargs["timeout"] = const_TIMEOUT |
746 kwargs["reply_handler"] = callback | |
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 | 756 error_handler = lambda err: errback(dbus_to_bridge_exception(err)) |
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 | 759 kwargs["timeout"] = const_TIMEOUT |
760 kwargs["reply_handler"] = callback | |
761 kwargs["error_handler"] = error_handler | |
762 return str( | |
763 self.db_core_iface.message_encryption_get(to_jid, profile_key, **kwargs) | |
764 ) | |
3066
2cc2f65379f7
core: added imageCheck and imageResize methods:
Goffi <goffi@goffi.org>
parents:
3042
diff
changeset
|
765 |
4284 | 766 def message_encryption_start( |
767 self, | |
768 to_jid, | |
769 namespace="", | |
770 replace=False, | |
771 profile_key="@NONE@", | |
772 callback=None, | |
773 errback=None, | |
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 | 780 error_handler = lambda err: errback(dbus_to_bridge_exception(err)) |
781 return self.db_core_iface.message_encryption_start( | |
782 to_jid, | |
783 namespace, | |
784 replace, | |
785 profile_key, | |
786 timeout=const_TIMEOUT, | |
787 reply_handler=callback, | |
788 error_handler=error_handler, | |
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 | 797 error_handler = lambda err: errback(dbus_to_bridge_exception(err)) |
798 return self.db_core_iface.message_encryption_stop( | |
799 to_jid, | |
800 profile_key, | |
801 timeout=const_TIMEOUT, | |
802 reply_handler=callback, | |
803 error_handler=error_handler, | |
804 ) | |
3201
439e2f88c3a9
core, bridge: new `imageGeneratePreview` helped method to generate a thumbnail
Goffi <goffi@goffi.org>
parents:
3163
diff
changeset
|
805 |
4284 | 806 def message_send( |
807 self, | |
808 to_jid, | |
809 message, | |
810 subject={}, | |
811 mess_type="auto", | |
812 extra={}, | |
813 profile_key="@NONE@", | |
814 callback=None, | |
815 errback=None, | |
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 | 822 error_handler = lambda err: errback(dbus_to_bridge_exception(err)) |
823 return self.db_core_iface.message_send( | |
824 to_jid, | |
825 message, | |
826 subject, | |
827 mess_type, | |
828 extra, | |
829 profile_key, | |
830 timeout=const_TIMEOUT, | |
831 reply_handler=callback, | |
832 error_handler=error_handler, | |
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 | 841 error_handler = lambda err: errback(dbus_to_bridge_exception(err)) |
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 | 844 kwargs["timeout"] = const_TIMEOUT |
845 kwargs["reply_handler"] = callback | |
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 | 849 def notification_add( |
850 self, | |
851 type_, | |
852 body_plain, | |
853 body_rich, | |
854 title, | |
855 is_global, | |
856 requires_action, | |
857 arg_6, | |
858 priority, | |
859 expire_at, | |
860 extra, | |
861 callback=None, | |
862 errback=None, | |
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 | 869 error_handler = lambda err: errback(dbus_to_bridge_exception(err)) |
870 kwargs = {} | |
4130
02f0adc745c6
core: notifications implementation, first draft:
Goffi <goffi@goffi.org>
parents:
4074
diff
changeset
|
871 if callback is not None: |
4284 | 872 kwargs["timeout"] = const_TIMEOUT |
873 kwargs["reply_handler"] = callback | |
874 kwargs["error_handler"] = error_handler | |
875 return self.db_core_iface.notification_add( | |
876 type_, | |
877 body_plain, | |
878 body_rich, | |
879 title, | |
880 is_global, | |
881 requires_action, | |
882 arg_6, | |
883 priority, | |
884 expire_at, | |
885 extra, | |
886 **kwargs, | |
887 ) | |
4130
02f0adc745c6
core: notifications implementation, first draft:
Goffi <goffi@goffi.org>
parents:
4074
diff
changeset
|
888 |
4284 | 889 def notification_delete( |
890 self, id_, is_global, profile_key, callback=None, errback=None | |
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 | 897 error_handler = lambda err: errback(dbus_to_bridge_exception(err)) |
898 kwargs = {} | |
4130
02f0adc745c6
core: notifications implementation, first draft:
Goffi <goffi@goffi.org>
parents:
4074
diff
changeset
|
899 if callback is not None: |
4284 | 900 kwargs["timeout"] = const_TIMEOUT |
901 kwargs["reply_handler"] = callback | |
902 kwargs["error_handler"] = error_handler | |
903 return self.db_core_iface.notification_delete( | |
904 id_, is_global, profile_key, **kwargs | |
905 ) | |
4130
02f0adc745c6
core: notifications implementation, first draft:
Goffi <goffi@goffi.org>
parents:
4074
diff
changeset
|
906 |
4284 | 907 def notifications_expired_clean( |
908 self, limit_timestamp, profile_key, callback=None, errback=None | |
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 | 915 error_handler = lambda err: errback(dbus_to_bridge_exception(err)) |
916 kwargs = {} | |
4130
02f0adc745c6
core: notifications implementation, first draft:
Goffi <goffi@goffi.org>
parents:
4074
diff
changeset
|
917 if callback is not None: |
4284 | 918 kwargs["timeout"] = const_TIMEOUT |
919 kwargs["reply_handler"] = callback | |
920 kwargs["error_handler"] = error_handler | |
921 return self.db_core_iface.notifications_expired_clean( | |
922 limit_timestamp, profile_key, **kwargs | |
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 | 931 error_handler = lambda err: errback(dbus_to_bridge_exception(err)) |
932 kwargs = {} | |
4130
02f0adc745c6
core: notifications implementation, first draft:
Goffi <goffi@goffi.org>
parents:
4074
diff
changeset
|
933 if callback is not None: |
4284 | 934 kwargs["timeout"] = const_TIMEOUT |
935 kwargs["reply_handler"] = callback | |
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 | 939 def param_get_a( |
940 self, | |
941 name, | |
942 category, | |
943 attribute="value", | |
944 profile_key="@DEFAULT@", | |
945 callback=None, | |
946 errback=None, | |
947 ): | |
948 if callback is None: | |
949 error_handler = None | |
950 else: | |
951 if errback is None: | |
952 errback = log.error | |
953 error_handler = lambda err: errback(dbus_to_bridge_exception(err)) | |
954 kwargs = {} | |
955 if callback is not None: | |
956 kwargs["timeout"] = const_TIMEOUT | |
957 kwargs["reply_handler"] = callback | |
958 kwargs["error_handler"] = error_handler | |
959 return str( | |
960 self.db_core_iface.param_get_a( | |
961 name, category, attribute, profile_key, **kwargs | |
962 ) | |
963 ) | |
964 | |
965 def param_get_a_async( | |
966 self, | |
967 name, | |
968 category, | |
969 attribute="value", | |
970 security_limit=-1, | |
971 profile_key="@DEFAULT@", | |
972 callback=None, | |
973 errback=None, | |
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 | 980 error_handler = lambda err: errback(dbus_to_bridge_exception(err)) |
981 return str( | |
982 self.db_core_iface.param_get_a_async( | |
983 name, | |
984 category, | |
985 attribute, | |
986 security_limit, | |
987 profile_key, | |
988 timeout=const_TIMEOUT, | |
989 reply_handler=callback, | |
990 error_handler=error_handler, | |
991 ) | |
992 ) | |
1015
fee00f2e11c2
memory, jp: added jp commands to load/save parameters template
souliane <souliane@mailoo.org>
parents:
993
diff
changeset
|
993 |
4284 | 994 def param_set( |
995 self, | |
996 name, | |
997 value, | |
998 category, | |
999 security_limit=-1, | |
1000 profile_key="@DEFAULT@", | |
1001 callback=None, | |
1002 errback=None, | |
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 | 1009 error_handler = lambda err: errback(dbus_to_bridge_exception(err)) |
1010 kwargs = {} | |
1011 if callback is not None: | |
1012 kwargs["timeout"] = const_TIMEOUT | |
1013 kwargs["reply_handler"] = callback | |
1014 kwargs["error_handler"] = error_handler | |
1015 return self.db_core_iface.param_set( | |
1016 name, value, category, security_limit, profile_key, **kwargs | |
1017 ) | |
4037
524856bd7b19
massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents:
3648
diff
changeset
|
1018 |
4284 | 1019 def param_ui_get( |
1020 self, | |
1021 security_limit=-1, | |
1022 app="", | |
1023 extra="", | |
1024 profile_key="@DEFAULT@", | |
1025 callback=None, | |
1026 errback=None, | |
1027 ): | |
2126 | 1028 if callback is None: |
1029 error_handler = None | |
1030 else: | |
1031 if errback is None: | |
1032 errback = log.error | |
4284 | 1033 error_handler = lambda err: errback(dbus_to_bridge_exception(err)) |
1034 return str( | |
1035 self.db_core_iface.param_ui_get( | |
1036 security_limit, | |
1037 app, | |
1038 extra, | |
1039 profile_key, | |
1040 timeout=const_TIMEOUT, | |
1041 reply_handler=callback, | |
1042 error_handler=error_handler, | |
1043 ) | |
1044 ) | |
2126 | 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 | 1047 if callback is None: |
1048 error_handler = None | |
1049 else: | |
1050 if errback is None: | |
1051 errback = log.error | |
4284 | 1052 error_handler = lambda err: errback(dbus_to_bridge_exception(err)) |
1053 kwargs = {} | |
2126 | 1054 if callback is not None: |
4284 | 1055 kwargs["timeout"] = const_TIMEOUT |
1056 kwargs["reply_handler"] = callback | |
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 | 1059 |
4284 | 1060 def params_register_app( |
1061 self, xml, security_limit=-1, app="", callback=None, errback=None | |
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 | 1068 error_handler = lambda err: errback(dbus_to_bridge_exception(err)) |
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 | 1071 kwargs["timeout"] = const_TIMEOUT |
1072 kwargs["reply_handler"] = callback | |
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 | 1082 error_handler = lambda err: errback(dbus_to_bridge_exception(err)) |
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 | 1085 kwargs["timeout"] = const_TIMEOUT |
1086 kwargs["reply_handler"] = callback | |
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 | 1096 error_handler = lambda err: errback(dbus_to_bridge_exception(err)) |
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 | 1099 kwargs["timeout"] = const_TIMEOUT |
1100 kwargs["reply_handler"] = callback | |
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 | 1104 def params_values_from_category_get_async( |
1105 self, | |
1106 category, | |
1107 security_limit=-1, | |
1108 app="", | |
1109 extra="", | |
1110 profile_key="@DEFAULT@", | |
1111 callback=None, | |
1112 errback=None, | |
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 | 1119 error_handler = lambda err: errback(dbus_to_bridge_exception(err)) |
1120 return self.db_core_iface.params_values_from_category_get_async( | |
1121 category, | |
1122 security_limit, | |
1123 app, | |
1124 extra, | |
1125 profile_key, | |
1126 timeout=const_TIMEOUT, | |
1127 reply_handler=callback, | |
1128 error_handler=error_handler, | |
1129 ) | |
4037
524856bd7b19
massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents:
3648
diff
changeset
|
1130 |
4284 | 1131 def presence_set( |
1132 self, | |
1133 to_jid="", | |
1134 show="", | |
1135 statuses={}, | |
1136 profile_key="@DEFAULT@", | |
1137 callback=None, | |
1138 errback=None, | |
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 | 1145 error_handler = lambda err: errback(dbus_to_bridge_exception(err)) |
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 | 1148 kwargs["timeout"] = const_TIMEOUT |
1149 kwargs["reply_handler"] = callback | |
1150 kwargs["error_handler"] = error_handler | |
1151 return self.db_core_iface.presence_set( | |
1152 to_jid, show, statuses, profile_key, **kwargs | |
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 | 1161 error_handler = lambda err: errback(dbus_to_bridge_exception(err)) |
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 | 1164 kwargs["timeout"] = const_TIMEOUT |
1165 kwargs["reply_handler"] = callback | |
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 | 1175 error_handler = lambda err: errback(dbus_to_bridge_exception(err)) |
1176 return self.db_core_iface.private_data_delete( | |
1177 namespace, | |
1178 key, | |
1179 arg_2, | |
1180 timeout=const_TIMEOUT, | |
1181 reply_handler=callback, | |
1182 error_handler=error_handler, | |
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 | 1191 error_handler = lambda err: errback(dbus_to_bridge_exception(err)) |
1192 return str( | |
1193 self.db_core_iface.private_data_get( | |
1194 namespace, | |
1195 key, | |
1196 profile_key, | |
1197 timeout=const_TIMEOUT, | |
1198 reply_handler=callback, | |
1199 error_handler=error_handler, | |
1200 ) | |
1201 ) | |
3163
d10b2368684e
bridge: added methods to let frontends store/retrieve/delete private data
Goffi <goffi@goffi.org>
parents:
3143
diff
changeset
|
1202 |
4284 | 1203 def private_data_set( |
1204 self, namespace, key, data, profile_key, callback=None, errback=None | |
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 | 1211 error_handler = lambda err: errback(dbus_to_bridge_exception(err)) |
1212 return self.db_core_iface.private_data_set( | |
1213 namespace, | |
1214 key, | |
1215 data, | |
1216 profile_key, | |
1217 timeout=const_TIMEOUT, | |
1218 reply_handler=callback, | |
1219 error_handler=error_handler, | |
1220 ) | |
3163
d10b2368684e
bridge: added methods to let frontends store/retrieve/delete private data
Goffi <goffi@goffi.org>
parents:
3143
diff
changeset
|
1221 |
4284 | 1222 def profile_create( |
1223 self, profile, password="", component="", callback=None, errback=None | |
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 | 1230 error_handler = lambda err: errback(dbus_to_bridge_exception(err)) |
1231 return self.db_core_iface.profile_create( | |
1232 profile, | |
1233 password, | |
1234 component, | |
1235 timeout=const_TIMEOUT, | |
1236 reply_handler=callback, | |
1237 error_handler=error_handler, | |
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 | 1246 error_handler = lambda err: errback(dbus_to_bridge_exception(err)) |
1247 return self.db_core_iface.profile_delete_async( | |
1248 profile, | |
1249 timeout=const_TIMEOUT, | |
1250 reply_handler=callback, | |
1251 error_handler=error_handler, | |
1252 ) | |
4037
524856bd7b19
massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents:
3648
diff
changeset
|
1253 |
4284 | 1254 def profile_is_session_started( |
1255 self, profile_key="@DEFAULT@", callback=None, errback=None | |
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 | 1262 error_handler = lambda err: errback(dbus_to_bridge_exception(err)) |
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 | 1265 kwargs["timeout"] = const_TIMEOUT |
1266 kwargs["reply_handler"] = callback | |
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 | 1276 error_handler = lambda err: errback(dbus_to_bridge_exception(err)) |
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 | 1279 kwargs["timeout"] = const_TIMEOUT |
1280 kwargs["reply_handler"] = callback | |
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 | 1290 error_handler = lambda err: errback(dbus_to_bridge_exception(err)) |
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 | 1293 kwargs["timeout"] = const_TIMEOUT |
1294 kwargs["reply_handler"] = callback | |
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 | 1298 def profile_start_session( |
1299 self, password="", profile_key="@DEFAULT@", callback=None, errback=None | |
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 | 1306 error_handler = lambda err: errback(dbus_to_bridge_exception(err)) |
1307 return self.db_core_iface.profile_start_session( | |
1308 password, | |
1309 profile_key, | |
1310 timeout=const_TIMEOUT, | |
1311 reply_handler=callback, | |
1312 error_handler=error_handler, | |
1313 ) | |
4037
524856bd7b19
massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents:
3648
diff
changeset
|
1314 |
4284 | 1315 def profiles_list_get( |
1316 self, clients=True, components=False, callback=None, errback=None | |
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 | 1323 error_handler = lambda err: errback(dbus_to_bridge_exception(err)) |
1324 kwargs = {} | |
1522
7d7e57a84792
core: progression handling improvments:
Goffi <goffi@goffi.org>
parents:
1482
diff
changeset
|
1325 if callback is not None: |
4284 | 1326 kwargs["timeout"] = const_TIMEOUT |
1327 kwargs["reply_handler"] = callback | |
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 | 1337 error_handler = lambda err: errback(dbus_to_bridge_exception(err)) |
1338 kwargs = {} | |
1522
7d7e57a84792
core: progression handling improvments:
Goffi <goffi@goffi.org>
parents:
1482
diff
changeset
|
1339 if callback is not None: |
4284 | 1340 kwargs["timeout"] = const_TIMEOUT |
1341 kwargs["reply_handler"] = callback | |
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 | 1351 error_handler = lambda err: errback(dbus_to_bridge_exception(err)) |
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 | 1354 kwargs["timeout"] = const_TIMEOUT |
1355 kwargs["reply_handler"] = callback | |
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 | 1365 error_handler = lambda err: errback(dbus_to_bridge_exception(err)) |
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 | 1368 kwargs["timeout"] = const_TIMEOUT |
1369 kwargs["reply_handler"] = callback | |
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 | 1379 error_handler = lambda err: errback(dbus_to_bridge_exception(err)) |
1380 return self.db_core_iface.ready_get( | |
1381 timeout=const_TIMEOUT, reply_handler=callback, error_handler=error_handler | |
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 | 1390 error_handler = lambda err: errback(dbus_to_bridge_exception(err)) |
1391 return self.db_core_iface.roster_resync( | |
1392 profile_key, | |
1393 timeout=const_TIMEOUT, | |
1394 reply_handler=callback, | |
1395 error_handler=error_handler, | |
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 | 1404 error_handler = lambda err: errback(dbus_to_bridge_exception(err)) |
1405 return self.db_core_iface.session_infos_get( | |
1406 profile_key, | |
1407 timeout=const_TIMEOUT, | |
1408 reply_handler=callback, | |
1409 error_handler=error_handler, | |
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 | 1418 error_handler = lambda err: errback(dbus_to_bridge_exception(err)) |
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 | 1421 kwargs["timeout"] = const_TIMEOUT |
1422 kwargs["reply_handler"] = callback | |
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 | 1426 def subscription( |
1427 self, sub_type, entity, profile_key="@DEFAULT@", callback=None, errback=None | |
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 | 1434 error_handler = lambda err: errback(dbus_to_bridge_exception(err)) |
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 | 1437 kwargs["timeout"] = const_TIMEOUT |
1438 kwargs["reply_handler"] = callback | |
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 | 1448 error_handler = lambda err: errback(dbus_to_bridge_exception(err)) |
1449 kwargs = {} | |
3254
6cf4bd6972c2
core, frontends: avatar refactoring:
Goffi <goffi@goffi.org>
parents:
3242
diff
changeset
|
1450 if callback is not None: |
4284 | 1451 kwargs["timeout"] = const_TIMEOUT |
1452 kwargs["reply_handler"] = callback | |
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 | 1525 error_handler = lambda err: loop.call_soon_threadsafe( |
1526 fut.set_exception, dbus_to_bridge_exception(err) | |
1527 ) | |
1528 self.db_core_iface.action_launch( | |
1529 callback_id, | |
1530 data, | |
1531 profile_key, | |
1532 timeout=const_TIMEOUT, | |
1533 reply_handler=reply_handler, | |
1534 error_handler=error_handler, | |
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 | 1542 error_handler = lambda err: loop.call_soon_threadsafe( |
1543 fut.set_exception, dbus_to_bridge_exception(err) | |
1544 ) | |
1545 self.db_core_iface.actions_get( | |
1546 profile_key, | |
1547 timeout=const_TIMEOUT, | |
1548 reply_handler=reply_handler, | |
1549 error_handler=error_handler, | |
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 | 1557 error_handler = lambda err: loop.call_soon_threadsafe( |
1558 fut.set_exception, dbus_to_bridge_exception(err) | |
1559 ) | |
1560 self.db_core_iface.config_get( | |
1561 section, | |
1562 name, | |
1563 timeout=const_TIMEOUT, | |
1564 reply_handler=reply_handler, | |
1565 error_handler=error_handler, | |
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 | 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 | 1573 error_handler = lambda err: loop.call_soon_threadsafe( |
1574 fut.set_exception, dbus_to_bridge_exception(err) | |
1575 ) | |
1576 self.db_core_iface.connect( | |
1577 profile_key, | |
1578 password, | |
1579 options, | |
1580 timeout=const_TIMEOUT, | |
1581 reply_handler=reply_handler, | |
1582 error_handler=error_handler, | |
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 | 1590 error_handler = lambda err: loop.call_soon_threadsafe( |
1591 fut.set_exception, dbus_to_bridge_exception(err) | |
1592 ) | |
1593 self.db_core_iface.contact_add( | |
1594 entity_jid, | |
1595 profile_key, | |
1596 timeout=const_TIMEOUT, | |
1597 reply_handler=reply_handler, | |
1598 error_handler=error_handler, | |
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 | 1606 error_handler = lambda err: loop.call_soon_threadsafe( |
1607 fut.set_exception, dbus_to_bridge_exception(err) | |
1608 ) | |
1609 self.db_core_iface.contact_del( | |
1610 entity_jid, | |
1611 profile_key, | |
1612 timeout=const_TIMEOUT, | |
1613 reply_handler=reply_handler, | |
1614 error_handler=error_handler, | |
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 | 1622 error_handler = lambda err: loop.call_soon_threadsafe( |
1623 fut.set_exception, dbus_to_bridge_exception(err) | |
1624 ) | |
1625 self.db_core_iface.contact_get( | |
1626 arg_0, | |
1627 profile_key, | |
1628 timeout=const_TIMEOUT, | |
1629 reply_handler=reply_handler, | |
1630 error_handler=error_handler, | |
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 | 1638 error_handler = lambda err: loop.call_soon_threadsafe( |
1639 fut.set_exception, dbus_to_bridge_exception(err) | |
1640 ) | |
1641 self.db_core_iface.contact_update( | |
1642 entity_jid, | |
1643 name, | |
1644 groups, | |
1645 profile_key, | |
1646 timeout=const_TIMEOUT, | |
1647 reply_handler=reply_handler, | |
1648 error_handler=error_handler, | |
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 | 1656 error_handler = lambda err: loop.call_soon_threadsafe( |
1657 fut.set_exception, dbus_to_bridge_exception(err) | |
1658 ) | |
1659 self.db_core_iface.contacts_get( | |
1660 profile_key, | |
1661 timeout=const_TIMEOUT, | |
1662 reply_handler=reply_handler, | |
1663 error_handler=error_handler, | |
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 | 1671 error_handler = lambda err: loop.call_soon_threadsafe( |
1672 fut.set_exception, dbus_to_bridge_exception(err) | |
1673 ) | |
1674 self.db_core_iface.contacts_get_from_group( | |
1675 group, | |
1676 profile_key, | |
1677 timeout=const_TIMEOUT, | |
1678 reply_handler=reply_handler, | |
1679 error_handler=error_handler, | |
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 | 1687 error_handler = lambda err: loop.call_soon_threadsafe( |
1688 fut.set_exception, dbus_to_bridge_exception(err) | |
1689 ) | |
1690 self.db_core_iface.devices_infos_get( | |
1691 bare_jid, | |
1692 profile_key, | |
1693 timeout=const_TIMEOUT, | |
1694 reply_handler=reply_handler, | |
1695 error_handler=error_handler, | |
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 | 1699 def disco_find_by_features( |
1700 self, | |
1701 namespaces, | |
1702 identities, | |
1703 bare_jid=False, | |
1704 service=True, | |
1705 roster=True, | |
1706 own_jid=True, | |
1707 local_device=False, | |
1708 profile_key="@DEFAULT@", | |
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 | 1713 error_handler = lambda err: loop.call_soon_threadsafe( |
1714 fut.set_exception, dbus_to_bridge_exception(err) | |
1715 ) | |
1716 self.db_core_iface.disco_find_by_features( | |
1717 namespaces, | |
1718 identities, | |
1719 bare_jid, | |
1720 service, | |
1721 roster, | |
1722 own_jid, | |
1723 local_device, | |
1724 profile_key, | |
1725 timeout=const_TIMEOUT, | |
1726 reply_handler=reply_handler, | |
1727 error_handler=error_handler, | |
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 | 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 | 1735 error_handler = lambda err: loop.call_soon_threadsafe( |
1736 fut.set_exception, dbus_to_bridge_exception(err) | |
1737 ) | |
1738 self.db_core_iface.disco_infos( | |
1739 entity_jid, | |
1740 node, | |
1741 use_cache, | |
1742 profile_key, | |
1743 timeout=const_TIMEOUT, | |
1744 reply_handler=reply_handler, | |
1745 error_handler=error_handler, | |
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 | 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 | 1753 error_handler = lambda err: loop.call_soon_threadsafe( |
1754 fut.set_exception, dbus_to_bridge_exception(err) | |
1755 ) | |
1756 self.db_core_iface.disco_items( | |
1757 entity_jid, | |
1758 node, | |
1759 use_cache, | |
1760 profile_key, | |
1761 timeout=const_TIMEOUT, | |
1762 reply_handler=reply_handler, | |
1763 error_handler=error_handler, | |
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 | 1771 error_handler = lambda err: loop.call_soon_threadsafe( |
1772 fut.set_exception, dbus_to_bridge_exception(err) | |
1773 ) | |
1774 self.db_core_iface.disconnect( | |
1775 profile_key, | |
1776 timeout=const_TIMEOUT, | |
1777 reply_handler=reply_handler, | |
1778 error_handler=error_handler, | |
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 | 1786 error_handler = lambda err: loop.call_soon_threadsafe( |
1787 fut.set_exception, dbus_to_bridge_exception(err) | |
1788 ) | |
1789 self.db_core_iface.encryption_namespace_get( | |
1790 arg_0, | |
1791 timeout=const_TIMEOUT, | |
1792 reply_handler=reply_handler, | |
1793 error_handler=error_handler, | |
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 | 1801 error_handler = lambda err: loop.call_soon_threadsafe( |
1802 fut.set_exception, dbus_to_bridge_exception(err) | |
1803 ) | |
1804 self.db_core_iface.encryption_plugins_get( | |
1805 timeout=const_TIMEOUT, | |
1806 reply_handler=reply_handler, | |
1807 error_handler=error_handler, | |
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 | 1815 error_handler = lambda err: loop.call_soon_threadsafe( |
1816 fut.set_exception, dbus_to_bridge_exception(err) | |
1817 ) | |
1818 self.db_core_iface.encryption_trust_ui_get( | |
1819 to_jid, | |
1820 namespace, | |
1821 profile_key, | |
1822 timeout=const_TIMEOUT, | |
1823 reply_handler=reply_handler, | |
1824 error_handler=error_handler, | |
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 | 1832 error_handler = lambda err: loop.call_soon_threadsafe( |
1833 fut.set_exception, dbus_to_bridge_exception(err) | |
1834 ) | |
1835 self.db_core_iface.entities_data_get( | |
1836 jids, | |
1837 keys, | |
1838 profile, | |
1839 timeout=const_TIMEOUT, | |
1840 reply_handler=reply_handler, | |
1841 error_handler=error_handler, | |
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 | 1849 error_handler = lambda err: loop.call_soon_threadsafe( |
1850 fut.set_exception, dbus_to_bridge_exception(err) | |
1851 ) | |
1852 self.db_core_iface.entity_data_get( | |
1853 jid, | |
1854 keys, | |
1855 profile, | |
1856 timeout=const_TIMEOUT, | |
1857 reply_handler=reply_handler, | |
1858 error_handler=error_handler, | |
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 | 1866 error_handler = lambda err: loop.call_soon_threadsafe( |
1867 fut.set_exception, dbus_to_bridge_exception(err) | |
1868 ) | |
1869 self.db_core_iface.features_get( | |
1870 profile_key, | |
1871 timeout=const_TIMEOUT, | |
1872 reply_handler=reply_handler, | |
1873 error_handler=error_handler, | |
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 | 1877 def history_get( |
1878 self, from_jid, to_jid, limit, between=True, filters="", profile="@NONE@" | |
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 | 1883 error_handler = lambda err: loop.call_soon_threadsafe( |
1884 fut.set_exception, dbus_to_bridge_exception(err) | |
1885 ) | |
1886 self.db_core_iface.history_get( | |
1887 from_jid, | |
1888 to_jid, | |
1889 limit, | |
1890 between, | |
1891 filters, | |
1892 profile, | |
1893 timeout=const_TIMEOUT, | |
1894 reply_handler=reply_handler, | |
1895 error_handler=error_handler, | |
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 | 1903 error_handler = lambda err: loop.call_soon_threadsafe( |
1904 fut.set_exception, dbus_to_bridge_exception(err) | |
1905 ) | |
1906 self.db_core_iface.image_check( | |
1907 arg_0, | |
1908 timeout=const_TIMEOUT, | |
1909 reply_handler=reply_handler, | |
1910 error_handler=error_handler, | |
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 | 1918 error_handler = lambda err: loop.call_soon_threadsafe( |
1919 fut.set_exception, dbus_to_bridge_exception(err) | |
1920 ) | |
1921 self.db_core_iface.image_convert( | |
1922 source, | |
1923 dest, | |
1924 arg_2, | |
1925 extra, | |
1926 timeout=const_TIMEOUT, | |
1927 reply_handler=reply_handler, | |
1928 error_handler=error_handler, | |
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 | 1936 error_handler = lambda err: loop.call_soon_threadsafe( |
1937 fut.set_exception, dbus_to_bridge_exception(err) | |
1938 ) | |
1939 self.db_core_iface.image_generate_preview( | |
1940 image_path, | |
1941 profile_key, | |
1942 timeout=const_TIMEOUT, | |
1943 reply_handler=reply_handler, | |
1944 error_handler=error_handler, | |
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 | 1952 error_handler = lambda err: loop.call_soon_threadsafe( |
1953 fut.set_exception, dbus_to_bridge_exception(err) | |
1954 ) | |
1955 self.db_core_iface.image_resize( | |
1956 image_path, | |
1957 width, | |
1958 height, | |
1959 timeout=const_TIMEOUT, | |
1960 reply_handler=reply_handler, | |
1961 error_handler=error_handler, | |
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 | 1969 error_handler = lambda err: loop.call_soon_threadsafe( |
1970 fut.set_exception, dbus_to_bridge_exception(err) | |
1971 ) | |
1972 self.db_core_iface.init_pre_script( | |
1973 timeout=const_TIMEOUT, | |
1974 reply_handler=reply_handler, | |
1975 error_handler=error_handler, | |
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 | 1983 error_handler = lambda err: loop.call_soon_threadsafe( |
1984 fut.set_exception, dbus_to_bridge_exception(err) | |
1985 ) | |
1986 self.db_core_iface.is_connected( | |
1987 profile_key, | |
1988 timeout=const_TIMEOUT, | |
1989 reply_handler=reply_handler, | |
1990 error_handler=error_handler, | |
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 | 1998 error_handler = lambda err: loop.call_soon_threadsafe( |
1999 fut.set_exception, dbus_to_bridge_exception(err) | |
2000 ) | |
2001 self.db_core_iface.main_resource_get( | |
2002 contact_jid, | |
2003 profile_key, | |
2004 timeout=const_TIMEOUT, | |
2005 reply_handler=reply_handler, | |
2006 error_handler=error_handler, | |
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 | 2014 error_handler = lambda err: loop.call_soon_threadsafe( |
2015 fut.set_exception, dbus_to_bridge_exception(err) | |
2016 ) | |
2017 self.db_core_iface.menu_help_get( | |
2018 menu_id, | |
2019 language, | |
2020 timeout=const_TIMEOUT, | |
2021 reply_handler=reply_handler, | |
2022 error_handler=error_handler, | |
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 | 2030 error_handler = lambda err: loop.call_soon_threadsafe( |
2031 fut.set_exception, dbus_to_bridge_exception(err) | |
2032 ) | |
2033 self.db_core_iface.menu_launch( | |
2034 menu_type, | |
2035 path, | |
2036 data, | |
2037 security_limit, | |
2038 profile_key, | |
2039 timeout=const_TIMEOUT, | |
2040 reply_handler=reply_handler, | |
2041 error_handler=error_handler, | |
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 | 2049 error_handler = lambda err: loop.call_soon_threadsafe( |
2050 fut.set_exception, dbus_to_bridge_exception(err) | |
2051 ) | |
2052 self.db_core_iface.menus_get( | |
2053 language, | |
2054 security_limit, | |
2055 timeout=const_TIMEOUT, | |
2056 reply_handler=reply_handler, | |
2057 error_handler=error_handler, | |
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 | 2065 error_handler = lambda err: loop.call_soon_threadsafe( |
2066 fut.set_exception, dbus_to_bridge_exception(err) | |
2067 ) | |
2068 self.db_core_iface.message_encryption_get( | |
2069 to_jid, | |
2070 profile_key, | |
2071 timeout=const_TIMEOUT, | |
2072 reply_handler=reply_handler, | |
2073 error_handler=error_handler, | |
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 | 2077 def message_encryption_start( |
2078 self, to_jid, namespace="", replace=False, profile_key="@NONE@" | |
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 | 2083 error_handler = lambda err: loop.call_soon_threadsafe( |
2084 fut.set_exception, dbus_to_bridge_exception(err) | |
2085 ) | |
2086 self.db_core_iface.message_encryption_start( | |
2087 to_jid, | |
2088 namespace, | |
2089 replace, | |
2090 profile_key, | |
2091 timeout=const_TIMEOUT, | |
2092 reply_handler=reply_handler, | |
2093 error_handler=error_handler, | |
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 | 2101 error_handler = lambda err: loop.call_soon_threadsafe( |
2102 fut.set_exception, dbus_to_bridge_exception(err) | |
2103 ) | |
2104 self.db_core_iface.message_encryption_stop( | |
2105 to_jid, | |
2106 profile_key, | |
2107 timeout=const_TIMEOUT, | |
2108 reply_handler=reply_handler, | |
2109 error_handler=error_handler, | |
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 | 2113 def message_send( |
2114 self, | |
2115 to_jid, | |
2116 message, | |
2117 subject={}, | |
2118 mess_type="auto", | |
2119 extra={}, | |
2120 profile_key="@NONE@", | |
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 | 2125 error_handler = lambda err: loop.call_soon_threadsafe( |
2126 fut.set_exception, dbus_to_bridge_exception(err) | |
2127 ) | |
2128 self.db_core_iface.message_send( | |
2129 to_jid, | |
2130 message, | |
2131 subject, | |
2132 mess_type, | |
2133 extra, | |
2134 profile_key, | |
2135 timeout=const_TIMEOUT, | |
2136 reply_handler=reply_handler, | |
2137 error_handler=error_handler, | |
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 | 2145 error_handler = lambda err: loop.call_soon_threadsafe( |
2146 fut.set_exception, dbus_to_bridge_exception(err) | |
2147 ) | |
2148 self.db_core_iface.namespaces_get( | |
2149 timeout=const_TIMEOUT, | |
2150 reply_handler=reply_handler, | |
2151 error_handler=error_handler, | |
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 | 2155 def notification_add( |
2156 self, | |
2157 type_, | |
2158 body_plain, | |
2159 body_rich, | |
2160 title, | |
2161 is_global, | |
2162 requires_action, | |
2163 arg_6, | |
2164 priority, | |
2165 expire_at, | |
2166 extra, | |
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 | 2171 error_handler = lambda err: loop.call_soon_threadsafe( |
2172 fut.set_exception, dbus_to_bridge_exception(err) | |
2173 ) | |
2174 self.db_core_iface.notification_add( | |
2175 type_, | |
2176 body_plain, | |
2177 body_rich, | |
2178 title, | |
2179 is_global, | |
2180 requires_action, | |
2181 arg_6, | |
2182 priority, | |
2183 expire_at, | |
2184 extra, | |
2185 timeout=const_TIMEOUT, | |
2186 reply_handler=reply_handler, | |
2187 error_handler=error_handler, | |
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 | 2195 error_handler = lambda err: loop.call_soon_threadsafe( |
2196 fut.set_exception, dbus_to_bridge_exception(err) | |
2197 ) | |
2198 self.db_core_iface.notification_delete( | |
2199 id_, | |
2200 is_global, | |
2201 profile_key, | |
2202 timeout=const_TIMEOUT, | |
2203 reply_handler=reply_handler, | |
2204 error_handler=error_handler, | |
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 | 2212 error_handler = lambda err: loop.call_soon_threadsafe( |
2213 fut.set_exception, dbus_to_bridge_exception(err) | |
2214 ) | |
2215 self.db_core_iface.notifications_expired_clean( | |
2216 limit_timestamp, | |
2217 profile_key, | |
2218 timeout=const_TIMEOUT, | |
2219 reply_handler=reply_handler, | |
2220 error_handler=error_handler, | |
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 | 2228 error_handler = lambda err: loop.call_soon_threadsafe( |
2229 fut.set_exception, dbus_to_bridge_exception(err) | |
2230 ) | |
2231 self.db_core_iface.notifications_get( | |
2232 filters, | |
2233 profile_key, | |
2234 timeout=const_TIMEOUT, | |
2235 reply_handler=reply_handler, | |
2236 error_handler=error_handler, | |
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 | 2244 error_handler = lambda err: loop.call_soon_threadsafe( |
2245 fut.set_exception, dbus_to_bridge_exception(err) | |
2246 ) | |
2247 self.db_core_iface.param_get_a( | |
2248 name, | |
2249 category, | |
2250 attribute, | |
2251 profile_key, | |
2252 timeout=const_TIMEOUT, | |
2253 reply_handler=reply_handler, | |
2254 error_handler=error_handler, | |
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 | 2258 def param_get_a_async( |
2259 self, | |
2260 name, | |
2261 category, | |
2262 attribute="value", | |
2263 security_limit=-1, | |
2264 profile_key="@DEFAULT@", | |
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 | 2269 error_handler = lambda err: loop.call_soon_threadsafe( |
2270 fut.set_exception, dbus_to_bridge_exception(err) | |
2271 ) | |
2272 self.db_core_iface.param_get_a_async( | |
2273 name, | |
2274 category, | |
2275 attribute, | |
2276 security_limit, | |
2277 profile_key, | |
2278 timeout=const_TIMEOUT, | |
2279 reply_handler=reply_handler, | |
2280 error_handler=error_handler, | |
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 | 2284 def param_set( |
2285 self, name, value, category, security_limit=-1, profile_key="@DEFAULT@" | |
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 | 2290 error_handler = lambda err: loop.call_soon_threadsafe( |
2291 fut.set_exception, dbus_to_bridge_exception(err) | |
2292 ) | |
2293 self.db_core_iface.param_set( | |
2294 name, | |
2295 value, | |
2296 category, | |
2297 security_limit, | |
2298 profile_key, | |
2299 timeout=const_TIMEOUT, | |
2300 reply_handler=reply_handler, | |
2301 error_handler=error_handler, | |
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 | 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 | 2309 error_handler = lambda err: loop.call_soon_threadsafe( |
2310 fut.set_exception, dbus_to_bridge_exception(err) | |
2311 ) | |
2312 self.db_core_iface.param_ui_get( | |
2313 security_limit, | |
2314 app, | |
2315 extra, | |
2316 profile_key, | |
2317 timeout=const_TIMEOUT, | |
2318 reply_handler=reply_handler, | |
2319 error_handler=error_handler, | |
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 | 2327 error_handler = lambda err: loop.call_soon_threadsafe( |
2328 fut.set_exception, dbus_to_bridge_exception(err) | |
2329 ) | |
2330 self.db_core_iface.params_categories_get( | |
2331 timeout=const_TIMEOUT, | |
2332 reply_handler=reply_handler, | |
2333 error_handler=error_handler, | |
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 | 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 | 2341 error_handler = lambda err: loop.call_soon_threadsafe( |
2342 fut.set_exception, dbus_to_bridge_exception(err) | |
2343 ) | |
2344 self.db_core_iface.params_register_app( | |
2345 xml, | |
2346 security_limit, | |
2347 app, | |
2348 timeout=const_TIMEOUT, | |
2349 reply_handler=reply_handler, | |
2350 error_handler=error_handler, | |
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 | 2358 error_handler = lambda err: loop.call_soon_threadsafe( |
2359 fut.set_exception, dbus_to_bridge_exception(err) | |
2360 ) | |
2361 self.db_core_iface.params_template_load( | |
2362 filename, | |
2363 timeout=const_TIMEOUT, | |
2364 reply_handler=reply_handler, | |
2365 error_handler=error_handler, | |
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 | 2373 error_handler = lambda err: loop.call_soon_threadsafe( |
2374 fut.set_exception, dbus_to_bridge_exception(err) | |
2375 ) | |
2376 self.db_core_iface.params_template_save( | |
2377 filename, | |
2378 timeout=const_TIMEOUT, | |
2379 reply_handler=reply_handler, | |
2380 error_handler=error_handler, | |
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 | 2384 def params_values_from_category_get_async( |
2385 self, category, security_limit=-1, app="", extra="", profile_key="@DEFAULT@" | |
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 | 2390 error_handler = lambda err: loop.call_soon_threadsafe( |
2391 fut.set_exception, dbus_to_bridge_exception(err) | |
2392 ) | |
2393 self.db_core_iface.params_values_from_category_get_async( | |
2394 category, | |
2395 security_limit, | |
2396 app, | |
2397 extra, | |
2398 profile_key, | |
2399 timeout=const_TIMEOUT, | |
2400 reply_handler=reply_handler, | |
2401 error_handler=error_handler, | |
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 | 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 | 2409 error_handler = lambda err: loop.call_soon_threadsafe( |
2410 fut.set_exception, dbus_to_bridge_exception(err) | |
2411 ) | |
2412 self.db_core_iface.presence_set( | |
2413 to_jid, | |
2414 show, | |
2415 statuses, | |
2416 profile_key, | |
2417 timeout=const_TIMEOUT, | |
2418 reply_handler=reply_handler, | |
2419 error_handler=error_handler, | |
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 | 2427 error_handler = lambda err: loop.call_soon_threadsafe( |
2428 fut.set_exception, dbus_to_bridge_exception(err) | |
2429 ) | |
2430 self.db_core_iface.presence_statuses_get( | |
2431 profile_key, | |
2432 timeout=const_TIMEOUT, | |
2433 reply_handler=reply_handler, | |
2434 error_handler=error_handler, | |
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 | 2442 error_handler = lambda err: loop.call_soon_threadsafe( |
2443 fut.set_exception, dbus_to_bridge_exception(err) | |
2444 ) | |
2445 self.db_core_iface.private_data_delete( | |
2446 namespace, | |
2447 key, | |
2448 arg_2, | |
2449 timeout=const_TIMEOUT, | |
2450 reply_handler=reply_handler, | |
2451 error_handler=error_handler, | |
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 | 2459 error_handler = lambda err: loop.call_soon_threadsafe( |
2460 fut.set_exception, dbus_to_bridge_exception(err) | |
2461 ) | |
2462 self.db_core_iface.private_data_get( | |
2463 namespace, | |
2464 key, | |
2465 profile_key, | |
2466 timeout=const_TIMEOUT, | |
2467 reply_handler=reply_handler, | |
2468 error_handler=error_handler, | |
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 | 2476 error_handler = lambda err: loop.call_soon_threadsafe( |
2477 fut.set_exception, dbus_to_bridge_exception(err) | |
2478 ) | |
2479 self.db_core_iface.private_data_set( | |
2480 namespace, | |
2481 key, | |
2482 data, | |
2483 profile_key, | |
2484 timeout=const_TIMEOUT, | |
2485 reply_handler=reply_handler, | |
2486 error_handler=error_handler, | |
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 | 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 | 2494 error_handler = lambda err: loop.call_soon_threadsafe( |
2495 fut.set_exception, dbus_to_bridge_exception(err) | |
2496 ) | |
2497 self.db_core_iface.profile_create( | |
2498 profile, | |
2499 password, | |
2500 component, | |
2501 timeout=const_TIMEOUT, | |
2502 reply_handler=reply_handler, | |
2503 error_handler=error_handler, | |
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 | 2511 error_handler = lambda err: loop.call_soon_threadsafe( |
2512 fut.set_exception, dbus_to_bridge_exception(err) | |
2513 ) | |
2514 self.db_core_iface.profile_delete_async( | |
2515 profile, | |
2516 timeout=const_TIMEOUT, | |
2517 reply_handler=reply_handler, | |
2518 error_handler=error_handler, | |
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 | 2526 error_handler = lambda err: loop.call_soon_threadsafe( |
2527 fut.set_exception, dbus_to_bridge_exception(err) | |
2528 ) | |
2529 self.db_core_iface.profile_is_session_started( | |
2530 profile_key, | |
2531 timeout=const_TIMEOUT, | |
2532 reply_handler=reply_handler, | |
2533 error_handler=error_handler, | |
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 | 2541 error_handler = lambda err: loop.call_soon_threadsafe( |
2542 fut.set_exception, dbus_to_bridge_exception(err) | |
2543 ) | |
2544 self.db_core_iface.profile_name_get( | |
2545 profile_key, | |
2546 timeout=const_TIMEOUT, | |
2547 reply_handler=reply_handler, | |
2548 error_handler=error_handler, | |
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 | 2556 error_handler = lambda err: loop.call_soon_threadsafe( |
2557 fut.set_exception, dbus_to_bridge_exception(err) | |
2558 ) | |
2559 self.db_core_iface.profile_set_default( | |
2560 profile, | |
2561 timeout=const_TIMEOUT, | |
2562 reply_handler=reply_handler, | |
2563 error_handler=error_handler, | |
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 | 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 | 2571 error_handler = lambda err: loop.call_soon_threadsafe( |
2572 fut.set_exception, dbus_to_bridge_exception(err) | |
2573 ) | |
2574 self.db_core_iface.profile_start_session( | |
2575 password, | |
2576 profile_key, | |
2577 timeout=const_TIMEOUT, | |
2578 reply_handler=reply_handler, | |
2579 error_handler=error_handler, | |
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 | 2587 error_handler = lambda err: loop.call_soon_threadsafe( |
2588 fut.set_exception, dbus_to_bridge_exception(err) | |
2589 ) | |
2590 self.db_core_iface.profiles_list_get( | |
2591 clients, | |
2592 components, | |
2593 timeout=const_TIMEOUT, | |
2594 reply_handler=reply_handler, | |
2595 error_handler=error_handler, | |
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 | 2603 error_handler = lambda err: loop.call_soon_threadsafe( |
2604 fut.set_exception, dbus_to_bridge_exception(err) | |
2605 ) | |
2606 self.db_core_iface.progress_get( | |
2607 id, | |
2608 profile, | |
2609 timeout=const_TIMEOUT, | |
2610 reply_handler=reply_handler, | |
2611 error_handler=error_handler, | |
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 | 2619 error_handler = lambda err: loop.call_soon_threadsafe( |
2620 fut.set_exception, dbus_to_bridge_exception(err) | |
2621 ) | |
2622 self.db_core_iface.progress_get_all( | |
2623 profile, | |
2624 timeout=const_TIMEOUT, | |
2625 reply_handler=reply_handler, | |
2626 error_handler=error_handler, | |
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 | 2634 error_handler = lambda err: loop.call_soon_threadsafe( |
2635 fut.set_exception, dbus_to_bridge_exception(err) | |
2636 ) | |
2637 self.db_core_iface.progress_get_all_metadata( | |
2638 profile, | |
2639 timeout=const_TIMEOUT, | |
2640 reply_handler=reply_handler, | |
2641 error_handler=error_handler, | |
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 | 2649 error_handler = lambda err: loop.call_soon_threadsafe( |
2650 fut.set_exception, dbus_to_bridge_exception(err) | |
2651 ) | |
2652 self.db_core_iface.ready_get( | |
2653 timeout=const_TIMEOUT, | |
2654 reply_handler=reply_handler, | |
2655 error_handler=error_handler, | |
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 | 2663 error_handler = lambda err: loop.call_soon_threadsafe( |
2664 fut.set_exception, dbus_to_bridge_exception(err) | |
2665 ) | |
2666 self.db_core_iface.roster_resync( | |
2667 profile_key, | |
2668 timeout=const_TIMEOUT, | |
2669 reply_handler=reply_handler, | |
2670 error_handler=error_handler, | |
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 | 2678 error_handler = lambda err: loop.call_soon_threadsafe( |
2679 fut.set_exception, dbus_to_bridge_exception(err) | |
2680 ) | |
2681 self.db_core_iface.session_infos_get( | |
2682 profile_key, | |
2683 timeout=const_TIMEOUT, | |
2684 reply_handler=reply_handler, | |
2685 error_handler=error_handler, | |
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 | 2693 error_handler = lambda err: loop.call_soon_threadsafe( |
2694 fut.set_exception, dbus_to_bridge_exception(err) | |
2695 ) | |
2696 self.db_core_iface.sub_waiting_get( | |
2697 profile_key, | |
2698 timeout=const_TIMEOUT, | |
2699 reply_handler=reply_handler, | |
2700 error_handler=error_handler, | |
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 | 2708 error_handler = lambda err: loop.call_soon_threadsafe( |
2709 fut.set_exception, dbus_to_bridge_exception(err) | |
2710 ) | |
2711 self.db_core_iface.subscription( | |
2712 sub_type, | |
2713 entity, | |
2714 profile_key, | |
2715 timeout=const_TIMEOUT, | |
2716 reply_handler=reply_handler, | |
2717 error_handler=error_handler, | |
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 | 2725 error_handler = lambda err: loop.call_soon_threadsafe( |
2726 fut.set_exception, dbus_to_bridge_exception(err) | |
2727 ) | |
2728 self.db_core_iface.version_get( | |
2729 timeout=const_TIMEOUT, | |
2730 reply_handler=reply_handler, | |
2731 error_handler=error_handler, | |
2732 ) | |
3042
964abd07dc03
bridge (dbus): AsyncIO version of D-Bus bridge:
Goffi <goffi@goffi.org>
parents:
3039
diff
changeset
|
2733 return fut |