From 51847133560e9ef6aaa3d13578fcdf87cb049b32 Mon Sep 17 00:00:00 2001 From: Emmanuel Gil Peyrot Date: Wed, 14 Mar 2018 17:37:55 +0100 Subject: Rearm an iq callback if it was addressed to ourself. --- slixmpp/stanza/iq.py | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/slixmpp/stanza/iq.py b/slixmpp/stanza/iq.py index af7e3109..385bbbd9 100644 --- a/slixmpp/stanza/iq.py +++ b/slixmpp/stanza/iq.py @@ -188,10 +188,19 @@ class Iq(RootStanza): future = asyncio.Future() def callback_success(result): - if result['type'] == 'error': + type_ = result['type'] + if type_ == 'result': + future.set_result(result) + elif type_ == 'error': future.set_exception(IqError(result)) else: - future.set_result(result) + # Most likely an iq addressed to ourself, rearm the callback. + handler = constr(handler_name, + matcher, + callback_success, + once=True) + self.stream.register_handler(handler) + return if timeout is not None: self.stream.cancel_schedule('IqTimeout_%s' % self['id']) -- cgit v1.2.3