From: SomeDude Date: Sat, 19 Jan 2008 16:30:00 +0000 (+0100) Subject: version 0.0.4 X-Git-Url: https://git.pterodactylus.net/?a=commitdiff_plain;h=8adfd604a97d385869b0ce763b35d014d7aa2cca;p=fms.git version 0.0.4 --- diff --git a/admin/identitytrust.php b/admin/identitytrust.php new file mode 100644 index 0000000..51803f0 --- /dev/null +++ b/admin/identitytrust.php @@ -0,0 +1,44 @@ +prepare("SELECT IdentityID,Name,LocalMessageTrust,PeerMessageTrust,LocalTrustListTrust,PeerTrustListTrust FROM tblIdentity ORDER BY Name;"); + $st->execute(); + ?> +

Identity Trust

+ + + + + + + + + fetch()) + { + ?> + + + + + + + + +
PeerLocal Message TrustPeer Message TrustLocal Trust List TrustPeer Trust List Trust
+ \ No newline at end of file diff --git a/admin/linkbar.php b/admin/linkbar.php index 6f39f5e..3308497 100644 --- a/admin/linkbar.php +++ b/admin/linkbar.php @@ -12,6 +12,7 @@ function linkbar()
  • Introduce Identity
  • Introduction Status
  • Manually Add Peer
  • +
  • Identity Trust
  • (value)); } virtual const bool Bind(const int column, const double value); virtual const bool Bind(const int column, const std::string &value); virtual const bool Bind(const int column, const void *data, const int length); diff --git a/include/identitytestglobal.h b/include/identitytestglobal.h index b15d875..17f6278 100644 --- a/include/identitytestglobal.h +++ b/include/identitytestglobal.h @@ -4,7 +4,7 @@ #include #include -#define FMS_VERSION "0.0.3" +#define FMS_VERSION "0.0.4" // opens database and creates tables and initial inserts if necessary void SetupDB(); diff --git a/src/db/sqlite3statement.cpp b/src/db/sqlite3statement.cpp index edb2f60..39c699f 100644 --- a/src/db/sqlite3statement.cpp +++ b/src/db/sqlite3statement.cpp @@ -30,7 +30,7 @@ Statement::Statement(sqlite3_stmt *statement) } } -Statement::Statement(Statement &rhs) +Statement::Statement(const Statement &rhs) { m_statement=NULL; m_parametercount=0; diff --git a/src/freenet/freenetmasterthread.cpp b/src/freenet/freenetmasterthread.cpp index 7a593fc..bef4930 100644 --- a/src/freenet/freenetmasterthread.cpp +++ b/src/freenet/freenetmasterthread.cpp @@ -62,7 +62,7 @@ const bool FreenetMasterThread::FCPConnect() m_receivednodehello=false; } - m_log->WriteLog(LogFile::LOGLEVEL_INFO,__FUNCTION__" trying to connect to node "+m_fcphost); + m_log->WriteLog(LogFile::LOGLEVEL_INFO,"FreenetMasterThread::FCPConnect trying to connect to node "+m_fcphost); if(m_fcp.Connect(m_fcphost.c_str(),m_fcpport)==true) { @@ -71,7 +71,7 @@ const bool FreenetMasterThread::FCPConnect() // send ClientHello message to node m_fcp.SendMessage("ClientHello",2,"Name",clientname.c_str(),"ExpectedVersion","2.0"); - m_log->WriteLog(LogFile::LOGLEVEL_INFO,__FUNCTION__" connected to node"); + m_log->WriteLog(LogFile::LOGLEVEL_INFO,"FreenetMasterThread::FCPConnect connected to node"); return true; } @@ -113,7 +113,7 @@ const bool FreenetMasterThread::HandleMessage(FCPMessage &message) { info+="\t\t\t\t"+(*mi).first+"="+(*mi).second+"\r\n"; } - m_log->WriteLog(LogFile::LOGLEVEL_DEBUG,__FUNCTION__" received unhandled "+message.GetName()+" message. Message content :\r\n"+info); + m_log->WriteLog(LogFile::LOGLEVEL_DEBUG,"FreenetMasterThread::HandleMessage received unhandled "+message.GetName()+" message. Message content :\r\n"+info); // if unhandled message was alldata - we must retrieve the data if(message.GetName()=="AllData") @@ -138,7 +138,7 @@ const bool FreenetMasterThread::HandleMessage(FCPMessage &message) } else { - m_log->WriteLog(LogFile::LOGLEVEL_ERROR,__FUNCTION__" received "+message.GetName()+" message before NodeHello"); + m_log->WriteLog(LogFile::LOGLEVEL_ERROR,"FreenetMasterThread::HandleMessage received "+message.GetName()+" message before NodeHello"); } return false; @@ -174,7 +174,7 @@ void FreenetMasterThread::run() if(FCPConnect()==false) { - m_log->WriteLog(LogFile::LOGLEVEL_ERROR,__FUNCTION__" could not connect to node. Waiting 60 seconds."); + m_log->WriteLog(LogFile::LOGLEVEL_ERROR,"FreenetMasterThread::run could not connect to node. Waiting 60 seconds."); // wait 60 seconds - will then try to connect again try diff --git a/src/freenet/identityinserter.cpp b/src/freenet/identityinserter.cpp index 4fac82f..571546a 100644 --- a/src/freenet/identityinserter.cpp +++ b/src/freenet/identityinserter.cpp @@ -82,14 +82,14 @@ const bool IdentityInserter::HandleMessage(FCPMessage &message) { m_db->Execute("UPDATE tblLocalIdentity SET InsertingIdentity='false', LastInsertedIdentity='"+now.Format("%Y-%m-%d %H:%M:%S")+"' WHERE LocalIdentityID="+idparts[1]+";"); m_db->Execute("INSERT INTO tblLocalIdentityInserts(LocalIdentityID,Day,InsertIndex) VALUES("+idparts[1]+",'"+idparts[4]+"',"+idparts[2]+");"); - m_log->WriteLog(LogFile::LOGLEVEL_DEBUG,__FUNCTION__" inserted Identity xml"); + m_log->WriteLog(LogFile::LOGLEVEL_DEBUG,"IdentityInserter::HandleMessage inserted Identity xml"); return true; } if(message.GetName()=="PutFailed") { m_db->Execute("UPDATE tblLocalIdentity SET InsertingIdentity='false' WHERE LocalIdentityID="+idparts[1]+";"); - m_log->WriteLog(LogFile::LOGLEVEL_DEBUG,__FUNCTION__" failure inserting identity xml. Code="+message["Code"]+" Description="+message["CodeDescription"]); + m_log->WriteLog(LogFile::LOGLEVEL_DEBUG,"IdentityInserter::HandleMessage failure inserting Identity xml. Code="+message["Code"]+" Description="+message["CodeDescription"]); // if code 9 (collision), then insert index into inserted table if(message["Code"]=="9") diff --git a/src/freenet/identityintroductioninserter.cpp b/src/freenet/identityintroductioninserter.cpp index dce7b78..aff048b 100644 --- a/src/freenet/identityintroductioninserter.cpp +++ b/src/freenet/identityintroductioninserter.cpp @@ -61,7 +61,7 @@ const bool IdentityIntroductionInserter::HandleMessage(FCPMessage &message) if(message["Fatal"]=="true" || message["Code"]=="9") { m_db->Execute("DELETE FROM tblIdentityIntroductionInserts WHERE UUID='"+idparts[3]+"';"); - m_log->WriteLog(LogFile::LOGLEVEL_WARNING,__FUNCTION__" received fatal error trying to insert IdentityIntroduction "+idparts[3]); + m_log->WriteLog(LogFile::LOGLEVEL_WARNING,"IdentityIntroductionInserter::HandleMessage received fatal error trying to insert IdentityIntroduction "+idparts[3]); } m_inserting=false; return true; @@ -71,7 +71,7 @@ const bool IdentityIntroductionInserter::HandleMessage(FCPMessage &message) { m_db->Execute("UPDATE tblIdentityIntroductionInserts SET Inserted='true' WHERE UUID='"+idparts[3]+"';"); m_inserting=false; - m_log->WriteLog(LogFile::LOGLEVEL_INFO,__FUNCTION__" successfully inserted IdentityIntroduction "+idparts[3]); + m_log->WriteLog(LogFile::LOGLEVEL_INFO,"IdentityIntroductionInserter::HandleMessage successfully inserted IdentityIntroduction "+idparts[3]); return true; } @@ -150,7 +150,7 @@ void IdentityIntroductionInserter::StartInsert(const long localidentityid, const } else { - m_log->WriteLog(LogFile::LOGLEVEL_DEBUG,__FUNCTION__" could not find a public key for identity. It is probably a new identity that doesn't have a key yet."); + m_log->WriteLog(LogFile::LOGLEVEL_DEBUG,"IdentityIntroductionInserter::StartInsert could not find a public key for identity. It is probably a new identity that doesn't have a key yet."); } } \ No newline at end of file diff --git a/src/freenet/identityintroductionrequester.cpp b/src/freenet/identityintroductionrequester.cpp index a474c9c..9fee644 100644 --- a/src/freenet/identityintroductionrequester.cpp +++ b/src/freenet/identityintroductionrequester.cpp @@ -91,10 +91,10 @@ const bool IdentityIntroductionRequester::HandleAllData(FCPMessage &message) } else { - m_log->WriteLog(LogFile::LOGLEVEL_ERROR,__FUNCTION__" parsed public SSK key was not valid."); + m_log->WriteLog(LogFile::LOGLEVEL_ERROR,"IdentityIntroductionRequester::HandleAllData parsed public SSK key was not valid."); } - m_log->WriteLog(LogFile::LOGLEVEL_DEBUG,__FUNCTION__" parsed IdentityIntroduction XML file : "+message["Identifier"]); + m_log->WriteLog(LogFile::LOGLEVEL_DEBUG,"IdentityIntroductionRequester::HandleAllData parsed IdentityIntroduction XML file : "+message["Identifier"]); } else { @@ -104,7 +104,7 @@ const bool IdentityIntroductionRequester::HandleAllData(FCPMessage &message) st.Step(); st.Finalize(); - m_log->WriteLog(LogFile::LOGLEVEL_ERROR,__FUNCTION__" error parsing IdentityIntroduction XML file : "+message["Identifier"]); + m_log->WriteLog(LogFile::LOGLEVEL_ERROR,"IdentityIntroductionRequester::HandleAllData error parsing IdentityIntroduction XML file : "+message["Identifier"]); } // remove UUID from request list @@ -127,7 +127,7 @@ const bool IdentityIntroductionRequester::HandleGetFailed(FCPMessage &message) st.Step(); st.Finalize(); - m_log->WriteLog(LogFile::LOGLEVEL_DEBUG,__FUNCTION__" Fatal GetFailed for "+message["Identifier"]); + m_log->WriteLog(LogFile::LOGLEVEL_DEBUG,"IdentityIntroductionRequester::HandleAllData Fatal GetFailed for "+message["Identifier"]); } // remove UUID from request list @@ -279,7 +279,6 @@ void IdentityIntroductionRequester::StartRequest(const std::string &UUID) st.Bind(0,UUID); st.Step(); - //TODO finish if(st.RowReturned()) { st.ResultText(0,day); diff --git a/src/freenet/identityrequester.cpp b/src/freenet/identityrequester.cpp index 229cc7b..9dc58e1 100644 --- a/src/freenet/identityrequester.cpp +++ b/src/freenet/identityrequester.cpp @@ -104,7 +104,7 @@ const bool IdentityRequester::HandleAllData(FCPMessage &message) st.Step(); st.Finalize(); - m_log->WriteLog(LogFile::LOGLEVEL_DEBUG,__FUNCTION__" parsed Identity XML file : "+message["Identifier"]); + m_log->WriteLog(LogFile::LOGLEVEL_DEBUG,"IdentityRequester::HandleAllData parsed Identity XML file : "+message["Identifier"]); } else { @@ -116,7 +116,7 @@ const bool IdentityRequester::HandleAllData(FCPMessage &message) st.Step(); st.Finalize(); - m_log->WriteLog(LogFile::LOGLEVEL_ERROR,__FUNCTION__" error parsing Identity XML file : "+message["Identifier"]); + m_log->WriteLog(LogFile::LOGLEVEL_ERROR,"IdentityRequester::HandleAllData error parsing Identity XML file : "+message["Identifier"]); } // remove this identityid from request list @@ -149,7 +149,7 @@ const bool IdentityRequester::HandleGetFailed(FCPMessage &message) st.Step(); st.Finalize(); - m_log->WriteLog(LogFile::LOGLEVEL_ERROR,__FUNCTION__" fatal error requesting "+message["Identifier"]); + m_log->WriteLog(LogFile::LOGLEVEL_ERROR,"IdentityRequester::HandleGetFailed fatal error requesting "+message["Identifier"]); } // remove this identityid from request list diff --git a/src/freenet/introductionpuzzleinserter.cpp b/src/freenet/introductionpuzzleinserter.cpp index ea78ace..a4b6617 100644 --- a/src/freenet/introductionpuzzleinserter.cpp +++ b/src/freenet/introductionpuzzleinserter.cpp @@ -118,7 +118,7 @@ const bool IntroductionPuzzleInserter::HandlePutFailed(FCPMessage &message) m_db->Execute("UPDATE tblIntroductionPuzzleInserts SET Day='"+idparts[5]+"', InsertIndex="+idparts[2]+", FoundSolution='true' WHERE UUID='"+idparts[3]+"';"); } - m_log->WriteLog(LogFile::LOGLEVEL_DEBUG,__FUNCTION__" failed to insert puzzle "+idparts[3]); + m_log->WriteLog(LogFile::LOGLEVEL_DEBUG,"IntroductionPuzzleInserter::HandlePutFailed failed to insert puzzle "+idparts[3]); return true; } @@ -149,7 +149,7 @@ const bool IntroductionPuzzleInserter::HandlePutSuccessful(FCPMessage &message) st.Step(); st.Finalize(); - m_log->WriteLog(LogFile::LOGLEVEL_DEBUG,__FUNCTION__" inserted puzzle "+idparts[3]); + m_log->WriteLog(LogFile::LOGLEVEL_DEBUG,"IntroductionPuzzleInserter::HandlePutSuccessful inserted puzzle "+idparts[3]); return true; } @@ -240,6 +240,6 @@ void IntroductionPuzzleInserter::StartInsert(const long localidentityid) m_db->Execute("UPDATE tblLocalIdentity SET InsertingPuzzle='true' WHERE LocalIdentityID="+idstring+";"); m_db->Execute("INSERT INTO tblIntroductionPuzzleInserts(UUID,Type,MimeType,LocalIdentityID,PuzzleData,PuzzleSolution) VALUES('"+xml.GetUUID()+"','captcha','image/bmp',"+idstring+",'"+encodedpuzzle+"','"+solutionstring+"');"); - m_log->WriteLog(LogFile::LOGLEVEL_DEBUG,__FUNCTION__" started insert for id "+idstring); + m_log->WriteLog(LogFile::LOGLEVEL_DEBUG,"IntroductionPuzzleInserter::StartInsert started insert for id "+idstring); } diff --git a/src/freenet/introductionpuzzlerequester.cpp b/src/freenet/introductionpuzzlerequester.cpp index 70a2e8e..c42e4cb 100644 --- a/src/freenet/introductionpuzzlerequester.cpp +++ b/src/freenet/introductionpuzzlerequester.cpp @@ -76,7 +76,7 @@ const bool IntroductionPuzzleRequester::HandleAllData(FCPMessage &message) st.Step(); st.Finalize(); - m_log->WriteLog(LogFile::LOGLEVEL_DEBUG,__FUNCTION__" parsed IntroductionPuzzle XML file : "+message["Identifier"]); + m_log->WriteLog(LogFile::LOGLEVEL_DEBUG,"IntroductionPuzzleRequester::HandleAllData parsed IntroductionPuzzle XML file : "+message["Identifier"]); } else { @@ -88,7 +88,7 @@ const bool IntroductionPuzzleRequester::HandleAllData(FCPMessage &message) st.Step(); st.Finalize(); - m_log->WriteLog(LogFile::LOGLEVEL_ERROR,__FUNCTION__" error parsing IntroductionPuzzle XML file : "+message["Identifier"]); + m_log->WriteLog(LogFile::LOGLEVEL_ERROR,"IntroductionPuzzleRequester::HandleAllData error parsing IntroductionPuzzle XML file : "+message["Identifier"]); } // remove this identityid from request list @@ -121,7 +121,7 @@ const bool IntroductionPuzzleRequester::HandleGetFailed(FCPMessage &message) st.Step(); st.Finalize(); - m_log->WriteLog(LogFile::LOGLEVEL_ERROR,__FUNCTION__" fatal error requesting "+message["Identifier"]); + m_log->WriteLog(LogFile::LOGLEVEL_ERROR,"IntroductionPuzzleRequester::HandleGetFailed fatal error requesting "+message["Identifier"]); } // remove this identityid from request list diff --git a/src/freenet/trustlistinserter.cpp b/src/freenet/trustlistinserter.cpp index c5cc7df..ca689ee 100644 --- a/src/freenet/trustlistinserter.cpp +++ b/src/freenet/trustlistinserter.cpp @@ -68,14 +68,14 @@ const bool TrustListInserter::HandleMessage(FCPMessage &message) { m_db->Execute("UPDATE tblLocalIdentity SET InsertingTrustList='false', LastInsertedTrustList='"+now.Format("%Y-%m-%d %H:%M:%S")+"' WHERE LocalIdentityID="+idparts[1]+";"); m_db->Execute("INSERT INTO tblTrustListInserts(LocalIdentityID,Day,InsertIndex) VALUES("+idparts[1]+",'"+idparts[4]+"',"+idparts[2]+");"); - m_log->WriteLog(LogFile::LOGLEVEL_DEBUG,__FUNCTION__" inserted TrustList xml"); + m_log->WriteLog(LogFile::LOGLEVEL_DEBUG,"TrustListInserter::HandleMessage inserted TrustList xml"); return true; } if(message.GetName()=="PutFailed") { m_db->Execute("UPDATE tblLocalIdentity SET InsertingTrustList='false' WHERE LocalIdentityID="+idparts[1]+";"); - m_log->WriteLog(LogFile::LOGLEVEL_DEBUG,__FUNCTION__" failure inserting TrustList xml. Code="+message["Code"]+" Description="+message["CodeDescription"]); + m_log->WriteLog(LogFile::LOGLEVEL_DEBUG,"TrustListInserter::HandleMessage failure inserting TrustList xml. Code="+message["Code"]+" Description="+message["CodeDescription"]); // if code 9 (collision), then insert index into inserted table if(message["Code"]=="9") diff --git a/src/freenet/trustlistrequester.cpp b/src/freenet/trustlistrequester.cpp index 5b13a6d..f14fc5b 100644 --- a/src/freenet/trustlistrequester.cpp +++ b/src/freenet/trustlistrequester.cpp @@ -112,7 +112,7 @@ const bool TrustListRequester::HandleAllData(FCPMessage &message) st.Step(); st.Finalize(); - m_log->WriteLog(LogFile::LOGLEVEL_DEBUG,__FUNCTION__" parsed TrustList XML file : "+message["Identifier"]); + m_log->WriteLog(LogFile::LOGLEVEL_DEBUG,"TrustListRequester::HandleAllData parsed TrustList XML file : "+message["Identifier"]); } else { @@ -124,7 +124,7 @@ const bool TrustListRequester::HandleAllData(FCPMessage &message) st.Step(); st.Finalize(); - m_log->WriteLog(LogFile::LOGLEVEL_ERROR,__FUNCTION__" error parsing TrustList XML file : "+message["Identifier"]); + m_log->WriteLog(LogFile::LOGLEVEL_ERROR,"TrustListRequester::HandleAllData error parsing TrustList XML file : "+message["Identifier"]); } // remove this identityid from request list @@ -157,7 +157,7 @@ const bool TrustListRequester::HandleGetFailed(FCPMessage &message) st.Step(); st.Finalize(); - m_log->WriteLog(LogFile::LOGLEVEL_ERROR,__FUNCTION__" fatal error requesting "+message["Identifier"]); + m_log->WriteLog(LogFile::LOGLEVEL_ERROR,"TrustListRequester::HandleGetFailed fatal error requesting "+message["Identifier"]); } // remove this identityid from request list diff --git a/src/freenet/trustlistxml.cpp b/src/freenet/trustlistxml.cpp index 1b36aa3..0d0df5c 100644 --- a/src/freenet/trustlistxml.cpp +++ b/src/freenet/trustlistxml.cpp @@ -134,7 +134,7 @@ const bool TrustListXML::ParseXML(const std::string &xml) } else { - m_log->WriteLog(LogFile::LOGLEVEL_ERROR,__FUNCTION__," malformed Trust in TrustList.xml"); + m_log->WriteLog(LogFile::LOGLEVEL_ERROR,"TrustListXML::ParseXML malformed Trust in TrustList.xml"); } node=node->NextSibling("Trust"); diff --git a/src/freenet/unkeyedidcreator.cpp b/src/freenet/unkeyedidcreator.cpp index df46469..6facf86 100644 --- a/src/freenet/unkeyedidcreator.cpp +++ b/src/freenet/unkeyedidcreator.cpp @@ -75,7 +75,7 @@ const bool UnkeyedIDCreator::HandleMessage(FCPMessage &message) SaveKeys(id,message["RequestURI"],message["InsertURI"]); } - m_log->WriteLog(LogFile::LOGLEVEL_INFO,__FUNCTION__" received keypair"); + m_log->WriteLog(LogFile::LOGLEVEL_INFO,"UnkeyedIDCreator::HandleMessage received keypair"); m_waiting=false; diff --git a/src/identitytestglobal.cpp b/src/identitytestglobal.cpp index 4b40288..985cb3f 100644 --- a/src/identitytestglobal.cpp +++ b/src/identitytestglobal.cpp @@ -126,6 +126,45 @@ void SetupDB() TrustListTrust INTEGER CHECK(TrustListTrust BETWEEN 0 AND 100)\ );"); + db->Execute("CREATE TABLE IF NOT EXISTS tblBoard(\ + BoardID INTEGER PRIMARY KEY,\ + BoardName TEXT UNIQUE,\ + BoardDescription TEXT,\ + DateAdded DATETIME\ + );"); + + db->Execute("INSERT INTO tblBoard(BoardName,BoardDescription,DateAdded) VALUES('fms','Freenet Message System','2007-12-01');"); + db->Execute("INSERT INTO tblBoard(BoardName,BoardDescription,DateAdded) VALUES('freenet','Discussion about Freenet','2007-12-01');"); + db->Execute("INSERT INTO tblBoard(BoardName,BoardDescription,DateAdded) VALUES('public','Public discussion','2007-12-01');"); + db->Execute("INSERT INTO tblBoard(BoardName,BoardDescription,DateAdded) VALUES('test','Test board','2007-12-01');"); + + db->Execute("CREATE TABLE IF NOT EXISTS tblMessage(\ + MessageID INTEGER PRIMARY KEY,\ + MessageDate DATE,\ + MessageTime TIME,\ + Subject TEXT,\ + MessageUUID TEXT UNIQUE,\ + ReplyBoardID INTEGER,\ + Body TEXT\ + );"); + + db->Execute("CREATE TABLE IF NOT EXISTS tblMessageReplyTo(\ + MessageID INTEGER,\ + ReplyToMessageID INTEGER,\ + Order INTEGER\ + );"); + + db->Execute("CREATE TABLE IF NOT EXISTS tblMessageBoard(\ + MessageID INTEGER,\ + BoardID 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' \ + FROM tblBoard LEFT JOIN tblMessageBoard ON tblBoard.BoardID=tblMessageBoard.BoardID \ + GROUP BY tblBoard.BoardID;"); + // calculates peer trust db->Execute("CREATE VIEW IF NOT EXISTS vwCalculatedPeerTrust AS \ SELECT TargetIdentityID, \