# HG changeset patch # User Matthew Wild # Date 1368998754 -3600 # Node ID 9f7c97e55593a1237b2b502f3299d5ae58bb55b3 # Parent 0fc9e1f086c1a116715bf09c448f4b4b6f17a510 mod_broadcast: Allow overriding from address on the broadcast stanza diff -r 0fc9e1f086c1 -r 9f7c97e55593 mod_broadcast/mod_broadcast.lua --- a/mod_broadcast/mod_broadcast.lua Sun May 19 22:09:54 2013 +0100 +++ b/mod_broadcast/mod_broadcast.lua Sun May 19 22:25:54 2013 +0100 @@ -1,5 +1,6 @@ local is_admin = require "core.usermanager".is_admin; local allowed_senders = module:get_option_set("broadcast_senders", {}); +local from_address = module:get_option_string("broadcast_from"); local jid_bare = require "util.jid".bare; @@ -21,6 +22,10 @@ local stanza = event.stanza; local from = stanza.attr.from; if is_admin(from) or allowed_senders:contains(jid_bare(from)) then + if from_address then + stanza = st.clone(stanza); + stanza.attr.from = from_address; + end local c = send_to_online(stanza); module:log("debug", "Broadcast stanza from %s to %d online users", from, c); return true;