Slow mode WIP (#192):
* default delay is configurable in channel's chat rooms options.
This commit is contained in:
@ -1,8 +1,13 @@
|
||||
-- Copyright (C) 2021 Kim Alvefur
|
||||
-- Copyright (C) 2024 John Livingston
|
||||
--
|
||||
-- This file is MIT licensed. Please see the
|
||||
-- COPYING file in the source package for more information.
|
||||
--
|
||||
-- This version contains a modification to take into account new config option "slow_mode_delay".
|
||||
-- This option is introduced in the Peertube livechat plugin, by mod_muc_slow_mode.
|
||||
-- There will be a XEP proposal. When done, these modifications will be submitted to the mod_muc_http_defaults maintainer.
|
||||
--
|
||||
|
||||
local http = require "net.http";
|
||||
local async = require "util.async";
|
||||
@ -104,6 +109,11 @@ local function apply_config(room, settings)
|
||||
|
||||
-- mod_muc_mam
|
||||
if type(config.archiving) == "boolean" then room._config.archiving = config.archiving; end
|
||||
|
||||
-- specific to peertube-plugin-livechat:
|
||||
if (type(config.slow_mode_delay) == "number") and config.slow_mode_delay >= 0 then
|
||||
room._data.slow_mode_delay = config.slow_mode_delay;
|
||||
end
|
||||
elseif config ~= nil then
|
||||
module:log("error", "Invalid config returned from API for %s: %q", room.jid, config);
|
||||
return nil, "format", { field = "config" };
|
||||
|
Reference in New Issue
Block a user