view mod_muc_restrict_avatars/mod_muc_restrict_avatars.lua @ 5694:8afa0fb8a73e

mod_client_management: Report on longest lived token when grant does not expire E.g. for mod_http_oauth2 where by default the grant itself is unlimited, while refresh tokens are issued with one week lifetime, but are renewed with each use.
author Kim Alvefur <zash@zash.se>
date Fri, 10 Nov 2023 00:26:17 +0100
parents 2c69577b28c2
children 66e7d46b1d4b
line wrap: on
line source

local bare_jid = require"util.jid".bare;
local mod_muc = module:depends("muc");

local function filter_avatar_advertisement(tag)
	if tag.attr.xmlns == "vcard-temp:x:update" then
		return nil;
	end

	return tag;
end

module:hook("presence/full", function(event)
	local stanza = event.stanza;
	local room = mod_muc.get_room_from_jid(bare_jid(stanza.attr.to));

	if not room:get_affiliation(stanza.attr.from) then
		stanza:maptags(filter_avatar_advertisement);
	end
end, 1);