Wed, 26 Nov 2008 08:56:30 +0500
Added mod_time with support for [XEP-0202: Entity Time] and [XEP-0090: Entity Time] (deprecated)
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; |
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
|
4 | |
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 | -- 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
|
6 | |
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 | 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
|
8 | |
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 | 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
|
10 | 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
|
11 | 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
|
12 | 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
|
13 | :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
|
14 | :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
|
15 | 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
|
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 | |
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 | -- 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
|
19 | |
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 | 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
|
21 | |
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 | 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
|
23 | 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
|
24 | 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
|
25 | session.send(st.reply(stanza):tag("query", {xmlns="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
|
26 | :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
|
27 | 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
|
28 | end); |