X-Git-Url: https://git.enpas.org/?a=blobdiff_plain;f=plugins%2Fmod_uptime.lua;h=45a83824f5421717fa0631a25fc00279a4e0d962;hb=37bb197d13c606a5de9ede4c7cd32f77f0398eb1;hp=9c2cb45da70bac21c9afd312caf2064ba98cd445;hpb=b9c54461bf031f807fa67f9730a3f1e04eb052a0;p=prosody.git diff --git a/plugins/mod_uptime.lua b/plugins/mod_uptime.lua index 9c2cb45d..45a83824 100644 --- a/plugins/mod_uptime.lua +++ b/plugins/mod_uptime.lua @@ -1,24 +1,33 @@ - -local st = require "util.stanza" - -local jid_split = require "util.jid".split; -local t_concat = table.concat; - -local start_time = os.time(); - -require "core.discomanager".set("uptime", "jabber:iq:last"); - -add_iq_handler({"c2s", "s2sin"}, "jabber:iq:last", - function (origin, stanza) - if stanza.tags[1].name == "query" then - if stanza.attr.type == "get" then - local node, host, resource = jid_split(stanza.attr.to); - if node or resource then - -- TODO - else - origin.send(st.reply(stanza):tag("query", {xmlns = "jabber:iq:last", seconds = tostring(os.difftime(os.time(), start_time))})); - return true; - end - end - end - end); +-- Prosody IM v0.4 +-- Copyright (C) 2008-2009 Matthew Wild +-- Copyright (C) 2008-2009 Waqas Hussain +-- +-- This project is MIT/X11 licensed. Please see the +-- COPYING file in the source package for more information. +-- + + + +local st = require "util.stanza" + +local jid_split = require "util.jid".split; +local t_concat = table.concat; + +local start_time = prosody.start_time; + +module:add_feature("jabber:iq:last"); + +module:add_iq_handler({"c2s", "s2sin"}, "jabber:iq:last", + function (origin, stanza) + if stanza.tags[1].name == "query" then + if stanza.attr.type == "get" then + local node, host, resource = jid_split(stanza.attr.to); + if node or resource then + -- TODO + else + origin.send(st.reply(stanza):tag("query", {xmlns = "jabber:iq:last", seconds = tostring(os.difftime(os.time(), start_time))})); + return true; + end + end + end + end);