Fix specs and other errores detected by Dialyzer
This commit is contained in:
parent
6adfc2cec5
commit
35d05f2925
|
@ -126,7 +126,7 @@ try_register(LUser, LServer, Password) ->
|
||||||
false -> Password
|
false -> Password
|
||||||
end,
|
end,
|
||||||
case make_req(post, <<"register">>, LUser, LServer, PasswordFinal) of
|
case make_req(post, <<"register">>, LUser, LServer, PasswordFinal) of
|
||||||
{ok, created} -> {cache, {ok, Password}};
|
{ok, <<"created">>} -> {cache, {ok, Password}};
|
||||||
{error, conflict} -> {nocache, {error, exists}};
|
{error, conflict} -> {nocache, {error, exists}};
|
||||||
_Error -> {nocache, {error, not_allowed}}
|
_Error -> {nocache, {error, not_allowed}}
|
||||||
end.
|
end.
|
||||||
|
@ -220,7 +220,7 @@ make_req(Method, Path, LUser, LServer, Password) ->
|
||||||
<<"400">> -> {error, RespBody};
|
<<"400">> -> {error, RespBody};
|
||||||
<<"503">> -> {error, RespBody};
|
<<"503">> -> {error, RespBody};
|
||||||
<<"204">> -> {ok, <<"">>};
|
<<"204">> -> {ok, <<"">>};
|
||||||
<<"201">> -> {ok, created};
|
<<"201">> -> {ok, <<"created">>};
|
||||||
<<"200">> -> {ok, RespBody};
|
<<"200">> -> {ok, RespBody};
|
||||||
_ -> {error, RespBody}
|
_ -> {error, RespBody}
|
||||||
end.
|
end.
|
||||||
|
|
|
@ -87,6 +87,6 @@ register_user(LUser, LServer) ->
|
||||||
%%--------------------------------------------------------------------
|
%%--------------------------------------------------------------------
|
||||||
%% Internal functions.
|
%% Internal functions.
|
||||||
%%--------------------------------------------------------------------
|
%%--------------------------------------------------------------------
|
||||||
-spec build_bookmark(jid(), boolean()) -> bookmark_storage().
|
-spec build_bookmark(jid(), boolean()) -> bookmark_conference().
|
||||||
build_bookmark(Room, AutoJoin) ->
|
build_bookmark(Room, AutoJoin) ->
|
||||||
#bookmark_conference{jid = Room, autojoin = AutoJoin}.
|
#bookmark_conference{jid = Room, autojoin = AutoJoin}.
|
||||||
|
|
|
@ -195,7 +195,7 @@ find_omemo_nodes(#ps_publish{node = Node, items = Items}) ->
|
||||||
find_omemo_nodes(_) ->
|
find_omemo_nodes(_) ->
|
||||||
[].
|
[].
|
||||||
|
|
||||||
-spec find_omemo_nodes(binary(), ps_items()) -> [binary()].
|
-spec find_omemo_nodes(binary(), [ps_item()]) -> [binary()].
|
||||||
find_omemo_nodes(<<?DEVICELIST_NODE>> = Node, [Item]) ->
|
find_omemo_nodes(<<?DEVICELIST_NODE>> = Node, [Item]) ->
|
||||||
[Node | find_bundle_nodes(Item)];
|
[Node | find_bundle_nodes(Item)];
|
||||||
find_omemo_nodes(<<?DEVICELIST_NODE>> = Node, []) ->
|
find_omemo_nodes(<<?DEVICELIST_NODE>> = Node, []) ->
|
||||||
|
|
|
@ -67,7 +67,7 @@
|
||||||
%% -------------------------------------------------------------------
|
%% -------------------------------------------------------------------
|
||||||
%% gen_mod callbacks.
|
%% gen_mod callbacks.
|
||||||
%% -------------------------------------------------------------------
|
%% -------------------------------------------------------------------
|
||||||
-spec start(binary(), gen_mod:opts()) -> {ok, _} | {ok, _, _} | {error, _}.
|
-spec start(binary(), gen_mod:opts()) -> ok | {ok, pid()} | {error, term()}.
|
||||||
start(Host, Opts) ->
|
start(Host, Opts) ->
|
||||||
ejabberd_hooks:add(user_send_packet, Host, ?MODULE,
|
ejabberd_hooks:add(user_send_packet, Host, ?MODULE,
|
||||||
log_packet_send, 42),
|
log_packet_send, 42),
|
||||||
|
@ -75,7 +75,7 @@ start(Host, Opts) ->
|
||||||
log_packet_receive, 42),
|
log_packet_receive, 42),
|
||||||
ejabberd_hooks:add(offline_message_hook, Host, ?MODULE,
|
ejabberd_hooks:add(offline_message_hook, Host, ?MODULE,
|
||||||
log_packet_offline, 42),
|
log_packet_offline, 42),
|
||||||
case gen_mod:start_child(?MODULE, global, Opts) of
|
case gen_mod:start_child(?MODULE, <<"global">>, Opts) of
|
||||||
{ok, Ref} ->
|
{ok, Ref} ->
|
||||||
{ok, Ref};
|
{ok, Ref};
|
||||||
{error, {already_started, Ref}} ->
|
{error, {already_started, Ref}} ->
|
||||||
|
@ -92,10 +92,10 @@ stop(Host) ->
|
||||||
log_packet_receive, 42),
|
log_packet_receive, 42),
|
||||||
ejabberd_hooks:delete(offline_message_hook, Host, ?MODULE,
|
ejabberd_hooks:delete(offline_message_hook, Host, ?MODULE,
|
||||||
log_packet_offline, 42),
|
log_packet_offline, 42),
|
||||||
gen_mod:stop_child(?MODULE, global),
|
gen_mod:stop_child(gen_mod:get_module_proc(global, ?MODULE)),
|
||||||
ok.
|
ok.
|
||||||
|
|
||||||
-spec mod_opt_type(atom()) -> fun((term()) -> term()).
|
-spec mod_opt_type(atom()) -> econf:validator().
|
||||||
mod_opt_type(filename) ->
|
mod_opt_type(filename) ->
|
||||||
econf:either(auto, econf:file(write)).
|
econf:either(auto, econf:file(write)).
|
||||||
|
|
||||||
|
@ -210,7 +210,7 @@ log_packet(Direction, #message{from = From, to = To, type = Type} = Msg) ->
|
||||||
|
|
||||||
-spec is_carbon(message()) -> {true, direction()} | false.
|
-spec is_carbon(message()) -> {true, direction()} | false.
|
||||||
is_carbon(#message{meta = #{carbon_copy := true}} = Msg) ->
|
is_carbon(#message{meta = #{carbon_copy := true}} = Msg) ->
|
||||||
case xmpp:has_subtag(Msg, #carbons_sent{}) of
|
case xmpp:has_subtag(Msg, #carbons_sent{forwarded = #forwarded{}}) of
|
||||||
true ->
|
true ->
|
||||||
{true, outgoing};
|
{true, outgoing};
|
||||||
false ->
|
false ->
|
||||||
|
|
Loading…
Reference in New Issue