aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKim Alvefur <zash@zash.se>2019-11-25 23:51:41 +0100
committerKim Alvefur <zash@zash.se>2019-11-25 23:51:41 +0100
commitc26f8beac4075c8d031ed9a620fac77653d1bb07 (patch)
treece2e898dd915726ee9dcd51791458f822559b206
parent057fbeaf06876cfbfbba24bbc317de313fa9e84b (diff)
downloadprosody-c26f8beac4075c8d031ed9a620fac77653d1bb07.tar.gz
prosody-c26f8beac4075c8d031ed9a620fac77653d1bb07.zip
MUC: Indicate origin of registration related errors
-rw-r--r--plugins/muc/register.lib.lua6
-rw-r--r--spec/scansion/muc_register.scs4
2 files changed, 5 insertions, 5 deletions
diff --git a/plugins/muc/register.lib.lua b/plugins/muc/register.lib.lua
index bf8cd877..f0a15dd4 100644
--- a/plugins/muc/register.lib.lua
+++ b/plugins/muc/register.lib.lua
@@ -66,7 +66,7 @@ local function enforce_nick_policy(event)
local reserved_by = get_registered_jid(room, requested_nick);
if reserved_by and reserved_by ~= jid_bare(stanza.attr.from) then
module:log("debug", "%s attempted to use nick %s reserved by %s", stanza.attr.from, requested_nick, reserved_by);
- local reply = st.error_reply(stanza, "cancel", "conflict"):up();
+ local reply = st.error_reply(stanza, "cancel", "conflict", nil, room.jid):up();
origin.send(reply:tag("x", {xmlns = "http://jabber.org/protocol/muc"}));
return true;
end
@@ -79,7 +79,7 @@ local function enforce_nick_policy(event)
event.occupant.nick = jid_bare(event.occupant.nick) .. "/" .. nick;
elseif event.dest_occupant.nick ~= jid_bare(event.dest_occupant.nick) .. "/" .. nick then
module:log("debug", "Attempt by %s to join as %s, but their reserved nick is %s", stanza.attr.from, requested_nick, nick);
- local reply = st.error_reply(stanza, "cancel", "not-acceptable"):up();
+ local reply = st.error_reply(stanza, "cancel", "not-acceptable", nil, room.jid):up();
origin.send(reply:tag("x", {xmlns = "http://jabber.org/protocol/muc"}));
return true;
end
@@ -103,7 +103,7 @@ local function handle_register_iq(room, origin, stanza)
local user_jid = jid_bare(stanza.attr.from)
local affiliation = room:get_affiliation(user_jid);
if affiliation == "outcast" then
- origin.send(st.error_reply(stanza, "auth", "forbidden"));
+ origin.send(st.error_reply(stanza, "auth", "forbidden", room.jid));
return true;
elseif not (affiliation or allow_unaffiliated) then
origin.send(st.error_reply(stanza, "auth", "registration-required"));
diff --git a/spec/scansion/muc_register.scs b/spec/scansion/muc_register.scs
index a077cd76..5d1f5f3e 100644
--- a/spec/scansion/muc_register.scs
+++ b/spec/scansion/muc_register.scs
@@ -177,7 +177,7 @@ Rosaline sends:
Rosaline receives:
<presence type='error' from='room@conference.localhost/Juliet'>
- <error type='cancel'>
+ <error type='cancel' by='room@conference.localhost'>
<conflict xmlns='urn:ietf:params:xml:ns:xmpp-stanzas'/>
</error>
<x xmlns='http://jabber.org/protocol/muc'/>
@@ -288,7 +288,7 @@ Rosaline sends:
Rosaline receives:
<presence type='error' from='room@conference.localhost/Juliet'>
- <error type='cancel'>
+ <error type='cancel' by='room@conference.localhost'>
<conflict xmlns='urn:ietf:params:xml:ns:xmpp-stanzas'/>
</error>
<x xmlns='http://jabber.org/protocol/muc'/>