Software /
code /
clix
Changeset
24:8e157125957d
clix.mirror: Mirror stanzas by switching to/from
author | Matthew Wild <mwild1@gmail.com> |
---|---|
date | Thu, 07 Jan 2010 22:05:57 +0000 |
parents | 23:c5f04bdc7c64 |
children | 25:db6e92989c41 |
files | clix/mirror.lua |
diffstat | 1 files changed, 15 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/clix/mirror.lua Thu Jan 07 22:05:57 2010 +0000 @@ -0,0 +1,15 @@ +return function (opts, arg) + local function on_connect(conn) + local function on_stanza(stanza) + if stanza.name == "presence" and opts.presence + and not opts.mirror_presence then + return; + end + stanza.attr.to, stanza.attr.from = stanza.attr.from, stanza.attr.to; + conn:send(stanza); + stanza.attr.to, stanza.attr.from = stanza.attr.from, stanza.attr.to; + end + conn:hook("stanza", on_stanza); + end + return clix_connect(opts, on_connect); +end