Mercurial > prosody-modules
comparison mod_idlecompat/mod_idlecompat.lua @ 2164:4b58e35a72e0
mod_idlecompat: Reference the correct XEP (256, not 12) and drop a redundant check
| author | Emmanuel Gil Peyrot <linkmauve@linkmauve.fr> |
|---|---|
| date | Sat, 16 Apr 2016 12:48:00 +0100 |
| parents | 4e14ad802d58 |
| children |
comparison
equal
deleted
inserted
replaced
| 2161:95a9f2d234da | 2164:4b58e35a72e0 |
|---|---|
| 1 -- Last User Interaction in Presence via Last Activity compatibility module | 1 -- Last User Interaction in Presence via Last Activity compatibility module |
| 2 -- http://xmpp.org/extensions/xep-0319.html | 2 -- http://xmpp.org/extensions/xep-0319.html |
| 3 -- http://xmpp.org/extensions/xep-0012.html | 3 -- http://xmpp.org/extensions/xep-0256.html |
| 4 -- Copyright (C) 2014 Tobias Markmann | 4 -- Copyright (C) 2014 Tobias Markmann |
| 5 -- | 5 -- |
| 6 -- This file is MIT/X11 licensed. | 6 -- This file is MIT/X11 licensed. |
| 7 | 7 |
| 8 local st = require "util.stanza"; | 8 local st = require "util.stanza"; |
| 9 local datetime = require "util.datetime"; | 9 local datetime = require "util.datetime"; |
| 10 | 10 |
| 11 local function on_presence(event) | 11 local function on_presence(event) |
| 12 local stanza = event.stanza; | 12 local stanza = event.stanza; |
| 13 | 13 |
| 14 local last_activity = stanza.name == "presence" and stanza:get_child("query", "jabber:iq:last") or false; | 14 local last_activity = stanza:get_child("query", "jabber:iq:last"); |
| 15 local has_idle = stanza:get_child("idle", "urn:xmpp:idle:1"); | 15 local has_idle = stanza:get_child("idle", "urn:xmpp:idle:1"); |
| 16 if last_activity and not has_idle then | 16 if last_activity and not has_idle then |
| 17 module:log("debug", "Adding XEP-0319 tag from Last Activity."); | 17 module:log("debug", "Adding XEP-0319 tag from Last Activity."); |
| 18 local seconds = last_activity.attr.seconds; | 18 local seconds = last_activity.attr.seconds; |
| 19 local last_userinteraction = datetime.datetime(os.time() - seconds); | 19 local last_userinteraction = datetime.datetime(os.time() - seconds); |
