X-Git-Url: https://git.pterodactylus.net/?a=blobdiff_plain;f=src%2Ffreenet%2Ftrustlistinserter.cpp;h=b22453db4053089715524a2e829bd5a88d1af00f;hb=5f8a87e41beeda971d6a47a6c6b0555da00af978;hp=bd8f87c9a89cd4c26cd2979fc06ec16a55d01e74;hpb=6b896a9e1dc143bba86795be1e9336549db9b85f;p=fms.git diff --git a/src/freenet/trustlistinserter.cpp b/src/freenet/trustlistinserter.cpp index bd8f87c..b22453d 100644 --- a/src/freenet/trustlistinserter.cpp +++ b/src/freenet/trustlistinserter.cpp @@ -93,7 +93,7 @@ const bool TrustListInserter::HandleMessage(FCPMessage &message) void TrustListInserter::Initialize() { - Option::instance()->Get("MessageBase",m_messagebase); + Option::Instance()->Get("MessageBase",m_messagebase); m_lastchecked.SetToGMTime(); } @@ -126,15 +126,18 @@ void TrustListInserter::StartInsert(const long localidentityid, const std::strin std::string publickey; int messagetrust; int trustlisttrust; - DateTime now; + DateTime now,date; int index; std::string indexstr; std::string localidentityidstr; now.SetToGMTime(); - - // build the xml file - SQLite3DB::Statement st=m_db->Prepare("SELECT PublicKey, LocalMessageTrust, LocalTrustListTrust FROM tblIdentity WHERE PublicKey IS NOT NULL AND PublicKey<>'';"); + date.SetToGMTime(); + + // build the xml file - we only want to add identities that we recently saw, otherwise we could be inserting a ton of identities + date.Add(0,0,0,-20); // identities seen in last 20 days + SQLite3DB::Statement st=m_db->Prepare("SELECT PublicKey, LocalMessageTrust, LocalTrustListTrust FROM tblIdentity WHERE PublicKey IS NOT NULL AND PublicKey<>'' AND LastSeen>=?;"); + st.Bind(0,date.Format("%Y-%m-%d")); st.Step(); while(st.RowReturned()) {