441 if not jid_resource(event.dest_occupant.nick):find("%S") then |
441 if not jid_resource(event.dest_occupant.nick):find("%S") then |
442 event.origin.send(st.error_reply(event.stanza, "modify", "not-allowed", "Invisible Nicknames are forbidden")); |
442 event.origin.send(st.error_reply(event.stanza, "modify", "not-allowed", "Invisible Nicknames are forbidden")); |
443 return true; |
443 return true; |
444 end |
444 end |
445 end, 1); |
445 end, 1); |
|
446 |
|
447 module:hook("muc-occupant-pre-join", function(event) |
|
448 local nick = jid_resource(event.occupant.nick); |
|
449 if not resourceprep(nick, true) then -- strict |
|
450 event.origin.send(st.error_reply(event.stanza, "modify", "jid-malformed", "Nickname must pass strict validation")); |
|
451 return true; |
|
452 end |
|
453 end, 2); |
|
454 |
|
455 module:hook("muc-occupant-pre-change", function(event) |
|
456 local nick = jid_resource(event.dest_occupant.nick); |
|
457 if not resourceprep(nick, true) then -- strict |
|
458 event.origin.send(st.error_reply(event.stanza, "modify", "jid-malformed", "Nickname must pass strict validation")); |
|
459 return true; |
|
460 end |
|
461 end, 2); |
446 |
462 |
447 function room_mt:handle_first_presence(origin, stanza) |
463 function room_mt:handle_first_presence(origin, stanza) |
448 local real_jid = stanza.attr.from; |
464 local real_jid = stanza.attr.from; |
449 local dest_jid = stanza.attr.to; |
465 local dest_jid = stanza.attr.to; |
450 local bare_jid = jid_bare(real_jid); |
466 local bare_jid = jid_bare(real_jid); |