Comparison

plugins/mod_time.lua @ 541:3521e0851c9e

Change modules to use the new add_feature module API method. This also fixes the bug causing disco features being added to every disco reply for every host.
author Waqas Hussain <waqas20@gmail.com>
date Thu, 04 Dec 2008 20:16:30 +0500
parent 519:cccd610a0ef9
child 615:4ae3e81513f3
comparison
equal deleted inserted replaced
540:ec03f6968fa8 541:3521e0851c9e
23 local datetime = require "util.datetime".datetime; 23 local datetime = require "util.datetime".datetime;
24 local legacy = require "util.datetime".legacy; 24 local legacy = require "util.datetime".legacy;
25 25
26 -- XEP-0202: Entity Time 26 -- XEP-0202: Entity Time
27 27
28 require "core.discomanager".set("time", "urn:xmpp:time"); 28 module:add_feature("urn:xmpp:time");
29 29
30 module:add_iq_handler({"c2s", "s2sin"}, "urn:xmpp:time", 30 module:add_iq_handler({"c2s", "s2sin"}, "urn:xmpp:time",
31 function(session, stanza) 31 function(session, stanza)
32 if stanza.attr.type == "get" then 32 if stanza.attr.type == "get" then
33 session.send(st.reply(stanza):tag("time", {xmlns="urn:xmpp:time"}) 33 session.send(st.reply(stanza):tag("time", {xmlns="urn:xmpp:time"})
36 end 36 end
37 end); 37 end);
38 38
39 -- XEP-0090: Entity Time (deprecated) 39 -- XEP-0090: Entity Time (deprecated)
40 40
41 require "core.discomanager".set("time", "jabber:iq:time"); 41 module:add_feature("jabber:iq:time");
42 42
43 module:add_iq_handler({"c2s", "s2sin"}, "jabber:iq:time", 43 module:add_iq_handler({"c2s", "s2sin"}, "jabber:iq:time",
44 function(session, stanza) 44 function(session, stanza)
45 if stanza.attr.type == "get" then 45 if stanza.attr.type == "get" then
46 session.send(st.reply(stanza):tag("query", {xmlns="jabber:iq:time"}) 46 session.send(st.reply(stanza):tag("query", {xmlns="jabber:iq:time"})