Software / code / prosody
Comparison
plugins/mod_lastactivity.lua @ 6302:76699a0ae4c4
mod_lastactivity, mod_legacyauth, mod_presence, mod_saslauth, mod_tls: Use the newer stanza:get_child APIs and optimize away some table lookups
| author | Kim Alvefur <zash@zash.se> |
|---|---|
| date | Fri, 04 Jul 2014 22:52:34 +0200 |
| parent | 5776:bd0ff8ae98a8 |
| child | 9224:a84dbd2e08bc |
comparison
equal
deleted
inserted
replaced
| 6301:2fdd71b08126 | 6302:76699a0ae4c4 |
|---|---|
| 17 | 17 |
| 18 module:hook("pre-presence/bare", function(event) | 18 module:hook("pre-presence/bare", function(event) |
| 19 local stanza = event.stanza; | 19 local stanza = event.stanza; |
| 20 if not(stanza.attr.to) and stanza.attr.type == "unavailable" then | 20 if not(stanza.attr.to) and stanza.attr.type == "unavailable" then |
| 21 local t = os.time(); | 21 local t = os.time(); |
| 22 local s = stanza:child_with_name("status"); | 22 local s = stanza:get_child_text("status"); |
| 23 s = s and #s.tags == 0 and s[1] or ""; | |
| 24 map[event.origin.username] = {s = s, t = t}; | 23 map[event.origin.username] = {s = s, t = t}; |
| 25 end | 24 end |
| 26 end, 10); | 25 end, 10); |
| 27 | 26 |
| 28 module:hook("iq/bare/jabber:iq:last:query", function(event) | 27 module:hook("iq/bare/jabber:iq:last:query", function(event) |