Diff

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
line wrap: on
line diff
--- a/plugins/mod_lastactivity.lua	Fri Jul 04 21:48:25 2014 +0200
+++ b/plugins/mod_lastactivity.lua	Fri Jul 04 22:52:34 2014 +0200
@@ -19,8 +19,7 @@
 	local stanza = event.stanza;
 	if not(stanza.attr.to) and stanza.attr.type == "unavailable" then
 		local t = os.time();
-		local s = stanza:child_with_name("status");
-		s = s and #s.tags == 0 and s[1] or "";
+		local s = stanza:get_child_text("status");
 		map[event.origin.username] = {s = s, t = t};
 	end
 end, 10);