# HG changeset patch # User Matthew Wild # Date 1368997794 -3600 # Node ID 0fc9e1f086c1a116715bf09c448f4b4b6f17a510 # Parent ed7431fd3b47100ce9744412877ae0d8775a78bd mod_broadcast: Allow admins to broadcast diff -r ed7431fd3b47 -r 0fc9e1f086c1 mod_broadcast/mod_broadcast.lua --- a/mod_broadcast/mod_broadcast.lua Sat May 18 15:31:14 2013 +0100 +++ b/mod_broadcast/mod_broadcast.lua Sun May 19 22:09:54 2013 +0100 @@ -1,3 +1,4 @@ +local is_admin = require "core.usermanager".is_admin; local allowed_senders = module:get_option_set("broadcast_senders", {}); local jid_bare = require "util.jid".bare; @@ -18,12 +19,13 @@ function send_message(event) local stanza = event.stanza; - if allowed_senders:contains(jid_bare(stanza.attr.from)) then + local from = stanza.attr.from; + if is_admin(from) or allowed_senders:contains(jid_bare(from)) then local c = send_to_online(stanza); - module:log("debug", "Broadcast stanza from %s to %d online users", stanza.attr.from, c); + module:log("debug", "Broadcast stanza from %s to %d online users", from, c); return true; else - module:log("warn", "Broadcasting is not allowed for %s", stanza.attr.from); + module:log("warn", "Broadcasting is not allowed for %s", from); end end