Diff

plugins/muc/muc.lib.lua @ 9024:43241e74bb19

MUC: Reject invisible nicknames (fixes #979)
author Kim Alvefur <zash@zash.se>
date Thu, 12 Jul 2018 02:14:16 +0200
parent 9023:ce461a67d2cc
child 9025:0f12d46cf754
line wrap: on
line diff
--- a/plugins/muc/muc.lib.lua	Thu Jul 12 01:50:06 2018 +0200
+++ b/plugins/muc/muc.lib.lua	Thu Jul 12 02:14:16 2018 +0200
@@ -401,6 +401,14 @@
 	end
 end, -10);
 
+module:hook("muc-occupant-pre-join", function(event)
+	local nick = jid_resource(event.stanza.attr.from);
+	if not nick:find("%S") then
+		event.origin.send(st.error_reply(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");