XEP-0231: wrap get_bob() with coroutine_wrapper
This commit is contained in:
parent
6fb3ecd414
commit
17464b10a4
@ -10,6 +10,7 @@
|
|||||||
import logging
|
import logging
|
||||||
import hashlib
|
import hashlib
|
||||||
|
|
||||||
|
from slixmpp import coroutine_wrapper
|
||||||
from slixmpp.stanza import Iq, Message, Presence
|
from slixmpp.stanza import Iq, Message, Presence
|
||||||
from slixmpp.exceptions import XMPPError
|
from slixmpp.exceptions import XMPPError
|
||||||
from slixmpp.xmlstream.handler import Callback
|
from slixmpp.xmlstream.handler import Callback
|
||||||
@ -81,8 +82,9 @@ class XEP_0231(BasePlugin):
|
|||||||
|
|
||||||
return cid
|
return cid
|
||||||
|
|
||||||
|
@coroutine_wrapper
|
||||||
def get_bob(self, jid=None, cid=None, cached=True, ifrom=None,
|
def get_bob(self, jid=None, cid=None, cached=True, ifrom=None,
|
||||||
timeout=None, callback=None):
|
timeout=None, callback=None, coroutine=False):
|
||||||
if cached:
|
if cached:
|
||||||
data = self.api['get_bob'](None, None, ifrom, args=cid)
|
data = self.api['get_bob'](None, None, ifrom, args=cid)
|
||||||
if data is not None:
|
if data is not None:
|
||||||
@ -97,7 +99,7 @@ class XEP_0231(BasePlugin):
|
|||||||
iq['from'] = ifrom
|
iq['from'] = ifrom
|
||||||
iq['type'] = 'get'
|
iq['type'] = 'get'
|
||||||
iq['bob']['cid'] = cid
|
iq['bob']['cid'] = cid
|
||||||
return iq.send(timeout=timeout, callback=callback)
|
return iq.send(timeout=timeout, callback=callback, coroutine=coroutine)
|
||||||
|
|
||||||
def del_bob(self, cid):
|
def del_bob(self, cid):
|
||||||
self.api['del_bob'](args=cid)
|
self.api['del_bob'](args=cid)
|
||||||
|
Loading…
Reference in New Issue
Block a user