Mercurial > prosody-modules
annotate mod_uptime_presence/mod_uptime_presence.lua @ 5511:0860497152af
mod_http_oauth2: Record hash of client_id to allow future verification
RFC 6819 section 5.2.2.2 states that refresh tokens MUST be bound to the
client. In order to do that, we must record something that can
definitely tie the client to the grant. Since the full client_id is so
large (why we have this client_subset function), a hash is stored
instead.
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Fri, 02 Jun 2023 10:14:16 +0200 |
parents | d3497b81a3b5 |
children |
rev | line source |
---|---|
917
d3497b81a3b5
mod_uptime_presence: Initial commit. Indicates uptime by replying to probes with delay-stamped presence.
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
1 local st = require"util.stanza"; |
d3497b81a3b5
mod_uptime_presence: Initial commit. Indicates uptime by replying to probes with delay-stamped presence.
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
2 local datetime = require"util.datetime"; |
d3497b81a3b5
mod_uptime_presence: Initial commit. Indicates uptime by replying to probes with delay-stamped presence.
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
3 |
d3497b81a3b5
mod_uptime_presence: Initial commit. Indicates uptime by replying to probes with delay-stamped presence.
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
4 local presence = st.presence({ from = module.host }) |
d3497b81a3b5
mod_uptime_presence: Initial commit. Indicates uptime by replying to probes with delay-stamped presence.
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
5 :tag("delay", { xmlns = "urn:xmpp:delay", |
d3497b81a3b5
mod_uptime_presence: Initial commit. Indicates uptime by replying to probes with delay-stamped presence.
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
6 stamp = datetime.datetime(prosody.start_time) }); |
d3497b81a3b5
mod_uptime_presence: Initial commit. Indicates uptime by replying to probes with delay-stamped presence.
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
7 |
d3497b81a3b5
mod_uptime_presence: Initial commit. Indicates uptime by replying to probes with delay-stamped presence.
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
8 module:hook("presence/host", function(event) |
d3497b81a3b5
mod_uptime_presence: Initial commit. Indicates uptime by replying to probes with delay-stamped presence.
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
9 local stanza = event.stanza; |
d3497b81a3b5
mod_uptime_presence: Initial commit. Indicates uptime by replying to probes with delay-stamped presence.
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
10 if stanza.attr.type == "probe" then |
d3497b81a3b5
mod_uptime_presence: Initial commit. Indicates uptime by replying to probes with delay-stamped presence.
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
11 presence.attr.id = stanza.attr.id; |
d3497b81a3b5
mod_uptime_presence: Initial commit. Indicates uptime by replying to probes with delay-stamped presence.
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
12 presence.attr.to = stanza.attr.from; |
d3497b81a3b5
mod_uptime_presence: Initial commit. Indicates uptime by replying to probes with delay-stamped presence.
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
13 module:send(presence); |
d3497b81a3b5
mod_uptime_presence: Initial commit. Indicates uptime by replying to probes with delay-stamped presence.
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
14 return true; |
d3497b81a3b5
mod_uptime_presence: Initial commit. Indicates uptime by replying to probes with delay-stamped presence.
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
15 end |
d3497b81a3b5
mod_uptime_presence: Initial commit. Indicates uptime by replying to probes with delay-stamped presence.
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
16 end, 10); |
d3497b81a3b5
mod_uptime_presence: Initial commit. Indicates uptime by replying to probes with delay-stamped presence.
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
17 |