version 0.1.12
[fms.git] / src / freenet / introductionpuzzleinserter.cpp
index fef42f1..66635bb 100644 (file)
@@ -201,7 +201,9 @@ void IntroductionPuzzleInserter::StartInsert(const long localidentityid)
        FCPMessage message;\r
        std::string xmldata;\r
        std::string xmldatasizestr;\r
-       std::string privatekey;\r
+       std::string privatekey="";\r
+       std::string publickey="";\r
+       std::string keypart="";\r
 \r
        StringFunctions::Convert(localidentityid,idstring);\r
        now.SetToGMTime();\r
@@ -217,10 +219,19 @@ void IntroductionPuzzleInserter::StartInsert(const long localidentityid)
        }\r
        StringFunctions::Convert(index,indexstr);\r
 \r
-       SQLite3DB::Recordset rs2=m_db->Query("SELECT PrivateKey FROM tblLocalIdentity WHERE LocalIdentityID="+idstring+";");\r
+       SQLite3DB::Recordset rs2=m_db->Query("SELECT PrivateKey,PublicKey FROM tblLocalIdentity WHERE LocalIdentityID="+idstring+";");\r
        if(rs2.Empty()==false && rs2.GetField(0)!=NULL)\r
        {\r
                privatekey=rs2.GetField(0);\r
+               if(rs2.GetField(1))\r
+               {\r
+                       publickey=rs2.GetField(1);\r
+               }\r
+               if(publickey.size()>=50)\r
+               {\r
+                       // remove - and ~\r
+                       keypart=StringFunctions::Replace(StringFunctions::Replace(publickey.substr(4,43),"-",""),"~","");\r
+               }\r
        }\r
 \r
        Option::Instance()->Get("MessageBase",messagebase);\r
@@ -228,7 +239,7 @@ void IntroductionPuzzleInserter::StartInsert(const long localidentityid)
        GenerateCaptcha(encodedpuzzle,solutionstring);\r
 \r
        xml.SetType("captcha");\r
-       xml.SetUUID(uuid.Generate());\r
+       xml.SetUUID(uuid.Generate()+"@"+keypart);\r
        xml.SetPuzzleData(encodedpuzzle);\r
        xml.SetMimeType("image/bmp");\r
 \r