X-Git-Url: https://git.pterodactylus.net/?a=blobdiff_plain;f=src%2Fglobal.cpp;h=872dfb7c26378568a2803fb610e30834dfbc88a3;hb=18b45335ba24f3b6b6d4f4acfe8c5a5ae845ce00;hp=7889810626b10a988a1c34907f02561ee2de170f;hpb=b4f4686250878cdf4fcb2986a2ea6546cba867d1;p=fms.git diff --git a/src/global.cpp b/src/global.cpp index 7889810..872dfb7 100644 --- a/src/global.cpp +++ b/src/global.cpp @@ -17,7 +17,7 @@ #include #endif -bool wantshutdown=false; +volatile bool wantshutdown=false; std::string CreateShortIdentityName(const std::string &name, const std::string &publickey) { @@ -39,11 +39,18 @@ void SetupDB() { DateTime date; + std::string tempval=""; SQLite3DB::DB *db=SQLite3DB::DB::Instance(); db->Open("fms.db3"); db->SetBusyTimeout(10000); // set timeout to 10 seconds - //db->Execute("VACUUM;"); // not needed every startup + + tempval=""; + Option::Instance()->Get("VacuumOnStartup",tempval); + if(tempval=="true") + { + db->Execute("VACUUM;"); + } db->Execute("CREATE TABLE IF NOT EXISTS tblDBVersion(\ Major INTEGER,\ @@ -95,18 +102,51 @@ void SetupDB() major=1; minor=7; } + if(major==1 && minor==7) + { + ConvertDB0107To0108(); + major=1; + minor=8; + } + if(major==1 && minor==8) + { + ConvertDB0108To0109(); + major=1; + minor=9; + } + if(major==1 && minor==9) + { + ConvertDB0109To0110(); + major=1; + minor=10; + } + if(major==1 && minor==10) + { + ConvertDB0110To0111(); + major=1; + minor=11; + } + if(major==1 && minor==11) + { + ConvertDB0111To0112(); + major=1; + minor=12; + } } else { - db->Execute("INSERT INTO tblDBVersion(Major,Minor) VALUES(1,7);"); + db->Execute("INSERT INTO tblDBVersion(Major,Minor) VALUES(1,12);"); } - db->Execute("UPDATE tblDBVersion SET Major=1, Minor=7;"); + db->Execute("UPDATE tblDBVersion SET Major=1, Minor=12;"); db->Execute("CREATE TABLE IF NOT EXISTS tblOption(\ Option TEXT UNIQUE,\ OptionValue TEXT NOT NULL,\ - OptionDescription TEXT\ + OptionDescription TEXT,\ + Section TEXT,\ + SortOrder INTEGER,\ + ValidValues TEXT\ );"); db->Execute("CREATE TABLE IF NOT EXISTS tblLocalIdentity(\ @@ -118,18 +158,19 @@ void SetupDB() 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',\ + FreesiteEdition INTEGER,\ InsertingIdentity BOOL CHECK(InsertingIdentity IN('true','false')) DEFAULT 'false',\ LastInsertedIdentity DATETIME,\ InsertingPuzzle BOOL CHECK(InsertingPuzzle IN('true','false')) DEFAULT 'false',\ LastInsertedPuzzle DATETIME,\ InsertingTrustList BOOL CHECK(InsertingTrustList IN('true','false')) DEFAULT 'false',\ LastInsertedTrustList DATETIME,\ - InsertingBoardList BOOL CHECK(InsertingBoardList IN('true','false')) DEFAULT 'false',\ LastInsertedBoardList DATETIME,\ - InsertingMessageList BOOL CHECK(InsertingMessageList IN('true','false')) DEFAULT 'false',\ LastInsertedMessageList DATETIME,\ LastInsertedFreesite DATETIME,\ - DateCreated DATETIME\ + DateCreated DATETIME,\ + MinMessageDelay INTEGER DEFAULT 0,\ + MaxMessageDelay INTEGER DEFAULT 0\ );"); db->Execute("CREATE TABLE IF NOT EXISTS tblLocalIdentityInserts(\ @@ -170,6 +211,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',\ + FreesiteEdition INTEGER,\ DateAdded DATETIME,\ LastSeen DATETIME,\ LocalMessageTrust INTEGER CHECK(LocalMessageTrust BETWEEN 0 AND 100) DEFAULT NULL,\ @@ -177,9 +219,8 @@ void SetupDB() LocalTrustListTrust INTEGER CHECK(LocalTrustListTrust BETWEEN 0 AND 100) DEFAULT NULL,\ PeerTrustListTrust INTEGER CHECK(PeerTrustListTrust BETWEEN 0 AND 100) DEFAULT NULL,\ AddedMethod TEXT,\ - MessageTrustComment TEXT,\ - TrustListTrustComment TEXT,\ - Hidden BOOL CHECK(Hidden IN('true','false')) DEFAULT 'false'\ + Hidden BOOL CHECK(Hidden IN('true','false')) DEFAULT 'false',\ + PurgeDate DATETIME\ );"); db->Execute("CREATE TABLE IF NOT EXISTS tblIdentityRequests(\ @@ -259,7 +300,7 @@ void SetupDB() );"); db->Execute("INSERT INTO tblBoard(BoardName,BoardDescription,DateAdded,AddedMethod) VALUES('fms','Freenet Message System','2007-12-01 12:00:00','Initial Board');"); - db->Execute("INSERT INTO tblBoard(BoardName,BoardDescription,DateAdded,AddedMethod) VALUES('freenet','Discussion about Freenet','2007-12-01 12:00:00','Initialt Board');"); + db->Execute("INSERT INTO tblBoard(BoardName,BoardDescription,DateAdded,AddedMethod) VALUES('freenet','Discussion about Freenet','2007-12-01 12:00:00','Initial Board');"); db->Execute("INSERT INTO tblBoard(BoardName,BoardDescription,DateAdded,AddedMethod) VALUES('public','Public discussion','2007-12-01 12:00:00','Initial Board');"); db->Execute("INSERT INTO tblBoard(BoardName,BoardDescription,DateAdded,AddedMethod) VALUES('test','Test board','2007-12-01 12:00:00','Initial Board');"); @@ -317,7 +358,18 @@ void SetupDB() InsertIndex INTEGER,\ MessageUUID TEXT UNIQUE,\ MessageXML TEXT,\ - Inserted BOOL CHECK(Inserted IN('true','false')) DEFAULT 'false'\ + Inserted BOOL CHECK(Inserted IN('true','false')) DEFAULT 'false',\ + SendDate DATETIME\ + );"); + + db->Execute("CREATE TABLE IF NOT EXISTS tblFileInserts(\ + FileInsertID INTEGER PRIMARY KEY,\ + MessageUUID TEXT,\ + FileName TEXT,\ + Key TEXT,\ + Size INTEGER,\ + MimeType TEXT,\ + Data BLOB\ );"); db->Execute("CREATE TABLE IF NOT EXISTS tblMessageListInserts(\ @@ -353,6 +405,11 @@ void SetupDB() Date DATETIME\ );"); + // A temporary table that will hold a local identity id of the last identity who was loaded in the trust list page + db->Execute("CREATE TEMPORARY TABLE IF NOT EXISTS tmpLocalIdentityPeerTrustPage(\ + LocalIdentityID INTEGER\ + );"); + // low / high / message count for each board db->Execute("CREATE VIEW IF NOT EXISTS vwBoardStats AS \ SELECT tblBoard.BoardID AS 'BoardID', IFNULL(MIN(MessageID),0) AS 'LowMessageID', IFNULL(MAX(MessageID),0) AS 'HighMessageID', COUNT(MessageID) AS 'MessageCount' \ @@ -373,6 +430,11 @@ void SetupDB() AND ( PeerTrustListTrust IS NULL OR PeerTrustListTrust>=(SELECT OptionValue FROM tblOption WHERE Option='MinPeerTrustListTrust') ) \ GROUP BY TargetIdentityID;"); + db->Execute("CREATE VIEW IF NOT EXISTS vwIdentityStats AS \ + SELECT tblIdentity.IdentityID, COUNT(tblMessage.MessageID) AS MessageCount, MIN(tblMessage.MessageDate) AS FirstMessageDate, MAX(tblMessage.MessageDate) AS LastMessageDate \ + FROM tblIdentity LEFT JOIN tblMessage ON tblIdentity.IdentityID=tblMessage.IdentityID \ + GROUP BY tblIdentity.IdentityID;"); + /* These peer trust calculations are too CPU intensive to be triggers - they were called every time a new trust list was processed All trust levels will now be recalculated every hour in the PeriodicDBMaintenance class @@ -420,6 +482,7 @@ void SetupDB() DELETE FROM tblMessageReplyTo WHERE tblMessageReplyTo.MessageID=old.MessageID;\ END;"); + db->Execute("DROP TRIGGER IF EXISTS trgDeleteIdentity;"); db->Execute("CREATE TRIGGER IF NOT EXISTS trgDeleteIdentity AFTER DELETE ON tblIdentity \ FOR EACH ROW \ BEGIN \ @@ -429,6 +492,7 @@ void SetupDB() DELETE FROM tblMessageRequests WHERE IdentityID=old.IdentityID;\ DELETE FROM tblPeerTrust WHERE IdentityID=old.IdentityID;\ DELETE FROM tblTrustListRequests WHERE IdentityID=old.IdentityID;\ + DELETE FROM tblIdentityTrust WHERE IdentityID=old.IdentityID;\ END;"); db->Execute("DROP TRIGGER IF EXISTS trgDeleteLocalIdentity;"); @@ -462,14 +526,31 @@ void SetupDB() date.SetToGMTime(); // insert SomeDude's public key db->Execute("INSERT INTO tblIdentity(PublicKey,DateAdded,LocalTrustListTrust,AddedMethod) VALUES('SSK@NuBL7aaJ6Cn4fB7GXFb9Zfi8w1FhPyW3oKgU9TweZMw,iXez4j3qCpd596TxXiJgZyTq9o-CElEuJxm~jNNZAuA,AQACAAE/','"+date.Format("%Y-%m-%d %H:%M:%S")+"',50,'Initial Identity');"); - // insert Shadow Panther's public key - db->Execute("INSERT INTO tblIdentity(PublicKey,DateAdded,AddedMethod) VALUES('SSK@~mimyB1kmH4f7Cgsd2wM2Qv2NxrZHRMM6IY8~7EWRVQ,fxTKkR0TYhgMYb-vEGAv55sMOxCGD2xhE4ZxWHxdPz4,AQACAAE/','"+date.Format("%Y-%m-%d %H:%M:%S")+"','Initial Identity');"); + // insert Shadow Panther's public key - haven't seen in a while - disabling for now + //db->Execute("INSERT INTO tblIdentity(PublicKey,DateAdded,AddedMethod) VALUES('SSK@~mimyB1kmH4f7Cgsd2wM2Qv2NxrZHRMM6IY8~7EWRVQ,fxTKkR0TYhgMYb-vEGAv55sMOxCGD2xhE4ZxWHxdPz4,AQACAAE/','"+date.Format("%Y-%m-%d %H:%M:%S")+"','Initial Identity');"); // insert garfield's public key db->Execute("INSERT INTO tblIdentity(PublicKey,DateAdded,AddedMethod) VALUES('SSK@T8l1IEGU4-PoASFzgc2GYhIgRzUvZsKdoQWeuLHuTmM,QLxAPfkGis8l5NafNpSCdbxzXhBlu9WL8svcqJw9Mpo,AQACAAE/','"+date.Format("%Y-%m-%d %H:%M:%S")+"','Initial Identity');"); + // insert alek's public key + db->Execute("INSERT INTO tblIdentity(PublicKey,DateAdded,AddedMethod) VALUES('SSK@lTjeI6V0lQsktXqaqJ6Iwk4TdsHduQI54rdUpHfhGbg,0oTYfrxxx8OmdU1~60gqpf3781qzEicM4Sz97mJsBM4,AQACAAE/','"+date.Format("%Y-%m-%d %H:%M:%S")+"','Initial Identity');"); + // insert Luke771's public key + db->Execute("INSERT INTO tblIdentity(PublicKey,DateAdded,AddedMethod) VALUES('SSK@mdXK~ZVlfTZhF1SLBrvZ--i0vOsOpa~w9wv~~psQ-04,gXonsXKc7aexKSO8Gt8Fwre4Qgmmbt2WueO7VzxNKkk,AQACAAE/','"+date.Format("%Y-%m-%d %H:%M:%S")+"','Initial Identity');"); + // insert falafel's public key + db->Execute("INSERT INTO tblIdentity(PublicKey,DateAdded,AddedMethod) VALUES('SSK@IxVqeqM0LyYdTmYAf5z49SJZUxr7NtQkOqVYG0hvITw,RM2wnMn5zAufCMt5upkkgq25B1elfBAxc7htapIWg1c,AQACAAE/','"+date.Format("%Y-%m-%d %H:%M:%S")+"','Initial Identity');"); + // insert cptn_insano's public key + db->Execute("INSERT INTO tblIdentity(PublicKey,DateAdded,AddedMethod) VALUES('SSK@bloE1LJ~qzSYUkU2nt7sB9kq060D4HTQC66pk5Q8NpA,DOOASUnp0kj6tOdhZJ-h5Tk7Ka50FSrUgsH7tCG1usU,AQACAAE/','"+date.Format("%Y-%m-%d %H:%M:%S")+"','Initial Identity');"); + // insert Flink's public key + db->Execute("INSERT INTO tblIdentity(PublicKey,DateAdded,AddedMethod) VALUES('SSK@q2TtkNBOuuniyJ56~8NSopCs3ttwe5KlB31ugZtWmXA,6~PzIupS8YK7L6oFNpXGKJmHT2kBMDfwTg73nHdNur8,AQACAAE/','"+date.Format("%Y-%m-%d %H:%M:%S")+"','Initial Identity');"); + // insert Kane's public key + db->Execute("INSERT INTO tblIdentity(PublicKey,DateAdded,AddedMethod) VALUES('SSK@Ofm~yZivDJ5Z2fSzZbMiLEUUQaIc0KHRdZMBTaPLO6I,WLm4s4hNbOOurJ6ijfOq4odz7-dN7uTUvYxJRwWnlMI,AQACAAE/','"+date.Format("%Y-%m-%d %H:%M:%S")+"','Initial Identity');"); + // inserts boardstat's public key + db->Execute("INSERT INTO tblIdentity(PublicKey,DateAdded,AddedMethod) VALUES('SSK@aYWBb6zo2AM13XCNhsmmRKMANEx6PG~C15CWjdZziKA,X1pAG4EIqR1gAiyGFVZ1iiw-uTlh460~rFACJ7ZHQXk,AQACAAE/','"+date.Format("%Y-%m-%d %H:%M:%S")+"','Initial Identity');"); // TODO remove sometime after 0.1.17 FixCapitalBoardNames(); + // run analyze - may speed up some queries + db->Execute("ANALYZE;"); + } void ConvertDB0100To0101() @@ -576,6 +657,120 @@ void ConvertDB0106To0107() db->Execute("UPDATE tblDBVersion SET Major=1, Minor=7;"); } +void ConvertDB0107To0108() +{ + // add FreesiteEdition to tblLocalIdentity and tblIdentity + SQLite3DB::DB *db=SQLite3DB::DB::Instance(); + db->Execute("ALTER TABLE tblLocalIdentity ADD COLUMN FreesiteEdition INTEGER;"); + db->Execute("ALTER TABLE tblIdentity ADD COLUMN FreesiteEdition INTEGER;"); + db->Execute("UPDATE tblDBVersion SET Major=1, Minor=8;"); +} + +void ConvertDB0108To0109() +{ + SQLite3DB::DB *db=SQLite3DB::DB::Instance(); + db->Execute("CREATE TABLE IF NOT EXISTS tblFileInserts(\ + FileInsertID INTEGER PRIMARY KEY,\ + MessageUUID TEXT,\ + FileName TEXT,\ + Key TEXT,\ + Size INTEGER,\ + Data BLOB\ + );"); + db->Execute("UPDATE tblDBVersion SET Major=1, Minor=9;"); +} + +void ConvertDB0109To0110() +{ + SQLite3DB::DB *db=SQLite3DB::DB::Instance(); + db->Execute("ALTER TABLE tblFileInserts ADD COLUMN MimeType TEXT;"); + db->Execute("UPDATE tblDBVersion SET Major=1, Minor=10;"); +} + +void ConvertDB0110To0111() +{ + /* + Drop MessageTrustComment, TrustListTrustComment FROM tblIdentity + + Drop InsertingMessageList, InsertingBoardList FROM tblLocalIdentity + Add MinMessageDelay, MaxMessageDelay to tblLocalIdentity Default 0 + + Add SendDate to tblMessageInserts + */ + SQLite3DB::DB *db=SQLite3DB::DB::Instance(); + + db->Execute("ALTER TABLE tblMessageInserts ADD COLUMN SendDate DATETIME;"); + + db->Execute("CREATE TEMPORARY TABLE tblLocalIdentityTemp AS SELECT * FROM tblLocalIdentity;"); + db->Execute("DROP TABLE IF EXISTS tblLocalIdentity;"); + db->Execute("CREATE TABLE IF NOT EXISTS tblLocalIdentity(\ + LocalIdentityID INTEGER PRIMARY KEY,\ + Name TEXT,\ + PublicKey TEXT UNIQUE,\ + PrivateKey TEXT UNIQUE,\ + 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',\ + FreesiteEdition INTEGER,\ + InsertingIdentity BOOL CHECK(InsertingIdentity IN('true','false')) DEFAULT 'false',\ + LastInsertedIdentity DATETIME,\ + InsertingPuzzle BOOL CHECK(InsertingPuzzle IN('true','false')) DEFAULT 'false',\ + LastInsertedPuzzle DATETIME,\ + InsertingTrustList BOOL CHECK(InsertingTrustList IN('true','false')) DEFAULT 'false',\ + LastInsertedTrustList DATETIME,\ + LastInsertedBoardList DATETIME,\ + LastInsertedMessageList DATETIME,\ + LastInsertedFreesite DATETIME,\ + DateCreated DATETIME,\ + MinMessageDelay INTEGER DEFAULT 0,\ + MaxMessageDelay INTEGER DEFAULT 0\ + );"); + db->Execute("INSERT INTO tblLocalIdentity SELECT LocalIdentityID,Name,PublicKey,PrivateKey,SingleUse,PublishTrustList,PublishBoardList,PublishFreesite,FreesiteEdition,InsertingIdentity,LastInsertedIdentity,InsertingPuzzle,LastInsertedPuzzle,InsertingTrustList,LastInsertedTrustList,LastInsertedBoardList,LastInsertedMessageList,LastInsertedFreesite,DateCreated,0,0 FROM tblLocalIdentityTemp;"); + db->Execute("DROP TABLE IF EXISTS tblLocalIdentityTemp;"); + + db->Execute("CREATE TEMPORARY TABLE tblIdentityTemp AS SELECT * FROM tblIdentity;"); + db->Execute("DROP TABLE IF EXISTS tblIdentity;"); + db->Execute("CREATE TABLE IF NOT EXISTS tblIdentity(\ + IdentityID INTEGER PRIMARY KEY,\ + PublicKey TEXT UNIQUE,\ + Name TEXT,\ + 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',\ + FreesiteEdition INTEGER,\ + DateAdded DATETIME,\ + LastSeen DATETIME,\ + LocalMessageTrust INTEGER CHECK(LocalMessageTrust BETWEEN 0 AND 100) DEFAULT NULL,\ + PeerMessageTrust INTEGER CHECK(PeerMessageTrust BETWEEN 0 AND 100) DEFAULT NULL,\ + LocalTrustListTrust INTEGER CHECK(LocalTrustListTrust BETWEEN 0 AND 100) DEFAULT NULL,\ + PeerTrustListTrust INTEGER CHECK(PeerTrustListTrust BETWEEN 0 AND 100) DEFAULT NULL,\ + AddedMethod TEXT,\ + Hidden BOOL CHECK(Hidden IN('true','false')) DEFAULT 'false'\ + );"); + db->Execute("INSERT INTO tblIdentity SELECT IdentityID,PublicKey,Name,SingleUse,PublishTrustList,PublishBoardList,FreesiteEdition,DateAdded,LastSeen,LocalMessageTrust,PeerMessageTrust,LocalTrustListTrust,PeerTrustListTrust,AddedMethod,Hidden FROM tblIdentityTemp;"); + db->Execute("DROP TABLE IF EXISTS tblIdentityTemp;"); + + db->Execute("UPDATE tblDBVersion SET Major=1, Minor=11;"); +} + +void ConvertDB0111To0112() +{ + /* + Add Section, SortOrder, ValidValues to tblOption + Add PurgeDate to tblIdentity + */ + SQLite3DB::DB *db=SQLite3DB::DB::Instance(); + + db->Execute("ALTER TABLE tblOption ADD COLUMN Section TEXT;"); + db->Execute("ALTER TABLE tblOption ADD COLUMN SortOrder INTEGER;"); + db->Execute("ALTER TABLE tblOption ADD COLUMN ValidValues TEXT;"); + + db->Execute("ALTER TABLE tblIdentity ADD COLUMN PurgeDate DATETIME;"); + + db->Execute("UPDATE tblDBVersion SET Major=1, Minor=12;"); +} + 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 @@ -583,6 +778,8 @@ void SetupDefaultOptions() std::ostringstream tempstr; // must set tempstr to "" between db inserts SQLite3DB::DB *db=SQLite3DB::DB::Instance(); SQLite3DB::Statement st=db->Prepare("INSERT INTO tblOption(Option,OptionValue,OptionDescription) VALUES(?,?,?);"); + SQLite3DB::Statement upd=db->Prepare("UPDATE tblOption SET Section=?, SortOrder=?, ValidValues=? WHERE Option=?;"); + int order=0; // LogLevel tempstr.str(""); @@ -592,6 +789,49 @@ void SetupDefaultOptions() st.Bind(2,"The maximum logging level that will be written to file. 0=Fatal Errors, 1=Errors, 2=Warnings, 3=Informational Messages, 4=Debug Messages. Higher levels will include all messages from the previous levels."); st.Step(); st.Reset(); + upd.Bind(0,"Program"); + upd.Bind(1,order++); + upd.Bind(2,"0|0 - Fatal Errors|1|1 - Errors|2|2 - Warnings|3|3 - Informational Messages|4|4 - Debug Messages"); + upd.Bind(3,"LogLevel"); + upd.Step(); + upd.Reset(); + + st.Bind(0,"VacuumOnStartup"); + st.Bind(1,"false"); + st.Bind(2,"VACUUM the database every time FMS starts. This will defragment the free space in the database and create a smaller database file. Vacuuming the database can be CPU and disk intensive."); + st.Step(); + st.Reset(); + upd.Bind(0,"Program"); + upd.Bind(1,order++); + upd.Bind(2,"true|true|false|false"); + upd.Bind(3,"VacuumOnStartup"); + upd.Step(); + upd.Reset(); + + st.Bind(0,"MessageBase"); + st.Bind(1,"fms"); + st.Bind(2,"A unique string shared by all clients who want to communicate with each other. This should not be changed unless you want to create your own separate communications network."); + st.Step(); + st.Reset(); + upd.Bind(0,"Program"); + upd.Bind(1,order++); + upd.Bind(2); + upd.Bind(3,"MessageBase"); + upd.Step(); + upd.Reset(); + + // StartNNTP + st.Bind(0,"StartNNTP"); + st.Bind(1,"true"); + st.Bind(2,"Start NNTP server."); + st.Step(); + st.Reset(); + upd.Bind(0,"NNTP Server"); + upd.Bind(1,order++); + upd.Bind(2,"true|true|false|false"); + upd.Bind(3,"StartNNTP"); + upd.Step(); + upd.Reset(); // NNTPListenPort st.Bind(0,"NNTPListenPort"); @@ -599,6 +839,12 @@ void SetupDefaultOptions() st.Bind(2,"The port that the NNTP service will listen for incoming connections."); st.Step(); st.Reset(); + upd.Bind(0,"NNTP Server"); + upd.Bind(1,order++); + upd.Bind(2); + upd.Bind(3,"NNTPListenPort"); + upd.Step(); + upd.Reset(); // NNTPBindAddresses st.Bind(0,"NNTPBindAddresses"); @@ -606,37 +852,60 @@ void SetupDefaultOptions() st.Bind(2,"A comma separated list of valid IPv4 or IPv6 addresses/hostnames that the NNTP service will try to bind to."); st.Step(); st.Reset(); + upd.Bind(0,"NNTP Server"); + upd.Bind(1,order++); + upd.Bind(2); + upd.Bind(3,"NNTPBindAddresses"); + upd.Step(); + upd.Reset(); st.Bind(0,"NNTPAllowPost"); st.Bind(1,"true"); st.Bind(2,"Allow posting messages from NNTP. Setting to false will make the newsgroups read only."); st.Step(); st.Reset(); - - // StartNNTP - st.Bind(0,"StartNNTP"); - st.Bind(1,"true"); - st.Bind(2,"Start NNTP server."); - st.Step(); - st.Reset(); + upd.Bind(0,"NNTP Server"); + upd.Bind(1,order++); + upd.Bind(2,"true|true|false|false"); + upd.Bind(3,"NNTPAllowPost"); + upd.Step(); + upd.Reset(); st.Bind(0,"StartHTTP"); st.Bind(1,"true"); 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(); + upd.Bind(0,"HTTP Server"); + upd.Bind(1,order++); + upd.Bind(2,"true|true|false|false"); + upd.Bind(3,"StartHTTP"); + upd.Step(); + upd.Reset(); st.Bind(0,"HTTPListenPort"); st.Bind(1,"8080"); st.Bind(2,"Port HTTP server will listen on."); st.Step(); st.Reset(); + upd.Bind(0,"HTTP Server"); + upd.Bind(1,order++); + upd.Bind(2); + upd.Bind(3,"HTTPListenPort"); + upd.Step(); + upd.Reset(); st.Bind(0,"HTTPAccessControl"); st.Bind(1,"-0.0.0.0/0,+127.0.0.1"); - st.Bind(2,"Comma separated list of addresses and/or subnet masks that are allowed access to the administration pages. Default is localhost only. + allows a host, - denies as host."); + st.Bind(2,"Comma separated list of addresses and/or subnet masks that are allowed access to the administration pages. Default is localhost only. + allows a host, - denies a host."); st.Step(); st.Reset(); + upd.Bind(0,"HTTP Server"); + upd.Bind(1,order++); + upd.Bind(2); + upd.Bind(3,"HTTPAccessControl"); + upd.Step(); + upd.Reset(); // StartFreenetUpdater st.Bind(0,"StartFreenetUpdater"); @@ -644,6 +913,12 @@ void SetupDefaultOptions() 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(); + upd.Bind(0,"Freenet Connection"); + upd.Bind(1,order++); + upd.Bind(2,"true|true|false|false"); + upd.Bind(3,"StartFreenetUpdater"); + upd.Step(); + upd.Reset(); // FCPHost st.Bind(0,"FCPHost"); @@ -651,6 +926,12 @@ void SetupDefaultOptions() st.Bind(2,"Host name or address of Freenet node."); st.Step(); st.Reset(); + upd.Bind(0,"Freenet Connection"); + upd.Bind(1,order++); + upd.Bind(2); + upd.Bind(3,"FCPHost"); + upd.Step(); + upd.Reset(); // FCPPort st.Bind(0,"FCPPort"); @@ -658,126 +939,264 @@ void SetupDefaultOptions() st.Bind(2,"The port that Freenet is listening for FCP connections on."); st.Step(); st.Reset(); - - st.Bind(0,"MessageBase"); - st.Bind(1,"fms"); - st.Bind(2,"A unique string shared by all clients who want to communicate with each other. This should not be changed unless you want to create your own separate communications network."); + upd.Bind(0,"Freenet Connection"); + upd.Bind(1,order++); + upd.Bind(2); + upd.Bind(3,"FCPPort"); + upd.Step(); + upd.Reset(); + + st.Bind(0,"FProxyPort"); + st.Bind(1,"8888"); + st.Bind(2,"The port that Freenet is listening for http connections on."); st.Step(); st.Reset(); + upd.Bind(0,"Freenet Connection"); + upd.Bind(1,order++); + upd.Bind(2); + upd.Bind(3,"FProxyPort"); + upd.Step(); + upd.Reset(); st.Bind(0,"MaxIdentityRequests"); st.Bind(1,"5"); st.Bind(2,"Maximum number of concurrent requests for new Identity xml files"); st.Step(); st.Reset(); + upd.Bind(0,"Requests"); + upd.Bind(1,order++); + upd.Bind(2); + upd.Bind(3,"MaxIdentityRequests"); + upd.Step(); + upd.Reset(); st.Bind(0,"MaxIdentityIntroductionRequests"); st.Bind(1,"5"); st.Bind(2,"Maximum number of concurrent identities requesting IdentityIntroduction xml files. Each identity may have multiple requests pending."); st.Step(); st.Reset(); + upd.Bind(0,"Requests"); + upd.Bind(1,order++); + upd.Bind(2); + upd.Bind(3,"MaxIdentityIntroductionRequests"); + upd.Step(); + upd.Reset(); st.Bind(0,"MaxIntroductionPuzzleRequests"); st.Bind(1,"5"); st.Bind(2,"Maximum number of concurrent requests for new IntroductionPuzzle xml files"); st.Step(); st.Reset(); + upd.Bind(0,"Requests"); + upd.Bind(1,order++); + upd.Bind(2); + upd.Bind(3,"MaxIntroductionPuzzleRequests"); + upd.Step(); + upd.Reset(); st.Bind(0,"MaxTrustListRequests"); st.Bind(1,"5"); st.Bind(2,"Maximum number of concurrent requests for new Trust Lists"); st.Step(); st.Reset(); + upd.Bind(0,"Requests"); + upd.Bind(1,order++); + upd.Bind(2); + upd.Bind(3,"MaxTrustListRequests"); + upd.Step(); + upd.Reset(); st.Bind(0,"MaxMessageListRequests"); st.Bind(1,"5"); st.Bind(2,"Maximum number of concurrent requests for new Message Lists"); st.Step(); st.Reset(); + upd.Bind(0,"Requests"); + upd.Bind(1,order++); + upd.Bind(2); + upd.Bind(3,"MaxMessageListRequests"); + upd.Step(); + upd.Reset(); st.Bind(0,"MaxMessageRequests"); st.Bind(1,"20"); st.Bind(2,"Maximum number of concurrent requests for new Messages"); st.Step(); st.Reset(); + upd.Bind(0,"Requests"); + upd.Bind(1,order++); + upd.Bind(2); + upd.Bind(3,"MaxMessageRequests"); + upd.Step(); + upd.Reset(); + + st.Bind(0,"MaxBoardListRequests"); + st.Bind(1,"5"); + st.Bind(2,"The maximum number of concurrent requests for new Board Lists. Set to 0 to disable."); + st.Step(); + st.Reset(); + upd.Bind(0,"Requests"); + upd.Bind(1,order++); + upd.Bind(2); + upd.Bind(3,"MaxBoardListRequests"); + upd.Step(); + upd.Reset(); st.Bind(0,"MinLocalMessageTrust"); st.Bind(1,"50"); st.Bind(2,"Specifies a local message trust level that a peer must have before its messages will be downloaded."); st.Step(); st.Reset(); + upd.Bind(0,"Trust"); + upd.Bind(1,order++); + upd.Bind(2); + upd.Bind(3,"MinLocalMessageTrust"); + upd.Step(); + upd.Reset(); st.Bind(0,"MinPeerMessageTrust"); st.Bind(1,"30"); st.Bind(2,"Specifies a peer message trust level that a peer must have before its messages will be downloaded."); st.Step(); st.Reset(); + upd.Bind(0,"Trust"); + upd.Bind(1,order++); + upd.Bind(2); + upd.Bind(3,"MinPeerMessageTrust"); + upd.Step(); + upd.Reset(); st.Bind(0,"MinLocalTrustListTrust"); 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(); + upd.Bind(0,"Trust"); + upd.Bind(1,order++); + upd.Bind(2); + upd.Bind(3,"MinLocalTrustListTrust"); + upd.Step(); + upd.Reset(); st.Bind(0,"MinPeerTrustListTrust"); st.Bind(1,"30"); st.Bind(2,"Specifies a peer 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(); + upd.Bind(0,"Trust"); + upd.Bind(1,order++); + upd.Bind(2); + upd.Bind(3,"MinPeerTrustListTrust"); + upd.Step(); + upd.Reset(); + + st.Bind(0,"LocalTrustOverridesPeerTrust"); + st.Bind(1,"false"); + st.Bind(2,"Set to true if you want your local trust levels to override the peer levels when determining which identities you will poll."); + st.Step(); + st.Reset(); + upd.Bind(0,"Trust"); + upd.Bind(1,order++); + upd.Bind(2,"true|true|false|false"); + upd.Bind(3,"LocalTrustOverridesPeerTrust"); + upd.Step(); + upd.Reset(); st.Bind(0,"MessageDownloadMaxDaysBackward"); st.Bind(1,"5"); st.Bind(2,"The maximum number of days backward that messages will be downloaded from each identity"); st.Step(); st.Reset(); + upd.Bind(0,"Messages"); + upd.Bind(1,order++); + upd.Bind(2); + upd.Bind(3,"MessageDownloadMaxDaysBackward"); + upd.Step(); + upd.Reset(); st.Bind(0,"MessageListDaysBackward"); st.Bind(1,"5"); st.Bind(2,"The number of days backward that messages you have inserted will appear in your MessageLists"); st.Step(); st.Reset(); + upd.Bind(0,"Messages"); + upd.Bind(1,order++); + upd.Bind(2); + upd.Bind(3,"MessageListDaysBackward"); + upd.Step(); + upd.Reset(); st.Bind(0,"MaxPeerMessagesPerDay"); st.Bind(1,"200"); st.Bind(2,"The maximum number of messages you will download from each peer on a given day."); st.Step(); st.Reset(); - - st.Bind(0,"MaxBoardListRequests"); - st.Bind(1,"5"); - st.Bind(2,"The maximum number of concurrent requests for new Board Lists. Set to 0 to disable."); - st.Step(); - st.Reset(); + upd.Bind(0,"Messages"); + upd.Bind(1,order++); + upd.Bind(2); + upd.Bind(3,"MaxPeerMessagesPerDay"); + upd.Step(); + upd.Reset(); st.Bind(0,"MaxBoardsPerMessage"); st.Bind(1,"8"); st.Bind(2,"The maximum number of boards a received message may be sent to. Boards over this limit will be ignored."); st.Step(); st.Reset(); + upd.Bind(0,"Messages"); + upd.Bind(1,order++); + upd.Bind(2); + upd.Bind(3,"MaxBoardsPerMessage"); + upd.Step(); + upd.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(); + upd.Bind(0,"Messages"); + upd.Bind(1,order++); + upd.Bind(2,"true|true|false|false"); + upd.Bind(3,"SaveMessagesFromNewBoards"); + upd.Step(); + upd.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."); st.Step(); st.Reset(); + upd.Bind(0,"Messages"); + upd.Bind(1,order++); + upd.Bind(2); + upd.Bind(3,"ChangeMessageTrustOnReply"); + upd.Step(); + upd.Reset(); st.Bind(0,"AddNewPostFromIdentities"); st.Bind(1,"false"); st.Bind(2,"Set to true to automatically create new identities when you send a message using a new name. If you set this to false, posting messages will fail until you manually create the identity."); st.Step(); st.Reset(); + upd.Bind(0,"Messages"); + upd.Bind(1,order++); + upd.Bind(2,"true|true|false|false"); + upd.Bind(3,"AddNewPostFromIdentities"); + upd.Step(); + upd.Reset(); st.Bind(0,"DeleteMessagesOlderThan"); st.Bind(1,"180"); st.Bind(2,"Automatically delete messages older than this many days."); st.Step(); st.Reset(); + upd.Bind(0,"Messages"); + upd.Bind(1,order++); + upd.Bind(2); + upd.Bind(3,"DeleteMessagesOlderThan"); + upd.Step(); + upd.Reset(); } @@ -818,6 +1237,9 @@ void SetupNetwork() void Shutdown() { + + LogFile::Instance()->WriteLog(LogFile::LOGLEVEL_DEBUG,"FMS starting shutdown"); + ThreadController::Instance()->ShutdownThreads(); ShutdownNetwork();