summaryrefslogtreecommitdiff
path: root/src/xmpp
diff options
context:
space:
mode:
authorlouiz’ <louiz@louiz.org>2017-04-12 17:53:44 +0200
committerlouiz’ <louiz@louiz.org>2017-04-19 23:02:08 +0200
commit54fa739d6b5d2cc0b3704eda32c7abac47708b60 (patch)
treed6fa5bb246b4b1c2d276d9857db58c18c13f1bfe /src/xmpp
parentdc5ad49b4011bb637373c6088efaf219fed4a016 (diff)
downloadbiboumi-54fa739d6b5d2cc0b3704eda32c7abac47708b60.tar.gz
biboumi-54fa739d6b5d2cc0b3704eda32c7abac47708b60.tar.bz2
biboumi-54fa739d6b5d2cc0b3704eda32c7abac47708b60.tar.xz
biboumi-54fa739d6b5d2cc0b3704eda32c7abac47708b60.zip
Limit of 100 MAM messages, if no other limit has been set by the client
fix #3256
Diffstat (limited to 'src/xmpp')
-rw-r--r--src/xmpp/biboumi_component.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/xmpp/biboumi_component.cpp b/src/xmpp/biboumi_component.cpp
index 8b2e541..c808eec 100644
--- a/src/xmpp/biboumi_component.cpp
+++ b/src/xmpp/biboumi_component.cpp
@@ -627,6 +627,12 @@ bool BiboumiComponent::handle_mam_request(const Stanza& stanza)
if (max)
limit = std::atoi(max->get_inner().data());
}
+ // If the archive is really big, and the client didn’t specify any
+ // limit, we avoid flooding it: we set an arbitrary max limit.
+ if (limit == -1 && start.empty() && end.empty())
+ {
+ limit = 100;
+ }
const auto lines = Database::get_muc_logs(from.bare(), iid.get_local(), iid.get_server(), limit, start, end);
for (const db::MucLogLine& line: lines)
{