Skip to content

Instantly share code, notes, and snippets.

@zeen
Created August 7, 2009 09:23
Show Gist options
  • Save zeen/163809 to your computer and use it in GitHub Desktop.
Save zeen/163809 to your computer and use it in GitHub Desktop.
-- this module is global
module.host = "*";
-- list of hosts on which to add the component
local hosts = {
["example.com"] = true;
["myhost.com"] = true;
};
-- the jid of the component
local components = {
["muc.server.com"] = true;
["conference.jabber.org"] = true;
}
-- code doing the adding
local unloaded;
require "core.discomanager".addDiscoItemsHandler("*host", function(reply, to, from, node)
if not unloaded and #node == 0 and hosts[to] then
for jid in pairs(components) do
reply:tag("item", {jid = jid}):up();
end
return true;
end
end);
module.unload = function()
unloaded = true;
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment