Mercurial > libervia-backend
comparison src/bridge/DBus.py @ 425:e4e9187e3b5b
backend, bridge: asynchronous history
quick_frontend: use of asynchronous history
author | Goffi <goffi@goffi.org> |
---|---|
date | Tue, 08 Nov 2011 01:08:11 +0100 |
parents | 72c13313b6d6 |
children | 17c7e48bf68f |
comparison
equal
deleted
inserted
replaced
424:72c13313b6d6 | 425:e4e9187e3b5b |
---|---|
78 else: | 78 else: |
79 async = False | 79 async = False |
80 result = self.cb[name](*args, **kwargs) | 80 result = self.cb[name](*args, **kwargs) |
81 if async: | 81 if async: |
82 if not isinstance(result, Deferred): | 82 if not isinstance(result, Deferred): |
83 error("Asynchrone method [%s] does not return a Deferred." % name) | 83 error("Asynchronous method [%s] does not return a Deferred." % name) |
84 raise AsyncNotDeferred | 84 raise AsyncNotDeferred |
85 result.addCallback(callback) | 85 result.addCallback(callback) |
86 result.addErrback(lambda err:errback(GenericException(err))) | 86 result.addErrback(lambda err:errback(GenericException(err))) |
87 else: | 87 else: |
88 if isinstance(result, Deferred): | 88 if isinstance(result, Deferred): |
89 error("Synchrone method [%s] return a Deferred." % name) | 89 error("Synchronous method [%s] return a Deferred." % name) |
90 raise DeferredNotAsync | 90 raise DeferredNotAsync |
91 return result | 91 return result |
92 | 92 |
93 ### signals ### | 93 ### signals ### |
94 | 94 |
250 async_callbacks=None) | 250 async_callbacks=None) |
251 def getContacts(self, profile_key="@DEFAULT@"): | 251 def getContacts(self, profile_key="@DEFAULT@"): |
252 return self._callback("getContacts", unicode(profile_key)) | 252 return self._callback("getContacts", unicode(profile_key)) |
253 | 253 |
254 @dbus.service.method(const_INT_PREFIX+const_CORE_SUFFIX, | 254 @dbus.service.method(const_INT_PREFIX+const_CORE_SUFFIX, |
255 in_signature='ssi', out_signature='a{i(ss)}', | 255 in_signature='ssib', out_signature='a{i(sss)}', |
256 async_callbacks=None) | 256 async_callbacks=('callback', 'errback')) |
257 def getHistory(self, from_jid, to_jid, size): | 257 def getHistory(self, from_jid, to_jid, limit, between=True, callback=None, errback=None): |
258 return self._callback("getHistory", unicode(from_jid), unicode(to_jid), size) | 258 return self._callback("getHistory", unicode(from_jid), unicode(to_jid), limit, between, callback=callback, errback=errback) |
259 | 259 |
260 @dbus.service.method(const_INT_PREFIX+const_CORE_SUFFIX, | 260 @dbus.service.method(const_INT_PREFIX+const_CORE_SUFFIX, |
261 in_signature='ss', out_signature='s', | 261 in_signature='ss', out_signature='s', |
262 async_callbacks=None) | 262 async_callbacks=None) |
263 def getLastResource(self, contact_jid, profile_key="@DEFAULT@"): | 263 def getLastResource(self, contact_jid, profile_key="@DEFAULT@"): |