diff options
author | hrxi <hrrrxi@gmail.com> | 2019-06-20 16:08:05 +0200 |
---|---|---|
committer | hrxi <hrrrxi@gmail.com> | 2019-06-21 18:09:44 +0200 |
commit | 57a7d165e91cbfa1b2b4c10e42958cdc0854e961 (patch) | |
tree | 812dd718bf4e2c9105c523e569b84fb83f37fe91 | |
parent | 62aa8aa74a63e67247cd80d20ccc27ae52882b9e (diff) | |
download | dino-57a7d165e91cbfa1b2b4c10e42958cdc0854e961.tar.gz dino-57a7d165e91cbfa1b2b4c10e42958cdc0854e961.zip |
Send bad-request error for unknown IQ set/gets
-rw-r--r-- | xmpp-vala/src/module/iq/module.vala | 10 | ||||
-rw-r--r-- | xmpp-vala/src/module/roster/module.vala | 2 | ||||
-rw-r--r-- | xmpp-vala/src/module/xep/0030_service_discovery/module.vala | 2 | ||||
-rw-r--r-- | xmpp-vala/src/module/xep/0191_blocking_command.vala | 1 | ||||
-rw-r--r-- | xmpp-vala/src/module/xep/0199_ping.vala | 1 |
5 files changed, 8 insertions, 8 deletions
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); + } } } diff --git a/xmpp-vala/src/module/roster/module.vala b/xmpp-vala/src/module/roster/module.vala index 2d36211d..7a69abe9 100644 --- a/xmpp-vala/src/module/roster/module.vala +++ b/xmpp-vala/src/module/roster/module.vala @@ -66,8 +66,6 @@ public class Module : XmppStreamModule, Iq.Handler { } } - public void on_iq_get(XmppStream stream, Iq.Stanza iq) { } - public override void attach(XmppStream stream) { stream.get_module(Iq.Module.IDENTITY).register_for_namespace(NS_URI, this); stream.get_module(Presence.Module.IDENTITY).initial_presence_sent.connect(roster_get); diff --git a/xmpp-vala/src/module/xep/0030_service_discovery/module.vala b/xmpp-vala/src/module/xep/0030_service_discovery/module.vala index 2b955738..e2bb46f8 100644 --- a/xmpp-vala/src/module/xep/0030_service_discovery/module.vala +++ b/xmpp-vala/src/module/xep/0030_service_discovery/module.vala @@ -66,8 +66,6 @@ public class Module : XmppStreamModule, Iq.Handler { } } - public void on_iq_set(XmppStream stream, Iq.Stanza iq) { } - public override void attach(XmppStream stream) { stream.add_flag(new Flag()); stream.get_module(Iq.Module.IDENTITY).register_for_namespace(NS_URI_INFO, this); diff --git a/xmpp-vala/src/module/xep/0191_blocking_command.vala b/xmpp-vala/src/module/xep/0191_blocking_command.vala index 4b78ed33..ee8a1fed 100644 --- a/xmpp-vala/src/module/xep/0191_blocking_command.vala +++ b/xmpp-vala/src/module/xep/0191_blocking_command.vala @@ -45,7 +45,6 @@ public class Module : XmppStreamModule, Iq.Handler { return stream.has_flag(Flag.IDENTITY); } - private void on_iq_get(XmppStream stream, Iq.Stanza iq) { } private void on_iq_set(XmppStream stream, Iq.Stanza iq) { StanzaNode? block_node = iq.stanza.get_subnode("block", NS_URI); StanzaNode? unblock_node = iq.stanza.get_subnode("unblock", NS_URI); diff --git a/xmpp-vala/src/module/xep/0199_ping.vala b/xmpp-vala/src/module/xep/0199_ping.vala index 661ad253..3458fa9d 100644 --- a/xmpp-vala/src/module/xep/0199_ping.vala +++ b/xmpp-vala/src/module/xep/0199_ping.vala @@ -27,7 +27,6 @@ namespace Xmpp.Xep.Ping { public void on_iq_get(XmppStream stream, Iq.Stanza iq) { stream.get_module(Iq.Module.IDENTITY).send_iq(stream, new Iq.Stanza.result(iq)); } - public void on_iq_set(XmppStream stream, Iq.Stanza iq) { } public override string get_ns() { return NS_URI; } public override string get_id() { return IDENTITY.id; } |