1 local st = require "util.stanza";
4 -- Make sure we only load this module when CSI itself is deployed
8 local function on_presence(event)
9 if not event.origin.username then
13 local child = event.stanza:get_child("show");
15 if child and child:get_text() == "away" then
16 module:log("debug", "User is now away, simulating CSI.");
17 module:fire_event("csi-client-inactive", event);
19 module:log("debug", "User is no longer away, ending simulated CSI.");
20 module:fire_event("csi-client-active", event);
26 module:hook("pre-presence/bare", on_presence);
27 module:hook("pre-presence/full", on_presence);
28 module:hook("pre-presence/host", on_presence);