Comparison

plugins/mod_time.lua @ 12635:f928cb5c5d04

mod_time: Remove obsolete XEP-0090 support Deprecated even before Prosody even started, obsolete for over a decade.
author Kim Alvefur <zash@zash.se>
date Mon, 15 Aug 2022 16:35:14 +0200
parent 12632:70ae68bb0aa5
child 12977:74b9e05af71e
comparison
equal deleted inserted replaced
12634:8cb6644ce463 12635:f928cb5c5d04
7 -- 7 --
8 8
9 local st = require "util.stanza"; 9 local st = require "util.stanza";
10 local datetime = require "util.datetime".datetime; 10 local datetime = require "util.datetime".datetime;
11 local now = require "util.time".now; 11 local now = require "util.time".now;
12 local legacy = require "util.datetime".legacy;
13 12
14 -- XEP-0202: Entity Time 13 -- XEP-0202: Entity Time
15 14
16 module:add_feature("urn:xmpp:time"); 15 module:add_feature("urn:xmpp:time");
17 16
24 end 23 end
25 24
26 module:hook("iq-get/bare/urn:xmpp:time:time", time_handler); 25 module:hook("iq-get/bare/urn:xmpp:time:time", time_handler);
27 module:hook("iq-get/host/urn:xmpp:time:time", time_handler); 26 module:hook("iq-get/host/urn:xmpp:time:time", time_handler);
28 27
29 -- XEP-0090: Entity Time (deprecated)
30
31 module:add_feature("jabber:iq:time");
32
33 local function legacy_time_handler(event)
34 local origin, stanza = event.origin, event.stanza;
35 origin.send(st.reply(stanza):tag("query", {xmlns="jabber:iq:time"})
36 :tag("utc"):text(legacy()));
37 return true;
38 end
39
40 module:hook("iq-get/bare/jabber:iq:time:query", legacy_time_handler);
41 module:hook("iq-get/host/jabber:iq:time:query", legacy_time_handler);