25
1
mirror of https://github.com/processone/ejabberd.git synced 2024-11-24 16:23:40 +01:00

Get back some commented specs that required Erlang R12

This commit is contained in:
Badlop 2020-06-02 21:20:50 +02:00
parent 4f5c00a83d
commit 337ba42953

View File

@ -35,9 +35,7 @@
delete_subscription/1, update_subscription/1]). delete_subscription/1, update_subscription/1]).
-export([export/1]). -export([export/1]).
%% TODO: Those -spec lines produce errors in old Erlang versions. -spec read_subscription(SubID :: string()) -> {ok, #pubsub_subscription{}} | notfound.
%% They can be enabled again in ejabberd 3.0 because it uses R12B or higher.
%% -spec read_subscription(SubID :: string()) -> {ok, #pubsub_subscription{}} | notfound.
read_subscription(SubID) -> read_subscription(SubID) ->
case case
ejabberd_sql:sql_query_t( ejabberd_sql:sql_query_t(
@ -51,19 +49,18 @@ read_subscription(SubID) ->
options = lists:map(fun subscription_opt_from_sql/1, Options)}} options = lists:map(fun subscription_opt_from_sql/1, Options)}}
end. end.
%% -spec delete_subscription(SubID :: string()) -> ok. -spec delete_subscription(SubID :: string()) -> ok.
delete_subscription(SubID) -> delete_subscription(SubID) ->
%% -spec update_subscription(#pubsub_subscription{}) -> ok .
%% -spec add_subscription(#pubsub_subscription{}) -> ok.
%% -------------- Internal utilities -----------------------
ejabberd_sql:sql_query_t( ejabberd_sql:sql_query_t(
?SQL("delete from pubsub_subscription_opt " ?SQL("delete from pubsub_subscription_opt "
"where subid = %(SubID)s")), "where subid = %(SubID)s")),
ok. ok.
-spec update_subscription(#pubsub_subscription{}) -> ok .
update_subscription(#pubsub_subscription{subid = SubId} = Sub) -> update_subscription(#pubsub_subscription{subid = SubId} = Sub) ->
delete_subscription(SubId), add_subscription(Sub). delete_subscription(SubId), add_subscription(Sub).
-spec add_subscription(#pubsub_subscription{}) -> ok.
add_subscription(#pubsub_subscription{subid = SubId, options = Opts}) -> add_subscription(#pubsub_subscription{subid = SubId, options = Opts}) ->
lists:foreach( lists:foreach(
fun(Opt) -> fun(Opt) ->