Send bad-request error for unknown IQ set/gets
This commit is contained in:
parent
62aa8aa74a
commit
57a7d165e9
|
@ -83,8 +83,14 @@ namespace Xmpp.Iq {
|
||||||
}
|
}
|
||||||
|
|
||||||
public interface Handler : Object {
|
public interface Handler : Object {
|
||||||
public abstract void on_iq_get(XmppStream stream, Iq.Stanza iq);
|
public virtual void on_iq_get(XmppStream stream, Iq.Stanza iq) {
|
||||||
public abstract void on_iq_set(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);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -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) {
|
public override void attach(XmppStream stream) {
|
||||||
stream.get_module(Iq.Module.IDENTITY).register_for_namespace(NS_URI, this);
|
stream.get_module(Iq.Module.IDENTITY).register_for_namespace(NS_URI, this);
|
||||||
stream.get_module(Presence.Module.IDENTITY).initial_presence_sent.connect(roster_get);
|
stream.get_module(Presence.Module.IDENTITY).initial_presence_sent.connect(roster_get);
|
||||||
|
|
|
@ -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) {
|
public override void attach(XmppStream stream) {
|
||||||
stream.add_flag(new Flag());
|
stream.add_flag(new Flag());
|
||||||
stream.get_module(Iq.Module.IDENTITY).register_for_namespace(NS_URI_INFO, this);
|
stream.get_module(Iq.Module.IDENTITY).register_for_namespace(NS_URI_INFO, this);
|
||||||
|
|
|
@ -45,7 +45,6 @@ public class Module : XmppStreamModule, Iq.Handler {
|
||||||
return stream.has_flag(Flag.IDENTITY);
|
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) {
|
private void on_iq_set(XmppStream stream, Iq.Stanza iq) {
|
||||||
StanzaNode? block_node = iq.stanza.get_subnode("block", NS_URI);
|
StanzaNode? block_node = iq.stanza.get_subnode("block", NS_URI);
|
||||||
StanzaNode? unblock_node = iq.stanza.get_subnode("unblock", NS_URI);
|
StanzaNode? unblock_node = iq.stanza.get_subnode("unblock", NS_URI);
|
||||||
|
|
|
@ -27,7 +27,6 @@ namespace Xmpp.Xep.Ping {
|
||||||
public void on_iq_get(XmppStream stream, Iq.Stanza iq) {
|
public void on_iq_get(XmppStream stream, Iq.Stanza iq) {
|
||||||
stream.get_module(Iq.Module.IDENTITY).send_iq(stream, new Iq.Stanza.result(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_ns() { return NS_URI; }
|
||||||
public override string get_id() { return IDENTITY.id; }
|
public override string get_id() { return IDENTITY.id; }
|
||||||
|
|
Loading…
Reference in a new issue