Thu, 07 Jan 2010 21:24:47 +0000
clix.receive: Suppress history from chatrooms unless -h/--history is supplied
22
19c5a66837ed
clix.receive: Suppress history from chatrooms unless -h/--history is supplied
Matthew Wild <mwild1@gmail.com>
parents:
17
diff
changeset
|
1 | short_opts.h = "history"; |
19c5a66837ed
clix.receive: Suppress history from chatrooms unless -h/--history is supplied
Matthew Wild <mwild1@gmail.com>
parents:
17
diff
changeset
|
2 | |
12
1793fca3d707
clix.receive: New command to print text of received messages
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
3 | return function (opts, args) |
1793fca3d707
clix.receive: New command to print text of received messages
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
4 | local function on_message(message) |
1793fca3d707
clix.receive: New command to print text of received messages
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
5 | local body = message:get_child("body"); |
22
19c5a66837ed
clix.receive: Suppress history from chatrooms unless -h/--history is supplied
Matthew Wild <mwild1@gmail.com>
parents:
17
diff
changeset
|
6 | local delay = message:get_child("delay", "urn:xmpp:delay"); |
19c5a66837ed
clix.receive: Suppress history from chatrooms unless -h/--history is supplied
Matthew Wild <mwild1@gmail.com>
parents:
17
diff
changeset
|
7 | if body and (not delay or opts.history) then |
12
1793fca3d707
clix.receive: New command to print text of received messages
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
8 | print(body:get_text()); |
1793fca3d707
clix.receive: New command to print text of received messages
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
9 | end |
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 | local function on_connect(conn) |
1793fca3d707
clix.receive: New command to print text of received messages
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
12 | conn:hook("message", on_message); |
1793fca3d707
clix.receive: New command to print text of received messages
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
13 | end |
1793fca3d707
clix.receive: New command to print text of received messages
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
14 | clix_connect(opts, on_connect); |
1793fca3d707
clix.receive: New command to print text of received messages
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
15 | end |