File

mod_discoitems/mod_discoitems.lua @ 94:941fd7d8b9b2

mod_muc_log: split into mod_muc_log and mod_muc_log_http mod_muc_log: should be enabled per muc component which should log! mod_muc_log_http: handle /me messages, add previous, next day links to day view, add link to speeqe.com to directly join the room, make the window recalculate the content div size, scrollbars are only shown when needed
author Thilo Cestonaro <thilo@cestona.ro>
date Tue, 17 Nov 2009 21:19:17 +0100
parent 78:ae91c98b7e4c
line wrap: on
line source

-- mod_discoitems.lua
--
-- In the config, you can add:
--
-- disco_items = {
--  {"proxy.eu.jabber.org", "Jabber.org SOCKS5 service"};
--  {"conference.jabber.org", "The Jabber.org MUC"};
-- };
--

local st = require "util.stanza";

local result_query = st.stanza("query", {xmlns="http://jabber.org/protocol/disco#items"});
for _, item in ipairs(module:get_option("disco_items") or {}) do
	result_query:tag("item", {jid=item[1], name=item[2]}):up();
end

module:hook('iq/host/http://jabber.org/protocol/disco#items:query', function(event)
	local stanza = event.stanza;
	local query = stanza.tags[1];
	if stanza.attr.type == 'get' and not query.attr.node then
		event.origin.send(st.reply(stanza):add_child(result_query));
		return true;
	end
end, 100);