aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorBadlop <badlop@process-one.net>2019-02-05 23:12:49 +0100
committerBadlop <badlop@process-one.net>2019-02-06 16:33:59 +0100
commit6cd458d2050003deaaf45d44a1040ab9c9fc051b (patch)
tree805f4a658006b4dbeb921441be672c3068a8c0af /src
parentFix support to restart module with live options in WebAdmin (diff)
Don't consider room's lack of history when history_size is zero (#2787)
Diffstat (limited to 'src')
-rw-r--r--src/mod_muc_admin.erl11
1 files changed, 7 insertions, 4 deletions
diff --git a/src/mod_muc_admin.erl b/src/mod_muc_admin.erl
index 616d54d28..5c8e5478c 100644
--- a/src/mod_muc_admin.erl
+++ b/src/mod_muc_admin.erl
@@ -736,7 +736,7 @@ muc_unused(Action, ServerHost, Last_allowed) ->
Rooms_all = get_rooms(ServerHost),
%% 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_pass = length(Rooms_pass),
@@ -767,11 +767,11 @@ get_room_state(Room_pid) ->
%%---------------
%% Decide
-decide_rooms(Rooms, Last_allowed) ->
- Decide = fun(R) -> decide_room(R, Last_allowed) end,
+decide_rooms(Rooms, ServerHost, Last_allowed) ->
+ Decide = fun(R) -> decide_room(R, ServerHost, Last_allowed) end,
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),
Persistent = C#config.persistent,
@@ -784,7 +784,10 @@ decide_room({_Room_name, _Host, Room_pid}, Last_allowed) ->
History = (S#state.history)#lqueue.queue,
Ts_now = calendar:universal_time(),
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
+ true when HistorySize == 0 ->
+ {false, 0};
true ->
{false, Ts_uptime};
false ->