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
fc3939c8a9
commit
f9390f3e9a
@ -283,10 +283,7 @@ get_subscribed(FsmRef) ->
|
||||
%%----------------------------------------------------------------------
|
||||
|
||||
wait_for_stream({xmlstreamstart, _Name, Attrs}, StateData) ->
|
||||
DefaultLang = case ?MYLANG of
|
||||
undefined -> <<"en">>;
|
||||
DL -> DL
|
||||
end,
|
||||
DefaultLang = ?MYLANG,
|
||||
case xml:get_attr_s(<<"xmlns:stream">>, Attrs) of
|
||||
?NS_STREAM ->
|
||||
Server = jlib:nameprep(xml:get_attr_s(<<"to">>, Attrs)),
|
||||
|
@ -198,7 +198,7 @@ parse_headers(#state{request_method = Method,
|
||||
undefined -> http;
|
||||
_ -> httph
|
||||
end,
|
||||
case erlang:decode_packet(PktType, Data) of
|
||||
case erlang:decode_packet(PktType, Data, []) of
|
||||
{ok, Pkt, Rest} ->
|
||||
NewState = process_header(State#state{trail = Rest}, {ok, Pkt}),
|
||||
case NewState#state.end_of_request of
|
||||
|
@ -102,7 +102,7 @@ change_shaper(Pid, Shaper) ->
|
||||
|
||||
reset_stream(Pid) -> do_call(Pid, reset_stream).
|
||||
|
||||
-spec starttls(pid(), iodata()) -> {ok, p1_tls:tls_socket()} | {error, any()}.
|
||||
-spec starttls(pid(), p1_tls:tls_socket()) -> ok.
|
||||
|
||||
starttls(Pid, TLSSocket) ->
|
||||
do_call(Pid, {starttls, TLSSocket}).
|
||||
|
@ -62,8 +62,8 @@
|
||||
|
||||
%% once a server is temporarly blocked, it stay blocked for 60 seconds
|
||||
|
||||
-record(s2s, {fromto = {<<"">>, <<"">>} :: {binary(), binary()},
|
||||
pid = self() :: pid() | '_',
|
||||
-record(s2s, {fromto = {<<"">>, <<"">>} :: {binary(), binary()} | '_',
|
||||
pid = self() :: pid() | '_' | '$1',
|
||||
key = <<"">> :: binary() | '_'}).
|
||||
|
||||
-record(state, {}).
|
||||
|
@ -60,8 +60,9 @@
|
||||
opts = [] :: list() | '_'}).
|
||||
|
||||
-record(muc_online_room,
|
||||
{name_host = {<<"">>, <<"">>} :: {binary(), binary()} | '$1',
|
||||
pid = self() :: pid() | '$2' | '_'}).
|
||||
{name_host = {<<"">>, <<"">>} :: {binary(), binary()} | '$1' |
|
||||
{'_', binary()} | '_',
|
||||
pid = self() :: pid() | '$2' | '_' | '$1'}).
|
||||
|
||||
-record(muc_registered,
|
||||
{us_host = {{<<"">>, <<"">>}, <<"">>} :: {{binary(), binary()}, binary()} | '$1',
|
||||
@ -1104,7 +1105,7 @@ update_tables(Host) ->
|
||||
update_muc_room_table(Host),
|
||||
update_muc_registered_table(Host).
|
||||
|
||||
update_muc_room_table(Host) ->
|
||||
update_muc_room_table(_Host) ->
|
||||
Fields = record_info(fields, muc_room),
|
||||
case mnesia:table_info(muc_room, attributes) of
|
||||
Fields ->
|
||||
@ -1122,7 +1123,7 @@ update_muc_room_table(Host) ->
|
||||
mnesia:transform_table(muc_room, ignore, Fields)
|
||||
end.
|
||||
|
||||
update_muc_registered_table(Host) ->
|
||||
update_muc_registered_table(_Host) ->
|
||||
Fields = record_info(fields, muc_registered),
|
||||
case mnesia:table_info(muc_registered, attributes) of
|
||||
Fields ->
|
||||
|
@ -43,6 +43,7 @@
|
||||
remove_old_messages/2,
|
||||
remove_user/2,
|
||||
get_queue_length/2,
|
||||
get_offline_els/2,
|
||||
webadmin_page/3,
|
||||
webadmin_user/4,
|
||||
webadmin_user_parse_query/5]).
|
||||
@ -520,6 +521,40 @@ webadmin_page(_, Host,
|
||||
Res = user_queue(U, Host, Query, Lang), {stop, Res};
|
||||
webadmin_page(Acc, _, _) -> Acc.
|
||||
|
||||
get_offline_els(LUser, LServer) ->
|
||||
get_offline_els(LUser, LServer, gen_mod:db_type(LServer, ?MODULE)).
|
||||
|
||||
get_offline_els(LUser, LServer, mnesia) ->
|
||||
Msgs = read_all_msgs(LUser, LServer, mnesia),
|
||||
lists:map(
|
||||
fun(Msg) ->
|
||||
{route, From, To, Packet} = offline_msg_to_route(LServer, Msg),
|
||||
jlib:replace_from_to(From, To, Packet)
|
||||
end, Msgs);
|
||||
get_offline_els(LUser, LServer, odbc) ->
|
||||
Username = ejabberd_odbc:escape(LUser),
|
||||
case catch ejabberd_odbc:sql_query(LServer,
|
||||
[<<"select xml from spool where username='">>,
|
||||
Username, <<"' order by seq;">>]) of
|
||||
{selected, [<<"xml">>], Rs} ->
|
||||
lists:flatmap(
|
||||
fun([XML]) ->
|
||||
case xml_stream:parse_element(XML) of
|
||||
#xmlel{} = El ->
|
||||
case offline_msg_to_route(LServer, El) of
|
||||
{route, _, _, NewEl} ->
|
||||
[NewEl];
|
||||
error ->
|
||||
[]
|
||||
end;
|
||||
_ ->
|
||||
[]
|
||||
end
|
||||
end, Rs);
|
||||
_ ->
|
||||
[]
|
||||
end.
|
||||
|
||||
offline_msg_to_route(LServer, #offline_msg{} = R) ->
|
||||
El = #xmlel{children = Els} = R#offline_msg.packet,
|
||||
{route, R#offline_msg.from, R#offline_msg.to,
|
||||
|
Loading…
Reference in New Issue
Block a user