This time, with the actual file attached...

Kind regards,

Seve
https://delape.net
https://github.com/SeveFP

>     On 14/12/2020 15:08 Severino Ferrer de la Peñita <s...@delape.net> wrote:
> 
> 
>     Hello!
> 
>     For deployments that have `allow_unaffiliated = true` 
> https://hg.prosody.im/trunk/file/tip/plugins/muc/register.lib.lua#l7
>     and use https://modules.prosody.im/mod_muc_http_auth.html 
> https://modules.prosody.im/mod_muc_http_auth.html
>     Users can still register to a MUC even if they are not allowed to join.
>     In order to extend mod_muc_http_auth, I need a change like the one I 
> provide with the patch attached, so mod_muc_http_auth can also block MUC 
> registrations.
> 
>     Thank you for your time in advance :)
> 
>     Kind regards,
> 
>     Seve
>     https://delape.net
>     https://github.com/SeveFP
> 

-- 
You received this message because you are subscribed to the Google Groups 
"prosody-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to prosody-dev+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/prosody-dev/59074539.42029.1607954947110%40office.mailbox.org.
# HG changeset patch
# User Seve Ferrer <s...@delape.net>
# Date 1607954100 -3600
#      Mon Dec 14 14:55:00 2020 +0100
# Node ID d7a6753a89331c7a5558865c3bc646a013e7eb76
# Parent  d28e11beb5d52d6f3ca5674772fb7f672902fbe0
register.lib.lua: Fire muc-register-iq event for modules willing to act on MUC registrations

diff -r d28e11beb5d5 -r d7a6753a8933 plugins/muc/register.lib.lua
--- a/plugins/muc/register.lib.lua	Sun Dec 13 16:27:00 2020 +0100
+++ b/plugins/muc/register.lib.lua	Mon Dec 14 14:55:00 2020 +0100
@@ -151,8 +151,15 @@
 			origin.send(st.error_reply(stanza, "modify", "bad-request", "Error in form"));
 			return true;
 		end
+
+		local desired_nick = resourceprep(reg_data["muc#register_roomnick"], true);
+
+		local event = {room = room, origin = origin, nick = desired_nick, stanza = stanza};
+		if module:fire_event("muc-register-iq", event) then
+			return true;
+		end
+
 		-- Is the nickname valid?
-		local desired_nick = resourceprep(reg_data["muc#register_roomnick"], true);
 		if not desired_nick then
 			origin.send(st.error_reply(stanza, "modify", "bad-request", "Invalid Nickname"));
 			return true;

Reply via email to