Slow Mode WIP (#192): option position
This commit is contained in:
parent
9ed689b5f1
commit
afbc78d0e6
@ -5,3 +5,19 @@ This module is a custom module that allows slow mode for MUC rooms.
|
||||
This module is part of peertube-plugin-livechat, and is under the same LICENSE.
|
||||
|
||||
There will probably be a XEP proposal for this module behaviour. When done, this module will be published in the prosody-modules repository.
|
||||
|
||||
## Configuration
|
||||
|
||||
Just enable the module on your MUC component.
|
||||
The feature will be accessible throught the room configuration form.
|
||||
|
||||
Depending on your application, it is possible that the slow mode is more important than other fields (for example for a video streaming service).
|
||||
The position in the room config form can be changed be setting the option `slow_mode_delay_form_position`.
|
||||
This value will be passed as priority for the "muc-config-form" hook.
|
||||
By default, the field will be between muc#roomconfig_changesubject and muc#roomconfig_moderatedroom.
|
||||
|
||||
``` lua
|
||||
VirtualHost "muc.example.com"
|
||||
modules_enabled = { "muc_slow_mode" }
|
||||
slow_mode_delay_form_position = 96
|
||||
```
|
||||
|
@ -22,6 +22,14 @@ local valid_roles = muc_util.valid_roles;
|
||||
-- Namespaces
|
||||
local xmlns_muc = "http://jabber.org/protocol/muc";
|
||||
|
||||
-- Options
|
||||
|
||||
-- form_position: the position in the room config form (this value will be passed as priority for the "muc-config-form" hook).
|
||||
-- Depending on your application, it is possible that the slow mode is more important than other fields (for example for a video streaming service).
|
||||
-- So there is an option to change this.
|
||||
-- By default, field will be between muc#roomconfig_changesubject and muc#roomconfig_moderatedroom
|
||||
local form_position = module:get_option_number("slow_mode_delay_form_position") or 80-2;
|
||||
|
||||
-- Getter/Setter
|
||||
local function get_slow_mode_delay(room)
|
||||
return room._data.slow_mode_delay or 0;
|
||||
@ -68,7 +76,7 @@ module:hook("muc-config-submitted/muc#roomconfig_slow_mode_delay", function(even
|
||||
end
|
||||
end);
|
||||
|
||||
module:hook("muc-config-form", add_form_option, 100-4);
|
||||
module:hook("muc-config-form", add_form_option, form_position);
|
||||
|
||||
-- handling groupchat messages
|
||||
function handle_groupchat(event)
|
||||
|
@ -207,6 +207,7 @@ class ProsodyConfigContent {
|
||||
this.muc.set('muc_room_default_history_length', 20)
|
||||
|
||||
this.muc.add('modules_enabled', 'muc_slow_mode')
|
||||
this.muc.add('slow_mode_delay_form_position', 120)
|
||||
}
|
||||
|
||||
useAnonymous (autoBanIP: boolean): void {
|
||||
|
Loading…
x
Reference in New Issue
Block a user