]> granicus.if.org Git - ejabberd/commitdiff
Don't consider room's lack of history when history_size is zero (#2787)
authorBadlop <badlop@process-one.net>
Tue, 5 Feb 2019 22:12:49 +0000 (23:12 +0100)
committerBadlop <badlop@process-one.net>
Wed, 6 Feb 2019 15:33:59 +0000 (16:33 +0100)
src/mod_muc_admin.erl

index 616d54d2876fe3fd606f98d48a0d7d0a21586583..5c8e5478cd81a88369a261c09c98b39f40727981 100644 (file)
@@ -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 ->