Module hooks problem

Good afternoon and, first of all, thank you for hard and good work on this platform!

I apologize in advance because this might be a quite silly question but I don’t seem to be able to find a solution.

I’ve been trying to use the modules in /usr/share/jitsi-meet/prosody-plugins but those didn’t seem to be working at all. I’ve added some logs to ensure that those were loaded and they’re but, for some reason I’m unable to figure out, hooks doesn’t seem to be called.

I’ve tried to use existing mod_muc_max_occupants.lua but, just to verify that the problem was in hooks, I’ve just written this very basic test script:

-- Simple hooks test

module:log('info', 'Loading hooks test plugin');
module:hook("authentication-success", function(event)
        module:log("info", "User successfully authenticated");

I have been looking for a similar problem in the topics but seems that nobody had any problem like this.

Thank you very much!

1 Like

Did you solve the problem ?

So if you load muc_max_occupants under conference muc component and “authentication-success” is fired from the virtual host you will not get the event, you need to be in the correct context.

I want to handle muc-occupant-pre-join event, where should I load it ? under virtual host or component ?

You need it under the muc component and I’m not sure that event is available on Prosody 0.10, but for sure is available when using 0.11.
You can grep for that string in all folders in /usr/lib/prosody/modules for it and if you see it, it is available

1 Like

Than you it works.

My module hook the event like below:

 module:hook("muc-occupant-pre-join", function (event)
    module:log('info','Occupant pre join');

    local room, stanza =, event.stanza;

    local user, domain, res = jid.split(event.stanza.attr.from);
    log("info", "--------------> user %s domain %s res %s pass %s", tostring(user),tostring(domain),tostring(res),tostring(room:get_password())); 


What is the structure of room object ? I want to take the name of the room.

try log("info", "%s", tostring(room));

1 Like

Thank you,
I read in prosody documentation about muc configurations and i see muc_room_default_members_only , I set it to true and when I am trying to join room using authenticated user jitsi ask me to enter password or enter name to join room.
My question is how can I set the members of room.

Component "" "muc"
	admins = { "" }
	restrict_room_creation = true
        muc_room_default_members_only = true

Now, I am trying to handle muc-occupant-pre-join event to prevent user to join room, how can I kick user out in my prosody module ?
And how can I listen to the event in jitsi meet to redirect the user to another page ?

We use members only logic for lobby, so you should disable lobby if you are doing such modification.
Members can be added from owners of the room:
So make a user, make that user an admin as we do for jicofo and that user can join and add members by … sending xmpp messages, there is no UI for such things, probably you can do it through the js console.

Can you help me please to know how can I sending them xmpp messages ? and how can I disable lobby ?

Can you get me the room object structure or a link to see it ?

Disable in the config - Comment out/remove changes found here

Remove "muc_lobby_rooms" from the modules_enabled section

but it is not found in my configuration file