plugins/invited.lua

Tue, 12 Jul 2011 15:39:25 +0200

author
Kim Alvefur <zash@zash.se>
date
Tue, 12 Jul 2011 15:39:25 +0200
changeset 82
ec22d6deb6c0
parent 38
e1479af7ec9a
permissions
-rw-r--r--

plugins.invited: Move xmlns-es to variables.

local xmlns_muc = "http://jabber.org/protocol/muc";
local xmlns_muc_user = xmlns_muc .. "#user";
local xmlns_jxc = "jabber:x:conference";

function riddim.plugins.invited(bot)
	bot:hook("message", function(event)
		local x = event.stanza:get_child("x", xmlns_muc_user);
		if x then -- XEP 45
			local invite = x:get_child("invite");
			if invite then
				bot:join_room(event.stanza.attr.from);
			end
		else -- try XEP 249
			x = event.stanza:get_child("x", xmlns_jxc);
			if x and x.attr.jid then
				bot:join_room(x.attr.jid);
			end
		end
	end);
end
--TODO
-- Passwords

mercurial