X-Git-Url: https://git.pterodactylus.net/?a=blobdiff_plain;f=src%2Ffreenet%2Ftrustlistinserter.cpp;fp=src%2Ffreenet%2Ftrustlistinserter.cpp;h=8962d5e9a7ee886ca29eb901446d48835f4fdbeb;hb=b4f4686250878cdf4fcb2986a2ea6546cba867d1;hp=79745ee53e072f6969af538edf19e2363af263aa;hpb=107bd97018964d48425306026d06afd038e84db0;p=fms.git diff --git a/src/freenet/trustlistinserter.cpp b/src/freenet/trustlistinserter.cpp index 79745ee..8962d5e 100644 --- a/src/freenet/trustlistinserter.cpp +++ b/src/freenet/trustlistinserter.cpp @@ -142,10 +142,16 @@ void TrustListInserter::StartInsert(const long localidentityid, const std::strin now.SetToGMTime(); date.SetToGMTime(); + // insert all identities not in trust list already + m_db->Execute("INSERT INTO tblIdentityTrust(LocalIdentityID,IdentityID) SELECT LocalIdentityID,IdentityID FROM tblLocalIdentity,tblIdentity WHERE LocalIdentityID || '_' || IdentityID NOT IN (SELECT LocalIdentityID || '_' || IdentityID FROM tblIdentityTrust);"); + // 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, MessageTrustComment, TrustListTrustComment FROM tblIdentity WHERE PublicKey IS NOT NULL AND PublicKey<>'' AND LastSeen>=?;"); + //SQLite3DB::Statement st=m_db->Prepare("SELECT PublicKey, LocalMessageTrust, LocalTrustListTrust, MessageTrustComment, TrustListTrustComment FROM tblIdentity WHERE PublicKey IS NOT NULL AND PublicKey<>'' AND LastSeen>=?;"); + // we want to order by public key so we can't do identity correllation based on the sequence of identities in the list. + SQLite3DB::Statement st=m_db->Prepare("SELECT PublicKey, tblIdentityTrust.LocalMessageTrust, tblIdentityTrust.LocalTrustListTrust, tblIdentityTrust.MessageTrustComment, tblIdentityTrust.TrustListTrustComment FROM tblIdentity INNER JOIN tblIdentityTrust ON tblIdentity.IdentityID=tblIdentityTrust.IdentityID WHERE PublicKey IS NOT NULL AND PublicKey<>'' AND LastSeen>=? AND tblIdentityTrust.LocalIdentityID=? ORDER BY PublicKey;"); st.Bind(0,date.Format("%Y-%m-%d")); + st.Bind(1,localidentityid); st.Step(); while(st.RowReturned()) {