annotate libervia/backend/bridge/dbus_bridge.py @ 4108:238e305f2306

plugin JID Search: JID search plugin, first draft
author Goffi <goffi@goffi.org>
date Thu, 06 Jul 2023 11:34:51 +0200
parents 4b842c1fb686
children 02f0adc745c6
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
3028
ab2696e34d29 Python 3 port:
Goffi <goffi@goffi.org>
parents: 2894
diff changeset
1 #!/usr/bin/env python3
3137
559a625a236b fixed shebangs
Goffi <goffi@goffi.org>
parents: 3136
diff changeset
2
3539
60d3861e5996 bridge (dbus): use Tx DBus for backend part of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3480
diff changeset
3 # Libervia communication bridge
3479
be6d91572633 date update
Goffi <goffi@goffi.org>
parents: 3259
diff changeset
4 # Copyright (C) 2009-2021 Jérôme Poisson (goffi@goffi.org)
0
goffi@necton2
parents:
diff changeset
5
609
84a6e83157c2 fixed licences in docstrings (they are now in comments)
Goffi <goffi@goffi.org>
parents: 595
diff changeset
6 # This program is free software: you can redistribute it and/or modify
84a6e83157c2 fixed licences in docstrings (they are now in comments)
Goffi <goffi@goffi.org>
parents: 595
diff changeset
7 # it under the terms of the GNU Affero General Public License as published by
84a6e83157c2 fixed licences in docstrings (they are now in comments)
Goffi <goffi@goffi.org>
parents: 595
diff changeset
8 # the Free Software Foundation, either version 3 of the License, or
84a6e83157c2 fixed licences in docstrings (they are now in comments)
Goffi <goffi@goffi.org>
parents: 595
diff changeset
9 # (at your option) any later version.
0
goffi@necton2
parents:
diff changeset
10
609
84a6e83157c2 fixed licences in docstrings (they are now in comments)
Goffi <goffi@goffi.org>
parents: 595
diff changeset
11 # This program is distributed in the hope that it will be useful,
84a6e83157c2 fixed licences in docstrings (they are now in comments)
Goffi <goffi@goffi.org>
parents: 595
diff changeset
12 # but WITHOUT ANY WARRANTY; without even the implied warranty of
84a6e83157c2 fixed licences in docstrings (they are now in comments)
Goffi <goffi@goffi.org>
parents: 595
diff changeset
13 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
84a6e83157c2 fixed licences in docstrings (they are now in comments)
Goffi <goffi@goffi.org>
parents: 595
diff changeset
14 # GNU Affero General Public License for more details.
0
goffi@necton2
parents:
diff changeset
15
609
84a6e83157c2 fixed licences in docstrings (they are now in comments)
Goffi <goffi@goffi.org>
parents: 595
diff changeset
16 # You should have received a copy of the GNU Affero General Public License
84a6e83157c2 fixed licences in docstrings (they are now in comments)
Goffi <goffi@goffi.org>
parents: 595
diff changeset
17 # along with this program. If not, see <http://www.gnu.org/licenses/>.
0
goffi@necton2
parents:
diff changeset
18
3539
60d3861e5996 bridge (dbus): use Tx DBus for backend part of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3480
diff changeset
19 from types import MethodType
60d3861e5996 bridge (dbus): use Tx DBus for backend part of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3480
diff changeset
20 from functools import partialmethod
60d3861e5996 bridge (dbus): use Tx DBus for backend part of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3480
diff changeset
21 from twisted.internet import defer, reactor
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.core.log import getLogger
4b842c1fb686 refactoring: renamed `sat` package to `libervia.backend`
Goffi <goffi@goffi.org>
parents: 4041
diff changeset
24 from libervia.backend.core.exceptions import BridgeInitError
4b842c1fb686 refactoring: renamed `sat` package to `libervia.backend`
Goffi <goffi@goffi.org>
parents: 4041
diff changeset
25 from libervia.backend.tools import config
3539
60d3861e5996 bridge (dbus): use Tx DBus for backend part of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3480
diff changeset
26 from txdbus import client, objects, error
60d3861e5996 bridge (dbus): use Tx DBus for backend part of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3480
diff changeset
27 from txdbus.interface import DBusInterface, Method, Signal
0
goffi@necton2
parents:
diff changeset
28
3143
830fce0db15d bridge (dbus): new `bridge_dbus_int_prefix` option (in `[DEFAULT]` settings) to change interface prefix
Goffi <goffi@goffi.org>
parents: 3137
diff changeset
29
830fce0db15d bridge (dbus): new `bridge_dbus_int_prefix` option (in `[DEFAULT]` settings) to change interface prefix
Goffi <goffi@goffi.org>
parents: 3137
diff changeset
30 log = getLogger(__name__)
830fce0db15d bridge (dbus): new `bridge_dbus_int_prefix` option (in `[DEFAULT]` settings) to change interface prefix
Goffi <goffi@goffi.org>
parents: 3137
diff changeset
31
830fce0db15d bridge (dbus): new `bridge_dbus_int_prefix` option (in `[DEFAULT]` settings) to change interface prefix
Goffi <goffi@goffi.org>
parents: 3137
diff changeset
32 # Interface prefix
4037
524856bd7b19 massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents: 3539
diff changeset
33 const_INT_PREFIX = config.config_get(
524856bd7b19 massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents: 3539
diff changeset
34 config.parse_main_conf(),
3143
830fce0db15d bridge (dbus): new `bridge_dbus_int_prefix` option (in `[DEFAULT]` settings) to change interface prefix
Goffi <goffi@goffi.org>
parents: 3137
diff changeset
35 "",
830fce0db15d bridge (dbus): new `bridge_dbus_int_prefix` option (in `[DEFAULT]` settings) to change interface prefix
Goffi <goffi@goffi.org>
parents: 3137
diff changeset
36 "bridge_dbus_int_prefix",
3480
7550ae9cfbac Renamed the project from "Salut à Toi" to "Libervia":
Goffi <goffi@goffi.org>
parents: 3479
diff changeset
37 "org.libervia.Libervia")
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"
3480
7550ae9cfbac Renamed the project from "Salut à Toi" to "Libervia":
Goffi <goffi@goffi.org>
parents: 3479
diff changeset
39 const_OBJ_PATH = "/org/libervia/Libervia/bridge"
371
3ea41a199b36 bridge refactoring: categories are now core and plugin instead of communication and request
Goffi <goffi@goffi.org>
parents: 365
diff changeset
40 const_CORE_SUFFIX = ".core"
3ea41a199b36 bridge refactoring: categories are now core and plugin instead of communication and request
Goffi <goffi@goffi.org>
parents: 365
diff changeset
41 const_PLUGIN_SUFFIX = ".plugin"
7
c14a3a7018a5 added dynamic exportation of Dbus bridge method (usefull for plugins)
Goffi <goffi@goffi.org>
parents: 1
diff changeset
42
595
1f160467f5de Fix pep8 support in src/bridge.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents: 587
diff changeset
43
477
031b0e0aaab8 plugin groupblog: subscriptions/notifications
Goffi <goffi@goffi.org>
parents: 469
diff changeset
44 class ParseError(Exception):
031b0e0aaab8 plugin groupblog: subscriptions/notifications
Goffi <goffi@goffi.org>
parents: 469
diff changeset
45 pass
031b0e0aaab8 plugin groupblog: subscriptions/notifications
Goffi <goffi@goffi.org>
parents: 469
diff changeset
46
595
1f160467f5de Fix pep8 support in src/bridge.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents: 587
diff changeset
47
3539
60d3861e5996 bridge (dbus): use Tx DBus for backend part of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3480
diff changeset
48 class DBusException(Exception):
60d3861e5996 bridge (dbus): use Tx DBus for backend part of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3480
diff changeset
49 pass
423
6c20c76abdcc backend: - bridge async D-Bus method now automatically manage callback and errback, we just have to return a deferred
Goffi <goffi@goffi.org>
parents: 419
diff changeset
50
595
1f160467f5de Fix pep8 support in src/bridge.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents: 587
diff changeset
51
3539
60d3861e5996 bridge (dbus): use Tx DBus for backend part of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3480
diff changeset
52 class MethodNotRegistered(DBusException):
60d3861e5996 bridge (dbus): use Tx DBus for backend part of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3480
diff changeset
53 dbusErrorName = const_ERROR_PREFIX + ".MethodNotRegistered"
423
6c20c76abdcc backend: - bridge async D-Bus method now automatically manage callback and errback, we just have to return a deferred
Goffi <goffi@goffi.org>
parents: 419
diff changeset
54
595
1f160467f5de Fix pep8 support in src/bridge.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents: 587
diff changeset
55
3539
60d3861e5996 bridge (dbus): use Tx DBus for backend part of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3480
diff changeset
56 class GenericException(DBusException):
423
6c20c76abdcc backend: - bridge async D-Bus method now automatically manage callback and errback, we just have to return a deferred
Goffi <goffi@goffi.org>
parents: 419
diff changeset
57 def __init__(self, twisted_error):
1073
f094583732de bridge: DBusException also transports the twisted failure condition
souliane <souliane@mailoo.org>
parents: 1062
diff changeset
58 """
f094583732de bridge: DBusException also transports the twisted failure condition
souliane <souliane@mailoo.org>
parents: 1062
diff changeset
59
f094583732de bridge: DBusException also transports the twisted failure condition
souliane <souliane@mailoo.org>
parents: 1062
diff changeset
60 @param twisted_error (Failure): instance of twisted Failure
3539
60d3861e5996 bridge (dbus): use Tx DBus for backend part of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3480
diff changeset
61 error message is used to store a repr of message and condition in a tuple,
60d3861e5996 bridge (dbus): use Tx DBus for backend part of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3480
diff changeset
62 so it can be evaluated by the frontend bridge.
1073
f094583732de bridge: DBusException also transports the twisted failure condition
souliane <souliane@mailoo.org>
parents: 1062
diff changeset
63 """
751
1def5b7edf9f core, bridge: better GenericException handling
Goffi <goffi@goffi.org>
parents: 698
diff changeset
64 try:
1def5b7edf9f core, bridge: better GenericException handling
Goffi <goffi@goffi.org>
parents: 698
diff changeset
65 # twisted_error.value is a class
1062
95758ef3faa8 bridge: async failures are more detailed (full class name + error message)
souliane <souliane@mailoo.org>
parents: 1060
diff changeset
66 class_ = twisted_error.value().__class__
751
1def5b7edf9f core, bridge: better GenericException handling
Goffi <goffi@goffi.org>
parents: 698
diff changeset
67 except TypeError:
1def5b7edf9f core, bridge: better GenericException handling
Goffi <goffi@goffi.org>
parents: 698
diff changeset
68 # twisted_error.value is an instance
1062
95758ef3faa8 bridge: async failures are more detailed (full class name + error message)
souliane <souliane@mailoo.org>
parents: 1060
diff changeset
69 class_ = twisted_error.value.__class__
3539
60d3861e5996 bridge (dbus): use Tx DBus for backend part of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3480
diff changeset
70 data = twisted_error.getErrorMessage()
1073
f094583732de bridge: DBusException also transports the twisted failure condition
souliane <souliane@mailoo.org>
parents: 1062
diff changeset
71 try:
3539
60d3861e5996 bridge (dbus): use Tx DBus for backend part of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3480
diff changeset
72 data = (data, twisted_error.value.condition)
1073
f094583732de bridge: DBusException also transports the twisted failure condition
souliane <souliane@mailoo.org>
parents: 1062
diff changeset
73 except AttributeError:
3539
60d3861e5996 bridge (dbus): use Tx DBus for backend part of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3480
diff changeset
74 data = (data,)
60d3861e5996 bridge (dbus): use Tx DBus for backend part of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3480
diff changeset
75 else:
60d3861e5996 bridge (dbus): use Tx DBus for backend part of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3480
diff changeset
76 data = (str(twisted_error),)
60d3861e5996 bridge (dbus): use Tx DBus for backend part of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3480
diff changeset
77 self.dbusErrorName = ".".join(
60d3861e5996 bridge (dbus): use Tx DBus for backend part of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3480
diff changeset
78 (const_ERROR_PREFIX, class_.__module__, class_.__name__)
2624
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2595
diff changeset
79 )
3539
60d3861e5996 bridge (dbus): use Tx DBus for backend part of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3480
diff changeset
80 super(GenericException, self).__init__(repr(data))
60d3861e5996 bridge (dbus): use Tx DBus for backend part of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3480
diff changeset
81
60d3861e5996 bridge (dbus): use Tx DBus for backend part of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3480
diff changeset
82 @classmethod
60d3861e5996 bridge (dbus): use Tx DBus for backend part of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3480
diff changeset
83 def create_and_raise(cls, exc):
60d3861e5996 bridge (dbus): use Tx DBus for backend part of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3480
diff changeset
84 raise cls(exc)
595
1f160467f5de Fix pep8 support in src/bridge.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents: 587
diff changeset
85
419
6c167a2e04b8 bridge: added generic D-Bus exception management + asyncCreateProfile method
Goffi <goffi@goffi.org>
parents: 413
diff changeset
86
3539
60d3861e5996 bridge (dbus): use Tx DBus for backend part of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3480
diff changeset
87 class DBusObject(objects.DBusObject):
60d3861e5996 bridge (dbus): use Tx DBus for backend part of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3480
diff changeset
88
60d3861e5996 bridge (dbus): use Tx DBus for backend part of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3480
diff changeset
89 core_iface = DBusInterface(
60d3861e5996 bridge (dbus): use Tx DBus for backend part of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3480
diff changeset
90 const_INT_PREFIX + const_CORE_SUFFIX,
4041
2594e1951cf7 core (bridge): `action_new` now use serialised dict for extra data.
Goffi <goffi@goffi.org>
parents: 4037
diff changeset
91 Method('action_launch', arguments='sss', returns='s'),
2594e1951cf7 core (bridge): `action_new` now use serialised dict for extra data.
Goffi <goffi@goffi.org>
parents: 4037
diff changeset
92 Method('actions_get', arguments='s', returns='a(ssi)'),
4037
524856bd7b19 massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents: 3539
diff changeset
93 Method('config_get', arguments='ss', returns='s'),
3539
60d3861e5996 bridge (dbus): use Tx DBus for backend part of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3480
diff changeset
94 Method('connect', arguments='ssa{ss}', returns='b'),
4037
524856bd7b19 massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents: 3539
diff changeset
95 Method('contact_add', arguments='ss', returns=''),
524856bd7b19 massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents: 3539
diff changeset
96 Method('contact_del', arguments='ss', returns=''),
524856bd7b19 massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents: 3539
diff changeset
97 Method('contact_get', arguments='ss', returns='(a{ss}as)'),
524856bd7b19 massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents: 3539
diff changeset
98 Method('contact_update', arguments='ssass', returns=''),
524856bd7b19 massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents: 3539
diff changeset
99 Method('contacts_get', arguments='s', returns='a(sa{ss}as)'),
524856bd7b19 massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents: 3539
diff changeset
100 Method('contacts_get_from_group', arguments='ss', returns='as'),
524856bd7b19 massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents: 3539
diff changeset
101 Method('devices_infos_get', arguments='ss', returns='s'),
524856bd7b19 massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents: 3539
diff changeset
102 Method('disco_find_by_features', arguments='asa(ss)bbbbbs', returns='(a{sa(sss)}a{sa(sss)}a{sa(sss)})'),
524856bd7b19 massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents: 3539
diff changeset
103 Method('disco_infos', arguments='ssbs', returns='(asa(sss)a{sa(a{ss}as)})'),
524856bd7b19 massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents: 3539
diff changeset
104 Method('disco_items', arguments='ssbs', returns='a(sss)'),
3539
60d3861e5996 bridge (dbus): use Tx DBus for backend part of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3480
diff changeset
105 Method('disconnect', arguments='s', returns=''),
4037
524856bd7b19 massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents: 3539
diff changeset
106 Method('encryption_namespace_get', arguments='s', returns='s'),
524856bd7b19 massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents: 3539
diff changeset
107 Method('encryption_plugins_get', arguments='', returns='s'),
524856bd7b19 massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents: 3539
diff changeset
108 Method('encryption_trust_ui_get', arguments='sss', returns='s'),
524856bd7b19 massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents: 3539
diff changeset
109 Method('entities_data_get', arguments='asass', returns='a{sa{ss}}'),
524856bd7b19 massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents: 3539
diff changeset
110 Method('entity_data_get', arguments='sass', returns='a{ss}'),
524856bd7b19 massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents: 3539
diff changeset
111 Method('features_get', arguments='s', returns='a{sa{ss}}'),
524856bd7b19 massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents: 3539
diff changeset
112 Method('history_get', arguments='ssiba{ss}s', returns='a(sdssa{ss}a{ss}ss)'),
524856bd7b19 massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents: 3539
diff changeset
113 Method('image_check', arguments='s', returns='s'),
524856bd7b19 massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents: 3539
diff changeset
114 Method('image_convert', arguments='ssss', returns='s'),
524856bd7b19 massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents: 3539
diff changeset
115 Method('image_generate_preview', arguments='ss', returns='s'),
524856bd7b19 massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents: 3539
diff changeset
116 Method('image_resize', arguments='sii', returns='s'),
524856bd7b19 massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents: 3539
diff changeset
117 Method('is_connected', arguments='s', returns='b'),
524856bd7b19 massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents: 3539
diff changeset
118 Method('main_resource_get', arguments='ss', returns='s'),
524856bd7b19 massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents: 3539
diff changeset
119 Method('menu_help_get', arguments='ss', returns='s'),
524856bd7b19 massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents: 3539
diff changeset
120 Method('menu_launch', arguments='sasa{ss}is', returns='a{ss}'),
524856bd7b19 massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents: 3539
diff changeset
121 Method('menus_get', arguments='si', returns='a(ssasasa{ss})'),
524856bd7b19 massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents: 3539
diff changeset
122 Method('message_encryption_get', arguments='ss', returns='s'),
524856bd7b19 massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents: 3539
diff changeset
123 Method('message_encryption_start', arguments='ssbs', returns=''),
524856bd7b19 massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents: 3539
diff changeset
124 Method('message_encryption_stop', arguments='ss', returns=''),
524856bd7b19 massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents: 3539
diff changeset
125 Method('message_send', arguments='sa{ss}a{ss}sss', returns=''),
524856bd7b19 massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents: 3539
diff changeset
126 Method('namespaces_get', arguments='', returns='a{ss}'),
524856bd7b19 massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents: 3539
diff changeset
127 Method('param_get_a', arguments='ssss', returns='s'),
524856bd7b19 massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents: 3539
diff changeset
128 Method('param_get_a_async', arguments='sssis', returns='s'),
524856bd7b19 massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents: 3539
diff changeset
129 Method('param_set', arguments='sssis', returns=''),
524856bd7b19 massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents: 3539
diff changeset
130 Method('param_ui_get', arguments='isss', returns='s'),
524856bd7b19 massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents: 3539
diff changeset
131 Method('params_categories_get', arguments='', returns='as'),
524856bd7b19 massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents: 3539
diff changeset
132 Method('params_register_app', arguments='sis', returns=''),
524856bd7b19 massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents: 3539
diff changeset
133 Method('params_template_load', arguments='s', returns='b'),
524856bd7b19 massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents: 3539
diff changeset
134 Method('params_template_save', arguments='s', returns='b'),
524856bd7b19 massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents: 3539
diff changeset
135 Method('params_values_from_category_get_async', arguments='sisss', returns='a{ss}'),
524856bd7b19 massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents: 3539
diff changeset
136 Method('presence_set', arguments='ssa{ss}s', returns=''),
524856bd7b19 massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents: 3539
diff changeset
137 Method('presence_statuses_get', arguments='s', returns='a{sa{s(sia{ss})}}'),
524856bd7b19 massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents: 3539
diff changeset
138 Method('private_data_delete', arguments='sss', returns=''),
524856bd7b19 massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents: 3539
diff changeset
139 Method('private_data_get', arguments='sss', returns='s'),
524856bd7b19 massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents: 3539
diff changeset
140 Method('private_data_set', arguments='ssss', returns=''),
524856bd7b19 massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents: 3539
diff changeset
141 Method('profile_create', arguments='sss', returns=''),
524856bd7b19 massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents: 3539
diff changeset
142 Method('profile_delete_async', arguments='s', returns=''),
524856bd7b19 massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents: 3539
diff changeset
143 Method('profile_is_session_started', arguments='s', returns='b'),
524856bd7b19 massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents: 3539
diff changeset
144 Method('profile_name_get', arguments='s', returns='s'),
524856bd7b19 massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents: 3539
diff changeset
145 Method('profile_set_default', arguments='s', returns=''),
524856bd7b19 massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents: 3539
diff changeset
146 Method('profile_start_session', arguments='ss', returns='b'),
524856bd7b19 massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents: 3539
diff changeset
147 Method('profiles_list_get', arguments='bb', returns='as'),
524856bd7b19 massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents: 3539
diff changeset
148 Method('progress_get', arguments='ss', returns='a{ss}'),
524856bd7b19 massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents: 3539
diff changeset
149 Method('progress_get_all', arguments='s', returns='a{sa{sa{ss}}}'),
524856bd7b19 massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents: 3539
diff changeset
150 Method('progress_get_all_metadata', arguments='s', returns='a{sa{sa{ss}}}'),
524856bd7b19 massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents: 3539
diff changeset
151 Method('ready_get', arguments='', returns=''),
524856bd7b19 massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents: 3539
diff changeset
152 Method('roster_resync', arguments='s', returns=''),
524856bd7b19 massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents: 3539
diff changeset
153 Method('session_infos_get', arguments='s', returns='a{ss}'),
524856bd7b19 massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents: 3539
diff changeset
154 Method('sub_waiting_get', arguments='s', returns='a{ss}'),
3539
60d3861e5996 bridge (dbus): use Tx DBus for backend part of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3480
diff changeset
155 Method('subscription', arguments='sss', returns=''),
4037
524856bd7b19 massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents: 3539
diff changeset
156 Method('version_get', arguments='', returns='s'),
3539
60d3861e5996 bridge (dbus): use Tx DBus for backend part of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3480
diff changeset
157 Signal('_debug', 'sa{ss}s'),
4041
2594e1951cf7 core (bridge): `action_new` now use serialised dict for extra data.
Goffi <goffi@goffi.org>
parents: 4037
diff changeset
158 Signal('action_new', 'ssis'),
3539
60d3861e5996 bridge (dbus): use Tx DBus for backend part of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3480
diff changeset
159 Signal('connected', 'ss'),
4037
524856bd7b19 massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents: 3539
diff changeset
160 Signal('contact_deleted', 'ss'),
524856bd7b19 massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents: 3539
diff changeset
161 Signal('contact_new', 'sa{ss}ass'),
3539
60d3861e5996 bridge (dbus): use Tx DBus for backend part of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3480
diff changeset
162 Signal('disconnected', 's'),
4037
524856bd7b19 massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents: 3539
diff changeset
163 Signal('entity_data_updated', 'ssss'),
524856bd7b19 massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents: 3539
diff changeset
164 Signal('message_encryption_started', 'sss'),
524856bd7b19 massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents: 3539
diff changeset
165 Signal('message_encryption_stopped', 'sa{ss}s'),
524856bd7b19 massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents: 3539
diff changeset
166 Signal('message_new', 'sdssa{ss}a{ss}sss'),
524856bd7b19 massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents: 3539
diff changeset
167 Signal('param_update', 'ssss'),
524856bd7b19 massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents: 3539
diff changeset
168 Signal('presence_update', 'ssia{ss}s'),
524856bd7b19 massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents: 3539
diff changeset
169 Signal('progress_error', 'sss'),
524856bd7b19 massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents: 3539
diff changeset
170 Signal('progress_finished', 'sa{ss}s'),
524856bd7b19 massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents: 3539
diff changeset
171 Signal('progress_started', 'sa{ss}s'),
3539
60d3861e5996 bridge (dbus): use Tx DBus for backend part of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3480
diff changeset
172 Signal('subscribe', 'sss'),
60d3861e5996 bridge (dbus): use Tx DBus for backend part of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3480
diff changeset
173 )
60d3861e5996 bridge (dbus): use Tx DBus for backend part of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3480
diff changeset
174 plugin_iface = DBusInterface(
60d3861e5996 bridge (dbus): use Tx DBus for backend part of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3480
diff changeset
175 const_INT_PREFIX + const_PLUGIN_SUFFIX
60d3861e5996 bridge (dbus): use Tx DBus for backend part of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3480
diff changeset
176 )
60d3861e5996 bridge (dbus): use Tx DBus for backend part of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3480
diff changeset
177
60d3861e5996 bridge (dbus): use Tx DBus for backend part of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3480
diff changeset
178 dbusInterfaces = [core_iface, plugin_iface]
60d3861e5996 bridge (dbus): use Tx DBus for backend part of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3480
diff changeset
179
60d3861e5996 bridge (dbus): use Tx DBus for backend part of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3480
diff changeset
180 def __init__(self, path):
60d3861e5996 bridge (dbus): use Tx DBus for backend part of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3480
diff changeset
181 super().__init__(path)
60d3861e5996 bridge (dbus): use Tx DBus for backend part of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3480
diff changeset
182 log.debug("Init DBusObject...")
595
1f160467f5de Fix pep8 support in src/bridge.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents: 587
diff changeset
183 self.cb = {}
0
goffi@necton2
parents:
diff changeset
184
2086
4633cfcbcccb bridge (D-Bus): bad design fixes:
Goffi <goffi@goffi.org>
parents: 2085
diff changeset
185 def register_method(self, name, cb):
595
1f160467f5de Fix pep8 support in src/bridge.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents: 587
diff changeset
186 self.cb[name] = cb
0
goffi@necton2
parents:
diff changeset
187
423
6c20c76abdcc backend: - bridge async D-Bus method now automatically manage callback and errback, we just have to return a deferred
Goffi <goffi@goffi.org>
parents: 419
diff changeset
188 def _callback(self, name, *args, **kwargs):
3539
60d3861e5996 bridge (dbus): use Tx DBus for backend part of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3480
diff changeset
189 """Call the callback if it exists, raise an exception else"""
60d3861e5996 bridge (dbus): use Tx DBus for backend part of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3480
diff changeset
190 try:
60d3861e5996 bridge (dbus): use Tx DBus for backend part of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3480
diff changeset
191 cb = self.cb[name]
60d3861e5996 bridge (dbus): use Tx DBus for backend part of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3480
diff changeset
192 except KeyError:
423
6c20c76abdcc backend: - bridge async D-Bus method now automatically manage callback and errback, we just have to return a deferred
Goffi <goffi@goffi.org>
parents: 419
diff changeset
193 raise MethodNotRegistered
6c20c76abdcc backend: - bridge async D-Bus method now automatically manage callback and errback, we just have to return a deferred
Goffi <goffi@goffi.org>
parents: 419
diff changeset
194 else:
3539
60d3861e5996 bridge (dbus): use Tx DBus for backend part of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3480
diff changeset
195 d = defer.maybeDeferred(cb, *args, **kwargs)
60d3861e5996 bridge (dbus): use Tx DBus for backend part of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3480
diff changeset
196 d.addErrback(GenericException.create_and_raise)
60d3861e5996 bridge (dbus): use Tx DBus for backend part of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3480
diff changeset
197 return d
1467
ceba6fd77739 core, bridge: new signal actionNew to launch an action from the backend (e.g. display a dialog message):
Goffi <goffi@goffi.org>
parents: 1435
diff changeset
198
4037
524856bd7b19 massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents: 3539
diff changeset
199 def dbus_action_launch(self, callback_id, data, profile_key="@DEFAULT@"):
524856bd7b19 massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents: 3539
diff changeset
200 return self._callback("action_launch", callback_id, data, profile_key)
2655
b8600f8130ac core (bridge): new messageEncryptionStarted and messageEncryptionStopped signals (not used yet)
Goffi <goffi@goffi.org>
parents: 2646
diff changeset
201
4037
524856bd7b19 massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents: 3539
diff changeset
202 def dbus_actions_get(self, profile_key="@DEFAULT@"):
524856bd7b19 massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents: 3539
diff changeset
203 return self._callback("actions_get", profile_key)
0
goffi@necton2
parents:
diff changeset
204
4037
524856bd7b19 massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents: 3539
diff changeset
205 def dbus_config_get(self, section, name):
524856bd7b19 massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents: 3539
diff changeset
206 return self._callback("config_get", section, name)
1522
7d7e57a84792 core: progression handling improvments:
Goffi <goffi@goffi.org>
parents: 1482
diff changeset
207
3539
60d3861e5996 bridge (dbus): use Tx DBus for backend part of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3480
diff changeset
208 def dbus_connect(self, profile_key="@DEFAULT@", password='', options={}):
60d3861e5996 bridge (dbus): use Tx DBus for backend part of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3480
diff changeset
209 return self._callback("connect", profile_key, password, options)
1522
7d7e57a84792 core: progression handling improvments:
Goffi <goffi@goffi.org>
parents: 1482
diff changeset
210
4037
524856bd7b19 massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents: 3539
diff changeset
211 def dbus_contact_add(self, entity_jid, profile_key="@DEFAULT@"):
524856bd7b19 massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents: 3539
diff changeset
212 return self._callback("contact_add", entity_jid, profile_key)
524856bd7b19 massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents: 3539
diff changeset
213
524856bd7b19 massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents: 3539
diff changeset
214 def dbus_contact_del(self, entity_jid, profile_key="@DEFAULT@"):
524856bd7b19 massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents: 3539
diff changeset
215 return self._callback("contact_del", entity_jid, profile_key)
1622
5b24d6bf5d15 core, bridge: actionsGet:
Goffi <goffi@goffi.org>
parents: 1599
diff changeset
216
4037
524856bd7b19 massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents: 3539
diff changeset
217 def dbus_contact_get(self, arg_0, profile_key="@DEFAULT@"):
524856bd7b19 massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents: 3539
diff changeset
218 return self._callback("contact_get", arg_0, profile_key)
893
308a96bc7c1b core, frontends: add method asyncDeleteProfile, remove synchronous methods createProfile and deleteProfile
souliane <souliane@mailoo.org>
parents: 811
diff changeset
219
4037
524856bd7b19 massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents: 3539
diff changeset
220 def dbus_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: 3539
diff changeset
221 return self._callback("contact_update", entity_jid, name, groups, profile_key)
524856bd7b19 massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents: 3539
diff changeset
222
524856bd7b19 massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents: 3539
diff changeset
223 def dbus_contacts_get(self, profile_key="@DEFAULT@"):
524856bd7b19 massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents: 3539
diff changeset
224 return self._callback("contacts_get", profile_key)
2142
be96beb7ca14 core, bridge, frontends: renamed asyncConnect to connect, and added options parameters (not used yet)
Goffi <goffi@goffi.org>
parents: 2126
diff changeset
225
4037
524856bd7b19 massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents: 3539
diff changeset
226 def dbus_contacts_get_from_group(self, group, profile_key="@DEFAULT@"):
524856bd7b19 massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents: 3539
diff changeset
227 return self._callback("contacts_get_from_group", group, profile_key)
524856bd7b19 massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents: 3539
diff changeset
228
524856bd7b19 massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents: 3539
diff changeset
229 def dbus_devices_infos_get(self, bare_jid, profile_key):
524856bd7b19 massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents: 3539
diff changeset
230 return self._callback("devices_infos_get", bare_jid, profile_key)
2628
779351da2c13 core, frontends: replaced org\.goffi namespaces by org.salutatoi + fixed generation:
Goffi <goffi@goffi.org>
parents: 2624
diff changeset
231
4037
524856bd7b19 massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents: 3539
diff changeset
232 def dbus_disco_find_by_features(self, namespaces, identities, bare_jid=False, service=True, roster=True, own_jid=True, local_device=False, profile_key="@DEFAULT@"):
524856bd7b19 massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents: 3539
diff changeset
233 return self._callback("disco_find_by_features", namespaces, identities, bare_jid, service, roster, own_jid, local_device, profile_key)
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
234
4037
524856bd7b19 massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents: 3539
diff changeset
235 def dbus_disco_infos(self, entity_jid, node=u'', use_cache=True, profile_key="@DEFAULT@"):
524856bd7b19 massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents: 3539
diff changeset
236 return self._callback("disco_infos", entity_jid, node, use_cache, profile_key)
524856bd7b19 massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents: 3539
diff changeset
237
524856bd7b19 massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents: 3539
diff changeset
238 def dbus_disco_items(self, entity_jid, node=u'', use_cache=True, profile_key="@DEFAULT@"):
524856bd7b19 massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents: 3539
diff changeset
239 return self._callback("disco_items", entity_jid, node, use_cache, profile_key)
963
723f28cd15c7 core (disco): added discoInfos and discoItems bridge methods
Goffi <goffi@goffi.org>
parents: 943
diff changeset
240
3539
60d3861e5996 bridge (dbus): use Tx DBus for backend part of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3480
diff changeset
241 def dbus_disconnect(self, profile_key="@DEFAULT@"):
60d3861e5996 bridge (dbus): use Tx DBus for backend part of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3480
diff changeset
242 return self._callback("disconnect", profile_key)
267
bdcd535e179e Bridge constructor:
Goffi <goffi@goffi.org>
parents: 266
diff changeset
243
4037
524856bd7b19 massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents: 3539
diff changeset
244 def dbus_encryption_namespace_get(self, arg_0):
524856bd7b19 massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents: 3539
diff changeset
245 return self._callback("encryption_namespace_get", arg_0)
2733
e347e32aa07f core (memory/encryption): new encryptionNamespaceGet and encryptionTrustUIGet methods:
Goffi <goffi@goffi.org>
parents: 2658
diff changeset
246
4037
524856bd7b19 massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents: 3539
diff changeset
247 def dbus_encryption_plugins_get(self, ):
524856bd7b19 massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents: 3539
diff changeset
248 return self._callback("encryption_plugins_get", )
2658
4e130cc9bfc0 core (memore/encryption): new methods and checks:
Goffi <goffi@goffi.org>
parents: 2655
diff changeset
249
4037
524856bd7b19 massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents: 3539
diff changeset
250 def dbus_encryption_trust_ui_get(self, to_jid, namespace, profile_key):
524856bd7b19 massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents: 3539
diff changeset
251 return self._callback("encryption_trust_ui_get", to_jid, namespace, profile_key)
2733
e347e32aa07f core (memory/encryption): new encryptionNamespaceGet and encryptionTrustUIGet methods:
Goffi <goffi@goffi.org>
parents: 2658
diff changeset
252
4037
524856bd7b19 massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents: 3539
diff changeset
253 def dbus_entities_data_get(self, jids, keys, profile):
524856bd7b19 massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents: 3539
diff changeset
254 return self._callback("entities_data_get", jids, keys, profile)
364
312ca6f9d84a core: configuration file
Goffi <goffi@goffi.org>
parents: 360
diff changeset
255
4037
524856bd7b19 massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents: 3539
diff changeset
256 def dbus_entity_data_get(self, jid, keys, profile):
524856bd7b19 massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents: 3539
diff changeset
257 return self._callback("entity_data_get", jid, keys, profile)
267
bdcd535e179e Bridge constructor:
Goffi <goffi@goffi.org>
parents: 266
diff changeset
258
4037
524856bd7b19 massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents: 3539
diff changeset
259 def dbus_features_get(self, profile_key):
524856bd7b19 massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents: 3539
diff changeset
260 return self._callback("features_get", profile_key)
501
e9634d2e7b38 core, quick_frontend, primitivus, wix: Contacts List refactoring phase 1:
Goffi <goffi@goffi.org>
parents: 480
diff changeset
261
4037
524856bd7b19 massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents: 3539
diff changeset
262 def dbus_history_get(self, from_jid, to_jid, limit, between=True, filters='', profile="@NONE@"):
524856bd7b19 massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents: 3539
diff changeset
263 return self._callback("history_get", from_jid, to_jid, limit, between, filters, profile)
1314
bb9c32249778 core: added getEntitiesData which get cache data for several entities at once
Goffi <goffi@goffi.org>
parents: 1290
diff changeset
264
4037
524856bd7b19 massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents: 3539
diff changeset
265 def dbus_image_check(self, arg_0):
524856bd7b19 massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents: 3539
diff changeset
266 return self._callback("image_check", arg_0)
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
267
4037
524856bd7b19 massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents: 3539
diff changeset
268 def dbus_image_convert(self, source, dest, arg_2, extra):
524856bd7b19 massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents: 3539
diff changeset
269 return self._callback("image_convert", source, dest, arg_2, extra)
1482
80cd55dd5b04 core, bridge: added getFeatures method:
Goffi <goffi@goffi.org>
parents: 1467
diff changeset
270
4037
524856bd7b19 massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents: 3539
diff changeset
271 def dbus_image_generate_preview(self, image_path, profile_key):
524856bd7b19 massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents: 3539
diff changeset
272 return self._callback("image_generate_preview", image_path, profile_key)
267
bdcd535e179e Bridge constructor:
Goffi <goffi@goffi.org>
parents: 266
diff changeset
273
4037
524856bd7b19 massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents: 3539
diff changeset
274 def dbus_image_resize(self, image_path, width, height):
524856bd7b19 massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents: 3539
diff changeset
275 return self._callback("image_resize", image_path, width, height)
267
bdcd535e179e Bridge constructor:
Goffi <goffi@goffi.org>
parents: 266
diff changeset
276
4037
524856bd7b19 massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents: 3539
diff changeset
277 def dbus_is_connected(self, profile_key="@DEFAULT@"):
524856bd7b19 massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents: 3539
diff changeset
278 return self._callback("is_connected", profile_key)
267
bdcd535e179e Bridge constructor:
Goffi <goffi@goffi.org>
parents: 266
diff changeset
279
4037
524856bd7b19 massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents: 3539
diff changeset
280 def dbus_main_resource_get(self, contact_jid, profile_key="@DEFAULT@"):
524856bd7b19 massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents: 3539
diff changeset
281 return self._callback("main_resource_get", contact_jid, profile_key)
2628
779351da2c13 core, frontends: replaced org\.goffi namespaces by org.salutatoi + fixed generation:
Goffi <goffi@goffi.org>
parents: 2624
diff changeset
282
4037
524856bd7b19 massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents: 3539
diff changeset
283 def dbus_menu_help_get(self, menu_id, language):
524856bd7b19 massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents: 3539
diff changeset
284 return self._callback("menu_help_get", menu_id, language)
267
bdcd535e179e Bridge constructor:
Goffi <goffi@goffi.org>
parents: 266
diff changeset
285
4037
524856bd7b19 massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents: 3539
diff changeset
286 def dbus_menu_launch(self, menu_type, path, data, security_limit, profile_key):
524856bd7b19 massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents: 3539
diff changeset
287 return self._callback("menu_launch", menu_type, path, data, security_limit, profile_key)
1023
8bae81e254a2 core: added a getReady method which can be called by frontends to ensure that backend is fully initialised before doing anything + this ckeck is automatically done in asyncConnect
Goffi <goffi@goffi.org>
parents: 1015
diff changeset
288
4037
524856bd7b19 massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents: 3539
diff changeset
289 def dbus_menus_get(self, language, security_limit):
524856bd7b19 massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents: 3539
diff changeset
290 return self._callback("menus_get", language, security_limit)
267
bdcd535e179e Bridge constructor:
Goffi <goffi@goffi.org>
parents: 266
diff changeset
291
4037
524856bd7b19 massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents: 3539
diff changeset
292 def dbus_message_encryption_get(self, to_jid, profile_key):
524856bd7b19 massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents: 3539
diff changeset
293 return self._callback("message_encryption_get", to_jid, profile_key)
267
bdcd535e179e Bridge constructor:
Goffi <goffi@goffi.org>
parents: 266
diff changeset
294
4037
524856bd7b19 massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents: 3539
diff changeset
295 def dbus_message_encryption_start(self, to_jid, namespace='', replace=False, profile_key="@NONE@"):
524856bd7b19 massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents: 3539
diff changeset
296 return self._callback("message_encryption_start", to_jid, namespace, replace, profile_key)
1955
633b5c21aefd backend, frontend: messages refactoring (huge commit, not finished):
Goffi <goffi@goffi.org>
parents: 1934
diff changeset
297
4037
524856bd7b19 massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents: 3539
diff changeset
298 def dbus_message_encryption_stop(self, to_jid, profile_key):
524856bd7b19 massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents: 3539
diff changeset
299 return self._callback("message_encryption_stop", to_jid, profile_key)
3066
2cc2f65379f7 core: added imageCheck and imageResize methods:
Goffi <goffi@goffi.org>
parents: 3028
diff changeset
300
4037
524856bd7b19 massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents: 3539
diff changeset
301 def dbus_message_send(self, to_jid, message, subject={}, mess_type="auto", extra={}, profile_key="@NONE@"):
524856bd7b19 massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents: 3539
diff changeset
302 return self._callback("message_send", to_jid, message, subject, mess_type, extra, profile_key)
3259
f300d78f08f3 core: image convertion + SVG support:
Goffi <goffi@goffi.org>
parents: 3254
diff changeset
303
4037
524856bd7b19 massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents: 3539
diff changeset
304 def dbus_namespaces_get(self, ):
524856bd7b19 massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents: 3539
diff changeset
305 return self._callback("namespaces_get", )
3201
439e2f88c3a9 core, bridge: new `imageGeneratePreview` helped method to generate a thumbnail
Goffi <goffi@goffi.org>
parents: 3179
diff changeset
306
4037
524856bd7b19 massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents: 3539
diff changeset
307 def dbus_param_get_a(self, name, category, attribute="value", profile_key="@DEFAULT@"):
524856bd7b19 massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents: 3539
diff changeset
308 return self._callback("param_get_a", name, category, attribute, profile_key)
267
bdcd535e179e Bridge constructor:
Goffi <goffi@goffi.org>
parents: 266
diff changeset
309
4037
524856bd7b19 massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents: 3539
diff changeset
310 def dbus_param_get_a_async(self, name, category, attribute="value", security_limit=-1, profile_key="@DEFAULT@"):
524856bd7b19 massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents: 3539
diff changeset
311 return self._callback("param_get_a_async", name, category, attribute, security_limit, profile_key)
60
9764e027ecc0 SàT: multi-profile parameters, first draft
Goffi <goffi@goffi.org>
parents: 57
diff changeset
312
4037
524856bd7b19 massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents: 3539
diff changeset
313 def dbus_param_set(self, name, value, category, security_limit=-1, profile_key="@DEFAULT@"):
524856bd7b19 massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents: 3539
diff changeset
314 return self._callback("param_set", name, value, category, security_limit, profile_key)
1015
fee00f2e11c2 memory, jp: added jp commands to load/save parameters template
souliane <souliane@mailoo.org>
parents: 993
diff changeset
315
4037
524856bd7b19 massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents: 3539
diff changeset
316 def dbus_param_ui_get(self, security_limit=-1, app='', extra='', profile_key="@DEFAULT@"):
524856bd7b19 massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents: 3539
diff changeset
317 return self._callback("param_ui_get", security_limit, app, extra, profile_key)
2126
2f264f3df280 core (menus): improvments:
Goffi <goffi@goffi.org>
parents: 2113
diff changeset
318
4037
524856bd7b19 massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents: 3539
diff changeset
319 def dbus_params_categories_get(self, ):
524856bd7b19 massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents: 3539
diff changeset
320 return self._callback("params_categories_get", )
2126
2f264f3df280 core (menus): improvments:
Goffi <goffi@goffi.org>
parents: 2113
diff changeset
321
4037
524856bd7b19 massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents: 3539
diff changeset
322 def dbus_params_register_app(self, xml, security_limit=-1, app=''):
524856bd7b19 massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents: 3539
diff changeset
323 return self._callback("params_register_app", xml, security_limit, app)
2126
2f264f3df280 core (menus): improvments:
Goffi <goffi@goffi.org>
parents: 2113
diff changeset
324
4037
524856bd7b19 massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents: 3539
diff changeset
325 def dbus_params_template_load(self, filename):
524856bd7b19 massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents: 3539
diff changeset
326 return self._callback("params_template_load", filename)
2658
4e130cc9bfc0 core (memore/encryption): new methods and checks:
Goffi <goffi@goffi.org>
parents: 2655
diff changeset
327
4037
524856bd7b19 massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents: 3539
diff changeset
328 def dbus_params_template_save(self, filename):
524856bd7b19 massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents: 3539
diff changeset
329 return self._callback("params_template_save", filename)
2658
4e130cc9bfc0 core (memore/encryption): new methods and checks:
Goffi <goffi@goffi.org>
parents: 2655
diff changeset
330
4037
524856bd7b19 massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents: 3539
diff changeset
331 def dbus_params_values_from_category_get_async(self, category, security_limit=-1, app="", extra="", profile_key="@DEFAULT@"):
524856bd7b19 massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents: 3539
diff changeset
332 return self._callback("params_values_from_category_get_async", category, security_limit, app, extra, profile_key)
2646
712cb4ff3e13 core: new EncryptionHandler class which manage encrypted session as a core feature:
Goffi <goffi@goffi.org>
parents: 2628
diff changeset
333
4037
524856bd7b19 massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents: 3539
diff changeset
334 def dbus_presence_set(self, to_jid='', show='', statuses={}, profile_key="@DEFAULT@"):
524856bd7b19 massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents: 3539
diff changeset
335 return self._callback("presence_set", to_jid, show, statuses, profile_key)
2628
779351da2c13 core, frontends: replaced org\.goffi namespaces by org.salutatoi + fixed generation:
Goffi <goffi@goffi.org>
parents: 2624
diff changeset
336
4037
524856bd7b19 massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents: 3539
diff changeset
337 def dbus_presence_statuses_get(self, profile_key="@DEFAULT@"):
524856bd7b19 massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents: 3539
diff changeset
338 return self._callback("presence_statuses_get", profile_key)
2443
81a45e7886c9 core: added a mechanism to associate short names to namespaces:
Goffi <goffi@goffi.org>
parents: 2414
diff changeset
339
4037
524856bd7b19 massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents: 3539
diff changeset
340 def dbus_private_data_delete(self, namespace, key, arg_2):
524856bd7b19 massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents: 3539
diff changeset
341 return self._callback("private_data_delete", namespace, key, arg_2)
777
5642939d254e core, bridge: new method paramsRegisterApp to register frontend's specific parameters
souliane <souliane@mailoo.org>
parents: 773
diff changeset
342
4037
524856bd7b19 massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents: 3539
diff changeset
343 def dbus_private_data_get(self, namespace, key, profile_key):
524856bd7b19 massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents: 3539
diff changeset
344 return self._callback("private_data_get", 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
345
4037
524856bd7b19 massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents: 3539
diff changeset
346 def dbus_private_data_set(self, namespace, key, data, profile_key):
524856bd7b19 massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents: 3539
diff changeset
347 return self._callback("private_data_set", 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
348
4037
524856bd7b19 massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents: 3539
diff changeset
349 def dbus_profile_create(self, profile, password='', component=''):
524856bd7b19 massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents: 3539
diff changeset
350 return self._callback("profile_create", profile, password, component)
2144
1d3f73e065e1 core, jp: component handling + client handling refactoring:
Goffi <goffi@goffi.org>
parents: 2142
diff changeset
351
4037
524856bd7b19 massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents: 3539
diff changeset
352 def dbus_profile_delete_async(self, profile):
524856bd7b19 massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents: 3539
diff changeset
353 return self._callback("profile_delete_async", profile)
1592
d6d655238a93 bridge: new core method profileStartSession to start a session without connecting the profile
Goffi <goffi@goffi.org>
parents: 1587
diff changeset
354
4037
524856bd7b19 massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents: 3539
diff changeset
355 def dbus_profile_is_session_started(self, profile_key="@DEFAULT@"):
524856bd7b19 massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents: 3539
diff changeset
356 return self._callback("profile_is_session_started", profile_key)
2168
255830fdb80b core, bridge: renamed getProfileName to profileNameGet according to new conventions
Goffi <goffi@goffi.org>
parents: 2150
diff changeset
357
4037
524856bd7b19 massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents: 3539
diff changeset
358 def dbus_profile_name_get(self, profile_key="@DEFAULT@"):
524856bd7b19 massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents: 3539
diff changeset
359 return self._callback("profile_name_get", profile_key)
1595
a3d0cfa5b7a6 core, bridge: added a profileSetDefault method
Goffi <goffi@goffi.org>
parents: 1592
diff changeset
360
4037
524856bd7b19 massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents: 3539
diff changeset
361 def dbus_profile_set_default(self, profile):
524856bd7b19 massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents: 3539
diff changeset
362 return self._callback("profile_set_default", profile)
1592
d6d655238a93 bridge: new core method profileStartSession to start a session without connecting the profile
Goffi <goffi@goffi.org>
parents: 1587
diff changeset
363
4037
524856bd7b19 massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents: 3539
diff changeset
364 def dbus_profile_start_session(self, password='', profile_key="@DEFAULT@"):
524856bd7b19 massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents: 3539
diff changeset
365 return self._callback("profile_start_session", password, profile_key)
2146
1bb9bf1b4150 core, frontends: getProfilesList renamed to profilesGetList + behaviour change:
Goffi <goffi@goffi.org>
parents: 2144
diff changeset
366
4037
524856bd7b19 massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents: 3539
diff changeset
367 def dbus_profiles_list_get(self, clients=True, components=False):
524856bd7b19 massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents: 3539
diff changeset
368 return self._callback("profiles_list_get", clients, components)
1626
63cef4dbf2a4 core, plugins file, XEP-0234, bridge: progression api enhancement:
Goffi <goffi@goffi.org>
parents: 1622
diff changeset
369
4037
524856bd7b19 massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents: 3539
diff changeset
370 def dbus_progress_get(self, id, profile):
524856bd7b19 massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents: 3539
diff changeset
371 return self._callback("progress_get", id, profile)
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: 2086
diff changeset
372
4037
524856bd7b19 massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents: 3539
diff changeset
373 def dbus_progress_get_all(self, profile):
524856bd7b19 massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents: 3539
diff changeset
374 return self._callback("progress_get_all", profile)
2628
779351da2c13 core, frontends: replaced org\.goffi namespaces by org.salutatoi + fixed generation:
Goffi <goffi@goffi.org>
parents: 2624
diff changeset
375
4037
524856bd7b19 massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents: 3539
diff changeset
376 def dbus_progress_get_all_metadata(self, profile):
524856bd7b19 massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents: 3539
diff changeset
377 return self._callback("progress_get_all_metadata", profile)
345
e6047415868d Bridge: added updateContact method
Goffi <goffi@goffi.org>
parents: 337
diff changeset
378
4037
524856bd7b19 massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents: 3539
diff changeset
379 def dbus_ready_get(self, ):
524856bd7b19 massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents: 3539
diff changeset
380 return self._callback("ready_get", )
7
c14a3a7018a5 added dynamic exportation of Dbus bridge method (usefull for plugins)
Goffi <goffi@goffi.org>
parents: 1
diff changeset
381
4037
524856bd7b19 massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents: 3539
diff changeset
382 def dbus_roster_resync(self, profile_key="@DEFAULT@"):
524856bd7b19 massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents: 3539
diff changeset
383 return self._callback("roster_resync", profile_key)
7
c14a3a7018a5 added dynamic exportation of Dbus bridge method (usefull for plugins)
Goffi <goffi@goffi.org>
parents: 1
diff changeset
384
4037
524856bd7b19 massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents: 3539
diff changeset
385 def dbus_session_infos_get(self, profile_key):
524856bd7b19 massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents: 3539
diff changeset
386 return self._callback("session_infos_get", profile_key)
7
c14a3a7018a5 added dynamic exportation of Dbus bridge method (usefull for plugins)
Goffi <goffi@goffi.org>
parents: 1
diff changeset
387
4037
524856bd7b19 massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents: 3539
diff changeset
388 def dbus_sub_waiting_get(self, profile_key="@DEFAULT@"):
524856bd7b19 massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents: 3539
diff changeset
389 return self._callback("sub_waiting_get", profile_key)
468
c97640c90a94 D-Bus Bridge: use inspection to name attribute + fix asynchronous calls for dynamically added method, it now use deferred return value instead of callback/errback attributes
Goffi <goffi@goffi.org>
parents: 459
diff changeset
390
3539
60d3861e5996 bridge (dbus): use Tx DBus for backend part of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3480
diff changeset
391 def dbus_subscription(self, sub_type, entity, profile_key="@DEFAULT@"):
60d3861e5996 bridge (dbus): use Tx DBus for backend part of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3480
diff changeset
392 return self._callback("subscription", sub_type, entity, profile_key)
587
952322b1d490 Remove trailing whitespaces.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents: 572
diff changeset
393
4037
524856bd7b19 massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents: 3539
diff changeset
394 def dbus_version_get(self, ):
524856bd7b19 massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents: 3539
diff changeset
395 return self._callback("version_get", )
595
1f160467f5de Fix pep8 support in src/bridge.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents: 587
diff changeset
396
7
c14a3a7018a5 added dynamic exportation of Dbus bridge method (usefull for plugins)
Goffi <goffi@goffi.org>
parents: 1
diff changeset
397
4037
524856bd7b19 massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents: 3539
diff changeset
398 class bridge:
3539
60d3861e5996 bridge (dbus): use Tx DBus for backend part of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3480
diff changeset
399
0
goffi@necton2
parents:
diff changeset
400 def __init__(self):
993
301b342c697a core: use of the new core.log module:
Goffi <goffi@goffi.org>
parents: 963
diff changeset
401 log.info("Init DBus...")
3539
60d3861e5996 bridge (dbus): use Tx DBus for backend part of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3480
diff changeset
402 self._obj = DBusObject(const_OBJ_PATH)
60d3861e5996 bridge (dbus): use Tx DBus for backend part of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3480
diff changeset
403
4037
524856bd7b19 massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents: 3539
diff changeset
404 async def post_init(self):
627
d207c2186519 core, bridge, jp, quick_frontend: SàT stop more gracefully if bridge can't be initialised:
Goffi <goffi@goffi.org>
parents: 609
diff changeset
405 try:
3539
60d3861e5996 bridge (dbus): use Tx DBus for backend part of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3480
diff changeset
406 conn = await client.connect(reactor)
60d3861e5996 bridge (dbus): use Tx DBus for backend part of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3480
diff changeset
407 except error.DBusException as e:
60d3861e5996 bridge (dbus): use Tx DBus for backend part of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3480
diff changeset
408 if e.errName == "org.freedesktop.DBus.Error.NotSupported":
2624
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2595
diff changeset
409 log.error(
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2595
diff changeset
410 _(
3539
60d3861e5996 bridge (dbus): use Tx DBus for backend part of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3480
diff changeset
411 "D-Bus is not launched, please see README to see instructions on "
60d3861e5996 bridge (dbus): use Tx DBus for backend part of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3480
diff changeset
412 "how to launch it"
2624
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2595
diff changeset
413 )
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2595
diff changeset
414 )
3539
60d3861e5996 bridge (dbus): use Tx DBus for backend part of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3480
diff changeset
415 raise BridgeInitError(str(e))
60d3861e5996 bridge (dbus): use Tx DBus for backend part of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3480
diff changeset
416
60d3861e5996 bridge (dbus): use Tx DBus for backend part of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3480
diff changeset
417 conn.exportObject(self._obj)
60d3861e5996 bridge (dbus): use Tx DBus for backend part of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3480
diff changeset
418 await conn.requestBusName(const_INT_PREFIX)
0
goffi@necton2
parents:
diff changeset
419
2854
eb9fa72eb62b core: added a "_debug" signal:
Goffi <goffi@goffi.org>
parents: 2771
diff changeset
420 def _debug(self, action, params, profile):
3539
60d3861e5996 bridge (dbus): use Tx DBus for backend part of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3480
diff changeset
421 self._obj.emitSignal("_debug", action, params, profile)
2854
eb9fa72eb62b core: added a "_debug" signal:
Goffi <goffi@goffi.org>
parents: 2771
diff changeset
422
4037
524856bd7b19 massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents: 3539
diff changeset
423 def action_new(self, action_data, id, security_limit, profile):
524856bd7b19 massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents: 3539
diff changeset
424 self._obj.emitSignal("action_new", action_data, id, security_limit, profile)
1467
ceba6fd77739 core, bridge: new signal actionNew to launch an action from the backend (e.g. display a dialog message):
Goffi <goffi@goffi.org>
parents: 1435
diff changeset
425
2894
c7c52c0dc13a core, quick_frontend(app): fixed connected signal handling
Goffi <goffi@goffi.org>
parents: 2892
diff changeset
426 def connected(self, jid_s, profile):
3539
60d3861e5996 bridge (dbus): use Tx DBus for backend part of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3480
diff changeset
427 self._obj.emitSignal("connected", jid_s, profile)
267
bdcd535e179e Bridge constructor:
Goffi <goffi@goffi.org>
parents: 266
diff changeset
428
4037
524856bd7b19 massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents: 3539
diff changeset
429 def contact_deleted(self, entity_jid, profile):
524856bd7b19 massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents: 3539
diff changeset
430 self._obj.emitSignal("contact_deleted", entity_jid, profile)
524856bd7b19 massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents: 3539
diff changeset
431
524856bd7b19 massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents: 3539
diff changeset
432 def contact_new(self, contact_jid, attributes, groups, profile):
524856bd7b19 massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents: 3539
diff changeset
433 self._obj.emitSignal("contact_new", contact_jid, attributes, groups, profile)
267
bdcd535e179e Bridge constructor:
Goffi <goffi@goffi.org>
parents: 266
diff changeset
434
66
8147b4f40809 SàT: multi-profile: DBus signals and frontend adaptation (first draft)
Goffi <goffi@goffi.org>
parents: 65
diff changeset
435 def disconnected(self, profile):
3539
60d3861e5996 bridge (dbus): use Tx DBus for backend part of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3480
diff changeset
436 self._obj.emitSignal("disconnected", profile)
267
bdcd535e179e Bridge constructor:
Goffi <goffi@goffi.org>
parents: 266
diff changeset
437
4037
524856bd7b19 massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents: 3539
diff changeset
438 def entity_data_updated(self, jid, name, value, profile):
524856bd7b19 massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents: 3539
diff changeset
439 self._obj.emitSignal("entity_data_updated", jid, name, value, profile)
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
440
4037
524856bd7b19 massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents: 3539
diff changeset
441 def message_encryption_started(self, to_jid, encryption_data, profile_key):
524856bd7b19 massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents: 3539
diff changeset
442 self._obj.emitSignal("message_encryption_started", to_jid, encryption_data, profile_key)
2655
b8600f8130ac core (bridge): new messageEncryptionStarted and messageEncryptionStopped signals (not used yet)
Goffi <goffi@goffi.org>
parents: 2646
diff changeset
443
4037
524856bd7b19 massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents: 3539
diff changeset
444 def message_encryption_stopped(self, to_jid, encryption_data, profile_key):
524856bd7b19 massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents: 3539
diff changeset
445 self._obj.emitSignal("message_encryption_stopped", to_jid, encryption_data, profile_key)
2655
b8600f8130ac core (bridge): new messageEncryptionStarted and messageEncryptionStopped signals (not used yet)
Goffi <goffi@goffi.org>
parents: 2646
diff changeset
446
4037
524856bd7b19 massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents: 3539
diff changeset
447 def message_new(self, uid, timestamp, from_jid, to_jid, message, subject, mess_type, extra, profile):
524856bd7b19 massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents: 3539
diff changeset
448 self._obj.emitSignal("message_new", uid, timestamp, from_jid, to_jid, message, subject, mess_type, extra, profile)
0
goffi@necton2
parents:
diff changeset
449
4037
524856bd7b19 massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents: 3539
diff changeset
450 def param_update(self, name, value, category, profile):
524856bd7b19 massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents: 3539
diff changeset
451 self._obj.emitSignal("param_update", name, value, category, profile)
267
bdcd535e179e Bridge constructor:
Goffi <goffi@goffi.org>
parents: 266
diff changeset
452
4037
524856bd7b19 massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents: 3539
diff changeset
453 def presence_update(self, entity_jid, show, priority, statuses, profile):
524856bd7b19 massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents: 3539
diff changeset
454 self._obj.emitSignal("presence_update", entity_jid, show, priority, statuses, profile)
49
9c79eb49d51f DBus bridge improvment:
Goffi <goffi@goffi.org>
parents: 37
diff changeset
455
4037
524856bd7b19 massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents: 3539
diff changeset
456 def progress_error(self, id, error, profile):
524856bd7b19 massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents: 3539
diff changeset
457 self._obj.emitSignal("progress_error", id, error, profile)
1522
7d7e57a84792 core: progression handling improvments:
Goffi <goffi@goffi.org>
parents: 1482
diff changeset
458
4037
524856bd7b19 massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents: 3539
diff changeset
459 def progress_finished(self, id, metadata, profile):
524856bd7b19 massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents: 3539
diff changeset
460 self._obj.emitSignal("progress_finished", id, metadata, profile)
1522
7d7e57a84792 core: progression handling improvments:
Goffi <goffi@goffi.org>
parents: 1482
diff changeset
461
4037
524856bd7b19 massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents: 3539
diff changeset
462 def progress_started(self, id, metadata, profile):
524856bd7b19 massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents: 3539
diff changeset
463 self._obj.emitSignal("progress_started", id, metadata, profile)
1522
7d7e57a84792 core: progression handling improvments:
Goffi <goffi@goffi.org>
parents: 1482
diff changeset
464
387
e66d300c5d42 frontends, bridge: sendFile method signature change + jid parameters in bridge now use _jid suffix
Goffi <goffi@goffi.org>
parents: 371
diff changeset
465 def subscribe(self, sub_type, entity_jid, profile):
3539
60d3861e5996 bridge (dbus): use Tx DBus for backend part of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3480
diff changeset
466 self._obj.emitSignal("subscribe", sub_type, entity_jid, profile)
0
goffi@necton2
parents:
diff changeset
467
2086
4633cfcbcccb bridge (D-Bus): bad design fixes:
Goffi <goffi@goffi.org>
parents: 2085
diff changeset
468 def register_method(self, name, callback):
3539
60d3861e5996 bridge (dbus): use Tx DBus for backend part of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3480
diff changeset
469 log.debug(f"registering DBus bridge method [{name}]")
60d3861e5996 bridge (dbus): use Tx DBus for backend part of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3480
diff changeset
470 self._obj.register_method(name, callback)
60d3861e5996 bridge (dbus): use Tx DBus for backend part of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3480
diff changeset
471
4037
524856bd7b19 massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents: 3539
diff changeset
472 def emit_signal(self, name, *args):
3539
60d3861e5996 bridge (dbus): use Tx DBus for backend part of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3480
diff changeset
473 self._obj.emitSignal(name, *args)
0
goffi@necton2
parents:
diff changeset
474
4037
524856bd7b19 massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents: 3539
diff changeset
475 def add_method(
3539
60d3861e5996 bridge (dbus): use Tx DBus for backend part of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3480
diff changeset
476 self, name, int_suffix, in_sign, out_sign, method, async_=False, doc={}
60d3861e5996 bridge (dbus): use Tx DBus for backend part of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3480
diff changeset
477 ):
4037
524856bd7b19 massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents: 3539
diff changeset
478 """Dynamically add a method to D-Bus bridge"""
2624
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2595
diff changeset
479 # FIXME: doc parameter is kept only temporary, the time to remove it from calls
3539
60d3861e5996 bridge (dbus): use Tx DBus for backend part of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3480
diff changeset
480 log.debug(f"Adding method {name!r} to D-Bus bridge")
60d3861e5996 bridge (dbus): use Tx DBus for backend part of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3480
diff changeset
481 self._obj.plugin_iface.addMethod(
60d3861e5996 bridge (dbus): use Tx DBus for backend part of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3480
diff changeset
482 Method(name, arguments=in_sign, returns=out_sign)
60d3861e5996 bridge (dbus): use Tx DBus for backend part of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3480
diff changeset
483 )
60d3861e5996 bridge (dbus): use Tx DBus for backend part of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3480
diff changeset
484 # we have to create a method here instead of using partialmethod, because txdbus
60d3861e5996 bridge (dbus): use Tx DBus for backend part of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3480
diff changeset
485 # uses __func__ which doesn't work with partialmethod
60d3861e5996 bridge (dbus): use Tx DBus for backend part of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3480
diff changeset
486 def caller(self_, *args, **kwargs):
60d3861e5996 bridge (dbus): use Tx DBus for backend part of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3480
diff changeset
487 return self_._callback(name, *args, **kwargs)
60d3861e5996 bridge (dbus): use Tx DBus for backend part of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3480
diff changeset
488 setattr(self._obj, f"dbus_{name}", MethodType(caller, self._obj))
2086
4633cfcbcccb bridge (D-Bus): bad design fixes:
Goffi <goffi@goffi.org>
parents: 2085
diff changeset
489 self.register_method(name, method)
7
c14a3a7018a5 added dynamic exportation of Dbus bridge method (usefull for plugins)
Goffi <goffi@goffi.org>
parents: 1
diff changeset
490
4037
524856bd7b19 massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents: 3539
diff changeset
491 def add_signal(self, name, int_suffix, signature, doc={}):
524856bd7b19 massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents: 3539
diff changeset
492 """Dynamically add a signal to D-Bus bridge"""
3539
60d3861e5996 bridge (dbus): use Tx DBus for backend part of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3480
diff changeset
493 log.debug(f"Adding signal {name!r} to D-Bus bridge")
60d3861e5996 bridge (dbus): use Tx DBus for backend part of D-Bus bridge:
Goffi <goffi@goffi.org>
parents: 3480
diff changeset
494 self._obj.plugin_iface.addSignal(Signal(name, signature))
4037
524856bd7b19 massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents: 3539
diff changeset
495 setattr(bridge, name, partialmethod(bridge.emit_signal, name))