diff options
author | Matthew Wild <mwild1@gmail.com> | 2018-08-01 10:26:08 +0100 |
---|---|---|
committer | Matthew Wild <mwild1@gmail.com> | 2018-08-01 10:26:08 +0100 |
commit | 59d4df69c63b216bbe96386cb36bc80d784d6bb2 (patch) | |
tree | 95329315752ec2800d49e145834556fadf9731ab | |
parent | 835fc62e2905fe9643394e455821cac06eddde69 (diff) | |
download | prosody-59d4df69c63b216bbe96386cb36bc80d784d6bb2.tar.gz prosody-59d4df69c63b216bbe96386cb36bc80d784d6bb2.zip |
mod_csi: Imported from prosody-modules 66b3085ecc49
-rw-r--r-- | plugins/mod_csi.lua | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/plugins/mod_csi.lua b/plugins/mod_csi.lua new file mode 100644 index 00000000..03f052b7 --- /dev/null +++ b/plugins/mod_csi.lua @@ -0,0 +1,22 @@ +local st = require "util.stanza"; +local xmlns_csi = "urn:xmpp:csi:0"; +local csi_feature = st.stanza("csi", { xmlns = xmlns_csi }); + +module:hook("stream-features", function (event) + if event.origin.username then + event.features:add_child(csi_feature); + end +end); + +function refire_event(name) + return function (event) + if event.origin.username then + module:fire_event(name, event); + return true; + end + end; +end + +module:hook("stanza/"..xmlns_csi..":active", refire_event("csi-client-active")); +module:hook("stanza/"..xmlns_csi..":inactive", refire_event("csi-client-inactive")); + |