diff options
author | Randy Barlow <bowlofeggs@electronsweatshop.com> | 2016-08-03 07:52:27 -0400 |
---|---|---|
committer | Randy Barlow <bowlofeggs@electronsweatshop.com> | 2016-08-03 07:52:27 -0400 |
commit | fc9a594fdc02336be11d545aaceb12d86d5e4233 (patch) | |
tree | c12a0e4eafd342039b720c990efe8812db3523a2 | |
parent | 3c0907bf7162d48d326c7f97e8a76f666203aadd (diff) | |
download | ejabberd-fc9a594fdc02336be11d545aaceb12d86d5e4233.tar.gz ejabberd-fc9a594fdc02336be11d545aaceb12d86d5e4233.tar.xz ejabberd-fc9a594fdc02336be11d545aaceb12d86d5e4233.zip |
Backport commit 0737958b to build on Erlang 19.
Also, remove commented make edoc, since upstream no longer ships
docs in this source.
-rw-r--r-- | ejabberd-0002-Fix-compilation-issues-on-R19.patch | 1293 | ||||
-rw-r--r-- | ejabberd.spec | 7 |
2 files changed, 1299 insertions, 1 deletions
diff --git a/ejabberd-0002-Fix-compilation-issues-on-R19.patch b/ejabberd-0002-Fix-compilation-issues-on-R19.patch new file mode 100644 index 0000000..b34923b --- /dev/null +++ b/ejabberd-0002-Fix-compilation-issues-on-R19.patch @@ -0,0 +1,1293 @@ +From 0737958b45be015d734769cd9b6fa5e7ce01409f Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Pawe=C5=82=20Chmielowski?= <pchmielowski@process-one.net> +Date: Fri, 1 Jul 2016 21:18:55 +0200 +Subject: [PATCH] Fix compilation issues on R19 + +--- + src/adhoc.erl | 23 +-- + src/cyrsasl.erl | 28 +-- + src/ejabberd_config.erl | 2 +- + src/jlib.erl | 47 ++--- + src/mod_pubsub.erl | 426 +++++++++++----------------------------- + src/node_flat_sql.erl | 78 ++------ + src/nodetree_dag.erl | 34 ++-- + src/pubsub_subscription.erl | 49 ++--- + src/pubsub_subscription_sql.erl | 44 ++--- + 10 files changed, 199 insertions(+), 538 deletions(-) + +diff --git a/src/adhoc.erl b/src/adhoc.erl +index 83a113a..6970584 100644 +--- a/src/adhoc.erl ++++ b/src/adhoc.erl +@@ -41,13 +41,7 @@ + %% Parse an ad-hoc request. Return either an adhoc_request record or + %% an {error, ErrorType} tuple. + %% +--spec(parse_request/1 :: +-( +- IQ :: iq_request()) +- -> adhoc_response() +- %% +- | {error, _} +-). ++-spec parse_request(IQ :: iq_request()) -> adhoc_response() | {error, _}. + + parse_request(#iq{type = set, lang = Lang, sub_el = SubEl, xmlns = ?NS_COMMANDS}) -> + ?DEBUG("entering parse_request...", []), +@@ -88,12 +82,9 @@ find_xdata_el1([_ | Els]) -> find_xdata_el1(Els). + %% record, filling in values for language, node and session id from + %% the request. + %% +--spec(produce_response/2 :: +-( +- Adhoc_Request :: adhoc_request(), +- Adhoc_Response :: adhoc_response()) +- -> Xmlel::xmlel() +-). ++-spec produce_response(Adhoc_Request :: adhoc_request(), ++ Adhoc_Response :: adhoc_response()) -> ++ Xmlel::xmlel(). + + %% Produce a <command/> node to use as response from an adhoc_response + %% record. +@@ -104,11 +95,7 @@ produce_response(#adhoc_request{lang = Lang, node = Node, sessionid = SessionID} + }). + + %% +--spec(produce_response/1 :: +-( +- Adhoc_Response::adhoc_response()) +- -> Xmlel::xmlel() +-). ++-spec produce_response(Adhoc_Response::adhoc_response()) -> Xmlel::xmlel(). + + produce_response( + #adhoc_response{ +diff --git a/src/cyrsasl.erl b/src/cyrsasl.erl +index 21fbc96..a101e13 100644 +--- a/src/cyrsasl.erl ++++ b/src/cyrsasl.erl +@@ -88,13 +88,8 @@ start() -> + ok. + + %% +--spec(register_mechanism/3 :: +-( +- Mechanim :: mechanism(), +- Module :: module(), +- PasswordType :: password_type()) +- -> any() +-). ++-spec register_mechanism(Mechanim :: mechanism(), Module :: module(), ++ PasswordType :: password_type()) -> any(). + + register_mechanism(Mechanism, Module, PasswordType) -> + case is_disabled(Mechanism) of +@@ -139,11 +134,7 @@ check_credentials(_State, Props) -> + _LUser -> ok + end. + +--spec(listmech/1 :: +-( +- Host ::binary()) +- -> Mechanisms::mechanisms() +-). ++-spec listmech(Host ::binary()) -> Mechanisms::mechanisms(). + + listmech(Host) -> + Mechs = ets:select(sasl_mechanism, +@@ -213,12 +204,7 @@ server_step(State, ClientIn) -> + %% Remove the anonymous mechanism from the list if not enabled for the given + %% host + %% +--spec(filter_anonymous/2 :: +-( +- Host :: binary(), +- Mechs :: mechanisms()) +- -> mechanisms() +-). ++-spec filter_anonymous(Host :: binary(), Mechs :: mechanisms()) -> mechanisms(). + + filter_anonymous(Host, Mechs) -> + case ejabberd_auth_anonymous:is_sasl_anonymous_enabled(Host) of +@@ -226,11 +212,7 @@ filter_anonymous(Host, Mechs) -> + false -> Mechs -- [<<"ANONYMOUS">>] + end. + +--spec(is_disabled/1 :: +-( +- Mechanism :: mechanism()) +- -> boolean() +-). ++-spec is_disabled(Mechanism :: mechanism()) -> boolean(). + + is_disabled(Mechanism) -> + Disabled = ejabberd_config:get_option( +diff --git a/src/ejabberd_config.erl b/src/ejabberd_config.erl +index 139047d..df9debd 100644 +--- a/src/ejabberd_config.erl ++++ b/src/ejabberd_config.erl +@@ -90,7 +90,7 @@ hosts_to_start(State) -> + + %% @private + %% At the moment, these functions are mainly used to setup unit tests. +--spec(start/2 :: (Hosts :: [binary()], Opts :: [acl:acl() | local_config()]) -> ok). ++-spec start(Hosts :: [binary()], Opts :: [acl:acl() | local_config()]) -> ok. + start(Hosts, Opts) -> + mnesia_init(), + set_opts(set_hosts_in_options(Hosts, #state{opts = Opts})). +diff --git a/src/jlib.erl b/src/jlib.erl +index e5cba31..532a746 100644 +--- a/src/jlib.erl ++++ b/src/jlib.erl +@@ -307,21 +307,16 @@ get_iq_namespace(#xmlel{name = <<"iq">>, children = Els}) -> + get_iq_namespace(_) -> <<"">>. + + %% +--spec(iq_query_info/1 :: +-( +- Xmlel :: xmlel()) +- -> iq_request() | 'reply' | 'invalid' | 'not_iq' +-). ++-spec iq_query_info(Xmlel :: xmlel()) -> ++ iq_request() | 'reply' | 'invalid' | 'not_iq'. + + %% @spec (xmlelement()) -> iq() | reply | invalid | not_iq + iq_query_info(El) -> iq_info_internal(El, request). + + %% +--spec(iq_query_or_response_info/1 :: +-( +- Xmlel :: xmlel()) +- -> iq_request() | iq_reply() | 'reply' | 'invalid' | 'not_iq' +-). ++-spec iq_query_or_response_info(Xmlel :: xmlel()) -> ++ iq_request() | iq_reply() | ++ 'reply' | 'invalid' | 'not_iq'. + + iq_query_or_response_info(El) -> + iq_info_internal(El, any). +@@ -373,11 +368,7 @@ iq_type_to_string(get) -> <<"get">>; + iq_type_to_string(result) -> <<"result">>; + iq_type_to_string(error) -> <<"error">>. + +--spec(iq_to_xml/1 :: +-( +- IQ :: iq()) +- -> xmlel() +-). ++-spec iq_to_xml(IQ :: iq()) -> xmlel(). + + iq_to_xml(#iq{id = ID, type = Type, sub_el = SubEl}) -> + if ID /= <<"">> -> +@@ -391,13 +382,8 @@ iq_to_xml(#iq{id = ID, type = Type, sub_el = SubEl}) -> + children = SubEl} + end. + +--spec(parse_xdata_submit/1 :: +-( +- El :: xmlel()) +- -> [{Var::binary(), Values::[binary()]}] +- %% +- | 'invalid' +-). ++-spec parse_xdata_submit(El :: xmlel()) -> ++ [{Var::binary(), Values::[binary()]}] | 'invalid'. + + parse_xdata_submit(#xmlel{attrs = Attrs, children = Els}) -> + case fxml:get_attr_s(<<"type">>, Attrs) of +@@ -409,12 +395,9 @@ parse_xdata_submit(#xmlel{attrs = Attrs, children = Els}) -> + invalid + end. + +--spec(parse_xdata_fields/2 :: +-( +- Xmlels :: [xmlel() | cdata()], +- Res :: [{Var::binary(), Values :: [binary()]}]) +- -> [{Var::binary(), Values::[binary()]}] +-). ++-spec parse_xdata_fields(Xmlels :: [xmlel() | cdata()], ++ Res :: [{Var::binary(), Values :: [binary()]}]) -> ++ [{Var::binary(), Values::[binary()]}]. + + parse_xdata_fields([], Res) -> Res; + parse_xdata_fields([#xmlel{name = <<"field">>, attrs = Attrs, children = SubEls} +@@ -429,12 +412,8 @@ parse_xdata_fields([#xmlel{name = <<"field">>, attrs = Attrs, children = SubEls} + parse_xdata_fields([_ | Els], Res) -> + parse_xdata_fields(Els, Res). + +--spec(parse_xdata_values/2 :: +-( +- Xmlels :: [xmlel() | cdata()], +- Res :: [binary()]) +- -> [binary()] +-). ++-spec parse_xdata_values(Xmlels :: [xmlel() | cdata()], ++ Res :: [binary()]) -> [binary()]. + + parse_xdata_values([], Res) -> Res; + parse_xdata_values([#xmlel{name = <<"value">>, children = SubEls} | Els], Res) -> +diff --git a/src/mod_pubsub.erl b/src/mod_pubsub.erl +index a978cc5..53378c3 100644 +--- a/src/mod_pubsub.erl ++++ b/src/mod_pubsub.erl +@@ -234,11 +234,7 @@ stop(Host) -> + %% {stop, Reason} + %% Description: Initiates the server + %%-------------------------------------------------------------------- +--spec(init/1 :: +- ( +- [binary() | [{_,_}],...]) +- -> {'ok',state()} +- ). ++-spec init([binary() | [{_,_}],...]) -> {'ok',state()}. + + init([ServerHost, Opts]) -> + ?DEBUG("pubsub init ~p ~p", [ServerHost, Opts]), +@@ -480,15 +476,10 @@ send_loop(State) -> + %% disco hooks handling functions + %% + +--spec(disco_local_identity/5 :: +- ( +- Acc :: [xmlel()], +- _From :: jid(), +- To :: jid(), +- Node :: <<>> | mod_pubsub:nodeId(), +- Lang :: binary()) +- -> [xmlel()] +- ). ++-spec disco_local_identity(Acc :: [xmlel()], _From :: jid(), ++ To :: jid(), Node :: <<>> | mod_pubsub:nodeId(), ++ Lang :: binary()) -> [xmlel()]. ++ + disco_local_identity(Acc, _From, To, <<>>, _Lang) -> + case lists:member(?PEPNODE, plugins(host(To#jid.lserver))) of + true -> +@@ -502,15 +493,10 @@ disco_local_identity(Acc, _From, To, <<>>, _Lang) -> + disco_local_identity(Acc, _From, _To, _Node, _Lang) -> + Acc. + +--spec(disco_local_features/5 :: +- ( +- Acc :: [xmlel()], +- _From :: jid(), +- To :: jid(), +- Node :: <<>> | mod_pubsub:nodeId(), +- Lang :: binary()) +- -> [binary(),...] +- ). ++-spec disco_local_features(Acc :: [xmlel()], _From :: jid(), ++ To :: jid(), Node :: <<>> | mod_pubsub:nodeId(), ++ Lang :: binary()) -> [binary(),...]. ++ + disco_local_features(Acc, _From, To, <<>>, _Lang) -> + Host = host(To#jid.lserver), + Feats = case Acc of +@@ -528,15 +514,10 @@ disco_local_items(Acc, _From, _To, _Node, _Lang) -> Acc. + % when is_binary(Node) -> + % disco_sm_identity(Acc, From, To, iolist_to_binary(Node), + % Lang); +--spec(disco_sm_identity/5 :: +- ( +- Acc :: empty | [xmlel()], +- From :: jid(), +- To :: jid(), +- Node :: mod_pubsub:nodeId(), +- Lang :: binary()) +- -> [xmlel()] +- ). ++-spec disco_sm_identity(Acc :: empty | [xmlel()], From :: jid(), ++ To :: jid(), Node :: mod_pubsub:nodeId(), ++ Lang :: binary()) -> [xmlel()]. ++ + disco_sm_identity(empty, From, To, Node, Lang) -> + disco_sm_identity([], From, To, Node, Lang); + disco_sm_identity(Acc, From, To, Node, _Lang) -> +@@ -571,15 +552,9 @@ disco_identity(Host, Node, From) -> + _ -> [] + end. + +--spec(disco_sm_features/5 :: +- ( +- Acc :: empty | {result, Features::[Feature::binary()]}, +- From :: jid(), +- To :: jid(), +- Node :: mod_pubsub:nodeId(), +- Lang :: binary()) +- -> {result, Features::[Feature::binary()]} +- ). ++-spec disco_sm_features(Acc :: empty | {result, Features::[Feature::binary()]}, ++ From :: jid(), To :: jid(), Node :: mod_pubsub:nodeId(), ++ Lang :: binary()) -> {result, Features::[Feature::binary()]}. + %disco_sm_features(Acc, From, To, Node, Lang) + % when is_binary(Node) -> + % disco_sm_features(Acc, From, To, iolist_to_binary(Node), +@@ -607,15 +582,9 @@ disco_features(Host, Node, From) -> + _ -> [] + end. + +--spec(disco_sm_items/5 :: +- ( +- Acc :: empty | {result, [xmlel()]}, +- From :: jid(), +- To :: jid(), +- Node :: mod_pubsub:nodeId(), +- Lang :: binary()) +- -> {result, [xmlel()]} +- ). ++-spec disco_sm_items(Acc :: empty | {result, [xmlel()]}, From :: jid(), ++ To :: jid(), Node :: mod_pubsub:nodeId(), ++ Lang :: binary()) -> {result, [xmlel()]}. + %disco_sm_items(Acc, From, To, Node, Lang) + % when is_binary(Node) -> + % disco_sm_items(Acc, From, To, iolist_to_binary(Node), +@@ -627,13 +596,8 @@ disco_sm_items({result, OtherItems}, From, To, Node, _Lang) -> + disco_items(jid:tolower(jid:remove_resource(To)), Node, From))}; + disco_sm_items(Acc, _From, _To, _Node, _Lang) -> Acc. + +--spec(disco_items/3 :: +- ( +- Host :: mod_pubsub:host(), +- Node :: mod_pubsub:nodeId(), +- From :: jid()) +- -> [xmlel()] +- ). ++-spec disco_items(Host :: mod_pubsub:host(), Node :: mod_pubsub:nodeId(), ++ From :: jid()) -> [xmlel()]. + disco_items(Host, <<>>, From) -> + Action = fun (#pubsub_node{nodeid = {_, Node}, + options = Options, type = Type, id = Nidx, owners = O}, +@@ -847,12 +811,8 @@ handle_call(stop, _From, State) -> + %% @private + handle_cast(_Msg, State) -> {noreply, State}. + +--spec(handle_info/2 :: +- ( +- _ :: {route, From::jid(), To::jid(), Packet::xmlel()}, +- State :: state()) +- -> {noreply, state()} +- ). ++-spec handle_info(_ :: {route, From::jid(), To::jid(), Packet::xmlel()}, ++ State :: state()) -> {noreply, state()}. + + %%-------------------------------------------------------------------- + %% Function: handle_info(Info, State) -> {noreply, State} | +@@ -935,17 +895,9 @@ terminate(_Reason, + %% @private + code_change(_OldVsn, State, _Extra) -> {ok, State}. + +--spec(do_route/7 :: +- ( +- ServerHost :: binary(), +- Access :: atom(), +- Plugins :: [binary(),...], +- Host :: mod_pubsub:hostPubsub(), +- From :: jid(), +- To :: jid(), +- Packet :: xmlel()) +- -> ok +- ). ++-spec do_route(ServerHost :: binary(), Access :: atom(), ++ Plugins :: [binary(),...], Host :: mod_pubsub:hostPubsub(), ++ From :: jid(), To :: jid(), Packet :: xmlel()) -> ok. + + %%-------------------------------------------------------------------- + %%% Internal functions +@@ -1132,14 +1084,8 @@ iq_disco_info(Host, SNode, From, Lang) -> + node_disco_info(Host, Node, From) + end. + +--spec(iq_disco_items/4 :: +- ( +- Host :: mod_pubsub:host(), +- Node :: <<>> | mod_pubsub:nodeId(), +- From :: jid(), +- Rsm :: none | rsm_in()) +- -> {result, [xmlel()]} +- ). ++-spec iq_disco_items(Host :: mod_pubsub:host(), Node :: <<>> | mod_pubsub:nodeId(), ++ From :: jid(), Rsm :: none | rsm_in()) -> {result, [xmlel()]}. + iq_disco_items(Host, <<>>, From, _RSM) -> + {result, + lists:map(fun (#pubsub_node{nodeid = {_, SubNode}, options = Options}) -> +@@ -1202,13 +1148,7 @@ iq_disco_items(Host, Item, From, RSM) -> + end + end. + +--spec(iq_sm/3 :: +- ( +- From :: jid(), +- To :: jid(), +- IQ :: iq_request()) +- -> iq_result() | iq_error() +- ). ++-spec iq_sm(From :: jid(), To :: jid(), IQ :: iq_request()) -> iq_result() | iq_error(). + iq_sm(From, To, #iq{type = Type, sub_el = SubEl, xmlns = XMLNS, lang = Lang} = IQ) -> + ServerHost = To#jid.lserver, + LOwner = jid:tolower(jid:remove_resource(To)), +@@ -1233,36 +1173,17 @@ iq_get_vcard(Lang) -> + <<(translate:translate(Lang, <<"ejabberd Publish-Subscribe module">>))/binary, + "\nCopyright (c) 2004-2016 ProcessOne">>}]}]. + +--spec(iq_pubsub/6 :: +- ( +- Host :: mod_pubsub:host(), +- ServerHost :: binary(), +- From :: jid(), +- IQType :: 'get' | 'set', +- SubEl :: xmlel(), +- Lang :: binary()) +- -> {result, [xmlel()]} +- %%% +- | {error, xmlel()} +- ). ++-spec iq_pubsub(Host :: mod_pubsub:host(), ServerHost :: binary(), From :: jid(), ++ IQType :: 'get' | 'set', SubEl :: xmlel(), Lang :: binary()) -> ++ {result, [xmlel()]} | {error, xmlel()}. + + iq_pubsub(Host, ServerHost, From, IQType, SubEl, Lang) -> + iq_pubsub(Host, ServerHost, From, IQType, SubEl, Lang, all, plugins(Host)). + +--spec(iq_pubsub/8 :: +- ( +- Host :: mod_pubsub:host(), +- ServerHost :: binary(), +- From :: jid(), +- IQType :: 'get' | 'set', +- SubEl :: xmlel(), +- Lang :: binary(), +- Access :: atom(), +- Plugins :: [binary(),...]) +- -> {result, [xmlel()]} +- %%% +- | {error, xmlel()} +- ). ++-spec iq_pubsub(Host :: mod_pubsub:host(), ServerHost :: binary(), From :: jid(), ++ IQType :: 'get' | 'set', SubEl :: xmlel(), Lang :: binary(), ++ Access :: atom(), Plugins :: [binary(),...]) -> ++ {result, [xmlel()]} | {error, xmlel()}. + + iq_pubsub(Host, ServerHost, From, IQType, SubEl, Lang, Access, Plugins) -> + #xmlel{children = SubEls} = SubEl, +@@ -1368,18 +1289,10 @@ iq_pubsub(Host, ServerHost, From, IQType, SubEl, Lang, Access, Plugins) -> + end. + + +--spec(iq_pubsub_owner/6 :: +- ( +- Host :: mod_pubsub:host(), +- ServerHost :: binary(), +- From :: jid(), +- IQType :: 'get' | 'set', +- SubEl :: xmlel(), +- Lang :: binary()) +- -> {result, [xmlel()]} +- %%% +- | {error, xmlel()} +- ). ++-spec iq_pubsub_owner(Host :: mod_pubsub:host(), ServerHost :: binary(), From :: jid(), ++ IQType :: 'get' | 'set', SubEl :: xmlel(), Lang :: binary()) -> ++ {result, [xmlel()]} | {error, xmlel()}. ++ + iq_pubsub_owner(Host, ServerHost, From, IQType, SubEl, Lang) -> + #xmlel{children = SubEls} = SubEl, + Action = fxml:remove_cdata(SubEls), +@@ -1654,10 +1567,10 @@ send_authorization_approval(Host, JID, SNode, Subscription) -> + %{S, SID} -> + % [{<<"subscription">>, subscription_to_string(S)}, + % {<<"subid">>, SID}]; +- S -> ++ S -> + [{<<"subscription">>, subscription_to_string(S)}] + end, +- Stanza = event_stanza(<<"subscription">>, ++ Stanza = event_stanza(<<"subscription">>, + [{<<"jid">>, jid:to_string(JID)} + | nodeAttr(SNode)] + ++ SubAttrs), +@@ -1802,33 +1715,17 @@ update_auth(Host, Node, Type, Nidx, Subscriber, Allow, Subs) -> + %%<li>nodetree create_node checks if nodeid already exists</li> + %%<li>node plugin create_node just sets default affiliation/subscription</li> + %%</ul> +--spec(create_node/5 :: +- ( +- Host :: mod_pubsub:host(), +- ServerHost :: binary(), +- Node :: <<>> | mod_pubsub:nodeId(), +- Owner :: jid(), +- Type :: binary()) +- -> {result, [xmlel(),...]} +- %%% +- | {error, xmlel()} +- ). ++-spec create_node(Host :: mod_pubsub:host(), ServerHost :: binary(), ++ Node :: <<>> | mod_pubsub:nodeId(), Owner :: jid(), ++ Type :: binary()) -> {result, [xmlel(),...]} | {error, xmlel()}. + create_node(Host, ServerHost, Node, Owner, Type) -> + create_node(Host, ServerHost, Node, Owner, Type, all, []). + +--spec(create_node/7 :: +- ( +- Host :: mod_pubsub:host(), +- ServerHost :: binary(), +- Node :: <<>> | mod_pubsub:nodeId(), +- Owner :: jid(), +- Type :: binary(), +- Access :: atom(), +- Configuration :: [xmlel()]) +- -> {result, [xmlel(),...]} +- %%% +- | {error, xmlel()} +- ). ++-spec create_node(Host :: mod_pubsub:host(), ServerHost :: binary(), ++ Node :: <<>> | mod_pubsub:nodeId(), Owner :: jid(), ++ Type :: binary(), Access :: atom(), Configuration :: [xmlel()]) -> ++ {result, [xmlel(),...]} | {error, xmlel()}. ++ + create_node(Host, ServerHost, <<>>, Owner, Type, Access, Configuration) -> + case lists:member(<<"instant-nodes">>, plugin_features(Host, Type)) of + true -> +@@ -1942,15 +1839,8 @@ create_node(Host, ServerHost, Node, Owner, GivenType, Access, Configuration) -> + %%<li>The node is the root collection node, which cannot be deleted.</li> + %%<li>The specified node does not exist.</li> + %%</ul> +--spec(delete_node/3 :: +- ( +- Host :: mod_pubsub:host(), +- Node :: mod_pubsub:nodeId(), +- Owner :: jid()) +- -> {result, [xmlel(),...]} +- %%% +- | {error, xmlel()} +- ). ++-spec delete_node(Host :: mod_pubsub:host(), Node :: mod_pubsub:nodeId(), ++ Owner :: jid()) -> {result, [xmlel(),...]} | {error, xmlel()}. + delete_node(_Host, <<>>, _Owner) -> + {error, ?ERRT_NOT_ALLOWED(?MYLANG, <<"No node specified">>)}; + delete_node(Host, Node, Owner) -> +@@ -2026,17 +1916,9 @@ delete_node(Host, Node, Owner) -> + %%<li>The node does not support subscriptions.</li> + %%<li>The node does not exist.</li> + %%</ul> +--spec(subscribe_node/5 :: +- ( +- Host :: mod_pubsub:host(), +- Node :: mod_pubsub:nodeId(), +- From :: jid(), +- JID :: binary(), +- Configuration :: [xmlel()]) +- -> {result, [xmlel(),...]} +- %%% +- | {error, xmlel()} +- ). ++-spec subscribe_node(Host :: mod_pubsub:host(), Node :: mod_pubsub:nodeId(), ++ From :: jid(), JID :: binary(), Configuration :: [xmlel()]) -> ++ {result, [xmlel(),...]} | {error, xmlel()}. + subscribe_node(Host, Node, From, JID, Configuration) -> + SubModule = subscription_plugin(Host), + SubOpts = case SubModule:parse_options_xform(Configuration) of +@@ -2145,17 +2027,11 @@ subscribe_node(Host, Node, From, JID, Configuration) -> + %%<li>The node does not exist.</li> + %%<li>The request specifies a subscription ID that is not valid or current.</li> + %%</ul> +--spec(unsubscribe_node/5 :: +- ( +- Host :: mod_pubsub:host(), +- Node :: mod_pubsub:nodeId(), +- From :: jid(), +- JID :: binary() | ljid(), +- SubId :: mod_pubsub:subId()) +- -> {result, []} +- %%% +- | {error, xmlel()} +- ). ++-spec unsubscribe_node(Host :: mod_pubsub:host(), Node :: mod_pubsub:nodeId(), ++ From :: jid(), JID :: binary() | ljid(), ++ SubId :: mod_pubsub:subId()) -> ++ {result, []} | {error, xmlel()}. ++ + unsubscribe_node(Host, Node, From, JID, SubId) when is_binary(JID) -> + unsubscribe_node(Host, Node, From, string_to_ljid(JID), SubId); + unsubscribe_node(Host, Node, From, Subscriber, SubId) -> +@@ -2183,18 +2059,12 @@ unsubscribe_node(Host, Node, From, Subscriber, SubId) -> + %%<li>The item contains more than one payload element or the namespace of the root payload element does not match the configured namespace for the node.</li> + %%<li>The request does not match the node configuration.</li> + %%</ul> +--spec(publish_item/6 :: +- ( +- Host :: mod_pubsub:host(), +- ServerHost :: binary(), +- Node :: mod_pubsub:nodeId(), +- Publisher :: jid(), +- ItemId :: <<>> | mod_pubsub:itemId(), +- Payload :: mod_pubsub:payload()) +- -> {result, [xmlel(),...]} +- %%% +- | {error, xmlel()} +- ). ++-spec publish_item(Host :: mod_pubsub:host(), ServerHost :: binary(), ++ Node :: mod_pubsub:nodeId(), Publisher :: jid(), ++ ItemId :: <<>> | mod_pubsub:itemId(), ++ Payload :: mod_pubsub:payload()) -> ++ {result, [xmlel(),...]} | {error, xmlel()}. ++ + publish_item(Host, ServerHost, Node, Publisher, ItemId, Payload) -> + publish_item(Host, ServerHost, Node, Publisher, ItemId, Payload, [], all). + publish_item(Host, ServerHost, Node, Publisher, <<>>, Payload, PubOpts, Access) -> +@@ -2319,16 +2189,10 @@ publish_item(Host, ServerHost, Node, Publisher, ItemId, Payload, PubOpts, Access + %%<li>The node does not support persistent items.</li> + %%<li>The service does not support the deletion of items.</li> + %%</ul> +--spec(delete_item/4 :: +- ( +- Host :: mod_pubsub:host(), +- Node :: mod_pubsub:nodeId(), +- Publisher :: jid(), +- ItemId :: mod_pubsub:itemId()) +- -> {result, []} +- %%% +- | {error, xmlel()} +- ). ++-spec delete_item(Host :: mod_pubsub:host(), Node :: mod_pubsub:nodeId(), ++ Publisher :: jid(), ItemId :: mod_pubsub:itemId()) -> ++ {result, []} | {error, xmlel()}. ++ + delete_item(Host, Node, Publisher, ItemId) -> + delete_item(Host, Node, Publisher, ItemId, false). + delete_item(_, <<>>, _, _, _) -> +@@ -2383,15 +2247,10 @@ delete_item(Host, Node, Publisher, ItemId, ForceNotify) -> + %%<li>The node is not configured to persist items.</li> + %%<li>The specified node does not exist.</li> + %%</ul> +--spec(purge_node/3 :: +- ( +- Host :: mod_pubsub:host(), +- Node :: mod_pubsub:nodeId(), +- Owner :: jid()) +- -> {result, []} +- %%% +- | {error, xmlel()} +- ). ++-spec purge_node(Host :: mod_pubsub:host(), Node :: mod_pubsub:nodeId(), ++ Owner :: jid()) -> ++ {result, []} | {error, xmlel()}. ++ + purge_node(Host, Node, Owner) -> + Action = fun (#pubsub_node{options = Options, type = Type, id = Nidx}) -> + Features = plugin_features(Host, Type), +@@ -2435,19 +2294,12 @@ purge_node(Host, Node, Owner) -> + %% <p>The permission are not checked in this function.</p> + %% @todo We probably need to check that the user doing the query has the right + %% to read the items. +--spec(get_items/7 :: +- ( +- Host :: mod_pubsub:host(), +- Node :: mod_pubsub:nodeId(), +- From :: jid(), +- SubId :: mod_pubsub:subId(), +- SMaxItems :: binary(), +- ItemIds :: [mod_pubsub:itemId()], +- Rsm :: none | rsm_in()) +- -> {result, [xmlel(),...]} +- %%% +- | {error, xmlel()} +- ). ++-spec get_items(Host :: mod_pubsub:host(), Node :: mod_pubsub:nodeId(), ++ From :: jid(), SubId :: mod_pubsub:subId(), ++ SMaxItems :: binary(), ItemIds :: [mod_pubsub:itemId()], ++ Rsm :: none | rsm_in()) -> ++ {result, [xmlel(),...]} | {error, xmlel()}. ++ + get_items(Host, Node, From, SubId, SMaxItems, ItemIds, RSM) -> + MaxItems = if SMaxItems == <<>> -> + case get_max_items_node(Host) of +@@ -2511,7 +2363,7 @@ get_items(Host, Node, From, SubId, SMaxItems, ItemIds, RSM) -> + + get_items(Host, Node) -> + Action = fun (#pubsub_node{type = Type, id = Nidx}) -> +- node_call(Host, Type, get_items, [Nidx, service_jid(Host), none]) ++ node_call(Host, Type, get_items, [Nidx, service_jid(Host), none]) + end, + case transaction(Host, Node, Action, sync_dirty) of + {result, {_, {Items, _}}} -> Items; +@@ -2610,16 +2462,10 @@ dispatch_items(From, To, _Node, Stanza) -> + ejabberd_router:route(service_jid(From), jid:make(To), Stanza). + + %% @doc <p>Return the list of affiliations as an XMPP response.</p> +--spec(get_affiliations/4 :: +- ( +- Host :: mod_pubsub:host(), +- Node :: mod_pubsub:nodeId(), +- JID :: jid(), +- Plugins :: [binary()]) +- -> {result, [xmlel(),...]} +- %%% +- | {error, xmlel()} +- ). ++-spec get_affiliations(Host :: mod_pubsub:host(), Node :: mod_pubsub:nodeId(), ++ JID :: jid(), Plugins :: [binary()]) -> ++ {result, [xmlel(),...]} | {error, xmlel()}. ++ + get_affiliations(Host, Node, JID, Plugins) when is_list(Plugins) -> + Result = lists:foldl( fun (Type, {Status, Acc}) -> + Features = plugin_features(Host, Type), +@@ -2663,15 +2509,10 @@ get_affiliations(Host, Node, JID, Plugins) when is_list(Plugins) -> + Error + end. + +--spec(get_affiliations/3 :: +- ( +- Host :: mod_pubsub:host(), +- Node :: mod_pubsub:nodeId(), +- JID :: jid()) +- -> {result, [xmlel(),...]} +- %%% +- | {error, xmlel()} +- ). ++-spec get_affiliations(Host :: mod_pubsub:host(), Node :: mod_pubsub:nodeId(), ++ JID :: jid()) -> ++ {result, [xmlel(),...]} | {error, xmlel()}. ++ + get_affiliations(Host, Node, JID) -> + Action = fun (#pubsub_node{type = Type, id = Nidx}) -> + Features = plugin_features(Host, Type), +@@ -2708,16 +2549,10 @@ get_affiliations(Host, Node, JID) -> + Error + end. + +--spec(set_affiliations/4 :: +- ( +- Host :: mod_pubsub:host(), +- Node :: mod_pubsub:nodeId(), +- From :: jid(), +- EntitiesEls :: [xmlel()]) +- -> {result, []} +- %%% +- | {error, xmlel()} +- ). ++-spec set_affiliations(Host :: mod_pubsub:host(), Node :: mod_pubsub:nodeId(), ++ From :: jid(), EntitiesEls :: [xmlel()]) -> ++ {result, []} | {error, xmlel()}. ++ + set_affiliations(Host, Node, From, EntitiesEls) -> + Owner = jid:tolower(jid:remove_resource(From)), + Entities = lists:foldl(fun +@@ -3113,15 +2948,13 @@ set_subscriptions(Host, Node, From, EntitiesEls) -> + end + end. + +--spec(get_presence_and_roster_permissions/5 :: +- ( +- Host :: mod_pubsub:host(), +- From :: ljid(), +- Owners :: [ljid(),...], +- AccessModel :: mod_pubsub:accessModel(), +- AllowedGroups :: [binary()]) +- -> {PresenceSubscription::boolean(), RosterGroup::boolean()} +- ). ++-spec get_presence_and_roster_permissions(Host :: mod_pubsub:host(), ++ From :: ljid(), Owners :: [ljid(),...], ++ AccessModel :: mod_pubsub:accessModel(), ++ AllowedGroups :: [binary()]) -> ++ {PresenceSubscription::boolean(), ++ RosterGroup::boolean()}. ++ + get_presence_and_roster_permissions(Host, From, Owners, AccessModel, AllowedGroups) -> + if (AccessModel == presence) or (AccessModel == roster) -> + case Host of +@@ -3179,11 +3012,7 @@ subscription_to_string(pending) -> <<"pending">>; + subscription_to_string(unconfigured) -> <<"unconfigured">>; + subscription_to_string(_) -> <<"none">>. + +--spec(service_jid/1 :: +- ( +- Host :: mod_pubsub:host()) +- -> jid() +- ). ++-spec service_jid(Host :: mod_pubsub:host()) -> jid(). + service_jid(#jid{} = Jid) -> Jid; + service_jid({U, S, R}) -> jid:make(U, S, R); + service_jid(Host) -> jid:make(<<>>, Host, <<>>). +@@ -3217,12 +3046,7 @@ sub_option_can_deliver(_, _, {deliver, false}) -> false; + sub_option_can_deliver(_, _, {expire, When}) -> p1_time_compat:timestamp() < When; + sub_option_can_deliver(_, _, _) -> true. + +--spec(presence_can_deliver/2 :: +- ( +- Entity :: ljid(), +- _ :: boolean()) +- -> boolean() +- ). ++-spec presence_can_deliver(Entity :: ljid(), _ :: boolean()) -> boolean(). + presence_can_deliver(_, false) -> + true; + presence_can_deliver({User, Server, Resource}, true) -> +@@ -3243,12 +3067,10 @@ presence_can_deliver({User, Server, Resource}, true) -> + false, Ss) + end. + +--spec(state_can_deliver/2 :: +- ( +- Entity::ljid(), +- SubOptions :: mod_pubsub:subOptions() | []) +- -> [ljid()] +- ). ++-spec state_can_deliver(Entity::ljid(), ++ SubOptions :: mod_pubsub:subOptions() | []) -> ++ [ljid()]. ++ + state_can_deliver({U, S, R}, []) -> [{U, S, R}]; + state_can_deliver({U, S, R}, SubOptions) -> + case lists:keysearch(show_values, 1, SubOptions) of +@@ -3268,13 +3090,10 @@ state_can_deliver({U, S, R}, SubOptions) -> + [], Resources) + end. + +--spec(get_resource_state/3 :: +- ( +- Entity :: ljid(), +- ShowValues :: [binary()], +- JIDs :: [ljid()]) +- -> [ljid()] +- ). ++-spec get_resource_state(Entity :: ljid(), ShowValues :: [binary()], ++ JIDs :: [ljid()]) -> ++ [ljid()]. ++ + get_resource_state({U, S, R}, ShowValues, JIDs) -> + case ejabberd_sm:get_session_pid(U, S, R) of + none -> +@@ -3293,11 +3112,8 @@ get_resource_state({U, S, R}, ShowValues, JIDs) -> + end + end. + +--spec(payload_xmlelements/1 :: +- ( +- Payload :: mod_pubsub:payload()) +- -> Count :: non_neg_integer() +- ). ++-spec payload_xmlelements(Payload :: mod_pubsub:payload()) -> ++ Count :: non_neg_integer(). + payload_xmlelements(Payload) -> + payload_xmlelements(Payload, 0). + +@@ -4040,12 +3856,9 @@ unset_cached_item(Host, Nidx) -> + _ -> ok + end. + +--spec(get_cached_item/2 :: +- ( +- Host :: mod_pubsub:host(), +- Nidx :: mod_pubsub:nodeIdx()) +- -> undefined | mod_pubsub:pubsubItem() +- ). ++-spec get_cached_item(Host :: mod_pubsub:host(), Nidx :: mod_pubsub:nodeIdx()) -> ++ undefined | mod_pubsub:pubsubItem(). ++ + get_cached_item({_, ServerHost, _}, Nidx) -> + get_cached_item(ServerHost, Nidx); + get_cached_item(Host, Nidx) -> +@@ -4340,7 +4153,7 @@ string_to_ljid(JID) -> + end + end. + +--spec(uniqid/0 :: () -> mod_pubsub:itemId()). ++-spec uniqid() -> mod_pubsub:itemId(). + uniqid() -> + {T1, T2, T3} = p1_time_compat:timestamp(), + iolist_to_binary(io_lib:fwrite("~.16B~.16B~.16B", [T1, T2, T3])). +@@ -4355,12 +4168,7 @@ itemsEls(Items) -> + [#xmlel{name = <<"item">>, attrs = itemAttr(ItemId), children = Payload} + || #pubsub_item{itemid = {ItemId, _}, payload = Payload} <- Items]. + +--spec(add_message_type/2 :: +- ( +- Message :: xmlel(), +- Type :: atom()) +- -> xmlel() +- ). ++-spec add_message_type(Message :: xmlel(), Type :: atom()) -> xmlel(). + + add_message_type(Message, normal) -> Message; + add_message_type(#xmlel{name = <<"message">>, attrs = Attrs, children = Els}, Type) -> +diff --git a/src/node_flat_sql.erl b/src/node_flat_sql.erl +index 68116cf..2030b12 100644 +--- a/src/node_flat_sql.erl ++++ b/src/node_flat_sql.erl +@@ -402,17 +402,13 @@ get_entity_subscriptions(Host, Owner) -> + end, + {result, Reply}. + +--spec(get_entity_subscriptions_for_send_last/2 :: +- ( +- Host :: mod_pubsub:hostPubsub(), +- Owner :: jid()) +- -> {result, +- [{mod_pubsub:pubsubNode(), +- mod_pubsub:subscription(), +- mod_pubsub:subId(), +- ljid()}] +- } +- ). ++-spec get_entity_subscriptions_for_send_last(Host :: mod_pubsub:hostPubsub(), ++ Owner :: jid()) -> ++ {result, [{mod_pubsub:pubsubNode(), ++ mod_pubsub:subscription(), ++ mod_pubsub:subId(), ++ ljid()}]}. ++ + get_entity_subscriptions_for_send_last(Host, Owner) -> + SubKey = jid:tolower(Owner), + GenKey = jid:remove_resource(SubKey), +@@ -611,11 +607,9 @@ get_state(Nidx, JID) -> + {SJID, _} = State#pubsub_state.stateid, + State#pubsub_state{items = itemids(Nidx, SJID)}. + +--spec(get_state_without_itemids/2 :: +- (Nidx :: mod_pubsub:nodeIdx(), +- Key :: ljid()) -> +- mod_pubsub:pubsubState() +- ). ++-spec get_state_without_itemids(Nidx :: mod_pubsub:nodeIdx(), Key :: ljid()) -> ++ mod_pubsub:pubsubState(). ++ + get_state_without_itemids(Nidx, JID) -> + J = encode_jid(JID), + case catch +@@ -973,17 +967,11 @@ update_subscription(Nidx, JID, Subscription) -> + "-affiliation='n'" + ]). + +--spec(decode_jid/1 :: +- ( SJID :: binary()) +- -> ljid() +- ). ++-spec decode_jid(SJID :: binary()) -> ljid(). + decode_jid(SJID) -> + jid:tolower(jid:from_string(SJID)). + +--spec(decode_affiliation/1 :: +- ( Arg :: binary()) +- -> atom() +- ). ++-spec decode_affiliation(Arg :: binary()) -> atom(). + decode_affiliation(<<"o">>) -> owner; + decode_affiliation(<<"p">>) -> publisher; + decode_affiliation(<<"u">>) -> publish_only; +@@ -991,19 +979,13 @@ decode_affiliation(<<"m">>) -> member; + decode_affiliation(<<"c">>) -> outcast; + decode_affiliation(_) -> none. + +--spec(decode_subscription/1 :: +- ( Arg :: binary()) +- -> atom() +- ). ++-spec decode_subscription(Arg :: binary()) -> atom(). + decode_subscription(<<"s">>) -> subscribed; + decode_subscription(<<"p">>) -> pending; + decode_subscription(<<"u">>) -> unconfigured; + decode_subscription(_) -> none. + +--spec(decode_subscriptions/1 :: +- ( Subscriptions :: binary()) +- -> [] | [{atom(), binary()},...] +- ). ++-spec decode_subscriptions(Subscriptions :: binary()) -> [] | [{atom(), binary()},...]. + decode_subscriptions(Subscriptions) -> + lists:foldl(fun (Subscription, Acc) -> + case str:tokens(Subscription, <<":">>) of +@@ -1013,36 +995,24 @@ decode_subscriptions(Subscriptions) -> + end, + [], str:tokens(Subscriptions, <<",">>)). + +--spec(encode_jid/1 :: +- ( JID :: ljid()) +- -> binary() +- ). ++-spec encode_jid(JID :: ljid()) -> binary(). + encode_jid(JID) -> + jid:to_string(JID). + +--spec(encode_jid_like/1 :: (JID :: ljid()) -> binary()). ++-spec encode_jid_like(JID :: ljid()) -> binary(). + encode_jid_like(JID) -> + ejabberd_sql:escape_like_arg_circumflex(jid:to_string(JID)). + +--spec(encode_host/1 :: +- ( Host :: host()) +- -> binary() +- ). ++-spec encode_host(Host :: host()) -> binary(). + encode_host({_U, _S, _R} = LJID) -> encode_jid(LJID); + encode_host(Host) -> Host. + +--spec(encode_host_like/1 :: +- ( Host :: host()) +- -> binary() +- ). ++-spec encode_host_like(Host :: host()) -> binary(). + encode_host_like({_U, _S, _R} = LJID) -> ejabberd_sql:escape(encode_jid_like(LJID)); + encode_host_like(Host) -> + ejabberd_sql:escape(ejabberd_sql:escape_like_arg_circumflex(Host)). + +--spec(encode_affiliation/1 :: +- ( Arg :: atom()) +- -> binary() +- ). ++-spec encode_affiliation(Arg :: atom()) -> binary(). + encode_affiliation(owner) -> <<"o">>; + encode_affiliation(publisher) -> <<"p">>; + encode_affiliation(publish_only) -> <<"u">>; +@@ -1050,19 +1020,13 @@ encode_affiliation(member) -> <<"m">>; + encode_affiliation(outcast) -> <<"c">>; + encode_affiliation(_) -> <<"n">>. + +--spec(encode_subscription/1 :: +- ( Arg :: atom()) +- -> binary() +- ). ++-spec encode_subscription(Arg :: atom()) -> binary(). + encode_subscription(subscribed) -> <<"s">>; + encode_subscription(pending) -> <<"p">>; + encode_subscription(unconfigured) -> <<"u">>; + encode_subscription(_) -> <<"n">>. + +--spec(encode_subscriptions/1 :: +- ( Subscriptions :: [] | [{atom(), binary()},...]) +- -> binary() +- ). ++-spec encode_subscriptions(Subscriptions :: [] | [{atom(), binary()},...]) -> binary(). + encode_subscriptions(Subscriptions) -> + str:join([<<(encode_subscription(S))/binary, ":", SubId/binary>> + || {S, SubId} <- Subscriptions], <<",">>). +diff --git a/src/nodetree_dag.erl b/src/nodetree_dag.erl +index a105db8..387d984 100644 +--- a/src/nodetree_dag.erl ++++ b/src/nodetree_dag.erl +@@ -167,12 +167,8 @@ oid(Key, Name) -> {Key, Name}. + + %% Key = jlib:jid() | host() + %% Node = string() +--spec(find_node/2 :: +- ( +- Key :: mod_pubsub:hostPubsub(), +- Node :: mod_pubsub:nodeId()) +- -> mod_pubsub:pubsubNode() | false +- ). ++-spec find_node(Key :: mod_pubsub:hostPubsub(), Node :: mod_pubsub:nodeId()) -> ++ mod_pubsub:pubsubNode() | false. + find_node(Key, Node) -> + case mnesia:read(pubsub_node, oid(Key, Node), read) of + [] -> false; +@@ -188,14 +184,11 @@ find_opt(Key, Default, Options) -> + _ -> Default + end. + +--spec(traversal_helper/4 :: +- ( +- Pred :: fun(), +- Tr :: fun(), +- Host :: mod_pubsub:hostPubsub(), +- Nodes :: [mod_pubsub:nodeId(),...]) +- -> [{Depth::non_neg_integer(), Nodes::[mod_pubsub:pubsubNode(),...]}] +- ). ++-spec traversal_helper(Pred :: fun(), Tr :: fun(), Host :: mod_pubsub:hostPubsub(), ++ Nodes :: [mod_pubsub:nodeId(),...]) -> ++ [{Depth::non_neg_integer(), ++ Nodes::[mod_pubsub:pubsubNode(),...]}]. ++ + traversal_helper(Pred, Tr, Host, Nodes) -> + traversal_helper(Pred, Tr, 0, Host, Nodes, []). + +@@ -220,15 +213,10 @@ remove_config_parent(Node, [{collection, Parents} | T], Acc) -> + remove_config_parent(Node, [H | T], Acc) -> + remove_config_parent(Node, T, [H | Acc]). + +--spec(validate_parentage/3 :: +- ( +- Key :: mod_pubsub:hostPubsub(), +- Owners :: [ljid(),...], +- Parent_Nodes :: [mod_pubsub:nodeId()]) +- -> true +- %%% +- | {error, xmlel()} +- ). ++-spec validate_parentage(Key :: mod_pubsub:hostPubsub(), Owners :: [ljid(),...], ++ Parent_Nodes :: [mod_pubsub:nodeId()]) -> ++ true | {error, xmlel()}. ++ + validate_parentage(_Key, _Owners, []) -> + true; + validate_parentage(Key, Owners, [[] | T]) -> +diff --git a/src/pubsub_subscription.erl b/src/pubsub_subscription.erl +index f990f6e..3ab5021 100644 +--- a/src/pubsub_subscription.erl ++++ b/src/pubsub_subscription.erl +@@ -152,13 +152,9 @@ create_table() -> + Other -> Other + end. + +--spec(add_subscription/3 :: +- ( +- _JID :: ljid(), +- _NodeId :: mod_pubsub:nodeIdx(), +- Options :: [] | mod_pubsub:subOptions()) +- -> SubId :: mod_pubsub:subId() +- ). ++-spec add_subscription(_JID :: ljid(), _NodeId :: mod_pubsub:nodeIdx(), ++ Options :: [] | mod_pubsub:subOptions()) -> ++ SubId :: mod_pubsub:subId(). + + add_subscription(_JID, _NodeId, []) -> make_subid(); + add_subscription(_JID, _NodeId, Options) -> +@@ -166,25 +162,13 @@ add_subscription(_JID, _NodeId, Options) -> + mnesia:write(#pubsub_subscription{subid = SubID, options = Options}), + SubID. + +--spec(delete_subscription/3 :: +- ( +- _JID :: _, +- _NodeId :: _, +- SubId :: mod_pubsub:subId()) +- -> ok +- ). ++-spec delete_subscription(_JID :: _, _NodeId :: _, SubId :: mod_pubsub:subId()) -> ok. + + delete_subscription(_JID, _NodeId, SubID) -> + mnesia:delete({pubsub_subscription, SubID}). + +--spec(read_subscription/3 :: +- ( +- _JID :: ljid(), +- _NodeId :: _, +- SubID :: mod_pubsub:subId()) +- -> mod_pubsub:pubsubSubscription() +- | {error, notfound} +- ). ++-spec read_subscription(_JID :: ljid(), _NodeId :: _, SubID :: mod_pubsub:subId()) -> ++ mod_pubsub:pubsubSubscription() | {error, notfound}. + + read_subscription(_JID, _NodeId, SubID) -> + case mnesia:read({pubsub_subscription, SubID}) of +@@ -192,19 +176,13 @@ read_subscription(_JID, _NodeId, SubID) -> + _ -> {error, notfound} + end. + +--spec(write_subscription/4 :: +- ( +- _JID :: ljid(), +- _NodeId :: _, +- SubID :: mod_pubsub:subId(), +- Options :: mod_pubsub:subOptions()) +- -> ok +- ). ++-spec write_subscription(_JID :: ljid(), _NodeId :: _, SubID :: mod_pubsub:subId(), ++ Options :: mod_pubsub:subOptions()) -> ok. + + write_subscription(_JID, _NodeId, SubID, Options) -> + mnesia:write(#pubsub_subscription{subid = SubID, options = Options}). + +--spec(make_subid/0 :: () -> SubId::mod_pubsub:subId()). ++-spec make_subid() -> SubId::mod_pubsub:subId(). + make_subid() -> + {T1, T2, T3} = p1_time_compat:timestamp(), + iolist_to_binary(io_lib:fwrite("~.16B~.16B~.16B", [T1, T2, T3])). +@@ -272,13 +250,8 @@ xopt_to_bool(Option, _) -> + ErrTxt = iolist_to_binary(io_lib:format(Txt, [Option])), + {error, ?ERRT_NOT_ACCEPTABLE(?MYLANG, ErrTxt)}. + +--spec(get_option_xfield/3 :: +- ( +- Lang :: binary(), +- Key :: atom(), +- Options :: mod_pubsub:subOptions()) +- -> xmlel() +- ). ++-spec get_option_xfield(Lang :: binary(), Key :: atom(), ++ Options :: mod_pubsub:subOptions()) -> xmlel(). + + %% Return a field for an XForm for Key, with data filled in, if + %% applicable, from Options. +diff --git a/src/pubsub_subscription_sql.erl b/src/pubsub_subscription_sql.erl +index 1f82aa0..6e59832 100644 +--- a/src/pubsub_subscription_sql.erl ++++ b/src/pubsub_subscription_sql.erl +@@ -73,54 +73,34 @@ + + init() -> ok = create_table(). + +--spec(subscribe_node/3 :: +- ( +- _JID :: _, +- _NodeId :: _, +- Options :: [] | mod_pubsub:subOptions()) +- -> {result, mod_pubsub:subId()} +- ). ++-spec subscribe_node(_JID :: _, _NodeId :: _, Options :: [] | mod_pubsub:subOptions()) -> ++ {result, mod_pubsub:subId()}. ++ + subscribe_node(_JID, _NodeId, Options) -> + SubID = make_subid(), + (?DB_MOD):add_subscription(#pubsub_subscription{subid = SubID, options = Options}), + {result, SubID}. + +--spec(unsubscribe_node/3 :: +- ( +- _JID :: _, +- _NodeId :: _, +- SubID :: mod_pubsub:subId()) +- -> {result, mod_pubsub:subscription()} +- | {error, notfound} +- ). ++-spec unsubscribe_node(_JID :: _, _NodeId :: _, SubID :: mod_pubsub:subId()) -> ++ {result, mod_pubsub:subscription()} | {error, notfound}. ++ + unsubscribe_node(_JID, _NodeId, SubID) -> + case (?DB_MOD):read_subscription(SubID) of + {ok, Sub} -> (?DB_MOD):delete_subscription(SubID), {result, Sub}; + notfound -> {error, notfound} + end. + +--spec(get_subscription/3 :: +- ( +- _JID :: _, +- _NodeId :: _, +- SubId :: mod_pubsub:subId()) +- -> {result, mod_pubsub:subscription()} +- | {error, notfound} +- ). ++-spec get_subscription(_JID :: _, _NodeId :: _, SubId :: mod_pubsub:subId()) -> ++ {result, mod_pubsub:subscription()} | {error, notfound}. ++ + get_subscription(_JID, _NodeId, SubID) -> + case (?DB_MOD):read_subscription(SubID) of + {ok, Sub} -> {result, Sub}; + notfound -> {error, notfound} + end. + +--spec(set_subscription/4 :: +- ( +- _JID :: _, +- _NodeId :: _, +- SubId :: mod_pubsub:subId(), +- Options :: mod_pubsub:subOptions()) +- -> {result, ok} +- ). ++-spec set_subscription(_JID :: _, _NodeId :: _, SubId :: mod_pubsub:subId(), ++ Options :: mod_pubsub:subOptions()) -> {result, ok}. + set_subscription(_JID, _NodeId, SubID, Options) -> + case (?DB_MOD):read_subscription(SubID) of + {ok, _} -> +@@ -167,7 +147,7 @@ parse_options_xform(XFields) -> + %%==================================================================== + create_table() -> ok. + +--spec(make_subid/0 :: () -> mod_pubsub:subId()). ++-spec make_subid() -> mod_pubsub:subId(). + make_subid() -> + {T1, T2, T3} = p1_time_compat:timestamp(), + iolist_to_binary(io_lib:fwrite("~.16B~.16B~.16B", [T1, T2, T3])). +-- +2.9.2 + diff --git a/ejabberd.spec b/ejabberd.spec index f8f97d4..3241d42 100644 --- a/ejabberd.spec +++ b/ejabberd.spec @@ -28,6 +28,9 @@ Source13: ejabberdctl.polkit.rules # Use ejabberd as an example for PAM service name (fedora/epel-specific) Patch1: ejabberd-0001-Fix-PAM-service-example-name-to-match-actual-one.patch +# This patch allows ejabberd to compile on Erlang 19, it was backported from upstream commit +# 0737958b45be015d734769cd9b6fa5e7ce01409f. +Patch2: ejabberd-0002-Fix-compilation-issues-on-R19.patch # BZ# 439583, 452326, 451554, 465196, 502361 (fedora/epel-specific) # rbarlow: i'm not sure what this patch is for, but it does not apply cleanly #Patch3: ejabberd-0003-Fedora-specific-changes-to-ejabberdctl.patch @@ -108,6 +111,7 @@ Windows NT/2000/XP). %setup -q %patch1 -p1 -b .pam_name +%patch2 -p1 -b .fix_r19 %patch6 -p1 -b .use_polkit %patch7 -p1 -b .use_bindir @@ -121,7 +125,6 @@ autoreconf -ivf mkdir deps make -t deps make src REBAR=%__rebar -# make edoc %install @@ -277,6 +280,8 @@ fi) %changelog * Sat Jul 30 2016 Randy Barlow <randy@electronsweatshop.com> - 16.06.1-1 - Update to 16.01.1 (#1351186). +- Backport commit 0737958b to build on Erlang 19. +- Remove commented make edoc, since upstream no longer ships docs in this source. * Wed Jul 06 2016 Jeremy Cline <jeremy@jcline.org> - 16.06-1 - Update to 16.06 (#1351186) |