Mercurial > libervia-backend
annotate sat_bridge/DBus.py @ 22:bb72c29f3432
added action cb mechanism for buttons. Tested with a temporary new user registration button.
author | Goffi <goffi@goffi.org> |
---|---|
date | Tue, 01 Dec 2009 04:56:08 +0100 |
parents | 6928e3cb73a8 |
children | 53e921c8a357 |
rev | line source |
---|---|
0 | 1 #!/usr/bin/python |
2 #-*- coding: utf-8 -*- | |
3 | |
4 """ | |
5 SAT: a jabber client | |
6 Copyright (C) 2009 Jérôme Poisson (goffi@goffi.org) | |
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 | |
23 from bridge import Bridge | |
24 import dbus | |
25 import dbus.service | |
26 import dbus.mainloop.glib | |
27 import pdb | |
28 from logging import debug, info, error | |
29 | |
10 | 30 const_INT_PREFIX = "org.goffi.SAT" #Interface prefix |
16
0a024d5e0cd0
New account creation (in-band registration)
Goffi <goffi@goffi.org>
parents:
10
diff
changeset
|
31 const_COMM_SUFFIX = ".communication" |
0a024d5e0cd0
New account creation (in-band registration)
Goffi <goffi@goffi.org>
parents:
10
diff
changeset
|
32 const_REQ_SUFFIX = ".request" |
7
c14a3a7018a5
added dynamic exportation of Dbus bridge method (usefull for plugins)
Goffi <goffi@goffi.org>
parents:
1
diff
changeset
|
33 |
0 | 34 class DbusObject(dbus.service.Object): |
35 | |
36 def __init__(self, bus, path): | |
37 dbus.service.Object.__init__(self, bus, path) | |
38 debug("Init DbusObject...") | |
39 self.cb={} | |
40 | |
41 def register(self, name, cb): | |
42 self.cb[name]=cb | |
43 | |
44 ### signals ### | |
45 | |
16
0a024d5e0cd0
New account creation (in-band registration)
Goffi <goffi@goffi.org>
parents:
10
diff
changeset
|
46 @dbus.service.signal(const_INT_PREFIX+const_COMM_SUFFIX, |
0 | 47 signature='sa{ss}as') |
48 def newContact(self, contact, attributes, groups): | |
49 debug("new contact signal (%s) sended", contact) | |
50 | |
16
0a024d5e0cd0
New account creation (in-band registration)
Goffi <goffi@goffi.org>
parents:
10
diff
changeset
|
51 @dbus.service.signal(const_INT_PREFIX+const_COMM_SUFFIX, |
0 | 52 signature='ssss') |
53 def newMessage(self, from_jid, msg, type='chat', to=''): | |
54 debug("new message signal (from:%s msg:%s type:%s to:%s) sended", from_jid, msg, type, to) | |
55 | |
16
0a024d5e0cd0
New account creation (in-band registration)
Goffi <goffi@goffi.org>
parents:
10
diff
changeset
|
56 @dbus.service.signal(const_INT_PREFIX+const_COMM_SUFFIX, |
0 | 57 signature='ssssi') |
58 def presenceUpdate(self, jid, type, show, status, priority): | |
59 debug("presence update signal (from:%s type: %s show:%s status:\"%s\" priority:%d) sended" , jid, type, show, status, priority) | |
60 | |
16
0a024d5e0cd0
New account creation (in-band registration)
Goffi <goffi@goffi.org>
parents:
10
diff
changeset
|
61 @dbus.service.signal(const_INT_PREFIX+const_COMM_SUFFIX, |
0 | 62 signature='sss') |
18
6928e3cb73a8
refactoring: using xml params part II
Goffi <goffi@goffi.org>
parents:
17
diff
changeset
|
63 def paramUpdate(self, name, value, category): |
6928e3cb73a8
refactoring: using xml params part II
Goffi <goffi@goffi.org>
parents:
17
diff
changeset
|
64 debug("param update signal: %s=%s in category %s", name, value, category) |
0 | 65 |
16
0a024d5e0cd0
New account creation (in-band registration)
Goffi <goffi@goffi.org>
parents:
10
diff
changeset
|
66 @dbus.service.signal(const_INT_PREFIX+const_COMM_SUFFIX, |
0 | 67 signature='s') |
68 def contactDeleted(self, jid): | |
69 debug("contact deleted signal: %s", jid) | |
70 | |
16
0a024d5e0cd0
New account creation (in-band registration)
Goffi <goffi@goffi.org>
parents:
10
diff
changeset
|
71 @dbus.service.signal(const_INT_PREFIX+const_REQ_SUFFIX, |
0 | 72 signature='ssa{ss}') |
73 def askConfirmation(self, type, id, data): | |
74 debug("asking for confirmation: id = [%s] type = %s data = %s", id, type, data) | |
75 | |
22
bb72c29f3432
added action cb mechanism for buttons. Tested with a temporary new user registration button.
Goffi <goffi@goffi.org>
parents:
18
diff
changeset
|
76 @dbus.service.signal(const_INT_PREFIX+const_REQ_SUFFIX, |
16
0a024d5e0cd0
New account creation (in-band registration)
Goffi <goffi@goffi.org>
parents:
10
diff
changeset
|
77 signature='ssa{ss}') |
22
bb72c29f3432
added action cb mechanism for buttons. Tested with a temporary new user registration button.
Goffi <goffi@goffi.org>
parents:
18
diff
changeset
|
78 def actionResult(self, type, id, data): |
bb72c29f3432
added action cb mechanism for buttons. Tested with a temporary new user registration button.
Goffi <goffi@goffi.org>
parents:
18
diff
changeset
|
79 debug("result of action: id = [%s] type = %s data = %s", id, type, data) |
0 | 80 |
81 ### methods ### | |
82 | |
16
0a024d5e0cd0
New account creation (in-band registration)
Goffi <goffi@goffi.org>
parents:
10
diff
changeset
|
83 @dbus.service.method(const_INT_PREFIX+const_COMM_SUFFIX, |
0a024d5e0cd0
New account creation (in-band registration)
Goffi <goffi@goffi.org>
parents:
10
diff
changeset
|
84 in_signature='sssi', out_signature='s') |
0a024d5e0cd0
New account creation (in-band registration)
Goffi <goffi@goffi.org>
parents:
10
diff
changeset
|
85 def registerNewAccount(self, login, password, host, port=5222): |
0a024d5e0cd0
New account creation (in-band registration)
Goffi <goffi@goffi.org>
parents:
10
diff
changeset
|
86 info ("New account registration asked") |
0a024d5e0cd0
New account creation (in-band registration)
Goffi <goffi@goffi.org>
parents:
10
diff
changeset
|
87 return self.cb["registerNewAccount"](login, password, host, port) |
0a024d5e0cd0
New account creation (in-band registration)
Goffi <goffi@goffi.org>
parents:
10
diff
changeset
|
88 |
0a024d5e0cd0
New account creation (in-band registration)
Goffi <goffi@goffi.org>
parents:
10
diff
changeset
|
89 @dbus.service.method(const_INT_PREFIX+const_COMM_SUFFIX, |
0 | 90 in_signature='', out_signature='') |
91 def connect(self): | |
92 info ("Connection asked") | |
93 return self.cb["connect"]() | |
94 | |
16
0a024d5e0cd0
New account creation (in-band registration)
Goffi <goffi@goffi.org>
parents:
10
diff
changeset
|
95 @dbus.service.method(const_INT_PREFIX+const_COMM_SUFFIX, |
1 | 96 in_signature='', out_signature='') |
97 def disconnect(self): | |
98 info ("Disconnection asked") | |
99 return self.cb["disconnect"]() | |
100 | |
16
0a024d5e0cd0
New account creation (in-band registration)
Goffi <goffi@goffi.org>
parents:
10
diff
changeset
|
101 @dbus.service.method(const_INT_PREFIX+const_COMM_SUFFIX, |
0 | 102 in_signature='', out_signature='a(sa{ss}as)') |
103 def getContacts(self): | |
104 debug("getContacts...") | |
105 return self.cb["getContacts"]() | |
106 | |
16
0a024d5e0cd0
New account creation (in-band registration)
Goffi <goffi@goffi.org>
parents:
10
diff
changeset
|
107 @dbus.service.method(const_INT_PREFIX+const_COMM_SUFFIX, |
0 | 108 in_signature='', out_signature='a(ssssi)') |
109 def getPresenceStatus(self): | |
110 debug("getPresenceStatus...") | |
111 return self.cb["getPresenceStatus"]() | |
112 | |
16
0a024d5e0cd0
New account creation (in-band registration)
Goffi <goffi@goffi.org>
parents:
10
diff
changeset
|
113 @dbus.service.method(const_INT_PREFIX+const_COMM_SUFFIX, |
0 | 114 in_signature='ss', out_signature='') |
115 def sendMessage(self, to, message): | |
116 debug("sendMessage...") | |
117 self.cb["sendMessage"](to, message) | |
118 | |
16
0a024d5e0cd0
New account creation (in-band registration)
Goffi <goffi@goffi.org>
parents:
10
diff
changeset
|
119 @dbus.service.method(const_INT_PREFIX+const_COMM_SUFFIX, |
0 | 120 in_signature='ssssi', out_signature='') |
121 def setPresence(self, to="", type="", show="", status="", priority=0): | |
122 self.cb["setPresence"](to, type, show, status, priority) | |
123 | |
16
0a024d5e0cd0
New account creation (in-band registration)
Goffi <goffi@goffi.org>
parents:
10
diff
changeset
|
124 @dbus.service.method(const_INT_PREFIX+const_COMM_SUFFIX, |
0 | 125 in_signature='sss', out_signature='') |
17
74a39f40eb6d
refactoring: using xml params (not finished yet)
Goffi <goffi@goffi.org>
parents:
16
diff
changeset
|
126 def setParam(self, name, value, category): |
74a39f40eb6d
refactoring: using xml params (not finished yet)
Goffi <goffi@goffi.org>
parents:
16
diff
changeset
|
127 self.cb["setParam"](name, str(value), category) |
0 | 128 |
18
6928e3cb73a8
refactoring: using xml params part II
Goffi <goffi@goffi.org>
parents:
17
diff
changeset
|
129 @dbus.service.method(const_INT_PREFIX+const_COMM_SUFFIX, |
6928e3cb73a8
refactoring: using xml params part II
Goffi <goffi@goffi.org>
parents:
17
diff
changeset
|
130 in_signature='ss', out_signature='s') |
22
bb72c29f3432
added action cb mechanism for buttons. Tested with a temporary new user registration button.
Goffi <goffi@goffi.org>
parents:
18
diff
changeset
|
131 def getParamA(self, name, category="default"): |
bb72c29f3432
added action cb mechanism for buttons. Tested with a temporary new user registration button.
Goffi <goffi@goffi.org>
parents:
18
diff
changeset
|
132 return self.cb["getParamA"](name, category) |
0 | 133 |
16
0a024d5e0cd0
New account creation (in-band registration)
Goffi <goffi@goffi.org>
parents:
10
diff
changeset
|
134 @dbus.service.method(const_INT_PREFIX+const_COMM_SUFFIX, |
17
74a39f40eb6d
refactoring: using xml params (not finished yet)
Goffi <goffi@goffi.org>
parents:
16
diff
changeset
|
135 in_signature='', out_signature='s') |
74a39f40eb6d
refactoring: using xml params (not finished yet)
Goffi <goffi@goffi.org>
parents:
16
diff
changeset
|
136 def getParams(self): |
74a39f40eb6d
refactoring: using xml params (not finished yet)
Goffi <goffi@goffi.org>
parents:
16
diff
changeset
|
137 return self.cb["getParams"]() |
0 | 138 |
16
0a024d5e0cd0
New account creation (in-band registration)
Goffi <goffi@goffi.org>
parents:
10
diff
changeset
|
139 @dbus.service.method(const_INT_PREFIX+const_COMM_SUFFIX, |
18
6928e3cb73a8
refactoring: using xml params part II
Goffi <goffi@goffi.org>
parents:
17
diff
changeset
|
140 in_signature='s', out_signature='s') |
6928e3cb73a8
refactoring: using xml params part II
Goffi <goffi@goffi.org>
parents:
17
diff
changeset
|
141 def getParamsForCategory(self, category): |
6928e3cb73a8
refactoring: using xml params part II
Goffi <goffi@goffi.org>
parents:
17
diff
changeset
|
142 return self.cb["getParamsForCategory"](category) |
6928e3cb73a8
refactoring: using xml params part II
Goffi <goffi@goffi.org>
parents:
17
diff
changeset
|
143 |
6928e3cb73a8
refactoring: using xml params part II
Goffi <goffi@goffi.org>
parents:
17
diff
changeset
|
144 @dbus.service.method(const_INT_PREFIX+const_COMM_SUFFIX, |
0 | 145 in_signature='', out_signature='as') |
146 def getParamsCategories(self): | |
147 return self.cb["getParamsCategories"]() | |
148 | |
16
0a024d5e0cd0
New account creation (in-band registration)
Goffi <goffi@goffi.org>
parents:
10
diff
changeset
|
149 @dbus.service.method(const_INT_PREFIX+const_COMM_SUFFIX, |
0 | 150 in_signature='ssi', out_signature='a{i(ss)}') |
151 def getHistory(self, from_jid, to_jid, size): | |
152 debug("History asked for %s", to_jid) | |
153 return self.cb["getHistory"](from_jid, to_jid, size) | |
154 | |
16
0a024d5e0cd0
New account creation (in-band registration)
Goffi <goffi@goffi.org>
parents:
10
diff
changeset
|
155 @dbus.service.method(const_INT_PREFIX+const_COMM_SUFFIX, |
0 | 156 in_signature='s', out_signature='') |
157 def addContact(self, jid): | |
158 debug("Subscription asked for %s", jid) | |
159 return self.cb["addContact"](jid) | |
160 | |
16
0a024d5e0cd0
New account creation (in-band registration)
Goffi <goffi@goffi.org>
parents:
10
diff
changeset
|
161 @dbus.service.method(const_INT_PREFIX+const_COMM_SUFFIX, |
0 | 162 in_signature='s', out_signature='') |
163 def delContact(self, jid): | |
164 debug("Unsubscription asked for %s", jid) | |
165 return self.cb["delContact"](jid) | |
166 | |
16
0a024d5e0cd0
New account creation (in-band registration)
Goffi <goffi@goffi.org>
parents:
10
diff
changeset
|
167 @dbus.service.method(const_INT_PREFIX+const_COMM_SUFFIX, |
0 | 168 in_signature='', out_signature='b') |
169 def isConnected(self): | |
170 debug("Connection status requested") | |
171 return self.cb["isConnected"]() | |
172 | |
16
0a024d5e0cd0
New account creation (in-band registration)
Goffi <goffi@goffi.org>
parents:
10
diff
changeset
|
173 @dbus.service.method(const_INT_PREFIX+const_REQ_SUFFIX, |
22
bb72c29f3432
added action cb mechanism for buttons. Tested with a temporary new user registration button.
Goffi <goffi@goffi.org>
parents:
18
diff
changeset
|
174 in_signature='sa{ss}', out_signature='s') |
bb72c29f3432
added action cb mechanism for buttons. Tested with a temporary new user registration button.
Goffi <goffi@goffi.org>
parents:
18
diff
changeset
|
175 def launchAction(self, type, data): |
bb72c29f3432
added action cb mechanism for buttons. Tested with a temporary new user registration button.
Goffi <goffi@goffi.org>
parents:
18
diff
changeset
|
176 return self.cb["launchAction"](type, data) |
bb72c29f3432
added action cb mechanism for buttons. Tested with a temporary new user registration button.
Goffi <goffi@goffi.org>
parents:
18
diff
changeset
|
177 |
bb72c29f3432
added action cb mechanism for buttons. Tested with a temporary new user registration button.
Goffi <goffi@goffi.org>
parents:
18
diff
changeset
|
178 @dbus.service.method(const_INT_PREFIX+const_REQ_SUFFIX, |
0 | 179 in_signature='sba{ss}', out_signature='') |
180 def confirmationAnswer(self, id, accepted, data): | |
181 debug("Answer for confirmation [%s]: %s", id, "Accepted" if accepted else "Refused") | |
182 return self.cb["confirmationAnswer"](id, accepted, data) | |
183 | |
16
0a024d5e0cd0
New account creation (in-band registration)
Goffi <goffi@goffi.org>
parents:
10
diff
changeset
|
184 @dbus.service.method(const_INT_PREFIX+const_REQ_SUFFIX, |
0 | 185 in_signature='s', out_signature='a{ss}') |
186 def getProgress(self, id): | |
187 #debug("Progress asked for %s", id) | |
188 return self.cb["getProgress"](id) | |
189 | |
16
0a024d5e0cd0
New account creation (in-band registration)
Goffi <goffi@goffi.org>
parents:
10
diff
changeset
|
190 def __attribute_string(self, in_sign): |
7
c14a3a7018a5
added dynamic exportation of Dbus bridge method (usefull for plugins)
Goffi <goffi@goffi.org>
parents:
1
diff
changeset
|
191 i=0 |
c14a3a7018a5
added dynamic exportation of Dbus bridge method (usefull for plugins)
Goffi <goffi@goffi.org>
parents:
1
diff
changeset
|
192 idx=0 |
c14a3a7018a5
added dynamic exportation of Dbus bridge method (usefull for plugins)
Goffi <goffi@goffi.org>
parents:
1
diff
changeset
|
193 attr_string="" |
c14a3a7018a5
added dynamic exportation of Dbus bridge method (usefull for plugins)
Goffi <goffi@goffi.org>
parents:
1
diff
changeset
|
194 while i<len(in_sign): |
c14a3a7018a5
added dynamic exportation of Dbus bridge method (usefull for plugins)
Goffi <goffi@goffi.org>
parents:
1
diff
changeset
|
195 if in_sign[i] not in ['b','y','n','i','x','q','u','t','d','s','a']: |
c14a3a7018a5
added dynamic exportation of Dbus bridge method (usefull for plugins)
Goffi <goffi@goffi.org>
parents:
1
diff
changeset
|
196 raise Exception #FIXME: create an exception here (unmanaged attribute type) |
c14a3a7018a5
added dynamic exportation of Dbus bridge method (usefull for plugins)
Goffi <goffi@goffi.org>
parents:
1
diff
changeset
|
197 |
c14a3a7018a5
added dynamic exportation of Dbus bridge method (usefull for plugins)
Goffi <goffi@goffi.org>
parents:
1
diff
changeset
|
198 attr_string += ("" if idx==0 else ",") + ("arg_%i" % idx) |
c14a3a7018a5
added dynamic exportation of Dbus bridge method (usefull for plugins)
Goffi <goffi@goffi.org>
parents:
1
diff
changeset
|
199 idx+=1 |
c14a3a7018a5
added dynamic exportation of Dbus bridge method (usefull for plugins)
Goffi <goffi@goffi.org>
parents:
1
diff
changeset
|
200 |
c14a3a7018a5
added dynamic exportation of Dbus bridge method (usefull for plugins)
Goffi <goffi@goffi.org>
parents:
1
diff
changeset
|
201 if in_sign[i] == 'a': |
c14a3a7018a5
added dynamic exportation of Dbus bridge method (usefull for plugins)
Goffi <goffi@goffi.org>
parents:
1
diff
changeset
|
202 while (True): |
c14a3a7018a5
added dynamic exportation of Dbus bridge method (usefull for plugins)
Goffi <goffi@goffi.org>
parents:
1
diff
changeset
|
203 i+=1 |
c14a3a7018a5
added dynamic exportation of Dbus bridge method (usefull for plugins)
Goffi <goffi@goffi.org>
parents:
1
diff
changeset
|
204 if i>=len(in_sign): |
c14a3a7018a5
added dynamic exportation of Dbus bridge method (usefull for plugins)
Goffi <goffi@goffi.org>
parents:
1
diff
changeset
|
205 raise Exception #FIXME: create an exception here (the '}' is not presend) |
c14a3a7018a5
added dynamic exportation of Dbus bridge method (usefull for plugins)
Goffi <goffi@goffi.org>
parents:
1
diff
changeset
|
206 if in_sign[i] == '}': |
c14a3a7018a5
added dynamic exportation of Dbus bridge method (usefull for plugins)
Goffi <goffi@goffi.org>
parents:
1
diff
changeset
|
207 break |
c14a3a7018a5
added dynamic exportation of Dbus bridge method (usefull for plugins)
Goffi <goffi@goffi.org>
parents:
1
diff
changeset
|
208 i+=1 |
c14a3a7018a5
added dynamic exportation of Dbus bridge method (usefull for plugins)
Goffi <goffi@goffi.org>
parents:
1
diff
changeset
|
209 return attr_string |
c14a3a7018a5
added dynamic exportation of Dbus bridge method (usefull for plugins)
Goffi <goffi@goffi.org>
parents:
1
diff
changeset
|
210 |
c14a3a7018a5
added dynamic exportation of Dbus bridge method (usefull for plugins)
Goffi <goffi@goffi.org>
parents:
1
diff
changeset
|
211 |
c14a3a7018a5
added dynamic exportation of Dbus bridge method (usefull for plugins)
Goffi <goffi@goffi.org>
parents:
1
diff
changeset
|
212 |
c14a3a7018a5
added dynamic exportation of Dbus bridge method (usefull for plugins)
Goffi <goffi@goffi.org>
parents:
1
diff
changeset
|
213 def addMethod(self, name, int_suffix, in_sign, out_sign): |
c14a3a7018a5
added dynamic exportation of Dbus bridge method (usefull for plugins)
Goffi <goffi@goffi.org>
parents:
1
diff
changeset
|
214 """Dynamically add a method to Dbus Bridge""" |
c14a3a7018a5
added dynamic exportation of Dbus bridge method (usefull for plugins)
Goffi <goffi@goffi.org>
parents:
1
diff
changeset
|
215 #FIXME: Better way ??? |
16
0a024d5e0cd0
New account creation (in-band registration)
Goffi <goffi@goffi.org>
parents:
10
diff
changeset
|
216 attributes = self.__attribute_string(in_sign) |
7
c14a3a7018a5
added dynamic exportation of Dbus bridge method (usefull for plugins)
Goffi <goffi@goffi.org>
parents:
1
diff
changeset
|
217 |
c14a3a7018a5
added dynamic exportation of Dbus bridge method (usefull for plugins)
Goffi <goffi@goffi.org>
parents:
1
diff
changeset
|
218 code = compile ('def '+name+' (self,'+attributes+'): return self.cb["'+name+'"]('+attributes+')', '<DBus bridge>','exec') |
c14a3a7018a5
added dynamic exportation of Dbus bridge method (usefull for plugins)
Goffi <goffi@goffi.org>
parents:
1
diff
changeset
|
219 exec (code) |
c14a3a7018a5
added dynamic exportation of Dbus bridge method (usefull for plugins)
Goffi <goffi@goffi.org>
parents:
1
diff
changeset
|
220 method = locals()[name] |
c14a3a7018a5
added dynamic exportation of Dbus bridge method (usefull for plugins)
Goffi <goffi@goffi.org>
parents:
1
diff
changeset
|
221 setattr(DbusObject, name, dbus.service.method( |
10 | 222 const_INT_PREFIX+int_suffix, in_signature=in_sign, out_signature=out_sign)(method)) |
7
c14a3a7018a5
added dynamic exportation of Dbus bridge method (usefull for plugins)
Goffi <goffi@goffi.org>
parents:
1
diff
changeset
|
223 |
0 | 224 class DBusBridge(Bridge): |
225 def __init__(self): | |
226 dbus.mainloop.glib.DBusGMainLoop(set_as_default=True) | |
227 Bridge.__init__(self) | |
228 info ("Init DBus...") | |
229 self.session_bus = dbus.SessionBus() | |
10 | 230 self.dbus_name = dbus.service.BusName(const_INT_PREFIX, self.session_bus) |
0 | 231 self.dbus_bridge = DbusObject(self.session_bus, '/org/goffi/SAT/bridge') |
232 | |
233 def newContact(self, contact, attributes, groups): | |
234 self.dbus_bridge.newContact(contact, attributes, groups) | |
235 | |
236 def newMessage(self,from_jid,msg,type='chat', to=''): | |
237 debug("sending message...") | |
238 self.dbus_bridge.newMessage(from_jid, msg, type, to) | |
239 | |
240 def presenceUpdate(self, jid, type, show, status, priority): | |
241 debug("updating presence for %s",jid) | |
242 self.dbus_bridge.presenceUpdate(jid, type, show, status, priority) | |
243 | |
18
6928e3cb73a8
refactoring: using xml params part II
Goffi <goffi@goffi.org>
parents:
17
diff
changeset
|
244 def paramUpdate(self, name, value, category): |
6928e3cb73a8
refactoring: using xml params part II
Goffi <goffi@goffi.org>
parents:
17
diff
changeset
|
245 debug("updating param [%s] %s ", category, name) |
6928e3cb73a8
refactoring: using xml params part II
Goffi <goffi@goffi.org>
parents:
17
diff
changeset
|
246 self.dbus_bridge.paramUpdate(name, value, category) |
0 | 247 |
248 def contactDeleted(self, jid): | |
249 debug("sending contact deleted signal %s ", jid) | |
250 self.dbus_bridge.contactDeleted(jid) | |
251 | |
252 def askConfirmation(self, type, id, data): | |
253 self.dbus_bridge.askConfirmation(type, id, data) | |
254 | |
22
bb72c29f3432
added action cb mechanism for buttons. Tested with a temporary new user registration button.
Goffi <goffi@goffi.org>
parents:
18
diff
changeset
|
255 def actionResult(self, type, id, data): |
bb72c29f3432
added action cb mechanism for buttons. Tested with a temporary new user registration button.
Goffi <goffi@goffi.org>
parents:
18
diff
changeset
|
256 self.dbus_bridge.actionResult(type, id, data) |
16
0a024d5e0cd0
New account creation (in-band registration)
Goffi <goffi@goffi.org>
parents:
10
diff
changeset
|
257 |
0 | 258 def register(self, name, callback): |
7
c14a3a7018a5
added dynamic exportation of Dbus bridge method (usefull for plugins)
Goffi <goffi@goffi.org>
parents:
1
diff
changeset
|
259 debug("registering DBus bridge method [%s]",name) |
0 | 260 self.dbus_bridge.register(name, callback) |
261 | |
7
c14a3a7018a5
added dynamic exportation of Dbus bridge method (usefull for plugins)
Goffi <goffi@goffi.org>
parents:
1
diff
changeset
|
262 def addMethod(self, name, int_suffix, in_sign, out_sign, method): |
c14a3a7018a5
added dynamic exportation of Dbus bridge method (usefull for plugins)
Goffi <goffi@goffi.org>
parents:
1
diff
changeset
|
263 """Dynamically add a method to Dbus Bridge""" |
c14a3a7018a5
added dynamic exportation of Dbus bridge method (usefull for plugins)
Goffi <goffi@goffi.org>
parents:
1
diff
changeset
|
264 print ("Adding method [%s] to DBus bridge" % name) |
c14a3a7018a5
added dynamic exportation of Dbus bridge method (usefull for plugins)
Goffi <goffi@goffi.org>
parents:
1
diff
changeset
|
265 self.dbus_bridge.addMethod(name, int_suffix, in_sign, out_sign) |
c14a3a7018a5
added dynamic exportation of Dbus bridge method (usefull for plugins)
Goffi <goffi@goffi.org>
parents:
1
diff
changeset
|
266 self.register(name, method) |
c14a3a7018a5
added dynamic exportation of Dbus bridge method (usefull for plugins)
Goffi <goffi@goffi.org>
parents:
1
diff
changeset
|
267 |