mirror of
https://github.com/processone/ejabberd.git
synced 2024-11-22 16:20:52 +01:00
Fix some Dialyzer warnings
This commit is contained in:
parent
56b66ab64f
commit
c57f726ecb
@ -388,11 +388,11 @@ import_dir(Path) ->
|
|||||||
%%%
|
%%%
|
||||||
|
|
||||||
delete_expired_messages() ->
|
delete_expired_messages() ->
|
||||||
{atomic, ok} = mod_offline:remove_expired_messages(),
|
mod_offline:remove_expired_messages(),
|
||||||
ok.
|
ok.
|
||||||
|
|
||||||
delete_old_messages(Days) ->
|
delete_old_messages(Days) ->
|
||||||
{atomic, _} = mod_offline:remove_old_messages(Days),
|
mod_offline:remove_old_messages(Days),
|
||||||
ok.
|
ok.
|
||||||
|
|
||||||
|
|
||||||
|
@ -218,8 +218,8 @@ process_local_iq(_From, _To, #iq{type = set} = IQ_Rec) ->
|
|||||||
|
|
||||||
|
|
||||||
process_sm_iq(_From, To, #iq{type = get} = IQ_Rec) ->
|
process_sm_iq(_From, To, #iq{type = get} = IQ_Rec) ->
|
||||||
LUser = exmpp_jid:prep_node_as_list(To),
|
LUser = exmpp_jid:prep_node(To),
|
||||||
LServer = exmpp_jid:prep_domain_as_list(To),
|
LServer = exmpp_jid:prep_domain(To),
|
||||||
case get_vcard(LUser, LServer) of
|
case get_vcard(LUser, LServer) of
|
||||||
{vcard, VCard} ->
|
{vcard, VCard} ->
|
||||||
exmpp_iq:result(IQ_Rec, VCard);
|
exmpp_iq:result(IQ_Rec, VCard);
|
||||||
@ -229,15 +229,16 @@ process_sm_iq(_From, To, #iq{type = get} = IQ_Rec) ->
|
|||||||
process_sm_iq(From, _To, #iq{type = set, payload = Request} = IQ_Rec) ->
|
process_sm_iq(From, _To, #iq{type = set, payload = Request} = IQ_Rec) ->
|
||||||
User = exmpp_jid:node_as_list(From),
|
User = exmpp_jid:node_as_list(From),
|
||||||
LServer = exmpp_jid:prep_domain_as_list(From),
|
LServer = exmpp_jid:prep_domain_as_list(From),
|
||||||
|
LServerB = exmpp_jid:prep_domain(From),
|
||||||
case ?IS_MY_HOST(LServer) of
|
case ?IS_MY_HOST(LServer) of
|
||||||
true ->
|
true ->
|
||||||
set_vcard(User, LServer, Request),
|
set_vcard(User, LServer, LServerB, Request),
|
||||||
exmpp_iq:result(IQ_Rec);
|
exmpp_iq:result(IQ_Rec);
|
||||||
false ->
|
false ->
|
||||||
exmpp_iq:error(IQ_Rec, 'not-allowed')
|
exmpp_iq:error(IQ_Rec, 'not-allowed')
|
||||||
end.
|
end.
|
||||||
|
|
||||||
%% @spec (User::string(), Host::string()) -> {vcard, xmlel()} | novcard
|
%% @spec (User::binary(), Host::binary()) -> {vcard, xmlel()} | novcard
|
||||||
get_vcard(User, Host) ->
|
get_vcard(User, Host) ->
|
||||||
US = {User, Host},
|
US = {User, Host},
|
||||||
case gen_storage:dirty_read(Host, {vcard, US}) of
|
case gen_storage:dirty_read(Host, {vcard, US}) of
|
||||||
@ -253,7 +254,7 @@ get_vcard(User, Host) ->
|
|||||||
end.
|
end.
|
||||||
|
|
||||||
|
|
||||||
set_vcard(User, LServer, VCARD) ->
|
set_vcard(User, LServer, LServerB, VCARD) ->
|
||||||
FN = exmpp_xml:get_path(VCARD,
|
FN = exmpp_xml:get_path(VCARD,
|
||||||
[{element, 'FN'}, cdata_as_list]),
|
[{element, 'FN'}, cdata_as_list]),
|
||||||
Family = exmpp_xml:get_path(VCARD,
|
Family = exmpp_xml:get_path(VCARD,
|
||||||
@ -301,14 +302,14 @@ set_vcard(User, LServer, VCARD) ->
|
|||||||
|
|
||||||
US = {LUser, LServer},
|
US = {LUser, LServer},
|
||||||
|
|
||||||
VcardToStore = case gen_storage:table_info(LServer, vcard, backend) of
|
VcardToStore = case gen_storage:table_info(LServerB, vcard, backend) of
|
||||||
mnesia -> VCARD;
|
mnesia -> VCARD;
|
||||||
odbc -> lists:flatten(exmpp_xml:document_to_list(VCARD))
|
odbc -> lists:flatten(exmpp_xml:document_to_list(VCARD))
|
||||||
end,
|
end,
|
||||||
|
|
||||||
F = fun() ->
|
F = fun() ->
|
||||||
gen_storage:write(LServer, #vcard{user_host = US, vcard = VcardToStore}),
|
gen_storage:write(LServerB, #vcard{user_host = US, vcard = VcardToStore}),
|
||||||
gen_storage:write(LServer,
|
gen_storage:write(LServerB,
|
||||||
#vcard_search{user_host=US,
|
#vcard_search{user_host=US,
|
||||||
username = User, lusername = LUser,
|
username = User, lusername = LUser,
|
||||||
fn = FN, lfn = LFN,
|
fn = FN, lfn = LFN,
|
||||||
@ -324,8 +325,8 @@ set_vcard(User, LServer, VCARD) ->
|
|||||||
orgunit = OrgUnit, lorgunit = LOrgUnit
|
orgunit = OrgUnit, lorgunit = LOrgUnit
|
||||||
})
|
})
|
||||||
end,
|
end,
|
||||||
gen_storage:transaction(LServer, vcard, F),
|
|
||||||
LServerB = list_to_binary(LServer),
|
LServerB = list_to_binary(LServer),
|
||||||
|
gen_storage:transaction(LServerB, vcard, F),
|
||||||
ejabberd_hooks:run(vcard_set, LServerB, [list_to_binary(LUser), LServerB, VCARD])
|
ejabberd_hooks:run(vcard_set, LServerB, [list_to_binary(LUser), LServerB, VCARD])
|
||||||
catch
|
catch
|
||||||
_ ->
|
_ ->
|
||||||
@ -729,10 +730,10 @@ remove_user(User, Server) when is_binary(User), is_binary(Server) ->
|
|||||||
LServer = binary_to_list(exmpp_stringprep:nameprep(Server)),
|
LServer = binary_to_list(exmpp_stringprep:nameprep(Server)),
|
||||||
US = {LUser, LServer},
|
US = {LUser, LServer},
|
||||||
F = fun() ->
|
F = fun() ->
|
||||||
gen_storage:delete(LServer, {vcard, US}),
|
gen_storage:delete(Server, {vcard, US}),
|
||||||
gen_storage:delete(LServer, {vcard_search, US})
|
gen_storage:delete(Server, {vcard_search, US})
|
||||||
end,
|
end,
|
||||||
gen_storage:transaction(LServer, vcard, F).
|
gen_storage:transaction(Server, vcard, F).
|
||||||
|
|
||||||
|
|
||||||
%%%
|
%%%
|
||||||
@ -892,6 +893,7 @@ get_user_photo(User, Host) ->
|
|||||||
|
|
||||||
user_queue_parse_query(US, Query) ->
|
user_queue_parse_query(US, Query) ->
|
||||||
{User, Server} = US,
|
{User, Server} = US,
|
||||||
|
?INFO_MSG("Query vcard: ~p", [Query]), %+++
|
||||||
case lists:keysearch("removevcard", 1, Query) of
|
case lists:keysearch("removevcard", 1, Query) of
|
||||||
{value, _} ->
|
{value, _} ->
|
||||||
case remove_user(list_to_binary(User), list_to_binary(Server)) of
|
case remove_user(list_to_binary(User), list_to_binary(Server)) of
|
||||||
|
@ -466,10 +466,6 @@ search(LServer, Data) ->
|
|||||||
MatchSpec = make_matchspec(LServer, Data),
|
MatchSpec = make_matchspec(LServer, Data),
|
||||||
AllowReturnAll = gen_mod:get_module_opt(LServer, ?MODULE,
|
AllowReturnAll = gen_mod:get_module_opt(LServer, ?MODULE,
|
||||||
allow_return_all, false),
|
allow_return_all, false),
|
||||||
if
|
|
||||||
(MatchSpec == "") and (not AllowReturnAll) ->
|
|
||||||
[];
|
|
||||||
true ->
|
|
||||||
Limit = case gen_mod:get_module_opt(LServer, ?MODULE,
|
Limit = case gen_mod:get_module_opt(LServer, ?MODULE,
|
||||||
matches, ?JUD_MATCHES) of
|
matches, ?JUD_MATCHES) of
|
||||||
infinity ->
|
infinity ->
|
||||||
@ -491,7 +487,6 @@ search(LServer, Data) ->
|
|||||||
Error ->
|
Error ->
|
||||||
?ERROR_MSG("~p", [Error]),
|
?ERROR_MSG("~p", [Error]),
|
||||||
[]
|
[]
|
||||||
end
|
|
||||||
end.
|
end.
|
||||||
|
|
||||||
|
|
||||||
@ -500,12 +495,7 @@ make_matchspec(LServer, Data) ->
|
|||||||
filter_fields(Data, ["host = '", Host, "'"], LServer).
|
filter_fields(Data, ["host = '", Host, "'"], LServer).
|
||||||
|
|
||||||
filter_fields([], Match, _LServer) ->
|
filter_fields([], Match, _LServer) ->
|
||||||
case Match of
|
[" where ", Match];
|
||||||
"" ->
|
|
||||||
"";
|
|
||||||
_ ->
|
|
||||||
[" where ", Match]
|
|
||||||
end;
|
|
||||||
filter_fields([{SVar, [Val]} | Ds], Match, LServer)
|
filter_fields([{SVar, [Val]} | Ds], Match, LServer)
|
||||||
when is_list(Val) and (Val /= "") ->
|
when is_list(Val) and (Val /= "") ->
|
||||||
LVal = exmpp_stringprep:to_lower(Val),
|
LVal = exmpp_stringprep:to_lower(Val),
|
||||||
@ -539,12 +529,7 @@ make_val(Match, Field, Val) ->
|
|||||||
SVal = ejabberd_odbc:escape(Val),
|
SVal = ejabberd_odbc:escape(Val),
|
||||||
[Field, " = '", SVal, "'"]
|
[Field, " = '", SVal, "'"]
|
||||||
end,
|
end,
|
||||||
case Match of
|
[Match, " and ", Condition].
|
||||||
"" ->
|
|
||||||
Condition;
|
|
||||||
_ ->
|
|
||||||
[Match, " and ", Condition]
|
|
||||||
end.
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user