mod_mix: Fix setnick

This commit is contained in:
PapaTutuWawa 2021-02-22 08:33:43 +01:00
parent fa884d72d7
commit 08c513a957

View File

@ -512,7 +512,7 @@ module:hook("iq-set/bare/"..mix_core_xmlns..":setnick", function(event)
-- NOTE: Prosody should guarantee us that the setnick stanza exists
local setnick = stanza:get_child("setnick", mix_core_xmlns);
local nick = setnick:get_child("nick");
if nick_stanza == nil then
if nick == nil then
origin.send(st.error_reply(stanza, "cancel", "bad-request", "Missing <nick>"));
return true;
end
@ -520,7 +520,7 @@ module:hook("iq-set/bare/"..mix_core_xmlns..":setnick", function(event)
-- Change the nick
channel.participants[j].nick = nick:get_text();
-- Inform all other members
local srv = pep.get_pep_service(channel.jid);
local srv = pep.get_pep_service(jid.node(channel.jid));
--local participant = channel.participants[participant_index];
publish_participant(srv, channel, channel:get_spid(participant.jid), participant);
@ -649,6 +649,7 @@ module:hook("iq-set/host/"..mix_core_xmlns..":destroy", function(event)
return true;
end
-- TODO: Permission checks
-- TODO: Maybe make this configurable
if helpers.find_str(channel.contacts, from) == -1 then
origin.send(st.error_reply(stanza, "cancel", "forbidden"));