Annotate

plugins/mod_time.lua @ 433:afbf29498123

Fix to make a global configmanager instance
author Matthew Wild <mwild1@gmail.com>
date Wed, 26 Nov 2008 23:12:05 +0000
parent 424:3eb22492e8ab
child 438:193f9dd64f17
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
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
10 add_iq_handler({"c2s", "s2sin"}, "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
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
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
23 add_iq_handler({"c2s", "s2sin"}, "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
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);