comparison mod_watch_spam_reports/mod_watch_spam_reports.lua @ 4663:6e5572fc6840

mod_watch_spam_reports: Support for fetching admins from authz provider
author Matthew Wild <mwild1@gmail.com>
date Thu, 26 Aug 2021 16:52:13 +0100
parents 78ef5d9e2361
children 97d34d520cfa
comparison
equal deleted inserted replaced
4662:a357c3e3bd32 4663:6e5572fc6840
1 local jid = require "util.jid"; 1 local jid = require "util.jid";
2 local set = require "util.set";
2 local st = require "util.stanza"; 3 local st = require "util.stanza";
3 local admins = module:get_option_inherited_set("admins"); 4 local usermanager = require "core.usermanager";
4 local host = module.host; 5 local host = module.host;
6
7 local admins;
8 if usermanager.get_jids_with_role then
9 admins = set.new(usermanager.get_jids_with_role("prosody:admin"), host);
10 else -- COMPAT w/pre-0.12
11 admins = module:get_option_inherited_set("admins");
12 end
5 13
6 module:depends("spam_reporting") 14 module:depends("spam_reporting")
7 15
8 module:hook("spam_reporting/spam-report", function(event) 16 module:hook("spam_reporting/spam-report", function(event)
9 local reporter_bare_jid = jid.bare(event.stanza.attr.from) 17 local reporter_bare_jid = jid.bare(event.stanza.attr.from)