Software / code / prosody
Comparison
plugins/mod_uptime.lua @ 279:76bad8b64018
Merging.
| author | Tobias Markmann <tm@ayena.de> |
|---|---|
| date | Mon, 10 Nov 2008 16:29:19 +0100 |
| parent | 235:6526df1a7277 |
| child | 314:851f271d25b0 |
comparison
equal
deleted
inserted
replaced
| 278:770a78cd38d7 | 279:76bad8b64018 |
|---|---|
| 1 | |
| 2 local st = require "util.stanza" | |
| 3 local send = require "core.sessionmanager".send_to_session | |
| 4 | |
| 5 local jid_split = require "util.jid".split; | |
| 6 local t_concat = table.concat; | |
| 7 | |
| 8 local start_time = os.time(); | |
| 9 | |
| 10 add_iq_handler({"c2s", "s2sin"}, "jabber:iq:last", | |
| 11 function (origin, stanza) | |
| 12 if stanza.tags[1].name == "query" then | |
| 13 if stanza.attr.type == "get" then | |
| 14 local node, host, resource = jid_split(stanza.attr.to); | |
| 15 if node or resource then | |
| 16 -- TODO | |
| 17 else | |
| 18 origin.send(st.reply(stanza):tag("query", {xmlns = "jabber:iq:last", seconds = tostring(os.difftime(os.time(), start_time))})); | |
| 19 return true; | |
| 20 end | |
| 21 end | |
| 22 end | |
| 23 end); | |
| 24 | |
| 25 |