clix/receive.lua

Thu, 07 Jan 2010 02:31:18 +0000

author
Matthew Wild <mwild1@gmail.com>
date
Thu, 07 Jan 2010 02:31:18 +0000
changeset 12
1793fca3d707
child 17
fa9efbef8a0c
permissions
-rw-r--r--

clix.receive: New command to print text of received messages

12
1793fca3d707 clix.receive: New command to print text of received messages
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
1 return function (opts, args)
1793fca3d707 clix.receive: New command to print text of received messages
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
2 local function on_message(message)
1793fca3d707 clix.receive: New command to print text of received messages
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
3 local body = message:get_child("body");
1793fca3d707 clix.receive: New command to print text of received messages
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
4 if body then
1793fca3d707 clix.receive: New command to print text of received messages
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
5 print(body:get_text());
1793fca3d707 clix.receive: New command to print text of received messages
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
6 end
1793fca3d707 clix.receive: New command to print text of received messages
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
7 end
1793fca3d707 clix.receive: New command to print text of received messages
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
8 local function on_connect(conn)
1793fca3d707 clix.receive: New command to print text of received messages
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
9 conn:hook("message", on_message);
1793fca3d707 clix.receive: New command to print text of received messages
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
10 conn:send(verse.presence());
1793fca3d707 clix.receive: New command to print text of received messages
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
11 end
1793fca3d707 clix.receive: New command to print text of received messages
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
12 clix_connect(opts, on_connect);
1793fca3d707 clix.receive: New command to print text of received messages
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
13 end

mercurial