Mercurial > libervia-backend
annotate frontends/src/bridge/DBus.py @ 303:2b52a5da0978
plugin XEP_0277: microblog access model can now be changed
plugin XEP_0060: added some method to manage pubsub nodes
author | Goffi <goffi@goffi.org> |
---|---|
date | Thu, 24 Mar 2011 21:15:26 +0100 |
parents | a00e87d48213 |
children | e04ccf122bb6 |
rev | line source |
---|---|
0 | 1 #!/usr/bin/python |
2 #-*- coding: utf-8 -*- | |
3 | |
4 """ | |
5 SAT communication bridge | |
228 | 6 Copyright (C) 2009, 2010, 2011 Jérôme Poisson (goffi@goffi.org) |
0 | 7 |
8 This program is free software: you can redistribute it and/or modify | |
9 it under the terms of the GNU General Public License as published by | |
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 | |
16 GNU General Public License for more details. | |
17 | |
18 You should have received a copy of the GNU General Public License | |
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 | |
272
1d2e0dfe7114
bridge: core & frontend sides of bridge are now generated
Goffi <goffi@goffi.org>
parents:
267
diff
changeset
|
24 from logging import debug |
0 | 25 |
165
8a2053de6f8c
Frontends: management of unlaunched SàT Backend (information message and exit)
Goffi <goffi@goffi.org>
parents:
136
diff
changeset
|
26 class BridgeExceptionNoService(Exception): |
8a2053de6f8c
Frontends: management of unlaunched SàT Backend (information message and exit)
Goffi <goffi@goffi.org>
parents:
136
diff
changeset
|
27 pass |
0 | 28 |
29 class DBusBridgeFrontend(BridgeFrontend): | |
30 def __init__(self): | |
165
8a2053de6f8c
Frontends: management of unlaunched SàT Backend (information message and exit)
Goffi <goffi@goffi.org>
parents:
136
diff
changeset
|
31 try: |
8a2053de6f8c
Frontends: management of unlaunched SàT Backend (information message and exit)
Goffi <goffi@goffi.org>
parents:
136
diff
changeset
|
32 self.sessions_bus = dbus.SessionBus() |
8a2053de6f8c
Frontends: management of unlaunched SàT Backend (information message and exit)
Goffi <goffi@goffi.org>
parents:
136
diff
changeset
|
33 self.db_object = self.sessions_bus.get_object('org.goffi.SAT', |
8a2053de6f8c
Frontends: management of unlaunched SàT Backend (information message and exit)
Goffi <goffi@goffi.org>
parents:
136
diff
changeset
|
34 '/org/goffi/SAT/bridge') |
8a2053de6f8c
Frontends: management of unlaunched SàT Backend (information message and exit)
Goffi <goffi@goffi.org>
parents:
136
diff
changeset
|
35 self.db_comm_iface = dbus.Interface(self.db_object, |
8a2053de6f8c
Frontends: management of unlaunched SàT Backend (information message and exit)
Goffi <goffi@goffi.org>
parents:
136
diff
changeset
|
36 dbus_interface='org.goffi.SAT.communication') |
8a2053de6f8c
Frontends: management of unlaunched SàT Backend (information message and exit)
Goffi <goffi@goffi.org>
parents:
136
diff
changeset
|
37 self.db_req_iface = dbus.Interface(self.db_object, |
8a2053de6f8c
Frontends: management of unlaunched SàT Backend (information message and exit)
Goffi <goffi@goffi.org>
parents:
136
diff
changeset
|
38 dbus_interface='org.goffi.SAT.request') |
8a2053de6f8c
Frontends: management of unlaunched SàT Backend (information message and exit)
Goffi <goffi@goffi.org>
parents:
136
diff
changeset
|
39 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
|
40 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
|
41 raise BridgeExceptionNoService |
8a2053de6f8c
Frontends: management of unlaunched SàT Backend (information message and exit)
Goffi <goffi@goffi.org>
parents:
136
diff
changeset
|
42 else: |
8a2053de6f8c
Frontends: management of unlaunched SàT Backend (information message and exit)
Goffi <goffi@goffi.org>
parents:
136
diff
changeset
|
43 raise e |
0 | 44 #props = self.db_comm_iface.getProperties() |
45 | |
46 def register(self, functionName, handler, iface="communication"): | |
47 if iface == "communication": | |
48 self.db_comm_iface.connect_to_signal(functionName, handler) | |
49 elif iface == "request": | |
50 self.db_req_iface.connect_to_signal(functionName, handler) | |
51 | |
272
1d2e0dfe7114
bridge: core & frontend sides of bridge are now generated
Goffi <goffi@goffi.org>
parents:
267
diff
changeset
|
52 def addContact(self, entity, profile_key="@DEFAULT@"): |
1d2e0dfe7114
bridge: core & frontend sides of bridge are now generated
Goffi <goffi@goffi.org>
parents:
267
diff
changeset
|
53 debug ("addContact") |
1d2e0dfe7114
bridge: core & frontend sides of bridge are now generated
Goffi <goffi@goffi.org>
parents:
267
diff
changeset
|
54 return self.db_comm_iface.addContact(entity, profile_key) |
1d2e0dfe7114
bridge: core & frontend sides of bridge are now generated
Goffi <goffi@goffi.org>
parents:
267
diff
changeset
|
55 |
1d2e0dfe7114
bridge: core & frontend sides of bridge are now generated
Goffi <goffi@goffi.org>
parents:
267
diff
changeset
|
56 def callMenu(self, category, name, menu_type, profile_key): |
1d2e0dfe7114
bridge: core & frontend sides of bridge are now generated
Goffi <goffi@goffi.org>
parents:
267
diff
changeset
|
57 debug ("callMenu") |
276
a00e87d48213
bridge, bridge constructor: fixed mix stuff
Goffi <goffi@goffi.org>
parents:
272
diff
changeset
|
58 return unicode(self.db_req_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
|
59 |
1d2e0dfe7114
bridge: core & frontend sides of bridge are now generated
Goffi <goffi@goffi.org>
parents:
267
diff
changeset
|
60 def confirmationAnswer(self, id, accepted, data): |
1d2e0dfe7114
bridge: core & frontend sides of bridge are now generated
Goffi <goffi@goffi.org>
parents:
267
diff
changeset
|
61 debug ("confirmationAnswer") |
1d2e0dfe7114
bridge: core & frontend sides of bridge are now generated
Goffi <goffi@goffi.org>
parents:
267
diff
changeset
|
62 return self.db_req_iface.confirmationAnswer(id, accepted, data) |
1d2e0dfe7114
bridge: core & frontend sides of bridge are now generated
Goffi <goffi@goffi.org>
parents:
267
diff
changeset
|
63 |
1d2e0dfe7114
bridge: core & frontend sides of bridge are now generated
Goffi <goffi@goffi.org>
parents:
267
diff
changeset
|
64 def connect(self, profile_key="@DEFAULT@"): |
1d2e0dfe7114
bridge: core & frontend sides of bridge are now generated
Goffi <goffi@goffi.org>
parents:
267
diff
changeset
|
65 debug ("connect") |
1d2e0dfe7114
bridge: core & frontend sides of bridge are now generated
Goffi <goffi@goffi.org>
parents:
267
diff
changeset
|
66 return self.db_comm_iface.connect(profile_key) |
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 createProfile(self, profile): |
1d2e0dfe7114
bridge: core & frontend sides of bridge are now generated
Goffi <goffi@goffi.org>
parents:
267
diff
changeset
|
69 debug ("createProfile") |
1d2e0dfe7114
bridge: core & frontend sides of bridge are now generated
Goffi <goffi@goffi.org>
parents:
267
diff
changeset
|
70 return self.db_req_iface.createProfile(profile) |
1d2e0dfe7114
bridge: core & frontend sides of bridge are now generated
Goffi <goffi@goffi.org>
parents:
267
diff
changeset
|
71 |
1d2e0dfe7114
bridge: core & frontend sides of bridge are now generated
Goffi <goffi@goffi.org>
parents:
267
diff
changeset
|
72 def delContact(self, entity, profile_key="@DEFAULT@"): |
1d2e0dfe7114
bridge: core & frontend sides of bridge are now generated
Goffi <goffi@goffi.org>
parents:
267
diff
changeset
|
73 debug ("delContact") |
1d2e0dfe7114
bridge: core & frontend sides of bridge are now generated
Goffi <goffi@goffi.org>
parents:
267
diff
changeset
|
74 return self.db_comm_iface.delContact(entity, profile_key) |
1d2e0dfe7114
bridge: core & frontend sides of bridge are now generated
Goffi <goffi@goffi.org>
parents:
267
diff
changeset
|
75 |
1d2e0dfe7114
bridge: core & frontend sides of bridge are now generated
Goffi <goffi@goffi.org>
parents:
267
diff
changeset
|
76 def deleteProfile(self, profile): |
1d2e0dfe7114
bridge: core & frontend sides of bridge are now generated
Goffi <goffi@goffi.org>
parents:
267
diff
changeset
|
77 debug ("deleteProfile") |
1d2e0dfe7114
bridge: core & frontend sides of bridge are now generated
Goffi <goffi@goffi.org>
parents:
267
diff
changeset
|
78 return self.db_req_iface.deleteProfile(profile) |
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 disconnect(self, profile_key="@DEFAULT@"): |
1d2e0dfe7114
bridge: core & frontend sides of bridge are now generated
Goffi <goffi@goffi.org>
parents:
267
diff
changeset
|
81 debug ("disconnect") |
1d2e0dfe7114
bridge: core & frontend sides of bridge are now generated
Goffi <goffi@goffi.org>
parents:
267
diff
changeset
|
82 return self.db_comm_iface.disconnect(profile_key) |
1d2e0dfe7114
bridge: core & frontend sides of bridge are now generated
Goffi <goffi@goffi.org>
parents:
267
diff
changeset
|
83 |
1d2e0dfe7114
bridge: core & frontend sides of bridge are now generated
Goffi <goffi@goffi.org>
parents:
267
diff
changeset
|
84 def getContacts(self, profile_key="@DEFAULT@"): |
1d2e0dfe7114
bridge: core & frontend sides of bridge are now generated
Goffi <goffi@goffi.org>
parents:
267
diff
changeset
|
85 debug ("getContacts") |
1d2e0dfe7114
bridge: core & frontend sides of bridge are now generated
Goffi <goffi@goffi.org>
parents:
267
diff
changeset
|
86 return self.db_comm_iface.getContacts(profile_key) |
1d2e0dfe7114
bridge: core & frontend sides of bridge are now generated
Goffi <goffi@goffi.org>
parents:
267
diff
changeset
|
87 |
1d2e0dfe7114
bridge: core & frontend sides of bridge are now generated
Goffi <goffi@goffi.org>
parents:
267
diff
changeset
|
88 def getHistory(self, from_jid, to_jid, size): |
1d2e0dfe7114
bridge: core & frontend sides of bridge are now generated
Goffi <goffi@goffi.org>
parents:
267
diff
changeset
|
89 debug ("getHistory") |
1d2e0dfe7114
bridge: core & frontend sides of bridge are now generated
Goffi <goffi@goffi.org>
parents:
267
diff
changeset
|
90 return self.db_comm_iface.getHistory(from_jid, to_jid, size) |
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 getMenuHelp(self, category, name, menu_type): |
1d2e0dfe7114
bridge: core & frontend sides of bridge are now generated
Goffi <goffi@goffi.org>
parents:
267
diff
changeset
|
93 debug ("getMenuHelp") |
276
a00e87d48213
bridge, bridge constructor: fixed mix stuff
Goffi <goffi@goffi.org>
parents:
272
diff
changeset
|
94 return unicode(self.db_req_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
|
95 |
1d2e0dfe7114
bridge: core & frontend sides of bridge are now generated
Goffi <goffi@goffi.org>
parents:
267
diff
changeset
|
96 def getMenus(self, ): |
1d2e0dfe7114
bridge: core & frontend sides of bridge are now generated
Goffi <goffi@goffi.org>
parents:
267
diff
changeset
|
97 debug ("getMenus") |
1d2e0dfe7114
bridge: core & frontend sides of bridge are now generated
Goffi <goffi@goffi.org>
parents:
267
diff
changeset
|
98 return self.db_req_iface.getMenus() |
1d2e0dfe7114
bridge: core & frontend sides of bridge are now generated
Goffi <goffi@goffi.org>
parents:
267
diff
changeset
|
99 |
1d2e0dfe7114
bridge: core & frontend sides of bridge are now generated
Goffi <goffi@goffi.org>
parents:
267
diff
changeset
|
100 def getParamA(self, name, category, attribute="value", profile_key="@DEFAULT@"): |
1d2e0dfe7114
bridge: core & frontend sides of bridge are now generated
Goffi <goffi@goffi.org>
parents:
267
diff
changeset
|
101 debug ("getParamA") |
276
a00e87d48213
bridge, bridge constructor: fixed mix stuff
Goffi <goffi@goffi.org>
parents:
272
diff
changeset
|
102 return unicode(self.db_comm_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@"): |
1d2e0dfe7114
bridge: core & frontend sides of bridge are now generated
Goffi <goffi@goffi.org>
parents:
267
diff
changeset
|
105 debug ("getParams") |
276
a00e87d48213
bridge, bridge constructor: fixed mix stuff
Goffi <goffi@goffi.org>
parents:
272
diff
changeset
|
106 return unicode(self.db_comm_iface.getParams(profile_key)) |
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 getParamsCategories(self, ): |
1d2e0dfe7114
bridge: core & frontend sides of bridge are now generated
Goffi <goffi@goffi.org>
parents:
267
diff
changeset
|
109 debug ("getParamsCategories") |
1d2e0dfe7114
bridge: core & frontend sides of bridge are now generated
Goffi <goffi@goffi.org>
parents:
267
diff
changeset
|
110 return self.db_comm_iface.getParamsCategories() |
1d2e0dfe7114
bridge: core & frontend sides of bridge are now generated
Goffi <goffi@goffi.org>
parents:
267
diff
changeset
|
111 |
1d2e0dfe7114
bridge: core & frontend sides of bridge are now generated
Goffi <goffi@goffi.org>
parents:
267
diff
changeset
|
112 def getParamsForCategory(self, category, profile_key="@DEFAULT@"): |
1d2e0dfe7114
bridge: core & frontend sides of bridge are now generated
Goffi <goffi@goffi.org>
parents:
267
diff
changeset
|
113 debug ("getParamsForCategory") |
276
a00e87d48213
bridge, bridge constructor: fixed mix stuff
Goffi <goffi@goffi.org>
parents:
272
diff
changeset
|
114 return unicode(self.db_comm_iface.getParamsForCategory(category, 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 getParamsUI(self, profile_key="@DEFAULT@"): |
1d2e0dfe7114
bridge: core & frontend sides of bridge are now generated
Goffi <goffi@goffi.org>
parents:
267
diff
changeset
|
117 debug ("getParamsUI") |
276
a00e87d48213
bridge, bridge constructor: fixed mix stuff
Goffi <goffi@goffi.org>
parents:
272
diff
changeset
|
118 return unicode(self.db_comm_iface.getParamsUI(profile_key)) |
272
1d2e0dfe7114
bridge: core & frontend sides of bridge are now generated
Goffi <goffi@goffi.org>
parents:
267
diff
changeset
|
119 |
1d2e0dfe7114
bridge: core & frontend sides of bridge are now generated
Goffi <goffi@goffi.org>
parents:
267
diff
changeset
|
120 def getPresenceStatus(self, profile_key="@DEFAULT@"): |
1d2e0dfe7114
bridge: core & frontend sides of bridge are now generated
Goffi <goffi@goffi.org>
parents:
267
diff
changeset
|
121 debug ("getPresenceStatus") |
1d2e0dfe7114
bridge: core & frontend sides of bridge are now generated
Goffi <goffi@goffi.org>
parents:
267
diff
changeset
|
122 return self.db_comm_iface.getPresenceStatus(profile_key) |
1d2e0dfe7114
bridge: core & frontend sides of bridge are now generated
Goffi <goffi@goffi.org>
parents:
267
diff
changeset
|
123 |
1d2e0dfe7114
bridge: core & frontend sides of bridge are now generated
Goffi <goffi@goffi.org>
parents:
267
diff
changeset
|
124 def getProfileName(self, profile_key="@DEFAULT@"): |
1d2e0dfe7114
bridge: core & frontend sides of bridge are now generated
Goffi <goffi@goffi.org>
parents:
267
diff
changeset
|
125 debug ("getProfileName") |
276
a00e87d48213
bridge, bridge constructor: fixed mix stuff
Goffi <goffi@goffi.org>
parents:
272
diff
changeset
|
126 return unicode(self.db_req_iface.getProfileName(profile_key)) |
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 getProfilesList(self, ): |
1d2e0dfe7114
bridge: core & frontend sides of bridge are now generated
Goffi <goffi@goffi.org>
parents:
267
diff
changeset
|
129 debug ("getProfilesList") |
1d2e0dfe7114
bridge: core & frontend sides of bridge are now generated
Goffi <goffi@goffi.org>
parents:
267
diff
changeset
|
130 return self.db_req_iface.getProfilesList() |
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 getProgress(self, id): |
1d2e0dfe7114
bridge: core & frontend sides of bridge are now generated
Goffi <goffi@goffi.org>
parents:
267
diff
changeset
|
133 debug ("getProgress") |
1d2e0dfe7114
bridge: core & frontend sides of bridge are now generated
Goffi <goffi@goffi.org>
parents:
267
diff
changeset
|
134 return self.db_req_iface.getProgress(id) |
1d2e0dfe7114
bridge: core & frontend sides of bridge are now generated
Goffi <goffi@goffi.org>
parents:
267
diff
changeset
|
135 |
1d2e0dfe7114
bridge: core & frontend sides of bridge are now generated
Goffi <goffi@goffi.org>
parents:
267
diff
changeset
|
136 def getVersion(self, ): |
1d2e0dfe7114
bridge: core & frontend sides of bridge are now generated
Goffi <goffi@goffi.org>
parents:
267
diff
changeset
|
137 debug ("getVersion") |
276
a00e87d48213
bridge, bridge constructor: fixed mix stuff
Goffi <goffi@goffi.org>
parents:
272
diff
changeset
|
138 return unicode(self.db_req_iface.getVersion()) |
272
1d2e0dfe7114
bridge: core & frontend sides of bridge are now generated
Goffi <goffi@goffi.org>
parents:
267
diff
changeset
|
139 |
1d2e0dfe7114
bridge: core & frontend sides of bridge are now generated
Goffi <goffi@goffi.org>
parents:
267
diff
changeset
|
140 def getWaitingSub(self, profile_key="@DEFAULT@"): |
1d2e0dfe7114
bridge: core & frontend sides of bridge are now generated
Goffi <goffi@goffi.org>
parents:
267
diff
changeset
|
141 debug ("getWaitingSub") |
1d2e0dfe7114
bridge: core & frontend sides of bridge are now generated
Goffi <goffi@goffi.org>
parents:
267
diff
changeset
|
142 return self.db_comm_iface.getWaitingSub(profile_key) |
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@"): |
1d2e0dfe7114
bridge: core & frontend sides of bridge are now generated
Goffi <goffi@goffi.org>
parents:
267
diff
changeset
|
145 debug ("isConnected") |
1d2e0dfe7114
bridge: core & frontend sides of bridge are now generated
Goffi <goffi@goffi.org>
parents:
267
diff
changeset
|
146 return self.db_comm_iface.isConnected(profile_key) |
1d2e0dfe7114
bridge: core & frontend sides of bridge are now generated
Goffi <goffi@goffi.org>
parents:
267
diff
changeset
|
147 |
1d2e0dfe7114
bridge: core & frontend sides of bridge are now generated
Goffi <goffi@goffi.org>
parents:
267
diff
changeset
|
148 def launchAction(self, action_type, data, profile_key="@DEFAULT@"): |
1d2e0dfe7114
bridge: core & frontend sides of bridge are now generated
Goffi <goffi@goffi.org>
parents:
267
diff
changeset
|
149 debug ("launchAction") |
276
a00e87d48213
bridge, bridge constructor: fixed mix stuff
Goffi <goffi@goffi.org>
parents:
272
diff
changeset
|
150 return unicode(self.db_req_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
|
151 |
1d2e0dfe7114
bridge: core & frontend sides of bridge are now generated
Goffi <goffi@goffi.org>
parents:
267
diff
changeset
|
152 def registerNewAccount(self, login, password, host, port=5222): |
1d2e0dfe7114
bridge: core & frontend sides of bridge are now generated
Goffi <goffi@goffi.org>
parents:
267
diff
changeset
|
153 debug ("registerNewAccount") |
276
a00e87d48213
bridge, bridge constructor: fixed mix stuff
Goffi <goffi@goffi.org>
parents:
272
diff
changeset
|
154 return unicode(self.db_comm_iface.registerNewAccount(login, password, host, port)) |
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 sendMessage(self, to_jid, message, subject='', mess_type="chat", profile_key="@DEFAULT@"): |
1d2e0dfe7114
bridge: core & frontend sides of bridge are now generated
Goffi <goffi@goffi.org>
parents:
267
diff
changeset
|
157 debug ("sendMessage") |
1d2e0dfe7114
bridge: core & frontend sides of bridge are now generated
Goffi <goffi@goffi.org>
parents:
267
diff
changeset
|
158 return self.db_comm_iface.sendMessage(to_jid, message, subject, mess_type, profile_key) |
1d2e0dfe7114
bridge: core & frontend sides of bridge are now generated
Goffi <goffi@goffi.org>
parents:
267
diff
changeset
|
159 |
1d2e0dfe7114
bridge: core & frontend sides of bridge are now generated
Goffi <goffi@goffi.org>
parents:
267
diff
changeset
|
160 def setParam(self, name, value, category, profile_key="@DEFAULT@"): |
1d2e0dfe7114
bridge: core & frontend sides of bridge are now generated
Goffi <goffi@goffi.org>
parents:
267
diff
changeset
|
161 debug ("setParam") |
1d2e0dfe7114
bridge: core & frontend sides of bridge are now generated
Goffi <goffi@goffi.org>
parents:
267
diff
changeset
|
162 return self.db_comm_iface.setParam(name, value, category, profile_key) |
1d2e0dfe7114
bridge: core & frontend sides of bridge are now generated
Goffi <goffi@goffi.org>
parents:
267
diff
changeset
|
163 |
1d2e0dfe7114
bridge: core & frontend sides of bridge are now generated
Goffi <goffi@goffi.org>
parents:
267
diff
changeset
|
164 def setPresence(self, to_jid='', show='', priority=0, statuses={}, profile_key="@DEFAULT@"): |
1d2e0dfe7114
bridge: core & frontend sides of bridge are now generated
Goffi <goffi@goffi.org>
parents:
267
diff
changeset
|
165 debug ("setPresence") |
1d2e0dfe7114
bridge: core & frontend sides of bridge are now generated
Goffi <goffi@goffi.org>
parents:
267
diff
changeset
|
166 return self.db_comm_iface.setPresence(to_jid, show, priority, statuses, profile_key) |
1d2e0dfe7114
bridge: core & frontend sides of bridge are now generated
Goffi <goffi@goffi.org>
parents:
267
diff
changeset
|
167 |
1d2e0dfe7114
bridge: core & frontend sides of bridge are now generated
Goffi <goffi@goffi.org>
parents:
267
diff
changeset
|
168 def subscription(self, sub_type, entity, profile_key="@DEFAULT@"): |
1d2e0dfe7114
bridge: core & frontend sides of bridge are now generated
Goffi <goffi@goffi.org>
parents:
267
diff
changeset
|
169 debug ("subscription") |
1d2e0dfe7114
bridge: core & frontend sides of bridge are now generated
Goffi <goffi@goffi.org>
parents:
267
diff
changeset
|
170 return self.db_comm_iface.subscription(sub_type, entity, profile_key) |
1d2e0dfe7114
bridge: core & frontend sides of bridge are now generated
Goffi <goffi@goffi.org>
parents:
267
diff
changeset
|
171 |
101 | 172 |
65
d35c5edab53f
SàT: multi-profile: memory & dbus bridge's methods profile management
Goffi <goffi@goffi.org>
parents:
64
diff
changeset
|
173 #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
|
174 def getRoomJoined(self, profile_key='@DEFAULT@'): |
ace2af8abc5a
Added method to know which MUC are joined, and which subjects were received.
Goffi <goffi@goffi.org>
parents:
72
diff
changeset
|
175 return self.db_comm_iface.getRoomJoined(profile_key) |
ace2af8abc5a
Added method to know which MUC are joined, and which subjects were received.
Goffi <goffi@goffi.org>
parents:
72
diff
changeset
|
176 |
ace2af8abc5a
Added method to know which MUC are joined, and which subjects were received.
Goffi <goffi@goffi.org>
parents:
72
diff
changeset
|
177 def getRoomSubjects(self, profile_key='@DEFAULT@'): |
ace2af8abc5a
Added method to know which MUC are joined, and which subjects were received.
Goffi <goffi@goffi.org>
parents:
72
diff
changeset
|
178 return self.db_comm_iface.getRoomSubjects(profile_key) |
ace2af8abc5a
Added method to know which MUC are joined, and which subjects were received.
Goffi <goffi@goffi.org>
parents:
72
diff
changeset
|
179 |
72 | 180 def joinMUC(self, service, roomId, nick, profile_key='@DEFAULT@'): |
181 return self.db_comm_iface.joinMUC(service, roomId, nick, profile_key) | |
182 | |
90 | 183 def tarotGameCreate(self, room_jid, players, profile_key='@DEFAULT@'): |
184 return self.db_comm_iface.tarotGameCreate(room_jid, players, profile_key) | |
185 | |
92 | 186 def tarotGameReady(self, player, referee, profile_key='@DEFAULT@'): |
187 return self.db_comm_iface.tarotGameReady(player, referee, profile_key) | |
85 | 188 |
92 | 189 def tarotGameContratChoosed(self, player, referee, contrat, profile_key='@DEFAULT@'): |
190 return self.db_comm_iface.tarotGameContratChoosed(player, referee, contrat, profile_key) | |
191 | |
192 def tarotGamePlayCards(self, player, referee, cards, profile_key='@DEFAULT@'): | |
193 return self.db_comm_iface.tarotGamePlayCards(player, referee, cards, profile_key) | |
91 | 194 |
64 | 195 def sendFile(self, to, path, profile_key='@DEFAULT@'): |
196 return self.db_comm_iface.sendFile(to, path, profile_key) | |
0 | 197 |
65
d35c5edab53f
SàT: multi-profile: memory & dbus bridge's methods profile management
Goffi <goffi@goffi.org>
parents:
64
diff
changeset
|
198 def findGateways(self, target, profile_key='@DEFAULT@'): |
d35c5edab53f
SàT: multi-profile: memory & dbus bridge's methods profile management
Goffi <goffi@goffi.org>
parents:
64
diff
changeset
|
199 return self.db_comm_iface.findGateways(target, profile_key) |
25
53e921c8a357
new plugin: gateways plugin, and first implementation of findGateways
Goffi <goffi@goffi.org>
parents:
22
diff
changeset
|
200 |
64 | 201 def getCard(self, target, profile_key='@DEFAULT@'): |
202 return self.db_comm_iface.getCard(target, profile_key) | |
42
874de3020e1c
Initial VCard (XEP-0054) support + misc fixes
Goffi <goffi@goffi.org>
parents:
37
diff
changeset
|
203 |
64 | 204 def getCardCache(self, target): |
205 return self.db_comm_iface.getCardCache(target) | |
51
8c67ea98ab91
frontend improved to take into account new SàT features
Goffi <goffi@goffi.org>
parents:
43
diff
changeset
|
206 |
43 | 207 def getAvatarFile(self, hash): |
208 return self.db_comm_iface.getAvatarFile(hash) | |
209 | |
64 | 210 def in_band_register(self, target, profile_key='@DEFAULT@'): |
211 return self.db_comm_iface.in_band_register(target, profile_key) | |
0 | 212 |
171
96af1bec2e68
Dbus bridge (frontend): added profile_key argument for gatewayRegister
Goffi <goffi@goffi.org>
parents:
165
diff
changeset
|
213 def gatewayRegister(self, action, target, data, profile_key='@DEFAULT@'): |
37
a61beb21d16d
Gateway registration, unregistration & edition
Goffi <goffi@goffi.org>
parents:
36
diff
changeset
|
214 if data == None: |
101 | 215 data = [('', '')] #XXX: we have to do this awful hack because python dbus need to guess the signature |
171
96af1bec2e68
Dbus bridge (frontend): added profile_key argument for gatewayRegister
Goffi <goffi@goffi.org>
parents:
165
diff
changeset
|
216 return self.db_req_iface.gatewayRegister(action, target, data, profile_key) |
36 | 217 |
303
2b52a5da0978
plugin XEP_0277: microblog access model can now be changed
Goffi <goffi@goffi.org>
parents:
276
diff
changeset
|
218 def getLastMicroblogs(self, jid, max_items, profile_key='@DEFAULT@', callback=None, errback=None): |
2b52a5da0978
plugin XEP_0277: microblog access model can now be changed
Goffi <goffi@goffi.org>
parents:
276
diff
changeset
|
219 return self.db_comm_iface.getLastMicroblogs(jid, max_items, profile_key, reply_handler=callback, error_handler=errback) |