25
1
mirror of https://github.com/processone/ejabberd.git synced 2024-12-20 17:27:00 +01:00

Remove deprecated XEP-0090 Entity Time and 91 Delayed Delivery (EJAB-849)

This commit is contained in:
Badlop 2015-05-18 12:38:07 +02:00
parent 555c1736b7
commit 2af659b737
3 changed files with 6 additions and 44 deletions

View File

@ -35,12 +35,10 @@
-define(NS_BLOCKING, <<"urn:xmpp:blocking">>).
-define(NS_PRIVATE, <<"jabber:iq:private">>).
-define(NS_VERSION, <<"jabber:iq:version">>).
-define(NS_TIME90, <<"jabber:iq:time">>).
-define(NS_TIME, <<"urn:xmpp:time">>).
-define(NS_LAST, <<"jabber:iq:last">>).
-define(NS_XDATA, <<"jabber:x:data">>).
-define(NS_IQDATA, <<"jabber:iq:data">>).
-define(NS_DELAY91, <<"jabber:x:delay">>).
-define(NS_DELAY, <<"urn:xmpp:delay">>).
-define(NS_HINTS, <<"urn:xmpp:hints">>).
-define(NS_EXPIRE, <<"jabber:x:expire">>).

View File

@ -54,9 +54,6 @@
atom_to_binary/1, binary_to_atom/1, tuple_to_binary/1,
l2i/1, i2l/1, i2l/2, queue_drop_while/2]).
%% TODO: Remove once XEP-0091 is Obsolete
%% TODO: Remove once XEP-0091 is Obsolete
-include("ejabberd.hrl").
-include("jlib.hrl").
@ -612,10 +609,7 @@ add_delay_info(El, From, Time) ->
binary()) -> xmlel().
add_delay_info(El, From, Time, Desc) ->
%% TODO: Remove support for <x/>, XEP-0091 is obsolete.
El1 = add_delay_info(El, From, Time, Desc, <<"delay">>, ?NS_DELAY),
El2 = add_delay_info(El1, From, Time, Desc, <<"x">>, ?NS_DELAY91),
El2.
add_delay_info(El, From, Time, Desc, <<"delay">>, ?NS_DELAY).
-spec add_delay_info(xmlel(), jid() | ljid() | binary(), erlang:timestamp(),
binary(), binary(), binary()) -> xmlel().
@ -652,20 +646,15 @@ add_delay_info(El, From, Time, Desc, Name, XMLNS) ->
-spec create_delay_tag(erlang:timestamp(), jid() | ljid() | binary(), binary(),
binary()) -> xmlel() | error.
create_delay_tag(TimeStamp, FromJID, Desc, XMLNS) when is_tuple(FromJID) ->
create_delay_tag(TimeStamp, FromJID, Desc, XMLNS) when is_tuple(FromJID)
and (XMLNS == ?NS_DELAY) ->
From = jlib:jid_to_string(FromJID),
{Name, Stamp} = case XMLNS of
?NS_DELAY ->
{<<"delay">>, now_to_utc_string(TimeStamp, 3)};
?NS_DELAY91 ->
DateTime = calendar:now_to_universal_time(TimeStamp),
{<<"x">>, timestamp_to_iso(DateTime)}
end,
Stamp = now_to_utc_string(TimeStamp, 3),
Children = case Desc of
<<"">> -> [];
_ -> [{xmlcdata, Desc}]
end,
#xmlel{name = Name,
#xmlel{name = <<"delay">>,
attrs =
[{<<"xmlns">>, XMLNS}, {<<"from">>, From},
{<<"stamp">>, Stamp}],

View File

@ -30,10 +30,7 @@
-behaviour(gen_mod).
-export([start/2, stop/1, process_local_iq90/3,
process_local_iq/3]).
% TODO: Remove once XEP-0090 is Obsolete
-export([start/2, stop/1, process_local_iq/3]).
-include("ejabberd.hrl").
-include("logger.hrl").
@ -43,35 +40,13 @@
start(Host, Opts) ->
IQDisc = gen_mod:get_opt(iqdisc, Opts, fun gen_iq_handler:check_type/1,
one_queue),
gen_iq_handler:add_iq_handler(ejabberd_local, Host,
?NS_TIME90, ?MODULE, process_local_iq90,
IQDisc),
gen_iq_handler:add_iq_handler(ejabberd_local, Host,
?NS_TIME, ?MODULE, process_local_iq, IQDisc).
stop(Host) ->
gen_iq_handler:remove_iq_handler(ejabberd_local, Host,
?NS_TIME90),
gen_iq_handler:remove_iq_handler(ejabberd_local, Host,
?NS_TIME).
%% TODO: Remove this function once XEP-0090 is Obsolete
process_local_iq90(_From, _To,
#iq{type = Type, sub_el = SubEl} = IQ) ->
case Type of
set ->
IQ#iq{type = error, sub_el = [SubEl, ?ERR_NOT_ALLOWED]};
get ->
UTC = jlib:timestamp_to_iso(calendar:universal_time()),
IQ#iq{type = result,
sub_el =
[#xmlel{name = <<"query">>,
attrs = [{<<"xmlns">>, ?NS_TIME90}],
children =
[#xmlel{name = <<"utc">>, attrs = [],
children = [{xmlcdata, UTC}]}]}]}
end.
process_local_iq(_From, _To,
#iq{type = Type, sub_el = SubEl} = IQ) ->
case Type of