mirror of
https://github.com/processone/ejabberd.git
synced 2024-11-20 16:15:59 +01:00
mod_mam: Sort messages returned by Mnesia
Sort the messages retrieved from an Mnesia archive before selecting the subset limited by the <max/> value. This makes sure the desired subset of messages is sent to the client.
This commit is contained in:
parent
58c8fc5770
commit
db04cdf2ca
@ -898,7 +898,8 @@ select(_LServer, #jid{luser = LUser, lserver = LServer} = JidRequestor,
|
||||
Start, End, With, RSM, MsgType, mnesia) ->
|
||||
MS = make_matchspec(LUser, LServer, Start, End, With),
|
||||
Msgs = mnesia:dirty_select(archive_msg, MS),
|
||||
{FilteredMsgs, IsComplete} = filter_by_rsm(Msgs, RSM),
|
||||
SortedMsgs = lists:keysort(#archive_msg.timestamp, Msgs),
|
||||
{FilteredMsgs, IsComplete} = filter_by_rsm(SortedMsgs, RSM),
|
||||
Count = length(Msgs),
|
||||
{lists:map(
|
||||
fun(Msg) ->
|
||||
|
Loading…
Reference in New Issue
Block a user