aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--rebar.config2
-rw-r--r--src/mod_mam.erl12
2 files changed, 9 insertions, 5 deletions
diff --git a/rebar.config b/rebar.config
index edbb5f1c6..e8dfee3d3 100644
--- a/rebar.config
+++ b/rebar.config
@@ -57,7 +57,7 @@
{stringprep, ".*", {git, "https://github.com/processone/stringprep", {tag, "1.0.22"}}},
{if_var_true, stun,
{stun, ".*", {git, "https://github.com/processone/stun", {tag, "1.0.37"}}}},
- {xmpp, ".*", {git, "https://github.com/processone/xmpp", "0fece8d96b5812c43be179c4f232cac7cb98d81c"}},
+ {xmpp, ".*", {git, "https://github.com/processone/xmpp", "362394889f5b2653177be1368d555277f2c49719"}},
{yconf, ".*", {git, "https://github.com/processone/yconf", {tag, "1.0.7"}}}
]}.
diff --git a/src/mod_mam.erl b/src/mod_mam.erl
index a2ff3d4ff..9ea04217f 100644
--- a/src/mod_mam.erl
+++ b/src/mod_mam.erl
@@ -687,11 +687,11 @@ process_iq(LServer, #iq{from = #jid{luser = LUser}, lang = Lang,
#mam_query{rsm = #rsm_set{index = I}} when is_integer(I) ->
Txt = ?T("Unsupported <index/> element"),
xmpp:make_error(IQ, xmpp:err_feature_not_implemented(Txt, Lang));
- #mam_query{rsm = RSM, xmlns = NS} ->
+ #mam_query{rsm = RSM, flippage = FlipPage, xmlns = NS} ->
case parse_query(SubEl, Lang) of
{ok, Query} ->
NewRSM = limit_max(RSM, NS),
- select_and_send(LServer, Query, NewRSM, IQ, MsgType);
+ select_and_send(LServer, Query, NewRSM, FlipPage, IQ, MsgType);
{error, Err} ->
xmpp:make_error(IQ, Err)
end
@@ -1017,7 +1017,7 @@ maybe_activate_mam(LUser, LServer) ->
ok
end.
-select_and_send(LServer, Query, RSM, #iq{from = From, to = To} = IQ, MsgType) ->
+select_and_send(LServer, Query, RSM, FlipPage, #iq{from = From, to = To} = IQ, MsgType) ->
Ret = case MsgType of
chat ->
select(LServer, From, From, Query, RSM, MsgType);
@@ -1027,7 +1027,11 @@ select_and_send(LServer, Query, RSM, #iq{from = From, to = To} = IQ, MsgType) ->
case Ret of
{Msgs, IsComplete, Count} ->
SortedMsgs = lists:keysort(2, Msgs),
- send(SortedMsgs, Count, IsComplete, IQ);
+ SortedMsgs2 = case FlipPage of
+ true -> lists:reverse(SortedMsgs);
+ false -> SortedMsgs
+ end,
+ send(SortedMsgs2, Count, IsComplete, IQ);
{error, _} ->
Txt = ?T("Database failure"),
Err = xmpp:err_internal_server_error(Txt, IQ#iq.lang),