diff options
author | lovetox <philipp@hoerist.com> | 2020-10-11 16:05:46 +0300 |
---|---|---|
committer | lovetox <philipp@hoerist.com> | 2020-10-11 16:05:46 +0300 |
commit | 04069afccc655ee20f2640a56fc47d40cd4a2ea3 (patch) | |
tree | 1823448bfdef3c299bfa7c6c41ed56de47d6d99b /nbxmpp | |
parent | a3ff92d5b3f6f7ba092918421bc5bde02f0db938 (diff) |
Tune: Use tasks
Diffstat (limited to 'nbxmpp')
-rw-r--r-- | nbxmpp/modules/tune.py | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/nbxmpp/modules/tune.py b/nbxmpp/modules/tune.py index 2512193..e054e3a 100644 --- a/nbxmpp/modules/tune.py +++ b/nbxmpp/modules/tune.py @@ -21,6 +21,8 @@ from nbxmpp.structs import StanzaHandler from nbxmpp.structs import TuneData from nbxmpp.const import TUNE_DATA from nbxmpp.modules.base import BaseModule +from nbxmpp.modules.util import finalize +from nbxmpp.task import iq_request_task class Tune(BaseModule): @@ -67,7 +69,10 @@ class Tune(BaseModule): properties.pubsub_event = pubsub_event + @iq_request_task def set_tune(self, data): + task = yield + item = Node('tune', {'xmlns': Namespace.TUNE}) if data is not None: data = data._asdict() @@ -75,4 +80,6 @@ class Tune(BaseModule): if value is not None: item.addChild(tag, payload=value) - self.publish(Namespace.TUNE, item, id_='current') + result = yield self.publish(Namespace.TUNE, item, id_='current') + + yield finalize(task, result) |