| 1 | return function (opts, arg) |
| 2 | if opts.short_help then |
| 3 | print("Echo received stanzas back to sender"); |
| 4 | return; |
| 5 | end |
| 6 | local function on_connect(conn) |
| 7 | local function on_stanza(stanza) |
| 8 | if stanza.name == "presence" and opts.presence |
| 9 | and not opts.mirror_presence then |
| 10 | return; |
| 11 | end |
| 12 | stanza.attr.to, stanza.attr.from = stanza.attr.from, stanza.attr.to; |
| 13 | conn:send(stanza); |
| 14 | stanza.attr.to, stanza.attr.from = stanza.attr.from, stanza.attr.to; |
| 15 | end |
| 16 | conn:hook("stanza", on_stanza); |
| 17 | end |
| 18 | return clix_connect(opts, on_connect); |
| 19 | end |