XEP-0077: wrap functions with coroutine_wrapper
This commit is contained in:
parent
e68135f59f
commit
1e4944d47e
@ -9,6 +9,7 @@
|
|||||||
import logging
|
import logging
|
||||||
import ssl
|
import ssl
|
||||||
|
|
||||||
|
from slixmpp import coroutine_wrapper
|
||||||
from slixmpp.stanza import StreamFeatures, Iq
|
from slixmpp.stanza import StreamFeatures, Iq
|
||||||
from slixmpp.xmlstream import register_stanza_plugin, JID
|
from slixmpp.xmlstream import register_stanza_plugin, JID
|
||||||
from slixmpp.plugins import BasePlugin
|
from slixmpp.plugins import BasePlugin
|
||||||
@ -81,26 +82,29 @@ class XEP_0077(BasePlugin):
|
|||||||
return True
|
return True
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
@coroutine_wrapper
|
||||||
def get_registration(self, jid=None, ifrom=None,
|
def get_registration(self, jid=None, ifrom=None,
|
||||||
timeout=None, callback=None):
|
timeout=None, callback=None, coroutine=False):
|
||||||
iq = self.xmpp.Iq()
|
iq = self.xmpp.Iq()
|
||||||
iq['type'] = 'get'
|
iq['type'] = 'get'
|
||||||
iq['to'] = jid
|
iq['to'] = jid
|
||||||
iq['from'] = ifrom
|
iq['from'] = ifrom
|
||||||
iq.enable('register')
|
iq.enable('register')
|
||||||
return iq.send(timeout=timeout, callback=callback)
|
return iq.send(timeout=timeout, callback=callback, coroutine=coroutine)
|
||||||
|
|
||||||
|
@coroutine_wrapper
|
||||||
def cancel_registration(self, jid=None, ifrom=None,
|
def cancel_registration(self, jid=None, ifrom=None,
|
||||||
timeout=None, callback=None):
|
timeout=None, callback=None, coroutine=False):
|
||||||
iq = self.xmpp.Iq()
|
iq = self.xmpp.Iq()
|
||||||
iq['type'] = 'set'
|
iq['type'] = 'set'
|
||||||
iq['to'] = jid
|
iq['to'] = jid
|
||||||
iq['from'] = ifrom
|
iq['from'] = ifrom
|
||||||
iq['register']['remove'] = True
|
iq['register']['remove'] = True
|
||||||
return iq.send(timeout=timeout, callback=callback)
|
return iq.send(timeout=timeout, callback=callback, coroutine=coroutine)
|
||||||
|
|
||||||
|
@coroutine_wrapper
|
||||||
def change_password(self, password, jid=None, ifrom=None,
|
def change_password(self, password, jid=None, ifrom=None,
|
||||||
timeout=None, callback=None):
|
timeout=None, callback=None, coroutine=False):
|
||||||
iq = self.xmpp.Iq()
|
iq = self.xmpp.Iq()
|
||||||
iq['type'] = 'set'
|
iq['type'] = 'set'
|
||||||
iq['to'] = jid
|
iq['to'] = jid
|
||||||
@ -111,4 +115,4 @@ class XEP_0077(BasePlugin):
|
|||||||
else:
|
else:
|
||||||
iq['register']['username'] = self.xmpp.boundjid.user
|
iq['register']['username'] = self.xmpp.boundjid.user
|
||||||
iq['register']['password'] = password
|
iq['register']['password'] = password
|
||||||
return iq.send(timeout=timeout, callback=callback)
|
return iq.send(timeout=timeout, callback=callback, coroutine=coroutine)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user