Software / code / prosody
Comparison
plugins/mod_uptime.lua @ 236:eb4ac201aad2
Merge from waqas
| author | Matthew Wild <mwild1@gmail.com> |
|---|---|
| date | Sun, 09 Nov 2008 21:48:01 +0000 |
| parent | 235:6526df1a7277 |
| child | 314:851f271d25b0 |
comparison
equal
deleted
inserted
replaced
| 233:23585c323daa | 236:eb4ac201aad2 |
|---|---|
| 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 |