Skip to content

Instantly share code, notes, and snippets.

@zeen
Created November 6, 2010 11:40
Show Gist options
  • Select an option

  • Save zeen/665352 to your computer and use it in GitHub Desktop.

Select an option

Save zeen/665352 to your computer and use it in GitHub Desktop.
Messages sent to room bare JIDs by room owners get broadcasted
-- mod_muc_broadcast.lua
local jid_bare = require "util.jid".bare;
local st = require "util.stanza";
module:hook("message/bare", function(event)
local stanza = event.stanza;
if stanza.attr.type == "chat" or stanza.attr.type == "normal" or not stanza.attr.type then
local from = jid_bare(stanza.attr.from);
local to = stanza.attr.to;
local room = hosts[module.host].muc.rooms[to];
if room then
if room:get_affiliation(from) == "owner" then
local clone = st.clone(stanza);
clone.attr.type = "groupchat";
clone.attr.from = to;
room:broadcast_message(clone, true);
return true;
end
end
end
end, 100);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment