plugins/invited.lua

Mon, 06 Dec 2021 11:26:37 +0000

author
Matthew Wild <mwild1@gmail.com>
date
Mon, 06 Dec 2021 11:26:37 +0000
changeset 166
95b668d73ff9
parent 82
ec22d6deb6c0
permissions
-rw-r--r--

rtbl_admin: Fix reason string (abuse is defined to be the most generic)

Would be nice to support reasons in the future (and text annotations)

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