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 |