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

Don't consider room's lack of history when history_size is zero (#2787)

This commit is contained in:
Badlop 2019-02-05 23:12:49 +01:00
parent c41c5b2185
commit 6cd458d205

View File

@ -736,7 +736,7 @@ muc_unused(Action, ServerHost, Last_allowed) ->
Rooms_all = get_rooms(ServerHost), Rooms_all = get_rooms(ServerHost),
%% Decide which ones pass the requirements %% Decide which ones pass the requirements
Rooms_pass = decide_rooms(Rooms_all, Last_allowed), Rooms_pass = decide_rooms(Rooms_all, ServerHost, Last_allowed),
Num_rooms_all = length(Rooms_all), Num_rooms_all = length(Rooms_all),
Num_rooms_pass = length(Rooms_pass), Num_rooms_pass = length(Rooms_pass),
@ -767,11 +767,11 @@ get_room_state(Room_pid) ->
%%--------------- %%---------------
%% Decide %% Decide
decide_rooms(Rooms, Last_allowed) -> decide_rooms(Rooms, ServerHost, Last_allowed) ->
Decide = fun(R) -> decide_room(R, Last_allowed) end, Decide = fun(R) -> decide_room(R, ServerHost, Last_allowed) end,
lists:filter(Decide, Rooms). lists:filter(Decide, Rooms).
decide_room({_Room_name, _Host, Room_pid}, Last_allowed) -> decide_room({_Room_name, _Host, Room_pid}, ServerHost, Last_allowed) ->
C = get_room_config(Room_pid), C = get_room_config(Room_pid),
Persistent = C#config.persistent, Persistent = C#config.persistent,
@ -784,7 +784,10 @@ decide_room({_Room_name, _Host, Room_pid}, Last_allowed) ->
History = (S#state.history)#lqueue.queue, History = (S#state.history)#lqueue.queue,
Ts_now = calendar:universal_time(), Ts_now = calendar:universal_time(),
Ts_uptime = uptime_seconds(), Ts_uptime = uptime_seconds(),
HistorySize = gen_mod:get_module_opt(ServerHost, mod_muc, history_size),
{Has_hist, Last} = case p1_queue:is_empty(History) of {Has_hist, Last} = case p1_queue:is_empty(History) of
true when HistorySize == 0 ->
{false, 0};
true -> true ->
{false, Ts_uptime}; {false, Ts_uptime};
false -> false ->