Software /
code /
prosody
Diff
plugins/muc/mod_muc.lua @ 13495:47e1df2d0a37
MUC: Add per-room PM restriction functionality (thanks Wirlaburla)
Based on mod_muc_restrict_pm in prosody-modules d82c0383106a
author | Matthew Wild <mwild1@gmail.com> |
---|---|
date | Thu, 23 May 2024 17:39:20 +0100 |
parent | 13308:d539cb48c6e9 |
child | 13496:3e6d5738ea09 |
line wrap: on
line diff
--- a/plugins/muc/mod_muc.lua Wed Jun 12 23:20:48 2024 +0200 +++ b/plugins/muc/mod_muc.lua Thu May 23 17:39:20 2024 +0100 @@ -86,6 +86,12 @@ room_mt.get_registered_jid = register.get_registered_jid; room_mt.handle_register_iq = register.handle_register_iq; +local restrict_pm = module:require "muc/restrict_pm"; +room_mt.get_allow_pm = restrict_pm.get_allow_pm; +room_mt.set_allow_pm = restrict_pm.set_allow_pm; +room_mt.get_allow_modpm = restrict_pm.get_allow_modpm; +room_mt.set_allow_modpm = restrict_pm.set_allow_modpm; + local presence_broadcast = module:require "muc/presence_broadcast"; room_mt.get_presence_broadcast = presence_broadcast.get; room_mt.set_presence_broadcast = presence_broadcast.set; @@ -293,6 +299,8 @@ room:set_language(lang or module:get_option_string("muc_room_default_language")); room:set_presence_broadcast(module:get_option_enum("muc_room_default_presence_broadcast", room:get_presence_broadcast(), "visitor", "participant", "moderator")); + room:set_allow_pm(module:get_option_enum("muc_room_default_allow_pm", room:get_allow_pm(), "visitor", "participant", "moderator")); + room:set_allow_modpm(module:get_option_boolean("muc_room_default_always_allow_moderator_pms", room:get_allow_modpm())); end function create_room(room_jid, config)