Mercurial > libervia-backend
annotate src/bridge/DBus.py @ 1612:48f324352c52
primitivus: fixed showDialog and XMLUI message dialog
author | Goffi <goffi@goffi.org> |
---|---|
date | Tue, 17 Nov 2015 12:28:45 +0100 |
parents | e2ed8009e66e |
children | 5b24d6bf5d15 |
rev | line source |
---|---|
0 | 1 #!/usr/bin/python |
2 #-*- coding: utf-8 -*- | |
3 | |
609
84a6e83157c2
fixed licences in docstrings (they are now in comments)
Goffi <goffi@goffi.org>
parents:
595
diff
changeset
|
4 # SAT: a jabber client |
1396 | 5 # Copyright (C) 2009, 2010, 2011, 2012, 2013, 2014, 2015 Jérôme Poisson (goffi@goffi.org) |
0 | 6 |
609
84a6e83157c2
fixed licences in docstrings (they are now in comments)
Goffi <goffi@goffi.org>
parents:
595
diff
changeset
|
7 # This program is free software: you can redistribute it and/or modify |
84a6e83157c2
fixed licences in docstrings (they are now in comments)
Goffi <goffi@goffi.org>
parents:
595
diff
changeset
|
8 # it under the terms of the GNU Affero General Public License as published by |
84a6e83157c2
fixed licences in docstrings (they are now in comments)
Goffi <goffi@goffi.org>
parents:
595
diff
changeset
|
9 # the Free Software Foundation, either version 3 of the License, or |
84a6e83157c2
fixed licences in docstrings (they are now in comments)
Goffi <goffi@goffi.org>
parents:
595
diff
changeset
|
10 # (at your option) any later version. |
0 | 11 |
609
84a6e83157c2
fixed licences in docstrings (they are now in comments)
Goffi <goffi@goffi.org>
parents:
595
diff
changeset
|
12 # This program is distributed in the hope that it will be useful, |
84a6e83157c2
fixed licences in docstrings (they are now in comments)
Goffi <goffi@goffi.org>
parents:
595
diff
changeset
|
13 # but WITHOUT ANY WARRANTY; without even the implied warranty of |
84a6e83157c2
fixed licences in docstrings (they are now in comments)
Goffi <goffi@goffi.org>
parents:
595
diff
changeset
|
14 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
84a6e83157c2
fixed licences in docstrings (they are now in comments)
Goffi <goffi@goffi.org>
parents:
595
diff
changeset
|
15 # GNU Affero General Public License for more details. |
0 | 16 |
609
84a6e83157c2
fixed licences in docstrings (they are now in comments)
Goffi <goffi@goffi.org>
parents:
595
diff
changeset
|
17 # You should have received a copy of the GNU Affero General Public License |
84a6e83157c2
fixed licences in docstrings (they are now in comments)
Goffi <goffi@goffi.org>
parents:
595
diff
changeset
|
18 # along with this program. If not, see <http://www.gnu.org/licenses/>. |
0 | 19 |
993
301b342c697a
core: use of the new core.log module:
Goffi <goffi@goffi.org>
parents:
963
diff
changeset
|
20 from sat.core.i18n import _ |
0 | 21 from bridge import Bridge |
22 import dbus | |
23 import dbus.service | |
24 import dbus.mainloop.glib | |
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
|
25 import inspect |
993
301b342c697a
core: use of the new core.log module:
Goffi <goffi@goffi.org>
parents:
963
diff
changeset
|
26 from sat.core.log import getLogger |
301b342c697a
core: use of the new core.log module:
Goffi <goffi@goffi.org>
parents:
963
diff
changeset
|
27 log = getLogger(__name__) |
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
|
28 from twisted.internet.defer import Deferred |
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
|
29 from sat.core.exceptions import BridgeInitError |
0 | 30 |
595
1f160467f5de
Fix pep8 support in src/bridge.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
587
diff
changeset
|
31 const_INT_PREFIX = "org.goffi.SAT" # Interface prefix |
1f160467f5de
Fix pep8 support in src/bridge.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
587
diff
changeset
|
32 const_ERROR_PREFIX = const_INT_PREFIX + ".error" |
360 | 33 const_OBJ_PATH = '/org/goffi/SAT/bridge' |
371
3ea41a199b36
bridge refactoring: categories are now core and plugin instead of communication and request
Goffi <goffi@goffi.org>
parents:
365
diff
changeset
|
34 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
|
35 const_PLUGIN_SUFFIX = ".plugin" |
7
c14a3a7018a5
added dynamic exportation of Dbus bridge method (usefull for plugins)
Goffi <goffi@goffi.org>
parents:
1
diff
changeset
|
36 |
595
1f160467f5de
Fix pep8 support in src/bridge.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
587
diff
changeset
|
37 |
477
031b0e0aaab8
plugin groupblog: subscriptions/notifications
Goffi <goffi@goffi.org>
parents:
469
diff
changeset
|
38 class ParseError(Exception): |
031b0e0aaab8
plugin groupblog: subscriptions/notifications
Goffi <goffi@goffi.org>
parents:
469
diff
changeset
|
39 pass |
031b0e0aaab8
plugin groupblog: subscriptions/notifications
Goffi <goffi@goffi.org>
parents:
469
diff
changeset
|
40 |
595
1f160467f5de
Fix pep8 support in src/bridge.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
587
diff
changeset
|
41 |
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
|
42 class MethodNotRegistered(dbus.DBusException): |
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
|
43 _dbus_error_name = const_ERROR_PREFIX + ".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
|
44 |
595
1f160467f5de
Fix pep8 support in src/bridge.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
587
diff
changeset
|
45 |
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
|
46 class InternalError(dbus.DBusException): |
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
|
47 _dbus_error_name = const_ERROR_PREFIX + ".InternalError" |
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
|
48 |
595
1f160467f5de
Fix pep8 support in src/bridge.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
587
diff
changeset
|
49 |
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 class AsyncNotDeferred(dbus.DBusException): |
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
|
51 _dbus_error_name = const_ERROR_PREFIX + ".AsyncNotDeferred" |
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
|
52 |
595
1f160467f5de
Fix pep8 support in src/bridge.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
587
diff
changeset
|
53 |
424
72c13313b6d6
bridge: added check that synchronous method does not return a deferred
Goffi <goffi@goffi.org>
parents:
423
diff
changeset
|
54 class DeferredNotAsync(dbus.DBusException): |
72c13313b6d6
bridge: added check that synchronous method does not return a deferred
Goffi <goffi@goffi.org>
parents:
423
diff
changeset
|
55 _dbus_error_name = const_ERROR_PREFIX + ".DeferredNotAsync" |
72c13313b6d6
bridge: added check that synchronous method does not return a deferred
Goffi <goffi@goffi.org>
parents:
423
diff
changeset
|
56 |
595
1f160467f5de
Fix pep8 support in src/bridge.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
587
diff
changeset
|
57 |
419
6c167a2e04b8
bridge: added generic D-Bus exception management + asyncCreateProfile method
Goffi <goffi@goffi.org>
parents:
413
diff
changeset
|
58 class GenericException(dbus.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
|
59 def __init__(self, twisted_error): |
1073
f094583732de
bridge: DBusException also transports the twisted failure condition
souliane <souliane@mailoo.org>
parents:
1062
diff
changeset
|
60 """ |
f094583732de
bridge: DBusException also transports the twisted failure condition
souliane <souliane@mailoo.org>
parents:
1062
diff
changeset
|
61 |
f094583732de
bridge: DBusException also transports the twisted failure condition
souliane <souliane@mailoo.org>
parents:
1062
diff
changeset
|
62 @param twisted_error (Failure): instance of twisted Failure |
f094583732de
bridge: DBusException also transports the twisted failure condition
souliane <souliane@mailoo.org>
parents:
1062
diff
changeset
|
63 @return: DBusException |
f094583732de
bridge: DBusException also transports the twisted failure condition
souliane <souliane@mailoo.org>
parents:
1062
diff
changeset
|
64 """ |
595
1f160467f5de
Fix pep8 support in src/bridge.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
587
diff
changeset
|
65 super(GenericException, self).__init__() |
751
1def5b7edf9f
core, bridge: better GenericException handling
Goffi <goffi@goffi.org>
parents:
698
diff
changeset
|
66 try: |
1def5b7edf9f
core, bridge: better GenericException handling
Goffi <goffi@goffi.org>
parents:
698
diff
changeset
|
67 # 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
|
68 class_ = twisted_error.value().__class__ |
751
1def5b7edf9f
core, bridge: better GenericException handling
Goffi <goffi@goffi.org>
parents:
698
diff
changeset
|
69 except TypeError: |
1def5b7edf9f
core, bridge: better GenericException handling
Goffi <goffi@goffi.org>
parents:
698
diff
changeset
|
70 # 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
|
71 class_ = twisted_error.value.__class__ |
1073
f094583732de
bridge: DBusException also transports the twisted failure condition
souliane <souliane@mailoo.org>
parents:
1062
diff
changeset
|
72 message = twisted_error.getErrorMessage() |
f094583732de
bridge: DBusException also transports the twisted failure condition
souliane <souliane@mailoo.org>
parents:
1062
diff
changeset
|
73 try: |
f094583732de
bridge: DBusException also transports the twisted failure condition
souliane <souliane@mailoo.org>
parents:
1062
diff
changeset
|
74 self.args = (message, twisted_error.value.condition) |
f094583732de
bridge: DBusException also transports the twisted failure condition
souliane <souliane@mailoo.org>
parents:
1062
diff
changeset
|
75 except AttributeError: |
f094583732de
bridge: DBusException also transports the twisted failure condition
souliane <souliane@mailoo.org>
parents:
1062
diff
changeset
|
76 self.args = (message,) |
1062
95758ef3faa8
bridge: async failures are more detailed (full class name + error message)
souliane <souliane@mailoo.org>
parents:
1060
diff
changeset
|
77 self._dbus_error_name = '.'.join([const_ERROR_PREFIX, class_.__module__, class_.__name__]) |
595
1f160467f5de
Fix pep8 support in src/bridge.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
587
diff
changeset
|
78 |
419
6c167a2e04b8
bridge: added generic D-Bus exception management + asyncCreateProfile method
Goffi <goffi@goffi.org>
parents:
413
diff
changeset
|
79 |
0 | 80 class DbusObject(dbus.service.Object): |
81 | |
82 def __init__(self, bus, path): | |
83 dbus.service.Object.__init__(self, bus, path) | |
993
301b342c697a
core: use of the new core.log module:
Goffi <goffi@goffi.org>
parents:
963
diff
changeset
|
84 log.debug("Init DbusObject...") |
595
1f160467f5de
Fix pep8 support in src/bridge.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
587
diff
changeset
|
85 self.cb = {} |
0 | 86 |
87 def register(self, name, cb): | |
595
1f160467f5de
Fix pep8 support in src/bridge.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
587
diff
changeset
|
88 self.cb[name] = cb |
0 | 89 |
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
|
90 def _callback(self, name, *args, **kwargs): |
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
|
91 """call the callback if it exists, raise an exception else |
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
|
92 if the callback return a deferred, use async methods""" |
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
|
93 if not name in self.cb: |
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
|
94 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
|
95 |
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
|
96 if "callback" in kwargs: |
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
|
97 #we must have errback too |
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
|
98 if not "errback" in kwargs: |
993
301b342c697a
core: use of the new core.log module:
Goffi <goffi@goffi.org>
parents:
963
diff
changeset
|
99 log.error("errback is missing in method call [%s]" % name) |
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
|
100 raise InternalError |
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
|
101 callback = kwargs.pop("callback") |
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
|
102 errback = kwargs.pop("errback") |
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
|
103 async = True |
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
|
104 else: |
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
|
105 async = False |
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
|
106 result = self.cb[name](*args, **kwargs) |
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
|
107 if async: |
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
|
108 if not isinstance(result, Deferred): |
993
301b342c697a
core: use of the new core.log module:
Goffi <goffi@goffi.org>
parents:
963
diff
changeset
|
109 log.error("Asynchronous method [%s] does not return a Deferred." % name) |
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
|
110 raise AsyncNotDeferred |
595
1f160467f5de
Fix pep8 support in src/bridge.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
587
diff
changeset
|
111 result.addCallback(lambda result: callback() if result is None else callback(result)) |
1f160467f5de
Fix pep8 support in src/bridge.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
587
diff
changeset
|
112 result.addErrback(lambda err: errback(GenericException(err))) |
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
|
113 else: |
424
72c13313b6d6
bridge: added check that synchronous method does not return a deferred
Goffi <goffi@goffi.org>
parents:
423
diff
changeset
|
114 if isinstance(result, Deferred): |
993
301b342c697a
core: use of the new core.log module:
Goffi <goffi@goffi.org>
parents:
963
diff
changeset
|
115 log.error("Synchronous method [%s] return a Deferred." % name) |
424
72c13313b6d6
bridge: added check that synchronous method does not return a deferred
Goffi <goffi@goffi.org>
parents:
423
diff
changeset
|
116 raise DeferredNotAsync |
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
|
117 return result |
587
952322b1d490
Remove trailing whitespaces.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
572
diff
changeset
|
118 ### signals ### |
0 | 119 |
595
1f160467f5de
Fix pep8 support in src/bridge.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
587
diff
changeset
|
120 @dbus.service.signal(const_INT_PREFIX + const_PLUGIN_SUFFIX, |
371
3ea41a199b36
bridge refactoring: categories are now core and plugin instead of communication and request
Goffi <goffi@goffi.org>
parents:
365
diff
changeset
|
121 signature='') |
3ea41a199b36
bridge refactoring: categories are now core and plugin instead of communication and request
Goffi <goffi@goffi.org>
parents:
365
diff
changeset
|
122 def dummySignal(self): |
3ea41a199b36
bridge refactoring: categories are now core and plugin instead of communication and request
Goffi <goffi@goffi.org>
parents:
365
diff
changeset
|
123 #FIXME: workaround for addSignal (doesn't work if one method doensn't |
3ea41a199b36
bridge refactoring: categories are now core and plugin instead of communication and request
Goffi <goffi@goffi.org>
parents:
365
diff
changeset
|
124 # already exist for plugins), probably missing some initialisation, need |
3ea41a199b36
bridge refactoring: categories are now core and plugin instead of communication and request
Goffi <goffi@goffi.org>
parents:
365
diff
changeset
|
125 # further investigations |
3ea41a199b36
bridge refactoring: categories are now core and plugin instead of communication and request
Goffi <goffi@goffi.org>
parents:
365
diff
changeset
|
126 pass |
3ea41a199b36
bridge refactoring: categories are now core and plugin instead of communication and request
Goffi <goffi@goffi.org>
parents:
365
diff
changeset
|
127 |
3ea41a199b36
bridge refactoring: categories are now core and plugin instead of communication and request
Goffi <goffi@goffi.org>
parents:
365
diff
changeset
|
128 @dbus.service.signal(const_INT_PREFIX+const_CORE_SUFFIX, |
1599
e2ed8009e66e
backend, bridge, frontends: actionNew has now a security_limit argument + added some docstring to explain data argument
Goffi <goffi@goffi.org>
parents:
1595
diff
changeset
|
129 signature='a{ss}sis') |
e2ed8009e66e
backend, bridge, frontends: actionNew has now a security_limit argument + added some docstring to explain data argument
Goffi <goffi@goffi.org>
parents:
1595
diff
changeset
|
130 def actionNew(self, 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
|
131 pass |
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
|
132 |
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
|
133 @dbus.service.signal(const_INT_PREFIX+const_CORE_SUFFIX, |
538
2c4016921403
core, frontends, bridgen plugins: fixed methods which were unproperly managing multi-profiles
Goffi <goffi@goffi.org>
parents:
513
diff
changeset
|
134 signature='ssa{ss}s') |
2c4016921403
core, frontends, bridgen plugins: fixed methods which were unproperly managing multi-profiles
Goffi <goffi@goffi.org>
parents:
513
diff
changeset
|
135 def actionResult(self, answer_type, id, data, profile): |
336
953536246d9d
core: added email in registerNewAccount
Goffi <goffi@goffi.org>
parents:
300
diff
changeset
|
136 pass |
267 | 137 |
371
3ea41a199b36
bridge refactoring: categories are now core and plugin instead of communication and request
Goffi <goffi@goffi.org>
parents:
365
diff
changeset
|
138 @dbus.service.signal(const_INT_PREFIX+const_CORE_SUFFIX, |
538
2c4016921403
core, frontends, bridgen plugins: fixed methods which were unproperly managing multi-profiles
Goffi <goffi@goffi.org>
parents:
513
diff
changeset
|
139 signature='ssa{sa{ss}}s') |
2c4016921403
core, frontends, bridgen plugins: fixed methods which were unproperly managing multi-profiles
Goffi <goffi@goffi.org>
parents:
513
diff
changeset
|
140 def actionResultExt(self, answer_type, id, data, profile): |
336
953536246d9d
core: added email in registerNewAccount
Goffi <goffi@goffi.org>
parents:
300
diff
changeset
|
141 pass |
267 | 142 |
371
3ea41a199b36
bridge refactoring: categories are now core and plugin instead of communication and request
Goffi <goffi@goffi.org>
parents:
365
diff
changeset
|
143 @dbus.service.signal(const_INT_PREFIX+const_CORE_SUFFIX, |
538
2c4016921403
core, frontends, bridgen plugins: fixed methods which were unproperly managing multi-profiles
Goffi <goffi@goffi.org>
parents:
513
diff
changeset
|
144 signature='ssa{ss}s') |
541
8b116fa42a31
core, bridge: waiting confirmation management (new getWaitingConf method)
Goffi <goffi@goffi.org>
parents:
538
diff
changeset
|
145 def askConfirmation(self, id, conf_type, data, profile): |
336
953536246d9d
core: added email in registerNewAccount
Goffi <goffi@goffi.org>
parents:
300
diff
changeset
|
146 pass |
267 | 147 |
371
3ea41a199b36
bridge refactoring: categories are now core and plugin instead of communication and request
Goffi <goffi@goffi.org>
parents:
365
diff
changeset
|
148 @dbus.service.signal(const_INT_PREFIX+const_CORE_SUFFIX, |
1435
7590bbf44eed
bridge, quick_frontend: the JID that is assigned by the server can differ from the one we asked for (resource)
souliane <souliane@mailoo.org>
parents:
1414
diff
changeset
|
149 signature='ss') |
7590bbf44eed
bridge, quick_frontend: the JID that is assigned by the server can differ from the one we asked for (resource)
souliane <souliane@mailoo.org>
parents:
1414
diff
changeset
|
150 def connected(self, profile, jid_s): |
336
953536246d9d
core: added email in registerNewAccount
Goffi <goffi@goffi.org>
parents:
300
diff
changeset
|
151 pass |
267 | 152 |
371
3ea41a199b36
bridge refactoring: categories are now core and plugin instead of communication and request
Goffi <goffi@goffi.org>
parents:
365
diff
changeset
|
153 @dbus.service.signal(const_INT_PREFIX+const_CORE_SUFFIX, |
262
af3d4f11fe43
Added management of connection error
Goffi <goffi@goffi.org>
parents:
260
diff
changeset
|
154 signature='ss') |
387
e66d300c5d42
frontends, bridge: sendFile method signature change + jid parameters in bridge now use _jid suffix
Goffi <goffi@goffi.org>
parents:
371
diff
changeset
|
155 def contactDeleted(self, entity_jid, profile): |
336
953536246d9d
core: added email in registerNewAccount
Goffi <goffi@goffi.org>
parents:
300
diff
changeset
|
156 pass |
267 | 157 |
371
3ea41a199b36
bridge refactoring: categories are now core and plugin instead of communication and request
Goffi <goffi@goffi.org>
parents:
365
diff
changeset
|
158 @dbus.service.signal(const_INT_PREFIX+const_CORE_SUFFIX, |
267 | 159 signature='s') |
160 def disconnected(self, profile): | |
336
953536246d9d
core: added email in registerNewAccount
Goffi <goffi@goffi.org>
parents:
300
diff
changeset
|
161 pass |
267 | 162 |
371
3ea41a199b36
bridge refactoring: categories are now core and plugin instead of communication and request
Goffi <goffi@goffi.org>
parents:
365
diff
changeset
|
163 @dbus.service.signal(const_INT_PREFIX+const_CORE_SUFFIX, |
267 | 164 signature='ssss') |
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
|
165 def entityDataUpdated(self, jid, name, value, profile): |
65ecbb473cbb
core, quick frontend, plugin xep-0054, bridge: use of memory's entities data for vcard:
Goffi <goffi@goffi.org>
parents:
501
diff
changeset
|
166 pass |
65ecbb473cbb
core, quick frontend, plugin xep-0054, bridge: use of memory's entities data for vcard:
Goffi <goffi@goffi.org>
parents:
501
diff
changeset
|
167 |
65ecbb473cbb
core, quick frontend, plugin xep-0054, bridge: use of memory's entities data for vcard:
Goffi <goffi@goffi.org>
parents:
501
diff
changeset
|
168 @dbus.service.signal(const_INT_PREFIX+const_CORE_SUFFIX, |
65ecbb473cbb
core, quick frontend, plugin xep-0054, bridge: use of memory's entities data for vcard:
Goffi <goffi@goffi.org>
parents:
501
diff
changeset
|
169 signature='ssss') |
267 | 170 def newAlert(self, message, title, alert_type, profile): |
336
953536246d9d
core: added email in registerNewAccount
Goffi <goffi@goffi.org>
parents:
300
diff
changeset
|
171 pass |
267 | 172 |
371
3ea41a199b36
bridge refactoring: categories are now core and plugin instead of communication and request
Goffi <goffi@goffi.org>
parents:
365
diff
changeset
|
173 @dbus.service.signal(const_INT_PREFIX+const_CORE_SUFFIX, |
267 | 174 signature='sa{ss}ass') |
387
e66d300c5d42
frontends, bridge: sendFile method signature change + jid parameters in bridge now use _jid suffix
Goffi <goffi@goffi.org>
parents:
371
diff
changeset
|
175 def newContact(self, contact_jid, attributes, groups, profile): |
336
953536246d9d
core: added email in registerNewAccount
Goffi <goffi@goffi.org>
parents:
300
diff
changeset
|
176 pass |
0 | 177 |
371
3ea41a199b36
bridge refactoring: categories are now core and plugin instead of communication and request
Goffi <goffi@goffi.org>
parents:
365
diff
changeset
|
178 @dbus.service.signal(const_INT_PREFIX+const_CORE_SUFFIX, |
513
8ee9113d307b
core, quick_frontend, primitivus, wixi, bridge: fixed delayed message timestamp:
Goffi <goffi@goffi.org>
parents:
512
diff
changeset
|
179 signature='ssssa{ss}s') |
8ee9113d307b
core, quick_frontend, primitivus, wixi, bridge: fixed delayed message timestamp:
Goffi <goffi@goffi.org>
parents:
512
diff
changeset
|
180 def newMessage(self, from_jid, message, mess_type, to_jid, extra, profile): |
336
953536246d9d
core: added email in registerNewAccount
Goffi <goffi@goffi.org>
parents:
300
diff
changeset
|
181 pass |
267 | 182 |
371
3ea41a199b36
bridge refactoring: categories are now core and plugin instead of communication and request
Goffi <goffi@goffi.org>
parents:
365
diff
changeset
|
183 @dbus.service.signal(const_INT_PREFIX+const_CORE_SUFFIX, |
267 | 184 signature='ssss') |
185 def paramUpdate(self, name, value, category, profile): | |
336
953536246d9d
core: added email in registerNewAccount
Goffi <goffi@goffi.org>
parents:
300
diff
changeset
|
186 pass |
0 | 187 |
371
3ea41a199b36
bridge refactoring: categories are now core and plugin instead of communication and request
Goffi <goffi@goffi.org>
parents:
365
diff
changeset
|
188 @dbus.service.signal(const_INT_PREFIX+const_CORE_SUFFIX, |
267 | 189 signature='ssia{ss}s') |
387
e66d300c5d42
frontends, bridge: sendFile method signature change + jid parameters in bridge now use _jid suffix
Goffi <goffi@goffi.org>
parents:
371
diff
changeset
|
190 def presenceUpdate(self, entity_jid, show, priority, statuses, profile): |
336
953536246d9d
core: added email in registerNewAccount
Goffi <goffi@goffi.org>
parents:
300
diff
changeset
|
191 pass |
267 | 192 |
371
3ea41a199b36
bridge refactoring: categories are now core and plugin instead of communication and request
Goffi <goffi@goffi.org>
parents:
365
diff
changeset
|
193 @dbus.service.signal(const_INT_PREFIX+const_CORE_SUFFIX, |
267 | 194 signature='sss') |
1522
7d7e57a84792
core: progression handling improvments:
Goffi <goffi@goffi.org>
parents:
1482
diff
changeset
|
195 def progressError(self, error, profile, arg_2): |
7d7e57a84792
core: progression handling improvments:
Goffi <goffi@goffi.org>
parents:
1482
diff
changeset
|
196 pass |
7d7e57a84792
core: progression handling improvments:
Goffi <goffi@goffi.org>
parents:
1482
diff
changeset
|
197 |
7d7e57a84792
core: progression handling improvments:
Goffi <goffi@goffi.org>
parents:
1482
diff
changeset
|
198 @dbus.service.signal(const_INT_PREFIX+const_CORE_SUFFIX, |
7d7e57a84792
core: progression handling improvments:
Goffi <goffi@goffi.org>
parents:
1482
diff
changeset
|
199 signature='ss') |
7d7e57a84792
core: progression handling improvments:
Goffi <goffi@goffi.org>
parents:
1482
diff
changeset
|
200 def progressFinished(self, id, profile): |
7d7e57a84792
core: progression handling improvments:
Goffi <goffi@goffi.org>
parents:
1482
diff
changeset
|
201 pass |
7d7e57a84792
core: progression handling improvments:
Goffi <goffi@goffi.org>
parents:
1482
diff
changeset
|
202 |
7d7e57a84792
core: progression handling improvments:
Goffi <goffi@goffi.org>
parents:
1482
diff
changeset
|
203 @dbus.service.signal(const_INT_PREFIX+const_CORE_SUFFIX, |
7d7e57a84792
core: progression handling improvments:
Goffi <goffi@goffi.org>
parents:
1482
diff
changeset
|
204 signature='ss') |
7d7e57a84792
core: progression handling improvments:
Goffi <goffi@goffi.org>
parents:
1482
diff
changeset
|
205 def progressStarted(self, id, profile): |
7d7e57a84792
core: progression handling improvments:
Goffi <goffi@goffi.org>
parents:
1482
diff
changeset
|
206 pass |
7d7e57a84792
core: progression handling improvments:
Goffi <goffi@goffi.org>
parents:
1482
diff
changeset
|
207 |
7d7e57a84792
core: progression handling improvments:
Goffi <goffi@goffi.org>
parents:
1482
diff
changeset
|
208 @dbus.service.signal(const_INT_PREFIX+const_CORE_SUFFIX, |
7d7e57a84792
core: progression handling improvments:
Goffi <goffi@goffi.org>
parents:
1482
diff
changeset
|
209 signature='sss') |
387
e66d300c5d42
frontends, bridge: sendFile method signature change + jid parameters in bridge now use _jid suffix
Goffi <goffi@goffi.org>
parents:
371
diff
changeset
|
210 def subscribe(self, sub_type, entity_jid, profile): |
336
953536246d9d
core: added email in registerNewAccount
Goffi <goffi@goffi.org>
parents:
300
diff
changeset
|
211 pass |
267 | 212 |
587
952322b1d490
Remove trailing whitespaces.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
572
diff
changeset
|
213 ### methods ### |
952322b1d490
Remove trailing whitespaces.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
572
diff
changeset
|
214 |
371
3ea41a199b36
bridge refactoring: categories are now core and plugin instead of communication and request
Goffi <goffi@goffi.org>
parents:
365
diff
changeset
|
215 @dbus.service.method(const_INT_PREFIX+const_CORE_SUFFIX, |
337
4402ac630712
bridge: async callback managed in bridge_constructor + misc
Goffi <goffi@goffi.org>
parents:
336
diff
changeset
|
216 in_signature='ss', out_signature='', |
4402ac630712
bridge: async callback managed in bridge_constructor + misc
Goffi <goffi@goffi.org>
parents:
336
diff
changeset
|
217 async_callbacks=None) |
387
e66d300c5d42
frontends, bridge: sendFile method signature change + jid parameters in bridge now use _jid suffix
Goffi <goffi@goffi.org>
parents:
371
diff
changeset
|
218 def addContact(self, entity_jid, profile_key="@DEFAULT@"): |
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
|
219 return self._callback("addContact", unicode(entity_jid), unicode(profile_key)) |
0 | 220 |
371
3ea41a199b36
bridge refactoring: categories are now core and plugin instead of communication and request
Goffi <goffi@goffi.org>
parents:
365
diff
changeset
|
221 @dbus.service.method(const_INT_PREFIX+const_CORE_SUFFIX, |
1030
15f43b54d697
core, memory, bridge: added profile password + password encryption:
souliane <souliane@mailoo.org>
parents:
1023
diff
changeset
|
222 in_signature='ss', out_signature='b', |
337
4402ac630712
bridge: async callback managed in bridge_constructor + misc
Goffi <goffi@goffi.org>
parents:
336
diff
changeset
|
223 async_callbacks=('callback', 'errback')) |
1030
15f43b54d697
core, memory, bridge: added profile password + password encryption:
souliane <souliane@mailoo.org>
parents:
1023
diff
changeset
|
224 def asyncConnect(self, profile_key="@DEFAULT@", password='', callback=None, errback=None): |
15f43b54d697
core, memory, bridge: added profile password + password encryption:
souliane <souliane@mailoo.org>
parents:
1023
diff
changeset
|
225 return self._callback("asyncConnect", unicode(profile_key), unicode(password), callback=callback, errback=errback) |
419
6c167a2e04b8
bridge: added generic D-Bus exception management + asyncCreateProfile method
Goffi <goffi@goffi.org>
parents:
413
diff
changeset
|
226 |
6c167a2e04b8
bridge: added generic D-Bus exception management + asyncCreateProfile method
Goffi <goffi@goffi.org>
parents:
413
diff
changeset
|
227 @dbus.service.method(const_INT_PREFIX+const_CORE_SUFFIX, |
1030
15f43b54d697
core, memory, bridge: added profile password + password encryption:
souliane <souliane@mailoo.org>
parents:
1023
diff
changeset
|
228 in_signature='ss', out_signature='', |
419
6c167a2e04b8
bridge: added generic D-Bus exception management + asyncCreateProfile method
Goffi <goffi@goffi.org>
parents:
413
diff
changeset
|
229 async_callbacks=('callback', 'errback')) |
1030
15f43b54d697
core, memory, bridge: added profile password + password encryption:
souliane <souliane@mailoo.org>
parents:
1023
diff
changeset
|
230 def asyncCreateProfile(self, profile, password='', callback=None, errback=None): |
15f43b54d697
core, memory, bridge: added profile password + password encryption:
souliane <souliane@mailoo.org>
parents:
1023
diff
changeset
|
231 return self._callback("asyncCreateProfile", unicode(profile), unicode(password), callback=callback, errback=errback) |
337
4402ac630712
bridge: async callback managed in bridge_constructor + misc
Goffi <goffi@goffi.org>
parents:
336
diff
changeset
|
232 |
371
3ea41a199b36
bridge refactoring: categories are now core and plugin instead of communication and request
Goffi <goffi@goffi.org>
parents:
365
diff
changeset
|
233 @dbus.service.method(const_INT_PREFIX+const_CORE_SUFFIX, |
893
308a96bc7c1b
core, frontends: add method asyncDeleteProfile, remove synchronous methods createProfile and deleteProfile
souliane <souliane@mailoo.org>
parents:
811
diff
changeset
|
234 in_signature='s', out_signature='', |
308a96bc7c1b
core, frontends: add method asyncDeleteProfile, remove synchronous methods createProfile and deleteProfile
souliane <souliane@mailoo.org>
parents:
811
diff
changeset
|
235 async_callbacks=('callback', 'errback')) |
308a96bc7c1b
core, frontends: add method asyncDeleteProfile, remove synchronous methods createProfile and deleteProfile
souliane <souliane@mailoo.org>
parents:
811
diff
changeset
|
236 def asyncDeleteProfile(self, profile, callback=None, errback=None): |
308a96bc7c1b
core, frontends: add method asyncDeleteProfile, remove synchronous methods createProfile and deleteProfile
souliane <souliane@mailoo.org>
parents:
811
diff
changeset
|
237 return self._callback("asyncDeleteProfile", unicode(profile), callback=callback, errback=errback) |
308a96bc7c1b
core, frontends: add method asyncDeleteProfile, remove synchronous methods createProfile and deleteProfile
souliane <souliane@mailoo.org>
parents:
811
diff
changeset
|
238 |
308a96bc7c1b
core, frontends: add method asyncDeleteProfile, remove synchronous methods createProfile and deleteProfile
souliane <souliane@mailoo.org>
parents:
811
diff
changeset
|
239 @dbus.service.method(const_INT_PREFIX+const_CORE_SUFFIX, |
656
7d6e5807504a
bridge, memory: added the parameter security_limit to asyncGetParamA so it can be used from libervia. refactorization in memory.py are related to that.
souliane <souliane@mailoo.org>
parents:
641
diff
changeset
|
240 in_signature='sssis', out_signature='s', |
413
dd4caab17008
core: - individual parameters managed through sqlite
Goffi <goffi@goffi.org>
parents:
399
diff
changeset
|
241 async_callbacks=('callback', 'errback')) |
656
7d6e5807504a
bridge, memory: added the parameter security_limit to asyncGetParamA so it can be used from libervia. refactorization in memory.py are related to that.
souliane <souliane@mailoo.org>
parents:
641
diff
changeset
|
242 def asyncGetParamA(self, name, category, attribute="value", security_limit=-1, profile_key="@DEFAULT@", callback=None, errback=None): |
7d6e5807504a
bridge, memory: added the parameter security_limit to asyncGetParamA so it can be used from libervia. refactorization in memory.py are related to that.
souliane <souliane@mailoo.org>
parents:
641
diff
changeset
|
243 return self._callback("asyncGetParamA", unicode(name), unicode(category), unicode(attribute), security_limit, unicode(profile_key), callback=callback, errback=errback) |
413
dd4caab17008
core: - individual parameters managed through sqlite
Goffi <goffi@goffi.org>
parents:
399
diff
changeset
|
244 |
dd4caab17008
core: - individual parameters managed through sqlite
Goffi <goffi@goffi.org>
parents:
399
diff
changeset
|
245 @dbus.service.method(const_INT_PREFIX+const_CORE_SUFFIX, |
1587
698d6755d62a
core, bridge (params): added asyncGetParamsValuesFromCategory (yes that's a long name!) method to retrive params names and values for a given category
Goffi <goffi@goffi.org>
parents:
1586
diff
changeset
|
246 in_signature='sis', out_signature='a{ss}', |
698d6755d62a
core, bridge (params): added asyncGetParamsValuesFromCategory (yes that's a long name!) method to retrive params names and values for a given category
Goffi <goffi@goffi.org>
parents:
1586
diff
changeset
|
247 async_callbacks=('callback', 'errback')) |
698d6755d62a
core, bridge (params): added asyncGetParamsValuesFromCategory (yes that's a long name!) method to retrive params names and values for a given category
Goffi <goffi@goffi.org>
parents:
1586
diff
changeset
|
248 def asyncGetParamsValuesFromCategory(self, category, security_limit=-1, profile_key="@DEFAULT@", callback=None, errback=None): |
698d6755d62a
core, bridge (params): added asyncGetParamsValuesFromCategory (yes that's a long name!) method to retrive params names and values for a given category
Goffi <goffi@goffi.org>
parents:
1586
diff
changeset
|
249 return self._callback("asyncGetParamsValuesFromCategory", unicode(category), security_limit, unicode(profile_key), callback=callback, errback=errback) |
698d6755d62a
core, bridge (params): added asyncGetParamsValuesFromCategory (yes that's a long name!) method to retrive params names and values for a given category
Goffi <goffi@goffi.org>
parents:
1586
diff
changeset
|
250 |
698d6755d62a
core, bridge (params): added asyncGetParamsValuesFromCategory (yes that's a long name!) method to retrive params names and values for a given category
Goffi <goffi@goffi.org>
parents:
1586
diff
changeset
|
251 @dbus.service.method(const_INT_PREFIX+const_CORE_SUFFIX, |
538
2c4016921403
core, frontends, bridgen plugins: fixed methods which were unproperly managing multi-profiles
Goffi <goffi@goffi.org>
parents:
513
diff
changeset
|
252 in_signature='sba{ss}s', out_signature='', |
337
4402ac630712
bridge: async callback managed in bridge_constructor + misc
Goffi <goffi@goffi.org>
parents:
336
diff
changeset
|
253 async_callbacks=None) |
538
2c4016921403
core, frontends, bridgen plugins: fixed methods which were unproperly managing multi-profiles
Goffi <goffi@goffi.org>
parents:
513
diff
changeset
|
254 def confirmationAnswer(self, id, accepted, data, profile): |
2c4016921403
core, frontends, bridgen plugins: fixed methods which were unproperly managing multi-profiles
Goffi <goffi@goffi.org>
parents:
513
diff
changeset
|
255 return self._callback("confirmationAnswer", unicode(id), accepted, data, unicode(profile)) |
267 | 256 |
371
3ea41a199b36
bridge refactoring: categories are now core and plugin instead of communication and request
Goffi <goffi@goffi.org>
parents:
365
diff
changeset
|
257 @dbus.service.method(const_INT_PREFIX+const_CORE_SUFFIX, |
337
4402ac630712
bridge: async callback managed in bridge_constructor + misc
Goffi <goffi@goffi.org>
parents:
336
diff
changeset
|
258 in_signature='ss', out_signature='', |
1262
f8a8434dbac7
core: improved roster management + misc:
Goffi <goffi@goffi.org>
parents:
1224
diff
changeset
|
259 async_callbacks=('callback', 'errback')) |
f8a8434dbac7
core: improved roster management + misc:
Goffi <goffi@goffi.org>
parents:
1224
diff
changeset
|
260 def delContact(self, entity_jid, profile_key="@DEFAULT@", callback=None, errback=None): |
f8a8434dbac7
core: improved roster management + misc:
Goffi <goffi@goffi.org>
parents:
1224
diff
changeset
|
261 return self._callback("delContact", unicode(entity_jid), unicode(profile_key), callback=callback, errback=errback) |
267 | 262 |
371
3ea41a199b36
bridge refactoring: categories are now core and plugin instead of communication and request
Goffi <goffi@goffi.org>
parents:
365
diff
changeset
|
263 @dbus.service.method(const_INT_PREFIX+const_CORE_SUFFIX, |
1414
159d16336f87
core, bridge, jp: management of service discovery extensions (XEP-0128)
Goffi <goffi@goffi.org>
parents:
1396
diff
changeset
|
264 in_signature='ss', out_signature='(asa(sss)a{sa(a{ss}as)})', |
963
723f28cd15c7
core (disco): added discoInfos and discoItems bridge methods
Goffi <goffi@goffi.org>
parents:
943
diff
changeset
|
265 async_callbacks=('callback', 'errback')) |
723f28cd15c7
core (disco): added discoInfos and discoItems bridge methods
Goffi <goffi@goffi.org>
parents:
943
diff
changeset
|
266 def discoInfos(self, entity_jid, profile_key, callback=None, errback=None): |
723f28cd15c7
core (disco): added discoInfos and discoItems bridge methods
Goffi <goffi@goffi.org>
parents:
943
diff
changeset
|
267 return self._callback("discoInfos", unicode(entity_jid), unicode(profile_key), callback=callback, errback=errback) |
723f28cd15c7
core (disco): added discoInfos and discoItems bridge methods
Goffi <goffi@goffi.org>
parents:
943
diff
changeset
|
268 |
723f28cd15c7
core (disco): added discoInfos and discoItems bridge methods
Goffi <goffi@goffi.org>
parents:
943
diff
changeset
|
269 @dbus.service.method(const_INT_PREFIX+const_CORE_SUFFIX, |
723f28cd15c7
core (disco): added discoInfos and discoItems bridge methods
Goffi <goffi@goffi.org>
parents:
943
diff
changeset
|
270 in_signature='ss', out_signature='a(sss)', |
723f28cd15c7
core (disco): added discoInfos and discoItems bridge methods
Goffi <goffi@goffi.org>
parents:
943
diff
changeset
|
271 async_callbacks=('callback', 'errback')) |
723f28cd15c7
core (disco): added discoInfos and discoItems bridge methods
Goffi <goffi@goffi.org>
parents:
943
diff
changeset
|
272 def discoItems(self, entity_jid, profile_key, callback=None, errback=None): |
723f28cd15c7
core (disco): added discoInfos and discoItems bridge methods
Goffi <goffi@goffi.org>
parents:
943
diff
changeset
|
273 return self._callback("discoItems", unicode(entity_jid), unicode(profile_key), callback=callback, errback=errback) |
723f28cd15c7
core (disco): added discoInfos and discoItems bridge methods
Goffi <goffi@goffi.org>
parents:
943
diff
changeset
|
274 |
723f28cd15c7
core (disco): added discoInfos and discoItems bridge methods
Goffi <goffi@goffi.org>
parents:
943
diff
changeset
|
275 @dbus.service.method(const_INT_PREFIX+const_CORE_SUFFIX, |
337
4402ac630712
bridge: async callback managed in bridge_constructor + misc
Goffi <goffi@goffi.org>
parents:
336
diff
changeset
|
276 in_signature='s', out_signature='', |
4402ac630712
bridge: async callback managed in bridge_constructor + misc
Goffi <goffi@goffi.org>
parents:
336
diff
changeset
|
277 async_callbacks=None) |
267 | 278 def disconnect(self, profile_key="@DEFAULT@"): |
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
|
279 return self._callback("disconnect", unicode(profile_key)) |
267 | 280 |
371
3ea41a199b36
bridge refactoring: categories are now core and plugin instead of communication and request
Goffi <goffi@goffi.org>
parents:
365
diff
changeset
|
281 @dbus.service.method(const_INT_PREFIX+const_CORE_SUFFIX, |
365
efbfccfed623
core: local_dir moved to config file
Goffi <goffi@goffi.org>
parents:
364
diff
changeset
|
282 in_signature='ss', out_signature='s', |
364 | 283 async_callbacks=None) |
365
efbfccfed623
core: local_dir moved to config file
Goffi <goffi@goffi.org>
parents:
364
diff
changeset
|
284 def getConfig(self, section, name): |
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
|
285 return self._callback("getConfig", unicode(section), unicode(name)) |
364 | 286 |
371
3ea41a199b36
bridge refactoring: categories are now core and plugin instead of communication and request
Goffi <goffi@goffi.org>
parents:
365
diff
changeset
|
287 @dbus.service.method(const_INT_PREFIX+const_CORE_SUFFIX, |
337
4402ac630712
bridge: async callback managed in bridge_constructor + misc
Goffi <goffi@goffi.org>
parents:
336
diff
changeset
|
288 in_signature='s', out_signature='a(sa{ss}as)', |
1262
f8a8434dbac7
core: improved roster management + misc:
Goffi <goffi@goffi.org>
parents:
1224
diff
changeset
|
289 async_callbacks=('callback', 'errback')) |
f8a8434dbac7
core: improved roster management + misc:
Goffi <goffi@goffi.org>
parents:
1224
diff
changeset
|
290 def getContacts(self, profile_key="@DEFAULT@", callback=None, errback=None): |
f8a8434dbac7
core: improved roster management + misc:
Goffi <goffi@goffi.org>
parents:
1224
diff
changeset
|
291 return self._callback("getContacts", unicode(profile_key), callback=callback, errback=errback) |
267 | 292 |
371
3ea41a199b36
bridge refactoring: categories are now core and plugin instead of communication and request
Goffi <goffi@goffi.org>
parents:
365
diff
changeset
|
293 @dbus.service.method(const_INT_PREFIX+const_CORE_SUFFIX, |
501
e9634d2e7b38
core, quick_frontend, primitivus, wix: Contacts List refactoring phase 1:
Goffi <goffi@goffi.org>
parents:
480
diff
changeset
|
294 in_signature='ss', out_signature='as', |
e9634d2e7b38
core, quick_frontend, primitivus, wix: Contacts List refactoring phase 1:
Goffi <goffi@goffi.org>
parents:
480
diff
changeset
|
295 async_callbacks=None) |
e9634d2e7b38
core, quick_frontend, primitivus, wix: Contacts List refactoring phase 1:
Goffi <goffi@goffi.org>
parents:
480
diff
changeset
|
296 def getContactsFromGroup(self, group, profile_key="@DEFAULT@"): |
e9634d2e7b38
core, quick_frontend, primitivus, wix: Contacts List refactoring phase 1:
Goffi <goffi@goffi.org>
parents:
480
diff
changeset
|
297 return self._callback("getContactsFromGroup", unicode(group), unicode(profile_key)) |
e9634d2e7b38
core, quick_frontend, primitivus, wix: Contacts List refactoring phase 1:
Goffi <goffi@goffi.org>
parents:
480
diff
changeset
|
298 |
e9634d2e7b38
core, quick_frontend, primitivus, wix: Contacts List refactoring phase 1:
Goffi <goffi@goffi.org>
parents:
480
diff
changeset
|
299 @dbus.service.method(const_INT_PREFIX+const_CORE_SUFFIX, |
1314
bb9c32249778
core: added getEntitiesData which get cache data for several entities at once
Goffi <goffi@goffi.org>
parents:
1290
diff
changeset
|
300 in_signature='asass', out_signature='a{sa{ss}}', |
bb9c32249778
core: added getEntitiesData which get cache data for several entities at once
Goffi <goffi@goffi.org>
parents:
1290
diff
changeset
|
301 async_callbacks=None) |
bb9c32249778
core: added getEntitiesData which get cache data for several entities at once
Goffi <goffi@goffi.org>
parents:
1290
diff
changeset
|
302 def getEntitiesData(self, jids, keys, profile): |
bb9c32249778
core: added getEntitiesData which get cache data for several entities at once
Goffi <goffi@goffi.org>
parents:
1290
diff
changeset
|
303 return self._callback("getEntitiesData", jids, keys, unicode(profile)) |
bb9c32249778
core: added getEntitiesData which get cache data for several entities at once
Goffi <goffi@goffi.org>
parents:
1290
diff
changeset
|
304 |
bb9c32249778
core: added getEntitiesData which get cache data for several entities at once
Goffi <goffi@goffi.org>
parents:
1290
diff
changeset
|
305 @dbus.service.method(const_INT_PREFIX+const_CORE_SUFFIX, |
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
|
306 in_signature='sass', out_signature='a{ss}', |
65ecbb473cbb
core, quick frontend, plugin xep-0054, bridge: use of memory's entities data for vcard:
Goffi <goffi@goffi.org>
parents:
501
diff
changeset
|
307 async_callbacks=None) |
65ecbb473cbb
core, quick frontend, plugin xep-0054, bridge: use of memory's entities data for vcard:
Goffi <goffi@goffi.org>
parents:
501
diff
changeset
|
308 def getEntityData(self, jid, keys, profile): |
65ecbb473cbb
core, quick frontend, plugin xep-0054, bridge: use of memory's entities data for vcard:
Goffi <goffi@goffi.org>
parents:
501
diff
changeset
|
309 return self._callback("getEntityData", unicode(jid), keys, unicode(profile)) |
65ecbb473cbb
core, quick frontend, plugin xep-0054, bridge: use of memory's entities data for vcard:
Goffi <goffi@goffi.org>
parents:
501
diff
changeset
|
310 |
65ecbb473cbb
core, quick frontend, plugin xep-0054, bridge: use of memory's entities data for vcard:
Goffi <goffi@goffi.org>
parents:
501
diff
changeset
|
311 @dbus.service.method(const_INT_PREFIX+const_CORE_SUFFIX, |
1482
80cd55dd5b04
core, bridge: added getFeatures method:
Goffi <goffi@goffi.org>
parents:
1467
diff
changeset
|
312 in_signature='s', out_signature='a{sa{ss}}', |
80cd55dd5b04
core, bridge: added getFeatures method:
Goffi <goffi@goffi.org>
parents:
1467
diff
changeset
|
313 async_callbacks=('callback', 'errback')) |
80cd55dd5b04
core, bridge: added getFeatures method:
Goffi <goffi@goffi.org>
parents:
1467
diff
changeset
|
314 def getFeatures(self, profile_key, callback=None, errback=None): |
80cd55dd5b04
core, bridge: added getFeatures method:
Goffi <goffi@goffi.org>
parents:
1467
diff
changeset
|
315 return self._callback("getFeatures", unicode(profile_key), callback=callback, errback=errback) |
80cd55dd5b04
core, bridge: added getFeatures method:
Goffi <goffi@goffi.org>
parents:
1467
diff
changeset
|
316 |
80cd55dd5b04
core, bridge: added getFeatures method:
Goffi <goffi@goffi.org>
parents:
1467
diff
changeset
|
317 @dbus.service.method(const_INT_PREFIX+const_CORE_SUFFIX, |
1224
f0c9b149ed99
bridge, memory: add "search" attribute to getHistory (filter the results with a unix globbing pattern)
souliane <souliane@mailoo.org>
parents:
1073
diff
changeset
|
318 in_signature='ssibss', out_signature='a(dssssa{ss})', |
425
e4e9187e3b5b
backend, bridge: asynchronous history
Goffi <goffi@goffi.org>
parents:
424
diff
changeset
|
319 async_callbacks=('callback', 'errback')) |
1224
f0c9b149ed99
bridge, memory: add "search" attribute to getHistory (filter the results with a unix globbing pattern)
souliane <souliane@mailoo.org>
parents:
1073
diff
changeset
|
320 def getHistory(self, from_jid, to_jid, limit, between=True, search='', profile="@NONE@", callback=None, errback=None): |
f0c9b149ed99
bridge, memory: add "search" attribute to getHistory (filter the results with a unix globbing pattern)
souliane <souliane@mailoo.org>
parents:
1073
diff
changeset
|
321 return self._callback("getHistory", unicode(from_jid), unicode(to_jid), limit, between, unicode(search), unicode(profile), callback=callback, errback=errback) |
267 | 322 |
371
3ea41a199b36
bridge refactoring: categories are now core and plugin instead of communication and request
Goffi <goffi@goffi.org>
parents:
365
diff
changeset
|
323 @dbus.service.method(const_INT_PREFIX+const_CORE_SUFFIX, |
399 | 324 in_signature='ss', out_signature='s', |
325 async_callbacks=None) | |
1290
faa1129559b8
core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents:
1262
diff
changeset
|
326 def getMainResource(self, contact_jid, profile_key="@DEFAULT@"): |
faa1129559b8
core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents:
1262
diff
changeset
|
327 return self._callback("getMainResource", unicode(contact_jid), unicode(profile_key)) |
399 | 328 |
329 @dbus.service.method(const_INT_PREFIX+const_CORE_SUFFIX, | |
773 | 330 in_signature='ss', out_signature='s', |
337
4402ac630712
bridge: async callback managed in bridge_constructor + misc
Goffi <goffi@goffi.org>
parents:
336
diff
changeset
|
331 async_callbacks=None) |
773 | 332 def getMenuHelp(self, menu_id, language): |
333 return self._callback("getMenuHelp", unicode(menu_id), unicode(language)) | |
267 | 334 |
371
3ea41a199b36
bridge refactoring: categories are now core and plugin instead of communication and request
Goffi <goffi@goffi.org>
parents:
365
diff
changeset
|
335 @dbus.service.method(const_INT_PREFIX+const_CORE_SUFFIX, |
1365
ba87b940f07a
core, quick_frontends: added an "extra" item in getMenus + use of new quick_menus module in QuickApp
Goffi <goffi@goffi.org>
parents:
1314
diff
changeset
|
336 in_signature='si', out_signature='a(ssasasa{ss})', |
337
4402ac630712
bridge: async callback managed in bridge_constructor + misc
Goffi <goffi@goffi.org>
parents:
336
diff
changeset
|
337 async_callbacks=None) |
773 | 338 def getMenus(self, language, security_limit): |
339 return self._callback("getMenus", unicode(language), security_limit) | |
267 | 340 |
371
3ea41a199b36
bridge refactoring: categories are now core and plugin instead of communication and request
Goffi <goffi@goffi.org>
parents:
365
diff
changeset
|
341 @dbus.service.method(const_INT_PREFIX+const_CORE_SUFFIX, |
337
4402ac630712
bridge: async callback managed in bridge_constructor + misc
Goffi <goffi@goffi.org>
parents:
336
diff
changeset
|
342 in_signature='ssss', out_signature='s', |
4402ac630712
bridge: async callback managed in bridge_constructor + misc
Goffi <goffi@goffi.org>
parents:
336
diff
changeset
|
343 async_callbacks=None) |
272
1d2e0dfe7114
bridge: core & frontend sides of bridge are now generated
Goffi <goffi@goffi.org>
parents:
267
diff
changeset
|
344 def getParamA(self, name, category, attribute="value", profile_key="@DEFAULT@"): |
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
|
345 return self._callback("getParamA", unicode(name), unicode(category), unicode(attribute), unicode(profile_key)) |
267 | 346 |
371
3ea41a199b36
bridge refactoring: categories are now core and plugin instead of communication and request
Goffi <goffi@goffi.org>
parents:
365
diff
changeset
|
347 @dbus.service.method(const_INT_PREFIX+const_CORE_SUFFIX, |
337
4402ac630712
bridge: async callback managed in bridge_constructor + misc
Goffi <goffi@goffi.org>
parents:
336
diff
changeset
|
348 in_signature='', out_signature='as', |
4402ac630712
bridge: async callback managed in bridge_constructor + misc
Goffi <goffi@goffi.org>
parents:
336
diff
changeset
|
349 async_callbacks=None) |
267 | 350 def getParamsCategories(self, ): |
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
|
351 return self._callback("getParamsCategories", ) |
267 | 352 |
371
3ea41a199b36
bridge refactoring: categories are now core and plugin instead of communication and request
Goffi <goffi@goffi.org>
parents:
365
diff
changeset
|
353 @dbus.service.method(const_INT_PREFIX+const_CORE_SUFFIX, |
777
5642939d254e
core, bridge: new method paramsRegisterApp to register frontend's specific parameters
souliane <souliane@mailoo.org>
parents:
773
diff
changeset
|
354 in_signature='iss', out_signature='s', |
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
|
355 async_callbacks=('callback', 'errback')) |
777
5642939d254e
core, bridge: new method paramsRegisterApp to register frontend's specific parameters
souliane <souliane@mailoo.org>
parents:
773
diff
changeset
|
356 def getParamsUI(self, security_limit=-1, app='', profile_key="@DEFAULT@", callback=None, errback=None): |
5642939d254e
core, bridge: new method paramsRegisterApp to register frontend's specific parameters
souliane <souliane@mailoo.org>
parents:
773
diff
changeset
|
357 return self._callback("getParamsUI", security_limit, unicode(app), unicode(profile_key), callback=callback, errback=errback) |
267 | 358 |
371
3ea41a199b36
bridge refactoring: categories are now core and plugin instead of communication and request
Goffi <goffi@goffi.org>
parents:
365
diff
changeset
|
359 @dbus.service.method(const_INT_PREFIX+const_CORE_SUFFIX, |
337
4402ac630712
bridge: async callback managed in bridge_constructor + misc
Goffi <goffi@goffi.org>
parents:
336
diff
changeset
|
360 in_signature='s', out_signature='a{sa{s(sia{ss})}}', |
4402ac630712
bridge: async callback managed in bridge_constructor + misc
Goffi <goffi@goffi.org>
parents:
336
diff
changeset
|
361 async_callbacks=None) |
943
71926ec2114d
core (memory): entities cache improvments:
Goffi <goffi@goffi.org>
parents:
917
diff
changeset
|
362 def getPresenceStatuses(self, profile_key="@DEFAULT@"): |
71926ec2114d
core (memory): entities cache improvments:
Goffi <goffi@goffi.org>
parents:
917
diff
changeset
|
363 return self._callback("getPresenceStatuses", unicode(profile_key)) |
267 | 364 |
371
3ea41a199b36
bridge refactoring: categories are now core and plugin instead of communication and request
Goffi <goffi@goffi.org>
parents:
365
diff
changeset
|
365 @dbus.service.method(const_INT_PREFIX+const_CORE_SUFFIX, |
337
4402ac630712
bridge: async callback managed in bridge_constructor + misc
Goffi <goffi@goffi.org>
parents:
336
diff
changeset
|
366 in_signature='s', out_signature='s', |
4402ac630712
bridge: async callback managed in bridge_constructor + misc
Goffi <goffi@goffi.org>
parents:
336
diff
changeset
|
367 async_callbacks=None) |
267 | 368 def getProfileName(self, profile_key="@DEFAULT@"): |
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
|
369 return self._callback("getProfileName", unicode(profile_key)) |
267 | 370 |
371
3ea41a199b36
bridge refactoring: categories are now core and plugin instead of communication and request
Goffi <goffi@goffi.org>
parents:
365
diff
changeset
|
371 @dbus.service.method(const_INT_PREFIX+const_CORE_SUFFIX, |
337
4402ac630712
bridge: async callback managed in bridge_constructor + misc
Goffi <goffi@goffi.org>
parents:
336
diff
changeset
|
372 in_signature='', out_signature='as', |
4402ac630712
bridge: async callback managed in bridge_constructor + misc
Goffi <goffi@goffi.org>
parents:
336
diff
changeset
|
373 async_callbacks=None) |
267 | 374 def getProfilesList(self, ): |
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
|
375 return self._callback("getProfilesList", ) |
60
9764e027ecc0
SàT: multi-profile parameters, first draft
Goffi <goffi@goffi.org>
parents:
57
diff
changeset
|
376 |
371
3ea41a199b36
bridge refactoring: categories are now core and plugin instead of communication and request
Goffi <goffi@goffi.org>
parents:
365
diff
changeset
|
377 @dbus.service.method(const_INT_PREFIX+const_CORE_SUFFIX, |
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
|
378 in_signature='', out_signature='', |
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
|
379 async_callbacks=('callback', 'errback')) |
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
|
380 def getReady(self, callback=None, errback=None): |
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
|
381 return self._callback("getReady", callback=callback, errback=errback) |
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
|
382 |
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
|
383 @dbus.service.method(const_INT_PREFIX+const_CORE_SUFFIX, |
337
4402ac630712
bridge: async callback managed in bridge_constructor + misc
Goffi <goffi@goffi.org>
parents:
336
diff
changeset
|
384 in_signature='', out_signature='s', |
4402ac630712
bridge: async callback managed in bridge_constructor + misc
Goffi <goffi@goffi.org>
parents:
336
diff
changeset
|
385 async_callbacks=None) |
267 | 386 def getVersion(self, ): |
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
|
387 return self._callback("getVersion", ) |
267 | 388 |
371
3ea41a199b36
bridge refactoring: categories are now core and plugin instead of communication and request
Goffi <goffi@goffi.org>
parents:
365
diff
changeset
|
389 @dbus.service.method(const_INT_PREFIX+const_CORE_SUFFIX, |
541
8b116fa42a31
core, bridge: waiting confirmation management (new getWaitingConf method)
Goffi <goffi@goffi.org>
parents:
538
diff
changeset
|
390 in_signature='s', out_signature='a(ssa{ss})', |
8b116fa42a31
core, bridge: waiting confirmation management (new getWaitingConf method)
Goffi <goffi@goffi.org>
parents:
538
diff
changeset
|
391 async_callbacks=None) |
8b116fa42a31
core, bridge: waiting confirmation management (new getWaitingConf method)
Goffi <goffi@goffi.org>
parents:
538
diff
changeset
|
392 def getWaitingConf(self, profile_key): |
8b116fa42a31
core, bridge: waiting confirmation management (new getWaitingConf method)
Goffi <goffi@goffi.org>
parents:
538
diff
changeset
|
393 return self._callback("getWaitingConf", unicode(profile_key)) |
8b116fa42a31
core, bridge: waiting confirmation management (new getWaitingConf method)
Goffi <goffi@goffi.org>
parents:
538
diff
changeset
|
394 |
8b116fa42a31
core, bridge: waiting confirmation management (new getWaitingConf method)
Goffi <goffi@goffi.org>
parents:
538
diff
changeset
|
395 @dbus.service.method(const_INT_PREFIX+const_CORE_SUFFIX, |
337
4402ac630712
bridge: async callback managed in bridge_constructor + misc
Goffi <goffi@goffi.org>
parents:
336
diff
changeset
|
396 in_signature='s', out_signature='a{ss}', |
4402ac630712
bridge: async callback managed in bridge_constructor + misc
Goffi <goffi@goffi.org>
parents:
336
diff
changeset
|
397 async_callbacks=None) |
267 | 398 def getWaitingSub(self, profile_key="@DEFAULT@"): |
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
|
399 return self._callback("getWaitingSub", unicode(profile_key)) |
267 | 400 |
371
3ea41a199b36
bridge refactoring: categories are now core and plugin instead of communication and request
Goffi <goffi@goffi.org>
parents:
365
diff
changeset
|
401 @dbus.service.method(const_INT_PREFIX+const_CORE_SUFFIX, |
337
4402ac630712
bridge: async callback managed in bridge_constructor + misc
Goffi <goffi@goffi.org>
parents:
336
diff
changeset
|
402 in_signature='s', out_signature='b', |
4402ac630712
bridge: async callback managed in bridge_constructor + misc
Goffi <goffi@goffi.org>
parents:
336
diff
changeset
|
403 async_callbacks=None) |
267 | 404 def isConnected(self, profile_key="@DEFAULT@"): |
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
|
405 return self._callback("isConnected", unicode(profile_key)) |
267 | 406 |
371
3ea41a199b36
bridge refactoring: categories are now core and plugin instead of communication and request
Goffi <goffi@goffi.org>
parents:
365
diff
changeset
|
407 @dbus.service.method(const_INT_PREFIX+const_CORE_SUFFIX, |
759
93bd868b8fb6
backend, frontends: callbacks refactoring:
Goffi <goffi@goffi.org>
parents:
755
diff
changeset
|
408 in_signature='sa{ss}s', out_signature='a{ss}', |
93bd868b8fb6
backend, frontends: callbacks refactoring:
Goffi <goffi@goffi.org>
parents:
755
diff
changeset
|
409 async_callbacks=('callback', 'errback')) |
93bd868b8fb6
backend, frontends: callbacks refactoring:
Goffi <goffi@goffi.org>
parents:
755
diff
changeset
|
410 def launchAction(self, callback_id, data, profile_key="@DEFAULT@", callback=None, errback=None): |
93bd868b8fb6
backend, frontends: callbacks refactoring:
Goffi <goffi@goffi.org>
parents:
755
diff
changeset
|
411 return self._callback("launchAction", unicode(callback_id), data, unicode(profile_key), callback=callback, errback=errback) |
60
9764e027ecc0
SàT: multi-profile parameters, first draft
Goffi <goffi@goffi.org>
parents:
57
diff
changeset
|
412 |
371
3ea41a199b36
bridge refactoring: categories are now core and plugin instead of communication and request
Goffi <goffi@goffi.org>
parents:
365
diff
changeset
|
413 @dbus.service.method(const_INT_PREFIX+const_CORE_SUFFIX, |
1015
fee00f2e11c2
memory, jp: added jp commands to load/save parameters template
souliane <souliane@mailoo.org>
parents:
993
diff
changeset
|
414 in_signature='s', out_signature='b', |
fee00f2e11c2
memory, jp: added jp commands to load/save parameters template
souliane <souliane@mailoo.org>
parents:
993
diff
changeset
|
415 async_callbacks=None) |
fee00f2e11c2
memory, jp: added jp commands to load/save parameters template
souliane <souliane@mailoo.org>
parents:
993
diff
changeset
|
416 def loadParamsTemplate(self, filename): |
fee00f2e11c2
memory, jp: added jp commands to load/save parameters template
souliane <souliane@mailoo.org>
parents:
993
diff
changeset
|
417 return self._callback("loadParamsTemplate", unicode(filename)) |
fee00f2e11c2
memory, jp: added jp commands to load/save parameters template
souliane <souliane@mailoo.org>
parents:
993
diff
changeset
|
418 |
fee00f2e11c2
memory, jp: added jp commands to load/save parameters template
souliane <souliane@mailoo.org>
parents:
993
diff
changeset
|
419 @dbus.service.method(const_INT_PREFIX+const_CORE_SUFFIX, |
777
5642939d254e
core, bridge: new method paramsRegisterApp to register frontend's specific parameters
souliane <souliane@mailoo.org>
parents:
773
diff
changeset
|
420 in_signature='sis', out_signature='', |
5642939d254e
core, bridge: new method paramsRegisterApp to register frontend's specific parameters
souliane <souliane@mailoo.org>
parents:
773
diff
changeset
|
421 async_callbacks=None) |
5642939d254e
core, bridge: new method paramsRegisterApp to register frontend's specific parameters
souliane <souliane@mailoo.org>
parents:
773
diff
changeset
|
422 def paramsRegisterApp(self, xml, security_limit=-1, app=''): |
5642939d254e
core, bridge: new method paramsRegisterApp to register frontend's specific parameters
souliane <souliane@mailoo.org>
parents:
773
diff
changeset
|
423 return self._callback("paramsRegisterApp", unicode(xml), security_limit, unicode(app)) |
5642939d254e
core, bridge: new method paramsRegisterApp to register frontend's specific parameters
souliane <souliane@mailoo.org>
parents:
773
diff
changeset
|
424 |
5642939d254e
core, bridge: new method paramsRegisterApp to register frontend's specific parameters
souliane <souliane@mailoo.org>
parents:
773
diff
changeset
|
425 @dbus.service.method(const_INT_PREFIX+const_CORE_SUFFIX, |
1592
d6d655238a93
bridge: new core method profileStartSession to start a session without connecting the profile
Goffi <goffi@goffi.org>
parents:
1587
diff
changeset
|
426 in_signature='s', out_signature='b', |
d6d655238a93
bridge: new core method profileStartSession to start a session without connecting the profile
Goffi <goffi@goffi.org>
parents:
1587
diff
changeset
|
427 async_callbacks=None) |
d6d655238a93
bridge: new core method profileStartSession to start a session without connecting the profile
Goffi <goffi@goffi.org>
parents:
1587
diff
changeset
|
428 def profileIsSessionStarted(self, profile_key="@DEFAULT@"): |
d6d655238a93
bridge: new core method profileStartSession to start a session without connecting the profile
Goffi <goffi@goffi.org>
parents:
1587
diff
changeset
|
429 return self._callback("profileIsSessionStarted", unicode(profile_key)) |
d6d655238a93
bridge: new core method profileStartSession to start a session without connecting the profile
Goffi <goffi@goffi.org>
parents:
1587
diff
changeset
|
430 |
d6d655238a93
bridge: new core method profileStartSession to start a session without connecting the profile
Goffi <goffi@goffi.org>
parents:
1587
diff
changeset
|
431 @dbus.service.method(const_INT_PREFIX+const_CORE_SUFFIX, |
1595
a3d0cfa5b7a6
core, bridge: added a profileSetDefault method
Goffi <goffi@goffi.org>
parents:
1592
diff
changeset
|
432 in_signature='s', out_signature='', |
a3d0cfa5b7a6
core, bridge: added a profileSetDefault method
Goffi <goffi@goffi.org>
parents:
1592
diff
changeset
|
433 async_callbacks=None) |
a3d0cfa5b7a6
core, bridge: added a profileSetDefault method
Goffi <goffi@goffi.org>
parents:
1592
diff
changeset
|
434 def profileSetDefault(self, arg_0): |
a3d0cfa5b7a6
core, bridge: added a profileSetDefault method
Goffi <goffi@goffi.org>
parents:
1592
diff
changeset
|
435 return self._callback("profileSetDefault", unicode(arg_0)) |
a3d0cfa5b7a6
core, bridge: added a profileSetDefault method
Goffi <goffi@goffi.org>
parents:
1592
diff
changeset
|
436 |
a3d0cfa5b7a6
core, bridge: added a profileSetDefault method
Goffi <goffi@goffi.org>
parents:
1592
diff
changeset
|
437 @dbus.service.method(const_INT_PREFIX+const_CORE_SUFFIX, |
1592
d6d655238a93
bridge: new core method profileStartSession to start a session without connecting the profile
Goffi <goffi@goffi.org>
parents:
1587
diff
changeset
|
438 in_signature='ss', out_signature='b', |
d6d655238a93
bridge: new core method profileStartSession to start a session without connecting the profile
Goffi <goffi@goffi.org>
parents:
1587
diff
changeset
|
439 async_callbacks=('callback', 'errback')) |
d6d655238a93
bridge: new core method profileStartSession to start a session without connecting the profile
Goffi <goffi@goffi.org>
parents:
1587
diff
changeset
|
440 def profileStartSession(self, password='', profile_key="@DEFAULT@", callback=None, errback=None): |
d6d655238a93
bridge: new core method profileStartSession to start a session without connecting the profile
Goffi <goffi@goffi.org>
parents:
1587
diff
changeset
|
441 return self._callback("profileStartSession", unicode(password), unicode(profile_key), callback=callback, errback=errback) |
d6d655238a93
bridge: new core method profileStartSession to start a session without connecting the profile
Goffi <goffi@goffi.org>
parents:
1587
diff
changeset
|
442 |
d6d655238a93
bridge: new core method profileStartSession to start a session without connecting the profile
Goffi <goffi@goffi.org>
parents:
1587
diff
changeset
|
443 @dbus.service.method(const_INT_PREFIX+const_CORE_SUFFIX, |
1522
7d7e57a84792
core: progression handling improvments:
Goffi <goffi@goffi.org>
parents:
1482
diff
changeset
|
444 in_signature='ss', out_signature='a{ss}', |
7d7e57a84792
core: progression handling improvments:
Goffi <goffi@goffi.org>
parents:
1482
diff
changeset
|
445 async_callbacks=None) |
7d7e57a84792
core: progression handling improvments:
Goffi <goffi@goffi.org>
parents:
1482
diff
changeset
|
446 def progressGet(self, id, profile): |
7d7e57a84792
core: progression handling improvments:
Goffi <goffi@goffi.org>
parents:
1482
diff
changeset
|
447 return self._callback("progressGet", unicode(id), unicode(profile)) |
7d7e57a84792
core: progression handling improvments:
Goffi <goffi@goffi.org>
parents:
1482
diff
changeset
|
448 |
7d7e57a84792
core: progression handling improvments:
Goffi <goffi@goffi.org>
parents:
1482
diff
changeset
|
449 @dbus.service.method(const_INT_PREFIX+const_CORE_SUFFIX, |
7d7e57a84792
core: progression handling improvments:
Goffi <goffi@goffi.org>
parents:
1482
diff
changeset
|
450 in_signature='s', out_signature='a{sa{sa{ss}}}', |
7d7e57a84792
core: progression handling improvments:
Goffi <goffi@goffi.org>
parents:
1482
diff
changeset
|
451 async_callbacks=None) |
7d7e57a84792
core: progression handling improvments:
Goffi <goffi@goffi.org>
parents:
1482
diff
changeset
|
452 def progressGetAll(self, profile): |
7d7e57a84792
core: progression handling improvments:
Goffi <goffi@goffi.org>
parents:
1482
diff
changeset
|
453 return self._callback("progressGetAll", unicode(profile)) |
7d7e57a84792
core: progression handling improvments:
Goffi <goffi@goffi.org>
parents:
1482
diff
changeset
|
454 |
7d7e57a84792
core: progression handling improvments:
Goffi <goffi@goffi.org>
parents:
1482
diff
changeset
|
455 @dbus.service.method(const_INT_PREFIX+const_CORE_SUFFIX, |
1015
fee00f2e11c2
memory, jp: added jp commands to load/save parameters template
souliane <souliane@mailoo.org>
parents:
993
diff
changeset
|
456 in_signature='s', out_signature='b', |
fee00f2e11c2
memory, jp: added jp commands to load/save parameters template
souliane <souliane@mailoo.org>
parents:
993
diff
changeset
|
457 async_callbacks=None) |
fee00f2e11c2
memory, jp: added jp commands to load/save parameters template
souliane <souliane@mailoo.org>
parents:
993
diff
changeset
|
458 def saveParamsTemplate(self, filename): |
fee00f2e11c2
memory, jp: added jp commands to load/save parameters template
souliane <souliane@mailoo.org>
parents:
993
diff
changeset
|
459 return self._callback("saveParamsTemplate", unicode(filename)) |
fee00f2e11c2
memory, jp: added jp commands to load/save parameters template
souliane <souliane@mailoo.org>
parents:
993
diff
changeset
|
460 |
fee00f2e11c2
memory, jp: added jp commands to load/save parameters template
souliane <souliane@mailoo.org>
parents:
993
diff
changeset
|
461 @dbus.service.method(const_INT_PREFIX+const_CORE_SUFFIX, |
636
7ea6d5a86e58
plugin XEP-0085: Chat State Notifications
souliane <souliane@mailoo.org>
parents:
634
diff
changeset
|
462 in_signature='ssssa{ss}s', out_signature='', |
752
f49945d728de
core,bridge: sendMessage bridge method is now async
Goffi <goffi@goffi.org>
parents:
751
diff
changeset
|
463 async_callbacks=('callback', 'errback')) |
f49945d728de
core,bridge: sendMessage bridge method is now async
Goffi <goffi@goffi.org>
parents:
751
diff
changeset
|
464 def sendMessage(self, to_jid, message, subject='', mess_type="auto", extra={}, profile_key="@NONE@", callback=None, errback=None): |
f49945d728de
core,bridge: sendMessage bridge method is now async
Goffi <goffi@goffi.org>
parents:
751
diff
changeset
|
465 return self._callback("sendMessage", unicode(to_jid), unicode(message), unicode(subject), unicode(mess_type), extra, unicode(profile_key), callback=callback, errback=errback) |
65
d35c5edab53f
SàT: multi-profile: memory & dbus bridge's methods profile management
Goffi <goffi@goffi.org>
parents:
61
diff
changeset
|
466 |
371
3ea41a199b36
bridge refactoring: categories are now core and plugin instead of communication and request
Goffi <goffi@goffi.org>
parents:
365
diff
changeset
|
467 @dbus.service.method(const_INT_PREFIX+const_CORE_SUFFIX, |
641
49587e170f53
core: added the security_limit to setParam
souliane <souliane@mailoo.org>
parents:
636
diff
changeset
|
468 in_signature='sssis', out_signature='', |
337
4402ac630712
bridge: async callback managed in bridge_constructor + misc
Goffi <goffi@goffi.org>
parents:
336
diff
changeset
|
469 async_callbacks=None) |
641
49587e170f53
core: added the security_limit to setParam
souliane <souliane@mailoo.org>
parents:
636
diff
changeset
|
470 def setParam(self, name, value, category, security_limit=-1, profile_key="@DEFAULT@"): |
49587e170f53
core: added the security_limit to setParam
souliane <souliane@mailoo.org>
parents:
636
diff
changeset
|
471 return self._callback("setParam", unicode(name), unicode(value), unicode(category), security_limit, unicode(profile_key)) |
105 | 472 |
371
3ea41a199b36
bridge refactoring: categories are now core and plugin instead of communication and request
Goffi <goffi@goffi.org>
parents:
365
diff
changeset
|
473 @dbus.service.method(const_INT_PREFIX+const_CORE_SUFFIX, |
917
a9401694d2dc
bridge, frontends: display presence with the highest priority + reset your own presence when you (dis)connect
souliane <souliane@mailoo.org>
parents:
893
diff
changeset
|
474 in_signature='ssa{ss}s', out_signature='', |
337
4402ac630712
bridge: async callback managed in bridge_constructor + misc
Goffi <goffi@goffi.org>
parents:
336
diff
changeset
|
475 async_callbacks=None) |
917
a9401694d2dc
bridge, frontends: display presence with the highest priority + reset your own presence when you (dis)connect
souliane <souliane@mailoo.org>
parents:
893
diff
changeset
|
476 def setPresence(self, to_jid='', show='', statuses={}, profile_key="@DEFAULT@"): |
a9401694d2dc
bridge, frontends: display presence with the highest priority + reset your own presence when you (dis)connect
souliane <souliane@mailoo.org>
parents:
893
diff
changeset
|
477 return self._callback("setPresence", unicode(to_jid), unicode(show), statuses, unicode(profile_key)) |
0 | 478 |
371
3ea41a199b36
bridge refactoring: categories are now core and plugin instead of communication and request
Goffi <goffi@goffi.org>
parents:
365
diff
changeset
|
479 @dbus.service.method(const_INT_PREFIX+const_CORE_SUFFIX, |
337
4402ac630712
bridge: async callback managed in bridge_constructor + misc
Goffi <goffi@goffi.org>
parents:
336
diff
changeset
|
480 in_signature='sss', out_signature='', |
4402ac630712
bridge: async callback managed in bridge_constructor + misc
Goffi <goffi@goffi.org>
parents:
336
diff
changeset
|
481 async_callbacks=None) |
267 | 482 def subscription(self, sub_type, entity, profile_key="@DEFAULT@"): |
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
|
483 return self._callback("subscription", unicode(sub_type), unicode(entity), unicode(profile_key)) |
0 | 484 |
371
3ea41a199b36
bridge refactoring: categories are now core and plugin instead of communication and request
Goffi <goffi@goffi.org>
parents:
365
diff
changeset
|
485 @dbus.service.method(const_INT_PREFIX+const_CORE_SUFFIX, |
345 | 486 in_signature='ssass', out_signature='', |
1262
f8a8434dbac7
core: improved roster management + misc:
Goffi <goffi@goffi.org>
parents:
1224
diff
changeset
|
487 async_callbacks=('callback', 'errback')) |
f8a8434dbac7
core: improved roster management + misc:
Goffi <goffi@goffi.org>
parents:
1224
diff
changeset
|
488 def updateContact(self, entity_jid, name, groups, profile_key="@DEFAULT@", callback=None, errback=None): |
f8a8434dbac7
core: improved roster management + misc:
Goffi <goffi@goffi.org>
parents:
1224
diff
changeset
|
489 return self._callback("updateContact", unicode(entity_jid), unicode(name), groups, unicode(profile_key), callback=callback, errback=errback) |
345 | 490 |
300
233e6fce0b49
DBus bridge: using new generated bridge
Goffi <goffi@goffi.org>
parents:
298
diff
changeset
|
491 def __attributes(self, in_sign): |
267 | 492 """Return arguments to user given a in_sign |
493 @param in_sign: in_sign in the short form (using s,a,i,b etc) | |
587
952322b1d490
Remove trailing whitespaces.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
572
diff
changeset
|
494 @return: list of arguments that correspond to a in_sign (e.g.: "sss" return "arg1, arg2, arg3")""" |
595
1f160467f5de
Fix pep8 support in src/bridge.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
587
diff
changeset
|
495 i = 0 |
1f160467f5de
Fix pep8 support in src/bridge.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
587
diff
changeset
|
496 idx = 0 |
1f160467f5de
Fix pep8 support in src/bridge.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
587
diff
changeset
|
497 attr = [] |
1f160467f5de
Fix pep8 support in src/bridge.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
587
diff
changeset
|
498 while i < len(in_sign): |
1f160467f5de
Fix pep8 support in src/bridge.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
587
diff
changeset
|
499 if in_sign[i] not in ['b', 'y', 'n', 'i', 'x', 'q', 'u', 't', 'd', 's', 'a']: |
267 | 500 raise ParseError("Unmanaged attribute type [%c]" % in_sign[i]) |
7
c14a3a7018a5
added dynamic exportation of Dbus bridge method (usefull for plugins)
Goffi <goffi@goffi.org>
parents:
1
diff
changeset
|
501 |
300
233e6fce0b49
DBus bridge: using new generated bridge
Goffi <goffi@goffi.org>
parents:
298
diff
changeset
|
502 attr.append("arg_%i" % idx) |
595
1f160467f5de
Fix pep8 support in src/bridge.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
587
diff
changeset
|
503 idx += 1 |
7
c14a3a7018a5
added dynamic exportation of Dbus bridge method (usefull for plugins)
Goffi <goffi@goffi.org>
parents:
1
diff
changeset
|
504 |
c14a3a7018a5
added dynamic exportation of Dbus bridge method (usefull for plugins)
Goffi <goffi@goffi.org>
parents:
1
diff
changeset
|
505 if in_sign[i] == 'a': |
595
1f160467f5de
Fix pep8 support in src/bridge.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
587
diff
changeset
|
506 i += 1 |
1f160467f5de
Fix pep8 support in src/bridge.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
587
diff
changeset
|
507 if in_sign[i] != '{' and in_sign[i] != '(': # FIXME: must manage tuples out of arrays |
1f160467f5de
Fix pep8 support in src/bridge.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
587
diff
changeset
|
508 i += 1 |
1f160467f5de
Fix pep8 support in src/bridge.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
587
diff
changeset
|
509 continue # we have a simple type for the array |
267 | 510 opening_car = in_sign[i] |
595
1f160467f5de
Fix pep8 support in src/bridge.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
587
diff
changeset
|
511 assert(opening_car in ['{', '(']) |
267 | 512 closing_car = '}' if opening_car == '{' else ')' |
513 opening_count = 1 | |
595
1f160467f5de
Fix pep8 support in src/bridge.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
587
diff
changeset
|
514 while (True): # we have a dict or a list of tuples |
1f160467f5de
Fix pep8 support in src/bridge.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
587
diff
changeset
|
515 i += 1 |
1f160467f5de
Fix pep8 support in src/bridge.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
587
diff
changeset
|
516 if i >= len(in_sign): |
267 | 517 raise ParseError("missing }") |
518 if in_sign[i] == opening_car: | |
595
1f160467f5de
Fix pep8 support in src/bridge.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
587
diff
changeset
|
519 opening_count += 1 |
267 | 520 if in_sign[i] == closing_car: |
595
1f160467f5de
Fix pep8 support in src/bridge.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
587
diff
changeset
|
521 opening_count -= 1 |
267 | 522 if opening_count == 0: |
523 break | |
595
1f160467f5de
Fix pep8 support in src/bridge.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
587
diff
changeset
|
524 i += 1 |
300
233e6fce0b49
DBus bridge: using new generated bridge
Goffi <goffi@goffi.org>
parents:
298
diff
changeset
|
525 return attr |
7
c14a3a7018a5
added dynamic exportation of Dbus bridge method (usefull for plugins)
Goffi <goffi@goffi.org>
parents:
1
diff
changeset
|
526 |
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
|
527 def addMethod(self, name, int_suffix, in_sign, out_sign, method, async=False): |
7
c14a3a7018a5
added dynamic exportation of Dbus bridge method (usefull for plugins)
Goffi <goffi@goffi.org>
parents:
1
diff
changeset
|
528 """Dynamically add a method to Dbus Bridge""" |
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
|
529 inspect_args = inspect.getargspec(method) |
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
|
530 |
469
db4c2b82bab6
D-Bus bridge: fixed getRoomsSubjects call + fixed dynamic addition of methods + added getLastGroupBlogs method
Goffi <goffi@goffi.org>
parents:
468
diff
changeset
|
531 _arguments = inspect_args.args |
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
|
532 _defaults = list(inspect_args.defaults or []) |
587
952322b1d490
Remove trailing whitespaces.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
572
diff
changeset
|
533 |
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
|
534 if inspect.ismethod(method): |
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
|
535 #if we have a method, we don't want the first argument (usually 'self') |
469
db4c2b82bab6
D-Bus bridge: fixed getRoomsSubjects call + fixed dynamic addition of methods + added getLastGroupBlogs method
Goffi <goffi@goffi.org>
parents:
468
diff
changeset
|
536 del(_arguments[0]) |
300
233e6fce0b49
DBus bridge: using new generated bridge
Goffi <goffi@goffi.org>
parents:
298
diff
changeset
|
537 |
469
db4c2b82bab6
D-Bus bridge: fixed getRoomsSubjects call + fixed dynamic addition of methods + added getLastGroupBlogs method
Goffi <goffi@goffi.org>
parents:
468
diff
changeset
|
538 #first arguments are for the _callback method |
595
1f160467f5de
Fix pep8 support in src/bridge.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
587
diff
changeset
|
539 arguments_callback = ', '.join([repr(name)] + ((_arguments + ['callback=callback', 'errback=errback']) if async else _arguments)) |
587
952322b1d490
Remove trailing whitespaces.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
572
diff
changeset
|
540 |
300
233e6fce0b49
DBus bridge: using new generated bridge
Goffi <goffi@goffi.org>
parents:
298
diff
changeset
|
541 if async: |
595
1f160467f5de
Fix pep8 support in src/bridge.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
587
diff
changeset
|
542 _arguments.extend(['callback', 'errback']) |
469
db4c2b82bab6
D-Bus bridge: fixed getRoomsSubjects call + fixed dynamic addition of methods + added getLastGroupBlogs method
Goffi <goffi@goffi.org>
parents:
468
diff
changeset
|
543 _defaults.extend([None, None]) |
587
952322b1d490
Remove trailing whitespaces.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
572
diff
changeset
|
544 |
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
|
545 #now we create a second list with default values |
595
1f160467f5de
Fix pep8 support in src/bridge.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
587
diff
changeset
|
546 for i in range(1, len(_defaults) + 1): |
469
db4c2b82bab6
D-Bus bridge: fixed getRoomsSubjects call + fixed dynamic addition of methods + added getLastGroupBlogs method
Goffi <goffi@goffi.org>
parents:
468
diff
changeset
|
547 _arguments[-i] = "%s = %s" % (_arguments[-i], repr(_defaults[-i])) |
7
c14a3a7018a5
added dynamic exportation of Dbus bridge method (usefull for plugins)
Goffi <goffi@goffi.org>
parents:
1
diff
changeset
|
548 |
595
1f160467f5de
Fix pep8 support in src/bridge.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
587
diff
changeset
|
549 arguments_defaults = ', '.join(_arguments) |
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
|
550 |
595
1f160467f5de
Fix pep8 support in src/bridge.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
587
diff
changeset
|
551 code = compile('def %(name)s (self,%(arguments_defaults)s): return self._callback(%(arguments_callback)s)' % |
1f160467f5de
Fix pep8 support in src/bridge.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
587
diff
changeset
|
552 {'name': name, 'arguments_defaults': arguments_defaults, 'arguments_callback': arguments_callback}, '<DBus bridge>', 'exec') |
1f160467f5de
Fix pep8 support in src/bridge.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
587
diff
changeset
|
553 exec (code) # FIXME: to the same thing in a cleaner way, without compile/exec |
7
c14a3a7018a5
added dynamic exportation of Dbus bridge method (usefull for plugins)
Goffi <goffi@goffi.org>
parents:
1
diff
changeset
|
554 method = locals()[name] |
300
233e6fce0b49
DBus bridge: using new generated bridge
Goffi <goffi@goffi.org>
parents:
298
diff
changeset
|
555 async_callbacks = ('callback', 'errback') if async else None |
7
c14a3a7018a5
added dynamic exportation of Dbus bridge method (usefull for plugins)
Goffi <goffi@goffi.org>
parents:
1
diff
changeset
|
556 setattr(DbusObject, name, dbus.service.method( |
595
1f160467f5de
Fix pep8 support in src/bridge.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
587
diff
changeset
|
557 const_INT_PREFIX + int_suffix, in_signature=in_sign, out_signature=out_sign, |
300
233e6fce0b49
DBus bridge: using new generated bridge
Goffi <goffi@goffi.org>
parents:
298
diff
changeset
|
558 async_callbacks=async_callbacks)(method)) |
284
c25371424090
dbus bridge: fixed introspection for dynamically added methods and signals
Goffi <goffi@goffi.org>
parents:
274
diff
changeset
|
559 function = getattr(self, name) |
c25371424090
dbus bridge: fixed introspection for dynamically added methods and signals
Goffi <goffi@goffi.org>
parents:
274
diff
changeset
|
560 func_table = self._dbus_class_table[self.__class__.__module__ + '.' + self.__class__.__name__][function._dbus_interface] |
595
1f160467f5de
Fix pep8 support in src/bridge.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
587
diff
changeset
|
561 func_table[function.__name__] = function # Needed for introspection |
587
952322b1d490
Remove trailing whitespaces.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
572
diff
changeset
|
562 |
298
15c8916317d0
dbus bridge: added doc parameter, unmanaged yet
Goffi <goffi@goffi.org>
parents:
284
diff
changeset
|
563 def addSignal(self, name, int_suffix, signature, doc={}): |
73 | 564 """Dynamically add a signal to Dbus Bridge""" |
300
233e6fce0b49
DBus bridge: using new generated bridge
Goffi <goffi@goffi.org>
parents:
298
diff
changeset
|
565 attributes = ', '.join(self.__attributes(signature)) |
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
|
566 #TODO: use doc parameter to name attributes |
73 | 567 |
993
301b342c697a
core: use of the new core.log module:
Goffi <goffi@goffi.org>
parents:
963
diff
changeset
|
568 #code = compile ('def '+name+' (self,'+attributes+'): log.debug ("'+name+' signal")', '<DBus bridge>','exec') #XXX: the log.debug is too annoying with xmllog |
595
1f160467f5de
Fix pep8 support in src/bridge.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
587
diff
changeset
|
569 code = compile('def ' + name + ' (self,' + attributes + '): pass', '<DBus bridge>', 'exec') |
73 | 570 exec (code) |
571 signal = locals()[name] | |
572 setattr(DbusObject, name, dbus.service.signal( | |
595
1f160467f5de
Fix pep8 support in src/bridge.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
587
diff
changeset
|
573 const_INT_PREFIX + int_suffix, signature=signature)(signal)) |
284
c25371424090
dbus bridge: fixed introspection for dynamically added methods and signals
Goffi <goffi@goffi.org>
parents:
274
diff
changeset
|
574 function = getattr(self, name) |
c25371424090
dbus bridge: fixed introspection for dynamically added methods and signals
Goffi <goffi@goffi.org>
parents:
274
diff
changeset
|
575 func_table = self._dbus_class_table[self.__class__.__module__ + '.' + self.__class__.__name__][function._dbus_interface] |
595
1f160467f5de
Fix pep8 support in src/bridge.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
587
diff
changeset
|
576 func_table[function.__name__] = function # Needed for introspection |
1f160467f5de
Fix pep8 support in src/bridge.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
587
diff
changeset
|
577 |
7
c14a3a7018a5
added dynamic exportation of Dbus bridge method (usefull for plugins)
Goffi <goffi@goffi.org>
parents:
1
diff
changeset
|
578 |
0 | 579 class DBusBridge(Bridge): |
580 def __init__(self): | |
581 dbus.mainloop.glib.DBusGMainLoop(set_as_default=True) | |
582 Bridge.__init__(self) | |
993
301b342c697a
core: use of the new core.log module:
Goffi <goffi@goffi.org>
parents:
963
diff
changeset
|
583 log.info("Init DBus...") |
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
|
584 try: |
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
|
585 self.session_bus = dbus.SessionBus() |
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
|
586 except dbus.DBusException as e: |
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
|
587 if e._dbus_error_name == 'org.freedesktop.DBus.Error.NotSupported': |
993
301b342c697a
core: use of the new core.log module:
Goffi <goffi@goffi.org>
parents:
963
diff
changeset
|
588 log.error(_(u"D-Bus is not launched, please see README to see instructions on how to launch it")) |
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
|
589 raise BridgeInitError |
10 | 590 self.dbus_name = dbus.service.BusName(const_INT_PREFIX, self.session_bus) |
360 | 591 self.dbus_bridge = DbusObject(self.session_bus, const_OBJ_PATH) |
0 | 592 |
1599
e2ed8009e66e
backend, bridge, frontends: actionNew has now a security_limit argument + added some docstring to explain data argument
Goffi <goffi@goffi.org>
parents:
1595
diff
changeset
|
593 def actionNew(self, action_data, id, security_limit, profile): |
e2ed8009e66e
backend, bridge, frontends: actionNew has now a security_limit argument + added some docstring to explain data argument
Goffi <goffi@goffi.org>
parents:
1595
diff
changeset
|
594 self.dbus_bridge.actionNew(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
|
595 |
538
2c4016921403
core, frontends, bridgen plugins: fixed methods which were unproperly managing multi-profiles
Goffi <goffi@goffi.org>
parents:
513
diff
changeset
|
596 def actionResult(self, answer_type, id, data, profile): |
2c4016921403
core, frontends, bridgen plugins: fixed methods which were unproperly managing multi-profiles
Goffi <goffi@goffi.org>
parents:
513
diff
changeset
|
597 self.dbus_bridge.actionResult(answer_type, id, data, profile) |
267 | 598 |
538
2c4016921403
core, frontends, bridgen plugins: fixed methods which were unproperly managing multi-profiles
Goffi <goffi@goffi.org>
parents:
513
diff
changeset
|
599 def actionResultExt(self, answer_type, id, data, profile): |
2c4016921403
core, frontends, bridgen plugins: fixed methods which were unproperly managing multi-profiles
Goffi <goffi@goffi.org>
parents:
513
diff
changeset
|
600 self.dbus_bridge.actionResultExt(answer_type, id, data, profile) |
267 | 601 |
541
8b116fa42a31
core, bridge: waiting confirmation management (new getWaitingConf method)
Goffi <goffi@goffi.org>
parents:
538
diff
changeset
|
602 def askConfirmation(self, id, conf_type, data, profile): |
8b116fa42a31
core, bridge: waiting confirmation management (new getWaitingConf method)
Goffi <goffi@goffi.org>
parents:
538
diff
changeset
|
603 self.dbus_bridge.askConfirmation(id, conf_type, data, profile) |
267 | 604 |
1435
7590bbf44eed
bridge, quick_frontend: the JID that is assigned by the server can differ from the one we asked for (resource)
souliane <souliane@mailoo.org>
parents:
1414
diff
changeset
|
605 def connected(self, profile, jid_s): |
7590bbf44eed
bridge, quick_frontend: the JID that is assigned by the server can differ from the one we asked for (resource)
souliane <souliane@mailoo.org>
parents:
1414
diff
changeset
|
606 self.dbus_bridge.connected(profile, jid_s) |
267 | 607 |
387
e66d300c5d42
frontends, bridge: sendFile method signature change + jid parameters in bridge now use _jid suffix
Goffi <goffi@goffi.org>
parents:
371
diff
changeset
|
608 def contactDeleted(self, entity_jid, profile): |
e66d300c5d42
frontends, bridge: sendFile method signature change + jid parameters in bridge now use _jid suffix
Goffi <goffi@goffi.org>
parents:
371
diff
changeset
|
609 self.dbus_bridge.contactDeleted(entity_jid, profile) |
267 | 610 |
66
8147b4f40809
SàT: multi-profile: DBus signals and frontend adaptation (first draft)
Goffi <goffi@goffi.org>
parents:
65
diff
changeset
|
611 def disconnected(self, profile): |
8147b4f40809
SàT: multi-profile: DBus signals and frontend adaptation (first draft)
Goffi <goffi@goffi.org>
parents:
65
diff
changeset
|
612 self.dbus_bridge.disconnected(profile) |
267 | 613 |
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
|
614 def entityDataUpdated(self, jid, name, value, profile): |
65ecbb473cbb
core, quick frontend, plugin xep-0054, bridge: use of memory's entities data for vcard:
Goffi <goffi@goffi.org>
parents:
501
diff
changeset
|
615 self.dbus_bridge.entityDataUpdated(jid, name, value, profile) |
65ecbb473cbb
core, quick frontend, plugin xep-0054, bridge: use of memory's entities data for vcard:
Goffi <goffi@goffi.org>
parents:
501
diff
changeset
|
616 |
267 | 617 def newAlert(self, message, title, alert_type, profile): |
618 self.dbus_bridge.newAlert(message, title, alert_type, profile) | |
619 | |
387
e66d300c5d42
frontends, bridge: sendFile method signature change + jid parameters in bridge now use _jid suffix
Goffi <goffi@goffi.org>
parents:
371
diff
changeset
|
620 def newContact(self, contact_jid, attributes, groups, profile): |
e66d300c5d42
frontends, bridge: sendFile method signature change + jid parameters in bridge now use _jid suffix
Goffi <goffi@goffi.org>
parents:
371
diff
changeset
|
621 self.dbus_bridge.newContact(contact_jid, attributes, groups, profile) |
0 | 622 |
513
8ee9113d307b
core, quick_frontend, primitivus, wixi, bridge: fixed delayed message timestamp:
Goffi <goffi@goffi.org>
parents:
512
diff
changeset
|
623 def newMessage(self, from_jid, message, mess_type, to_jid, extra, profile): |
8ee9113d307b
core, quick_frontend, primitivus, wixi, bridge: fixed delayed message timestamp:
Goffi <goffi@goffi.org>
parents:
512
diff
changeset
|
624 self.dbus_bridge.newMessage(from_jid, message, mess_type, to_jid, extra, profile) |
0 | 625 |
267 | 626 def paramUpdate(self, name, value, category, profile): |
627 self.dbus_bridge.paramUpdate(name, value, category, profile) | |
628 | |
387
e66d300c5d42
frontends, bridge: sendFile method signature change + jid parameters in bridge now use _jid suffix
Goffi <goffi@goffi.org>
parents:
371
diff
changeset
|
629 def presenceUpdate(self, entity_jid, show, priority, statuses, profile): |
e66d300c5d42
frontends, bridge: sendFile method signature change + jid parameters in bridge now use _jid suffix
Goffi <goffi@goffi.org>
parents:
371
diff
changeset
|
630 self.dbus_bridge.presenceUpdate(entity_jid, show, priority, statuses, profile) |
49 | 631 |
1522
7d7e57a84792
core: progression handling improvments:
Goffi <goffi@goffi.org>
parents:
1482
diff
changeset
|
632 def progressError(self, error, profile, arg_2): |
7d7e57a84792
core: progression handling improvments:
Goffi <goffi@goffi.org>
parents:
1482
diff
changeset
|
633 self.dbus_bridge.progressError(error, profile, arg_2) |
7d7e57a84792
core: progression handling improvments:
Goffi <goffi@goffi.org>
parents:
1482
diff
changeset
|
634 |
7d7e57a84792
core: progression handling improvments:
Goffi <goffi@goffi.org>
parents:
1482
diff
changeset
|
635 def progressFinished(self, id, profile): |
7d7e57a84792
core: progression handling improvments:
Goffi <goffi@goffi.org>
parents:
1482
diff
changeset
|
636 self.dbus_bridge.progressFinished(id, profile) |
7d7e57a84792
core: progression handling improvments:
Goffi <goffi@goffi.org>
parents:
1482
diff
changeset
|
637 |
7d7e57a84792
core: progression handling improvments:
Goffi <goffi@goffi.org>
parents:
1482
diff
changeset
|
638 def progressStarted(self, id, profile): |
7d7e57a84792
core: progression handling improvments:
Goffi <goffi@goffi.org>
parents:
1482
diff
changeset
|
639 self.dbus_bridge.progressStarted(id, profile) |
7d7e57a84792
core: progression handling improvments:
Goffi <goffi@goffi.org>
parents:
1482
diff
changeset
|
640 |
387
e66d300c5d42
frontends, bridge: sendFile method signature change + jid parameters in bridge now use _jid suffix
Goffi <goffi@goffi.org>
parents:
371
diff
changeset
|
641 def subscribe(self, sub_type, entity_jid, profile): |
e66d300c5d42
frontends, bridge: sendFile method signature change + jid parameters in bridge now use _jid suffix
Goffi <goffi@goffi.org>
parents:
371
diff
changeset
|
642 self.dbus_bridge.subscribe(sub_type, entity_jid, profile) |
0 | 643 |
644 def register(self, name, callback): | |
993
301b342c697a
core: use of the new core.log module:
Goffi <goffi@goffi.org>
parents:
963
diff
changeset
|
645 log.debug("registering DBus bridge method [%s]" % name) |
0 | 646 self.dbus_bridge.register(name, callback) |
647 | |
300
233e6fce0b49
DBus bridge: using new generated bridge
Goffi <goffi@goffi.org>
parents:
298
diff
changeset
|
648 def addMethod(self, name, int_suffix, in_sign, out_sign, method, async=False, doc={}): |
7
c14a3a7018a5
added dynamic exportation of Dbus bridge method (usefull for plugins)
Goffi <goffi@goffi.org>
parents:
1
diff
changeset
|
649 """Dynamically add a method to Dbus Bridge""" |
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
|
650 #FIXME: doc parameter is kept only temporary, the time to remove it from calls |
993
301b342c697a
core: use of the new core.log module:
Goffi <goffi@goffi.org>
parents:
963
diff
changeset
|
651 log.debug("Adding method [%s] to DBus bridge" % name) |
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
|
652 self.dbus_bridge.addMethod(name, int_suffix, in_sign, out_sign, method, async) |
7
c14a3a7018a5
added dynamic exportation of Dbus bridge method (usefull for plugins)
Goffi <goffi@goffi.org>
parents:
1
diff
changeset
|
653 self.register(name, method) |
c14a3a7018a5
added dynamic exportation of Dbus bridge method (usefull for plugins)
Goffi <goffi@goffi.org>
parents:
1
diff
changeset
|
654 |
298
15c8916317d0
dbus bridge: added doc parameter, unmanaged yet
Goffi <goffi@goffi.org>
parents:
284
diff
changeset
|
655 def addSignal(self, name, int_suffix, signature, doc={}): |
300
233e6fce0b49
DBus bridge: using new generated bridge
Goffi <goffi@goffi.org>
parents:
298
diff
changeset
|
656 self.dbus_bridge.addSignal(name, int_suffix, signature, doc) |
595
1f160467f5de
Fix pep8 support in src/bridge.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
587
diff
changeset
|
657 setattr(DBusBridge, name, getattr(self.dbus_bridge, name)) |