Thu, 07 Jan 2010 02:31:18 +0000
clix.receive: New command to print text of received messages
clix/receive.lua | file | annotate | diff | comparison | revisions |
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/clix/receive.lua Thu Jan 07 02:31:18 2010 +0000 @@ -0,0 +1,13 @@ +return function (opts, args) + local function on_message(message) + local body = message:get_child("body"); + if body then + print(body:get_text()); + end + end + local function on_connect(conn) + conn:hook("message", on_message); + conn:send(verse.presence()); + end + clix_connect(opts, on_connect); +end