Mercurial > libervia-backend
annotate frontends/src/bridge/DBus.py @ 1064:7ee9d9db67b9
memory, tools (config): move special config retrieval from memory to tools
author | souliane <souliane@mailoo.org> |
---|---|
date | Mon, 09 Jun 2014 20:40:13 +0200 |
parents | 95758ef3faa8 |
children | d123d61976c8 |
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 communication bridge |
811 | 5 # Copyright (C) 2009, 2010, 2011, 2012, 2013, 2014 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 |
771 | 20 from sat.core.i18n import _ |
1062
95758ef3faa8
bridge: async failures are more detailed (full class name + error message)
souliane <souliane@mailoo.org>
parents:
1059
diff
changeset
|
21 from bridge_frontend import BridgeFrontend, BridgeException |
535
790be337cc41
bridge: fixed D-Bus warning in frontend side of bridge
Goffi <goffi@goffi.org>
parents:
504
diff
changeset
|
22 import dbus |
993
301b342c697a
core: use of the new core.log module:
Goffi <goffi@goffi.org>
parents:
963
diff
changeset
|
23 from sat.core.log import getLogger |
301b342c697a
core: use of the new core.log module:
Goffi <goffi@goffi.org>
parents:
963
diff
changeset
|
24 log = getLogger(__name__) |
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
|
25 from sat.core.exceptions import BridgeExceptionNoService, BridgeInitError |
0 | 26 |
535
790be337cc41
bridge: fixed D-Bus warning in frontend side of bridge
Goffi <goffi@goffi.org>
parents:
504
diff
changeset
|
27 from dbus.mainloop.glib import DBusGMainLoop |
790be337cc41
bridge: fixed D-Bus warning in frontend side of bridge
Goffi <goffi@goffi.org>
parents:
504
diff
changeset
|
28 DBusGMainLoop(set_as_default=True) |
790be337cc41
bridge: fixed D-Bus warning in frontend side of bridge
Goffi <goffi@goffi.org>
parents:
504
diff
changeset
|
29 |
595
1f160467f5de
Fix pep8 support in src/bridge.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
587
diff
changeset
|
30 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
|
31 const_ERROR_PREFIX = const_INT_PREFIX + ".error" |
360 | 32 const_OBJ_PATH = '/org/goffi/SAT/bridge' |
372
f964dcec1611
core: plugins refactored according to bridge + updatedValue now use profile
Goffi <goffi@goffi.org>
parents:
365
diff
changeset
|
33 const_CORE_SUFFIX = ".core" |
f964dcec1611
core: plugins refactored according to bridge + updatedValue now use profile
Goffi <goffi@goffi.org>
parents:
365
diff
changeset
|
34 const_PLUGIN_SUFFIX = ".plugin" |
360 | 35 |
595
1f160467f5de
Fix pep8 support in src/bridge.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
587
diff
changeset
|
36 |
1062
95758ef3faa8
bridge: async failures are more detailed (full class name + error message)
souliane <souliane@mailoo.org>
parents:
1059
diff
changeset
|
37 def dbus_to_bridge_exception(dbus_e): |
95758ef3faa8
bridge: async failures are more detailed (full class name + error message)
souliane <souliane@mailoo.org>
parents:
1059
diff
changeset
|
38 """Convert a DBusException to a BridgeException. |
95758ef3faa8
bridge: async failures are more detailed (full class name + error message)
souliane <souliane@mailoo.org>
parents:
1059
diff
changeset
|
39 |
95758ef3faa8
bridge: async failures are more detailed (full class name + error message)
souliane <souliane@mailoo.org>
parents:
1059
diff
changeset
|
40 @param dbus_e (DBusException) |
95758ef3faa8
bridge: async failures are more detailed (full class name + error message)
souliane <souliane@mailoo.org>
parents:
1059
diff
changeset
|
41 @return: BridgeException |
95758ef3faa8
bridge: async failures are more detailed (full class name + error message)
souliane <souliane@mailoo.org>
parents:
1059
diff
changeset
|
42 """ |
95758ef3faa8
bridge: async failures are more detailed (full class name + error message)
souliane <souliane@mailoo.org>
parents:
1059
diff
changeset
|
43 name = dbus_e.get_dbus_name()[len(const_ERROR_PREFIX) + 1:] |
95758ef3faa8
bridge: async failures are more detailed (full class name + error message)
souliane <souliane@mailoo.org>
parents:
1059
diff
changeset
|
44 return BridgeException(name, dbus_e.get_dbus_message()) |
95758ef3faa8
bridge: async failures are more detailed (full class name + error message)
souliane <souliane@mailoo.org>
parents:
1059
diff
changeset
|
45 |
95758ef3faa8
bridge: async failures are more detailed (full class name + error message)
souliane <souliane@mailoo.org>
parents:
1059
diff
changeset
|
46 |
0 | 47 class DBusBridgeFrontend(BridgeFrontend): |
48 def __init__(self): | |
165
8a2053de6f8c
Frontends: management of unlaunched SàT Backend (information message and exit)
Goffi <goffi@goffi.org>
parents:
136
diff
changeset
|
49 try: |
8a2053de6f8c
Frontends: management of unlaunched SàT Backend (information message and exit)
Goffi <goffi@goffi.org>
parents:
136
diff
changeset
|
50 self.sessions_bus = dbus.SessionBus() |
360 | 51 self.db_object = self.sessions_bus.get_object(const_INT_PREFIX, |
595
1f160467f5de
Fix pep8 support in src/bridge.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
587
diff
changeset
|
52 const_OBJ_PATH) |
372
f964dcec1611
core: plugins refactored according to bridge + updatedValue now use profile
Goffi <goffi@goffi.org>
parents:
365
diff
changeset
|
53 self.db_core_iface = dbus.Interface(self.db_object, |
595
1f160467f5de
Fix pep8 support in src/bridge.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
587
diff
changeset
|
54 dbus_interface=const_INT_PREFIX + const_CORE_SUFFIX) |
372
f964dcec1611
core: plugins refactored according to bridge + updatedValue now use profile
Goffi <goffi@goffi.org>
parents:
365
diff
changeset
|
55 self.db_plugin_iface = dbus.Interface(self.db_object, |
595
1f160467f5de
Fix pep8 support in src/bridge.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
587
diff
changeset
|
56 dbus_interface=const_INT_PREFIX + const_PLUGIN_SUFFIX) |
1f160467f5de
Fix pep8 support in src/bridge.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
587
diff
changeset
|
57 except dbus.exceptions.DBusException, e: |
1f160467f5de
Fix pep8 support in src/bridge.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
587
diff
changeset
|
58 if e._dbus_error_name == 'org.freedesktop.DBus.Error.ServiceUnknown': |
165
8a2053de6f8c
Frontends: management of unlaunched SàT Backend (information message and exit)
Goffi <goffi@goffi.org>
parents:
136
diff
changeset
|
59 raise BridgeExceptionNoService |
627
d207c2186519
core, bridge, jp, quick_frontend: SàT stop more gracefully if bridge can't be initialised:
Goffi <goffi@goffi.org>
parents:
609
diff
changeset
|
60 elif 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
|
61 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
|
62 raise BridgeInitError |
165
8a2053de6f8c
Frontends: management of unlaunched SàT Backend (information message and exit)
Goffi <goffi@goffi.org>
parents:
136
diff
changeset
|
63 else: |
8a2053de6f8c
Frontends: management of unlaunched SàT Backend (information message and exit)
Goffi <goffi@goffi.org>
parents:
136
diff
changeset
|
64 raise e |
372
f964dcec1611
core: plugins refactored according to bridge + updatedValue now use profile
Goffi <goffi@goffi.org>
parents:
365
diff
changeset
|
65 #props = self.db_core_iface.getProperties() |
0 | 66 |
372
f964dcec1611
core: plugins refactored according to bridge + updatedValue now use profile
Goffi <goffi@goffi.org>
parents:
365
diff
changeset
|
67 def register(self, functionName, handler, iface="core"): |
f964dcec1611
core: plugins refactored according to bridge + updatedValue now use profile
Goffi <goffi@goffi.org>
parents:
365
diff
changeset
|
68 if iface == "core": |
f964dcec1611
core: plugins refactored according to bridge + updatedValue now use profile
Goffi <goffi@goffi.org>
parents:
365
diff
changeset
|
69 self.db_core_iface.connect_to_signal(functionName, handler) |
f964dcec1611
core: plugins refactored according to bridge + updatedValue now use profile
Goffi <goffi@goffi.org>
parents:
365
diff
changeset
|
70 elif iface == "plugin": |
f964dcec1611
core: plugins refactored according to bridge + updatedValue now use profile
Goffi <goffi@goffi.org>
parents:
365
diff
changeset
|
71 self.db_plugin_iface.connect_to_signal(functionName, handler) |
f964dcec1611
core: plugins refactored according to bridge + updatedValue now use profile
Goffi <goffi@goffi.org>
parents:
365
diff
changeset
|
72 else: |
993
301b342c697a
core: use of the new core.log module:
Goffi <goffi@goffi.org>
parents:
963
diff
changeset
|
73 log.error(_('Unknown interface')) |
0 | 74 |
568
239abc5484c9
bridge: generic plugin methods handling for frontend side in D-Bus Bridge \o/
Goffi <goffi@goffi.org>
parents:
562
diff
changeset
|
75 def __getattribute__(self, name): |
239abc5484c9
bridge: generic plugin methods handling for frontend side in D-Bus Bridge \o/
Goffi <goffi@goffi.org>
parents:
562
diff
changeset
|
76 """ usual __getattribute__ if the method exists, else try to find a plugin method """ |
239abc5484c9
bridge: generic plugin methods handling for frontend side in D-Bus Bridge \o/
Goffi <goffi@goffi.org>
parents:
562
diff
changeset
|
77 try: |
239abc5484c9
bridge: generic plugin methods handling for frontend side in D-Bus Bridge \o/
Goffi <goffi@goffi.org>
parents:
562
diff
changeset
|
78 return object.__getattribute__(self, name) |
239abc5484c9
bridge: generic plugin methods handling for frontend side in D-Bus Bridge \o/
Goffi <goffi@goffi.org>
parents:
562
diff
changeset
|
79 except AttributeError: |
239abc5484c9
bridge: generic plugin methods handling for frontend side in D-Bus Bridge \o/
Goffi <goffi@goffi.org>
parents:
562
diff
changeset
|
80 # The attribute is not found, we try the plugin proxy to find the requested method |
239abc5484c9
bridge: generic plugin methods handling for frontend side in D-Bus Bridge \o/
Goffi <goffi@goffi.org>
parents:
562
diff
changeset
|
81 |
239abc5484c9
bridge: generic plugin methods handling for frontend side in D-Bus Bridge \o/
Goffi <goffi@goffi.org>
parents:
562
diff
changeset
|
82 def getPluginMethod(*args, **kwargs): |
239abc5484c9
bridge: generic plugin methods handling for frontend side in D-Bus Bridge \o/
Goffi <goffi@goffi.org>
parents:
562
diff
changeset
|
83 # We first check if we have an async call. We detect this in two ways: |
239abc5484c9
bridge: generic plugin methods handling for frontend side in D-Bus Bridge \o/
Goffi <goffi@goffi.org>
parents:
562
diff
changeset
|
84 # - if we have the 'callback' and 'errback' keyword arguments |
239abc5484c9
bridge: generic plugin methods handling for frontend side in D-Bus Bridge \o/
Goffi <goffi@goffi.org>
parents:
562
diff
changeset
|
85 # - or if the last two arguments are callable |
239abc5484c9
bridge: generic plugin methods handling for frontend side in D-Bus Bridge \o/
Goffi <goffi@goffi.org>
parents:
562
diff
changeset
|
86 |
239abc5484c9
bridge: generic plugin methods handling for frontend side in D-Bus Bridge \o/
Goffi <goffi@goffi.org>
parents:
562
diff
changeset
|
87 async = False |
587
952322b1d490
Remove trailing whitespaces.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
572
diff
changeset
|
88 |
568
239abc5484c9
bridge: generic plugin methods handling for frontend side in D-Bus Bridge \o/
Goffi <goffi@goffi.org>
parents:
562
diff
changeset
|
89 if kwargs: |
239abc5484c9
bridge: generic plugin methods handling for frontend side in D-Bus Bridge \o/
Goffi <goffi@goffi.org>
parents:
562
diff
changeset
|
90 if 'callback' in kwargs and 'errback' in kwargs: |
239abc5484c9
bridge: generic plugin methods handling for frontend side in D-Bus Bridge \o/
Goffi <goffi@goffi.org>
parents:
562
diff
changeset
|
91 async = True |
239abc5484c9
bridge: generic plugin methods handling for frontend side in D-Bus Bridge \o/
Goffi <goffi@goffi.org>
parents:
562
diff
changeset
|
92 _callback = kwargs.pop('callback') |
239abc5484c9
bridge: generic plugin methods handling for frontend side in D-Bus Bridge \o/
Goffi <goffi@goffi.org>
parents:
562
diff
changeset
|
93 _errback = kwargs.pop('errback') |
595
1f160467f5de
Fix pep8 support in src/bridge.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
587
diff
changeset
|
94 elif len(args) >= 2 and callable(args[-1]) and callable(args[-2]): |
568
239abc5484c9
bridge: generic plugin methods handling for frontend side in D-Bus Bridge \o/
Goffi <goffi@goffi.org>
parents:
562
diff
changeset
|
95 async = True |
239abc5484c9
bridge: generic plugin methods handling for frontend side in D-Bus Bridge \o/
Goffi <goffi@goffi.org>
parents:
562
diff
changeset
|
96 args = list(args) |
239abc5484c9
bridge: generic plugin methods handling for frontend side in D-Bus Bridge \o/
Goffi <goffi@goffi.org>
parents:
562
diff
changeset
|
97 _errback = args.pop() |
239abc5484c9
bridge: generic plugin methods handling for frontend side in D-Bus Bridge \o/
Goffi <goffi@goffi.org>
parents:
562
diff
changeset
|
98 _callback = args.pop() |
587
952322b1d490
Remove trailing whitespaces.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
572
diff
changeset
|
99 |
568
239abc5484c9
bridge: generic plugin methods handling for frontend side in D-Bus Bridge \o/
Goffi <goffi@goffi.org>
parents:
562
diff
changeset
|
100 method = getattr(self.db_plugin_iface, name) |
587
952322b1d490
Remove trailing whitespaces.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
572
diff
changeset
|
101 |
568
239abc5484c9
bridge: generic plugin methods handling for frontend side in D-Bus Bridge \o/
Goffi <goffi@goffi.org>
parents:
562
diff
changeset
|
102 if async: |
239abc5484c9
bridge: generic plugin methods handling for frontend side in D-Bus Bridge \o/
Goffi <goffi@goffi.org>
parents:
562
diff
changeset
|
103 kwargs['reply_handler'] = _callback |
1062
95758ef3faa8
bridge: async failures are more detailed (full class name + error message)
souliane <souliane@mailoo.org>
parents:
1059
diff
changeset
|
104 kwargs['error_handler'] = lambda err: _errback(dbus_to_bridge_exception(err)) |
568
239abc5484c9
bridge: generic plugin methods handling for frontend side in D-Bus Bridge \o/
Goffi <goffi@goffi.org>
parents:
562
diff
changeset
|
105 |
239abc5484c9
bridge: generic plugin methods handling for frontend side in D-Bus Bridge \o/
Goffi <goffi@goffi.org>
parents:
562
diff
changeset
|
106 return method(*args, **kwargs) |
587
952322b1d490
Remove trailing whitespaces.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
572
diff
changeset
|
107 |
568
239abc5484c9
bridge: generic plugin methods handling for frontend side in D-Bus Bridge \o/
Goffi <goffi@goffi.org>
parents:
562
diff
changeset
|
108 return getPluginMethod |
387
e66d300c5d42
frontends, bridge: sendFile method signature change + jid parameters in bridge now use _jid suffix
Goffi <goffi@goffi.org>
parents:
372
diff
changeset
|
109 def addContact(self, entity_jid, profile_key="@DEFAULT@"): |
e66d300c5d42
frontends, bridge: sendFile method signature change + jid parameters in bridge now use _jid suffix
Goffi <goffi@goffi.org>
parents:
372
diff
changeset
|
110 return self.db_core_iface.addContact(entity_jid, profile_key) |
272
1d2e0dfe7114
bridge: core & frontend sides of bridge are now generated
Goffi <goffi@goffi.org>
parents:
267
diff
changeset
|
111 |
1030
15f43b54d697
core, memory, bridge: added profile password + password encryption:
souliane <souliane@mailoo.org>
parents:
1024
diff
changeset
|
112 def asyncConnect(self, profile_key="@DEFAULT@", password='', callback=None, errback=None): |
1062
95758ef3faa8
bridge: async failures are more detailed (full class name + error message)
souliane <souliane@mailoo.org>
parents:
1059
diff
changeset
|
113 return self.db_core_iface.asyncConnect(profile_key, password, reply_handler=callback, error_handler=lambda err:errback(dbus_to_bridge_exception(err))) |
421
28e4299d4553
primitivus: profile manager updated to use new asynchronous profile creation
Goffi <goffi@goffi.org>
parents:
413
diff
changeset
|
114 |
1030
15f43b54d697
core, memory, bridge: added profile password + password encryption:
souliane <souliane@mailoo.org>
parents:
1024
diff
changeset
|
115 def asyncCreateProfile(self, profile, password='', callback=None, errback=None): |
1062
95758ef3faa8
bridge: async failures are more detailed (full class name + error message)
souliane <souliane@mailoo.org>
parents:
1059
diff
changeset
|
116 return self.db_core_iface.asyncCreateProfile(profile, password, reply_handler=callback, error_handler=lambda err:errback(dbus_to_bridge_exception(err))) |
337
4402ac630712
bridge: async callback managed in bridge_constructor + misc
Goffi <goffi@goffi.org>
parents:
336
diff
changeset
|
117 |
893
308a96bc7c1b
core, frontends: add method asyncDeleteProfile, remove synchronous methods createProfile and deleteProfile
souliane <souliane@mailoo.org>
parents:
811
diff
changeset
|
118 def asyncDeleteProfile(self, profile, callback=None, errback=None): |
1062
95758ef3faa8
bridge: async failures are more detailed (full class name + error message)
souliane <souliane@mailoo.org>
parents:
1059
diff
changeset
|
119 return self.db_core_iface.asyncDeleteProfile(profile, reply_handler=callback, error_handler=lambda err:errback(dbus_to_bridge_exception(err))) |
893
308a96bc7c1b
core, frontends: add method asyncDeleteProfile, remove synchronous methods createProfile and deleteProfile
souliane <souliane@mailoo.org>
parents:
811
diff
changeset
|
120 |
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
|
121 def asyncGetParamA(self, name, category, attribute="value", security_limit=-1, profile_key="@DEFAULT@", callback=None, errback=None): |
1062
95758ef3faa8
bridge: async failures are more detailed (full class name + error message)
souliane <souliane@mailoo.org>
parents:
1059
diff
changeset
|
122 return unicode(self.db_core_iface.asyncGetParamA(name, category, attribute, security_limit, profile_key, reply_handler=callback, error_handler=lambda err:errback(dbus_to_bridge_exception(err)))) |
413
dd4caab17008
core: - individual parameters managed through sqlite
Goffi <goffi@goffi.org>
parents:
405
diff
changeset
|
123 |
538
2c4016921403
core, frontends, bridgen plugins: fixed methods which were unproperly managing multi-profiles
Goffi <goffi@goffi.org>
parents:
535
diff
changeset
|
124 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:
535
diff
changeset
|
125 return self.db_core_iface.confirmationAnswer(id, accepted, data, profile) |
272
1d2e0dfe7114
bridge: core & frontend sides of bridge are now generated
Goffi <goffi@goffi.org>
parents:
267
diff
changeset
|
126 |
387
e66d300c5d42
frontends, bridge: sendFile method signature change + jid parameters in bridge now use _jid suffix
Goffi <goffi@goffi.org>
parents:
372
diff
changeset
|
127 def delContact(self, entity_jid, profile_key="@DEFAULT@"): |
e66d300c5d42
frontends, bridge: sendFile method signature change + jid parameters in bridge now use _jid suffix
Goffi <goffi@goffi.org>
parents:
372
diff
changeset
|
128 return self.db_core_iface.delContact(entity_jid, profile_key) |
272
1d2e0dfe7114
bridge: core & frontend sides of bridge are now generated
Goffi <goffi@goffi.org>
parents:
267
diff
changeset
|
129 |
963
723f28cd15c7
core (disco): added discoInfos and discoItems bridge methods
Goffi <goffi@goffi.org>
parents:
943
diff
changeset
|
130 def discoInfos(self, entity_jid, profile_key, callback=None, errback=None): |
1062
95758ef3faa8
bridge: async failures are more detailed (full class name + error message)
souliane <souliane@mailoo.org>
parents:
1059
diff
changeset
|
131 return self.db_core_iface.discoInfos(entity_jid, profile_key, reply_handler=callback, error_handler=lambda err:errback(dbus_to_bridge_exception(err))) |
963
723f28cd15c7
core (disco): added discoInfos and discoItems bridge methods
Goffi <goffi@goffi.org>
parents:
943
diff
changeset
|
132 |
723f28cd15c7
core (disco): added discoInfos and discoItems bridge methods
Goffi <goffi@goffi.org>
parents:
943
diff
changeset
|
133 def discoItems(self, entity_jid, profile_key, callback=None, errback=None): |
1062
95758ef3faa8
bridge: async failures are more detailed (full class name + error message)
souliane <souliane@mailoo.org>
parents:
1059
diff
changeset
|
134 return self.db_core_iface.discoItems(entity_jid, profile_key, reply_handler=callback, error_handler=lambda err:errback(dbus_to_bridge_exception(err))) |
963
723f28cd15c7
core (disco): added discoInfos and discoItems bridge methods
Goffi <goffi@goffi.org>
parents:
943
diff
changeset
|
135 |
272
1d2e0dfe7114
bridge: core & frontend sides of bridge are now generated
Goffi <goffi@goffi.org>
parents:
267
diff
changeset
|
136 def disconnect(self, profile_key="@DEFAULT@"): |
372
f964dcec1611
core: plugins refactored according to bridge + updatedValue now use profile
Goffi <goffi@goffi.org>
parents:
365
diff
changeset
|
137 return self.db_core_iface.disconnect(profile_key) |
272
1d2e0dfe7114
bridge: core & frontend sides of bridge are now generated
Goffi <goffi@goffi.org>
parents:
267
diff
changeset
|
138 |
365
efbfccfed623
core: local_dir moved to config file
Goffi <goffi@goffi.org>
parents:
364
diff
changeset
|
139 def getConfig(self, section, name): |
372
f964dcec1611
core: plugins refactored according to bridge + updatedValue now use profile
Goffi <goffi@goffi.org>
parents:
365
diff
changeset
|
140 return unicode(self.db_core_iface.getConfig(section, name)) |
364 | 141 |
272
1d2e0dfe7114
bridge: core & frontend sides of bridge are now generated
Goffi <goffi@goffi.org>
parents:
267
diff
changeset
|
142 def getContacts(self, profile_key="@DEFAULT@"): |
372
f964dcec1611
core: plugins refactored according to bridge + updatedValue now use profile
Goffi <goffi@goffi.org>
parents:
365
diff
changeset
|
143 return self.db_core_iface.getContacts(profile_key) |
272
1d2e0dfe7114
bridge: core & frontend sides of bridge are now generated
Goffi <goffi@goffi.org>
parents:
267
diff
changeset
|
144 |
501
e9634d2e7b38
core, quick_frontend, primitivus, wix: Contacts List refactoring phase 1:
Goffi <goffi@goffi.org>
parents:
492
diff
changeset
|
145 def getContactsFromGroup(self, group, profile_key="@DEFAULT@"): |
e9634d2e7b38
core, quick_frontend, primitivus, wix: Contacts List refactoring phase 1:
Goffi <goffi@goffi.org>
parents:
492
diff
changeset
|
146 return self.db_core_iface.getContactsFromGroup(group, profile_key) |
e9634d2e7b38
core, quick_frontend, primitivus, wix: Contacts List refactoring phase 1:
Goffi <goffi@goffi.org>
parents:
492
diff
changeset
|
147 |
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
|
148 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
|
149 return self.db_core_iface.getEntityData(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
|
150 |
538
2c4016921403
core, frontends, bridgen plugins: fixed methods which were unproperly managing multi-profiles
Goffi <goffi@goffi.org>
parents:
535
diff
changeset
|
151 def getHistory(self, from_jid, to_jid, limit, between=True, profile="@NONE@", callback=None, errback=None): |
1062
95758ef3faa8
bridge: async failures are more detailed (full class name + error message)
souliane <souliane@mailoo.org>
parents:
1059
diff
changeset
|
152 return self.db_core_iface.getHistory(from_jid, to_jid, limit, between, profile, reply_handler=callback, error_handler=lambda err:errback(dbus_to_bridge_exception(err))) |
272
1d2e0dfe7114
bridge: core & frontend sides of bridge are now generated
Goffi <goffi@goffi.org>
parents:
267
diff
changeset
|
153 |
399 | 154 def getLastResource(self, contact_jid, profile_key="@DEFAULT@"): |
155 return unicode(self.db_core_iface.getLastResource(contact_jid, profile_key)) | |
156 | |
773 | 157 def getMenuHelp(self, menu_id, language): |
158 return unicode(self.db_core_iface.getMenuHelp(menu_id, language)) | |
272
1d2e0dfe7114
bridge: core & frontend sides of bridge are now generated
Goffi <goffi@goffi.org>
parents:
267
diff
changeset
|
159 |
773 | 160 def getMenus(self, language, security_limit): |
161 return self.db_core_iface.getMenus(language, security_limit) | |
272
1d2e0dfe7114
bridge: core & frontend sides of bridge are now generated
Goffi <goffi@goffi.org>
parents:
267
diff
changeset
|
162 |
1d2e0dfe7114
bridge: core & frontend sides of bridge are now generated
Goffi <goffi@goffi.org>
parents:
267
diff
changeset
|
163 def getParamA(self, name, category, attribute="value", profile_key="@DEFAULT@"): |
372
f964dcec1611
core: plugins refactored according to bridge + updatedValue now use profile
Goffi <goffi@goffi.org>
parents:
365
diff
changeset
|
164 return unicode(self.db_core_iface.getParamA(name, category, attribute, profile_key)) |
272
1d2e0dfe7114
bridge: core & frontend sides of bridge are now generated
Goffi <goffi@goffi.org>
parents:
267
diff
changeset
|
165 |
777
5642939d254e
core, bridge: new method paramsRegisterApp to register frontend's specific parameters
souliane <souliane@mailoo.org>
parents:
773
diff
changeset
|
166 def getParams(self, security_limit=-1, app='', profile_key="@DEFAULT@", callback=None, errback=None): |
1062
95758ef3faa8
bridge: async failures are more detailed (full class name + error message)
souliane <souliane@mailoo.org>
parents:
1059
diff
changeset
|
167 return unicode(self.db_core_iface.getParams(security_limit, app, profile_key, reply_handler=callback, error_handler=lambda err:errback(dbus_to_bridge_exception(err)))) |
272
1d2e0dfe7114
bridge: core & frontend sides of bridge are now generated
Goffi <goffi@goffi.org>
parents:
267
diff
changeset
|
168 |
1d2e0dfe7114
bridge: core & frontend sides of bridge are now generated
Goffi <goffi@goffi.org>
parents:
267
diff
changeset
|
169 def getParamsCategories(self, ): |
372
f964dcec1611
core: plugins refactored according to bridge + updatedValue now use profile
Goffi <goffi@goffi.org>
parents:
365
diff
changeset
|
170 return self.db_core_iface.getParamsCategories() |
272
1d2e0dfe7114
bridge: core & frontend sides of bridge are now generated
Goffi <goffi@goffi.org>
parents:
267
diff
changeset
|
171 |
777
5642939d254e
core, bridge: new method paramsRegisterApp to register frontend's specific parameters
souliane <souliane@mailoo.org>
parents:
773
diff
changeset
|
172 def getParamsForCategory(self, category, security_limit=-1, app='', profile_key="@DEFAULT@", callback=None, errback=None): |
1062
95758ef3faa8
bridge: async failures are more detailed (full class name + error message)
souliane <souliane@mailoo.org>
parents:
1059
diff
changeset
|
173 return unicode(self.db_core_iface.getParamsForCategory(category, security_limit, app, profile_key, reply_handler=callback, error_handler=lambda err:errback(dbus_to_bridge_exception(err)))) |
272
1d2e0dfe7114
bridge: core & frontend sides of bridge are now generated
Goffi <goffi@goffi.org>
parents:
267
diff
changeset
|
174 |
777
5642939d254e
core, bridge: new method paramsRegisterApp to register frontend's specific parameters
souliane <souliane@mailoo.org>
parents:
773
diff
changeset
|
175 def getParamsUI(self, security_limit=-1, app='', profile_key="@DEFAULT@", callback=None, errback=None): |
1062
95758ef3faa8
bridge: async failures are more detailed (full class name + error message)
souliane <souliane@mailoo.org>
parents:
1059
diff
changeset
|
176 return unicode(self.db_core_iface.getParamsUI(security_limit, app, profile_key, reply_handler=callback, error_handler=lambda err:errback(dbus_to_bridge_exception(err)))) |
272
1d2e0dfe7114
bridge: core & frontend sides of bridge are now generated
Goffi <goffi@goffi.org>
parents:
267
diff
changeset
|
177 |
943
71926ec2114d
core (memory): entities cache improvments:
Goffi <goffi@goffi.org>
parents:
917
diff
changeset
|
178 def getPresenceStatuses(self, profile_key="@DEFAULT@"): |
71926ec2114d
core (memory): entities cache improvments:
Goffi <goffi@goffi.org>
parents:
917
diff
changeset
|
179 return self.db_core_iface.getPresenceStatuses(profile_key) |
272
1d2e0dfe7114
bridge: core & frontend sides of bridge are now generated
Goffi <goffi@goffi.org>
parents:
267
diff
changeset
|
180 |
1d2e0dfe7114
bridge: core & frontend sides of bridge are now generated
Goffi <goffi@goffi.org>
parents:
267
diff
changeset
|
181 def getProfileName(self, profile_key="@DEFAULT@"): |
372
f964dcec1611
core: plugins refactored according to bridge + updatedValue now use profile
Goffi <goffi@goffi.org>
parents:
365
diff
changeset
|
182 return unicode(self.db_core_iface.getProfileName(profile_key)) |
272
1d2e0dfe7114
bridge: core & frontend sides of bridge are now generated
Goffi <goffi@goffi.org>
parents:
267
diff
changeset
|
183 |
1d2e0dfe7114
bridge: core & frontend sides of bridge are now generated
Goffi <goffi@goffi.org>
parents:
267
diff
changeset
|
184 def getProfilesList(self, ): |
372
f964dcec1611
core: plugins refactored according to bridge + updatedValue now use profile
Goffi <goffi@goffi.org>
parents:
365
diff
changeset
|
185 return self.db_core_iface.getProfilesList() |
272
1d2e0dfe7114
bridge: core & frontend sides of bridge are now generated
Goffi <goffi@goffi.org>
parents:
267
diff
changeset
|
186 |
538
2c4016921403
core, frontends, bridgen plugins: fixed methods which were unproperly managing multi-profiles
Goffi <goffi@goffi.org>
parents:
535
diff
changeset
|
187 def getProgress(self, id, profile): |
2c4016921403
core, frontends, bridgen plugins: fixed methods which were unproperly managing multi-profiles
Goffi <goffi@goffi.org>
parents:
535
diff
changeset
|
188 return self.db_core_iface.getProgress(id, profile) |
272
1d2e0dfe7114
bridge: core & frontend sides of bridge are now generated
Goffi <goffi@goffi.org>
parents:
267
diff
changeset
|
189 |
1024
7e43ea75cce8
bridge (constructor): fixed D-Bus frontend generator for async method without sig_in + fixed --debug option + regenerated bridge to fix bad frontend D-Bus bridge.
Goffi <goffi@goffi.org>
parents:
1023
diff
changeset
|
190 def getReady(self, callback=None, errback=None): |
1062
95758ef3faa8
bridge: async failures are more detailed (full class name + error message)
souliane <souliane@mailoo.org>
parents:
1059
diff
changeset
|
191 return self.db_core_iface.getReady(reply_handler=callback, error_handler=lambda err:errback(dbus_to_bridge_exception(err))) |
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
|
192 |
272
1d2e0dfe7114
bridge: core & frontend sides of bridge are now generated
Goffi <goffi@goffi.org>
parents:
267
diff
changeset
|
193 def getVersion(self, ): |
372
f964dcec1611
core: plugins refactored according to bridge + updatedValue now use profile
Goffi <goffi@goffi.org>
parents:
365
diff
changeset
|
194 return unicode(self.db_core_iface.getVersion()) |
272
1d2e0dfe7114
bridge: core & frontend sides of bridge are now generated
Goffi <goffi@goffi.org>
parents:
267
diff
changeset
|
195 |
542
3eeb6c865e4d
frontends: incoming files transfer management:
Goffi <goffi@goffi.org>
parents:
538
diff
changeset
|
196 def getWaitingConf(self, profile_key): |
3eeb6c865e4d
frontends: incoming files transfer management:
Goffi <goffi@goffi.org>
parents:
538
diff
changeset
|
197 return self.db_core_iface.getWaitingConf(profile_key) |
3eeb6c865e4d
frontends: incoming files transfer management:
Goffi <goffi@goffi.org>
parents:
538
diff
changeset
|
198 |
272
1d2e0dfe7114
bridge: core & frontend sides of bridge are now generated
Goffi <goffi@goffi.org>
parents:
267
diff
changeset
|
199 def getWaitingSub(self, profile_key="@DEFAULT@"): |
372
f964dcec1611
core: plugins refactored according to bridge + updatedValue now use profile
Goffi <goffi@goffi.org>
parents:
365
diff
changeset
|
200 return self.db_core_iface.getWaitingSub(profile_key) |
272
1d2e0dfe7114
bridge: core & frontend sides of bridge are now generated
Goffi <goffi@goffi.org>
parents:
267
diff
changeset
|
201 |
1d2e0dfe7114
bridge: core & frontend sides of bridge are now generated
Goffi <goffi@goffi.org>
parents:
267
diff
changeset
|
202 def isConnected(self, profile_key="@DEFAULT@"): |
372
f964dcec1611
core: plugins refactored according to bridge + updatedValue now use profile
Goffi <goffi@goffi.org>
parents:
365
diff
changeset
|
203 return self.db_core_iface.isConnected(profile_key) |
272
1d2e0dfe7114
bridge: core & frontend sides of bridge are now generated
Goffi <goffi@goffi.org>
parents:
267
diff
changeset
|
204 |
759
93bd868b8fb6
backend, frontends: callbacks refactoring:
Goffi <goffi@goffi.org>
parents:
755
diff
changeset
|
205 def launchAction(self, callback_id, data, profile_key="@DEFAULT@", callback=None, errback=None): |
1062
95758ef3faa8
bridge: async failures are more detailed (full class name + error message)
souliane <souliane@mailoo.org>
parents:
1059
diff
changeset
|
206 return self.db_core_iface.launchAction(callback_id, data, profile_key, reply_handler=callback, error_handler=lambda err:errback(dbus_to_bridge_exception(err))) |
272
1d2e0dfe7114
bridge: core & frontend sides of bridge are now generated
Goffi <goffi@goffi.org>
parents:
267
diff
changeset
|
207 |
1015
fee00f2e11c2
memory, jp: added jp commands to load/save parameters template
souliane <souliane@mailoo.org>
parents:
993
diff
changeset
|
208 def loadParamsTemplate(self, filename): |
fee00f2e11c2
memory, jp: added jp commands to load/save parameters template
souliane <souliane@mailoo.org>
parents:
993
diff
changeset
|
209 return self.db_core_iface.loadParamsTemplate(filename) |
fee00f2e11c2
memory, jp: added jp commands to load/save parameters template
souliane <souliane@mailoo.org>
parents:
993
diff
changeset
|
210 |
777
5642939d254e
core, bridge: new method paramsRegisterApp to register frontend's specific parameters
souliane <souliane@mailoo.org>
parents:
773
diff
changeset
|
211 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
|
212 return self.db_core_iface.paramsRegisterApp(xml, security_limit, app) |
5642939d254e
core, bridge: new method paramsRegisterApp to register frontend's specific parameters
souliane <souliane@mailoo.org>
parents:
773
diff
changeset
|
213 |
1015
fee00f2e11c2
memory, jp: added jp commands to load/save parameters template
souliane <souliane@mailoo.org>
parents:
993
diff
changeset
|
214 def saveParamsTemplate(self, filename): |
fee00f2e11c2
memory, jp: added jp commands to load/save parameters template
souliane <souliane@mailoo.org>
parents:
993
diff
changeset
|
215 return self.db_core_iface.saveParamsTemplate(filename) |
fee00f2e11c2
memory, jp: added jp commands to load/save parameters template
souliane <souliane@mailoo.org>
parents:
993
diff
changeset
|
216 |
752
f49945d728de
core,bridge: sendMessage bridge method is now async
Goffi <goffi@goffi.org>
parents:
709
diff
changeset
|
217 def sendMessage(self, to_jid, message, subject='', mess_type="auto", extra={}, profile_key="@NONE@", callback=None, errback=None): |
1062
95758ef3faa8
bridge: async failures are more detailed (full class name + error message)
souliane <souliane@mailoo.org>
parents:
1059
diff
changeset
|
218 return self.db_core_iface.sendMessage(to_jid, message, subject, mess_type, extra, profile_key, reply_handler=callback, error_handler=lambda err:errback(dbus_to_bridge_exception(err))) |
272
1d2e0dfe7114
bridge: core & frontend sides of bridge are now generated
Goffi <goffi@goffi.org>
parents:
267
diff
changeset
|
219 |
641
49587e170f53
core: added the security_limit to setParam
souliane <souliane@mailoo.org>
parents:
636
diff
changeset
|
220 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
|
221 return self.db_core_iface.setParam(name, value, category, security_limit, profile_key) |
272
1d2e0dfe7114
bridge: core & frontend sides of bridge are now generated
Goffi <goffi@goffi.org>
parents:
267
diff
changeset
|
222 |
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
|
223 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
|
224 return self.db_core_iface.setPresence(to_jid, show, statuses, profile_key) |
272
1d2e0dfe7114
bridge: core & frontend sides of bridge are now generated
Goffi <goffi@goffi.org>
parents:
267
diff
changeset
|
225 |
1d2e0dfe7114
bridge: core & frontend sides of bridge are now generated
Goffi <goffi@goffi.org>
parents:
267
diff
changeset
|
226 def subscription(self, sub_type, entity, profile_key="@DEFAULT@"): |
372
f964dcec1611
core: plugins refactored according to bridge + updatedValue now use profile
Goffi <goffi@goffi.org>
parents:
365
diff
changeset
|
227 return self.db_core_iface.subscription(sub_type, entity, profile_key) |
272
1d2e0dfe7114
bridge: core & frontend sides of bridge are now generated
Goffi <goffi@goffi.org>
parents:
267
diff
changeset
|
228 |
387
e66d300c5d42
frontends, bridge: sendFile method signature change + jid parameters in bridge now use _jid suffix
Goffi <goffi@goffi.org>
parents:
372
diff
changeset
|
229 def updateContact(self, entity_jid, name, groups, profile_key="@DEFAULT@"): |
e66d300c5d42
frontends, bridge: sendFile method signature change + jid parameters in bridge now use _jid suffix
Goffi <goffi@goffi.org>
parents:
372
diff
changeset
|
230 return self.db_core_iface.updateContact(entity_jid, name, groups, profile_key) |