aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthew Wild <mwild1@gmail.com>2018-08-01 10:26:08 +0100
committerMatthew Wild <mwild1@gmail.com>2018-08-01 10:26:08 +0100
commit59d4df69c63b216bbe96386cb36bc80d784d6bb2 (patch)
tree95329315752ec2800d49e145834556fadf9731ab
parent835fc62e2905fe9643394e455821cac06eddde69 (diff)
downloadprosody-59d4df69c63b216bbe96386cb36bc80d784d6bb2.tar.gz
prosody-59d4df69c63b216bbe96386cb36bc80d784d6bb2.zip
mod_csi: Imported from prosody-modules 66b3085ecc49
-rw-r--r--plugins/mod_csi.lua22
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"));
+