From 5d94b20a6267a2517d47b86af3063115b8b34425 Mon Sep 17 00:00:00 2001 From: Matthew Wild Date: Wed, 1 Aug 2018 10:26:08 +0100 Subject: mod_csi: Imported from prosody-modules 66b3085ecc49 --- plugins/mod_csi.lua | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 plugins/mod_csi.lua 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")); + -- cgit v1.2.3