clix/mirror.lua

Thu, 07 Jan 2010 22:25:28 +0000

author
Matthew Wild <mwild1@gmail.com>
date
Thu, 07 Jan 2010 22:25:28 +0000
changeset 25
db6e92989c41
parent 24
8e157125957d
child 27
5b58c002d6ad
permissions
-rw-r--r--

clix.bounce: Bounce stanzas from all or certain JIDs to another JID (which may be a chatroom)

return function (opts, arg)
	local function on_connect(conn)
		local function on_stanza(stanza)
			if stanza.name == "presence" and opts.presence
				and not opts.mirror_presence then
				return;
			end
			stanza.attr.to, stanza.attr.from = stanza.attr.from, stanza.attr.to;
			conn:send(stanza);
			stanza.attr.to, stanza.attr.from = stanza.attr.from, stanza.attr.to;
		end
		conn:hook("stanza", on_stanza);
	end
	return clix_connect(opts, on_connect);
end

mercurial