clix/receive.lua

Thu, 07 Jan 2010 21:24:47 +0000

author
Matthew Wild <mwild1@gmail.com>
date
Thu, 07 Jan 2010 21:24:47 +0000
changeset 22
19c5a66837ed
parent 17
fa9efbef8a0c
child 27
5b58c002d6ad
permissions
-rw-r--r--

clix.receive: Suppress history from chatrooms unless -h/--history is supplied

short_opts.h = "history";

return function (opts, args)
	local function on_message(message)
		local body = message:get_child("body");
		local delay = message:get_child("delay", "urn:xmpp:delay");
		if body and (not delay or opts.history) then
			print(body:get_text());
		end
	end
	local function on_connect(conn)
		conn:hook("message", on_message);
	end
	clix_connect(opts, on_connect);
end

mercurial