Thu, 07 Jan 2010 20:56:18 +0000
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 |