Mercurial > prosody-modules
view mod_muc_config_restrict/mod_muc_config_restrict.lua @ 3656:3e0f4d727825
mod_vcard_muc: Add an alternative method of signaling avatar change
When the avatar has been changed, a signal is sent that the room
configuration has changed. Clients then do a disco#info query to find
the SHA-1 of the new avatar. They can then fetch it as before, or not if
they have it cached already.
This is meant to be less disruptive than signaling via presence, which
caused problems for some clients.
If clients transition to the new method, the old one can eventually be removed.
The namespace is made up while waiting for standardization.
Otherwise it is very close to what's described in
https://xmpp.org/extensions/inbox/muc-avatars.html
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Sun, 25 Aug 2019 20:46:43 +0200 |
parents | ed7431fd3b47 |
children |
line wrap: on
line source
local is_admin = require "core.usermanager".is_admin; local t_remove = table.remove; local restricted_options = module:get_option_set("muc_config_restricted", {})._items; function handle_config_submit(event) local stanza = event.stanza; if is_admin(stanza.attr.from, module.host) then return; end -- Don't restrict admins local fields = event.fields; for option in restricted_options do fields[option] = nil; -- Like it was never there end end function handle_config_request(event) if is_admin(event.actor, module.host) then return; end -- Don't restrict admins local form = event.form; for i = #form, 1, -1 do if restricted_options[form[i].name] then t_remove(form, i); end end end module:hook("muc-config-submitted", handle_config_submit); module:hook("muc-config-form", handle_config_request);