Comparison

mod_csi/mod_csi.lua @ 1483:90fe03e65d2c

mod_csi: Client State Indication support
author Matthew Wild <mwild1@gmail.com>
date Fri, 15 Aug 2014 16:34:10 +0100
child 1590:fbb4cd2922a1
comparison
equal deleted inserted replaced
1482:25be5fde250f 1483:90fe03e65d2c
1 local st = require "util.stanza";
2 local csi_feature = st.stanza("csi", { xmlns = "urn:xmpp:csi" });
3
4 module:hook("stream-features", function (event)
5 if event.origin.username then
6 event.features:add_child(csi_feature);
7 end
8 end);
9
10 function refire_event(name)
11 return function (event)
12 if event.origin.username then
13 module:fire_event(name, event);
14 return true;
15 end
16 end;
17
18 end
19
20 module:hook("stanza/urn:xmpp:csi:active", refire_event("csi-client-active"));
21 module:hook("stanza/urn:xmpp:csi:inactive", refire_event("csi-client-inactive"));
22