summaryrefslogtreecommitdiff
path: root/examples/custom_stanzas/custom_stanza_provider.py
diff options
context:
space:
mode:
authormathieui <mathieui@mathieui.net>2017-02-14 01:00:41 +0100
committermathieui <mathieui@mathieui.net>2017-02-14 01:00:41 +0100
commitcc4522d9cd256489459c2611e867dece52449363 (patch)
treea9d0b87fd24ca123d25029a77ffc2dd3d0c9d7cc /examples/custom_stanzas/custom_stanza_provider.py
parent5bf69dca763d6ef4fe21636ff1b606d042942e71 (diff)
downloadslixmpp-cc4522d9cd256489459c2611e867dece52449363.tar.gz
slixmpp-cc4522d9cd256489459c2611e867dece52449363.tar.bz2
slixmpp-cc4522d9cd256489459c2611e867dece52449363.tar.xz
slixmpp-cc4522d9cd256489459c2611e867dece52449363.zip
Fix custom stanza examples
Diffstat (limited to 'examples/custom_stanzas/custom_stanza_provider.py')
-rwxr-xr-xexamples/custom_stanzas/custom_stanza_provider.py19
1 files changed, 11 insertions, 8 deletions
diff --git a/examples/custom_stanzas/custom_stanza_provider.py b/examples/custom_stanzas/custom_stanza_provider.py
index 9927c449..bca4a904 100755
--- a/examples/custom_stanzas/custom_stanza_provider.py
+++ b/examples/custom_stanzas/custom_stanza_provider.py
@@ -50,7 +50,7 @@ class ActionBot(slixmpp.ClientXMPP):
register_stanza_plugin(Iq, Action)
- def start(self, event):
+ async def start(self, event):
"""
Process the session_start event.
@@ -73,7 +73,7 @@ class ActionBot(slixmpp.ClientXMPP):
"""
self.event('custom_action', iq)
- def _handle_action_event(self, iq):
+ async def _handle_action_event(self, iq):
"""
Respond to the custom action event.
"""
@@ -82,17 +82,20 @@ class ActionBot(slixmpp.ClientXMPP):
if method == 'is_prime' and param == '2':
print("got message: %s" % iq)
- iq.reply()
- iq['action']['status'] = 'done'
- iq.send()
+ rep = iq.reply()
+ rep['action']['status'] = 'done'
+ await rep.send()
elif method == 'bye':
print("got message: %s" % iq)
+ rep = iq.reply()
+ rep['action']['status'] = 'done'
+ await rep.send()
self.disconnect()
else:
print("got message: %s" % iq)
- iq.reply()
- iq['action']['status'] = 'error'
- iq.send()
+ rep = iq.reply()
+ rep['action']['status'] = 'error'
+ await rep.send()
if __name__ == '__main__':
# Setup the command line arguments.