Changeset

9027:4028eb4a9f7f

MUC: Also prevent changing to an invisible nickname
author Kim Alvefur <zash@zash.se>
date Thu, 12 Jul 2018 02:18:46 +0200
parents 9026:91b5a5667016
children 9028:d4c2a3060e7e
files plugins/muc/muc.lib.lua
diffstat 1 files changed, 7 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/plugins/muc/muc.lib.lua	Thu Jul 12 02:31:47 2018 +0200
+++ b/plugins/muc/muc.lib.lua	Thu Jul 12 02:18:46 2018 +0200
@@ -409,6 +409,13 @@
 	end
 end, 1);
 
+module:hook("muc-occupant-pre-change", function(event)
+	if not jid_resource(event.dest_occupant.nick):find("%S") then
+		event.origin.send(st.error_reply(event.stanza, "modify", "not-allowed", "Invisible Nicknames are forbidden"));
+		return true;
+	end
+end, 1);
+
 function room_mt:handle_first_presence(origin, stanza)
 	if not stanza:get_child("x", "http://jabber.org/protocol/muc") then
 		module:log("debug", "Room creation without <x>, possibly desynced");