From 0142e5c340b570429d6a55a48631a95cbf3a8776 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?louiz=E2=80=99?= Date: Wed, 12 Apr 2017 17:53:44 +0200 Subject: [PATCH] Limit of 200 MAM messages, if no other limit has been set by the client fix #3256 --- src/xmpp/biboumi_component.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/xmpp/biboumi_component.cpp b/src/xmpp/biboumi_component.cpp index 8b2e541..ddfb625 100644 --- a/src/xmpp/biboumi_component.cpp +++ b/src/xmpp/biboumi_component.cpp @@ -627,6 +627,11 @@ 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) { -- GitLab