diff --git a/resources/prosody-plugins/mod_muc_allowners.lua b/resources/prosody-plugins/mod_muc_allowners.lua index a5d57b6c6..0fca2ebd9 100644 --- a/resources/prosody-plugins/mod_muc_allowners.lua +++ b/resources/prosody-plugins/mod_muc_allowners.lua @@ -1,13 +1,21 @@ --- Copyright (c) 2015 &yet --- https://github.com/otalk/mod_muc_allowners/blob/9a86266a25ed32ade150742cc79f5a1669765a8f/mod_muc_allowners.lua --- --- Used under the terms of the MIT License --- https://github.com/otalk/mod_muc_allowners/blob/9a86266a25ed32ade150742cc79f5a1669765a8f/LICENSE +local is_healthcheck_room = module:require "util".is_healthcheck_room; -local muc_service = module:depends("muc"); -local room_mt = muc_service.room_mt; +module:hook("muc-occupant-joined", function (event) + local room, occupant = event.room, event.occupant; + if is_healthcheck_room(room) then + return; + end -room_mt.get_affiliation = function (room, jid) - return "owner"; -end + room:set_affiliation(true, occupant.bare_jid, "owner"); +end, 2); + +module:hook("muc-occupant-left", function (event) + local room, occupant = event.room, event.occupant; + + if is_healthcheck_room(room) then + return; + end + + room:set_affiliation(true, occupant.bare_jid, nil); +end, 2); diff --git a/resources/prosody-plugins/mod_muc_lobby_rooms.lua b/resources/prosody-plugins/mod_muc_lobby_rooms.lua new file mode 100644 index 000000000..424961481 --- /dev/null +++ b/resources/prosody-plugins/mod_muc_lobby_rooms.lua @@ -0,0 +1,245 @@ +-- This module added under the main virtual host domain +-- It needs a lobby muc component +-- +-- VirtualHost "jitmeet.example.com" +-- modules_enabled = { +-- "muc_lobby_rooms" +-- } +-- lobby_muc = "lobby.jitmeet.example.com" +-- main_muc = "conference.jitmeet.example.com" +-- +-- Component "lobbyrooms.damencho.jitsi.net" "muc" +-- storage = "memory" +-- muc_room_cache_size = 1000 +-- restrict_room_creation = true +-- muc_room_locking = false +-- muc_room_default_public_jids = true +-- +-- we use async to detect Prosody 0.10 and earlier +local have_async = pcall(require, "util.async"); + +if not have_async then + module:log("warn", "Lobby rooms will not work with Prosody version 0.10 or less."); + return; +end + +local jid_split = require 'util.jid'.split; +local jid_bare = require 'util.jid'.bare; +local filters = require 'util.filters'; +local st = require 'util.stanza'; +local MUC_NS = 'http://jabber.org/protocol/muc'; + +local is_healthcheck_room = module:require "util".is_healthcheck_room; + +local main_muc_component_config = module:get_option_string('main_muc'); +if main_muc_component_config == nil then + module:log('error', 'lobby not enabled missing main_muc config'); + return ; +end +local lobby_muc_component_config = module:get_option_string('lobby_muc'); +if lobby_muc_component_config == nil then + module:log('error', 'lobby not enabled missing lobby_muc config'); + return ; +end + +local lobby_muc_service; +local main_muc_service; + +-- Checks whether there is self-status 110 of the