annotate frontends/src/bridge/DBus.py @ 377:aa2cd6639e00

Bridge Constructor: added anchor link in mediawiki constructor
author Goffi <goffi@goffi.org>
date Fri, 12 Aug 2011 14:07:55 +0200
parents f964dcec1611
children e66d300c5d42
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
goffi@necton2
parents:
diff changeset
1 #!/usr/bin/python
goffi@necton2
parents:
diff changeset
2 #-*- coding: utf-8 -*-
goffi@necton2
parents:
diff changeset
3
goffi@necton2
parents:
diff changeset
4 """
goffi@necton2
parents:
diff changeset
5 SAT communication bridge
228
b1794cbb88e5 2011 copyright upgrade
Goffi <goffi@goffi.org>
parents: 223
diff changeset
6 Copyright (C) 2009, 2010, 2011 Jérôme Poisson (goffi@goffi.org)
0
goffi@necton2
parents:
diff changeset
7
goffi@necton2
parents:
diff changeset
8 This program is free software: you can redistribute it and/or modify
goffi@necton2
parents:
diff changeset
9 it under the terms of the GNU General Public License as published by
goffi@necton2
parents:
diff changeset
10 the Free Software Foundation, either version 3 of the License, or
goffi@necton2
parents:
diff changeset
11 (at your option) any later version.
goffi@necton2
parents:
diff changeset
12
goffi@necton2
parents:
diff changeset
13 This program is distributed in the hope that it will be useful,
goffi@necton2
parents:
diff changeset
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
goffi@necton2
parents:
diff changeset
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
goffi@necton2
parents:
diff changeset
16 GNU General Public License for more details.
goffi@necton2
parents:
diff changeset
17
goffi@necton2
parents:
diff changeset
18 You should have received a copy of the GNU General Public License
goffi@necton2
parents:
diff changeset
19 along with this program. If not, see <http://www.gnu.org/licenses/>.
goffi@necton2
parents:
diff changeset
20 """
goffi@necton2
parents:
diff changeset
21
goffi@necton2
parents:
diff changeset
22 from bridge_frontend import BridgeFrontend
goffi@necton2
parents:
diff changeset
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
goffi@necton2
parents:
diff changeset
25
360
6b5626c37909 bridge: regenerated DBus bridge
Goffi <goffi@goffi.org>
parents: 345
diff changeset
26 const_INT_PREFIX = "org.goffi.SAT" #Interface prefix
6b5626c37909 bridge: regenerated DBus bridge
Goffi <goffi@goffi.org>
parents: 345
diff changeset
27 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
28 const_CORE_SUFFIX = ".core"
f964dcec1611 core: plugins refactored according to bridge + updatedValue now use profile
Goffi <goffi@goffi.org>
parents: 365
diff changeset
29 const_PLUGIN_SUFFIX = ".plugin"
360
6b5626c37909 bridge: regenerated DBus bridge
Goffi <goffi@goffi.org>
parents: 345
diff changeset
30
165
8a2053de6f8c Frontends: management of unlaunched SàT Backend (information message and exit)
Goffi <goffi@goffi.org>
parents: 136
diff changeset
31 class BridgeExceptionNoService(Exception):
8a2053de6f8c Frontends: management of unlaunched SàT Backend (information message and exit)
Goffi <goffi@goffi.org>
parents: 136
diff changeset
32 pass
0
goffi@necton2
parents:
diff changeset
33
goffi@necton2
parents:
diff changeset
34 class DBusBridgeFrontend(BridgeFrontend):
goffi@necton2
parents:
diff changeset
35 def __init__(self):
165
8a2053de6f8c Frontends: management of unlaunched SàT Backend (information message and exit)
Goffi <goffi@goffi.org>
parents: 136
diff changeset
36 try:
8a2053de6f8c Frontends: management of unlaunched SàT Backend (information message and exit)
Goffi <goffi@goffi.org>
parents: 136
diff changeset
37 self.sessions_bus = dbus.SessionBus()
360
6b5626c37909 bridge: regenerated DBus bridge
Goffi <goffi@goffi.org>
parents: 345
diff changeset
38 self.db_object = self.sessions_bus.get_object(const_INT_PREFIX,
6b5626c37909 bridge: regenerated DBus bridge
Goffi <goffi@goffi.org>
parents: 345
diff changeset
39 const_OBJ_PATH)
372
f964dcec1611 core: plugins refactored according to bridge + updatedValue now use profile
Goffi <goffi@goffi.org>
parents: 365
diff changeset
40 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
41 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
42 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
43 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
44 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
45 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
46 raise BridgeExceptionNoService
8a2053de6f8c Frontends: management of unlaunched SàT Backend (information message and exit)
Goffi <goffi@goffi.org>
parents: 136
diff changeset
47 else:
8a2053de6f8c Frontends: management of unlaunched SàT Backend (information message and exit)
Goffi <goffi@goffi.org>
parents: 136
diff changeset
48 raise e
372
f964dcec1611 core: plugins refactored according to bridge + updatedValue now use profile
Goffi <goffi@goffi.org>
parents: 365
diff changeset
49 #props = self.db_core_iface.getProperties()
0
goffi@necton2
parents:
diff changeset
50
372
f964dcec1611 core: plugins refactored according to bridge + updatedValue now use profile
Goffi <goffi@goffi.org>
parents: 365
diff changeset
51 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
52 if iface == "core":
f964dcec1611 core: plugins refactored according to bridge + updatedValue now use profile
Goffi <goffi@goffi.org>
parents: 365
diff changeset
53 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
54 elif iface == "plugin":
f964dcec1611 core: plugins refactored according to bridge + updatedValue now use profile
Goffi <goffi@goffi.org>
parents: 365
diff changeset
55 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
56 else:
f964dcec1611 core: plugins refactored according to bridge + updatedValue now use profile
Goffi <goffi@goffi.org>
parents: 365
diff changeset
57 error(_('Unknown interface'))
0
goffi@necton2
parents:
diff changeset
58
272
1d2e0dfe7114 bridge: core & frontend sides of bridge are now generated
Goffi <goffi@goffi.org>
parents: 267
diff changeset
59 def addContact(self, entity, profile_key="@DEFAULT@"):
372
f964dcec1611 core: plugins refactored according to bridge + updatedValue now use profile
Goffi <goffi@goffi.org>
parents: 365
diff changeset
60 return self.db_core_iface.addContact(entity, profile_key)
272
1d2e0dfe7114 bridge: core & frontend sides of bridge are now generated
Goffi <goffi@goffi.org>
parents: 267
diff changeset
61
337
4402ac630712 bridge: async callback managed in bridge_constructor + misc
Goffi <goffi@goffi.org>
parents: 336
diff changeset
62 def asyncConnect(self, 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
63 return self.db_core_iface.asyncConnect(profile_key, reply_handler=callback, error_handler=errback)
337
4402ac630712 bridge: async callback managed in bridge_constructor + misc
Goffi <goffi@goffi.org>
parents: 336
diff changeset
64
272
1d2e0dfe7114 bridge: core & frontend sides of bridge are now generated
Goffi <goffi@goffi.org>
parents: 267
diff changeset
65 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
66 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
67
1d2e0dfe7114 bridge: core & frontend sides of bridge are now generated
Goffi <goffi@goffi.org>
parents: 267
diff changeset
68 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
69 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
70
1d2e0dfe7114 bridge: core & frontend sides of bridge are now generated
Goffi <goffi@goffi.org>
parents: 267
diff changeset
71 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
72 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
73
1d2e0dfe7114 bridge: core & frontend sides of bridge are now generated
Goffi <goffi@goffi.org>
parents: 267
diff changeset
74 def createProfile(self, profile):
372
f964dcec1611 core: plugins refactored according to bridge + updatedValue now use profile
Goffi <goffi@goffi.org>
parents: 365
diff changeset
75 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
76
1d2e0dfe7114 bridge: core & frontend sides of bridge are now generated
Goffi <goffi@goffi.org>
parents: 267
diff changeset
77 def delContact(self, entity, profile_key="@DEFAULT@"):
372
f964dcec1611 core: plugins refactored according to bridge + updatedValue now use profile
Goffi <goffi@goffi.org>
parents: 365
diff changeset
78 return self.db_core_iface.delContact(entity, profile_key)
272
1d2e0dfe7114 bridge: core & frontend sides of bridge are now generated
Goffi <goffi@goffi.org>
parents: 267
diff changeset
79
1d2e0dfe7114 bridge: core & frontend sides of bridge are now generated
Goffi <goffi@goffi.org>
parents: 267
diff changeset
80 def deleteProfile(self, profile):
372
f964dcec1611 core: plugins refactored according to bridge + updatedValue now use profile
Goffi <goffi@goffi.org>
parents: 365
diff changeset
81 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
82
1d2e0dfe7114 bridge: core & frontend sides of bridge are now generated
Goffi <goffi@goffi.org>
parents: 267
diff changeset
83 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
84 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
85
365
efbfccfed623 core: local_dir moved to config file
Goffi <goffi@goffi.org>
parents: 364
diff changeset
86 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
87 return unicode(self.db_core_iface.getConfig(section, name))
364
312ca6f9d84a core: configuration file
Goffi <goffi@goffi.org>
parents: 362
diff changeset
88
272
1d2e0dfe7114 bridge: core & frontend sides of bridge are now generated
Goffi <goffi@goffi.org>
parents: 267
diff changeset
89 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
90 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
91
1d2e0dfe7114 bridge: core & frontend sides of bridge are now generated
Goffi <goffi@goffi.org>
parents: 267
diff changeset
92 def getHistory(self, from_jid, to_jid, size):
372
f964dcec1611 core: plugins refactored according to bridge + updatedValue now use profile
Goffi <goffi@goffi.org>
parents: 365
diff changeset
93 return self.db_core_iface.getHistory(from_jid, to_jid, size)
272
1d2e0dfe7114 bridge: core & frontend sides of bridge are now generated
Goffi <goffi@goffi.org>
parents: 267
diff changeset
94
1d2e0dfe7114 bridge: core & frontend sides of bridge are now generated
Goffi <goffi@goffi.org>
parents: 267
diff changeset
95 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
96 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
97
1d2e0dfe7114 bridge: core & frontend sides of bridge are now generated
Goffi <goffi@goffi.org>
parents: 267
diff changeset
98 def getMenus(self, ):
372
f964dcec1611 core: plugins refactored according to bridge + updatedValue now use profile
Goffi <goffi@goffi.org>
parents: 365
diff changeset
99 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
100
1d2e0dfe7114 bridge: core & frontend sides of bridge are now generated
Goffi <goffi@goffi.org>
parents: 267
diff changeset
101 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
102 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
103
1d2e0dfe7114 bridge: core & frontend sides of bridge are now generated
Goffi <goffi@goffi.org>
parents: 267
diff changeset
104 def getParams(self, profile_key="@DEFAULT@"):
372
f964dcec1611 core: plugins refactored according to bridge + updatedValue now use profile
Goffi <goffi@goffi.org>
parents: 365
diff changeset
105 return unicode(self.db_core_iface.getParams(profile_key))
272
1d2e0dfe7114 bridge: core & frontend sides of bridge are now generated
Goffi <goffi@goffi.org>
parents: 267
diff changeset
106
1d2e0dfe7114 bridge: core & frontend sides of bridge are now generated
Goffi <goffi@goffi.org>
parents: 267
diff changeset
107 def getParamsCategories(self, ):
372
f964dcec1611 core: plugins refactored according to bridge + updatedValue now use profile
Goffi <goffi@goffi.org>
parents: 365
diff changeset
108 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
109
1d2e0dfe7114 bridge: core & frontend sides of bridge are now generated
Goffi <goffi@goffi.org>
parents: 267
diff changeset
110 def getParamsForCategory(self, category, profile_key="@DEFAULT@"):
372
f964dcec1611 core: plugins refactored according to bridge + updatedValue now use profile
Goffi <goffi@goffi.org>
parents: 365
diff changeset
111 return unicode(self.db_core_iface.getParamsForCategory(category, profile_key))
272
1d2e0dfe7114 bridge: core & frontend sides of bridge are now generated
Goffi <goffi@goffi.org>
parents: 267
diff changeset
112
1d2e0dfe7114 bridge: core & frontend sides of bridge are now generated
Goffi <goffi@goffi.org>
parents: 267
diff changeset
113 def getParamsUI(self, profile_key="@DEFAULT@"):
372
f964dcec1611 core: plugins refactored according to bridge + updatedValue now use profile
Goffi <goffi@goffi.org>
parents: 365
diff changeset
114 return unicode(self.db_core_iface.getParamsUI(profile_key))
272
1d2e0dfe7114 bridge: core & frontend sides of bridge are now generated
Goffi <goffi@goffi.org>
parents: 267
diff changeset
115
1d2e0dfe7114 bridge: core & frontend sides of bridge are now generated
Goffi <goffi@goffi.org>
parents: 267
diff changeset
116 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
117 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
118
1d2e0dfe7114 bridge: core & frontend sides of bridge are now generated
Goffi <goffi@goffi.org>
parents: 267
diff changeset
119 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
120 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
121
1d2e0dfe7114 bridge: core & frontend sides of bridge are now generated
Goffi <goffi@goffi.org>
parents: 267
diff changeset
122 def getProfilesList(self, ):
372
f964dcec1611 core: plugins refactored according to bridge + updatedValue now use profile
Goffi <goffi@goffi.org>
parents: 365
diff changeset
123 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
124
1d2e0dfe7114 bridge: core & frontend sides of bridge are now generated
Goffi <goffi@goffi.org>
parents: 267
diff changeset
125 def getProgress(self, id):
372
f964dcec1611 core: plugins refactored according to bridge + updatedValue now use profile
Goffi <goffi@goffi.org>
parents: 365
diff changeset
126 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
127
1d2e0dfe7114 bridge: core & frontend sides of bridge are now generated
Goffi <goffi@goffi.org>
parents: 267
diff changeset
128 def getVersion(self, ):
372
f964dcec1611 core: plugins refactored according to bridge + updatedValue now use profile
Goffi <goffi@goffi.org>
parents: 365
diff changeset
129 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
130
1d2e0dfe7114 bridge: core & frontend sides of bridge are now generated
Goffi <goffi@goffi.org>
parents: 267
diff changeset
131 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
132 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
133
1d2e0dfe7114 bridge: core & frontend sides of bridge are now generated
Goffi <goffi@goffi.org>
parents: 267
diff changeset
134 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
135 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
136
1d2e0dfe7114 bridge: core & frontend sides of bridge are now generated
Goffi <goffi@goffi.org>
parents: 267
diff changeset
137 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
138 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
139
336
953536246d9d core: added email in registerNewAccount
Goffi <goffi@goffi.org>
parents: 320
diff changeset
140 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
141 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
142
1d2e0dfe7114 bridge: core & frontend sides of bridge are now generated
Goffi <goffi@goffi.org>
parents: 267
diff changeset
143 def sendMessage(self, to_jid, message, subject='', mess_type="chat", profile_key="@DEFAULT@"):
372
f964dcec1611 core: plugins refactored according to bridge + updatedValue now use profile
Goffi <goffi@goffi.org>
parents: 365
diff changeset
144 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
145
1d2e0dfe7114 bridge: core & frontend sides of bridge are now generated
Goffi <goffi@goffi.org>
parents: 267
diff changeset
146 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
147 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
148
1d2e0dfe7114 bridge: core & frontend sides of bridge are now generated
Goffi <goffi@goffi.org>
parents: 267
diff changeset
149 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
150 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
151
1d2e0dfe7114 bridge: core & frontend sides of bridge are now generated
Goffi <goffi@goffi.org>
parents: 267
diff changeset
152 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
153 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
154
345
e6047415868d Bridge: added updateContact method
Goffi <goffi@goffi.org>
parents: 337
diff changeset
155 def updateContact(self, entity, name, groups, profile_key="@DEFAULT@"):
372
f964dcec1611 core: plugins refactored according to bridge + updatedValue now use profile
Goffi <goffi@goffi.org>
parents: 365
diff changeset
156 return self.db_core_iface.updateContact(entity, name, groups, profile_key)
345
e6047415868d Bridge: added updateContact method
Goffi <goffi@goffi.org>
parents: 337
diff changeset
157
101
783e9d6980ec Couchsurfing plugin: first draft
Goffi <goffi@goffi.org>
parents: 92
diff changeset
158
65
d35c5edab53f SàT: multi-profile: memory & dbus bridge's methods profile management
Goffi <goffi@goffi.org>
parents: 64
diff changeset
159 #methods from plugins
78
ace2af8abc5a Added method to know which MUC are joined, and which subjects were received.
Goffi <goffi@goffi.org>
parents: 72
diff changeset
160 def getRoomJoined(self, profile_key='@DEFAULT@'):
372
f964dcec1611 core: plugins refactored according to bridge + updatedValue now use profile
Goffi <goffi@goffi.org>
parents: 365
diff changeset
161 return self.db_plugin_iface.getRoomJoined(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
162
ace2af8abc5a Added method to know which MUC are joined, and which subjects were received.
Goffi <goffi@goffi.org>
parents: 72
diff changeset
163 def getRoomSubjects(self, profile_key='@DEFAULT@'):
372
f964dcec1611 core: plugins refactored according to bridge + updatedValue now use profile
Goffi <goffi@goffi.org>
parents: 365
diff changeset
164 return self.db_plugin_iface.getRoomSubjects(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
165
72
f271fff3a713 MUC implementation: first draft
Goffi <goffi@goffi.org>
parents: 68
diff changeset
166 def joinMUC(self, service, roomId, nick, profile_key='@DEFAULT@'):
372
f964dcec1611 core: plugins refactored according to bridge + updatedValue now use profile
Goffi <goffi@goffi.org>
parents: 365
diff changeset
167 return self.db_plugin_iface.joinMUC(service, roomId, nick, profile_key)
72
f271fff3a713 MUC implementation: first draft
Goffi <goffi@goffi.org>
parents: 68
diff changeset
168
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
169 def tarotGameLaunch(self, players, profile_key='@DEFAULT@'):
372
f964dcec1611 core: plugins refactored according to bridge + updatedValue now use profile
Goffi <goffi@goffi.org>
parents: 365
diff changeset
170 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
171
90
4020931569b8 Tarot Game: session initialization
Goffi <goffi@goffi.org>
parents: 85
diff changeset
172 def tarotGameCreate(self, room_jid, players, profile_key='@DEFAULT@'):
372
f964dcec1611 core: plugins refactored according to bridge + updatedValue now use profile
Goffi <goffi@goffi.org>
parents: 365
diff changeset
173 return self.db_plugin_iface.tarotGameCreate(room_jid, players, profile_key)
90
4020931569b8 Tarot Game: session initialization
Goffi <goffi@goffi.org>
parents: 85
diff changeset
174
92
2503de7fb4c7 Tarot game: chien/écart stage
Goffi <goffi@goffi.org>
parents: 91
diff changeset
175 def tarotGameReady(self, player, referee, profile_key='@DEFAULT@'):
372
f964dcec1611 core: plugins refactored according to bridge + updatedValue now use profile
Goffi <goffi@goffi.org>
parents: 365
diff changeset
176 return self.db_plugin_iface.tarotGameReady(player, referee, profile_key)
85
fc7583282d40 Tarot Game plugin: first draft
Goffi <goffi@goffi.org>
parents: 78
diff changeset
177
92
2503de7fb4c7 Tarot game: chien/écart stage
Goffi <goffi@goffi.org>
parents: 91
diff changeset
178 def tarotGameContratChoosed(self, player, referee, contrat, profile_key='@DEFAULT@'):
372
f964dcec1611 core: plugins refactored according to bridge + updatedValue now use profile
Goffi <goffi@goffi.org>
parents: 365
diff changeset
179 return self.db_plugin_iface.tarotGameContratChoosed(player, referee, contrat, profile_key)
92
2503de7fb4c7 Tarot game: chien/écart stage
Goffi <goffi@goffi.org>
parents: 91
diff changeset
180
2503de7fb4c7 Tarot game: chien/écart stage
Goffi <goffi@goffi.org>
parents: 91
diff changeset
181 def tarotGamePlayCards(self, player, referee, cards, profile_key='@DEFAULT@'):
372
f964dcec1611 core: plugins refactored according to bridge + updatedValue now use profile
Goffi <goffi@goffi.org>
parents: 365
diff changeset
182 return self.db_plugin_iface.tarotGamePlayCards(player, referee, cards, profile_key)
91
39c672544593 Tarot: bidding phase
Goffi <goffi@goffi.org>
parents: 90
diff changeset
183
361
141eeb7cd9e6 Quizz game: first draft
Goffi <goffi@goffi.org>
parents: 360
diff changeset
184 def quizGameLaunch(self, players, profile_key='@DEFAULT@'):
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.quizGameLaunch(players, profile_key)
361
141eeb7cd9e6 Quizz game: first draft
Goffi <goffi@goffi.org>
parents: 360
diff changeset
186
141eeb7cd9e6 Quizz game: first draft
Goffi <goffi@goffi.org>
parents: 360
diff changeset
187 def quizGameCreate(self, room_jid, players, profile_key='@DEFAULT@'):
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.quizGameCreate(room_jid, players, profile_key)
361
141eeb7cd9e6 Quizz game: first draft
Goffi <goffi@goffi.org>
parents: 360
diff changeset
189
141eeb7cd9e6 Quizz game: first draft
Goffi <goffi@goffi.org>
parents: 360
diff changeset
190 def quizGameReady(self, player, referee, profile_key='@DEFAULT@'):
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.quizGameReady(player, referee, profile_key)
361
141eeb7cd9e6 Quizz game: first draft
Goffi <goffi@goffi.org>
parents: 360
diff changeset
192
362
208107419b17 Quiz game: buzzer, timer, answer management
Goffi <goffi@goffi.org>
parents: 361
diff changeset
193 def quizGameAnswer(self, player, referee, answer, profile_key='@DEFAULT@'):
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.quizGameAnswer(player, referee, answer, profile_key)
362
208107419b17 Quiz game: buzzer, timer, answer management
Goffi <goffi@goffi.org>
parents: 361
diff changeset
195
64
d46f849664aa SàT: multi-profile, plugins updated
Goffi <goffi@goffi.org>
parents: 57
diff changeset
196 def sendFile(self, to, path, profile_key='@DEFAULT@'):
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.sendFile(to, path, profile_key)
0
goffi@necton2
parents:
diff changeset
198
65
d35c5edab53f SàT: multi-profile: memory & dbus bridge's methods profile management
Goffi <goffi@goffi.org>
parents: 64
diff changeset
199 def findGateways(self, target, profile_key='@DEFAULT@'):
372
f964dcec1611 core: plugins refactored according to bridge + updatedValue now use profile
Goffi <goffi@goffi.org>
parents: 365
diff changeset
200 return self.db_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
201
64
d46f849664aa SàT: multi-profile, plugins updated
Goffi <goffi@goffi.org>
parents: 57
diff changeset
202 def getCard(self, target, profile_key='@DEFAULT@'):
372
f964dcec1611 core: plugins refactored according to bridge + updatedValue now use profile
Goffi <goffi@goffi.org>
parents: 365
diff changeset
203 return self.db_plugin_iface.getCard(target, profile_key)
42
874de3020e1c Initial VCard (XEP-0054) support + misc fixes
Goffi <goffi@goffi.org>
parents: 37
diff changeset
204
64
d46f849664aa SàT: multi-profile, plugins updated
Goffi <goffi@goffi.org>
parents: 57
diff changeset
205 def getCardCache(self, target):
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.getCardCache(target)
51
8c67ea98ab91 frontend improved to take into account new SàT features
Goffi <goffi@goffi.org>
parents: 43
diff changeset
207
43
8a438a6ff587 Wix: added avatar in profile
Goffi <goffi@goffi.org>
parents: 42
diff changeset
208 def getAvatarFile(self, hash):
372
f964dcec1611 core: plugins refactored according to bridge + updatedValue now use profile
Goffi <goffi@goffi.org>
parents: 365
diff changeset
209 return self.db_plugin_iface.getAvatarFile(hash)
43
8a438a6ff587 Wix: added avatar in profile
Goffi <goffi@goffi.org>
parents: 42
diff changeset
210
64
d46f849664aa SàT: multi-profile, plugins updated
Goffi <goffi@goffi.org>
parents: 57
diff changeset
211 def in_band_register(self, target, profile_key='@DEFAULT@'):
372
f964dcec1611 core: plugins refactored according to bridge + updatedValue now use profile
Goffi <goffi@goffi.org>
parents: 365
diff changeset
212 return self.db_plugin_iface.in_band_register(target, profile_key)
0
goffi@necton2
parents:
diff changeset
213
171
96af1bec2e68 Dbus bridge (frontend): added profile_key argument for gatewayRegister
Goffi <goffi@goffi.org>
parents: 165
diff changeset
214 def gatewayRegister(self, action, target, data, profile_key='@DEFAULT@'):
37
a61beb21d16d Gateway registration, unregistration & edition
Goffi <goffi@goffi.org>
parents: 36
diff changeset
215 if data == None:
101
783e9d6980ec Couchsurfing plugin: first draft
Goffi <goffi@goffi.org>
parents: 92
diff changeset
216 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
217 return self.db_plugin_iface.gatewayRegister(action, target, data, profile_key)
36
6491b7956c80 wix: Form submitting, first draft
Goffi <goffi@goffi.org>
parents: 30
diff changeset
218
303
2b52a5da0978 plugin XEP_0277: microblog access model can now be changed
Goffi <goffi@goffi.org>
parents: 276
diff changeset
219 def getLastMicroblogs(self, jid, max_items, 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
220 return self.db_plugin_iface.getLastMicroblogs(jid, max_items, profile_key, reply_handler=callback, error_handler=errback)
304
e04ccf122bb6 microblog sending
Goffi <goffi@goffi.org>
parents: 303
diff changeset
221
307
1e4575e12581 Group blog first draft
Goffi <goffi@goffi.org>
parents: 304
diff changeset
222 def getMblogNodes(self, 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
223 return self.db_plugin_iface.getMblogNodes(profile_key, reply_handler=callback, error_handler=errback)
307
1e4575e12581 Group blog first draft
Goffi <goffi@goffi.org>
parents: 304
diff changeset
224
1e4575e12581 Group blog first draft
Goffi <goffi@goffi.org>
parents: 304
diff changeset
225 def sendGroupBlog(self, groups, message, profile_key='@DEFAULT@'):
372
f964dcec1611 core: plugins refactored according to bridge + updatedValue now use profile
Goffi <goffi@goffi.org>
parents: 365
diff changeset
226 return self.db_plugin_iface.sendGroupBlog(groups, message, profile_key)
307
1e4575e12581 Group blog first draft
Goffi <goffi@goffi.org>
parents: 304
diff changeset
227
304
e04ccf122bb6 microblog sending
Goffi <goffi@goffi.org>
parents: 303
diff changeset
228 def sendPersonalEvent(self, event_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
229 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
230
4402ac630712 bridge: async callback managed in bridge_constructor + misc
Goffi <goffi@goffi.org>
parents: 336
diff changeset
231 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
232 return self.db_plugin_iface.setMicroblogAccess(access, profile_key, reply_handler=callback, error_handler=errback)