clix/receive.lua

Sun, 10 Feb 2013 14:09:20 +0100

author
"Georg Lukas <georg@op-co.de>"
date
Sun, 10 Feb 2013 14:09:20 +0100
changeset 104
16cdeb9cd879
parent 27
5b58c002d6ad
permissions
-rw-r--r--

Add clix module to send XMPP pings to JIDs

Signed-off-by: Georg Lukas <georg@op-co.de>

short_opts.h = "history";

return function (opts, args)
	if opts.short_help then
		print("Receive and display XMPP messages");
		return;
	end
	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