| 1 | short_opts.h = "history"; |
| 2 | |
| 3 | return function (opts, args) |
| 4 | if opts.short_help then |
| 5 | print("Receive and display XMPP messages"); |
| 6 | return; |
| 7 | end |
| 8 | local function on_message(message) |
| 9 | local body = message:get_child("body"); |
| 10 | local delay = message:get_child("delay", "urn:xmpp:delay"); |
| 11 | if body and (not delay or opts.history) then |
| 12 | print(body:get_text()); |
| 13 | end |
| 14 | end |
| 15 | local function on_connect(conn) |
| 16 | conn:hook("message", on_message); |
| 17 | end |
| 18 | clix_connect(opts, on_connect); |
| 19 | end |