Mercurial > libervia-backend
annotate frontends/src/bridge/DBus.py @ 497:50dd2a0196c0
primitivus: contacts list improvments:
- icon and color are used to show availability (away, do not disturb, etc)
- status are shown with meta-s (hidden by default)
author | Goffi <goffi@goffi.org> |
---|---|
date | Tue, 04 Sep 2012 01:15:19 +0200 |
parents | 9248f2c5e03e |
children | e9634d2e7b38 |
rev | line source |
---|---|
0 | 1 #!/usr/bin/python |
2 #-*- coding: utf-8 -*- | |
3 | |
4 """ | |
5 SAT communication bridge | |
459 | 6 Copyright (C) 2009, 2010, 2011, 2012 Jérôme Poisson (goffi@goffi.org) |
0 | 7 |
8 This program is free software: you can redistribute it and/or modify | |
480
2a072735e459
Licence modification: the full project is now under AGPL v3+ instead of GPL v3+
Goffi <goffi@goffi.org>
parents:
477
diff
changeset
|
9 it under the terms of the GNU Affero General Public License as published by |
0 | 10 the Free Software Foundation, either version 3 of the License, or |
11 (at your option) any later version. | |
12 | |
13 This program is distributed in the hope that it will be useful, | |
14 but WITHOUT ANY WARRANTY; without even the implied warranty of | |
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
480
2a072735e459
Licence modification: the full project is now under AGPL v3+ instead of GPL v3+
Goffi <goffi@goffi.org>
parents:
477
diff
changeset
|
16 GNU Affero General Public License for more details. |
0 | 17 |
480
2a072735e459
Licence modification: the full project is now under AGPL v3+ instead of GPL v3+
Goffi <goffi@goffi.org>
parents:
477
diff
changeset
|
18 You should have received a copy of the GNU Affero General Public License |
0 | 19 along with this program. If not, see <http://www.gnu.org/licenses/>. |
20 """ | |
21 | |
22 from bridge_frontend import BridgeFrontend | |
23 import dbus, dbus.glib | |
372
f964dcec1611
core: plugins refactored according to bridge + updatedValue now use profile
Goffi <goffi@goffi.org>
parents:
365
diff
changeset
|
24 from logging import debug, error |
0 | 25 |
360 | 26 const_INT_PREFIX = "org.goffi.SAT" #Interface prefix |
421
28e4299d4553
primitivus: profile manager updated to use new asynchronous profile creation
Goffi <goffi@goffi.org>
parents:
413
diff
changeset
|
27 const_ERROR_PREFIX = const_INT_PREFIX+".error" |
360 | 28 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
|
29 const_CORE_SUFFIX = ".core" |
f964dcec1611
core: plugins refactored according to bridge + updatedValue now use profile
Goffi <goffi@goffi.org>
parents:
365
diff
changeset
|
30 const_PLUGIN_SUFFIX = ".plugin" |
360 | 31 |
165
8a2053de6f8c
Frontends: management of unlaunched SàT Backend (information message and exit)
Goffi <goffi@goffi.org>
parents:
136
diff
changeset
|
32 class BridgeExceptionNoService(Exception): |
8a2053de6f8c
Frontends: management of unlaunched SàT Backend (information message and exit)
Goffi <goffi@goffi.org>
parents:
136
diff
changeset
|
33 pass |
0 | 34 |
35 class DBusBridgeFrontend(BridgeFrontend): | |
36 def __init__(self): | |
165
8a2053de6f8c
Frontends: management of unlaunched SàT Backend (information message and exit)
Goffi <goffi@goffi.org>
parents:
136
diff
changeset
|
37 try: |
8a2053de6f8c
Frontends: management of unlaunched SàT Backend (information message and exit)
Goffi <goffi@goffi.org>
parents:
136
diff
changeset
|
38 self.sessions_bus = dbus.SessionBus() |
360 | 39 self.db_object = self.sessions_bus.get_object(const_INT_PREFIX, |
40 const_OBJ_PATH) | |
372
f964dcec1611
core: plugins refactored according to bridge + updatedValue now use profile
Goffi <goffi@goffi.org>
parents:
365
diff
changeset
|
41 self.db_core_iface = dbus.Interface(self.db_object, |
f964dcec1611
core: plugins refactored according to bridge + updatedValue now use profile
Goffi <goffi@goffi.org>
parents:
365
diff
changeset
|
42 dbus_interface=const_INT_PREFIX + const_CORE_SUFFIX) |
f964dcec1611
core: plugins refactored according to bridge + updatedValue now use profile
Goffi <goffi@goffi.org>
parents:
365
diff
changeset
|
43 self.db_plugin_iface = dbus.Interface(self.db_object, |
f964dcec1611
core: plugins refactored according to bridge + updatedValue now use profile
Goffi <goffi@goffi.org>
parents:
365
diff
changeset
|
44 dbus_interface=const_INT_PREFIX + const_PLUGIN_SUFFIX) |
165
8a2053de6f8c
Frontends: management of unlaunched SàT Backend (information message and exit)
Goffi <goffi@goffi.org>
parents:
136
diff
changeset
|
45 except dbus.exceptions.DBusException,e: |
8a2053de6f8c
Frontends: management of unlaunched SàT Backend (information message and exit)
Goffi <goffi@goffi.org>
parents:
136
diff
changeset
|
46 if e._dbus_error_name=='org.freedesktop.DBus.Error.ServiceUnknown': |
8a2053de6f8c
Frontends: management of unlaunched SàT Backend (information message and exit)
Goffi <goffi@goffi.org>
parents:
136
diff
changeset
|
47 raise BridgeExceptionNoService |
8a2053de6f8c
Frontends: management of unlaunched SàT Backend (information message and exit)
Goffi <goffi@goffi.org>
parents:
136
diff
changeset
|
48 else: |
8a2053de6f8c
Frontends: management of unlaunched SàT Backend (information message and exit)
Goffi <goffi@goffi.org>
parents:
136
diff
changeset
|
49 raise e |
372
f964dcec1611
core: plugins refactored according to bridge + updatedValue now use profile
Goffi <goffi@goffi.org>
parents:
365
diff
changeset
|
50 #props = self.db_core_iface.getProperties() |
0 | 51 |
372
f964dcec1611
core: plugins refactored according to bridge + updatedValue now use profile
Goffi <goffi@goffi.org>
parents:
365
diff
changeset
|
52 def register(self, functionName, handler, iface="core"): |
f964dcec1611
core: plugins refactored according to bridge + updatedValue now use profile
Goffi <goffi@goffi.org>
parents:
365
diff
changeset
|
53 if iface == "core": |
f964dcec1611
core: plugins refactored according to bridge + updatedValue now use profile
Goffi <goffi@goffi.org>
parents:
365
diff
changeset
|
54 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
|
55 elif iface == "plugin": |
f964dcec1611
core: plugins refactored according to bridge + updatedValue now use profile
Goffi <goffi@goffi.org>
parents:
365
diff
changeset
|
56 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
|
57 else: |
f964dcec1611
core: plugins refactored according to bridge + updatedValue now use profile
Goffi <goffi@goffi.org>
parents:
365
diff
changeset
|
58 error(_('Unknown interface')) |
0 | 59 |
387
e66d300c5d42
frontends, bridge: sendFile method signature change + jid parameters in bridge now use _jid suffix
Goffi <goffi@goffi.org>
parents:
372
diff
changeset
|
60 def addContact(self, entity_jid, profile_key="@DEFAULT@"): |
e66d300c5d42
frontends, bridge: sendFile method signature change + jid parameters in bridge now use _jid suffix
Goffi <goffi@goffi.org>
parents:
372
diff
changeset
|
61 return self.db_core_iface.addContact(entity_jid, profile_key) |
272
1d2e0dfe7114
bridge: core & frontend sides of bridge are now generated
Goffi <goffi@goffi.org>
parents:
267
diff
changeset
|
62 |
337
4402ac630712
bridge: async callback managed in bridge_constructor + misc
Goffi <goffi@goffi.org>
parents:
336
diff
changeset
|
63 def asyncConnect(self, profile_key="@DEFAULT@", callback=None, errback=None): |
421
28e4299d4553
primitivus: profile manager updated to use new asynchronous profile creation
Goffi <goffi@goffi.org>
parents:
413
diff
changeset
|
64 return self.db_core_iface.asyncConnect(profile_key, reply_handler=callback, error_handler=lambda err:errback(err._dbus_error_name[len(const_ERROR_PREFIX)+1:])) |
28e4299d4553
primitivus: profile manager updated to use new asynchronous profile creation
Goffi <goffi@goffi.org>
parents:
413
diff
changeset
|
65 |
28e4299d4553
primitivus: profile manager updated to use new asynchronous profile creation
Goffi <goffi@goffi.org>
parents:
413
diff
changeset
|
66 def asyncCreateProfile(self, profile, callback=None, errback=None): |
28e4299d4553
primitivus: profile manager updated to use new asynchronous profile creation
Goffi <goffi@goffi.org>
parents:
413
diff
changeset
|
67 return self.db_core_iface.asyncCreateProfile(profile, reply_handler=callback, error_handler=lambda err:errback(err._dbus_error_name[len(const_ERROR_PREFIX)+1:])) |
337
4402ac630712
bridge: async callback managed in bridge_constructor + misc
Goffi <goffi@goffi.org>
parents:
336
diff
changeset
|
68 |
413
dd4caab17008
core: - individual parameters managed through sqlite
Goffi <goffi@goffi.org>
parents:
405
diff
changeset
|
69 def asyncGetParamA(self, name, category, attribute="value", profile_key="@DEFAULT@", callback=None, errback=None): |
421
28e4299d4553
primitivus: profile manager updated to use new asynchronous profile creation
Goffi <goffi@goffi.org>
parents:
413
diff
changeset
|
70 return unicode(self.db_core_iface.asyncGetParamA(name, category, attribute, profile_key, reply_handler=callback, error_handler=lambda err:errback(err._dbus_error_name[len(const_ERROR_PREFIX)+1:]))) |
413
dd4caab17008
core: - individual parameters managed through sqlite
Goffi <goffi@goffi.org>
parents:
405
diff
changeset
|
71 |
272
1d2e0dfe7114
bridge: core & frontend sides of bridge are now generated
Goffi <goffi@goffi.org>
parents:
267
diff
changeset
|
72 def callMenu(self, category, name, menu_type, profile_key): |
372
f964dcec1611
core: plugins refactored according to bridge + updatedValue now use profile
Goffi <goffi@goffi.org>
parents:
365
diff
changeset
|
73 return unicode(self.db_core_iface.callMenu(category, name, menu_type, profile_key)) |
272
1d2e0dfe7114
bridge: core & frontend sides of bridge are now generated
Goffi <goffi@goffi.org>
parents:
267
diff
changeset
|
74 |
1d2e0dfe7114
bridge: core & frontend sides of bridge are now generated
Goffi <goffi@goffi.org>
parents:
267
diff
changeset
|
75 def confirmationAnswer(self, id, accepted, data): |
372
f964dcec1611
core: plugins refactored according to bridge + updatedValue now use profile
Goffi <goffi@goffi.org>
parents:
365
diff
changeset
|
76 return self.db_core_iface.confirmationAnswer(id, accepted, data) |
272
1d2e0dfe7114
bridge: core & frontend sides of bridge are now generated
Goffi <goffi@goffi.org>
parents:
267
diff
changeset
|
77 |
1d2e0dfe7114
bridge: core & frontend sides of bridge are now generated
Goffi <goffi@goffi.org>
parents:
267
diff
changeset
|
78 def connect(self, profile_key="@DEFAULT@"): |
372
f964dcec1611
core: plugins refactored according to bridge + updatedValue now use profile
Goffi <goffi@goffi.org>
parents:
365
diff
changeset
|
79 return self.db_core_iface.connect(profile_key) |
272
1d2e0dfe7114
bridge: core & frontend sides of bridge are now generated
Goffi <goffi@goffi.org>
parents:
267
diff
changeset
|
80 |
1d2e0dfe7114
bridge: core & frontend sides of bridge are now generated
Goffi <goffi@goffi.org>
parents:
267
diff
changeset
|
81 def createProfile(self, profile): |
372
f964dcec1611
core: plugins refactored according to bridge + updatedValue now use profile
Goffi <goffi@goffi.org>
parents:
365
diff
changeset
|
82 return self.db_core_iface.createProfile(profile) |
272
1d2e0dfe7114
bridge: core & frontend sides of bridge are now generated
Goffi <goffi@goffi.org>
parents:
267
diff
changeset
|
83 |
387
e66d300c5d42
frontends, bridge: sendFile method signature change + jid parameters in bridge now use _jid suffix
Goffi <goffi@goffi.org>
parents:
372
diff
changeset
|
84 def delContact(self, entity_jid, profile_key="@DEFAULT@"): |
e66d300c5d42
frontends, bridge: sendFile method signature change + jid parameters in bridge now use _jid suffix
Goffi <goffi@goffi.org>
parents:
372
diff
changeset
|
85 return self.db_core_iface.delContact(entity_jid, profile_key) |
272
1d2e0dfe7114
bridge: core & frontend sides of bridge are now generated
Goffi <goffi@goffi.org>
parents:
267
diff
changeset
|
86 |
1d2e0dfe7114
bridge: core & frontend sides of bridge are now generated
Goffi <goffi@goffi.org>
parents:
267
diff
changeset
|
87 def deleteProfile(self, profile): |
372
f964dcec1611
core: plugins refactored according to bridge + updatedValue now use profile
Goffi <goffi@goffi.org>
parents:
365
diff
changeset
|
88 return self.db_core_iface.deleteProfile(profile) |
272
1d2e0dfe7114
bridge: core & frontend sides of bridge are now generated
Goffi <goffi@goffi.org>
parents:
267
diff
changeset
|
89 |
1d2e0dfe7114
bridge: core & frontend sides of bridge are now generated
Goffi <goffi@goffi.org>
parents:
267
diff
changeset
|
90 def disconnect(self, profile_key="@DEFAULT@"): |
372
f964dcec1611
core: plugins refactored according to bridge + updatedValue now use profile
Goffi <goffi@goffi.org>
parents:
365
diff
changeset
|
91 return self.db_core_iface.disconnect(profile_key) |
272
1d2e0dfe7114
bridge: core & frontend sides of bridge are now generated
Goffi <goffi@goffi.org>
parents:
267
diff
changeset
|
92 |
365
efbfccfed623
core: local_dir moved to config file
Goffi <goffi@goffi.org>
parents:
364
diff
changeset
|
93 def getConfig(self, section, name): |
372
f964dcec1611
core: plugins refactored according to bridge + updatedValue now use profile
Goffi <goffi@goffi.org>
parents:
365
diff
changeset
|
94 return unicode(self.db_core_iface.getConfig(section, name)) |
364 | 95 |
272
1d2e0dfe7114
bridge: core & frontend sides of bridge are now generated
Goffi <goffi@goffi.org>
parents:
267
diff
changeset
|
96 def getContacts(self, profile_key="@DEFAULT@"): |
372
f964dcec1611
core: plugins refactored according to bridge + updatedValue now use profile
Goffi <goffi@goffi.org>
parents:
365
diff
changeset
|
97 return self.db_core_iface.getContacts(profile_key) |
272
1d2e0dfe7114
bridge: core & frontend sides of bridge are now generated
Goffi <goffi@goffi.org>
parents:
267
diff
changeset
|
98 |
425
e4e9187e3b5b
backend, bridge: asynchronous history
Goffi <goffi@goffi.org>
parents:
423
diff
changeset
|
99 def getHistory(self, from_jid, to_jid, limit, between=True, callback=None, errback=None): |
e4e9187e3b5b
backend, bridge: asynchronous history
Goffi <goffi@goffi.org>
parents:
423
diff
changeset
|
100 return self.db_core_iface.getHistory(from_jid, to_jid, limit, between, reply_handler=callback, error_handler=lambda err:errback(err._dbus_error_name[len(const_ERROR_PREFIX)+1:])) |
272
1d2e0dfe7114
bridge: core & frontend sides of bridge are now generated
Goffi <goffi@goffi.org>
parents:
267
diff
changeset
|
101 |
399 | 102 def getLastResource(self, contact_jid, profile_key="@DEFAULT@"): |
103 return unicode(self.db_core_iface.getLastResource(contact_jid, profile_key)) | |
104 | |
272
1d2e0dfe7114
bridge: core & frontend sides of bridge are now generated
Goffi <goffi@goffi.org>
parents:
267
diff
changeset
|
105 def getMenuHelp(self, category, name, menu_type): |
372
f964dcec1611
core: plugins refactored according to bridge + updatedValue now use profile
Goffi <goffi@goffi.org>
parents:
365
diff
changeset
|
106 return unicode(self.db_core_iface.getMenuHelp(category, name, menu_type)) |
272
1d2e0dfe7114
bridge: core & frontend sides of bridge are now generated
Goffi <goffi@goffi.org>
parents:
267
diff
changeset
|
107 |
1d2e0dfe7114
bridge: core & frontend sides of bridge are now generated
Goffi <goffi@goffi.org>
parents:
267
diff
changeset
|
108 def getMenus(self, ): |
372
f964dcec1611
core: plugins refactored according to bridge + updatedValue now use profile
Goffi <goffi@goffi.org>
parents:
365
diff
changeset
|
109 return self.db_core_iface.getMenus() |
272
1d2e0dfe7114
bridge: core & frontend sides of bridge are now generated
Goffi <goffi@goffi.org>
parents:
267
diff
changeset
|
110 |
1d2e0dfe7114
bridge: core & frontend sides of bridge are now generated
Goffi <goffi@goffi.org>
parents:
267
diff
changeset
|
111 def getParamA(self, name, category, attribute="value", profile_key="@DEFAULT@"): |
372
f964dcec1611
core: plugins refactored according to bridge + updatedValue now use profile
Goffi <goffi@goffi.org>
parents:
365
diff
changeset
|
112 return unicode(self.db_core_iface.getParamA(name, category, attribute, profile_key)) |
272
1d2e0dfe7114
bridge: core & frontend sides of bridge are now generated
Goffi <goffi@goffi.org>
parents:
267
diff
changeset
|
113 |
423
6c20c76abdcc
backend: - bridge async D-Bus method now automatically manage callback and errback, we just have to return a deferred
Goffi <goffi@goffi.org>
parents:
421
diff
changeset
|
114 def getParams(self, profile_key="@DEFAULT@", callback=None, errback=None): |
6c20c76abdcc
backend: - bridge async D-Bus method now automatically manage callback and errback, we just have to return a deferred
Goffi <goffi@goffi.org>
parents:
421
diff
changeset
|
115 return unicode(self.db_core_iface.getParams(profile_key, reply_handler=callback, error_handler=lambda err:errback(err._dbus_error_name[len(const_ERROR_PREFIX)+1:]))) |
272
1d2e0dfe7114
bridge: core & frontend sides of bridge are now generated
Goffi <goffi@goffi.org>
parents:
267
diff
changeset
|
116 |
1d2e0dfe7114
bridge: core & frontend sides of bridge are now generated
Goffi <goffi@goffi.org>
parents:
267
diff
changeset
|
117 def getParamsCategories(self, ): |
372
f964dcec1611
core: plugins refactored according to bridge + updatedValue now use profile
Goffi <goffi@goffi.org>
parents:
365
diff
changeset
|
118 return self.db_core_iface.getParamsCategories() |
272
1d2e0dfe7114
bridge: core & frontend sides of bridge are now generated
Goffi <goffi@goffi.org>
parents:
267
diff
changeset
|
119 |
423
6c20c76abdcc
backend: - bridge async D-Bus method now automatically manage callback and errback, we just have to return a deferred
Goffi <goffi@goffi.org>
parents:
421
diff
changeset
|
120 def getParamsForCategory(self, category, profile_key="@DEFAULT@", callback=None, errback=None): |
6c20c76abdcc
backend: - bridge async D-Bus method now automatically manage callback and errback, we just have to return a deferred
Goffi <goffi@goffi.org>
parents:
421
diff
changeset
|
121 return unicode(self.db_core_iface.getParamsForCategory(category, profile_key, reply_handler=callback, error_handler=lambda err:errback(err._dbus_error_name[len(const_ERROR_PREFIX)+1:]))) |
272
1d2e0dfe7114
bridge: core & frontend sides of bridge are now generated
Goffi <goffi@goffi.org>
parents:
267
diff
changeset
|
122 |
423
6c20c76abdcc
backend: - bridge async D-Bus method now automatically manage callback and errback, we just have to return a deferred
Goffi <goffi@goffi.org>
parents:
421
diff
changeset
|
123 def getParamsUI(self, profile_key="@DEFAULT@", callback=None, errback=None): |
6c20c76abdcc
backend: - bridge async D-Bus method now automatically manage callback and errback, we just have to return a deferred
Goffi <goffi@goffi.org>
parents:
421
diff
changeset
|
124 return unicode(self.db_core_iface.getParamsUI(profile_key, reply_handler=callback, error_handler=lambda err:errback(err._dbus_error_name[len(const_ERROR_PREFIX)+1:]))) |
272
1d2e0dfe7114
bridge: core & frontend sides of bridge are now generated
Goffi <goffi@goffi.org>
parents:
267
diff
changeset
|
125 |
1d2e0dfe7114
bridge: core & frontend sides of bridge are now generated
Goffi <goffi@goffi.org>
parents:
267
diff
changeset
|
126 def getPresenceStatus(self, profile_key="@DEFAULT@"): |
372
f964dcec1611
core: plugins refactored according to bridge + updatedValue now use profile
Goffi <goffi@goffi.org>
parents:
365
diff
changeset
|
127 return self.db_core_iface.getPresenceStatus(profile_key) |
272
1d2e0dfe7114
bridge: core & frontend sides of bridge are now generated
Goffi <goffi@goffi.org>
parents:
267
diff
changeset
|
128 |
1d2e0dfe7114
bridge: core & frontend sides of bridge are now generated
Goffi <goffi@goffi.org>
parents:
267
diff
changeset
|
129 def getProfileName(self, profile_key="@DEFAULT@"): |
372
f964dcec1611
core: plugins refactored according to bridge + updatedValue now use profile
Goffi <goffi@goffi.org>
parents:
365
diff
changeset
|
130 return unicode(self.db_core_iface.getProfileName(profile_key)) |
272
1d2e0dfe7114
bridge: core & frontend sides of bridge are now generated
Goffi <goffi@goffi.org>
parents:
267
diff
changeset
|
131 |
1d2e0dfe7114
bridge: core & frontend sides of bridge are now generated
Goffi <goffi@goffi.org>
parents:
267
diff
changeset
|
132 def getProfilesList(self, ): |
372
f964dcec1611
core: plugins refactored according to bridge + updatedValue now use profile
Goffi <goffi@goffi.org>
parents:
365
diff
changeset
|
133 return self.db_core_iface.getProfilesList() |
272
1d2e0dfe7114
bridge: core & frontend sides of bridge are now generated
Goffi <goffi@goffi.org>
parents:
267
diff
changeset
|
134 |
1d2e0dfe7114
bridge: core & frontend sides of bridge are now generated
Goffi <goffi@goffi.org>
parents:
267
diff
changeset
|
135 def getProgress(self, id): |
372
f964dcec1611
core: plugins refactored according to bridge + updatedValue now use profile
Goffi <goffi@goffi.org>
parents:
365
diff
changeset
|
136 return self.db_core_iface.getProgress(id) |
272
1d2e0dfe7114
bridge: core & frontend sides of bridge are now generated
Goffi <goffi@goffi.org>
parents:
267
diff
changeset
|
137 |
1d2e0dfe7114
bridge: core & frontend sides of bridge are now generated
Goffi <goffi@goffi.org>
parents:
267
diff
changeset
|
138 def getVersion(self, ): |
372
f964dcec1611
core: plugins refactored according to bridge + updatedValue now use profile
Goffi <goffi@goffi.org>
parents:
365
diff
changeset
|
139 return unicode(self.db_core_iface.getVersion()) |
272
1d2e0dfe7114
bridge: core & frontend sides of bridge are now generated
Goffi <goffi@goffi.org>
parents:
267
diff
changeset
|
140 |
1d2e0dfe7114
bridge: core & frontend sides of bridge are now generated
Goffi <goffi@goffi.org>
parents:
267
diff
changeset
|
141 def getWaitingSub(self, profile_key="@DEFAULT@"): |
372
f964dcec1611
core: plugins refactored according to bridge + updatedValue now use profile
Goffi <goffi@goffi.org>
parents:
365
diff
changeset
|
142 return self.db_core_iface.getWaitingSub(profile_key) |
272
1d2e0dfe7114
bridge: core & frontend sides of bridge are now generated
Goffi <goffi@goffi.org>
parents:
267
diff
changeset
|
143 |
1d2e0dfe7114
bridge: core & frontend sides of bridge are now generated
Goffi <goffi@goffi.org>
parents:
267
diff
changeset
|
144 def isConnected(self, profile_key="@DEFAULT@"): |
372
f964dcec1611
core: plugins refactored according to bridge + updatedValue now use profile
Goffi <goffi@goffi.org>
parents:
365
diff
changeset
|
145 return self.db_core_iface.isConnected(profile_key) |
272
1d2e0dfe7114
bridge: core & frontend sides of bridge are now generated
Goffi <goffi@goffi.org>
parents:
267
diff
changeset
|
146 |
1d2e0dfe7114
bridge: core & frontend sides of bridge are now generated
Goffi <goffi@goffi.org>
parents:
267
diff
changeset
|
147 def launchAction(self, action_type, data, profile_key="@DEFAULT@"): |
372
f964dcec1611
core: plugins refactored according to bridge + updatedValue now use profile
Goffi <goffi@goffi.org>
parents:
365
diff
changeset
|
148 return unicode(self.db_core_iface.launchAction(action_type, data, profile_key)) |
272
1d2e0dfe7114
bridge: core & frontend sides of bridge are now generated
Goffi <goffi@goffi.org>
parents:
267
diff
changeset
|
149 |
336
953536246d9d
core: added email in registerNewAccount
Goffi <goffi@goffi.org>
parents:
320
diff
changeset
|
150 def registerNewAccount(self, login, password, email, host, port=5222): |
372
f964dcec1611
core: plugins refactored according to bridge + updatedValue now use profile
Goffi <goffi@goffi.org>
parents:
365
diff
changeset
|
151 return unicode(self.db_core_iface.registerNewAccount(login, password, email, host, port)) |
272
1d2e0dfe7114
bridge: core & frontend sides of bridge are now generated
Goffi <goffi@goffi.org>
parents:
267
diff
changeset
|
152 |
492 | 153 def sendMessage(self, to_jid, message, subject='', mess_type="auto", profile_key="@DEFAULT@"): |
372
f964dcec1611
core: plugins refactored according to bridge + updatedValue now use profile
Goffi <goffi@goffi.org>
parents:
365
diff
changeset
|
154 return self.db_core_iface.sendMessage(to_jid, message, subject, mess_type, profile_key) |
272
1d2e0dfe7114
bridge: core & frontend sides of bridge are now generated
Goffi <goffi@goffi.org>
parents:
267
diff
changeset
|
155 |
1d2e0dfe7114
bridge: core & frontend sides of bridge are now generated
Goffi <goffi@goffi.org>
parents:
267
diff
changeset
|
156 def setParam(self, name, value, category, profile_key="@DEFAULT@"): |
372
f964dcec1611
core: plugins refactored according to bridge + updatedValue now use profile
Goffi <goffi@goffi.org>
parents:
365
diff
changeset
|
157 return self.db_core_iface.setParam(name, value, category, profile_key) |
272
1d2e0dfe7114
bridge: core & frontend sides of bridge are now generated
Goffi <goffi@goffi.org>
parents:
267
diff
changeset
|
158 |
1d2e0dfe7114
bridge: core & frontend sides of bridge are now generated
Goffi <goffi@goffi.org>
parents:
267
diff
changeset
|
159 def setPresence(self, to_jid='', show='', priority=0, statuses={}, profile_key="@DEFAULT@"): |
372
f964dcec1611
core: plugins refactored according to bridge + updatedValue now use profile
Goffi <goffi@goffi.org>
parents:
365
diff
changeset
|
160 return self.db_core_iface.setPresence(to_jid, show, priority, statuses, profile_key) |
272
1d2e0dfe7114
bridge: core & frontend sides of bridge are now generated
Goffi <goffi@goffi.org>
parents:
267
diff
changeset
|
161 |
1d2e0dfe7114
bridge: core & frontend sides of bridge are now generated
Goffi <goffi@goffi.org>
parents:
267
diff
changeset
|
162 def subscription(self, sub_type, entity, profile_key="@DEFAULT@"): |
372
f964dcec1611
core: plugins refactored according to bridge + updatedValue now use profile
Goffi <goffi@goffi.org>
parents:
365
diff
changeset
|
163 return self.db_core_iface.subscription(sub_type, entity, profile_key) |
272
1d2e0dfe7114
bridge: core & frontend sides of bridge are now generated
Goffi <goffi@goffi.org>
parents:
267
diff
changeset
|
164 |
387
e66d300c5d42
frontends, bridge: sendFile method signature change + jid parameters in bridge now use _jid suffix
Goffi <goffi@goffi.org>
parents:
372
diff
changeset
|
165 def updateContact(self, entity_jid, name, groups, profile_key="@DEFAULT@"): |
e66d300c5d42
frontends, bridge: sendFile method signature change + jid parameters in bridge now use _jid suffix
Goffi <goffi@goffi.org>
parents:
372
diff
changeset
|
166 return self.db_core_iface.updateContact(entity_jid, name, groups, profile_key) |
345 | 167 |
101 | 168 |
65
d35c5edab53f
SàT: multi-profile: memory & dbus bridge's methods profile management
Goffi <goffi@goffi.org>
parents:
64
diff
changeset
|
169 #methods from plugins |
449
961543b20806
bridge: removed default profile_key in dbus_frontend_template to avoid difficult to find bugs
Goffi <goffi@goffi.org>
parents:
435
diff
changeset
|
170 def getRoomsJoined(self, profile_key): |
405
10b4f577d0c0
MUC update to follow wokkel's MUC branch update
Goffi <goffi@goffi.org>
parents:
401
diff
changeset
|
171 return self.db_plugin_iface.getRoomsJoined(profile_key) |
78
ace2af8abc5a
Added method to know which MUC are joined, and which subjects were received.
Goffi <goffi@goffi.org>
parents:
72
diff
changeset
|
172 |
470
5c916b99d0f6
plugin groupblog, D-Bus frontend: added getLastGroupBlogs and getMassiveLastGroupBlogs
Goffi <goffi@goffi.org>
parents:
459
diff
changeset
|
173 def getRoomsSubjects(self, profile_key): |
5c916b99d0f6
plugin groupblog, D-Bus frontend: added getLastGroupBlogs and getMassiveLastGroupBlogs
Goffi <goffi@goffi.org>
parents:
459
diff
changeset
|
174 return self.db_plugin_iface.getRoomsSubjects(profile_key) |
78
ace2af8abc5a
Added method to know which MUC are joined, and which subjects were received.
Goffi <goffi@goffi.org>
parents:
72
diff
changeset
|
175 |
449
961543b20806
bridge: removed default profile_key in dbus_frontend_template to avoid difficult to find bugs
Goffi <goffi@goffi.org>
parents:
435
diff
changeset
|
176 def joinMUC(self, room_jid, nick, options, profile_key): |
405
10b4f577d0c0
MUC update to follow wokkel's MUC branch update
Goffi <goffi@goffi.org>
parents:
401
diff
changeset
|
177 if options == None: |
10b4f577d0c0
MUC update to follow wokkel's MUC branch update
Goffi <goffi@goffi.org>
parents:
401
diff
changeset
|
178 options = [('', '')] #XXX: we have to do this awful hack because python dbus need to guess the signature |
10b4f577d0c0
MUC update to follow wokkel's MUC branch update
Goffi <goffi@goffi.org>
parents:
401
diff
changeset
|
179 return self.db_plugin_iface.joinMUC(room_jid, nick, options, profile_key) |
72 | 180 |
449
961543b20806
bridge: removed default profile_key in dbus_frontend_template to avoid difficult to find bugs
Goffi <goffi@goffi.org>
parents:
435
diff
changeset
|
181 def tarotGameLaunch(self, players, profile_key): |
372
f964dcec1611
core: plugins refactored according to bridge + updatedValue now use profile
Goffi <goffi@goffi.org>
parents:
365
diff
changeset
|
182 return self.db_plugin_iface.tarotGameLaunch(players, profile_key) |
320
5fc5e6a7e5c3
plugin Tarot: added a launch method to automatically create a new room, invite players and create the game
Goffi <goffi@goffi.org>
parents:
314
diff
changeset
|
183 |
449
961543b20806
bridge: removed default profile_key in dbus_frontend_template to avoid difficult to find bugs
Goffi <goffi@goffi.org>
parents:
435
diff
changeset
|
184 def tarotGameCreate(self, room_jid, players, profile_key): |
372
f964dcec1611
core: plugins refactored according to bridge + updatedValue now use profile
Goffi <goffi@goffi.org>
parents:
365
diff
changeset
|
185 return self.db_plugin_iface.tarotGameCreate(room_jid, players, profile_key) |
90 | 186 |
449
961543b20806
bridge: removed default profile_key in dbus_frontend_template to avoid difficult to find bugs
Goffi <goffi@goffi.org>
parents:
435
diff
changeset
|
187 def tarotGameReady(self, player, referee, profile_key): |
372
f964dcec1611
core: plugins refactored according to bridge + updatedValue now use profile
Goffi <goffi@goffi.org>
parents:
365
diff
changeset
|
188 return self.db_plugin_iface.tarotGameReady(player, referee, profile_key) |
85 | 189 |
449
961543b20806
bridge: removed default profile_key in dbus_frontend_template to avoid difficult to find bugs
Goffi <goffi@goffi.org>
parents:
435
diff
changeset
|
190 def tarotGameContratChoosed(self, player, referee, contrat, profile_key): |
372
f964dcec1611
core: plugins refactored according to bridge + updatedValue now use profile
Goffi <goffi@goffi.org>
parents:
365
diff
changeset
|
191 return self.db_plugin_iface.tarotGameContratChoosed(player, referee, contrat, profile_key) |
92 | 192 |
449
961543b20806
bridge: removed default profile_key in dbus_frontend_template to avoid difficult to find bugs
Goffi <goffi@goffi.org>
parents:
435
diff
changeset
|
193 def tarotGamePlayCards(self, player, referee, cards, profile_key): |
372
f964dcec1611
core: plugins refactored according to bridge + updatedValue now use profile
Goffi <goffi@goffi.org>
parents:
365
diff
changeset
|
194 return self.db_plugin_iface.tarotGamePlayCards(player, referee, cards, profile_key) |
91 | 195 |
449
961543b20806
bridge: removed default profile_key in dbus_frontend_template to avoid difficult to find bugs
Goffi <goffi@goffi.org>
parents:
435
diff
changeset
|
196 def quizGameLaunch(self, players, profile_key): |
372
f964dcec1611
core: plugins refactored according to bridge + updatedValue now use profile
Goffi <goffi@goffi.org>
parents:
365
diff
changeset
|
197 return self.db_plugin_iface.quizGameLaunch(players, profile_key) |
361 | 198 |
449
961543b20806
bridge: removed default profile_key in dbus_frontend_template to avoid difficult to find bugs
Goffi <goffi@goffi.org>
parents:
435
diff
changeset
|
199 def quizGameCreate(self, room_jid, players, profile_key): |
372
f964dcec1611
core: plugins refactored according to bridge + updatedValue now use profile
Goffi <goffi@goffi.org>
parents:
365
diff
changeset
|
200 return self.db_plugin_iface.quizGameCreate(room_jid, players, profile_key) |
361 | 201 |
449
961543b20806
bridge: removed default profile_key in dbus_frontend_template to avoid difficult to find bugs
Goffi <goffi@goffi.org>
parents:
435
diff
changeset
|
202 def quizGameReady(self, player, referee, profile_key): |
372
f964dcec1611
core: plugins refactored according to bridge + updatedValue now use profile
Goffi <goffi@goffi.org>
parents:
365
diff
changeset
|
203 return self.db_plugin_iface.quizGameReady(player, referee, profile_key) |
361 | 204 |
449
961543b20806
bridge: removed default profile_key in dbus_frontend_template to avoid difficult to find bugs
Goffi <goffi@goffi.org>
parents:
435
diff
changeset
|
205 def quizGameAnswer(self, player, referee, answer, profile_key): |
372
f964dcec1611
core: plugins refactored according to bridge + updatedValue now use profile
Goffi <goffi@goffi.org>
parents:
365
diff
changeset
|
206 return self.db_plugin_iface.quizGameAnswer(player, referee, answer, profile_key) |
362
208107419b17
Quiz game: buzzer, timer, answer management
Goffi <goffi@goffi.org>
parents:
361
diff
changeset
|
207 |
450
afe9cfd2ddbb
plugins: radio collective first draft
Goffi <goffi@goffi.org>
parents:
449
diff
changeset
|
208 def radiocolLaunch(self, players, profile_key): |
afe9cfd2ddbb
plugins: radio collective first draft
Goffi <goffi@goffi.org>
parents:
449
diff
changeset
|
209 return self.db_plugin_iface.radiocolLaunch(players, profile_key) |
afe9cfd2ddbb
plugins: radio collective first draft
Goffi <goffi@goffi.org>
parents:
449
diff
changeset
|
210 |
afe9cfd2ddbb
plugins: radio collective first draft
Goffi <goffi@goffi.org>
parents:
449
diff
changeset
|
211 def radiocolCreate(self, room_jid, profile_key): |
afe9cfd2ddbb
plugins: radio collective first draft
Goffi <goffi@goffi.org>
parents:
449
diff
changeset
|
212 return self.db_plugin_iface.radiocolCreate(room_jid, profile_key) |
afe9cfd2ddbb
plugins: radio collective first draft
Goffi <goffi@goffi.org>
parents:
449
diff
changeset
|
213 |
455
72522263cbc9
plugin RadioCol: basic functionnality working approximately
Goffi <goffi@goffi.org>
parents:
450
diff
changeset
|
214 def radiocolSongAdded(self, room_jid, song_path, profile): |
72522263cbc9
plugin RadioCol: basic functionnality working approximately
Goffi <goffi@goffi.org>
parents:
450
diff
changeset
|
215 return self.db_plugin_iface.radiocolSongAdded(room_jid, song_path, profile) |
72522263cbc9
plugin RadioCol: basic functionnality working approximately
Goffi <goffi@goffi.org>
parents:
450
diff
changeset
|
216 |
449
961543b20806
bridge: removed default profile_key in dbus_frontend_template to avoid difficult to find bugs
Goffi <goffi@goffi.org>
parents:
435
diff
changeset
|
217 def sendFile(self, to, path, data, profile_key): |
387
e66d300c5d42
frontends, bridge: sendFile method signature change + jid parameters in bridge now use _jid suffix
Goffi <goffi@goffi.org>
parents:
372
diff
changeset
|
218 return self.db_plugin_iface.sendFile(to, path, data, profile_key) |
0 | 219 |
449
961543b20806
bridge: removed default profile_key in dbus_frontend_template to avoid difficult to find bugs
Goffi <goffi@goffi.org>
parents:
435
diff
changeset
|
220 def pipeOut(self, to, path, data, profile_key): |
401
b2caa2615c4c
jp roster name manegement + Pipe transfer
Goffi <goffi@goffi.org>
parents:
399
diff
changeset
|
221 return self.db_plugin_iface.pipeOut(to, path, data, profile_key) |
b2caa2615c4c
jp roster name manegement + Pipe transfer
Goffi <goffi@goffi.org>
parents:
399
diff
changeset
|
222 |
449
961543b20806
bridge: removed default profile_key in dbus_frontend_template to avoid difficult to find bugs
Goffi <goffi@goffi.org>
parents:
435
diff
changeset
|
223 def findGateways(self, target, profile_key): |
372
f964dcec1611
core: plugins refactored according to bridge + updatedValue now use profile
Goffi <goffi@goffi.org>
parents:
365
diff
changeset
|
224 return self.db_plugin_iface.findGateways(target, profile_key) |
25
53e921c8a357
new plugin: gateways plugin, and first implementation of findGateways
Goffi <goffi@goffi.org>
parents:
22
diff
changeset
|
225 |
449
961543b20806
bridge: removed default profile_key in dbus_frontend_template to avoid difficult to find bugs
Goffi <goffi@goffi.org>
parents:
435
diff
changeset
|
226 def getCard(self, target, profile_key): |
372
f964dcec1611
core: plugins refactored according to bridge + updatedValue now use profile
Goffi <goffi@goffi.org>
parents:
365
diff
changeset
|
227 return self.db_plugin_iface.getCard(target, profile_key) |
42
874de3020e1c
Initial VCard (XEP-0054) support + misc fixes
Goffi <goffi@goffi.org>
parents:
37
diff
changeset
|
228 |
449
961543b20806
bridge: removed default profile_key in dbus_frontend_template to avoid difficult to find bugs
Goffi <goffi@goffi.org>
parents:
435
diff
changeset
|
229 def getCardCache(self, target, profile_key): |
435
c243f4cb2ad9
plugin XEP-0054: cache now use storage
Goffi <goffi@goffi.org>
parents:
425
diff
changeset
|
230 return self.db_plugin_iface.getCardCache(target, profile_key) |
51
8c67ea98ab91
frontend improved to take into account new SàT features
Goffi <goffi@goffi.org>
parents:
43
diff
changeset
|
231 |
43 | 232 def getAvatarFile(self, hash): |
372
f964dcec1611
core: plugins refactored according to bridge + updatedValue now use profile
Goffi <goffi@goffi.org>
parents:
365
diff
changeset
|
233 return self.db_plugin_iface.getAvatarFile(hash) |
43 | 234 |
449
961543b20806
bridge: removed default profile_key in dbus_frontend_template to avoid difficult to find bugs
Goffi <goffi@goffi.org>
parents:
435
diff
changeset
|
235 def in_band_register(self, target, profile_key): |
372
f964dcec1611
core: plugins refactored according to bridge + updatedValue now use profile
Goffi <goffi@goffi.org>
parents:
365
diff
changeset
|
236 return self.db_plugin_iface.in_band_register(target, profile_key) |
0 | 237 |
449
961543b20806
bridge: removed default profile_key in dbus_frontend_template to avoid difficult to find bugs
Goffi <goffi@goffi.org>
parents:
435
diff
changeset
|
238 def gatewayRegister(self, action, target, data, profile_key): |
37
a61beb21d16d
Gateway registration, unregistration & edition
Goffi <goffi@goffi.org>
parents:
36
diff
changeset
|
239 if data == None: |
101 | 240 data = [('', '')] #XXX: we have to do this awful hack because python dbus need to guess the signature |
372
f964dcec1611
core: plugins refactored according to bridge + updatedValue now use profile
Goffi <goffi@goffi.org>
parents:
365
diff
changeset
|
241 return self.db_plugin_iface.gatewayRegister(action, target, data, profile_key) |
36 | 242 |
449
961543b20806
bridge: removed default profile_key in dbus_frontend_template to avoid difficult to find bugs
Goffi <goffi@goffi.org>
parents:
435
diff
changeset
|
243 def getLastMicroblogs(self, jid, max_items, profile_key, callback=None, errback=None): |
372
f964dcec1611
core: plugins refactored according to bridge + updatedValue now use profile
Goffi <goffi@goffi.org>
parents:
365
diff
changeset
|
244 return self.db_plugin_iface.getLastMicroblogs(jid, max_items, profile_key, reply_handler=callback, error_handler=errback) |
304 | 245 |
471 | 246 def sendGroupBlog(self, access_type, access_list, message, profile_key='@DEFAULT@'): |
247 return self.db_plugin_iface.sendGroupBlog(access_type, access_list, message, profile_key) | |
307 | 248 |
470
5c916b99d0f6
plugin groupblog, D-Bus frontend: added getLastGroupBlogs and getMassiveLastGroupBlogs
Goffi <goffi@goffi.org>
parents:
459
diff
changeset
|
249 def getLastGroupBlogs(self, jid, max_items, profile_key, callback=None, errback=None): |
5c916b99d0f6
plugin groupblog, D-Bus frontend: added getLastGroupBlogs and getMassiveLastGroupBlogs
Goffi <goffi@goffi.org>
parents:
459
diff
changeset
|
250 return self.db_plugin_iface.getLastGroupBlogs(jid, max_items, profile_key, reply_handler=callback, error_handler=errback) |
5c916b99d0f6
plugin groupblog, D-Bus frontend: added getLastGroupBlogs and getMassiveLastGroupBlogs
Goffi <goffi@goffi.org>
parents:
459
diff
changeset
|
251 |
5c916b99d0f6
plugin groupblog, D-Bus frontend: added getLastGroupBlogs and getMassiveLastGroupBlogs
Goffi <goffi@goffi.org>
parents:
459
diff
changeset
|
252 def getMassiveLastGroupBlogs(self, publishers_type, publishers, max_items=10, profile_key='@DEFAULT@', callback=None, errback=None): |
5c916b99d0f6
plugin groupblog, D-Bus frontend: added getLastGroupBlogs and getMassiveLastGroupBlogs
Goffi <goffi@goffi.org>
parents:
459
diff
changeset
|
253 return self.db_plugin_iface.getMassiveLastGroupBlogs(publishers_type, publishers, max_items, profile_key, reply_handler=callback, error_handler=errback) |
5c916b99d0f6
plugin groupblog, D-Bus frontend: added getLastGroupBlogs and getMassiveLastGroupBlogs
Goffi <goffi@goffi.org>
parents:
459
diff
changeset
|
254 |
477
031b0e0aaab8
plugin groupblog: subscriptions/notifications
Goffi <goffi@goffi.org>
parents:
471
diff
changeset
|
255 def subscribeGroupBlog(self, jid, profile_key='@DEFAULT@', callback=None, errback=None): |
031b0e0aaab8
plugin groupblog: subscriptions/notifications
Goffi <goffi@goffi.org>
parents:
471
diff
changeset
|
256 return self.db_plugin_iface.subscribeGroupBlog(jid, profile_key, reply_handler=callback, error_handler=errback) |
031b0e0aaab8
plugin groupblog: subscriptions/notifications
Goffi <goffi@goffi.org>
parents:
471
diff
changeset
|
257 |
031b0e0aaab8
plugin groupblog: subscriptions/notifications
Goffi <goffi@goffi.org>
parents:
471
diff
changeset
|
258 def massiveSubscribeGroupBlogs(self, publishers_type, publishers, profile_key='@DEFAULT@', callback=None, errback=None): |
031b0e0aaab8
plugin groupblog: subscriptions/notifications
Goffi <goffi@goffi.org>
parents:
471
diff
changeset
|
259 return self.db_plugin_iface.massiveSubscribeGroupBlogs(publishers_type, publishers, profile_key, reply_handler=callback, error_handler=errback) |
031b0e0aaab8
plugin groupblog: subscriptions/notifications
Goffi <goffi@goffi.org>
parents:
471
diff
changeset
|
260 |
449
961543b20806
bridge: removed default profile_key in dbus_frontend_template to avoid difficult to find bugs
Goffi <goffi@goffi.org>
parents:
435
diff
changeset
|
261 def sendPersonalEvent(self, event_type, data, profile_key): |
372
f964dcec1611
core: plugins refactored according to bridge + updatedValue now use profile
Goffi <goffi@goffi.org>
parents:
365
diff
changeset
|
262 return self.db_plugin_iface.sendPersonalEvent(event_type, data, profile_key) |
337
4402ac630712
bridge: async callback managed in bridge_constructor + misc
Goffi <goffi@goffi.org>
parents:
336
diff
changeset
|
263 |
4402ac630712
bridge: async callback managed in bridge_constructor + misc
Goffi <goffi@goffi.org>
parents:
336
diff
changeset
|
264 def setMicroblogAccess(self, access="presence", profile_key='@DEFAULT@', callback=None, errback=None): |
372
f964dcec1611
core: plugins refactored according to bridge + updatedValue now use profile
Goffi <goffi@goffi.org>
parents:
365
diff
changeset
|
265 return self.db_plugin_iface.setMicroblogAccess(access, profile_key, reply_handler=callback, error_handler=errback) |