clix/receive.lua

Thu, 07 Jan 2010 20:56:18 +0000

author
Matthew Wild <mwild1@gmail.com>
date
Thu, 07 Jan 2010 20:56:18 +0000
changeset 17
fa9efbef8a0c
parent 12
1793fca3d707
child 22
19c5a66837ed
permissions
-rw-r--r--

Move presence sending into clix_connect(), and control with -o/--presence

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 end
1793fca3d707 clix.receive: New command to print text of received messages
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
11 clix_connect(opts, on_connect);
1793fca3d707 clix.receive: New command to print text of received messages
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
12 end

mercurial