From 88499d037962b4a0bd85d812cb77ef0452c985f8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?louiz=E2=80=99?= Date: Tue, 23 Aug 2016 00:28:12 +0200 Subject: If the maxHistoryLength is negative, make it 0 Instead of doing a broken SQL request that returns weird lines --- src/database/database.cpp | 4 +++- src/database/database.hpp | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/database/database.cpp b/src/database/database.cpp index 48cdea8..009ff0e 100644 --- a/src/database/database.cpp +++ b/src/database/database.cpp @@ -136,8 +136,10 @@ void Database::store_muc_message(const std::string& owner, const Iid& iid, line.update(); } -std::vector Database::get_muc_logs(const std::string& owner, const std::string& chan_name, const std::string& server, const int limit) +std::vector Database::get_muc_logs(const std::string& owner, const std::string& chan_name, const std::string& server, int limit) { + if (limit < 0) + limit = 0; auto res = litesql::select(*Database::db, db::MucLogLine::Owner == owner && db::MucLogLine::IrcChanName == chan_name && diff --git a/src/database/database.hpp b/src/database/database.hpp index 14012ff..e7fdd5f 100644 --- a/src/database/database.hpp +++ b/src/database/database.hpp @@ -49,7 +49,7 @@ public: const std::string& server, const std::string& channel); static std::vector get_muc_logs(const std::string& owner, const std::string& chan_name, const std::string& server, - const int limit); + int limit); static void store_muc_message(const std::string& owner, const Iid& iid, time_point date, const std::string& body, const std::string& nick); -- cgit v1.2.3