25
1
mirror of https://github.com/processone/ejabberd.git synced 2024-11-24 16:23:40 +01:00

Merge branch 'master' of github.com:processone/ejabberd

This commit is contained in:
Christophe Romain 2013-06-24 13:46:44 +02:00
commit 0e28e4b600
10 changed files with 439 additions and 209 deletions

View File

@ -261,8 +261,20 @@ dialyzer/ejabberd.plt:
-o dialyzer/ejabberd.log ebin; \ -o dialyzer/ejabberd.log ebin; \
status=$$? ; if [ $$status -ne 2 ]; then exit $$status; else exit 0; fi status=$$? ; if [ $$status -ne 2 ]; then exit $$status; else exit 0; fi
dialyzer: dialyzer/erlang.plt dialyzer/deps.plt dialyzer/ejabberd.plt erlang_plt: dialyzer/erlang.plt
@dialyzer --plts dialyzer/erlang.plt dialyzer/deps.plt dialyzer/ejabberd.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; \ --get_warnings -o dialyzer/error.log ebin; \
status=$$? ; if [ $$status -ne 2 ]; then exit $$status; else exit 0; fi status=$$? ; if [ $$status -ne 2 ]; then exit $$status; else exit 0; fi
@ -273,4 +285,5 @@ test:
$(REBAR) skip_deps=true ct $(REBAR) skip_deps=true ct
.PHONY: src doc edoc dialyzer Makefile TAGS clean clean-rel distclean rel \ .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

565
configure vendored

File diff suppressed because it is too large Load Diff

View File

@ -283,10 +283,7 @@ get_subscribed(FsmRef) ->
%%---------------------------------------------------------------------- %%----------------------------------------------------------------------
wait_for_stream({xmlstreamstart, _Name, Attrs}, StateData) -> wait_for_stream({xmlstreamstart, _Name, Attrs}, StateData) ->
DefaultLang = case ?MYLANG of DefaultLang = ?MYLANG,
undefined -> <<"en">>;
DL -> DL
end,
case xml:get_attr_s(<<"xmlns:stream">>, Attrs) of case xml:get_attr_s(<<"xmlns:stream">>, Attrs) of
?NS_STREAM -> ?NS_STREAM ->
Server = jlib:nameprep(xml:get_attr_s(<<"to">>, Attrs)), Server = jlib:nameprep(xml:get_attr_s(<<"to">>, Attrs)),

View File

