aboutsummaryrefslogtreecommitdiffstats
path: root/plugins/mod_announce.lua
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/mod_announce.lua')
-rw-r--r--plugins/mod_announce.lua10
1 files changed, 5 insertions, 5 deletions
diff --git a/plugins/mod_announce.lua b/plugins/mod_announce.lua
index c742ebb8..ba62c11b 100644
--- a/plugins/mod_announce.lua
+++ b/plugins/mod_announce.lua
@@ -6,10 +6,9 @@
-- COPYING file in the source package for more information.
--
-local st, jid = require "util.stanza", require "util.jid";
+local st, jid = require "prosody.util.stanza", require "prosody.util.jid";
local hosts = prosody.hosts;
-local is_admin = require "core.usermanager".is_admin;
function send_to_online(message, host)
local sessions;
@@ -34,6 +33,7 @@ function send_to_online(message, host)
return c;
end
+module:default_permission("prosody:admin", ":send-announcement");
-- Old <message>-based jabberd-style announcement sending
function handle_announcement(event)
@@ -45,8 +45,8 @@ function handle_announcement(event)
return; -- Not an announcement
end
- if not is_admin(stanza.attr.from, host) then
- -- Not an admin? Not allowed!
+ if not module:may(":send-announcement", event) then
+ -- Not allowed!
module:log("warn", "Non-admin '%s' tried to send server announcement", stanza.attr.from);
return;
end
@@ -63,7 +63,7 @@ end
module:hook("message/host", handle_announcement);
-- Ad-hoc command (XEP-0133)
-local dataforms_new = require "util.dataforms".new;
+local dataforms_new = require "prosody.util.dataforms".new;
local announce_layout = dataforms_new{
title = "Making an Announcement";
instructions = "Fill out this form to make an announcement to all\nactive users of this service.";