comparison src/bridge/DBus.py @ 423:6c20c76abdcc

backend: - bridge async D-Bus method now automatically manage callback and errback, we just have to return a deferred - getParams, getParamsForCategory and getParamsUI are now asynchronous primitivus: management of asynchronous getParamsUI
author Goffi <goffi@goffi.org>
date Mon, 07 Nov 2011 00:09:22 +0100
parents 6c167a2e04b8
children 72c13313b6d6
comparison
equal deleted inserted replaced
422:5a18c5f08d9b 423:6c20c76abdcc
22 22
23 from bridge import Bridge 23 from bridge import Bridge
24 import dbus 24 import dbus
25 import dbus.service 25 import dbus.service
26 import dbus.mainloop.glib 26 import dbus.mainloop.glib
27 from logging import debug, info 27 from logging import debug, info, error
28 from twisted.internet.defer import Deferred
28 29
29 const_INT_PREFIX = "org.goffi.SAT" #Interface prefix 30 const_INT_PREFIX = "org.goffi.SAT" #Interface prefix
30 const_ERROR_PREFIX = const_INT_PREFIX+".error" 31 const_ERROR_PREFIX = const_INT_PREFIX+".error"
31 const_OBJ_PATH = '/org/goffi/SAT/bridge' 32 const_OBJ_PATH = '/org/goffi/SAT/bridge'
32 const_CORE_SUFFIX = ".core" 33 const_CORE_SUFFIX = ".core"
33 const_PLUGIN_SUFFIX = ".plugin" 34 const_PLUGIN_SUFFIX = ".plugin"
34 35
36 class MethodNotRegistered(dbus.DBusException):
37 _dbus_error_name = const_ERROR_PREFIX + ".MethodNotRegistered"
38
39 class InternalError(dbus.DBusException):
40 _dbus_error_name = const_ERROR_PREFIX + ".InternalError"
41
42 class AsyncNotDeferred(dbus.DBusException):
43 _dbus_error_name = const_ERROR_PREFIX + ".AsyncNotDeferred"
44
35 class GenericException(dbus.DBusException): 45 class GenericException(dbus.DBusException):
36 def __init__(self, name): 46 def __init__(self, twisted_error):
37 super(GenericException,self).__init__() 47 super(GenericException,self).__init__()
38 self._dbus_error_name = const_ERROR_PREFIX+"."+name 48 mess = twisted_error.getErrorMessage()
49 self._dbus_error_name = const_ERROR_PREFIX+"."+ (mess or str(err.__class__))
39 50
40 class DbusObject(dbus.service.Object): 51 class DbusObject(dbus.service.Object):
41 52
42 def __init__(self, bus, path): 53 def __init__(self, bus, path):
43 dbus.service.Object.__init__(self, bus, path) 54 dbus.service.Object.__init__(self, bus, path)
44 debug("Init DbusObject...") 55 debug("Init DbusObject...")
45 self.cb={} 56 self.cb={}
46 57
47 def register(self, name, cb): 58 def register(self, name, cb):
48 self.cb[name]=cb 59 self.cb[name]=cb
60
61 def _callback(self, name, *args, **kwargs):
62 """call the callback if it exists, raise an exception else
63 if the callback return a deferred, use async methods"""
64 if not name in self.cb:
65 raise MethodNotRegistered
66
67 if "callback" in kwargs:
68 #we must have errback too
69 if not "errback" in kwargs:
70 error("errback is missing in method call [%s]" % name)
71 raise InternalError
72 callback = kwargs.pop("callback")
73 errback = kwargs.pop("errback")
74 async = True
75 else:
76 async = False
77 result = self.cb[name](*args, **kwargs)
78 if async:
79 if not isinstance(result, Deferred):
80 error("Asynchrone method [%s] does not return a Deferred." % name)
81 raise AsyncNotDeferred
82 result.addCallback(callback)
83 result.addErrback(lambda err:errback(GenericException(err)))
84 else:
85 return result
49 86
50 ### signals ### 87 ### signals ###
51 88
52 @dbus.service.signal(const_INT_PREFIX+const_PLUGIN_SUFFIX, 89 @dbus.service.signal(const_INT_PREFIX+const_PLUGIN_SUFFIX,
53 signature='') 90 signature='')
132 169
133 @dbus.service.method(const_INT_PREFIX+const_CORE_SUFFIX, 170 @dbus.service.method(const_INT_PREFIX+const_CORE_SUFFIX,
134 in_signature='ss', out_signature='', 171 in_signature='ss', out_signature='',
135 async_callbacks=None) 172 async_callbacks=None)
136 def addContact(self, entity_jid, profile_key="@DEFAULT@"): 173 def addContact(self, entity_jid, profile_key="@DEFAULT@"):
137 return self.cb["addContact"](unicode(entity_jid), unicode(profile_key)) 174 return self._callback("addContact", unicode(entity_jid), unicode(profile_key))
138 175
139 @dbus.service.method(const_INT_PREFIX+const_CORE_SUFFIX, 176 @dbus.service.method(const_INT_PREFIX+const_CORE_SUFFIX,
140 in_signature='s', out_signature='', 177 in_signature='s', out_signature='',
141 async_callbacks=('callback', 'errback')) 178 async_callbacks=('callback', 'errback'))
142 def asyncConnect(self, profile_key="@DEFAULT@", callback=None, errback=None): 179 def asyncConnect(self, profile_key="@DEFAULT@", callback=None, errback=None):
143 return self.cb["asyncConnect"](unicode(profile_key), callback, lambda arg:errback(GenericException(arg))) 180 return self._callback("asyncConnect", unicode(profile_key), callback=callback, errback=errback)
144 181
145 @dbus.service.method(const_INT_PREFIX+const_CORE_SUFFIX, 182 @dbus.service.method(const_INT_PREFIX+const_CORE_SUFFIX,
146 in_signature='s', out_signature='', 183 in_signature='s', out_signature='',
147 async_callbacks=('callback', 'errback')) 184 async_callbacks=('callback', 'errback'))
148 def asyncCreateProfile(self, profile, callback=None, errback=None): 185 def asyncCreateProfile(self, profile, callback=None, errback=None):
149 return self.cb["asyncCreateProfile"](unicode(profile), callback, lambda arg:errback(GenericException(arg))) 186 return self._callback("asyncCreateProfile", unicode(profile), callback=callback, errback=errback)
150 187
151 @dbus.service.method(const_INT_PREFIX+const_CORE_SUFFIX, 188 @dbus.service.method(const_INT_PREFIX+const_CORE_SUFFIX,
152 in_signature='ssss', out_signature='s', 189 in_signature='ssss', out_signature='s',
153 async_callbacks=('callback', 'errback')) 190 async_callbacks=('callback', 'errback'))
154 def asyncGetParamA(self, name, category, attribute="value", profile_key="@DEFAULT@", callback=None, errback=None): 191 def asyncGetParamA(self, name, category, attribute="value", profile_key="@DEFAULT@", callback=None, errback=None):
155 return self.cb["asyncGetParamA"](unicode(name), unicode(category), unicode(attribute), unicode(profile_key), callback, lambda arg:errback(GenericException(arg))) 192 return self._callback("asyncGetParamA", unicode(name), unicode(category), unicode(attribute), unicode(profile_key), callback=callback, errback=errback)
156 193
157 @dbus.service.method(const_INT_PREFIX+const_CORE_SUFFIX, 194 @dbus.service.method(const_INT_PREFIX+const_CORE_SUFFIX,
158 in_signature='ssss', out_signature='s', 195 in_signature='ssss', out_signature='s',
159 async_callbacks=None) 196 async_callbacks=None)
160 def callMenu(self, category, name, menu_type, profile_key): 197 def callMenu(self, category, name, menu_type, profile_key):
161 return self.cb["callMenu"](unicode(category), unicode(name), unicode(menu_type), unicode(profile_key)) 198 return self._callback("callMenu", unicode(category), unicode(name), unicode(menu_type), unicode(profile_key))
162 199
163 @dbus.service.method(const_INT_PREFIX+const_CORE_SUFFIX, 200 @dbus.service.method(const_INT_PREFIX+const_CORE_SUFFIX,
164 in_signature='sba{ss}', out_signature='', 201 in_signature='sba{ss}', out_signature='',
165 async_callbacks=None) 202 async_callbacks=None)
166 def confirmationAnswer(self, id, accepted, data): 203 def confirmationAnswer(self, id, accepted, data):
167 return self.cb["confirmationAnswer"](unicode(id), accepted, data) 204 return self._callback("confirmationAnswer", unicode(id), accepted, data)
168 205
169 @dbus.service.method(const_INT_PREFIX+const_CORE_SUFFIX, 206 @dbus.service.method(const_INT_PREFIX+const_CORE_SUFFIX,
170 in_signature='s', out_signature='', 207 in_signature='s', out_signature='',
171 async_callbacks=None) 208 async_callbacks=None)
172 def connect(self, profile_key="@DEFAULT@"): 209 def connect(self, profile_key="@DEFAULT@"):
173 return self.cb["connect"](unicode(profile_key)) 210 return self._callback("connect", unicode(profile_key))
174 211
175 @dbus.service.method(const_INT_PREFIX+const_CORE_SUFFIX, 212 @dbus.service.method(const_INT_PREFIX+const_CORE_SUFFIX,
176 in_signature='s', out_signature='i', 213 in_signature='s', out_signature='i',
177 async_callbacks=None) 214 async_callbacks=None)
178 def createProfile(self, profile): 215 def createProfile(self, profile):
179 return self.cb["createProfile"](unicode(profile)) 216 return self._callback("createProfile", unicode(profile))
180 217
181 @dbus.service.method(const_INT_PREFIX+const_CORE_SUFFIX, 218 @dbus.service.method(const_INT_PREFIX+const_CORE_SUFFIX,
182 in_signature='ss', out_signature='', 219 in_signature='ss', out_signature='',
183 async_callbacks=None) 220 async_callbacks=None)
184 def delContact(self, entity_jid, profile_key="@DEFAULT@"): 221 def delContact(self, entity_jid, profile_key="@DEFAULT@"):
185 return self.cb["delContact"](unicode(entity_jid), unicode(profile_key)) 222 return self._callback("delContact", unicode(entity_jid), unicode(profile_key))
186 223
187 @dbus.service.method(const_INT_PREFIX+const_CORE_SUFFIX, 224 @dbus.service.method(const_INT_PREFIX+const_CORE_SUFFIX,
188 in_signature='s', out_signature='i', 225 in_signature='s', out_signature='i',
189 async_callbacks=None) 226 async_callbacks=None)
190 def deleteProfile(self, profile): 227 def deleteProfile(self, profile):
191 return self.cb["deleteProfile"](unicode(profile)) 228 return self._callback("deleteProfile", unicode(profile))
192 229
193 @dbus.service.method(const_INT_PREFIX+const_CORE_SUFFIX, 230 @dbus.service.method(const_INT_PREFIX+const_CORE_SUFFIX,
194 in_signature='s', out_signature='', 231 in_signature='s', out_signature='',
195 async_callbacks=None) 232 async_callbacks=None)
196 def disconnect(self, profile_key="@DEFAULT@"): 233 def disconnect(self, profile_key="@DEFAULT@"):
197 return self.cb["disconnect"](unicode(profile_key)) 234 return self._callback("disconnect", unicode(profile_key))
198 235
199 @dbus.service.method(const_INT_PREFIX+const_CORE_SUFFIX, 236 @dbus.service.method(const_INT_PREFIX+const_CORE_SUFFIX,
200 in_signature='ss', out_signature='s', 237 in_signature='ss', out_signature='s',
201 async_callbacks=None) 238 async_callbacks=None)
202 def getConfig(self, section, name): 239 def getConfig(self, section, name):
203 return self.cb["getConfig"](unicode(section), unicode(name)) 240 return self._callback("getConfig", unicode(section), unicode(name))
204 241
205 @dbus.service.method(const_INT_PREFIX+const_CORE_SUFFIX, 242 @dbus.service.method(const_INT_PREFIX+const_CORE_SUFFIX,
206 in_signature='s', out_signature='a(sa{ss}as)', 243 in_signature='s', out_signature='a(sa{ss}as)',
207 async_callbacks=None) 244 async_callbacks=None)
208 def getContacts(self, profile_key="@DEFAULT@"): 245 def getContacts(self, profile_key="@DEFAULT@"):
209 return self.cb["getContacts"](unicode(profile_key)) 246 return self._callback("getContacts", unicode(profile_key))
210 247
211 @dbus.service.method(const_INT_PREFIX+const_CORE_SUFFIX, 248 @dbus.service.method(const_INT_PREFIX+const_CORE_SUFFIX,
212 in_signature='ssi', out_signature='a{i(ss)}', 249 in_signature='ssi', out_signature='a{i(ss)}',
213 async_callbacks=None) 250 async_callbacks=None)
214 def getHistory(self, from_jid, to_jid, size): 251 def getHistory(self, from_jid, to_jid, size):
215 return self.cb["getHistory"](unicode(from_jid), unicode(to_jid), size) 252 return self._callback("getHistory", unicode(from_jid), unicode(to_jid), size)
216 253
217 @dbus.service.method(const_INT_PREFIX+const_CORE_SUFFIX, 254 @dbus.service.method(const_INT_PREFIX+const_CORE_SUFFIX,
218 in_signature='ss', out_signature='s', 255 in_signature='ss', out_signature='s',
219 async_callbacks=None) 256 async_callbacks=None)
220 def getLastResource(self, contact_jid, profile_key="@DEFAULT@"): 257 def getLastResource(self, contact_jid, profile_key="@DEFAULT@"):
221 return self.cb["getLastResource"](unicode(contact_jid), unicode(profile_key)) 258 return self._callback("getLastResource", unicode(contact_jid), unicode(profile_key))
222 259
223 @dbus.service.method(const_INT_PREFIX+const_CORE_SUFFIX, 260 @dbus.service.method(const_INT_PREFIX+const_CORE_SUFFIX,
224 in_signature='sss', out_signature='s', 261 in_signature='sss', out_signature='s',
225 async_callbacks=None) 262 async_callbacks=None)
226 def getMenuHelp(self, category, name, menu_type): 263 def getMenuHelp(self, category, name, menu_type):
227 return self.cb["getMenuHelp"](unicode(category), unicode(name), unicode(menu_type)) 264 return self._callback("getMenuHelp", unicode(category), unicode(name), unicode(menu_type))
228 265
229 @dbus.service.method(const_INT_PREFIX+const_CORE_SUFFIX, 266 @dbus.service.method(const_INT_PREFIX+const_CORE_SUFFIX,
230 in_signature='', out_signature='a(sss)', 267 in_signature='', out_signature='a(sss)',
231 async_callbacks=None) 268 async_callbacks=None)
232 def getMenus(self, ): 269 def getMenus(self, ):
233 return self.cb["getMenus"]() 270 return self._callback("getMenus", )
234 271
235 @dbus.service.method(const_INT_PREFIX+const_CORE_SUFFIX, 272 @dbus.service.method(const_INT_PREFIX+const_CORE_SUFFIX,
236 in_signature='ssss', out_signature='s', 273 in_signature='ssss', out_signature='s',
237 async_callbacks=None) 274 async_callbacks=None)
238 def getParamA(self, name, category, attribute="value", profile_key="@DEFAULT@"): 275 def getParamA(self, name, category, attribute="value", profile_key="@DEFAULT@"):
239 return self.cb["getParamA"](unicode(name), unicode(category), unicode(attribute), unicode(profile_key)) 276 return self._callback("getParamA", unicode(name), unicode(category), unicode(attribute), unicode(profile_key))
240 277
241 @dbus.service.method(const_INT_PREFIX+const_CORE_SUFFIX, 278 @dbus.service.method(const_INT_PREFIX+const_CORE_SUFFIX,
242 in_signature='s', out_signature='s', 279 in_signature='s', out_signature='s',
243 async_callbacks=None) 280 async_callbacks=('callback', 'errback'))
244 def getParams(self, profile_key="@DEFAULT@"): 281 def getParams(self, profile_key="@DEFAULT@", callback=None, errback=None):
245 return self.cb["getParams"](unicode(profile_key)) 282 return self._callback("getParams", unicode(profile_key), callback=callback, errback=errback)
246 283
247 @dbus.service.method(const_INT_PREFIX+const_CORE_SUFFIX, 284 @dbus.service.method(const_INT_PREFIX+const_CORE_SUFFIX,
248 in_signature='', out_signature='as', 285 in_signature='', out_signature='as',
249 async_callbacks=None) 286 async_callbacks=None)
250 def getParamsCategories(self, ): 287 def getParamsCategories(self, ):
251 return self.cb["getParamsCategories"]() 288 return self._callback("getParamsCategories", )
252 289
253 @dbus.service.method(const_INT_PREFIX+const_CORE_SUFFIX, 290 @dbus.service.method(const_INT_PREFIX+const_CORE_SUFFIX,
254 in_signature='ss', out_signature='s', 291 in_signature='ss', out_signature='s',
255 async_callbacks=None) 292 async_callbacks=('callback', 'errback'))
256 def getParamsForCategory(self, category, profile_key="@DEFAULT@"): 293 def getParamsForCategory(self, category, profile_key="@DEFAULT@", callback=None, errback=None):
257 return self.cb["getParamsForCategory"](unicode(category), unicode(profile_key)) 294 return self._callback("getParamsForCategory", unicode(category), unicode(profile_key), callback=callback, errback=errback)
258 295
259 @dbus.service.method(const_INT_PREFIX+const_CORE_SUFFIX, 296 @dbus.service.method(const_INT_PREFIX+const_CORE_SUFFIX,
260 in_signature='s', out_signature='s', 297 in_signature='s', out_signature='s',
261 async_callbacks=None) 298 async_callbacks=('callback', 'errback'))
262 def getParamsUI(self, profile_key="@DEFAULT@"): 299 def getParamsUI(self, profile_key="@DEFAULT@", callback=None, errback=None):
263 return self.cb["getParamsUI"](unicode(profile_key)) 300 return self._callback("getParamsUI", unicode(profile_key), callback=callback, errback=errback)
264 301
265 @dbus.service.method(const_INT_PREFIX+const_CORE_SUFFIX, 302 @dbus.service.method(const_INT_PREFIX+const_CORE_SUFFIX,
266 in_signature='s', out_signature='a{sa{s(sia{ss})}}', 303 in_signature='s', out_signature='a{sa{s(sia{ss})}}',
267 async_callbacks=None) 304 async_callbacks=None)
268 def getPresenceStatus(self, profile_key="@DEFAULT@"): 305 def getPresenceStatus(self, profile_key="@DEFAULT@"):
269 return self.cb["getPresenceStatus"](unicode(profile_key)) 306 return self._callback("getPresenceStatus", unicode(profile_key))
270 307
271 @dbus.service.method(const_INT_PREFIX+const_CORE_SUFFIX, 308 @dbus.service.method(const_INT_PREFIX+const_CORE_SUFFIX,
272 in_signature='s', out_signature='s', 309 in_signature='s', out_signature='s',
273 async_callbacks=None) 310 async_callbacks=None)
274 def getProfileName(self, profile_key="@DEFAULT@"): 311 def getProfileName(self, profile_key="@DEFAULT@"):
275 return self.cb["getProfileName"](unicode(profile_key)) 312 return self._callback("getProfileName", unicode(profile_key))
276 313
277 @dbus.service.method(const_INT_PREFIX+const_CORE_SUFFIX, 314 @dbus.service.method(const_INT_PREFIX+const_CORE_SUFFIX,
278 in_signature='', out_signature='as', 315 in_signature='', out_signature='as',
279 async_callbacks=None) 316 async_callbacks=None)
280 def getProfilesList(self, ): 317 def getProfilesList(self, ):
281 return self.cb["getProfilesList"]() 318 return self._callback("getProfilesList", )
282 319
283 @dbus.service.method(const_INT_PREFIX+const_CORE_SUFFIX, 320 @dbus.service.method(const_INT_PREFIX+const_CORE_SUFFIX,
284 in_signature='s', out_signature='a{ss}', 321 in_signature='s', out_signature='a{ss}',
285 async_callbacks=None) 322 async_callbacks=None)
286 def getProgress(self, id): 323 def getProgress(self, id):
287 return self.cb["getProgress"](unicode(id)) 324 return self._callback("getProgress", unicode(id))
288 325
289 @dbus.service.method(const_INT_PREFIX+const_CORE_SUFFIX, 326 @dbus.service.method(const_INT_PREFIX+const_CORE_SUFFIX,
290 in_signature='', out_signature='s', 327 in_signature='', out_signature='s',
291 async_callbacks=None) 328 async_callbacks=None)
292 def getVersion(self, ): 329 def getVersion(self, ):
293 return self.cb["getVersion"]() 330 return self._callback("getVersion", )
294 331
295 @dbus.service.method(const_INT_PREFIX+const_CORE_SUFFIX, 332 @dbus.service.method(const_INT_PREFIX+const_CORE_SUFFIX,
296 in_signature='s', out_signature='a{ss}', 333 in_signature='s', out_signature='a{ss}',
297 async_callbacks=None) 334 async_callbacks=None)
298 def getWaitingSub(self, profile_key="@DEFAULT@"): 335 def getWaitingSub(self, profile_key="@DEFAULT@"):
299 return self.cb["getWaitingSub"](unicode(profile_key)) 336 return self._callback("getWaitingSub", unicode(profile_key))
300 337
301 @dbus.service.method(const_INT_PREFIX+const_CORE_SUFFIX, 338 @dbus.service.method(const_INT_PREFIX+const_CORE_SUFFIX,
302 in_signature='s', out_signature='b', 339 in_signature='s', out_signature='b',
303 async_callbacks=None) 340 async_callbacks=None)
304 def isConnected(self, profile_key="@DEFAULT@"): 341 def isConnected(self, profile_key="@DEFAULT@"):
305 return self.cb["isConnected"](unicode(profile_key)) 342 return self._callback("isConnected", unicode(profile_key))
306 343
307 @dbus.service.method(const_INT_PREFIX+const_CORE_SUFFIX, 344 @dbus.service.method(const_INT_PREFIX+const_CORE_SUFFIX,
308 in_signature='sa{ss}s', out_signature='s', 345 in_signature='sa{ss}s', out_signature='s',
309 async_callbacks=None) 346 async_callbacks=None)
310 def launchAction(self, action_type, data, profile_key="@DEFAULT@"): 347 def launchAction(self, action_type, data, profile_key="@DEFAULT@"):
311 return self.cb["launchAction"](unicode(action_type), data, unicode(profile_key)) 348 return self._callback("launchAction", unicode(action_type), data, unicode(profile_key))
312 349
313 @dbus.service.method(const_INT_PREFIX+const_CORE_SUFFIX, 350 @dbus.service.method(const_INT_PREFIX+const_CORE_SUFFIX,
314 in_signature='ssssi', out_signature='s', 351 in_signature='ssssi', out_signature='s',
315 async_callbacks=None) 352 async_callbacks=None)
316 def registerNewAccount(self, login, password, email, host, port=5222): 353 def registerNewAccount(self, login, password, email, host, port=5222):
317 return self.cb["registerNewAccount"](unicode(login), unicode(password), unicode(email), unicode(host), port) 354 return self._callback("registerNewAccount", unicode(login), unicode(password), unicode(email), unicode(host), port)
318 355
319 @dbus.service.method(const_INT_PREFIX+const_CORE_SUFFIX, 356 @dbus.service.method(const_INT_PREFIX+const_CORE_SUFFIX,
320 in_signature='sssss', out_signature='', 357 in_signature='sssss', out_signature='',
321 async_callbacks=None) 358 async_callbacks=None)
322 def sendMessage(self, to_jid, message, subject='', mess_type="chat", profile_key="@DEFAULT@"): 359 def sendMessage(self, to_jid, message, subject='', mess_type="chat", profile_key="@DEFAULT@"):
323 return self.cb["sendMessage"](unicode(to_jid), unicode(message), unicode(subject), unicode(mess_type), unicode(profile_key)) 360 return self._callback("sendMessage", unicode(to_jid), unicode(message), unicode(subject), unicode(mess_type), unicode(profile_key))
324 361
325 @dbus.service.method(const_INT_PREFIX+const_CORE_SUFFIX, 362 @dbus.service.method(const_INT_PREFIX+const_CORE_SUFFIX,
326 in_signature='ssss', out_signature='', 363 in_signature='ssss', out_signature='',
327 async_callbacks=None) 364 async_callbacks=None)
328 def setParam(self, name, value, category, profile_key="@DEFAULT@"): 365 def setParam(self, name, value, category, profile_key="@DEFAULT@"):
329 return self.cb["setParam"](unicode(name), unicode(value), unicode(category), unicode(profile_key)) 366 return self._callback("setParam", unicode(name), unicode(value), unicode(category), unicode(profile_key))
330 367
331 @dbus.service.method(const_INT_PREFIX+const_CORE_SUFFIX, 368 @dbus.service.method(const_INT_PREFIX+const_CORE_SUFFIX,
332 in_signature='ssia{ss}s', out_signature='', 369 in_signature='ssia{ss}s', out_signature='',
333 async_callbacks=None) 370 async_callbacks=None)
334 def setPresence(self, to_jid='', show='', priority=0, statuses={}, profile_key="@DEFAULT@"): 371 def setPresence(self, to_jid='', show='', priority=0, statuses={}, profile_key="@DEFAULT@"):
335 return self.cb["setPresence"](unicode(to_jid), unicode(show), priority, statuses, unicode(profile_key)) 372 return self._callback("setPresence", unicode(to_jid), unicode(show), priority, statuses, unicode(profile_key))
336 373
337 @dbus.service.method(const_INT_PREFIX+const_CORE_SUFFIX, 374 @dbus.service.method(const_INT_PREFIX+const_CORE_SUFFIX,
338 in_signature='sss', out_signature='', 375 in_signature='sss', out_signature='',
339 async_callbacks=None) 376 async_callbacks=None)
340 def subscription(self, sub_type, entity, profile_key="@DEFAULT@"): 377 def subscription(self, sub_type, entity, profile_key="@DEFAULT@"):
341 return self.cb["subscription"](unicode(sub_type), unicode(entity), unicode(profile_key)) 378 return self._callback("subscription", unicode(sub_type), unicode(entity), unicode(profile_key))
342 379
343 @dbus.service.method(const_INT_PREFIX+const_CORE_SUFFIX, 380 @dbus.service.method(const_INT_PREFIX+const_CORE_SUFFIX,
344 in_signature='ssass', out_signature='', 381 in_signature='ssass', out_signature='',
345 async_callbacks=None) 382 async_callbacks=None)
346 def updateContact(self, entity_jid, name, groups, profile_key="@DEFAULT@"): 383 def updateContact(self, entity_jid, name, groups, profile_key="@DEFAULT@"):
347 return self.cb["updateContact"](unicode(entity_jid), unicode(name), groups, unicode(profile_key)) 384 return self._callback("updateContact", unicode(entity_jid), unicode(name), groups, unicode(profile_key))
348 385
349 386
350 def __attributes(self, in_sign): 387 def __attributes(self, in_sign):
351 """Return arguments to user given a in_sign 388 """Return arguments to user given a in_sign
352 @param in_sign: in_sign in the short form (using s,a,i,b etc) 389 @param in_sign: in_sign in the short form (using s,a,i,b etc)