@ -198,7 +198,7 @@ parse_headers(#state{request_method = Method,
undefined -> http; undefined -> http;
_ -> httph _ -> httph
end, end,
case erlang:decode_packet(PktType, Data) of case erlang:decode_packet(PktType, Data, []) of
{ok, Pkt, Rest} -> {ok, Pkt, Rest} ->
NewState = process_header(State#state{trail = Rest}, {ok, Pkt}), NewState = process_header(State#state{trail = Rest}, {ok, Pkt}),
case NewState#state.end_of_request of case NewState#state.end_of_request of
@ -293,9 +293,6 @@ process_header(State, Data) ->
#state{end_of_request = true, #state{end_of_request = true,
request_handlers = State#state.request_handlers} request_handlers = State#state.request_handlers}
end; end;
{error, _Reason} ->
#state{end_of_request = true,
request_handlers = State#state.request_handlers};
_ -> _ ->
#state{end_of_request = true, #state{end_of_request = true,
request_handlers = State#state.request_handlers} request_handlers = State#state.request_handlers}

View File

@ -102,7 +102,7 @@ change_shaper(Pid, Shaper) ->
reset_stream(Pid) -> do_call(Pid, reset_stream). 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) -> starttls(Pid, TLSSocket) ->
do_call(Pid, {starttls, TLSSocket}). do_call(Pid, {starttls, TLSSocket}).

View File

@ -62,8 +62,8 @@
%% once a server is temporarly blocked, it stay blocked for 60 seconds %% once a server is temporarly blocked, it stay blocked for 60 seconds
-record(s2s, {fromto = {<<"">>, <<"">>} :: {binary(), binary()}, -record(s2s, {fromto = {<<"">>, <<"">>} :: {binary(), binary()} | '_',
pid = self() :: pid() | '_', pid = self() :: pid() | '_' | '$1',
key = <<"">> :: binary() | '_'}). key = <<"">> :: binary() | '_'}).
-record(state, {}). -record(state, {}).

View File

@ -55,7 +55,7 @@
-type matchspec_atom() :: '_' | '$1' | '$2' | '$3'. -type matchspec_atom() :: '_' | '$1' | '$2' | '$3'.
-record(carboncopy,{us :: {binary(), binary()} | matchspec_atom(), -record(carboncopy,{us :: {binary(), binary()} | matchspec_atom(),
resource :: binary() | matchspec_atom(), resource :: binary() | matchspec_atom(),
version :: binary() }). version :: binary() | matchspec_atom()}).
is_carbon_copy(Packet) -> is_carbon_copy(Packet) ->
case xml:get_subtag(Packet, <<"sent">>) of case xml:get_subtag(Packet, <<"sent">>) of

View File

@ -60,8 +60,9 @@
opts = [] :: list() | '_'}). opts = [] :: list() | '_'}).
-record(muc_online_room, -record(muc_online_room,
{name_host = {<<"">>, <<"">>} :: {binary(), binary()} | '$1', {name_host = {<<"">>, <<"">>} :: {binary(), binary()} | '$1' |
pid = self() :: pid() | '$2' | '_'}). {'_', binary()} | '_',
pid = self() :: pid() | '$2' | '_' | '$1'}).
-record(muc_registered, -record(muc_registered,
{us_host = {{<<"">>, <<"">>}, <<"">>} :: {{binary(), binary()}, binary()} | '$1', {us_host = {{<<"">>, <<"">>}, <<"">>} :: {{binary(), binary()}, binary()} | '$1',
@ -1104,7 +1105,7 @@ update_tables(Host) ->
update_muc_room_table(Host), update_muc_room_table(Host),
update_muc_registered_table(Host). update_muc_registered_table(Host).
update_muc_room_table(Host) -> update_muc_room_table(_Host) ->
Fields = record_info(fields, muc_room), Fields = record_info(fields, muc_room),
case mnesia:table_info(muc_room, attributes) of case mnesia:table_info(muc_room, attributes) of
Fields -> Fields ->
@ -1122,7 +1123,7 @@ update_muc_room_table(Host) ->
mnesia:transform_table(muc_room, ignore, Fields) mnesia:transform_table(muc_room, ignore, Fields)
end. end.
update_muc_registered_table(Host) -> update_muc_registered_table(_Host) ->
Fields = record_info(fields, muc_registered), Fields = record_info(fields, muc_registered),
case mnesia:table_info(muc_registered, attributes) of case mnesia:table_info(muc_registered, attributes) of
Fields -> Fields ->

View File

@ -43,6 +43,7 @@
remove_old_messages/2, remove_old_messages/2,
remove_user/2, remove_user/2,
get_queue_length/2, get_queue_length/2,
get_offline_els/2,
webadmin_page/3, webadmin_page/3,
webadmin_user/4, webadmin_user/4,
webadmin_user_parse_query/5]). webadmin_user_parse_query/5]).
@ -520,6 +521,40 @@ webadmin_page(_, Host,
Res = user_queue(U, Host, Query, Lang), {stop, Res}; Res = user_queue(U, Host, Query, Lang), {stop, Res};
webadmin_page(Acc, _, _) -> Acc. 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) -> offline_msg_to_route(LServer, #offline_msg{} = R) ->
El = #xmlel{children = Els} = R#offline_msg.packet, El = #xmlel{children = Els} = R#offline_msg.packet,
{route, R#offline_msg.from, R#offline_msg.to, {route, R#offline_msg.from, R#offline_msg.to,

View File

@ -100,7 +100,7 @@ eprof_stop() ->
eprof:stop_profiling(), eprof:stop_profiling(),
case erlang:function_exported(eprof, analyse, 0) of case erlang:function_exported(eprof, analyse, 0) of
true -> true ->
eprof:analyse(); apply(eprof, analyse, []);
false -> false ->
eprof:analyze() eprof:analyze()
end. end.