version 0.0.3
[fms.git] / src / freenet / identityinserter.cpp
index 028f495..4fac82f 100644 (file)
@@ -26,10 +26,13 @@ void IdentityInserter::CheckForNeededInsert()
        // set date to 1 hour back\r
        date.Add(0,0,-1);\r
 \r
-       // Because of importance of Identity.xml, if we are now at the next day we immediately want to insert identities so change the date back to now\r
+       // Because of importance of Identity.xml, if we are now at the next day we immediately want to insert identities so change the date back to 12:00 AM so we find all identities not inserted yet today\r
        if(date.GetDay()!=now.GetDay())\r
        {\r
                date=now;\r
+               date.SetHour(0);\r
+               date.SetMinute(0);\r
+               date.SetSecond(0);\r
        }\r
 \r
        SQLite3DB::Recordset rs=m_db->Query("SELECT LocalIdentityID FROM tblLocalIdentity WHERE PrivateKey IS NOT NULL AND PrivateKey <> '' AND InsertingIdentity='false' AND (LastInsertedIdentity<'"+date.Format("%Y-%m-%d %H:%M:%S")+"' OR LastInsertedIdentity IS NULL) ORDER BY LastInsertedIdentity;");\r
@@ -79,7 +82,7 @@ const bool IdentityInserter::HandleMessage(FCPMessage &message)
                {\r
                        m_db->Execute("UPDATE tblLocalIdentity SET InsertingIdentity='false', LastInsertedIdentity='"+now.Format("%Y-%m-%d %H:%M:%S")+"' WHERE LocalIdentityID="+idparts[1]+";");\r
                        m_db->Execute("INSERT INTO tblLocalIdentityInserts(LocalIdentityID,Day,InsertIndex) VALUES("+idparts[1]+",'"+idparts[4]+"',"+idparts[2]+");");\r
-                       m_log->WriteLog(LogFile::LOGLEVEL_DEBUG,__FUNCTION__" inserted identity xml");\r
+                       m_log->WriteLog(LogFile::LOGLEVEL_DEBUG,__FUNCTION__" inserted Identity xml");\r
                        return true;\r
                }\r
 \r
@@ -195,7 +198,7 @@ void IdentityInserter::StartInsert(const long localidentityid)
 \r
                if(rs.GetField(4))\r
                {\r
-                       publishboardlist=rs.GetField(3);\r
+                       publishboardlist=rs.GetField(4);\r
                }\r
                publishboardlist=="true" ? idxml.SetPublishBoardList(true) : idxml.SetPublishBoardList(false);\r
 \r