From e034b31d6bc34f43578456e9c6527bc56dff78e3 Mon Sep 17 00:00:00 2001 From: mathieui Date: Mon, 23 Feb 2015 19:46:32 +0100 Subject: [PATCH] XEP-0050: wrap send_command() and get_commands() with coroutine_wrapper (if flow=True in send_command, the result will still be using the default callbacks and the function will return None) --- slixmpp/plugins/xep_0050/adhoc.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/slixmpp/plugins/xep_0050/adhoc.py b/slixmpp/plugins/xep_0050/adhoc.py index 1b32870e..6be6997c 100644 --- a/slixmpp/plugins/xep_0050/adhoc.py +++ b/slixmpp/plugins/xep_0050/adhoc.py @@ -10,7 +10,7 @@ import logging import time from slixmpp import Iq -from slixmpp.exceptions import IqError +from slixmpp.exceptions import XMPPError from slixmpp.xmlstream.handler import Callback from slixmpp.xmlstream.matcher import StanzaPath from slixmpp.xmlstream import register_stanza_plugin, JID @@ -18,6 +18,7 @@ from slixmpp.plugins import BasePlugin from slixmpp.plugins.xep_0050 import stanza from slixmpp.plugins.xep_0050 import Command from slixmpp.plugins.xep_0004 import Form +from slixmpp import coroutine_wrapper log = logging.getLogger(__name__) @@ -427,6 +428,7 @@ class XEP_0050(BasePlugin): # ================================================================= # Client side (command user) API + @coroutine_wrapper def get_commands(self, jid, **kwargs): """ Return a list of commands provided by a given JID. @@ -452,6 +454,7 @@ class XEP_0050(BasePlugin): node=Command.namespace, **kwargs) + @coroutine_wrapper def send_command(self, jid, node, ifrom=None, action='execute', payload=None, sessionid=None, flow=False, **kwargs): """