Software / code / prosody
Comparison
plugins/mod_time.lua @ 438:193f9dd64f17
Bumper commit for the new modulemanager API \o/ Updates all the modules, though some more changes may be in store.
| author | Matthew Wild <mwild1@gmail.com> |
|---|---|
| date | Thu, 27 Nov 2008 03:12:12 +0000 |
| parent | 424:3eb22492e8ab |
| child | 519:cccd610a0ef9 |
comparison
equal
deleted
inserted
replaced
| 437:c1a720db2157 | 438:193f9dd64f17 |
|---|---|
| 5 | 5 |
| 6 -- XEP-0202: Entity Time | 6 -- XEP-0202: Entity Time |
| 7 | 7 |
| 8 require "core.discomanager".set("time", "urn:xmpp:time"); | 8 require "core.discomanager".set("time", "urn:xmpp:time"); |
| 9 | 9 |
| 10 add_iq_handler({"c2s", "s2sin"}, "urn:xmpp:time", | 10 module:add_iq_handler({"c2s", "s2sin"}, "urn:xmpp:time", |
| 11 function(session, stanza) | 11 function(session, stanza) |
| 12 if stanza.attr.type == "get" then | 12 if stanza.attr.type == "get" then |
| 13 session.send(st.reply(stanza):tag("time", {xmlns="urn:xmpp:time"}) | 13 session.send(st.reply(stanza):tag("time", {xmlns="urn:xmpp:time"}) |
| 14 :tag("tzo"):text("+00:00"):up() -- FIXME get the timezone in a platform independent fashion | 14 :tag("tzo"):text("+00:00"):up() -- FIXME get the timezone in a platform independent fashion |
| 15 :tag("utc"):text(datetime())); | 15 :tag("utc"):text(datetime())); |
| 18 | 18 |
| 19 -- XEP-0090: Entity Time (deprecated) | 19 -- XEP-0090: Entity Time (deprecated) |
| 20 | 20 |
| 21 require "core.discomanager".set("time", "jabber:iq:time"); | 21 require "core.discomanager".set("time", "jabber:iq:time"); |
| 22 | 22 |
| 23 add_iq_handler({"c2s", "s2sin"}, "jabber:iq:time", | 23 module:add_iq_handler({"c2s", "s2sin"}, "jabber:iq:time", |
| 24 function(session, stanza) | 24 function(session, stanza) |
| 25 if stanza.attr.type == "get" then | 25 if stanza.attr.type == "get" then |
| 26 session.send(st.reply(stanza):tag("query", {xmlns="jabber:iq:time"}) | 26 session.send(st.reply(stanza):tag("query", {xmlns="jabber:iq:time"}) |
| 27 :tag("utc"):text(legacy())); | 27 :tag("utc"):text(legacy())); |
| 28 end | 28 end |