diff options
author | fiaxh <fiaxh@users.noreply.github.com> | 2019-06-21 19:49:17 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-06-21 19:49:17 +0200 |
commit | 23a298dc4b5645c12f2478d3d82bb20f38374c2c (patch) | |
tree | 812dd718bf4e2c9105c523e569b84fb83f37fe91 /xmpp-vala/src/module/iq/module.vala | |
parent | 34f9677c4e5384c9b823ce76c3dbeb143a3ff625 (diff) | |
parent | 57a7d165e91cbfa1b2b4c10e42958cdc0854e961 (diff) | |
download | dino-23a298dc4b5645c12f2478d3d82bb20f38374c2c.tar.gz dino-23a298dc4b5645c12f2478d3d82bb20f38374c2c.zip |
Merge pull request #579 from hrxi/pr_errors
Add a couple of error primitives for easier error handling
Diffstat (limited to 'xmpp-vala/src/module/iq/module.vala')
-rw-r--r-- | xmpp-vala/src/module/iq/module.vala | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/xmpp-vala/src/module/iq/module.vala b/xmpp-vala/src/module/iq/module.vala index 47f6e764..f73f5459 100644 --- a/xmpp-vala/src/module/iq/module.vala +++ b/xmpp-vala/src/module/iq/module.vala @@ -67,7 +67,7 @@ namespace Xmpp.Iq { } } } else { - Iq.Stanza unavailable_error = new Iq.Stanza.error(iq, new StanzaNode.build("service-unavailable", "urn:ietf:params:xml:ns:xmpp-stanzas").add_self_xmlns()); + Iq.Stanza unavailable_error = new Iq.Stanza.error(iq, new ErrorStanza.service_unavailable()); send_iq(stream, unavailable_error); } } @@ -83,8 +83,14 @@ namespace Xmpp.Iq { } public interface Handler : Object { - public abstract void on_iq_get(XmppStream stream, Iq.Stanza iq); - public abstract void on_iq_set(XmppStream stream, Iq.Stanza iq); + public 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) { + 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); + } } } |