Thu, 07 Jan 2010 22:05:57 +0000
clix.mirror: Mirror stanzas by switching to/from
24
8e157125957d
clix.mirror: Mirror stanzas by switching to/from
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
1 | return function (opts, arg) |
8e157125957d
clix.mirror: Mirror stanzas by switching to/from
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
2 | local function on_connect(conn) |
8e157125957d
clix.mirror: Mirror stanzas by switching to/from
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
3 | local function on_stanza(stanza) |
8e157125957d
clix.mirror: Mirror stanzas by switching to/from
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
4 | if stanza.name == "presence" and opts.presence |
8e157125957d
clix.mirror: Mirror stanzas by switching to/from
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
5 | and not opts.mirror_presence then |
8e157125957d
clix.mirror: Mirror stanzas by switching to/from
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
6 | return; |
8e157125957d
clix.mirror: Mirror stanzas by switching to/from
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
7 | end |
8e157125957d
clix.mirror: Mirror stanzas by switching to/from
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
8 | 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
|
9 | conn:send(stanza); |
8e157125957d
clix.mirror: Mirror stanzas by switching to/from
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
10 | 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
|
11 | end |
8e157125957d
clix.mirror: Mirror stanzas by switching to/from
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
12 | conn:hook("stanza", on_stanza); |
8e157125957d
clix.mirror: Mirror stanzas by switching to/from
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
13 | end |
8e157125957d
clix.mirror: Mirror stanzas by switching to/from
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
14 | return clix_connect(opts, on_connect); |
8e157125957d
clix.mirror: Mirror stanzas by switching to/from
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
15 | end |