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:
		
							parent
							
								
									0a24936e92
								
							
						
					
					
						commit
						ea4964dccd
					
				| @ -123,7 +123,8 @@ start(ServerHost, Opts) -> | |||||||
| 			       remove_user, 50), | 			       remove_user, 50), | ||||||
| 	    ejabberd_hooks:add(anonymous_purge_hook, ServerHost, ?MODULE, | 	    ejabberd_hooks:add(anonymous_purge_hook, ServerHost, ?MODULE, | ||||||
| 			       remove_user, 50); | 			       remove_user, 50); | ||||||
|       false -> ok | 	false -> | ||||||
|  | 	    ok | ||||||
|     end, |     end, | ||||||
|     Proc = get_proc_name(ServerHost, ?PROCNAME), |     Proc = get_proc_name(ServerHost, ?PROCNAME), | ||||||
|     Spec = {Proc, |     Spec = {Proc, | ||||||
| @ -145,7 +146,8 @@ stop(ServerHost) -> | |||||||
| 				  remove_user, 50), | 				  remove_user, 50), | ||||||
| 	    ejabberd_hooks:delete(anonymous_purge_hook, ServerHost, ?MODULE, | 	    ejabberd_hooks:delete(anonymous_purge_hook, ServerHost, ?MODULE, | ||||||
| 				  remove_user, 50); | 				  remove_user, 50); | ||||||
|       false -> ok | 	false -> | ||||||
|  | 	    ok | ||||||
|     end, |     end, | ||||||
|     Proc = get_proc_name(ServerHost, ?PROCNAME), |     Proc = get_proc_name(ServerHost, ?PROCNAME), | ||||||
|     supervisor:terminate_child(ejabberd_sup, Proc), |     supervisor:terminate_child(ejabberd_sup, Proc), | ||||||
| @ -510,10 +512,12 @@ process_iq(From, | |||||||
| 	allow -> | 	allow -> | ||||||
| 	    case parse_request(SubEl, Lang) of | 	    case parse_request(SubEl, Lang) of | ||||||
| 		{ok, File, Size, ContentType} -> | 		{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, Slot} -> | ||||||
| 			    {ok, Timer} = timer:send_after(?SLOT_TIMEOUT, | 			    {ok, Timer} = timer:send_after(?SLOT_TIMEOUT, | ||||||
| 						     {slot_timed_out, Slot}), | 							   {slot_timed_out, | ||||||
|  | 							    Slot}), | ||||||
| 			    NewState = add_slot(Slot, Size, Timer, State), | 			    NewState = add_slot(Slot, Size, Timer, State), | ||||||
| 			    SlotEl = slot_el(Slot, State, XMLNS), | 			    SlotEl = slot_el(Slot, State, XMLNS), | ||||||
| 			    {IQ#iq{type = result, sub_el = [SlotEl]}, NewState}; | 			    {IQ#iq{type = result, sub_el = [SlotEl]}, NewState}; | ||||||
| @ -613,7 +617,8 @@ create_slot(#state{service_url = ServiceURL}, | |||||||
|     case httpc:request(get, {GetRequest, []}, HttpOptions, Options) of |     case httpc:request(get, {GetRequest, []}, HttpOptions, Options) of | ||||||
| 	{ok, {Code, Body}} when Code >= 200, Code =< 299 -> | 	{ok, {Code, Body}} when Code >= 200, Code =< 299 -> | ||||||
| 	    case binary:split(Body, <<$\n>>, [global, trim]) of | 	    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)", | 		    ?INFO_MSG("Got HTTP upload slot for ~s (file: ~s)", | ||||||
| 			      [jlib:jid_to_string(JID), File]), | 			      [jlib:jid_to_string(JID), File]), | ||||||
| 		    {ok, PutURL, GetURL}; | 		    {ok, PutURL, GetURL}; | ||||||
|  | |||||||
| @ -199,11 +199,13 @@ handle_info(sweep, #state{server_host = ServerHost, | |||||||
| 	{ok, Entries} -> | 	{ok, Entries} -> | ||||||
| 	    BackThen = secs_since_epoch() - (MaxDays * 86400), | 	    BackThen = secs_since_epoch() - (MaxDays * 86400), | ||||||
| 	    DocRootS = binary_to_list(DocRoot), | 	    DocRootS = binary_to_list(DocRoot), | ||||||
| 	  PathNames = lists:map(fun(Entry) -> DocRootS ++ "/" ++ Entry end, | 	    PathNames = lists:map(fun(Entry) -> | ||||||
| 				Entries), | 					  DocRootS ++ "/" ++ Entry | ||||||
|  | 				  end, Entries), | ||||||
| 	    UserDirs = lists:filter(fun filelib:is_dir/1, PathNames), | 	    UserDirs = lists:filter(fun filelib:is_dir/1, PathNames), | ||||||
| 	  lists:foreach(fun(UserDir) -> delete_old_files(UserDir, BackThen) end, | 	    lists:foreach(fun(UserDir) -> | ||||||
| 			UserDirs); | 				  delete_old_files(UserDir, BackThen) | ||||||
|  | 			  end, UserDirs); | ||||||
| 	{error, Error} -> | 	{error, Error} -> | ||||||
| 	    ?ERROR_MSG("Cannot open document root ~s: ~s", | 	    ?ERROR_MSG("Cannot open document root ~s: ~s", | ||||||
| 		       [DocRoot, ?FORMAT(Error)]) | 		       [DocRoot, ?FORMAT(Error)]) | ||||||
| @ -276,9 +278,9 @@ enforce_quota(UserDir, SlotSize, _OldSize, MinSize, MaxSize) -> | |||||||
| 
 | 
 | ||||||
| -spec delete_old_files(file:filename_all(), integer()) -> ok. | -spec delete_old_files(file:filename_all(), integer()) -> ok. | ||||||
| 
 | 
 | ||||||
| delete_old_files(UserDir, Timestamp) -> | delete_old_files(UserDir, CutOff) -> | ||||||
|     FileInfo = gather_file_info(UserDir), |     FileInfo = gather_file_info(UserDir), | ||||||
|     case [Path || {Path, _Size, Time} <- FileInfo, Time < Timestamp] of |     case [Path || {Path, _Size, Time} <- FileInfo, Time < CutOff] of | ||||||
| 	[] -> | 	[] -> | ||||||
| 	    ok; | 	    ok; | ||||||
| 	OldFiles -> | 	OldFiles -> | ||||||
| @ -296,7 +298,8 @@ gather_file_info(Dir) -> | |||||||
| 	{ok, Entries} -> | 	{ok, Entries} -> | ||||||
| 	    lists:foldl(fun(Entry, Acc) -> | 	    lists:foldl(fun(Entry, Acc) -> | ||||||
| 				Path = Dir ++ "/" ++ Entry, | 				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}} -> | 				    {ok, #file_info{type = directory}} -> | ||||||
| 					gather_file_info(Path) ++ Acc; | 					gather_file_info(Path) ++ Acc; | ||||||
| 				    {ok, #file_info{type = regular, | 				    {ok, #file_info{type = regular, | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user