diff options
author | hrxi <hrrrxi@gmail.com> | 2019-06-20 16:01:58 +0200 |
---|---|---|
committer | hrxi <hrrrxi@gmail.com> | 2019-06-21 18:09:44 +0200 |
commit | 62aa8aa74a63e67247cd80d20ccc27ae52882b9e (patch) | |
tree | 6c81e2a88fcfb3aedc297db72bb5674651ac07d8 /xmpp-vala/src/module/iq | |
parent | 34f9677c4e5384c9b823ce76c3dbeb143a3ff625 (diff) | |
download | dino-62aa8aa74a63e67247cd80d20ccc27ae52882b9e.tar.gz dino-62aa8aa74a63e67247cd80d20ccc27ae52882b9e.zip |
Add a couple of error primitives for easier error handling
Diffstat (limited to 'xmpp-vala/src/module/iq')
-rw-r--r-- | xmpp-vala/src/module/iq/module.vala | 2 | ||||
-rw-r--r-- | xmpp-vala/src/module/iq/stanza.vala | 9 |
2 files changed, 4 insertions, 7 deletions
diff --git a/xmpp-vala/src/module/iq/module.vala b/xmpp-vala/src/module/iq/module.vala index 47f6e764..abcc271c 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); } } diff --git a/xmpp-vala/src/module/iq/stanza.vala b/xmpp-vala/src/module/iq/stanza.vala index 3c938883..825d6a5d 100644 --- a/xmpp-vala/src/module/iq/stanza.vala +++ b/xmpp-vala/src/module/iq/stanza.vala @@ -30,17 +30,14 @@ public class Stanza : Xmpp.Stanza { public Stanza.set(StanzaNode stanza_node, string? id = null) { this(id); - type_ = TYPE_SET; + this.type_ = TYPE_SET; stanza.put_node(stanza_node); } - public Stanza.error(Stanza request, StanzaNode error_stanza, StanzaNode? associated_child = null) { + public Stanza.error(Stanza request, ErrorStanza error_stanza) { this(request.id); this.type_ = TYPE_ERROR; - stanza.put_node(error_stanza); - if (associated_child != null) { - stanza.put_node(associated_child); - } + stanza.put_node(error_stanza.error_node); } public Stanza.from_stanza(StanzaNode stanza_node, Jid? my_jid) { base.incoming(stanza_node, my_jid); |