version 0.1.2
[fms.git] / src / freenet / trustlistinserter.cpp
index bd8f87c..6cd8843 100644 (file)
@@ -126,15 +126,18 @@ void TrustListInserter::StartInsert(const long localidentityid, const std::strin
        std::string publickey;\r
        int messagetrust;\r
        int trustlisttrust;\r
-       DateTime now;\r
+       DateTime now,date;\r
        int index;\r
        std::string indexstr;\r
        std::string localidentityidstr;\r
 \r
        now.SetToGMTime();\r
-       \r
-       // build the xml file\r
-       SQLite3DB::Statement st=m_db->Prepare("SELECT PublicKey, LocalMessageTrust, LocalTrustListTrust FROM tblIdentity WHERE PublicKey IS NOT NULL AND PublicKey<>'';");\r
+       date.SetToGMTime();\r
+\r
+       // build the xml file - we only want to add identities that we recently saw, otherwise we could be inserting a ton of identities\r
+       date.Add(0,0,0,-20);    // identities seen in last 20 days\r
+       SQLite3DB::Statement st=m_db->Prepare("SELECT PublicKey, LocalMessageTrust, LocalTrustListTrust FROM tblIdentity WHERE PublicKey IS NOT NULL AND PublicKey<>'' AND LastSeen>=?;");\r
+       st.Bind(0,date.Format("%Y-%m-%d"));\r
        st.Step();\r
        while(st.RowReturned())\r
        {\r