aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorhrxi <hrrrxi@gmail.com>2019-08-06 20:20:43 +0200
committerhrxi <hrrrxi@gmail.com>2019-08-06 21:12:41 +0200
commit4e0adcd2b4cae09b8ede7cf4f357e447afd1e723 (patch)
treecc5e115633ceba195680d716f837c8bcbb3ee93b
parente1c98a0fd94d0536c231ce79c2af63d891bf4c16 (diff)
downloaddino-4e0adcd2b4cae09b8ede7cf4f357e447afd1e723.tar.gz
dino-4e0adcd2b4cae09b8ede7cf4f357e447afd1e723.zip
Fix destination address of IBB error codes
-rw-r--r--xmpp-vala/src/module/xep/0047_in_band_bytestreams.vala22
1 files changed, 11 insertions, 11 deletions
diff --git a/xmpp-vala/src/module/xep/0047_in_band_bytestreams.vala b/xmpp-vala/src/module/xep/0047_in_band_bytestreams.vala
index caf5309d..9aa2d98c 100644
--- a/xmpp-vala/src/module/xep/0047_in_band_bytestreams.vala
+++ b/xmpp-vala/src/module/xep/0047_in_band_bytestreams.vala
@@ -25,28 +25,28 @@ public class Module : XmppStreamModule, Iq.Handler {
node = (node != null) ? node : iq.stanza.get_subnode("data", NS_URI);
node = (node != null) ? node : iq.stanza.get_subnode("close", NS_URI);
if (node == null) {
- stream.get_module(Iq.Module.IDENTITY).send_iq(stream, new Iq.Stanza.error(iq, new ErrorStanza.bad_request("unknown IBB action")));
+ stream.get_module(Iq.Module.IDENTITY).send_iq(stream, new Iq.Stanza.error(iq, new ErrorStanza.bad_request("unknown IBB action")) { to=iq.from });
return;
}
string? sid = node.get_attribute("sid");
if (sid == null) {
- stream.get_module(Iq.Module.IDENTITY).send_iq(stream, new Iq.Stanza.error(iq, new ErrorStanza.bad_request("missing sid")));
+ stream.get_module(Iq.Module.IDENTITY).send_iq(stream, new Iq.Stanza.error(iq, new ErrorStanza.bad_request("missing sid")) { to=iq.from });
return;
}
Connection? conn = stream.get_flag(Flag.IDENTITY).get_connection(sid);
if (node.name == "open") {
if (conn == null) {
- stream.get_module(Iq.Module.IDENTITY).send_iq(stream, new Iq.Stanza.error(iq, new ErrorStanza.not_acceptable("unexpected IBB connection")));
+ stream.get_module(Iq.Module.IDENTITY).send_iq(stream, new Iq.Stanza.error(iq, new ErrorStanza.not_acceptable("unexpected IBB connection")) { to=iq.from });
return;
}
if (conn.state != Connection.State.WAITING_FOR_CONNECT) {
- stream.get_module(Iq.Module.IDENTITY).send_iq(stream, new Iq.Stanza.error(iq, new ErrorStanza.bad_request("IBB open for already open connection")));
+ stream.get_module(Iq.Module.IDENTITY).send_iq(stream, new Iq.Stanza.error(iq, new ErrorStanza.bad_request("IBB open for already open connection")) { to=iq.from });
return;
}
conn.handle_open(stream, node, iq);
} else {
if (conn == null || conn.state != Connection.State.CONNECTED) {
- stream.get_module(Iq.Module.IDENTITY).send_iq(stream, new Iq.Stanza.error(iq, new ErrorStanza.item_not_found()));
+ stream.get_module(Iq.Module.IDENTITY).send_iq(stream, new Iq.Stanza.error(iq, new ErrorStanza.item_not_found()) { to=iq.from });
return;
}
if (node.name == "close") {
@@ -373,17 +373,17 @@ public class Connection : IOStream {
string? stanza = open.get_attribute("stanza");
if (block_size < 0 || (stanza != null && stanza != "iq" && stanza != "message")) {
set_error("invalid open");
- stream.get_module(Iq.Module.IDENTITY).send_iq(stream, new Iq.Stanza.error(iq, new ErrorStanza.bad_request("missing block_size or invalid stanza")));
+ stream.get_module(Iq.Module.IDENTITY).send_iq(stream, new Iq.Stanza.error(iq, new ErrorStanza.bad_request("missing block_size or invalid stanza")) { to=iq.from });
return;
}
if (stanza != null && stanza != "iq") {
set_error("invalid open");
- stream.get_module(Iq.Module.IDENTITY).send_iq(stream, new Iq.Stanza.error(iq, new ErrorStanza.feature_not_implemented("cannot use message stanzas for IBB")));
+ stream.get_module(Iq.Module.IDENTITY).send_iq(stream, new Iq.Stanza.error(iq, new ErrorStanza.feature_not_implemented("cannot use message stanzas for IBB")) { to=iq.from });
return;
}
if (block_size > this.block_size) {
set_error("invalid open");
- stream.get_module(Iq.Module.IDENTITY).send_iq(stream, new Iq.Stanza.error(iq, new ErrorStanza.build(ErrorStanza.TYPE_CANCEL, ErrorStanza.CONDITION_RESOURCE_CONSTRAINT, "opening a connection with a greater than negotiated/acceptable block size", null)));
+ stream.get_module(Iq.Module.IDENTITY).send_iq(stream, new Iq.Stanza.error(iq, new ErrorStanza.build(ErrorStanza.TYPE_CANCEL, ErrorStanza.CONDITION_RESOURCE_CONSTRAINT, "opening a connection with a greater than negotiated/acceptable block size", null)) { to=iq.from });
return;
}
this.block_size = block_size;
@@ -395,7 +395,7 @@ public class Connection : IOStream {
assert(state == State.CONNECTED);
if (input_closed) {
set_error("unexpected data");
- stream.get_module(Iq.Module.IDENTITY).send_iq(stream, new Iq.Stanza.error(iq, new ErrorStanza.not_allowed("unexpected data")));
+ stream.get_module(Iq.Module.IDENTITY).send_iq(stream, new Iq.Stanza.error(iq, new ErrorStanza.not_allowed("unexpected data")) { to=iq.from });
return;
}
int seq = data.get_attribute_int("seq");
@@ -404,12 +404,12 @@ public class Connection : IOStream {
uint8[] content = Base64.decode(data.get_string_content());
if (content.length > block_size) {
set_error("data longer than negotiated block size");
- stream.get_module(Iq.Module.IDENTITY).send_iq(stream, new Iq.Stanza.error(iq, new ErrorStanza.bad_request("data longer than negotiated block size")));
+ stream.get_module(Iq.Module.IDENTITY).send_iq(stream, new Iq.Stanza.error(iq, new ErrorStanza.bad_request("data longer than negotiated block size")) { to=iq.from });
return;
}
if (seq < 0 || seq != remote_seq) {
set_error("out of order data packets");
- stream.get_module(Iq.Module.IDENTITY).send_iq(stream, new Iq.Stanza.error(iq, new ErrorStanza.build(ErrorStanza.TYPE_CANCEL, ErrorStanza.CONDITION_UNEXPECTED_REQUEST, "out of order data packets", null)));
+ stream.get_module(Iq.Module.IDENTITY).send_iq(stream, new Iq.Stanza.error(iq, new ErrorStanza.build(ErrorStanza.TYPE_CANCEL, ErrorStanza.CONDITION_UNEXPECTED_REQUEST, "out of order data packets", null)) { to=iq.from });
return;
}
remote_seq = (remote_seq + 1) % SEQ_MODULUS;