25
1
mirror of https://github.com/processone/ejabberd.git synced 2024-11-28 16:34:13 +01:00

mod_http_upload: Make case indentation consistent

Use four spaces (or the corresponding amount of tab characters) for case
indentation everywhere in mod_http_upload and mod_http_upload_quota.
This commit is contained in:
Holger Weiss 2015-11-09 19:23:52 +01:00
parent 113c315857
commit 20709f9880
2 changed files with 300 additions and 292 deletions

View File

@ -141,7 +141,8 @@ start(ServerHost, Opts) ->
remove_user, 50),
ejabberd_hooks:add(anonymous_purge_hook, ServerHost, ?MODULE,
remove_user, 50);
false -> ok
false ->
ok
end,
Proc = get_proc_name(ServerHost, ?PROCNAME),
Spec = {Proc,
@ -163,7 +164,8 @@ stop(ServerHost) ->
remove_user, 50),
ejabberd_hooks:delete(anonymous_purge_hook, ServerHost, ?MODULE,
remove_user, 50);
false -> ok
false ->
ok
end,
Proc = get_proc_name(ServerHost, ?PROCNAME),
supervisor:terminate_child(ejabberd_sup, Proc),
@ -528,10 +530,12 @@ process_iq(From,
allow ->
case parse_request(SubEl, Lang) of
{ok, File, Size, ContentType} ->
case create_slot(State, From, File, Size, ContentType, Lang) of
case create_slot(State, From, File, Size, ContentType,
Lang) of
{ok, Slot} ->
{ok, Timer} = timer:send_after(?SLOT_TIMEOUT,
{slot_timed_out, Slot}),
{slot_timed_out,
Slot}),
NewState = add_slot(Slot, Size, Timer, State),
SlotEl = slot_el(Slot, State, XMLNS),
{IQ#iq{type = result, sub_el = [SlotEl]}, NewState};
@ -631,7 +635,8 @@ create_slot(#state{service_url = ServiceURL},
case httpc:request(get, {GetRequest, []}, HttpOptions, Options) of
{ok, {Code, Body}} when Code >= 200, Code =< 299 ->
case binary:split(Body, <<$\n>>, [global, trim]) of
[<<"http", _/binary>> = PutURL, <<"http", _/binary>> = GetURL] ->
[<<"http", _/binary>> = PutURL,
<<"http", _/binary>> = GetURL] ->
?INFO_MSG("Got HTTP upload slot for ~s (file: ~s)",
[jlib:jid_to_string(JID), File]),
{ok, PutURL, GetURL};

View File

@ -217,11 +217,13 @@ handle_info(sweep, #state{server_host = ServerHost,
{ok, Entries} ->
BackThen = secs_since_epoch() - (MaxDays * 86400),
DocRootS = binary_to_list(DocRoot),
PathNames = lists:map(fun(Entry) -> DocRootS ++ "/" ++ Entry end,
Entries),
PathNames = lists:map(fun(Entry) ->
DocRootS ++ "/" ++ Entry
end, Entries),
UserDirs = lists:filter(fun filelib:is_dir/1, PathNames),
lists:foreach(fun(UserDir) -> delete_old_files(UserDir, BackThen) end,
UserDirs);
lists:foreach(fun(UserDir) ->
delete_old_files(UserDir, BackThen)
end, UserDirs);
{error, Error} ->
?ERROR_MSG("Cannot open document root ~s: ~s",
[DocRoot, ?FORMAT(Error)])
@ -294,9 +296,9 @@ enforce_quota(UserDir, SlotSize, _OldSize, MinSize, MaxSize) ->
-spec delete_old_files(file:filename_all(), integer()) -> ok.
delete_old_files(UserDir, Timestamp) ->
delete_old_files(UserDir, CutOff) ->
FileInfo = gather_file_info(UserDir),
case [Path || {Path, _Size, Time} <- FileInfo, Time < Timestamp] of
case [Path || {Path, _Size, Time} <- FileInfo, Time < CutOff] of
[] ->
ok;
OldFiles ->
@ -314,7 +316,8 @@ gather_file_info(Dir) ->
{ok, Entries} ->
lists:foldl(fun(Entry, Acc) ->
Path = Dir ++ "/" ++ Entry,
case file:read_file_info(Path, [{time, posix}]) of
case file:read_file_info(Path,
[{time, posix}]) of
{ok, #file_info{type = directory}} ->
gather_file_info(Path) ++ Acc;
{ok, #file_info{type = regular,