Persistent Passswords On Rooms ( Prosody 0.10.0 )

This is a follow up post for Persistent Passwords on Self Hosted Rooms

The script from post #10 is working great on Prosody 0.11.x, but I have a problem with Prosody 0.10.0
The script writes the password to the persistent storage and also reads it from there.

module:hook("muc-occupant-pre-join", function (event)

works with Prosody 0.11.x but seems not to be fired on Prosody 0.10.0

So, jicofo cannot join the room as the first member and we are ending in

Oops, Something went wrong and we couldn’t connect to the conference: connection.GET_SESSION_ID_ERROR.

Anyone who got it working on Prosody 0.10.0 and can tell, which event is fired before jicofo joins a room?

Did you test the muc-room-pre-create hook originally suggested in this post by damencho?

not even this solution works on Prosody 0.10.0. Why is this stuff so unreliable? I don’t get it …

Does the muc-room-pre--create event not even fire or is it the module that fails to work? I did not check, but it seems likely that you would need to add some code again to whitelist jicofo when using the muc-room-pre-create hook (similar to what needed to be done for persistent rooms).

I am aware about the jicofo user behaviour.

I have build a module where I only have the module:hook(s) … and a log line inside the function like this

module:hook("muc-room-pre-create", function(event)
     module:log("info", "muc-room-pre-create event triggered");
end);

I use it to learn, at wich point in time a specific event is triggered.
With Prosody 0.11.x, I see the output in the prosody.log file . With Prosody 0.10.0 nothing happens.

her is my mod_log_events.lua

--[[Ulrich Krause, 17-MAY-2020]]
module:hook("muc-occupant-pre-join", function (event)
    module:log("info", "muc-occupant-pre-joined event triggered");
end);

module:hook("muc-occupant-left", function(event)
    module:log("info", "muc-occupant-left event triggered");
end);

module:hook("muc-room-destroyed", function (event)
    module:log("info", "muc-room-destroyed event triggered");
end);

module:hook("muc-room-created", function (event)
    module:log("info", "muc-room-created event triggered");
end);

module:hook("muc-room-pre-create", function (event)
    module:log("info", "muc-room-pre-create event triggered");
end);

These are the events that are triggered with Prosody 0.10.0 ( 0.11.x triggers ALL events) when I create a new room and log in as owner

May 16 11:47:54 mod_bosh        info    New BOSH session, assigned it sid '966c30cf-ae17-495b-acac-9e32645a0d29'

May 16 11:47:54 bosh966c30cf-ae17-495b-acac-9e32645a0d29        info    Authenticated as d5a11a8d-9c0a-4e0d-bfd9-5e7c9c81fa72@guest.meet.xyz.net

May 16 11:47:55 conference.meet.xyz.net:log_events        info    muc-room-created event triggered

May 16 11:48:02 conference.meet.xyz.net:log_events        info    muc-room-destroyed event triggered

May 16 11:48:03 conference.meet.xyz.net:muc_domain_mapper warn    Session filters applied

May 16 11:48:03 mod_bosh        info    New BOSH session, assigned it sid 'eda84fb7-7732-41f1-8c90-486053fc73db'

May 16 11:48:04 bosheda84fb7-7732-41f1-8c90-486053fc73db        info    Authenticated as ulrich@meet.xyz.net

May 16 11:48:04 conference.meet.xyz.net:log_events        info    muc-room-created event triggered

May 16 11:48:04 bosheda84fb7-7732-41f1-8c90-486053fc73db        info    BOSH client disconnected

May 16 11:48:05 conference.meet.xyz.net:log_events        info    muc-room-created event triggered

May 16 11:48:12 conference.meet.xyz.net:log_events        info    muc-room-destroyed event triggered

May 16 11:48:15 conference.meet.xyz.net:log_events        info    muc-room-created event triggered

Anyone a solution other than “upgrade to Prosody 011.x”? We cannot upgrade, because the upgrade would break LDAP auth with cyrus.

A look into the Prosody 0.10 sourecode, and it becomes pretty clear why the

module:hook("muc-occupant-pre-join"

does not work.

It just doesn’t get triggered anywhere. The same goes for

module:hook("muc-room-pre-create" .

The triggering events are only triggered from Prosody 0.11 on.
The whole thing happens in mod_muc.lua.
Starting with Prosody 0.11 several more libs and modules have been added there.

I have not yet tested if you can simply exchange the mod_muc + dependencies.