clix/receive.lua

Sat, 24 Jun 2023 09:59:07 +0200

author
Kim Alvefur <zash@zash.se>
date
Sat, 24 Jun 2023 09:59:07 +0200
changeset 170
0d561f921c13
parent 27
5b58c002d6ad
permissions
-rw-r--r--

clix.adhoc: Move stanza to dataform converter here

Removes the need for verse to have a custom util.dataforms fork only for
this

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