Software /
code /
prosody
Annotate
plugins/mod_time.lua @ 887:eef21d7bbe04
mod_saslauth: Disable SASL ANONYMOUS unless explicitly enabled with sasl_anonymous = true
author | Matthew Wild <mwild1@gmail.com> |
---|---|
date | Sat, 07 Mar 2009 20:17:09 +0000 |
parent | 760:90ce865eebd8 |
child | 896:2c0b9e3c11c3 |
rev | line source |
---|---|
759 | 1 -- Prosody IM v0.3 |
760
90ce865eebd8
Update copyright notices for 2009
Matthew Wild <mwild1@gmail.com>
parents:
759
diff
changeset
|
2 -- Copyright (C) 2008-2009 Matthew Wild |
90ce865eebd8
Update copyright notices for 2009
Matthew Wild <mwild1@gmail.com>
parents:
759
diff
changeset
|
3 -- Copyright (C) 2008-2009 Waqas Hussain |
519
cccd610a0ef9
Insert copyright/license headers
Matthew Wild <mwild1@gmail.com>
parents:
438
diff
changeset
|
4 -- |
758 | 5 -- This project is MIT/X11 licensed. Please see the |
6 -- COPYING file in the source package for more information. | |
519
cccd610a0ef9
Insert copyright/license headers
Matthew Wild <mwild1@gmail.com>
parents:
438
diff
changeset
|
7 -- |
cccd610a0ef9
Insert copyright/license headers
Matthew Wild <mwild1@gmail.com>
parents:
438
diff
changeset
|
8 |
cccd610a0ef9
Insert copyright/license headers
Matthew Wild <mwild1@gmail.com>
parents:
438
diff
changeset
|
9 |
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
|
10 |
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 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
|
12 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
|
13 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
|
14 |
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 -- 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
|
16 |
541
3521e0851c9e
Change modules to use the new add_feature module API method.
Waqas Hussain <waqas20@gmail.com>
parents:
519
diff
changeset
|
17 module:add_feature("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
|
18 |
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
|
19 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
|
20 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
|
21 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
|
22 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
|
23 :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
|
24 :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
|
25 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
|
26 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
|
27 |
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 -- 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
|
29 |
541
3521e0851c9e
Change modules to use the new add_feature module API method.
Waqas Hussain <waqas20@gmail.com>
parents:
519
diff
changeset
|
30 module:add_feature("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
|
31 |
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
|
32 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
|
33 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
|
34 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
|
35 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
|
36 :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
|
37 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
|
38 end); |