Software /
code /
clix
Changeset
12:1793fca3d707
clix.receive: New command to print text of received messages
author | Matthew Wild <mwild1@gmail.com> |
---|---|
date | Thu, 07 Jan 2010 02:31:18 +0000 |
parents | 11:a502c905527c |
children | 13:751db005032e |
files | clix/receive.lua |
diffstat | 1 files changed, 13 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- /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