XEP-0410: set not-in-the-room error condition to not-acceptable

XEP-0410 demands that. This changes the error condition for all
pings to the room, even those which aren’t self-pings, if the
sender is not joined.

The conditions of XEP-0410 were based on observing existing
implementations.
This commit is contained in:
Jonas Schäfer
2019-08-20 21:42:43 +02:00
parent b68f36056d
commit a8ce138dd2
2 changed files with 3 additions and 3 deletions
+1 -1
View File
@@ -743,7 +743,7 @@ void Bridge::send_irc_participant_ping_request(const Iid& iid, const std::string
IrcChannel* chan = irc->get_channel(iid.get_local()); IrcChannel* chan = irc->get_channel(iid.get_local());
if (!chan->joined || !this->is_resource_in_chan(iid.to_tuple(), from.resource)) if (!chan->joined || !this->is_resource_in_chan(iid.to_tuple(), from.resource))
{ {
this->xmpp.send_stanza_error("iq", to_jid, from_jid, iq_id, "cancel", "not-allowed", this->xmpp.send_stanza_error("iq", to_jid, from_jid, iq_id, "cancel", "not-acceptable",
"", true); "", true);
return; return;
} }
+2 -2
View File
@@ -1543,14 +1543,14 @@ if __name__ == '__main__':
"<iq type='get' from='{jid_one}/{resource_one}' id='first_ping' to='#nil%{irc_server_one}/{nick_one}'><ping xmlns='urn:xmpp:ping' /></iq>"), "<iq type='get' from='{jid_one}/{resource_one}' id='first_ping' to='#nil%{irc_server_one}/{nick_one}'><ping xmlns='urn:xmpp:ping' /></iq>"),
# Immediately receive an error # Immediately receive an error
partial(expect_stanza, partial(expect_stanza,
"/iq[@from='#nil%{irc_server_one}/{nick_one}'][@type='error'][@to='{jid_one}/{resource_one}'][@id='first_ping']/error/stanza:not-allowed"), "/iq[@from='#nil%{irc_server_one}/{nick_one}'][@type='error'][@to='{jid_one}/{resource_one}'][@id='first_ping']/error/stanza:not-acceptable"),
# Send a ping to ourself, in a muc where we are, but not this resource # Send a ping to ourself, in a muc where we are, but not this resource
partial(send_stanza, partial(send_stanza,
"<iq type='get' from='{jid_one}/{resource_two}' id='first_ping' to='#foo%{irc_server_one}/{nick_one}'><ping xmlns='urn:xmpp:ping' /></iq>"), "<iq type='get' from='{jid_one}/{resource_two}' id='first_ping' to='#foo%{irc_server_one}/{nick_one}'><ping xmlns='urn:xmpp:ping' /></iq>"),
# Immediately receive an error # Immediately receive an error
partial(expect_stanza, partial(expect_stanza,
"/iq[@from='#foo%{irc_server_one}/{nick_one}'][@type='error'][@to='{jid_one}/{resource_two}'][@id='first_ping']/error/stanza:not-allowed"), "/iq[@from='#foo%{irc_server_one}/{nick_one}'][@type='error'][@to='{jid_one}/{resource_two}'][@id='first_ping']/error/stanza:not-acceptable"),
]), ]),
Scenario("self_ping_on_real_channel", Scenario("self_ping_on_real_channel",
[ [