From 3a91ff2b481ed264559f8e24d191309b68f3c1ce Mon Sep 17 00:00:00 2001 From: Kim Alvefur Date: Fri, 3 Nov 2023 21:13:34 +0100 Subject: muc.register: Clarify what's going on when enforcing nicknames Does this make it clearer what is going on? --- plugins/muc/register.lib.lua | 2 ++ 1 file changed, 2 insertions(+) (limited to 'plugins/muc/register.lib.lua') diff --git a/plugins/muc/register.lib.lua b/plugins/muc/register.lib.lua index 24ae7153..82ccb8ea 100644 --- a/plugins/muc/register.lib.lua +++ b/plugins/muc/register.lib.lua @@ -94,8 +94,10 @@ local function enforce_nick_policy(event) local nick = get_registered_nick(room, jid_bare(stanza.attr.from)); if nick then if event.occupant then + -- someone is joining, force their nickname to the registered one event.occupant.nick = jid_bare(event.occupant.nick) .. "/" .. nick; elseif event.dest_occupant.nick ~= jid_bare(event.dest_occupant.nick) .. "/" .. nick then + -- someone is trying to change nickname to something other than their registered nickname, can't have that 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", nil, room.jid):up(); origin.send(reply); -- cgit v1.2.3