Mercurial > prosody-modules
view mod_muc_moderation_delay/config.lib.lua @ 6319:04c3273cb81f
mod_auth_cyrus: Add empty 'profile' table to SASL handler objects
This is for compatibility with Prosody's built-in util.sasl objects.
A SASL profile table usually includes methods supported by the backend, which
can be used by SASL mechanism handlers to perform operations (such as testing
the password). It also optionally contains a 'cb' field with channel binding
method handlers.
The Cyrus backend doesn't support channel binding, and doesn't have the same
concept of auth backend methods (it handles all that internally, and Prosody
has no insight or control over it).
Thus, we create an empty profile which informs Prosody that the SASL handler
does not support any of the auth or channel binding methods. Some features
will not work, but they didn't work anyway. This just makes it explicit.
This fixes a traceback in mod_sasl2_fast, which expected SASL handlers to
always contain a 'profile' field.
| author | Matthew Wild <mwild1@gmail.com> |
|---|---|
| date | Thu, 04 Sep 2025 10:14:46 +0100 |
| parents | 959382fac20c |
| children |
line wrap: on
line source
-- SPDX-FileCopyrightText: 2024 John Livingston <https://www.john-livingston.fr/> -- SPDX-License-Identifier: AGPL-3.0-only -- Getter/Setter local function get_moderation_delay(room) return room._data.moderation_delay or nil; end local function set_moderation_delay(room, delay) if delay == 0 then delay = nil; end if delay ~= nil then delay = assert(tonumber(delay), "Moderation delay is not a valid number"); if delay < 0 then delay = nil; end end if get_moderation_delay(room) == delay then return false; end room._data.moderation_delay = delay; return true; end -- Discovering support local function add_disco_form(event) table.insert(event.form, { name = "muc#roominfo_moderation_delay"; value = ""; }); event.formdata["muc#roominfo_moderation_delay"] = get_moderation_delay(event.room); end -- Config form declaration local function add_form_option(event) table.insert(event.form, { name = "muc#roomconfig_moderation_delay"; type = "text-single"; datatype = "xs:integer"; range_min = 0; range_max = 60; -- do not allow too big values, it does not make sense. label = "Moderation delay (0=disabled, any positive integer= messages will be delayed for X seconds for non-moderator participants.)"; -- desc = ""; value = get_moderation_delay(event.room); }); end local function config_submitted(event) set_moderation_delay(event.room, event.value); -- no need to 104 status, this feature is invisible for regular participants. end return { set_moderation_delay = set_moderation_delay; get_moderation_delay = get_moderation_delay; add_disco_form = add_disco_form; add_form_option = add_form_option; config_submitted = config_submitted; }
