X-Git-Url: https://git.pterodactylus.net/?a=blobdiff_plain;f=src%2Ffreenet%2Fidentityintroductioninserter.cpp;h=5d01882c34676502c5c3dbf28386d33ac9369ae1;hb=59a5414ec47a2932a7802fcd1d98c4d80166564f;hp=7537c915144ff06020ccbaa7469e269a85ef6395;hpb=dec33c63afafabf83c3039e916725cac6faef9b3;p=fms.git diff --git a/src/freenet/identityintroductioninserter.cpp b/src/freenet/identityintroductioninserter.cpp index 7537c91..5d01882 100644 --- a/src/freenet/identityintroductioninserter.cpp +++ b/src/freenet/identityintroductioninserter.cpp @@ -10,12 +10,12 @@ #include #endif -IdentityIntroductionInserter::IdentityIntroductionInserter() +IdentityIntroductionInserter::IdentityIntroductionInserter(SQLite3DB::DB *db):IDatabase(db) { Initialize(); } -IdentityIntroductionInserter::IdentityIntroductionInserter(FCPv2 *fcp):IFCPConnected(fcp) +IdentityIntroductionInserter::IdentityIntroductionInserter(SQLite3DB::DB *db, FCPv2::Connection *fcp):IDatabase(db),IFCPConnected(fcp) { Initialize(); } @@ -42,7 +42,7 @@ void IdentityIntroductionInserter::FCPDisconnected() } -const bool IdentityIntroductionInserter::HandleMessage(FCPMessage &message) +const bool IdentityIntroductionInserter::HandleMessage(FCPv2::Message &message) { if(message["Identifier"].find("IdentityIntroductionInserter")==0) @@ -91,7 +91,8 @@ const bool IdentityIntroductionInserter::HandleMessage(FCPMessage &message) void IdentityIntroductionInserter::Initialize() { m_inserting=false; - Option::Instance()->Get("MessageBase",m_messagebase); + Option option(m_db); + option.Get("MessageBase",m_messagebase); } void IdentityIntroductionInserter::Process() @@ -115,12 +116,11 @@ void IdentityIntroductionInserter::RegisterWithThread(FreenetMasterThread *threa void IdentityIntroductionInserter::StartInsert(const long localidentityid, const std::string &day, const std::string &UUID, const std::string &solution) { - FCPMessage message; + FCPv2::Message message; IdentityIntroductionXML xml; std::string publickey; std::string data; std::string datasizestr; -// std::vector hash; std::string encodedhash; SQLite3DB::Statement st=m_db->Prepare("SELECT PublicKey FROM tblLocalIdentity WHERE PublicKey IS NOT NULL AND PublicKey<>'' AND LocalIdentityID=?;"); @@ -140,18 +140,14 @@ void IdentityIntroductionInserter::StartInsert(const long localidentityid, const encodedhash=Poco::DigestEngine::digestToHex(sha1.digest()); StringFunctions::UpperCase(encodedhash,encodedhash); -// hash.resize(20); -// sha1((unsigned char *)solution.c_str(),solution.size(),&hash[0]); -// Hex::Encode(hash,encodedhash); - message.SetName("ClientPut"); message["URI"]="KSK@"+m_messagebase+"|"+day+"|"+UUID+"|"+encodedhash+".xml"; message["Identifier"]="IdentityIntroductionInserter|"+message["URI"]; message["UploadFrom"]="direct"; message["DataLength"]=datasizestr; - m_fcp->SendMessage(message); - m_fcp->SendRaw(data.c_str(),data.size()); + m_fcp->Send(message); + m_fcp->Send(std::vector(data.begin(),data.end())); m_inserting=true; }