aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEmmanuel Gil Peyrot <linkmauve@linkmauve.fr>2018-08-24 20:35:17 +0200
committerEmmanuel Gil Peyrot <linkmauve@linkmauve.fr>2018-08-24 20:35:17 +0200
commitb7b67000ca6533c88a40a7ce1ded6a476c7a4538 (patch)
treebf823e98447c8a66433eeeea245d3dd56d9eba21
parentdb4ad26aed09da87aff7e310c7ebca53a2346fdb (diff)
downloadprosody-b7b67000ca6533c88a40a7ce1ded6a476c7a4538.tar.gz
prosody-b7b67000ca6533c88a40a7ce1ded6a476c7a4538.zip
mod_uptime: Simplify iq handling by hooking on iq-get/ instead of iq/.
-rw-r--r--plugins/mod_uptime.lua8
1 files changed, 3 insertions, 5 deletions
diff --git a/plugins/mod_uptime.lua b/plugins/mod_uptime.lua
index b018da7b..24985ef1 100644
--- a/plugins/mod_uptime.lua
+++ b/plugins/mod_uptime.lua
@@ -14,12 +14,10 @@ module:hook_global("server-started", function() start_time = prosody.start_time
-- 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