summaryrefslogtreecommitdiff
path: root/src/xmpp
diff options
context:
space:
mode:
authorlouiz’ <louiz@louiz.org>2017-04-12 17:07:39 +0200
committerlouiz’ <louiz@louiz.org>2017-04-12 17:07:39 +0200
commit3a8203c366d46ec2937a601868f5e2ed591c923e (patch)
tree7ce839420c7ddd737dca356c05c5b365a9dcdb3b /src/xmpp
parent4fde4d7369ff2f54f4216704a4fd51a974f53885 (diff)
downloadbiboumi-3a8203c366d46ec2937a601868f5e2ed591c923e.tar.gz
biboumi-3a8203c366d46ec2937a601868f5e2ed591c923e.tar.bz2
biboumi-3a8203c366d46ec2937a601868f5e2ed591c923e.tar.xz
biboumi-3a8203c366d46ec2937a601868f5e2ed591c923e.zip
Handle the RSM "max" value in the MAM requests
fix #3255
Diffstat (limited to 'src/xmpp')
-rw-r--r--src/xmpp/biboumi_component.cpp10
1 files changed, 9 insertions, 1 deletions
diff --git a/src/xmpp/biboumi_component.cpp b/src/xmpp/biboumi_component.cpp
index b4b6a45..8b2e541 100644
--- a/src/xmpp/biboumi_component.cpp
+++ b/src/xmpp/biboumi_component.cpp
@@ -619,7 +619,15 @@ bool BiboumiComponent::handle_mam_request(const Stanza& stanza)
}
}
}
- const auto lines = Database::get_muc_logs(from.bare(), iid.get_local(), iid.get_server(), -1, start, end);
+ const XmlNode* set = query->get_child("set", RSM_NS);
+ int limit = -1;
+ if (set)
+ {
+ const XmlNode* max = set->get_child("max", RSM_NS);
+ if (max)
+ limit = std::atoi(max->get_inner().data());
+ }
+ const auto lines = Database::get_muc_logs(from.bare(), iid.get_local(), iid.get_server(), limit, start, end);
for (const db::MucLogLine& line: lines)
{
if (!line.nick.value().empty())