Software / code / prosody-modules
Comparison
mod_muc_auto_member/mod_muc_auto_member.lua @ 5162:243c156074d3
mod_muc_auto_member: New module to automatically make MUC participants members
| author | Matthew Wild <mwild1@gmail.com> |
|---|---|
| date | Mon, 30 Jan 2023 15:07:31 +0000 |
comparison
equal
deleted
inserted
replaced
| 5161:6af2d74daa15 | 5162:243c156074d3 |
|---|---|
| 1 module:hook("muc-occupant-joined", function (event) | |
| 2 local room = event.room; | |
| 3 local occupant_jid = event.occupant.bare_jid; | |
| 4 local aff = room:get_affiliation(occupant_jid); | |
| 5 if aff then return; end -- user already registered | |
| 6 module:log("debug", "Automatically registering %s as a member in %s", occupant_jid, room.jid); | |
| 7 room:set_affiliation(true, occupant_jid, "member"); | |
| 8 end); |