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

mod_mam: Always limit result set page size

Limit the number of messages returned for a given MAM request even if
the client didn't specify an RSM set (not just if the client specified
an RSM set without a limit).

This is still not done for MAM v0.2 requests though, as that version of
the XEP doesn't require clients to support RSM.
This commit is contained in:
Holger Weiss 2016-07-19 21:08:13 +02:00
parent 490a758050
commit 9fcb81dea9

View File

@ -1032,12 +1032,12 @@ filter_by_max(_Msgs, _Junk) ->
limit_max(RSM, ?NS_MAM_TMP) ->
RSM; % XEP-0313 v0.2 doesn't require clients to support RSM.
limit_max(none, _NS) ->
#rsm_in{max = ?DEF_PAGE_SIZE};
limit_max(#rsm_in{max = Max} = RSM, _NS) when not is_integer(Max) ->
RSM#rsm_in{max = ?DEF_PAGE_SIZE};
limit_max(#rsm_in{max = Max} = RSM, _NS) when Max > ?MAX_PAGE_SIZE ->
RSM#rsm_in{max = ?MAX_PAGE_SIZE};
limit_max(RSM, _NS) ->
RSM.
RSM#rsm_in{max = ?MAX_PAGE_SIZE}.
match_interval(Now, Start, End) ->
(Now >= Start) and (Now =< End).