XEP-0012: wrap get_last_activity() with coroutine_wrapper
This commit is contained in:
parent
f795ac02e3
commit
2ee05d9616
@ -16,6 +16,7 @@ from slixmpp.xmlstream import JID, register_stanza_plugin
|
||||
from slixmpp.xmlstream.handler import Callback
|
||||
from slixmpp.xmlstream.matcher import StanzaPath
|
||||
from slixmpp.plugins.xep_0012 import stanza, LastActivity
|
||||
from slixmpp import coroutine_wrapper
|
||||
|
||||
|
||||
log = logging.getLogger(__name__)
|
||||
@ -76,8 +77,9 @@ class XEP_0012(BasePlugin):
|
||||
def del_last_activity(self, jid):
|
||||
self.api['del_last_activity'](jid)
|
||||
|
||||
@coroutine_wrapper
|
||||
def get_last_activity(self, jid, local=False, ifrom=None, timeout=None,
|
||||
callback=None, timeout_callback=None):
|
||||
callback=None, timeout_callback=None, coroutine=False):
|
||||
if jid is not None and not isinstance(jid, JID):
|
||||
jid = JID(jid)
|
||||
|
||||
@ -98,7 +100,7 @@ class XEP_0012(BasePlugin):
|
||||
iq['to'] = jid
|
||||
iq['type'] = 'get'
|
||||
iq.enable('last_activity')
|
||||
return iq.send(timeout=timeout, callback=callback,
|
||||
return iq.send(timeout=timeout, callback=callback, coroutine=coroutine,
|
||||
timeout_callback=timeout_callback)
|
||||
|
||||
def _handle_get_last_activity(self, iq):
|
||||
|
Loading…
Reference in New Issue
Block a user