Annotate

plugins/mod_time.lua @ 487:86e77b6ba579

Automated merge.
author Tobias Markmann <tm@ayena.de>
date Sat, 29 Nov 2008 20:33:14 +0100
parent 438:193f9dd64f17
child 519:cccd610a0ef9
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
423
c9c7f026a108 Added mod_time with support for [XEP-0202: Entity Time] and [XEP-0090: Entity Time] (deprecated)
Waqas Hussain <waqas20@gmail.com>
parents:
diff changeset
1
c9c7f026a108 Added mod_time with support for [XEP-0202: Entity Time] and [XEP-0090: Entity Time] (deprecated)
Waqas Hussain <waqas20@gmail.com>
parents:
diff changeset
2 local st = require "util.stanza";
c9c7f026a108 Added mod_time with support for [XEP-0202: Entity Time] and [XEP-0090: Entity Time] (deprecated)
Waqas Hussain <waqas20@gmail.com>
parents:
diff changeset
3 local datetime = require "util.datetime".datetime;
424
3eb22492e8ab Changed format for XEP-0090 to the legacy format
Waqas Hussain <waqas20@gmail.com>
parents: 423
diff changeset
4 local legacy = require "util.datetime".legacy;
423
c9c7f026a108 Added mod_time with support for [XEP-0202: Entity Time] and [XEP-0090: Entity Time] (deprecated)
Waqas Hussain <waqas20@gmail.com>
parents:
diff changeset
5
c9c7f026a108 Added mod_time with support for [XEP-0202: Entity Time] and [XEP-0090: Entity Time] (deprecated)
Waqas Hussain <waqas20@gmail.com>
parents:
diff changeset
6 -- XEP-0202: Entity Time
c9c7f026a108 Added mod_time with support for [XEP-0202: Entity Time] and [XEP-0090: Entity Time] (deprecated)
Waqas Hussain <waqas20@gmail.com>
parents:
diff changeset
7
c9c7f026a108 Added mod_time with support for [XEP-0202: Entity Time] and [XEP-0090: Entity Time] (deprecated)
Waqas Hussain <waqas20@gmail.com>
parents:
diff changeset
8 require "core.discomanager".set("time", "urn:xmpp:time");
c9c7f026a108 Added mod_time with support for [XEP-0202: Entity Time] and [XEP-0090: Entity Time] (deprecated)
Waqas Hussain <waqas20@gmail.com>
parents:
diff changeset
9
438
193f9dd64f17 Bumper commit for the new modulemanager API \o/ Updates all the modules, though some more changes may be in store.
Matthew Wild <mwild1@gmail.com>
parents: 424
diff changeset
10 module:add_iq_handler({"c2s", "s2sin"}, "urn:xmpp:time",
423
c9c7f026a108 Added mod_time with support for [XEP-0202: Entity Time] and [XEP-0090: Entity Time] (deprecated)
Waqas Hussain <waqas20@gmail.com>
parents:
diff changeset
11 function(session, stanza)
c9c7f026a108 Added mod_time with support for [XEP-0202: Entity Time] and [XEP-0090: Entity Time] (deprecated)
Waqas Hussain <waqas20@gmail.com>
parents:
diff changeset
12 if stanza.attr.type == "get" then
c9c7f026a108 Added mod_time with support for [XEP-0202: Entity Time] and [XEP-0090: Entity Time] (deprecated)
Waqas Hussain <waqas20@gmail.com>
parents:
diff changeset
13 session.send(st.reply(stanza):tag("time", {xmlns="urn:xmpp:time"})
c9c7f026a108 Added mod_time with support for [XEP-0202: Entity Time] and [XEP-0090: Entity Time] (deprecated)
Waqas Hussain <waqas20@gmail.com>
parents:
diff changeset
14 :tag("tzo"):text("+00:00"):up() -- FIXME get the timezone in a platform independent fashion
c9c7f026a108 Added mod_time with support for [XEP-0202: Entity Time] and [XEP-0090: Entity Time] (deprecated)
Waqas Hussain <waqas20@gmail.com>
parents:
diff changeset
15 :tag("utc"):text(datetime()));
c9c7f026a108 Added mod_time with support for [XEP-0202: Entity Time] and [XEP-0090: Entity Time] (deprecated)
Waqas Hussain <waqas20@gmail.com>
parents:
diff changeset
16 end
c9c7f026a108 Added mod_time with support for [XEP-0202: Entity Time] and [XEP-0090: Entity Time] (deprecated)
Waqas Hussain <waqas20@gmail.com>
parents:
diff changeset
17 end);
c9c7f026a108 Added mod_time with support for [XEP-0202: Entity Time] and [XEP-0090: Entity Time] (deprecated)
Waqas Hussain <waqas20@gmail.com>
parents:
diff changeset
18
c9c7f026a108 Added mod_time with support for [XEP-0202: Entity Time] and [XEP-0090: Entity Time] (deprecated)
Waqas Hussain <waqas20@gmail.com>
parents:
diff changeset
19 -- XEP-0090: Entity Time (deprecated)
c9c7f026a108 Added mod_time with support for [XEP-0202: Entity Time] and [XEP-0090: Entity Time] (deprecated)
Waqas Hussain <waqas20@gmail.com>
parents:
diff changeset
20
c9c7f026a108 Added mod_time with support for [XEP-0202: Entity Time] and [XEP-0090: Entity Time] (deprecated)
Waqas Hussain <waqas20@gmail.com>
parents:
diff changeset
21 require "core.discomanager".set("time", "jabber:iq:time");
c9c7f026a108 Added mod_time with support for [XEP-0202: Entity Time] and [XEP-0090: Entity Time] (deprecated)
Waqas Hussain <waqas20@gmail.com>
parents:
diff changeset
22
438
193f9dd64f17 Bumper commit for the new modulemanager API \o/ Updates all the modules, though some more changes may be in store.
Matthew Wild <mwild1@gmail.com>
parents: 424
diff changeset
23 module:add_iq_handler({"c2s", "s2sin"}, "jabber:iq:time",
423
c9c7f026a108 Added mod_time with support for [XEP-0202: Entity Time] and [XEP-0090: Entity Time] (deprecated)
Waqas Hussain <waqas20@gmail.com>
parents:
diff changeset
24 function(session, stanza)
c9c7f026a108 Added mod_time with support for [XEP-0202: Entity Time] and [XEP-0090: Entity Time] (deprecated)
Waqas Hussain <waqas20@gmail.com>
parents:
diff changeset
25 if stanza.attr.type == "get" then
c9c7f026a108 Added mod_time with support for [XEP-0202: Entity Time] and [XEP-0090: Entity Time] (deprecated)
Waqas Hussain <waqas20@gmail.com>
parents:
diff changeset
26 session.send(st.reply(stanza):tag("query", {xmlns="jabber:iq:time"})
424
3eb22492e8ab Changed format for XEP-0090 to the legacy format
Waqas Hussain <waqas20@gmail.com>
parents: 423
diff changeset
27 :tag("utc"):text(legacy()));
423
c9c7f026a108 Added mod_time with support for [XEP-0202: Entity Time] and [XEP-0090: Entity Time] (deprecated)
Waqas Hussain <waqas20@gmail.com>
parents:
diff changeset
28 end
c9c7f026a108 Added mod_time with support for [XEP-0202: Entity Time] and [XEP-0090: Entity Time] (deprecated)
Waqas Hussain <waqas20@gmail.com>
parents:
diff changeset
29 end);