Changeset

9226:affd84be3fc3

mod_uptime: Simplify iq handling by hooking on iq-get/ instead of iq/.
author Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
date Fri, 24 Aug 2018 20:35:17 +0200
parents 9225:0ba963e82ac7
children 9227:c0e058633d9a
files plugins/mod_uptime.lua
diffstat 1 files changed, 3 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/plugins/mod_uptime.lua	Fri Aug 24 20:35:03 2018 +0200
+++ b/plugins/mod_uptime.lua	Fri Aug 24 20:35:17 2018 +0200
@@ -14,12 +14,10 @@
 -- XEP-0012: Last activity
 module:add_feature("jabber:iq:last");
 
-module:hook("iq/host/jabber:iq:last:query", function(event)
+module:hook("iq-get/host/jabber:iq:last:query", function(event)
 	local origin, stanza = event.origin, event.stanza;
-	if stanza.attr.type == "get" then
-		origin.send(st.reply(stanza):tag("query", {xmlns = "jabber:iq:last", seconds = tostring(os.difftime(os.time(), start_time))}));
-		return true;
-	end
+	origin.send(st.reply(stanza):tag("query", {xmlns = "jabber:iq:last", seconds = tostring(os.difftime(os.time(), start_time))}));
+	return true;
 end);
 
 -- Ad-hoc command