version 0.0.4
[fms.git] / src / freenet / introductionpuzzleinserter.cpp
index f87e2bd..a4b6617 100644 (file)
@@ -112,7 +112,13 @@ const bool IntroductionPuzzleInserter::HandlePutFailed(FCPMessage &message)
        st.Step();\r
        st.Finalize();\r
 \r
-       m_log->WriteLog(LogFile::LOGLEVEL_DEBUG,__FUNCTION__" failed to insert puzzle "+idparts[3]);\r
+       // if fatal error or collision - mark index\r
+       if(message["Fatal"]=="true" || message["Code"]=="9")\r
+       {\r
+               m_db->Execute("UPDATE tblIntroductionPuzzleInserts SET Day='"+idparts[5]+"', InsertIndex="+idparts[2]+", FoundSolution='true' WHERE UUID='"+idparts[3]+"';");\r
+       }\r
+\r
+       m_log->WriteLog(LogFile::LOGLEVEL_DEBUG,"IntroductionPuzzleInserter::HandlePutFailed failed to insert puzzle "+idparts[3]);\r
 \r
        return true;\r
 }\r
@@ -143,7 +149,7 @@ const bool IntroductionPuzzleInserter::HandlePutSuccessful(FCPMessage &message)
        st.Step();\r
        st.Finalize();\r
 \r
-       m_log->WriteLog(LogFile::LOGLEVEL_DEBUG,__FUNCTION__" inserted puzzle "+idparts[3]);\r
+       m_log->WriteLog(LogFile::LOGLEVEL_DEBUG,"IntroductionPuzzleInserter::HandlePutSuccessful inserted puzzle "+idparts[3]);\r
 \r
        return true;\r
 }\r
@@ -234,6 +240,6 @@ void IntroductionPuzzleInserter::StartInsert(const long localidentityid)
        m_db->Execute("UPDATE tblLocalIdentity SET InsertingPuzzle='true' WHERE LocalIdentityID="+idstring+";");\r
        m_db->Execute("INSERT INTO tblIntroductionPuzzleInserts(UUID,Type,MimeType,LocalIdentityID,PuzzleData,PuzzleSolution) VALUES('"+xml.GetUUID()+"','captcha','image/bmp',"+idstring+",'"+encodedpuzzle+"','"+solutionstring+"');");\r
 \r
-       m_log->WriteLog(LogFile::LOGLEVEL_DEBUG,__FUNCTION__" started insert for id "+idstring);\r
+       m_log->WriteLog(LogFile::LOGLEVEL_DEBUG,"IntroductionPuzzleInserter::StartInsert started insert for id "+idstring);\r
 \r
 }\r