From 9a14c0d9f7f7c319e539583b93664953764e83b7 Mon Sep 17 00:00:00 2001 From: SomeDude Date: Sat, 10 May 2008 18:35:00 +0200 Subject: [PATCH] version 0.2.15 --- include/freenet/boardlistinserter.h | 2 +- include/freenet/boardlistrequester.h | 1 + include/freenet/fileinserter.h | 2 +- include/freenet/iindexinserter.h | 2 +- include/freenet/messageinserter.h | 2 +- include/freenet/messagelistinserter.h | 3 ++- include/freenet/messagelistrequester.h | 2 ++ include/freenet/messagerequester.h | 1 + include/freenet/siteinserter.h | 2 +- include/global.h | 2 +- src/charsetconverter.cpp | 1 + src/freenet/boardlistinserter.cpp | 4 +++- src/freenet/boardlistrequester.cpp | 21 ++++++++++++++++++- src/freenet/captcha/simplecaptcha.cpp | 9 ++++---- src/freenet/fileinserter.cpp | 4 +++- src/freenet/messageinserter.cpp | 8 ++++++- src/freenet/messagelistinserter.cpp | 38 +++++++++++++++++++++++----------- src/freenet/messagelistrequester.cpp | 22 +++++++++++++++++++- src/freenet/messagerequester.cpp | 25 +++++++++++++++++++--- src/freenet/siteinserter.cpp | 7 ++++++- src/global.cpp | 8 ++++++- src/http/pages/localidentitiespage.cpp | 1 + src/http/pages/peerdetailspage.cpp | 17 ++++++++++++--- 23 files changed, 148 insertions(+), 36 deletions(-) diff --git a/include/freenet/boardlistinserter.h b/include/freenet/boardlistinserter.h index 54b5e80..d041cdb 100644 --- a/include/freenet/boardlistinserter.h +++ b/include/freenet/boardlistinserter.h @@ -13,7 +13,7 @@ private: void Initialize(); const bool HandlePutSuccessful(FCPMessage &message); const bool HandlePutFailed(FCPMessage &message); - void StartInsert(const long &localidentityid); + const bool StartInsert(const long &localidentityid); void CheckForNeededInsert(); }; diff --git a/include/freenet/boardlistrequester.h b/include/freenet/boardlistrequester.h index a917e0a..b2cacb2 100644 --- a/include/freenet/boardlistrequester.h +++ b/include/freenet/boardlistrequester.h @@ -19,6 +19,7 @@ private: std::string GetIdentityName(const long identityid); bool m_savemessagesfromnewboards; + bool m_localtrustoverrides; }; diff --git a/include/freenet/fileinserter.h b/include/freenet/fileinserter.h index efc105a..c02b0ea 100644 --- a/include/freenet/fileinserter.h +++ b/include/freenet/fileinserter.h @@ -13,7 +13,7 @@ private: void Initialize(); const bool HandlePutSuccessful(FCPMessage &message); const bool HandlePutFailed(FCPMessage &message); - void StartInsert(const long &fileinsertid); + const bool StartInsert(const long &fileinsertid); void CheckForNeededInsert(); }; diff --git a/include/freenet/iindexinserter.h b/include/freenet/iindexinserter.h index 035c5f3..0539b29 100644 --- a/include/freenet/iindexinserter.h +++ b/include/freenet/iindexinserter.h @@ -36,7 +36,7 @@ protected: virtual void Initialize()=0; // initialize m_fcpuniquename virtual const bool HandlePutSuccessful(FCPMessage &message)=0; virtual const bool HandlePutFailed(FCPMessage &message)=0; - virtual void StartInsert(const IDTYPE &id)=0; + virtual const bool StartInsert(const IDTYPE &id)=0; virtual void CheckForNeededInsert()=0; virtual void RemoveFromInsertList(const IDTYPE id); diff --git a/include/freenet/messageinserter.h b/include/freenet/messageinserter.h index b762157..a73813e 100644 --- a/include/freenet/messageinserter.h +++ b/include/freenet/messageinserter.h @@ -14,7 +14,7 @@ private: void Initialize(); const bool HandlePutSuccessful(FCPMessage &message); const bool HandlePutFailed(FCPMessage &message); - void StartInsert(const std::string &messageuuid); + const bool StartInsert(const std::string &messageuuid); void CheckForNeededInsert(); }; diff --git a/include/freenet/messagelistinserter.h b/include/freenet/messagelistinserter.h index a0564d3..8658960 100644 --- a/include/freenet/messagelistinserter.h +++ b/include/freenet/messagelistinserter.h @@ -13,10 +13,11 @@ private: void Initialize(); const bool HandlePutSuccessful(FCPMessage &message); const bool HandlePutFailed(FCPMessage &message); - void StartInsert(const long &localidentityid); + const bool StartInsert(const long &localidentityid); void CheckForNeededInsert(); long m_daysbackward; + std::map m_lastinsertedxml; // last xml document inserted for each local identity }; diff --git a/include/freenet/messagelistrequester.h b/include/freenet/messagelistrequester.h index 56895e2..e8463ff 100644 --- a/include/freenet/messagelistrequester.h +++ b/include/freenet/messagelistrequester.h @@ -16,6 +16,8 @@ private: const bool HandleAllData(FCPMessage &message); const bool HandleGetFailed(FCPMessage &message); + bool m_localtrustoverrides; + }; #endif // _messagelistrequester_ diff --git a/include/freenet/messagerequester.h b/include/freenet/messagerequester.h index 31eb580..17b577f 100644 --- a/include/freenet/messagerequester.h +++ b/include/freenet/messagerequester.h @@ -24,6 +24,7 @@ private: long m_maxpeermessages; long m_maxboardspermessage; bool m_savemessagesfromnewboards; + bool m_localtrustoverrides; }; diff --git a/include/freenet/siteinserter.h b/include/freenet/siteinserter.h index fe501f3..a24f3a5 100644 --- a/include/freenet/siteinserter.h +++ b/include/freenet/siteinserter.h @@ -13,7 +13,7 @@ private: void Initialize(); const bool HandlePutSuccessful(FCPMessage &message); const bool HandlePutFailed(FCPMessage &message); - void StartInsert(const long &localidentityid); + const bool StartInsert(const long &localidentityid); void CheckForNeededInsert(); const std::string SanitizeOutput(const std::string &input); void GeneratePages(const long localidentityid, std::string &uskkey, std::map &pages); diff --git a/include/global.h b/include/global.h index 7dcc373..69952d1 100644 --- a/include/global.h +++ b/include/global.h @@ -5,7 +5,7 @@ #include #include "pthreadwrapper/thread.h" -#define FMS_VERSION "0.2.14" +#define FMS_VERSION "0.2.15" // opens database and creates tables and initial inserts if necessary void SetupDB(); diff --git a/src/charsetconverter.cpp b/src/charsetconverter.cpp index 97ba594..4685add 100644 --- a/src/charsetconverter.cpp +++ b/src/charsetconverter.cpp @@ -39,6 +39,7 @@ const bool CharsetConverter::SetConversion(const std::string &fromcharset, const { m_fromcharset=""; m_tocharset=""; + return false; } } diff --git a/src/freenet/boardlistinserter.cpp b/src/freenet/boardlistinserter.cpp index 92ed0b7..6099ff6 100644 --- a/src/freenet/boardlistinserter.cpp +++ b/src/freenet/boardlistinserter.cpp @@ -103,7 +103,7 @@ void BoardListInserter::Initialize() m_fcpuniquename="BoardListInserter"; } -void BoardListInserter::StartInsert(const long &localidentityid) +const bool BoardListInserter::StartInsert(const long &localidentityid) { DateTime daysback; DateTime now; @@ -178,4 +178,6 @@ void BoardListInserter::StartInsert(const long &localidentityid) m_inserting.push_back(localidentityid); + return true; + } diff --git a/src/freenet/boardlistrequester.cpp b/src/freenet/boardlistrequester.cpp index 9fbc6b2..69c2e35 100644 --- a/src/freenet/boardlistrequester.cpp +++ b/src/freenet/boardlistrequester.cpp @@ -219,6 +219,16 @@ void BoardListRequester::Initialize() m_savemessagesfromnewboards=false; } + Option::Instance()->Get("LocalTrustOverridesPeerTrust",tempval); + if(tempval=="true") + { + m_localtrustoverrides=true; + } + else + { + m_localtrustoverrides=false; + } + } void BoardListRequester::PopulateIDList() @@ -227,7 +237,16 @@ void BoardListRequester::PopulateIDList() DateTime today; today.SetToGMTime(); - SQLite3DB::Statement st=m_db->Prepare("SELECT IdentityID FROM tblIdentity WHERE PublicKey IS NOT NULL AND PublicKey <> '' AND LastSeen>='"+today.Format("%Y-%m-%d")+"' AND (LocalMessageTrust IS NULL OR LocalMessageTrust>=(SELECT OptionValue FROM tblOption WHERE Option='MinLocalMessageTrust')) AND (PeerMessageTrust IS NULL OR PeerMessageTrust>=(SELECT OptionValue FROM tblOption WHERE Option='MinPeerMessageTrust')) AND PublishBoardList='true' ORDER BY LocalMessageTrust+LocalTrustListTrust DESC, LastSeen;"); + SQLite3DB::Statement st; + + if(m_localtrustoverrides==false) + { + st=m_db->Prepare("SELECT IdentityID FROM tblIdentity WHERE PublicKey IS NOT NULL AND PublicKey <> '' AND LastSeen>='"+today.Format("%Y-%m-%d")+"' AND (LocalMessageTrust IS NULL OR LocalMessageTrust>=(SELECT OptionValue FROM tblOption WHERE Option='MinLocalMessageTrust')) AND (PeerMessageTrust IS NULL OR PeerMessageTrust>=(SELECT OptionValue FROM tblOption WHERE Option='MinPeerMessageTrust')) AND PublishBoardList='true' ORDER BY LocalMessageTrust+LocalTrustListTrust DESC, LastSeen;"); + } + else + { + st=m_db->Prepare("SELECT IdentityID FROM tblIdentity WHERE PublicKey IS NOT NULL AND PublicKey <> '' AND LastSeen>='"+today.Format("%Y-%m-%d")+"' AND (LocalMessageTrust>=(SELECT OptionValue FROM tblOption WHERE Option='MinLocalMessageTrust') OR (LocalMessageTrust IS NULL AND (PeerMessageTrust IS NULL OR PeerMessageTrust>=(SELECT OptionValue FROM tblOption WHERE Option='MinPeerMessageTrust')))) AND PublishBoardList='true' ORDER BY LocalMessageTrust+LocalTrustListTrust DESC, LastSeen;"); + } st.Step(); m_ids.clear(); diff --git a/src/freenet/captcha/simplecaptcha.cpp b/src/freenet/captcha/simplecaptcha.cpp index 7539f80..3753a12 100644 --- a/src/freenet/captcha/simplecaptcha.cpp +++ b/src/freenet/captcha/simplecaptcha.cpp @@ -53,16 +53,17 @@ void SimpleCaptcha::Generate() double endangle=(double)(rand()%360)*(3.14159/180); pixel.Red=100+(rand()%150); pixel.Green=100+(rand()%150); + pixel.Blue=100+(rand()%150); DrawArc(bmp,x1,y1,radius,startangle,endangle,pixel); } for(int i=0; i<5; i++) { // keep the colors dark - lettercols[i].Red=(rand()%200); - lettercols[i].Green=(rand()%200); - lettercols[i].Blue=(rand()%200); - // draw a line with the letter col + lettercols[i].Red=(rand()%150); + lettercols[i].Green=(rand()%150); + lettercols[i].Blue=(rand()%150); + // draw a line with the letter color DrawAALine(bmp,rand()%bmpwidth,rand()%bmpheight,rand()%bmpwidth,rand()%bmpheight,lettercols[i]); } diff --git a/src/freenet/fileinserter.cpp b/src/freenet/fileinserter.cpp index 4a82bda..42d2777 100644 --- a/src/freenet/fileinserter.cpp +++ b/src/freenet/fileinserter.cpp @@ -69,7 +69,7 @@ void FileInserter::Initialize() m_fcpuniquename="FileInserter"; } -void FileInserter::StartInsert(const long &fileinsertid) +const bool FileInserter::StartInsert(const long &fileinsertid) { FCPMessage message; std::string fileinsertidstr=""; @@ -109,4 +109,6 @@ void FileInserter::StartInsert(const long &fileinsertid) m_fcp->SendRaw(&data[0],data.size()); m_inserting.push_back(fileinsertid); + + return true; } diff --git a/src/freenet/messageinserter.cpp b/src/freenet/messageinserter.cpp index b4e1ce4..3dc1203 100644 --- a/src/freenet/messageinserter.cpp +++ b/src/freenet/messageinserter.cpp @@ -125,7 +125,7 @@ void MessageInserter::Initialize() m_fcpuniquename="MessageInserter"; } -void MessageInserter::StartInsert(const std::string &messageuuid) +const bool MessageInserter::StartInsert(const std::string &messageuuid) { MessageXML xmlfile; DateTime now; @@ -207,6 +207,12 @@ void MessageInserter::StartInsert(const std::string &messageuuid) m_inserting.push_back(messageuuid); m_log->WriteLog(LogFile::LOGLEVEL_DEBUG,"MessageInserter::StartInsert started message insert "+message["URI"]); + + return true; + } + else + { + return false; } } diff --git a/src/freenet/messagelistinserter.cpp b/src/freenet/messagelistinserter.cpp index 6fda244..e0d8957 100644 --- a/src/freenet/messagelistinserter.cpp +++ b/src/freenet/messagelistinserter.cpp @@ -24,6 +24,7 @@ void MessageListInserter::CheckForNeededInsert() std::string sql; DateTime now; DateTime previous; + bool startedinsert=false; now.SetToGMTime(); previous.SetToGMTime(); @@ -41,11 +42,12 @@ void MessageListInserter::CheckForNeededInsert() st.Bind(1,(now-(1.0/48.0)).Format("%Y-%m-%d %H:%M:%S")); st.Step(); - if(st.RowReturned()) + while(st.RowReturned() && startedinsert==false) { int localidentityid; st.ResultInt(0,localidentityid); - StartInsert(localidentityid); + startedinsert=StartInsert(localidentityid); + st.Step(); } } @@ -121,7 +123,7 @@ void MessageListInserter::Initialize() StringFunctions::Convert(tempval,m_daysbackward); } -void MessageListInserter::StartInsert(const long &localidentityid) +const bool MessageListInserter::StartInsert(const long &localidentityid) { FCPMessage message; DateTime date; @@ -214,16 +216,28 @@ void MessageListInserter::StartInsert(const long &localidentityid) // actually insert message xmlstr=mlxml.GetXML(); - StringFunctions::Convert(xmlstr.size(),xmlsizestr); - message.SetName("ClientPut"); - message["URI"]=privatekey+m_messagebase+"|"+now.Format("%Y-%m-%d")+"|MessageList|"+indexstr+".xml"; - message["Identifier"]=m_fcpuniquename+"|"+localidentityidstr+"|"+indexstr+"|"+message["URI"]; - message["UploadFrom"]="direct"; - message["DataLength"]=xmlsizestr; - m_fcp->SendMessage(message); - m_fcp->SendRaw(xmlstr.c_str(),xmlstr.size()); + // only insert if the last message this identity inserted is different than this message + if(m_lastinsertedxml[localidentityid]!=xmlstr) + { + StringFunctions::Convert(xmlstr.size(),xmlsizestr); + + message.SetName("ClientPut"); + message["URI"]=privatekey+m_messagebase+"|"+now.Format("%Y-%m-%d")+"|MessageList|"+indexstr+".xml"; + message["Identifier"]=m_fcpuniquename+"|"+localidentityidstr+"|"+indexstr+"|"+message["URI"]; + message["UploadFrom"]="direct"; + message["DataLength"]=xmlsizestr; + m_fcp->SendMessage(message); + m_fcp->SendRaw(xmlstr.c_str(),xmlstr.size()); + + m_inserting.push_back(localidentityid); - m_inserting.push_back(localidentityid); + m_lastinsertedxml[localidentityid]=xmlstr; + return true; + } + else + { + return false; + } } diff --git a/src/freenet/messagelistrequester.cpp b/src/freenet/messagelistrequester.cpp index bbf8650..ba2d4ff 100644 --- a/src/freenet/messagelistrequester.cpp +++ b/src/freenet/messagelistrequester.cpp @@ -167,6 +167,17 @@ void MessageListRequester::Initialize() { m_log->WriteLog(LogFile::LOGLEVEL_WARNING,"Option MaxMessageListRequests is currently set at "+tempval+". This value might be incorrectly configured."); } + + Option::Instance()->Get("LocalTrustOverridesPeerTrust",tempval); + if(tempval=="true") + { + m_localtrustoverrides=true; + } + else + { + m_localtrustoverrides=false; + } + } void MessageListRequester::PopulateIDList() @@ -176,8 +187,17 @@ void MessageListRequester::PopulateIDList() date.SetToGMTime(); + SQLite3DB::Statement st; + // select identities we want to query (we've seen them today) - sort by their trust level (descending) with secondary sort on how long ago we saw them (ascending) - SQLite3DB::Statement st=m_db->Prepare("SELECT IdentityID FROM tblIdentity WHERE PublicKey IS NOT NULL AND PublicKey <> '' AND LastSeen>='"+date.Format("%Y-%m-%d")+"' AND (LocalMessageTrust IS NULL OR LocalMessageTrust>=(SELECT OptionValue FROM tblOption WHERE Option='MinLocalMessageTrust')) AND (PeerMessageTrust IS NULL OR PeerMessageTrust>=(SELECT OptionValue FROM tblOption WHERE Option='MinPeerMessageTrust')) ORDER BY LocalMessageTrust+LocalTrustListTrust DESC, LastSeen;"); + if(m_localtrustoverrides==false) + { + st=m_db->Prepare("SELECT IdentityID FROM tblIdentity WHERE PublicKey IS NOT NULL AND PublicKey <> '' AND LastSeen>='"+date.Format("%Y-%m-%d")+"' AND (LocalMessageTrust IS NULL OR LocalMessageTrust>=(SELECT OptionValue FROM tblOption WHERE Option='MinLocalMessageTrust')) AND (PeerMessageTrust IS NULL OR PeerMessageTrust>=(SELECT OptionValue FROM tblOption WHERE Option='MinPeerMessageTrust')) ORDER BY LocalMessageTrust+LocalTrustListTrust DESC, LastSeen;"); + } + else + { + st=m_db->Prepare("SELECT IdentityID FROM tblIdentity WHERE PublicKey IS NOT NULL AND PublicKey <> '' AND LastSeen>='"+date.Format("%Y-%m-%d")+"' AND (LocalMessageTrust>=(SELECT OptionValue FROM tblOption WHERE Option='MinLocalMessageTrust') OR (LocalMessageTrust IS NULL AND (PeerMessageTrust IS NULL OR PeerMessageTrust>=(SELECT OptionValue FROM tblOption WHERE Option='MinPeerMessageTrust')))) ORDER BY LocalMessageTrust+LocalTrustListTrust DESC, LastSeen;"); + } st.Step(); m_ids.clear(); diff --git a/src/freenet/messagerequester.cpp b/src/freenet/messagerequester.cpp index 836d402..70a5dba 100644 --- a/src/freenet/messagerequester.cpp +++ b/src/freenet/messagerequester.cpp @@ -367,6 +367,7 @@ void MessageRequester::Initialize() { m_log->WriteLog(LogFile::LOGLEVEL_WARNING,"Option MaxBoardsPerMessage is currently set at "+tempval+". This value might be incorrectly configured."); } + Option::Instance()->Get("SaveMessagesFromNewBoards",tempval); if(tempval=="true") { @@ -376,6 +377,17 @@ void MessageRequester::Initialize() { m_savemessagesfromnewboards=false; } + + Option::Instance()->Get("LocalTrustOverridesPeerTrust",tempval); + if(tempval=="true") + { + m_localtrustoverrides=true; + } + else + { + m_localtrustoverrides=false; + } + } void MessageRequester::PopulateIDList() @@ -392,9 +404,16 @@ void MessageRequester::PopulateIDList() sql="SELECT tblIdentity.IdentityID,Day,RequestIndex "; sql+="FROM tblMessageRequests INNER JOIN tblIdentity ON tblMessageRequests.IdentityID=tblIdentity.IdentityID "; - sql+="WHERE (tblIdentity.LocalMessageTrust IS NULL OR tblIdentity.LocalMessageTrust>=(SELECT OptionValue FROM tblOption WHERE Option='MinLocalMessageTrust')) "; - sql+="AND FromMessageList='true' AND Found='false' AND Day>='"+date.Format("%Y-%m-%d")+"' "; - sql+="AND (tblIdentity.PeerMessageTrust IS NULL OR tblIdentity.PeerMessageTrust>=(SELECT OptionValue FROM tblOption WHERE Option='MinPeerMessageTrust')) "; + sql+="WHERE FromMessageList='true' AND Found='false' AND Day>='"+date.Format("%Y-%m-%d")+"' "; + if(m_localtrustoverrides==false) + { + sql+="AND (tblIdentity.LocalMessageTrust IS NULL OR tblIdentity.LocalMessageTrust>=(SELECT OptionValue FROM tblOption WHERE Option='MinLocalMessageTrust')) "; + sql+="AND (tblIdentity.PeerMessageTrust IS NULL OR tblIdentity.PeerMessageTrust>=(SELECT OptionValue FROM tblOption WHERE Option='MinPeerMessageTrust')) "; + } + else + { + sql+="AND (tblIdentity.LocalMessageTrust>=(SELECT OptionValue FROM tblOption WHERE Option='MinLocalMessageTrust') OR (tblIdentity.LocalMessageTrust IS NULL AND (tblIdentity.PeerMessageTrust IS NULL OR tblIdentity.PeerMessageTrust>=(SELECT OptionValue FROM tblOption WHERE Option='MinPeerMessageTrust')))) "; + } sql+="AND tblIdentity.Name <> '' "; sql+=";"; diff --git a/src/freenet/siteinserter.cpp b/src/freenet/siteinserter.cpp index df4831c..c717d0d 100644 --- a/src/freenet/siteinserter.cpp +++ b/src/freenet/siteinserter.cpp @@ -84,6 +84,9 @@ std::string SiteInserter::GenerateIndex(const std::string &htmltemplate, const l content+=""; content+="
"; content+=SanitizeOutput(post); + //post=SanitizeOutput(post); + //StringFunctions::Replace(post,"\r\n","
"); + //content+=post; content+="
"; content+=""; @@ -414,7 +417,7 @@ const std::string SiteInserter::SanitizeOutput(const std::string &input) return output; } -void SiteInserter::StartInsert(const long &localidentityid) +const bool SiteInserter::StartInsert(const long &localidentityid) { FCPMessage message; std::string localidentityidstr=""; @@ -458,4 +461,6 @@ void SiteInserter::StartInsert(const long &localidentityid) m_inserting.push_back(localidentityid); + return true; + } diff --git a/src/global.cpp b/src/global.cpp index ec296c1..b81ed6f 100644 --- a/src/global.cpp +++ b/src/global.cpp @@ -286,7 +286,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');"); @@ -817,6 +817,12 @@ void SetupDefaultOptions() st.Step(); st.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(); + 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"); diff --git a/src/http/pages/localidentitiespage.cpp b/src/http/pages/localidentitiespage.cpp index 3fd3c48..c06ee5b 100644 --- a/src/http/pages/localidentitiespage.cpp +++ b/src/http/pages/localidentitiespage.cpp @@ -247,6 +247,7 @@ const std::string LocalIdentitiesPage::GeneratePage(const std::string &method, c content+=""; content+="
"; content+=""; + content+=""+publickey+""; st.Step(); count++; } diff --git a/src/http/pages/peerdetailspage.cpp b/src/http/pages/peerdetailspage.cpp index afb1c42..ea38925 100644 --- a/src/http/pages/peerdetailspage.cpp +++ b/src/http/pages/peerdetailspage.cpp @@ -23,9 +23,12 @@ const std::string PeerDetailsPage::GeneratePage(const std::string &method, const std::string fcphost=""; std::string hidden=""; int freesiteedition=-1; + std::string publishtrustlist=""; + std::string messagebase=""; std::string fproxyport="8888"; Option::Instance()->Get("FProxyPort",fproxyport); + Option::Instance()->Get("MessageBase",messagebase); if(queryvars.find("identityid")!=queryvars.end() && (*queryvars.find("identityid")).second!="") { @@ -56,7 +59,7 @@ const std::string PeerDetailsPage::GeneratePage(const std::string &method, const Option::Instance()->Get("FCPHost",fcphost); - SQLite3DB::Statement st=m_db->Prepare("SELECT Name,PublicKey,DateAdded,LastSeen,AddedMethod,Hidden,FreesiteEdition FROM tblIdentity WHERE IdentityID=?;"); + SQLite3DB::Statement st=m_db->Prepare("SELECT Name,PublicKey,DateAdded,LastSeen,AddedMethod,Hidden,FreesiteEdition,PublishTrustList FROM tblIdentity WHERE IdentityID=?;"); st.Bind(0,identityid); st.Step(); @@ -73,13 +76,12 @@ const std::string PeerDetailsPage::GeneratePage(const std::string &method, const { st.ResultInt(6,freesiteedition); } + st.ResultText(7,publishtrustlist); usk=publickey; if(freesiteedition>=0 && usk.find("SSK@")==0) { - std::string messagebase=""; std::string editionstr=""; - Option::Instance()->Get("MessageBase",messagebase); usk.erase(0,3); StringFunctions::Convert(freesiteedition,editionstr); usk="USK"+usk+messagebase+"/"+editionstr+"/"; @@ -95,6 +97,15 @@ const std::string PeerDetailsPage::GeneratePage(const std::string &method, const { content+="Freesite"+SanitizeOutput(usk)+""; } + if(publishtrustlist=="true") + { + std::string lastseendate=lastseen; + if(lastseendate.size()>=10) + { + lastseendate=lastseendate.substr(0,10); + } + content+="Trust List XMLTrust List"; + } content+="Date Added"+dateadded+""; content+="Last Seen"+lastseen+""; content+="Added Method"+SanitizeOutput(addedmethod)+""; -- 2.7.4