summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorlouiz <louiz@louiz.org>2017-04-19 23:15:49 +0200
committerlouiz <louiz@louiz.org>2017-04-19 23:15:49 +0200
commit47ff1cd3116424342c79d173d30a0f118859bc9f (patch)
tree6de3edf0dc0ba152d1e96157b11f32acda09460f /src
parenteec8f68de71b642fbeb39c65c96124a8a784f78f (diff)
parent96d460de480617ec2ade3b5cc428bd144a1659f3 (diff)
downloadbiboumi-47ff1cd3116424342c79d173d30a0f118859bc9f.tar.gz
biboumi-47ff1cd3116424342c79d173d30a0f118859bc9f.tar.bz2
biboumi-47ff1cd3116424342c79d173d30a0f118859bc9f.tar.xz
biboumi-47ff1cd3116424342c79d173d30a0f118859bc9f.zip
Merge branch 'mam_default_limit' into 'master'
Limit of 100 MAM messages, if no other limit has been set by the client Closes #3256 See merge request !9
Diffstat (limited to 'src')
-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)
{