Mercurial > prosody-hg
comparison plugins/mod_lastactivity.lua @ 2025:dab1693f8a08
mod_lastactivity: Allow users to request their own last activity.
| author | Waqas Hussain <waqas20@gmail.com> |
|---|---|
| date | Wed, 21 Oct 2009 01:01:46 +0500 |
| parents | 418c04834017 |
| children | 97b17187b29d |
comparison
equal
deleted
inserted
replaced
| 2024:46a9c7c99476 | 2025:dab1693f8a08 |
|---|---|
| 27 | 27 |
| 28 module:hook("iq/bare/jabber:iq:last:query", function(event) | 28 module:hook("iq/bare/jabber:iq:last:query", function(event) |
| 29 local origin, stanza = event.origin, event.stanza; | 29 local origin, stanza = event.origin, event.stanza; |
| 30 if stanza.attr.type == "get" then | 30 if stanza.attr.type == "get" then |
| 31 local username = jid_split(stanza.attr.to) or origin.username; | 31 local username = jid_split(stanza.attr.to) or origin.username; |
| 32 if is_contact_subscribed(username, module.host, jid_bare(stanza.attr.from)) then | 32 if not stanza.attr.to or is_contact_subscribed(username, module.host, jid_bare(stanza.attr.from)) then |
| 33 local seconds, text = "0", ""; | 33 local seconds, text = "0", ""; |
| 34 if map[username] then | 34 if map[username] then |
| 35 seconds = tostring(os.difftime(os.time(), map[username].t)); | 35 seconds = tostring(os.difftime(os.time(), map[username].t)); |
| 36 text = map[username].s; | 36 text = map[username].s; |
| 37 end | 37 end |
