Software /
code /
prosody-modules
Comparison
mod_uptime_presence/mod_uptime_presence.lua @ 917:d3497b81a3b5
mod_uptime_presence: Initial commit. Indicates uptime by replying to probes with delay-stamped presence.
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Tue, 26 Feb 2013 16:11:20 +0100 |
comparison
equal
deleted
inserted
replaced
916:9c5573b389c0 | 917:d3497b81a3b5 |
---|---|
1 local st = require"util.stanza"; | |
2 local datetime = require"util.datetime"; | |
3 | |
4 local presence = st.presence({ from = module.host }) | |
5 :tag("delay", { xmlns = "urn:xmpp:delay", | |
6 stamp = datetime.datetime(prosody.start_time) }); | |
7 | |
8 module:hook("presence/host", function(event) | |
9 local stanza = event.stanza; | |
10 if stanza.attr.type == "probe" then | |
11 presence.attr.id = stanza.attr.id; | |
12 presence.attr.to = stanza.attr.from; | |
13 module:send(presence); | |
14 return true; | |
15 end | |
16 end, 10); | |
17 |