Software /
code /
prosody-modules
File
mod_admin_notify/mod_admin_notify.lua @ 5141:027fb71ad509
Remove reverse dependencies on mod_invites (for plugin installer)
Since mod_invites is included with Prosody 0.12, the same version which
includes the plugin installer, there should be no need to depend on in.
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Tue, 10 Jan 2023 20:49:17 +0100 |
parent | 4274:44e18454e1e0 |
line wrap: on
line source
local it = require "util.iterators"; local jid = require "util.jid"; local set = require "util.set"; local st = require "util.stanza"; local roles_store = module:open_store("roles", "map"); local config_admins = module:get_option_inherited_set("admins", {}) / jid.prep; local function append_host(username) return username.."@"..module.host; end local function get_admins() local role_admins = roles_store:get_all("prosody:admin") or {}; local admins = config_admins + (set.new(it.to_array(it.keys(role_admins))) / append_host); return admins; end function notify(text) --luacheck: ignore 131/notify local base_msg = st.message({ from = module.host }) :text_tag("body", text); for admin_jid in get_admins() do local msg = st.clone(base_msg); msg.attr.to = admin_jid; module:send(msg); end end