From 57a7d165e91cbfa1b2b4c10e42958cdc0854e961 Mon Sep 17 00:00:00 2001 From: hrxi Date: Thu, 20 Jun 2019 16:08:05 +0200 Subject: Send bad-request error for unknown IQ set/gets --- xmpp-vala/src/module/iq/module.vala | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'xmpp-vala/src/module/iq') diff --git a/xmpp-vala/src/module/iq/module.vala b/xmpp-vala/src/module/iq/module.vala index abcc271c..f73f5459 100644 --- a/xmpp-vala/src/module/iq/module.vala +++ b/xmpp-vala/src/module/iq/module.vala @@ -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); + } } } -- cgit v1.2.3-70-g09d2