mirror of
https://github.com/processone/ejabberd.git
synced 2024-11-20 16:15:59 +01:00
Merge branch 'master' of github.com:processone/ejabberd
This commit is contained in:
commit
0e28e4b600
19
Makefile.in
19
Makefile.in
@ -261,8 +261,20 @@ dialyzer/ejabberd.plt:
|
||||
-o dialyzer/ejabberd.log ebin; \
|
||||
status=$$? ; if [ $$status -ne 2 ]; then exit $$status; else exit 0; fi
|
||||
|
||||
dialyzer: dialyzer/erlang.plt dialyzer/deps.plt dialyzer/ejabberd.plt
|
||||
@dialyzer --plts dialyzer/erlang.plt dialyzer/deps.plt dialyzer/ejabberd.plt \
|
||||
erlang_plt: dialyzer/erlang.plt
|
||||
@dialyzer --plt dialyzer/erlang.plt --check_plt -o dialyzer/erlang.log; \
|
||||
status=$$? ; if [ $$status -ne 2 ]; then exit $$status; else exit 0; fi
|
||||
|
||||
deps_plt: dialyzer/deps.plt
|
||||
@dialyzer --plt dialyzer/deps.plt --check_plt -o dialyzer/deps.log; \
|
||||
status=$$? ; if [ $$status -ne 2 ]; then exit $$status; else exit 0; fi
|
||||
|
||||
ejabberd_plt: dialyzer/ejabberd.plt
|
||||
@dialyzer --plt dialyzer/ejabberd.plt --check_plt -o dialyzer/ejabberd.log; \
|
||||
status=$$? ; if [ $$status -ne 2 ]; then exit $$status; else exit 0; fi
|
||||
|
||||
dialyzer: erlang_plt deps_plt ejabberd_plt
|
||||
@dialyzer --plts dialyzer/*.plt --no_check_plt \
|
||||
--get_warnings -o dialyzer/error.log ebin; \
|
||||
status=$$? ; if [ $$status -ne 2 ]; then exit $$status; else exit 0; fi
|
||||
|
||||
@ -273,4 +285,5 @@ test:
|
||||
$(REBAR) skip_deps=true ct
|
||||
|
||||
.PHONY: src doc edoc dialyzer Makefile TAGS clean clean-rel distclean rel \
|
||||
install uninstall uninstall-binary uninstall-all translations deps test spec
|
||||
install uninstall uninstall-binary uninstall-all translations deps test spec \
|
||||
erlang_plt deps_plt ejabberd_plt
|
||||
|
@ -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
|
||||
@ -293,9 +293,6 @@ process_header(State, Data) ->
|
||||
#state{end_of_request = true,
|
||||
request_handlers = State#state.request_handlers}
|
||||
end;
|
||||
{error, _Reason} ->
|
||||
#state{end_of_request = true,
|
||||
request_handlers = State#state.request_handlers};
|
||||
_ ->
|
||||
#state{end_of_request = true,
|
||||
request_handlers = State#state.request_handlers}
|
||||
|
@ -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, {}).
|
||||
|
@ -55,7 +55,7 @@
|
||||
-type matchspec_atom() :: '_' | '$1' | '$2' | '$3'.
|
||||
-record(carboncopy,{us :: {binary(), binary()} | matchspec_atom(),
|
||||
resource :: binary() | matchspec_atom(),
|
||||
version :: binary() }).
|
||||
version :: binary() | matchspec_atom()}).
|
||||
|
||||
is_carbon_copy(Packet) ->
|
||||
case xml:get_subtag(Packet, <<"sent">>) of
|
||||
|
@ -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,
|
||||
|
@ -100,7 +100,7 @@ eprof_stop() ->
|
||||
eprof:stop_profiling(),
|
||||
case erlang:function_exported(eprof, analyse, 0) of
|
||||
true ->
|
||||
eprof:analyse();
|
||||
apply(eprof, analyse, []);
|
||||
false ->
|
||||
eprof:analyze()
|
||||
end.
|
||||
|
Loading…
Reference in New Issue
Block a user