clix/mirror.lua

Tue, 12 Jan 2010 02:17:38 +0000

author
Matthew Wild <mwild1@gmail.com>
date
Tue, 12 Jan 2010 02:17:38 +0000
changeset 27
5b58c002d6ad
parent 24
8e157125957d
permissions
-rw-r--r--

clix.*: Add --short-help and make sure they are working correctly

return function (opts, arg)
	if opts.short_help then
		print("Echo received stanzas back to sender");
		return;
	end
	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