Skip to content

Commit

Permalink
Fix compilation issues on R19
Browse files Browse the repository at this point in the history
  • Loading branch information
prefiks committed Jul 1, 2016
1 parent 024124d commit 0737958
Show file tree
Hide file tree
Showing 10 changed files with 199 additions and 538 deletions.
6 changes: 3 additions & 3 deletions rebar.config
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@
%%% Created : 1 May 2013 by Evgeniy Khramtsov <ekhramtsov@process-one.net>
%%%-------------------------------------------------------------------

{deps, [{lager, ".*", {git, "https://github.com/basho/lager", {tag, "3.0.2"}}},
{deps, [{lager, ".*", {git, "https://github.com/basho/lager", {tag, "3.2.1"}}},
{p1_utils, ".*", {git, "https://github.com/processone/p1_utils", {tag, "1.0.4"}}},
{cache_tab, ".*", {git, "https://github.com/processone/cache_tab", {tag, "1.0.3"}}},
{fast_tls, ".*", {git, "https://github.com/processone/fast_tls", {tag, "1.0.5"}}},
{stringprep, ".*", {git, "https://github.com/processone/stringprep", {tag, "1.0.4"}}},
{fast_xml, ".*", {git, "https://github.com/processone/fast_xml", {tag, "1.1.13"}}},
{fast_xml, ".*", {git, "https://github.com/processone/fast_xml", {tag, "1.1.14"}}},
{stun, ".*", {git, "https://github.com/processone/stun", {tag, "1.0.5"}}},
{esip, ".*", {git, "https://github.com/processone/esip", {tag, "1.0.6"}}},
{fast_yaml, ".*", {git, "https://github.com/processone/fast_yaml", {tag, "1.0.4"}}},
Expand All @@ -34,7 +34,7 @@
"527722d12d0433b837cdb92a60900c2cb5df8942"}}},
%% Forces correct dependency for riakc and allow using newer meck version)
{if_var_true, riak, {hamcrest, ".*", {git, "https://github.com/hyperthunk/hamcrest-erlang",
"908a24fda4a46776a5135db60ca071e3d783f9f6"}}}, % for riak_pb-2.1.0.7
"13f9bfb9b27d216e8e033b0e0a9a29097ed923dd"}}}, % for riak_pb-2.1.0.7
{if_var_true, riak, {protobuffs, ".*", {git, "https://github.com/basho/erlang_protobuffs",
"6e7fc924506e2dc166a6170e580ce1d95ebbd5bd"}}}, % for riak_pb-2.1.0.7 with correct meck dependency
%% Elixir support, needed to run tests
Expand Down
23 changes: 5 additions & 18 deletions src/adhoc.erl
Original file line number Diff line number Diff line change
Expand Up @@ -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...", []),
Expand Down Expand Up @@ -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.
Expand All @@ -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{
Expand Down
28 changes: 5 additions & 23 deletions src/cyrsasl.erl
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -213,24 +204,15 @@ 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
true -> 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(
Expand Down
2 changes: 1 addition & 1 deletion src/ejabberd_config.erl
Original file line number Diff line number Diff line change
Expand Up @@ -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})).
Expand Down
47 changes: 13 additions & 34 deletions src/jlib.erl
Original file line number Diff line number Diff line change
Expand Up @@ -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).
Expand Down Expand Up @@ -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 /= <<"">> ->
Expand All @@ -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
Expand All @@ -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}
Expand All @@ -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) ->
Expand Down
Loading

0 comments on commit 0737958

Please sign in to comment.