diff options
author | fiaxh <git@lightrise.org> | 2020-04-24 14:19:42 +0200 |
---|---|---|
committer | fiaxh <git@lightrise.org> | 2020-04-24 14:19:42 +0200 |
commit | f8f305efe551838c780dce4224c06bed695d8a62 (patch) | |
tree | 1e5b9f6988d0bb911a53d3234eba464873e6984b /xmpp-vala/src/module/iq | |
parent | 1db94905ae7af1c1aed475a090dfb09e59fb2520 (diff) | |
download | dino-f8f305efe551838c780dce4224c06bed695d8a62.tar.gz dino-f8f305efe551838c780dce4224c06bed695d8a62.zip |
xmpp-vala: Use more async
Diffstat (limited to 'xmpp-vala/src/module/iq')
-rw-r--r-- | xmpp-vala/src/module/iq/module.vala | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/xmpp-vala/src/module/iq/module.vala b/xmpp-vala/src/module/iq/module.vala index 51a5f359..9deb0422 100644 --- a/xmpp-vala/src/module/iq/module.vala +++ b/xmpp-vala/src/module/iq/module.vala @@ -54,7 +54,7 @@ namespace Xmpp.Iq { public override string get_ns() { return NS_URI; } public override string get_id() { return IDENTITY.id; } - private void on_received_iq_stanza(XmppStream stream, StanzaNode node) { + private async void on_received_iq_stanza(XmppStream stream, StanzaNode node) { Iq.Stanza iq = new Iq.Stanza.from_stanza(node, stream.has_flag(Bind.Flag.IDENTITY) ? stream.get_flag(Bind.Flag.IDENTITY).my_jid : null); if (iq.type_ == Iq.Stanza.TYPE_RESULT || iq.is_error()) { @@ -71,9 +71,9 @@ namespace Xmpp.Iq { Gee.List<Handler> handlers = namespaceRegistrants[children[0].ns_uri]; foreach (Handler handler in handlers) { if (iq.type_ == Iq.Stanza.TYPE_GET) { - handler.on_iq_get(stream, iq); + yield handler.on_iq_get(stream, iq); } else if (iq.type_ == Iq.Stanza.TYPE_SET) { - handler.on_iq_set(stream, iq); + yield handler.on_iq_set(stream, iq); } } } else { @@ -94,11 +94,11 @@ namespace Xmpp.Iq { } public interface Handler : Object { - public virtual void on_iq_get(XmppStream stream, Iq.Stanza iq) { + public async virtual void on_iq_get(XmppStream stream, Iq.Stanza iq) { Iq.Stanza bad_request = new Iq.Stanza.error(iq, new ErrorStanza.bad_request("unexpected IQ get for this namespace")); stream.get_module(Module.IDENTITY).send_iq(stream, bad_request); } - public virtual void on_iq_set(XmppStream stream, Iq.Stanza iq) { + public async virtual void on_iq_set(XmppStream stream, Iq.Stanza iq) { Iq.Stanza bad_request = new Iq.Stanza.error(iq, new ErrorStanza.bad_request("unexpected IQ set for this namespace")); stream.get_module(Module.IDENTITY).send_iq(stream, bad_request); } |