annotate frontends/src/bridge/dbus_bridge.py @ 2113:9c861d07b5b6

core: added sessionGetInfos bridge method to retrieve various data on current profile session + client.started keep start time
author Goffi <goffi@goffi.org>
date Thu, 05 Jan 2017 22:22:13 +0100
parents f413bfc24458
children 2f264f3df280
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
1934
2daf7b4c6756 use of /usr/bin/env instead of /usr/bin/python in shebang
Goffi <goffi@goffi.org>
parents: 1917
diff changeset
1 #!/usr/bin/env python2
0
goffi@necton2
parents:
diff changeset
2 #-*- coding: utf-8 -*-
goffi@necton2
parents:
diff changeset
3
609
84a6e83157c2 fixed licences in docstrings (they are now in comments)
Goffi <goffi@goffi.org>
parents: 595
diff changeset
4 # SAT communication bridge
1766
d17772b0fe22 copyright update
Goffi <goffi@goffi.org>
parents: 1626
diff changeset
5 # Copyright (C) 2009-2016 Jérôme Poisson (goffi@goffi.org)
0
goffi@necton2
parents:
diff changeset
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
goffi@necton2
parents:
diff changeset
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
goffi@necton2
parents:
diff changeset
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
goffi@necton2
parents:
diff changeset
19
771
bfabeedbf32e core: i18n refactoring:
Goffi <goffi@goffi.org>
parents: 759
diff changeset
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
goffi@necton2
parents:
diff changeset
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
1073
f094583732de bridge: DBusException also transports the twisted failure condition
souliane <souliane@mailoo.org>
parents: 1072
diff changeset
30 import ast
f094583732de bridge: DBusException also transports the twisted failure condition
souliane <souliane@mailoo.org>
parents: 1072
diff changeset
31
595
1f160467f5de Fix pep8 support in src/bridge.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents: 587
diff changeset
32 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
33 const_ERROR_PREFIX = const_INT_PREFIX + ".error"
360
6b5626c37909 bridge: regenerated DBus bridge
Goffi <goffi@goffi.org>
parents: 345
diff changeset
34 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
35 const_CORE_SUFFIX = ".core"
f964dcec1611 core: plugins refactored according to bridge + updatedValue now use profile
Goffi <goffi@goffi.org>
parents: 365
diff changeset
36 const_PLUGIN_SUFFIX = ".plugin"
1072
d123d61976c8 bridge (D-Bus): frontend side now use a 120 s timeout for async calls
Goffi <goffi@goffi.org>
parents: 1062
diff changeset
37 const_TIMEOUT = 120
360
6b5626c37909 bridge: regenerated DBus bridge
Goffi <goffi@goffi.org>
parents: 345
diff changeset
38
595
1f160467f5de Fix pep8 support in src/bridge.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents: 587
diff changeset
39
1062
95758ef3faa8 bridge: async failures are more detailed (full class name + error message)
souliane <souliane@mailoo.org>
parents: 1059
diff changeset
40 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
41 """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
42
95758ef3faa8 bridge: async failures are more detailed (full class name + error message)
souliane <souliane@mailoo.org>
parents: 1059
diff changeset
43 @param dbus_e (DBusException)
95758ef3faa8 bridge: async failures are more detailed (full class name + error message)
souliane <souliane@mailoo.org>
parents: 1059
diff changeset
44 @return: BridgeException
95758ef3faa8 bridge: async failures are more detailed (full class name + error message)
souliane <souliane@mailoo.org>
parents: 1059
diff changeset
45 """
1188
bf2927e6a0f5 frontends (dbus): error is not truncated anymore if it's not a SàT error.
Goffi <goffi@goffi.org>
parents: 1073
diff changeset
46 full_name = dbus_e.get_dbus_name()
bf2927e6a0f5 frontends (dbus): error is not truncated anymore if it's not a SàT error.
Goffi <goffi@goffi.org>
parents: 1073
diff changeset
47 if full_name.startswith(const_ERROR_PREFIX):
bf2927e6a0f5 frontends (dbus): error is not truncated anymore if it's not a SàT error.
Goffi <goffi@goffi.org>
parents: 1073
diff changeset
48 name = dbus_e.get_dbus_name()[len(const_ERROR_PREFIX) + 1:]
bf2927e6a0f5 frontends (dbus): error is not truncated anymore if it's not a SàT error.
Goffi <goffi@goffi.org>
parents: 1073
diff changeset
49 else:
bf2927e6a0f5 frontends (dbus): error is not truncated anymore if it's not a SàT error.
Goffi <goffi@goffi.org>
parents: 1073
diff changeset
50 name = full_name
1073
f094583732de bridge: DBusException also transports the twisted failure condition
souliane <souliane@mailoo.org>
parents: 1072
diff changeset
51 # XXX: dbus_e.args doesn't contain the original DBusException args, but we
f094583732de bridge: DBusException also transports the twisted failure condition
souliane <souliane@mailoo.org>
parents: 1072
diff changeset
52 # receive its serialized form in dbus_e.args[0]. From that we can rebuild
f094583732de bridge: DBusException also transports the twisted failure condition
souliane <souliane@mailoo.org>
parents: 1072
diff changeset
53 # the original arguments list thanks to ast.literal_eval (secure eval).
f094583732de bridge: DBusException also transports the twisted failure condition
souliane <souliane@mailoo.org>
parents: 1072
diff changeset
54 message = dbus_e.get_dbus_message() # similar to dbus_e.args[0]
f094583732de bridge: DBusException also transports the twisted failure condition
souliane <souliane@mailoo.org>
parents: 1072
diff changeset
55 try:
f094583732de bridge: DBusException also transports the twisted failure condition
souliane <souliane@mailoo.org>
parents: 1072
diff changeset
56 message, condition = ast.literal_eval(message)
f094583732de bridge: DBusException also transports the twisted failure condition
souliane <souliane@mailoo.org>
parents: 1072
diff changeset
57 except (SyntaxError, ValueError, TypeError):
f094583732de bridge: DBusException also transports the twisted failure condition
souliane <souliane@mailoo.org>
parents: 1072
diff changeset
58 condition = ''
f094583732de bridge: DBusException also transports the twisted failure condition
souliane <souliane@mailoo.org>
parents: 1072
diff changeset
59 return BridgeException(name, message, condition)
1062
95758ef3faa8 bridge: async failures are more detailed (full class name + error message)
souliane <souliane@mailoo.org>
parents: 1059
diff changeset
60
95758ef3faa8 bridge: async failures are more detailed (full class name + error message)
souliane <souliane@mailoo.org>
parents: 1059
diff changeset
61
2086
4633cfcbcccb bridge (D-Bus): bad design fixes:
Goffi <goffi@goffi.org>
parents: 2083
diff changeset
62 class Bridge(BridgeFrontend):
2091
f413bfc24458 bridge, quick_frontend: preparation for async bridge
Goffi <goffi@goffi.org>
parents: 2086
diff changeset
63
f413bfc24458 bridge, quick_frontend: preparation for async bridge
Goffi <goffi@goffi.org>
parents: 2086
diff changeset
64 def bridgeConnect(self, callback, errback):
165
8a2053de6f8c Frontends: management of unlaunched SàT Backend (information message and exit)
Goffi <goffi@goffi.org>
parents: 136
diff changeset
65 try:
8a2053de6f8c Frontends: management of unlaunched SàT Backend (information message and exit)
Goffi <goffi@goffi.org>
parents: 136
diff changeset
66 self.sessions_bus = dbus.SessionBus()
360
6b5626c37909 bridge: regenerated DBus bridge
Goffi <goffi@goffi.org>
parents: 345
diff changeset
67 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
68 const_OBJ_PATH)
372
f964dcec1611 core: plugins refactored according to bridge + updatedValue now use profile
Goffi <goffi@goffi.org>
parents: 365
diff changeset
69 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
70 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
71 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
72 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
73 except dbus.exceptions.DBusException, e:
1917
05a5a125a238 bridge (frontend): raise a BridgeExceptionNoService on org.freedesktop.DBus.Error.Spawn.ExecFailed D-Bus error
Goffi <goffi@goffi.org>
parents: 1794
diff changeset
74 if e._dbus_error_name in ('org.freedesktop.DBus.Error.ServiceUnknown',
05a5a125a238 bridge (frontend): raise a BridgeExceptionNoService on org.freedesktop.DBus.Error.Spawn.ExecFailed D-Bus error
Goffi <goffi@goffi.org>
parents: 1794
diff changeset
75 'org.freedesktop.DBus.Error.Spawn.ExecFailed'):
2091
f413bfc24458 bridge, quick_frontend: preparation for async bridge
Goffi <goffi@goffi.org>
parents: 2086
diff changeset
76 errback(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
77 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
78 log.error(_(u"D-Bus is not launched, please see README to see instructions on how to launch it"))
2091
f413bfc24458 bridge, quick_frontend: preparation for async bridge
Goffi <goffi@goffi.org>
parents: 2086
diff changeset
79 errback(BridgeInitError)
165
8a2053de6f8c Frontends: management of unlaunched SàT Backend (information message and exit)
Goffi <goffi@goffi.org>
parents: 136
diff changeset
80 else:
2091
f413bfc24458 bridge, quick_frontend: preparation for async bridge
Goffi <goffi@goffi.org>
parents: 2086
diff changeset
81 errback(e)
f413bfc24458 bridge, quick_frontend: preparation for async bridge
Goffi <goffi@goffi.org>
parents: 2086
diff changeset
82 callback()
372
f964dcec1611 core: plugins refactored according to bridge + updatedValue now use profile
Goffi <goffi@goffi.org>
parents: 365
diff changeset
83 #props = self.db_core_iface.getProperties()
0
goffi@necton2
parents:
diff changeset
84
2086
4633cfcbcccb bridge (D-Bus): bad design fixes:
Goffi <goffi@goffi.org>
parents: 2083
diff changeset
85 def register_signal(self, functionName, handler, iface="core"):
372
f964dcec1611 core: plugins refactored according to bridge + updatedValue now use profile
Goffi <goffi@goffi.org>
parents: 365
diff changeset
86 if iface == "core":
f964dcec1611 core: plugins refactored according to bridge + updatedValue now use profile
Goffi <goffi@goffi.org>
parents: 365
diff changeset
87 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
88 elif iface == "plugin":
f964dcec1611 core: plugins refactored according to bridge + updatedValue now use profile
Goffi <goffi@goffi.org>
parents: 365
diff changeset
89 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
90 else:
993
301b342c697a core: use of the new core.log module:
Goffi <goffi@goffi.org>
parents: 963
diff changeset
91 log.error(_('Unknown interface'))
0
goffi@necton2
parents:
diff changeset
92
568
239abc5484c9 bridge: generic plugin methods handling for frontend side in D-Bus Bridge \o/
Goffi <goffi@goffi.org>
parents: 562
diff changeset
93 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
94 """ 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
95 try:
239abc5484c9 bridge: generic plugin methods handling for frontend side in D-Bus Bridge \o/
Goffi <goffi@goffi.org>
parents: 562
diff changeset
96 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
97 except AttributeError:
239abc5484c9 bridge: generic plugin methods handling for frontend side in D-Bus Bridge \o/
Goffi <goffi@goffi.org>
parents: 562
diff changeset
98 # 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
99
239abc5484c9 bridge: generic plugin methods handling for frontend side in D-Bus Bridge \o/
Goffi <goffi@goffi.org>
parents: 562
diff changeset
100 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
101 # 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
102 # - 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
103 # - 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
104
239abc5484c9 bridge: generic plugin methods handling for frontend side in D-Bus Bridge \o/
Goffi <goffi@goffi.org>
parents: 562
diff changeset
105 async = False
1794
b0ed4863dbc7 bridge (D-Bus): fixed handling of profile in kwargs:
Goffi <goffi@goffi.org>
parents: 1766
diff changeset
106 args = list(args)
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 if kwargs:
1290
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
109 if 'callback' in kwargs:
568
239abc5484c9 bridge: generic plugin methods handling for frontend side in D-Bus Bridge \o/
Goffi <goffi@goffi.org>
parents: 562
diff changeset
110 async = True
239abc5484c9 bridge: generic plugin methods handling for frontend side in D-Bus Bridge \o/
Goffi <goffi@goffi.org>
parents: 562
diff changeset
111 _callback = kwargs.pop('callback')
1290
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
112 _errback = kwargs.pop('errback', lambda failure: log.error(unicode(failure)))
1794
b0ed4863dbc7 bridge (D-Bus): fixed handling of profile in kwargs:
Goffi <goffi@goffi.org>
parents: 1766
diff changeset
113 try:
b0ed4863dbc7 bridge (D-Bus): fixed handling of profile in kwargs:
Goffi <goffi@goffi.org>
parents: 1766
diff changeset
114 args.append(kwargs.pop('profile'))
b0ed4863dbc7 bridge (D-Bus): fixed handling of profile in kwargs:
Goffi <goffi@goffi.org>
parents: 1766
diff changeset
115 except KeyError:
b0ed4863dbc7 bridge (D-Bus): fixed handling of profile in kwargs:
Goffi <goffi@goffi.org>
parents: 1766
diff changeset
116 try:
b0ed4863dbc7 bridge (D-Bus): fixed handling of profile in kwargs:
Goffi <goffi@goffi.org>
parents: 1766
diff changeset
117 args.append(kwargs.pop('profile_key'))
b0ed4863dbc7 bridge (D-Bus): fixed handling of profile in kwargs:
Goffi <goffi@goffi.org>
parents: 1766
diff changeset
118 except KeyError:
b0ed4863dbc7 bridge (D-Bus): fixed handling of profile in kwargs:
Goffi <goffi@goffi.org>
parents: 1766
diff changeset
119 pass
b0ed4863dbc7 bridge (D-Bus): fixed handling of profile in kwargs:
Goffi <goffi@goffi.org>
parents: 1766
diff changeset
120 # at this point, kwargs should be empty
b0ed4863dbc7 bridge (D-Bus): fixed handling of profile in kwargs:
Goffi <goffi@goffi.org>
parents: 1766
diff changeset
121 if kwargs:
b0ed4863dbc7 bridge (D-Bus): fixed handling of profile in kwargs:
Goffi <goffi@goffi.org>
parents: 1766
diff changeset
122 log.warnings(u"unexpected keyword arguments, they will be ignored: {}".format(kwargs))
595
1f160467f5de Fix pep8 support in src/bridge.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents: 587
diff changeset
123 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
124 async = True
239abc5484c9 bridge: generic plugin methods handling for frontend side in D-Bus Bridge \o/
Goffi <goffi@goffi.org>
parents: 562
diff changeset
125 _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
126 _callback = args.pop()
587
952322b1d490 Remove trailing whitespaces.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents: 572
diff changeset
127
568
239abc5484c9 bridge: generic plugin methods handling for frontend side in D-Bus Bridge \o/
Goffi <goffi@goffi.org>
parents: 562
diff changeset
128 method = getattr(self.db_plugin_iface, name)
587
952322b1d490 Remove trailing whitespaces.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents: 572
diff changeset
129
568
239abc5484c9 bridge: generic plugin methods handling for frontend side in D-Bus Bridge \o/
Goffi <goffi@goffi.org>
parents: 562
diff changeset
130 if async:
1072
d123d61976c8 bridge (D-Bus): frontend side now use a 120 s timeout for async calls
Goffi <goffi@goffi.org>
parents: 1062
diff changeset
131 kwargs['timeout'] = const_TIMEOUT
568
239abc5484c9 bridge: generic plugin methods handling for frontend side in D-Bus Bridge \o/
Goffi <goffi@goffi.org>
parents: 562
diff changeset
132 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
133 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
134
239abc5484c9 bridge: generic plugin methods handling for frontend side in D-Bus Bridge \o/
Goffi <goffi@goffi.org>
parents: 562
diff changeset
135 return method(*args, **kwargs)
587
952322b1d490 Remove trailing whitespaces.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents: 572
diff changeset
136
568
239abc5484c9 bridge: generic plugin methods handling for frontend side in D-Bus Bridge \o/
Goffi <goffi@goffi.org>
parents: 562
diff changeset
137 return getPluginMethod
1290
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
138
1622
5b24d6bf5d15 core, bridge: actionsGet:
Goffi <goffi@goffi.org>
parents: 1595
diff changeset
139 def actionsGet(self, profile_key="@DEFAULT@", callback=None, errback=None):
5b24d6bf5d15 core, bridge: actionsGet:
Goffi <goffi@goffi.org>
parents: 1595
diff changeset
140 if callback is None:
5b24d6bf5d15 core, bridge: actionsGet:
Goffi <goffi@goffi.org>
parents: 1595
diff changeset
141 error_handler = None
5b24d6bf5d15 core, bridge: actionsGet:
Goffi <goffi@goffi.org>
parents: 1595
diff changeset
142 else:
5b24d6bf5d15 core, bridge: actionsGet:
Goffi <goffi@goffi.org>
parents: 1595
diff changeset
143 if errback is None:
5b24d6bf5d15 core, bridge: actionsGet:
Goffi <goffi@goffi.org>
parents: 1595
diff changeset
144 errback = log.error
5b24d6bf5d15 core, bridge: actionsGet:
Goffi <goffi@goffi.org>
parents: 1595
diff changeset
145 error_handler = lambda err:errback(dbus_to_bridge_exception(err))
5b24d6bf5d15 core, bridge: actionsGet:
Goffi <goffi@goffi.org>
parents: 1595
diff changeset
146 kwargs={}
5b24d6bf5d15 core, bridge: actionsGet:
Goffi <goffi@goffi.org>
parents: 1595
diff changeset
147 if callback is not None:
5b24d6bf5d15 core, bridge: actionsGet:
Goffi <goffi@goffi.org>
parents: 1595
diff changeset
148 kwargs['timeout'] = const_TIMEOUT
5b24d6bf5d15 core, bridge: actionsGet:
Goffi <goffi@goffi.org>
parents: 1595
diff changeset
149 kwargs['reply_handler'] = callback
5b24d6bf5d15 core, bridge: actionsGet:
Goffi <goffi@goffi.org>
parents: 1595
diff changeset
150 kwargs['error_handler'] = error_handler
5b24d6bf5d15 core, bridge: actionsGet:
Goffi <goffi@goffi.org>
parents: 1595
diff changeset
151 return self.db_core_iface.actionsGet(profile_key, **kwargs)
5b24d6bf5d15 core, bridge: actionsGet:
Goffi <goffi@goffi.org>
parents: 1595
diff changeset
152
1290
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
153 def addContact(self, entity_jid, profile_key="@DEFAULT@", callback=None, errback=None):
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
154 if callback is None:
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
155 error_handler = None
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
156 else:
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
157 if errback is None:
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
158 errback = log.error
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
159 error_handler = lambda err:errback(dbus_to_bridge_exception(err))
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
160 kwargs={}
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
161 if callback is not None:
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
162 kwargs['timeout'] = const_TIMEOUT
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
163 kwargs['reply_handler'] = callback
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
164 kwargs['error_handler'] = error_handler
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
165 return self.db_core_iface.addContact(entity_jid, profile_key, **kwargs)
272
1d2e0dfe7114 bridge: core & frontend sides of bridge are now generated
Goffi <goffi@goffi.org>
parents: 267
diff changeset
166
1030
15f43b54d697 core, memory, bridge: added profile password + password encryption:
souliane <souliane@mailoo.org>
parents: 1024
diff changeset
167 def asyncConnect(self, profile_key="@DEFAULT@", password='', callback=None, errback=None):
1290
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
168 if callback is None:
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
169 error_handler = None
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
170 else:
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
171 if errback is None:
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
172 errback = log.error
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
173 error_handler = lambda err:errback(dbus_to_bridge_exception(err))
1237
c1e916594e09 bridge (frontends side): fixed call of async method in blocking context
Goffi <goffi@goffi.org>
parents: 1224
diff changeset
174 return self.db_core_iface.asyncConnect(profile_key, password, timeout=const_TIMEOUT, reply_handler=callback, error_handler=error_handler)
421
28e4299d4553 primitivus: profile manager updated to use new asynchronous profile creation
Goffi <goffi@goffi.org>
parents: 413
diff changeset
175
1030
15f43b54d697 core, memory, bridge: added profile password + password encryption:
souliane <souliane@mailoo.org>
parents: 1024
diff changeset
176 def asyncCreateProfile(self, profile, password='', callback=None, errback=None):
1290
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
177 if callback is None:
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
178 error_handler = None
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
179 else:
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
180 if errback is None:
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
181 errback = log.error
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
182 error_handler = lambda err:errback(dbus_to_bridge_exception(err))
1237
c1e916594e09 bridge (frontends side): fixed call of async method in blocking context
Goffi <goffi@goffi.org>
parents: 1224
diff changeset
183 return self.db_core_iface.asyncCreateProfile(profile, password, timeout=const_TIMEOUT, reply_handler=callback, error_handler=error_handler)
337
4402ac630712 bridge: async callback managed in bridge_constructor + misc
Goffi <goffi@goffi.org>
parents: 336
diff changeset
184
893
308a96bc7c1b core, frontends: add method asyncDeleteProfile, remove synchronous methods createProfile and deleteProfile
souliane <souliane@mailoo.org>
parents: 811
diff changeset
185 def asyncDeleteProfile(self, profile, callback=None, errback=None):
1290
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
186 if callback is None:
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
187 error_handler = None
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
188 else:
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
189 if errback is None:
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
190 errback = log.error
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
191 error_handler = lambda err:errback(dbus_to_bridge_exception(err))
1237
c1e916594e09 bridge (frontends side): fixed call of async method in blocking context
Goffi <goffi@goffi.org>
parents: 1224
diff changeset
192 return self.db_core_iface.asyncDeleteProfile(profile, timeout=const_TIMEOUT, reply_handler=callback, error_handler=error_handler)
893
308a96bc7c1b core, frontends: add method asyncDeleteProfile, remove synchronous methods createProfile and deleteProfile
souliane <souliane@mailoo.org>
parents: 811
diff changeset
193
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
194 def asyncGetParamA(self, name, category, attribute="value", security_limit=-1, profile_key="@DEFAULT@", callback=None, errback=None):
1290
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
195 if callback is None:
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
196 error_handler = None
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
197 else:
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
198 if errback is None:
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
199 errback = log.error
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
200 error_handler = lambda err:errback(dbus_to_bridge_exception(err))
1237
c1e916594e09 bridge (frontends side): fixed call of async method in blocking context
Goffi <goffi@goffi.org>
parents: 1224
diff changeset
201 return unicode(self.db_core_iface.asyncGetParamA(name, category, attribute, security_limit, profile_key, timeout=const_TIMEOUT, reply_handler=callback, error_handler=error_handler))
413
dd4caab17008 core: - individual parameters managed through sqlite
Goffi <goffi@goffi.org>
parents: 405
diff changeset
202
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
203 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
204 if callback is 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
205 error_handler = 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
206 else:
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
207 if errback is 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
208 errback = log.error
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
209 error_handler = lambda err:errback(dbus_to_bridge_exception(err))
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
210 return self.db_core_iface.asyncGetParamsValuesFromCategory(category, security_limit, profile_key, timeout=const_TIMEOUT, reply_handler=callback, error_handler=error_handler)
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
211
1265
e3a9ea76de35 quick_frontend, primitivus: multi-profiles refactoring part 1 (big commit, sorry :p):
Goffi <goffi@goffi.org>
parents: 1237
diff changeset
212 def delContact(self, entity_jid, profile_key="@DEFAULT@", callback=None, errback=None):
1290
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
213 if callback is None:
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
214 error_handler = None
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
215 else:
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
216 if errback is None:
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
217 errback = log.error
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
218 error_handler = lambda err:errback(dbus_to_bridge_exception(err))
1265
e3a9ea76de35 quick_frontend, primitivus: multi-profiles refactoring part 1 (big commit, sorry :p):
Goffi <goffi@goffi.org>
parents: 1237
diff changeset
219 return self.db_core_iface.delContact(entity_jid, profile_key, timeout=const_TIMEOUT, reply_handler=callback, error_handler=error_handler)
272
1d2e0dfe7114 bridge: core & frontend sides of bridge are now generated
Goffi <goffi@goffi.org>
parents: 267
diff changeset
220
963
723f28cd15c7 core (disco): added discoInfos and discoItems bridge methods
Goffi <goffi@goffi.org>
parents: 943
diff changeset
221 def discoInfos(self, entity_jid, profile_key, callback=None, errback=None):
1290
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
222 if callback is None:
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
223 error_handler = None
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
224 else:
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
225 if errback is None:
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
226 errback = log.error
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
227 error_handler = lambda err:errback(dbus_to_bridge_exception(err))
1237
c1e916594e09 bridge (frontends side): fixed call of async method in blocking context
Goffi <goffi@goffi.org>
parents: 1224
diff changeset
228 return self.db_core_iface.discoInfos(entity_jid, profile_key, timeout=const_TIMEOUT, reply_handler=callback, error_handler=error_handler)
963
723f28cd15c7 core (disco): added discoInfos and discoItems bridge methods
Goffi <goffi@goffi.org>
parents: 943
diff changeset
229
723f28cd15c7 core (disco): added discoInfos and discoItems bridge methods
Goffi <goffi@goffi.org>
parents: 943
diff changeset
230 def discoItems(self, entity_jid, profile_key, callback=None, errback=None):
1290
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
231 if callback is None:
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
232 error_handler = None
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
233 else:
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
234 if errback is None:
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
235 errback = log.error
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
236 error_handler = lambda err:errback(dbus_to_bridge_exception(err))
1237
c1e916594e09 bridge (frontends side): fixed call of async method in blocking context
Goffi <goffi@goffi.org>
parents: 1224
diff changeset
237 return self.db_core_iface.discoItems(entity_jid, profile_key, timeout=const_TIMEOUT, reply_handler=callback, error_handler=error_handler)
963
723f28cd15c7 core (disco): added discoInfos and discoItems bridge methods
Goffi <goffi@goffi.org>
parents: 943
diff changeset
238
1290
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
239 def disconnect(self, profile_key="@DEFAULT@", callback=None, errback=None):
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
240 if callback is None:
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
241 error_handler = None
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
242 else:
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
243 if errback is None:
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
244 errback = log.error
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
245 error_handler = lambda err:errback(dbus_to_bridge_exception(err))
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
246 kwargs={}
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
247 if callback is not None:
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
248 kwargs['timeout'] = const_TIMEOUT
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
249 kwargs['reply_handler'] = callback
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
250 kwargs['error_handler'] = error_handler
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
251 return self.db_core_iface.disconnect(profile_key, **kwargs)
272
1d2e0dfe7114 bridge: core & frontend sides of bridge are now generated
Goffi <goffi@goffi.org>
parents: 267
diff changeset
252
1290
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
253 def getConfig(self, section, name, callback=None, errback=None):
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
254 if callback is None:
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
255 error_handler = None
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
256 else:
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
257 if errback is None:
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
258 errback = log.error
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
259 error_handler = lambda err:errback(dbus_to_bridge_exception(err))
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
260 kwargs={}
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
261 if callback is not None:
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
262 kwargs['timeout'] = const_TIMEOUT
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
263 kwargs['reply_handler'] = callback
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
264 kwargs['error_handler'] = error_handler
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
265 return unicode(self.db_core_iface.getConfig(section, name, **kwargs))
364
312ca6f9d84a core: configuration file
Goffi <goffi@goffi.org>
parents: 362
diff changeset
266
1265
e3a9ea76de35 quick_frontend, primitivus: multi-profiles refactoring part 1 (big commit, sorry :p):
Goffi <goffi@goffi.org>
parents: 1237
diff changeset
267 def getContacts(self, profile_key="@DEFAULT@", callback=None, errback=None):
1290
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
268 if callback is None:
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
269 error_handler = None
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
270 else:
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
271 if errback is None:
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
272 errback = log.error
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
273 error_handler = lambda err:errback(dbus_to_bridge_exception(err))
1265
e3a9ea76de35 quick_frontend, primitivus: multi-profiles refactoring part 1 (big commit, sorry :p):
Goffi <goffi@goffi.org>
parents: 1237
diff changeset
274 return self.db_core_iface.getContacts(profile_key, timeout=const_TIMEOUT, reply_handler=callback, error_handler=error_handler)
272
1d2e0dfe7114 bridge: core & frontend sides of bridge are now generated
Goffi <goffi@goffi.org>
parents: 267
diff changeset
275
1290
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
276 def getContactsFromGroup(self, group, profile_key="@DEFAULT@", callback=None, errback=None):
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
277 if callback is None:
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
278 error_handler = None
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
279 else:
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
280 if errback is None:
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
281 errback = log.error
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
282 error_handler = lambda err:errback(dbus_to_bridge_exception(err))
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
283 kwargs={}
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
284 if callback is not None:
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
285 kwargs['timeout'] = const_TIMEOUT
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
286 kwargs['reply_handler'] = callback
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
287 kwargs['error_handler'] = error_handler
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
288 return self.db_core_iface.getContactsFromGroup(group, profile_key, **kwargs)
501
e9634d2e7b38 core, quick_frontend, primitivus, wix: Contacts List refactoring phase 1:
Goffi <goffi@goffi.org>
parents: 492
diff changeset
289
1314
bb9c32249778 core: added getEntitiesData which get cache data for several entities at once
Goffi <goffi@goffi.org>
parents: 1290
diff changeset
290 def getEntitiesData(self, jids, keys, profile, callback=None, errback=None):
bb9c32249778 core: added getEntitiesData which get cache data for several entities at once
Goffi <goffi@goffi.org>
parents: 1290
diff changeset
291 if callback is None:
bb9c32249778 core: added getEntitiesData which get cache data for several entities at once
Goffi <goffi@goffi.org>
parents: 1290
diff changeset
292 error_handler = None
bb9c32249778 core: added getEntitiesData which get cache data for several entities at once
Goffi <goffi@goffi.org>
parents: 1290
diff changeset
293 else:
bb9c32249778 core: added getEntitiesData which get cache data for several entities at once
Goffi <goffi@goffi.org>
parents: 1290
diff changeset
294 if errback is None:
bb9c32249778 core: added getEntitiesData which get cache data for several entities at once
Goffi <goffi@goffi.org>
parents: 1290
diff changeset
295 errback = log.error
bb9c32249778 core: added getEntitiesData which get cache data for several entities at once
Goffi <goffi@goffi.org>
parents: 1290
diff changeset
296 error_handler = lambda err:errback(dbus_to_bridge_exception(err))
bb9c32249778 core: added getEntitiesData which get cache data for several entities at once
Goffi <goffi@goffi.org>
parents: 1290
diff changeset
297 kwargs={}
bb9c32249778 core: added getEntitiesData which get cache data for several entities at once
Goffi <goffi@goffi.org>
parents: 1290
diff changeset
298 if callback is not None:
bb9c32249778 core: added getEntitiesData which get cache data for several entities at once
Goffi <goffi@goffi.org>
parents: 1290
diff changeset
299 kwargs['timeout'] = const_TIMEOUT
bb9c32249778 core: added getEntitiesData which get cache data for several entities at once
Goffi <goffi@goffi.org>
parents: 1290
diff changeset
300 kwargs['reply_handler'] = callback
bb9c32249778 core: added getEntitiesData which get cache data for several entities at once
Goffi <goffi@goffi.org>
parents: 1290
diff changeset
301 kwargs['error_handler'] = error_handler
bb9c32249778 core: added getEntitiesData which get cache data for several entities at once
Goffi <goffi@goffi.org>
parents: 1290
diff changeset
302 return self.db_core_iface.getEntitiesData(jids, keys, profile, **kwargs)
bb9c32249778 core: added getEntitiesData which get cache data for several entities at once
Goffi <goffi@goffi.org>
parents: 1290
diff changeset
303
1290
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
304 def getEntityData(self, jid, keys, profile, callback=None, errback=None):
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
305 if callback is None:
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
306 error_handler = None
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
307 else:
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
308 if errback is None:
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
309 errback = log.error
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
310 error_handler = lambda err:errback(dbus_to_bridge_exception(err))
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
311 kwargs={}
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
312 if callback is not None:
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
313 kwargs['timeout'] = const_TIMEOUT
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
314 kwargs['reply_handler'] = callback
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
315 kwargs['error_handler'] = error_handler
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
316 return self.db_core_iface.getEntityData(jid, keys, profile, **kwargs)
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
317
1482
80cd55dd5b04 core, bridge: added getFeatures method:
Goffi <goffi@goffi.org>
parents: 1396
diff changeset
318 def getFeatures(self, profile_key, callback=None, errback=None):
80cd55dd5b04 core, bridge: added getFeatures method:
Goffi <goffi@goffi.org>
parents: 1396
diff changeset
319 if callback is None:
80cd55dd5b04 core, bridge: added getFeatures method:
Goffi <goffi@goffi.org>
parents: 1396
diff changeset
320 error_handler = None
80cd55dd5b04 core, bridge: added getFeatures method:
Goffi <goffi@goffi.org>
parents: 1396
diff changeset
321 else:
80cd55dd5b04 core, bridge: added getFeatures method:
Goffi <goffi@goffi.org>
parents: 1396
diff changeset
322 if errback is None:
80cd55dd5b04 core, bridge: added getFeatures method:
Goffi <goffi@goffi.org>
parents: 1396
diff changeset
323 errback = log.error
80cd55dd5b04 core, bridge: added getFeatures method:
Goffi <goffi@goffi.org>
parents: 1396
diff changeset
324 error_handler = lambda err:errback(dbus_to_bridge_exception(err))
80cd55dd5b04 core, bridge: added getFeatures method:
Goffi <goffi@goffi.org>
parents: 1396
diff changeset
325 return self.db_core_iface.getFeatures(profile_key, timeout=const_TIMEOUT, reply_handler=callback, error_handler=error_handler)
80cd55dd5b04 core, bridge: added getFeatures method:
Goffi <goffi@goffi.org>
parents: 1396
diff changeset
326
1290
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
327 def getMainResource(self, contact_jid, profile_key="@DEFAULT@", callback=None, errback=None):
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
328 if callback is None:
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
329 error_handler = None
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
330 else:
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
331 if errback is None:
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
332 errback = log.error
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
333 error_handler = lambda err:errback(dbus_to_bridge_exception(err))
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
334 kwargs={}
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
335 if callback is not None:
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
336 kwargs['timeout'] = const_TIMEOUT
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
337 kwargs['reply_handler'] = callback
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
338 kwargs['error_handler'] = error_handler
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
339 return unicode(self.db_core_iface.getMainResource(contact_jid, profile_key, **kwargs))
399
3ed53803b3b3 core: added getLastResource method
Goffi <goffi@goffi.org>
parents: 387
diff changeset
340
1290
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
341 def getMenuHelp(self, menu_id, language, callback=None, errback=None):
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
342 if callback is None:
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
343 error_handler = None
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
344 else:
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
345 if errback is None:
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
346 errback = log.error
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
347 error_handler = lambda err:errback(dbus_to_bridge_exception(err))
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
348 kwargs={}
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
349 if callback is not None:
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
350 kwargs['timeout'] = const_TIMEOUT
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
351 kwargs['reply_handler'] = callback
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
352 kwargs['error_handler'] = error_handler
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
353 return unicode(self.db_core_iface.getMenuHelp(menu_id, language, **kwargs))
272
1d2e0dfe7114 bridge: core & frontend sides of bridge are now generated
Goffi <goffi@goffi.org>
parents: 267
diff changeset
354
1290
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
355 def getMenus(self, language, security_limit, callback=None, errback=None):
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
356 if callback is None:
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
357 error_handler = None
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
358 else:
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
359 if errback is None:
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
360 errback = log.error
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
361 error_handler = lambda err:errback(dbus_to_bridge_exception(err))
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
362 kwargs={}
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
363 if callback is not None:
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
364 kwargs['timeout'] = const_TIMEOUT
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
365 kwargs['reply_handler'] = callback
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
366 kwargs['error_handler'] = error_handler
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
367 return self.db_core_iface.getMenus(language, security_limit, **kwargs)
272
1d2e0dfe7114 bridge: core & frontend sides of bridge are now generated
Goffi <goffi@goffi.org>
parents: 267
diff changeset
368
1290
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
369 def getParamA(self, name, category, attribute="value", profile_key="@DEFAULT@", callback=None, errback=None):
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
370 if callback is None:
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
371 error_handler = None
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
372 else:
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
373 if errback is None:
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
374 errback = log.error
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
375 error_handler = lambda err:errback(dbus_to_bridge_exception(err))
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
376 kwargs={}
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
377 if callback is not None:
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
378 kwargs['timeout'] = const_TIMEOUT
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
379 kwargs['reply_handler'] = callback
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
380 kwargs['error_handler'] = error_handler
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
381 return unicode(self.db_core_iface.getParamA(name, category, attribute, profile_key, **kwargs))
272
1d2e0dfe7114 bridge: core & frontend sides of bridge are now generated
Goffi <goffi@goffi.org>
parents: 267
diff changeset
382
1290
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
383 def getParamsCategories(self, callback=None, errback=None):
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
384 if callback is None:
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
385 error_handler = None
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
386 else:
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
387 if errback is None:
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
388 errback = log.error
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
389 error_handler = lambda err:errback(dbus_to_bridge_exception(err))
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
390 kwargs={}
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
391 if callback is not None:
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
392 kwargs['timeout'] = const_TIMEOUT
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
393 kwargs['reply_handler'] = callback
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
394 kwargs['error_handler'] = error_handler
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
395 return self.db_core_iface.getParamsCategories(**kwargs)
272
1d2e0dfe7114 bridge: core & frontend sides of bridge are now generated
Goffi <goffi@goffi.org>
parents: 267
diff changeset
396
777
5642939d254e core, bridge: new method paramsRegisterApp to register frontend's specific parameters
souliane <souliane@mailoo.org>
parents: 773
diff changeset
397 def getParamsUI(self, security_limit=-1, app='', profile_key="@DEFAULT@", callback=None, errback=None):
1290
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
398 if callback is None:
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
399 error_handler = None
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
400 else:
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
401 if errback is None:
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
402 errback = log.error
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
403 error_handler = lambda err:errback(dbus_to_bridge_exception(err))
1237
c1e916594e09 bridge (frontends side): fixed call of async method in blocking context
Goffi <goffi@goffi.org>
parents: 1224
diff changeset
404 return unicode(self.db_core_iface.getParamsUI(security_limit, app, profile_key, timeout=const_TIMEOUT, reply_handler=callback, error_handler=error_handler))
272
1d2e0dfe7114 bridge: core & frontend sides of bridge are now generated
Goffi <goffi@goffi.org>
parents: 267
diff changeset
405
1290
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
406 def getPresenceStatuses(self, profile_key="@DEFAULT@", callback=None, errback=None):
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
407 if callback is None:
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
408 error_handler = None
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
409 else:
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
410 if errback is None:
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
411 errback = log.error
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
412 error_handler = lambda err:errback(dbus_to_bridge_exception(err))
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
413 kwargs={}
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
414 if callback is not None:
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
415 kwargs['timeout'] = const_TIMEOUT
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
416 kwargs['reply_handler'] = callback
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
417 kwargs['error_handler'] = error_handler
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
418 return self.db_core_iface.getPresenceStatuses(profile_key, **kwargs)
272
1d2e0dfe7114 bridge: core & frontend sides of bridge are now generated
Goffi <goffi@goffi.org>
parents: 267
diff changeset
419
1290
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
420 def getProfileName(self, profile_key="@DEFAULT@", callback=None, errback=None):
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
421 if callback is None:
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
422 error_handler = None
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
423 else:
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
424 if errback is None:
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
425 errback = log.error
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
426 error_handler = lambda err:errback(dbus_to_bridge_exception(err))
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
427 kwargs={}
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
428 if callback is not None:
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
429 kwargs['timeout'] = const_TIMEOUT
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
430 kwargs['reply_handler'] = callback
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
431 kwargs['error_handler'] = error_handler
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
432 return unicode(self.db_core_iface.getProfileName(profile_key, **kwargs))
272
1d2e0dfe7114 bridge: core & frontend sides of bridge are now generated
Goffi <goffi@goffi.org>
parents: 267
diff changeset
433
1290
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
434 def getProfilesList(self, callback=None, errback=None):
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
435 if callback is None:
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
436 error_handler = None
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
437 else:
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
438 if errback is None:
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
439 errback = log.error
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
440 error_handler = lambda err:errback(dbus_to_bridge_exception(err))
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
441 kwargs={}
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
442 if callback is not None:
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
443 kwargs['timeout'] = const_TIMEOUT
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
444 kwargs['reply_handler'] = callback
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
445 kwargs['error_handler'] = error_handler
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
446 return self.db_core_iface.getProfilesList(**kwargs)
272
1d2e0dfe7114 bridge: core & frontend sides of bridge are now generated
Goffi <goffi@goffi.org>
parents: 267
diff changeset
447
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
448 def getReady(self, callback=None, errback=None):
1290
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
449 if callback is None:
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
450 error_handler = None
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
451 else:
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
452 if errback is None:
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
453 errback = log.error
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
454 error_handler = lambda err:errback(dbus_to_bridge_exception(err))
1237
c1e916594e09 bridge (frontends side): fixed call of async method in blocking context
Goffi <goffi@goffi.org>
parents: 1224
diff changeset
455 return self.db_core_iface.getReady(timeout=const_TIMEOUT, reply_handler=callback, error_handler=error_handler)
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
456
1290
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
457 def getVersion(self, callback=None, errback=None):
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
458 if callback is None:
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
459 error_handler = None
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
460 else:
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
461 if errback is None:
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
462 errback = log.error
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
463 error_handler = lambda err:errback(dbus_to_bridge_exception(err))
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
464 kwargs={}
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
465 if callback is not None:
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
466 kwargs['timeout'] = const_TIMEOUT
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
467 kwargs['reply_handler'] = callback
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
468 kwargs['error_handler'] = error_handler
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
469 return unicode(self.db_core_iface.getVersion(**kwargs))
272
1d2e0dfe7114 bridge: core & frontend sides of bridge are now generated
Goffi <goffi@goffi.org>
parents: 267
diff changeset
470
1290
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
471 def getWaitingSub(self, profile_key="@DEFAULT@", callback=None, errback=None):
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
472 if callback is None:
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
473 error_handler = None
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
474 else:
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
475 if errback is None:
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
476 errback = log.error
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
477 error_handler = lambda err:errback(dbus_to_bridge_exception(err))
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
478 kwargs={}
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
479 if callback is not None:
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
480 kwargs['timeout'] = const_TIMEOUT
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
481 kwargs['reply_handler'] = callback
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
482 kwargs['error_handler'] = error_handler
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
483 return self.db_core_iface.getWaitingSub(profile_key, **kwargs)
272
1d2e0dfe7114 bridge: core & frontend sides of bridge are now generated
Goffi <goffi@goffi.org>
parents: 267
diff changeset
484
2013
b536dd121da1 backend (memory), frontends: improved history filtering:
Goffi <goffi@goffi.org>
parents: 1963
diff changeset
485 def historyGet(self, from_jid, to_jid, limit, between=True, filters='', profile="@NONE@", callback=None, errback=None):
1955
633b5c21aefd backend, frontend: messages refactoring (huge commit, not finished):
Goffi <goffi@goffi.org>
parents: 1934
diff changeset
486 if callback is None:
633b5c21aefd backend, frontend: messages refactoring (huge commit, not finished):
Goffi <goffi@goffi.org>
parents: 1934
diff changeset
487 error_handler = None
633b5c21aefd backend, frontend: messages refactoring (huge commit, not finished):
Goffi <goffi@goffi.org>
parents: 1934
diff changeset
488 else:
633b5c21aefd backend, frontend: messages refactoring (huge commit, not finished):
Goffi <goffi@goffi.org>
parents: 1934
diff changeset
489 if errback is None:
633b5c21aefd backend, frontend: messages refactoring (huge commit, not finished):
Goffi <goffi@goffi.org>
parents: 1934
diff changeset
490 errback = log.error
633b5c21aefd backend, frontend: messages refactoring (huge commit, not finished):
Goffi <goffi@goffi.org>
parents: 1934
diff changeset
491 error_handler = lambda err:errback(dbus_to_bridge_exception(err))
2013
b536dd121da1 backend (memory), frontends: improved history filtering:
Goffi <goffi@goffi.org>
parents: 1963
diff changeset
492 return self.db_core_iface.historyGet(from_jid, to_jid, limit, between, filters, profile, timeout=const_TIMEOUT, reply_handler=callback, error_handler=error_handler)
1955
633b5c21aefd backend, frontend: messages refactoring (huge commit, not finished):
Goffi <goffi@goffi.org>
parents: 1934
diff changeset
493
1290
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
494 def isConnected(self, profile_key="@DEFAULT@", callback=None, errback=None):
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
495 if callback is None:
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
496 error_handler = None
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
497 else:
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
498 if errback is None:
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
499 errback = log.error
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
500 error_handler = lambda err:errback(dbus_to_bridge_exception(err))
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
501 kwargs={}
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
502 if callback is not None:
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
503 kwargs['timeout'] = const_TIMEOUT
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
504 kwargs['reply_handler'] = callback
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
505 kwargs['error_handler'] = error_handler
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
506 return self.db_core_iface.isConnected(profile_key, **kwargs)
272
1d2e0dfe7114 bridge: core & frontend sides of bridge are now generated
Goffi <goffi@goffi.org>
parents: 267
diff changeset
507
759
93bd868b8fb6 backend, frontends: callbacks refactoring:
Goffi <goffi@goffi.org>
parents: 755
diff changeset
508 def launchAction(self, callback_id, data, profile_key="@DEFAULT@", callback=None, errback=None):
1290
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
509 if callback is None:
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
510 error_handler = None
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
511 else:
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
512 if errback is None:
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
513 errback = log.error
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
514 error_handler = lambda err:errback(dbus_to_bridge_exception(err))
1237
c1e916594e09 bridge (frontends side): fixed call of async method in blocking context
Goffi <goffi@goffi.org>
parents: 1224
diff changeset
515 return self.db_core_iface.launchAction(callback_id, data, profile_key, timeout=const_TIMEOUT, reply_handler=callback, error_handler=error_handler)
272
1d2e0dfe7114 bridge: core & frontend sides of bridge are now generated
Goffi <goffi@goffi.org>
parents: 267
diff changeset
516
1290
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
517 def loadParamsTemplate(self, filename, callback=None, errback=None):
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
518 if callback is None:
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
519 error_handler = None
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
520 else:
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
521 if errback is None:
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
522 errback = log.error
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
523 error_handler = lambda err:errback(dbus_to_bridge_exception(err))
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
524 kwargs={}
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
525 if callback is not None:
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
526 kwargs['timeout'] = const_TIMEOUT
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
527 kwargs['reply_handler'] = callback
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
528 kwargs['error_handler'] = error_handler
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
529 return self.db_core_iface.loadParamsTemplate(filename, **kwargs)
1015
fee00f2e11c2 memory, jp: added jp commands to load/save parameters template
souliane <souliane@mailoo.org>
parents: 993
diff changeset
530
1963
a2bc5089c2eb backend, frontends: message refactoring (huge commit):
Goffi <goffi@goffi.org>
parents: 1955
diff changeset
531 def messageSend(self, to_jid, message, subject={}, mess_type="auto", extra={}, profile_key="@NONE@", callback=None, errback=None):
1955
633b5c21aefd backend, frontend: messages refactoring (huge commit, not finished):
Goffi <goffi@goffi.org>
parents: 1934
diff changeset
532 if callback is None:
633b5c21aefd backend, frontend: messages refactoring (huge commit, not finished):
Goffi <goffi@goffi.org>
parents: 1934
diff changeset
533 error_handler = None
633b5c21aefd backend, frontend: messages refactoring (huge commit, not finished):
Goffi <goffi@goffi.org>
parents: 1934
diff changeset
534 else:
633b5c21aefd backend, frontend: messages refactoring (huge commit, not finished):
Goffi <goffi@goffi.org>
parents: 1934
diff changeset
535 if errback is None:
633b5c21aefd backend, frontend: messages refactoring (huge commit, not finished):
Goffi <goffi@goffi.org>
parents: 1934
diff changeset
536 errback = log.error
633b5c21aefd backend, frontend: messages refactoring (huge commit, not finished):
Goffi <goffi@goffi.org>
parents: 1934
diff changeset
537 error_handler = lambda err:errback(dbus_to_bridge_exception(err))
633b5c21aefd backend, frontend: messages refactoring (huge commit, not finished):
Goffi <goffi@goffi.org>
parents: 1934
diff changeset
538 return self.db_core_iface.messageSend(to_jid, message, subject, mess_type, extra, profile_key, timeout=const_TIMEOUT, reply_handler=callback, error_handler=error_handler)
633b5c21aefd backend, frontend: messages refactoring (huge commit, not finished):
Goffi <goffi@goffi.org>
parents: 1934
diff changeset
539
1290
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
540 def paramsRegisterApp(self, xml, security_limit=-1, app='', callback=None, errback=None):
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
541 if callback is None:
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
542 error_handler = None
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
543 else:
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
544 if errback is None:
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
545 errback = log.error
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
546 error_handler = lambda err:errback(dbus_to_bridge_exception(err))
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
547 kwargs={}
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
548 if callback is not None:
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
549 kwargs['timeout'] = const_TIMEOUT
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
550 kwargs['reply_handler'] = callback
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
551 kwargs['error_handler'] = error_handler
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
552 return self.db_core_iface.paramsRegisterApp(xml, security_limit, app, **kwargs)
777
5642939d254e core, bridge: new method paramsRegisterApp to register frontend's specific parameters
souliane <souliane@mailoo.org>
parents: 773
diff changeset
553
1592
d6d655238a93 bridge: new core method profileStartSession to start a session without connecting the profile
Goffi <goffi@goffi.org>
parents: 1587
diff changeset
554 def profileIsSessionStarted(self, 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
555 if callback is None:
d6d655238a93 bridge: new core method profileStartSession to start a session without connecting the profile
Goffi <goffi@goffi.org>
parents: 1587
diff changeset
556 error_handler = None
d6d655238a93 bridge: new core method profileStartSession to start a session without connecting the profile
Goffi <goffi@goffi.org>
parents: 1587
diff changeset
557 else:
d6d655238a93 bridge: new core method profileStartSession to start a session without connecting the profile
Goffi <goffi@goffi.org>
parents: 1587
diff changeset
558 if errback is None:
d6d655238a93 bridge: new core method profileStartSession to start a session without connecting the profile
Goffi <goffi@goffi.org>
parents: 1587
diff changeset
559 errback = log.error
d6d655238a93 bridge: new core method profileStartSession to start a session without connecting the profile
Goffi <goffi@goffi.org>
parents: 1587
diff changeset
560 error_handler = lambda err:errback(dbus_to_bridge_exception(err))
d6d655238a93 bridge: new core method profileStartSession to start a session without connecting the profile
Goffi <goffi@goffi.org>
parents: 1587
diff changeset
561 kwargs={}
d6d655238a93 bridge: new core method profileStartSession to start a session without connecting the profile
Goffi <goffi@goffi.org>
parents: 1587
diff changeset
562 if callback is not None:
d6d655238a93 bridge: new core method profileStartSession to start a session without connecting the profile
Goffi <goffi@goffi.org>
parents: 1587
diff changeset
563 kwargs['timeout'] = const_TIMEOUT
d6d655238a93 bridge: new core method profileStartSession to start a session without connecting the profile
Goffi <goffi@goffi.org>
parents: 1587
diff changeset
564 kwargs['reply_handler'] = callback
d6d655238a93 bridge: new core method profileStartSession to start a session without connecting the profile
Goffi <goffi@goffi.org>
parents: 1587
diff changeset
565 kwargs['error_handler'] = error_handler
d6d655238a93 bridge: new core method profileStartSession to start a session without connecting the profile
Goffi <goffi@goffi.org>
parents: 1587
diff changeset
566 return self.db_core_iface.profileIsSessionStarted(profile_key, **kwargs)
d6d655238a93 bridge: new core method profileStartSession to start a session without connecting the profile
Goffi <goffi@goffi.org>
parents: 1587
diff changeset
567
2083
7999d5299ddc bridge(D-Bus): minotr argument name fix
Goffi <goffi@goffi.org>
parents: 2050
diff changeset
568 def profileSetDefault(self, profile, callback=None, errback=None):
1595
a3d0cfa5b7a6 core, bridge: added a profileSetDefault method
Goffi <goffi@goffi.org>
parents: 1592
diff changeset
569 if callback is None:
a3d0cfa5b7a6 core, bridge: added a profileSetDefault method
Goffi <goffi@goffi.org>
parents: 1592
diff changeset
570 error_handler = None
a3d0cfa5b7a6 core, bridge: added a profileSetDefault method
Goffi <goffi@goffi.org>
parents: 1592
diff changeset
571 else:
a3d0cfa5b7a6 core, bridge: added a profileSetDefault method
Goffi <goffi@goffi.org>
parents: 1592
diff changeset
572 if errback is None:
a3d0cfa5b7a6 core, bridge: added a profileSetDefault method
Goffi <goffi@goffi.org>
parents: 1592
diff changeset
573 errback = log.error
a3d0cfa5b7a6 core, bridge: added a profileSetDefault method
Goffi <goffi@goffi.org>
parents: 1592
diff changeset
574 error_handler = lambda err:errback(dbus_to_bridge_exception(err))
a3d0cfa5b7a6 core, bridge: added a profileSetDefault method
Goffi <goffi@goffi.org>
parents: 1592
diff changeset
575 kwargs={}
a3d0cfa5b7a6 core, bridge: added a profileSetDefault method
Goffi <goffi@goffi.org>
parents: 1592
diff changeset
576 if callback is not None:
a3d0cfa5b7a6 core, bridge: added a profileSetDefault method
Goffi <goffi@goffi.org>
parents: 1592
diff changeset
577 kwargs['timeout'] = const_TIMEOUT
a3d0cfa5b7a6 core, bridge: added a profileSetDefault method
Goffi <goffi@goffi.org>
parents: 1592
diff changeset
578 kwargs['reply_handler'] = callback
a3d0cfa5b7a6 core, bridge: added a profileSetDefault method
Goffi <goffi@goffi.org>
parents: 1592
diff changeset
579 kwargs['error_handler'] = error_handler
2083
7999d5299ddc bridge(D-Bus): minotr argument name fix
Goffi <goffi@goffi.org>
parents: 2050
diff changeset
580 return self.db_core_iface.profileSetDefault(profile, **kwargs)
1595
a3d0cfa5b7a6 core, bridge: added a profileSetDefault method
Goffi <goffi@goffi.org>
parents: 1592
diff changeset
581
1592
d6d655238a93 bridge: new core method profileStartSession to start a session without connecting the profile
Goffi <goffi@goffi.org>
parents: 1587
diff changeset
582 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
583 if callback is None:
d6d655238a93 bridge: new core method profileStartSession to start a session without connecting the profile
Goffi <goffi@goffi.org>
parents: 1587
diff changeset
584 error_handler = None
d6d655238a93 bridge: new core method profileStartSession to start a session without connecting the profile
Goffi <goffi@goffi.org>
parents: 1587
diff changeset
585 else:
d6d655238a93 bridge: new core method profileStartSession to start a session without connecting the profile
Goffi <goffi@goffi.org>
parents: 1587
diff changeset
586 if errback is None:
d6d655238a93 bridge: new core method profileStartSession to start a session without connecting the profile
Goffi <goffi@goffi.org>
parents: 1587
diff changeset
587 errback = log.error
d6d655238a93 bridge: new core method profileStartSession to start a session without connecting the profile
Goffi <goffi@goffi.org>
parents: 1587
diff changeset
588 error_handler = lambda err:errback(dbus_to_bridge_exception(err))
d6d655238a93 bridge: new core method profileStartSession to start a session without connecting the profile
Goffi <goffi@goffi.org>
parents: 1587
diff changeset
589 return self.db_core_iface.profileStartSession(password, profile_key, timeout=const_TIMEOUT, reply_handler=callback, error_handler=error_handler)
d6d655238a93 bridge: new core method profileStartSession to start a session without connecting the profile
Goffi <goffi@goffi.org>
parents: 1587
diff changeset
590
1522
7d7e57a84792 core: progression handling improvments:
Goffi <goffi@goffi.org>
parents: 1482
diff changeset
591 def progressGet(self, id, profile, callback=None, errback=None):
7d7e57a84792 core: progression handling improvments:
Goffi <goffi@goffi.org>
parents: 1482
diff changeset
592 if callback is None:
7d7e57a84792 core: progression handling improvments:
Goffi <goffi@goffi.org>
parents: 1482
diff changeset
593 error_handler = None
7d7e57a84792 core: progression handling improvments:
Goffi <goffi@goffi.org>
parents: 1482
diff changeset
594 else:
7d7e57a84792 core: progression handling improvments:
Goffi <goffi@goffi.org>
parents: 1482
diff changeset
595 if errback is None:
7d7e57a84792 core: progression handling improvments:
Goffi <goffi@goffi.org>
parents: 1482
diff changeset
596 errback = log.error
7d7e57a84792 core: progression handling improvments:
Goffi <goffi@goffi.org>
parents: 1482
diff changeset
597 error_handler = lambda err:errback(dbus_to_bridge_exception(err))
7d7e57a84792 core: progression handling improvments:
Goffi <goffi@goffi.org>
parents: 1482
diff changeset
598 kwargs={}
7d7e57a84792 core: progression handling improvments:
Goffi <goffi@goffi.org>
parents: 1482
diff changeset
599 if callback is not None:
7d7e57a84792 core: progression handling improvments:
Goffi <goffi@goffi.org>
parents: 1482
diff changeset
600 kwargs['timeout'] = const_TIMEOUT
7d7e57a84792 core: progression handling improvments:
Goffi <goffi@goffi.org>
parents: 1482
diff changeset
601 kwargs['reply_handler'] = callback
7d7e57a84792 core: progression handling improvments:
Goffi <goffi@goffi.org>
parents: 1482
diff changeset
602 kwargs['error_handler'] = error_handler
7d7e57a84792 core: progression handling improvments:
Goffi <goffi@goffi.org>
parents: 1482
diff changeset
603 return self.db_core_iface.progressGet(id, profile, **kwargs)
7d7e57a84792 core: progression handling improvments:
Goffi <goffi@goffi.org>
parents: 1482
diff changeset
604
7d7e57a84792 core: progression handling improvments:
Goffi <goffi@goffi.org>
parents: 1482
diff changeset
605 def progressGetAll(self, profile, callback=None, errback=None):
7d7e57a84792 core: progression handling improvments:
Goffi <goffi@goffi.org>
parents: 1482
diff changeset
606 if callback is None:
7d7e57a84792 core: progression handling improvments:
Goffi <goffi@goffi.org>
parents: 1482
diff changeset
607 error_handler = None
7d7e57a84792 core: progression handling improvments:
Goffi <goffi@goffi.org>
parents: 1482
diff changeset
608 else:
7d7e57a84792 core: progression handling improvments:
Goffi <goffi@goffi.org>
parents: 1482
diff changeset
609 if errback is None:
7d7e57a84792 core: progression handling improvments:
Goffi <goffi@goffi.org>
parents: 1482
diff changeset
610 errback = log.error
7d7e57a84792 core: progression handling improvments:
Goffi <goffi@goffi.org>
parents: 1482
diff changeset
611 error_handler = lambda err:errback(dbus_to_bridge_exception(err))
7d7e57a84792 core: progression handling improvments:
Goffi <goffi@goffi.org>
parents: 1482
diff changeset
612 kwargs={}
7d7e57a84792 core: progression handling improvments:
Goffi <goffi@goffi.org>
parents: 1482
diff changeset
613 if callback is not None:
7d7e57a84792 core: progression handling improvments:
Goffi <goffi@goffi.org>
parents: 1482
diff changeset
614 kwargs['timeout'] = const_TIMEOUT
7d7e57a84792 core: progression handling improvments:
Goffi <goffi@goffi.org>
parents: 1482
diff changeset
615 kwargs['reply_handler'] = callback
7d7e57a84792 core: progression handling improvments:
Goffi <goffi@goffi.org>
parents: 1482
diff changeset
616 kwargs['error_handler'] = error_handler
7d7e57a84792 core: progression handling improvments:
Goffi <goffi@goffi.org>
parents: 1482
diff changeset
617 return self.db_core_iface.progressGetAll(profile, **kwargs)
7d7e57a84792 core: progression handling improvments:
Goffi <goffi@goffi.org>
parents: 1482
diff changeset
618
1626
63cef4dbf2a4 core, plugins file, XEP-0234, bridge: progression api enhancement:
Goffi <goffi@goffi.org>
parents: 1622
diff changeset
619 def progressGetAllMetadata(self, profile, callback=None, errback=None):
63cef4dbf2a4 core, plugins file, XEP-0234, bridge: progression api enhancement:
Goffi <goffi@goffi.org>
parents: 1622
diff changeset
620 if callback is None:
63cef4dbf2a4 core, plugins file, XEP-0234, bridge: progression api enhancement:
Goffi <goffi@goffi.org>
parents: 1622
diff changeset
621 error_handler = None
63cef4dbf2a4 core, plugins file, XEP-0234, bridge: progression api enhancement:
Goffi <goffi@goffi.org>
parents: 1622
diff changeset
622 else:
63cef4dbf2a4 core, plugins file, XEP-0234, bridge: progression api enhancement:
Goffi <goffi@goffi.org>
parents: 1622
diff changeset
623 if errback is None:
63cef4dbf2a4 core, plugins file, XEP-0234, bridge: progression api enhancement:
Goffi <goffi@goffi.org>
parents: 1622
diff changeset
624 errback = log.error
63cef4dbf2a4 core, plugins file, XEP-0234, bridge: progression api enhancement:
Goffi <goffi@goffi.org>
parents: 1622
diff changeset
625 error_handler = lambda err:errback(dbus_to_bridge_exception(err))
63cef4dbf2a4 core, plugins file, XEP-0234, bridge: progression api enhancement:
Goffi <goffi@goffi.org>
parents: 1622
diff changeset
626 kwargs={}
63cef4dbf2a4 core, plugins file, XEP-0234, bridge: progression api enhancement:
Goffi <goffi@goffi.org>
parents: 1622
diff changeset
627 if callback is not None:
63cef4dbf2a4 core, plugins file, XEP-0234, bridge: progression api enhancement:
Goffi <goffi@goffi.org>
parents: 1622
diff changeset
628 kwargs['timeout'] = const_TIMEOUT
63cef4dbf2a4 core, plugins file, XEP-0234, bridge: progression api enhancement:
Goffi <goffi@goffi.org>
parents: 1622
diff changeset
629 kwargs['reply_handler'] = callback
63cef4dbf2a4 core, plugins file, XEP-0234, bridge: progression api enhancement:
Goffi <goffi@goffi.org>
parents: 1622
diff changeset
630 kwargs['error_handler'] = error_handler
63cef4dbf2a4 core, plugins file, XEP-0234, bridge: progression api enhancement:
Goffi <goffi@goffi.org>
parents: 1622
diff changeset
631 return self.db_core_iface.progressGetAllMetadata(profile, **kwargs)
63cef4dbf2a4 core, plugins file, XEP-0234, bridge: progression api enhancement:
Goffi <goffi@goffi.org>
parents: 1622
diff changeset
632
1290
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
633 def saveParamsTemplate(self, filename, callback=None, errback=None):
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
634 if callback is None:
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
635 error_handler = None
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
636 else:
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
637 if errback is None:
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
638 errback = log.error
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
639 error_handler = lambda err:errback(dbus_to_bridge_exception(err))
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
640 kwargs={}
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
641 if callback is not None:
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
642 kwargs['timeout'] = const_TIMEOUT
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
643 kwargs['reply_handler'] = callback
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
644 kwargs['error_handler'] = error_handler
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
645 return self.db_core_iface.saveParamsTemplate(filename, **kwargs)
1015
fee00f2e11c2 memory, jp: added jp commands to load/save parameters template
souliane <souliane@mailoo.org>
parents: 993
diff changeset
646
2113
9c861d07b5b6 core: added sessionGetInfos bridge method to retrieve various data on current profile session + client.started keep start time
Goffi <goffi@goffi.org>
parents: 2091
diff changeset
647 def sessionInfosGet(self, profile_key, callback=None, errback=None):
9c861d07b5b6 core: added sessionGetInfos bridge method to retrieve various data on current profile session + client.started keep start time
Goffi <goffi@goffi.org>
parents: 2091
diff changeset
648 if callback is None:
9c861d07b5b6 core: added sessionGetInfos bridge method to retrieve various data on current profile session + client.started keep start time
Goffi <goffi@goffi.org>
parents: 2091
diff changeset
649 error_handler = None
9c861d07b5b6 core: added sessionGetInfos bridge method to retrieve various data on current profile session + client.started keep start time
Goffi <goffi@goffi.org>
parents: 2091
diff changeset
650 else:
9c861d07b5b6 core: added sessionGetInfos bridge method to retrieve various data on current profile session + client.started keep start time
Goffi <goffi@goffi.org>
parents: 2091
diff changeset
651 if errback is None:
9c861d07b5b6 core: added sessionGetInfos bridge method to retrieve various data on current profile session + client.started keep start time
Goffi <goffi@goffi.org>
parents: 2091
diff changeset
652 errback = log.error
9c861d07b5b6 core: added sessionGetInfos bridge method to retrieve various data on current profile session + client.started keep start time
Goffi <goffi@goffi.org>
parents: 2091
diff changeset
653 error_handler = lambda err:errback(dbus_to_bridge_exception(err))
9c861d07b5b6 core: added sessionGetInfos bridge method to retrieve various data on current profile session + client.started keep start time
Goffi <goffi@goffi.org>
parents: 2091
diff changeset
654 return self.db_core_iface.sessionInfosGet(profile_key, timeout=const_TIMEOUT, reply_handler=callback, error_handler=error_handler)
9c861d07b5b6 core: added sessionGetInfos bridge method to retrieve various data on current profile session + client.started keep start time
Goffi <goffi@goffi.org>
parents: 2091
diff changeset
655
1290
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
656 def setParam(self, name, value, category, security_limit=-1, profile_key="@DEFAULT@", callback=None, errback=None):
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
657 if callback is None:
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
658 error_handler = None
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
659 else:
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
660 if errback is None:
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
661 errback = log.error
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
662 error_handler = lambda err:errback(dbus_to_bridge_exception(err))
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
663 kwargs={}
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
664 if callback is not None:
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
665 kwargs['timeout'] = const_TIMEOUT
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
666 kwargs['reply_handler'] = callback
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
667 kwargs['error_handler'] = error_handler
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
668 return self.db_core_iface.setParam(name, value, category, security_limit, profile_key, **kwargs)
272
1d2e0dfe7114 bridge: core & frontend sides of bridge are now generated
Goffi <goffi@goffi.org>
parents: 267
diff changeset
669
1290
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
670 def setPresence(self, to_jid='', show='', statuses={}, profile_key="@DEFAULT@", callback=None, errback=None):
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
671 if callback is None:
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
672 error_handler = None
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
673 else:
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
674 if errback is None:
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
675 errback = log.error
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
676 error_handler = lambda err:errback(dbus_to_bridge_exception(err))
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
677 kwargs={}
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
678 if callback is not None:
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
679 kwargs['timeout'] = const_TIMEOUT
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
680 kwargs['reply_handler'] = callback
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
681 kwargs['error_handler'] = error_handler
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
682 return self.db_core_iface.setPresence(to_jid, show, statuses, profile_key, **kwargs)
272
1d2e0dfe7114 bridge: core & frontend sides of bridge are now generated
Goffi <goffi@goffi.org>
parents: 267
diff changeset
683
1290
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
684 def subscription(self, sub_type, entity, profile_key="@DEFAULT@", callback=None, errback=None):
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
685 if callback is None:
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
686 error_handler = None
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
687 else:
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
688 if errback is None:
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
689 errback = log.error
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
690 error_handler = lambda err:errback(dbus_to_bridge_exception(err))
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
691 kwargs={}
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
692 if callback is not None:
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
693 kwargs['timeout'] = const_TIMEOUT
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
694 kwargs['reply_handler'] = callback
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
695 kwargs['error_handler'] = error_handler
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
696 return self.db_core_iface.subscription(sub_type, entity, profile_key, **kwargs)
272
1d2e0dfe7114 bridge: core & frontend sides of bridge are now generated
Goffi <goffi@goffi.org>
parents: 267
diff changeset
697
1265
e3a9ea76de35 quick_frontend, primitivus: multi-profiles refactoring part 1 (big commit, sorry :p):
Goffi <goffi@goffi.org>
parents: 1237
diff changeset
698 def updateContact(self, entity_jid, name, groups, profile_key="@DEFAULT@", callback=None, errback=None):
1290
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
699 if callback is None:
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
700 error_handler = None
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
701 else:
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
702 if errback is None:
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
703 errback = log.error
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
704 error_handler = lambda err:errback(dbus_to_bridge_exception(err))
1265
e3a9ea76de35 quick_frontend, primitivus: multi-profiles refactoring part 1 (big commit, sorry :p):
Goffi <goffi@goffi.org>
parents: 1237
diff changeset
705 return self.db_core_iface.updateContact(entity_jid, name, groups, profile_key, timeout=const_TIMEOUT, reply_handler=callback, error_handler=error_handler)