Software /
code /
prosody
Comparison
plugins/muc/muc.lib.lua @ 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 |
parent | 9026:91b5a5667016 |
child | 9052:5017e43ccc39 |
comparison
equal
deleted
inserted
replaced
9026:91b5a5667016 | 9027:4028eb4a9f7f |
---|---|
402 end, -10); | 402 end, -10); |
403 | 403 |
404 module:hook("muc-occupant-pre-join", function(event) | 404 module:hook("muc-occupant-pre-join", function(event) |
405 local nick = jid_resource(event.occupant.nick); | 405 local nick = jid_resource(event.occupant.nick); |
406 if not nick:find("%S") then | 406 if not nick:find("%S") then |
407 event.origin.send(st.error_reply(event.stanza, "modify", "not-allowed", "Invisible Nicknames are forbidden")); | |
408 return true; | |
409 end | |
410 end, 1); | |
411 | |
412 module:hook("muc-occupant-pre-change", function(event) | |
413 if not jid_resource(event.dest_occupant.nick):find("%S") then | |
407 event.origin.send(st.error_reply(event.stanza, "modify", "not-allowed", "Invisible Nicknames are forbidden")); | 414 event.origin.send(st.error_reply(event.stanza, "modify", "not-allowed", "Invisible Nicknames are forbidden")); |
408 return true; | 415 return true; |
409 end | 416 end |
410 end, 1); | 417 end, 1); |
411 | 418 |