Comparison

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
comparison
equal deleted inserted replaced
9023:ce461a67d2cc 9024:43241e74bb19
398 reply.tags[1].attr.code = "403"; 398 reply.tags[1].attr.code = "403";
399 event.origin.send(reply:tag("x", {xmlns = "http://jabber.org/protocol/muc"})); 399 event.origin.send(reply:tag("x", {xmlns = "http://jabber.org/protocol/muc"}));
400 return true; 400 return true;
401 end 401 end
402 end, -10); 402 end, -10);
403
404 module:hook("muc-occupant-pre-join", function(event)
405 local nick = jid_resource(event.stanza.attr.from);
406 if not nick:find("%S") then
407 event.origin.send(st.error_reply(stanza, "modify", "not-allowed", "Invisible Nicknames are forbidden"));
408 return true;
409 end
410 end, 1);
403 411
404 function room_mt:handle_first_presence(origin, stanza) 412 function room_mt:handle_first_presence(origin, stanza)
405 if not stanza:get_child("x", "http://jabber.org/protocol/muc") then 413 if not stanza:get_child("x", "http://jabber.org/protocol/muc") then
406 module:log("debug", "Room creation without <x>, possibly desynced"); 414 module:log("debug", "Room creation without <x>, possibly desynced");
407 415