# HG changeset patch # User Menel # Date 1776333738 -7200 # Node ID 3d14a407307d54632bbfcaa9c7fa97371fdb9905 # Parent 3b69df385f66b68b06119cebc6ca1f80e80edc6e mod_muc_restrict_attention: Add default option for participants. Breaking change config option name. diff -r 3b69df385f66 -r 3d14a407307d mod_muc_restrict_attention/README.md --- a/mod_muc_restrict_attention/README.md Wed Apr 08 23:12:13 2026 +0200 +++ b/mod_muc_restrict_attention/README.md Thu Apr 16 12:02:18 2026 +0200 @@ -1,17 +1,14 @@ --- -summary: Strip XEP-0224 Attention from unaffiliated users in rooms +summary: Strip XEP-0224 Attention from affiliations in rooms labels: - Stage-Beta ... # Introduction -This module strips [XEP-0224 Attention] for certain affiliations in rooms. -It adds a room configuration option to strip it from members, so that only admins and higher can use it. -A default setting for all rooms can be set in the config file. This can be overwritten per room. -With this module loaded, unaffiliated users won't ever be allowed to use *Attention*. - -This can prevent spam and noise in clients that don't have precautions against this in place. +This module can strip [XEP-0224 Attention] for certain affiliations in rooms. +By default it will only allow *Attention* from admins or above. +This can prevent unwanted noise, made with big public channels in mind. # Configuring @@ -26,18 +23,20 @@ ## Settings -A default setting can be provided in the config file, defaults to *true*. -A loglevel can be set (debug, info, warn, error). -Defaults to *debug*: +A default setting for all rooms can be provided in the config file, ("members", "participants", false), defaults to *"members"*. +A loglevel can be set ("debug", "info", "warn", "error"). +Defaults to *"debug"*: ``` {.lua} -muc_restrict_attention_from_members = true +muc_restrict_attention_by_default = "members" muc_restrict_attention_loglevel = "debug" ``` +The module adds a room configuration option to choose the behavior for members, overriding the defaults per room. + # Todo -- Restrict fine tuned, per every affiliation. +- Restrict fine tuned, per every affiliation in the room config with nice dropdown config option. # Compatibility diff -r 3b69df385f66 -r 3d14a407307d mod_muc_restrict_attention/mod_muc_restrict_attention.lua --- a/mod_muc_restrict_attention/mod_muc_restrict_attention.lua Wed Apr 08 23:12:13 2026 +0200 +++ b/mod_muc_restrict_attention/mod_muc_restrict_attention.lua Thu Apr 16 12:02:18 2026 +0200 @@ -3,8 +3,21 @@ local from_affiliation local from_jid local room_jid -local restrict_members_by_default = module:get_option_boolean("muc_restrict_attention_from_members", true) local loglevel = module:get_option_enum("muc_restrict_attention_loglevel", "debug", "info", "warn", "error") +local restrict_by_default = module:get_option_enum("muc_restrict_attention_by_default", "members", "participants", false, "false") + +-- ugly hack, improve it when you do for the room config option too +if restrict_by_default == "members" then + local restrict_members_by_default = true + local restrict_participants_by_default = true +elseif restrict_by_default == false + or restrict_by_default == "false" then + local restrict_members_by_default = false + local restrict_participants_by_default = false +elseif restrict_by_default == "participants" then + local restrict_members_by_default = false + local restrict_participants_by_default = true +end local function should_restrict_members(room) local restrict_members = room._data.restrict_members @@ -69,7 +82,8 @@ return end if should_restrict_members(event.room) - or not from_affiliation then + or restrict_participants_by_default + and not from_affiliation then room_jid = event.room.jid from_jid = event.stanza.attr.from stanza:maptags(filter_attention_tags)