Sat, 06 Nov 2021 18:12:22 +0100
clix.moderate: New command to do MUC moderation (XEP-0425)
24
8e157125957d
clix.mirror: Mirror stanzas by switching to/from
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
1 | return function (opts, arg) |
27
5b58c002d6ad
clix.*: Add --short-help and make sure they are working correctly
Matthew Wild <mwild1@gmail.com>
parents:
24
diff
changeset
|
2 | if opts.short_help then |
5b58c002d6ad
clix.*: Add --short-help and make sure they are working correctly
Matthew Wild <mwild1@gmail.com>
parents:
24
diff
changeset
|
3 | print("Echo received stanzas back to sender"); |
5b58c002d6ad
clix.*: Add --short-help and make sure they are working correctly
Matthew Wild <mwild1@gmail.com>
parents:
24
diff
changeset
|
4 | return; |
5b58c002d6ad
clix.*: Add --short-help and make sure they are working correctly
Matthew Wild <mwild1@gmail.com>
parents:
24
diff
changeset
|
5 | end |
24
8e157125957d
clix.mirror: Mirror stanzas by switching to/from
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
6 | local function on_connect(conn) |
8e157125957d
clix.mirror: Mirror stanzas by switching to/from
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
7 | local function on_stanza(stanza) |
8e157125957d
clix.mirror: Mirror stanzas by switching to/from
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
8 | if stanza.name == "presence" and opts.presence |
8e157125957d
clix.mirror: Mirror stanzas by switching to/from
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
9 | and not opts.mirror_presence then |
8e157125957d
clix.mirror: Mirror stanzas by switching to/from
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
10 | return; |
8e157125957d
clix.mirror: Mirror stanzas by switching to/from
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
11 | end |
8e157125957d
clix.mirror: Mirror stanzas by switching to/from
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
12 | stanza.attr.to, stanza.attr.from = stanza.attr.from, stanza.attr.to; |
8e157125957d
clix.mirror: Mirror stanzas by switching to/from
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
13 | conn:send(stanza); |
8e157125957d
clix.mirror: Mirror stanzas by switching to/from
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
14 | stanza.attr.to, stanza.attr.from = stanza.attr.from, stanza.attr.to; |
8e157125957d
clix.mirror: Mirror stanzas by switching to/from
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
15 | end |
8e157125957d
clix.mirror: Mirror stanzas by switching to/from
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
16 | conn:hook("stanza", on_stanza); |
8e157125957d
clix.mirror: Mirror stanzas by switching to/from
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
17 | end |
8e157125957d
clix.mirror: Mirror stanzas by switching to/from
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
18 | return clix_connect(opts, on_connect); |
8e157125957d
clix.mirror: Mirror stanzas by switching to/from
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
19 | end |