Add the persistent_by_default configuration option

fix #3293
This commit is contained in:
louiz’
2017-09-09 17:09:17 +02:00
parent 8d99374f1f
commit bfcf294517
9 changed files with 70 additions and 9 deletions
+5
View File
@@ -6,6 +6,8 @@
#include <utils/get_first_non_empty.hpp>
#include <utils/time.hpp>
#include <config/config.hpp>
#include <database/index.hpp>
#include <sqlite3.h>
@@ -18,6 +20,9 @@ Database::IrcChannelOptionsTable Database::irc_channel_options("IrcChannelOption
Database::RosterTable Database::roster("roster");
std::map<Database::CacheKey, Database::EncodingIn::real_type> Database::encoding_in_cache{};
Database::GlobalPersistent::GlobalPersistent():
Column<bool>{Config::get_bool("persistent_by_default", false)}
{}
void Database::open(const std::string& filename)
{
+4 -1
View File
@@ -73,6 +73,9 @@ class Database
struct Persistent: Column<bool> { static constexpr auto name = "persistent_";
Persistent(): Column<bool>(false) {} };
struct GlobalPersistent: Column<bool> { static constexpr auto name = "persistent_";
GlobalPersistent(); };
struct LocalJid: Column<std::string> { static constexpr auto name = "local"; };
struct RemoteJid: Column<std::string> { static constexpr auto name = "remote"; };
@@ -81,7 +84,7 @@ class Database
using MucLogLineTable = Table<Id, Uuid, Owner, IrcChanName, IrcServerName, Date, Body, Nick>;
using MucLogLine = MucLogLineTable::RowType;
using GlobalOptionsTable = Table<Id, Owner, MaxHistoryLength, RecordHistory, Persistent>;
using GlobalOptionsTable = Table<Id, Owner, MaxHistoryLength, RecordHistory, GlobalPersistent>;
using GlobalOptions = GlobalOptionsTable::RowType;
using IrcServerOptionsTable = Table<Id, Owner, Server, Pass, AfterConnectionCommand, TlsPorts, Ports, Username, Realname, VerifyCert, TrustedFingerprint, EncodingOut, EncodingIn, MaxHistoryLength>;