X-Git-Url: https://git.pterodactylus.net/?a=blobdiff_plain;f=src%2Ffreenet%2Fidentityinserter.cpp;h=f246d66402989d8bb6c75e1bba1fa51bc1786b30;hb=e773b0ecb8a35c67cde5b2e82bbebb05224f34d0;hp=aa1f4ab8f19ecb8ebb6e9fa28f3cf0b0cfc3a224;hpb=964f55fd550fc711c0320ce6a24ad713040695d0;p=fms.git diff --git a/src/freenet/identityinserter.cpp b/src/freenet/identityinserter.cpp index aa1f4ab..f246d66 100644 --- a/src/freenet/identityinserter.cpp +++ b/src/freenet/identityinserter.cpp @@ -84,10 +84,14 @@ const bool IdentityInserter::HandleMessage(FCPMessage &message) // If this is the case, we will skip updating LastInsertedIdentity so that we can insert this identity again for today DateTime lastdate; lastdate.Set(idparts[4]); - if(lastdate.GetDay()!=now.GetDay()) + if(lastdate.GetDay()==now.GetDay()) { m_db->Execute("UPDATE tblLocalIdentity SET InsertingIdentity='false', LastInsertedIdentity='"+now.Format("%Y-%m-%d %H:%M:%S")+"' WHERE LocalIdentityID="+idparts[1]+";"); } + else + { + m_db->Execute("UPDATE tblLocalIdentity SET InsertingIdentity='false' WHERE LocalIdentityID="+idparts[1]+";"); + } m_db->Execute("INSERT INTO tblLocalIdentityInserts(LocalIdentityID,Day,InsertIndex) VALUES("+idparts[1]+",'"+idparts[4]+"',"+idparts[2]+");"); m_log->WriteLog(LogFile::LOGLEVEL_DEBUG,"IdentityInserter::HandleMessage inserted Identity xml"); return true; @@ -146,7 +150,7 @@ void IdentityInserter::StartInsert(const long localidentityid) StringFunctions::Convert(localidentityid,idstring); date.SetToGMTime(); - SQLite3DB::Recordset rs=m_db->Query("SELECT Name,PrivateKey,SingleUse,PublishTrustList,PublishBoardList FROM tblLocalIdentity WHERE LocalIdentityID="+idstring+";"); + SQLite3DB::Recordset rs=m_db->Query("SELECT Name,PrivateKey,SingleUse,PublishTrustList,PublishBoardList,PublishFreesite,FreesiteEdition FROM tblLocalIdentity WHERE LocalIdentityID="+idstring+";"); if(rs.Empty()==false) { @@ -162,6 +166,8 @@ void IdentityInserter::StartInsert(const long localidentityid) std::string singleuse="false"; std::string publishtrustlist="false"; std::string publishboardlist="false"; + std::string freesiteedition=""; + int edition=-1; now.SetToGMTime(); @@ -179,7 +185,7 @@ void IdentityInserter::StartInsert(const long localidentityid) } StringFunctions::Convert(index,indexstr); - Option::instance()->Get("MessageBase",messagebase); + Option::Instance()->Get("MessageBase",messagebase); if(rs.GetField(0)) { @@ -209,6 +215,16 @@ void IdentityInserter::StartInsert(const long localidentityid) } publishboardlist=="true" ? idxml.SetPublishBoardList(true) : idxml.SetPublishBoardList(false); + if(rs.GetField(5) && rs.GetField(6)) + { + if(std::string(rs.GetField(5))=="true") + { + freesiteedition=rs.GetField(6); + StringFunctions::Convert(freesiteedition,edition); + idxml.SetFreesiteEdition(edition); + } + } + data=idxml.GetXML(); StringFunctions::Convert(data.size(),datasizestr);