25
1
mirror of https://github.com/processone/ejabberd.git synced 2024-12-22 17:28:25 +01:00

Properly handle infinity as max number of message in mam offline storage

This commit is contained in:
Paweł Chmielowski 2019-04-29 16:37:21 +02:00
parent aaf674160b
commit c550d36581

View File

@ -793,8 +793,9 @@ read_mam_messages(LUser, LServer, ReadMsgs) ->
ExtraMsgs; ExtraMsgs;
_ -> _ ->
MaxOfflineMsgs = case get_max_user_messages(LUser, LServer) of MaxOfflineMsgs = case get_max_user_messages(LUser, LServer) of
Number when is_integer(Number) -> Number; Number when is_integer(Number) -> Number - length(ExtraMsgs);
_ -> 100 infinity -> undefined;
_ -> 100 - length(ExtraMsgs)
end, end,
JID = jid:make(LUser, LServer, <<>>), JID = jid:make(LUser, LServer, <<>>),
{MamMsgs, _, _} = mod_mam:select(LServer, JID, JID, {MamMsgs, _, _} = mod_mam:select(LServer, JID, JID,