X-Git-Url: https://git.pterodactylus.net/?a=blobdiff_plain;f=src%2Fglobal.cpp;h=d241f069f2ec6bb96f4324735ecdceaf74d9255e;hb=8a0a83a78390f22f99d4487cda2569909dfbc28e;hp=087ce1cc304cd7024c41e7006d1b324024b5f662;hpb=175f098e7e712b839db433b93fe8649a402c6784;p=fms.git diff --git a/src/global.cpp b/src/global.cpp index 087ce1c..d241f06 100644 --- a/src/global.cpp +++ b/src/global.cpp @@ -67,13 +67,19 @@ void SetupDB() major=1; minor=5; } + if(major==1 && minor==5) + { + ConvertDB0105To0106(); + major=1; + minor=6; + } } else { - db->Execute("INSERT INTO tblDBVersion(Major,Minor) VALUES(1,5);"); + db->Execute("INSERT INTO tblDBVersion(Major,Minor) VALUES(1,6);"); } - db->Execute("UPDATE tblDBVersion SET Major=1, Minor=4;"); + db->Execute("UPDATE tblDBVersion SET Major=1, Minor=6;"); db->Execute("CREATE TABLE IF NOT EXISTS tblOption(\ Option TEXT UNIQUE,\ @@ -89,6 +95,7 @@ void SetupDB() SingleUse BOOL CHECK(SingleUse IN('true','false')) DEFAULT 'false',\ PublishTrustList BOOL CHECK(PublishTrustList IN('true','false')) DEFAULT 'false',\ PublishBoardList BOOL CHECK(PublishBoardList IN('true','false')) DEFAULT 'false',\ + PublishFreesite BOOL CHECK(PublishFreesite IN('true','false')) DEFAULT 'false',\ InsertingIdentity BOOL CHECK(InsertingIdentity IN('true','false')) DEFAULT 'false',\ LastInsertedIdentity DATETIME,\ InsertingPuzzle BOOL CHECK(InsertingPuzzle IN('true','false')) DEFAULT 'false',\ @@ -99,6 +106,7 @@ void SetupDB() LastInsertedBoardList DATETIME,\ InsertingMessageList BOOL CHECK(InsertingMessageList IN('true','false')) DEFAULT 'false',\ LastInsertedMessageList DATETIME,\ + LastInsertedFreesite DATETIME,\ DateCreated DATETIME\ );"); @@ -484,6 +492,15 @@ void ConvertDB0104To0105() db->Execute("UPDATE tblDBVersion SET Major=1, Minor=5;"); } +void ConvertDB0105To0106() +{ + // add Publish Freesite + SQLite3DB::DB *db=SQLite3DB::DB::Instance(); + db->Execute("ALTER TABLE tblLocalIdentity ADD COLUMN PublishFreesite BOOL CHECK(PublishFreesite IN('true','false')) DEFAULT 'false';"); + db->Execute("ALTER TABLE tblLocalIdentity ADD COLUMN LastInsertedFreesite DATETIME;"); + db->Execute("UPDATE tblDBVersion SET Major=1, Minor=6;"); +} + void SetupDefaultOptions() { // OptionValue should always be inserted as a string, even if the option really isn't a string - just to keep the field data type consistent @@ -530,7 +547,7 @@ void SetupDefaultOptions() st.Bind(0,"StartHTTP"); st.Bind(1,"true"); - st.Bind(2,"Start HTTP server."); + st.Bind(2,"Start HTTP server. WARNING: If you turn this off, you won't be able to access the administration pages."); st.Step(); st.Reset(); @@ -549,7 +566,7 @@ void SetupDefaultOptions() // StartFreenetUpdater st.Bind(0,"StartFreenetUpdater"); st.Bind(1,"true"); - st.Bind(2,"Start Freenet Updater thread."); + st.Bind(2,"Set to true to start the Freenet Updater thread and connect to Freenet. Set to false to prevent communication with Freenet."); st.Step(); st.Reset(); @@ -622,7 +639,7 @@ void SetupDefaultOptions() st.Reset(); st.Bind(0,"MinLocalTrustListTrust"); - st.Bind(1,"51"); + st.Bind(1,"50"); st.Bind(2,"Specifies a local trust list trust level that a peer must have before its trust list will be included in the weighted average. Any peers below this number will be excluded from the results."); st.Step(); st.Reset(); @@ -663,6 +680,12 @@ void SetupDefaultOptions() st.Step(); st.Reset(); + st.Bind(0,"SaveMessagesFromNewBoards"); + st.Bind(1,"true"); + st.Bind(2,"Set to true to automatically save messages posted to new boards. Set to false to ignore messages to new boards."); + st.Step(); + st.Reset(); + st.Bind(0,"ChangeMessageTrustOnReply"); st.Bind(1,"0"); st.Bind(2,"How much the local message trust level of an identity should change when you reply to one of their messages."); @@ -741,72 +764,6 @@ void SigHandler(int signum) exit(0); } -/* -void ShutdownThreads(std::vector &threads) -{ - std::vector::iterator i; - for(i=threads.begin(); i!=threads.end(); i++) - { - (*i)->Cancel(); - } - - for(i=threads.begin(); i!=threads.end(); i++) - { - LogFile::Instance()->WriteLog(LogFile::LOGLEVEL_DEBUG,"ShutdownThreads waiting for thread to exit."); - //(*i)->wait(); - (*i)->Join(); - delete (*i); - } - - threads.clear(); - -} - -void StartThreads(std::vector &threads) -{ - std::string startfreenet; - std::string startnntp; - std::string starthttp; - - if(Option::Instance()->Get("StartFreenetUpdater",startfreenet)==false) - { - startfreenet="true"; - Option::Instance()->Set("StartFreenetUpdater","true"); - } - - if(Option::Instance()->Get("StartNNTP",startnntp)==false) - { - startnntp="true"; - Option::Instance()->Set("StartNNTP","true"); - } - - if(Option::Instance()->Get("StartHTTP",starthttp)==false) - { - starthttp="true"; - Option::Instance()->Set("StartHTTP","true"); - } - - if(startfreenet=="true") - { - PThread::Thread *t=new PThread::Thread(new FreenetMasterThread()); - threads.push_back(t); - } - - if(startnntp=="true") - { - PThread::Thread *t=new PThread::Thread(new NNTPListener()); - threads.push_back(t); - } - - if(starthttp=="true") - { - PThread::Thread *t=new PThread::Thread(new HTTPThread()); - threads.push_back(t); - } - -} -*/ - void FixCapitalBoardNames() { SQLite3DB::DB *db=SQLite3DB::DB::Instance();