From 44f964d9b2b2d55a5b5672e9297717bd25fa8ee2 Mon Sep 17 00:00:00 2001 From: SomeDude Date: Sat, 3 May 2008 09:43:00 +0200 Subject: [PATCH] version 0.2.13 --- include/freenet/captcha/simplecaptcha.h | 2 ++ include/global.h | 2 +- include/nntp/mime/MimeCode.h | 1 + src/db/sqlite3recordset.cpp | 2 ++ src/freenet/captcha/simplecaptcha.cpp | 2 ++ src/freenet/fcpv2.cpp | 1 + src/freenet/freenetmasterthread.cpp | 3 ++- src/freenet/periodicdbmaintenance.cpp | 4 ++-- src/freenet/siteinserter.cpp | 17 ++++++++++++++++- src/global.cpp | 4 ++++ src/http/ipagehandler.cpp | 2 ++ src/http/pages/insertedfilespage.cpp | 21 ++++++++++++++++++--- src/main.cpp | 5 ++--- src/message.cpp | 10 ++++++++-- src/nntp/mime/Mime.cpp | 1 + src/nntp/nntplistener.cpp | 2 ++ src/nntp/uwildmat.cpp | 1 + src/socketdefines.cpp | 1 + src/uuidgenerator.cpp | 2 ++ 19 files changed, 70 insertions(+), 13 deletions(-) diff --git a/include/freenet/captcha/simplecaptcha.h b/include/freenet/captcha/simplecaptcha.h index 4dec4dc..2bd3d0a 100644 --- a/include/freenet/captcha/simplecaptcha.h +++ b/include/freenet/captcha/simplecaptcha.h @@ -1,6 +1,8 @@ #ifndef _simple_captcha_ #define _simple_captcha_ +#include + #include "icaptcha.h" class SimpleCaptcha:public ICaptcha diff --git a/include/global.h b/include/global.h index 6258372..b1b315b 100644 --- a/include/global.h +++ b/include/global.h @@ -5,7 +5,7 @@ #include #include "pthreadwrapper/thread.h" -#define FMS_VERSION "0.2.12" +#define FMS_VERSION "0.2.13" // opens database and creates tables and initial inserts if necessary void SetupDB(); diff --git a/include/nntp/mime/MimeCode.h b/include/nntp/mime/MimeCode.h index 0b828df..d3d7402 100644 --- a/include/nntp/mime/MimeCode.h +++ b/include/nntp/mime/MimeCode.h @@ -16,6 +16,7 @@ #pragma once #endif // _MSC_VER > 1000 +#include #include #include #include diff --git a/src/db/sqlite3recordset.cpp b/src/db/sqlite3recordset.cpp index 137f7b3..c85a49c 100644 --- a/src/db/sqlite3recordset.cpp +++ b/src/db/sqlite3recordset.cpp @@ -1,5 +1,7 @@ #include "../../include/db/sqlite3db/sqlite3recordset.h" +#include + #ifdef XMEM #include #endif diff --git a/src/freenet/captcha/simplecaptcha.cpp b/src/freenet/captcha/simplecaptcha.cpp index 41d7166..7539f80 100644 --- a/src/freenet/captcha/simplecaptcha.cpp +++ b/src/freenet/captcha/simplecaptcha.cpp @@ -3,6 +3,8 @@ #include "../../../include/freenet/captcha/easybmp/EasyBMP_Font.h" #include "../../../include/freenet/captcha/easybmp/EasyBMP_Geometry.h" +#include + #ifdef XMEM #include #endif diff --git a/src/freenet/fcpv2.cpp b/src/freenet/fcpv2.cpp index 81d706c..16a7348 100644 --- a/src/freenet/fcpv2.cpp +++ b/src/freenet/fcpv2.cpp @@ -2,6 +2,7 @@ #include #include #include +#include #ifdef _WIN32 #include diff --git a/src/freenet/freenetmasterthread.cpp b/src/freenet/freenetmasterthread.cpp index 73d26b6..a6445ad 100644 --- a/src/freenet/freenetmasterthread.cpp +++ b/src/freenet/freenetmasterthread.cpp @@ -20,9 +20,10 @@ #include "../../include/freenet/boardlistrequester.h" #include "../../include/freenet/siteinserter.h" #include "../../include/freenet/fileinserter.h" - #include "../../include/pthreadwrapper/thread.h" +#include + #ifdef XMEM #include #endif diff --git a/src/freenet/periodicdbmaintenance.cpp b/src/freenet/periodicdbmaintenance.cpp index 073da19..caf14ab 100644 --- a/src/freenet/periodicdbmaintenance.cpp +++ b/src/freenet/periodicdbmaintenance.cpp @@ -143,8 +143,6 @@ void PeriodicDBMaintenance::Do1DayMaintenance() m_db->Execute("DELETE FROM tblIntroductionPuzzleInserts WHERE Day<='"+date.Format("%Y-%m-%d")+"';"); m_db->Execute("DELETE FROM tblIntroductionPuzzleRequests WHERE Day<='"+date.Format("%Y-%m-%d")+"';"); - m_log->WriteLog(LogFile::LOGLEVEL_DEBUG,"PeriodicDBMaintenance::Do1DayMaintenance"); - // delete all identities we've never seen and were added more than 20 days ago date.SetToGMTime(); date.Add(0,0,0,-20); @@ -249,6 +247,8 @@ void PeriodicDBMaintenance::Do1DayMaintenance() m_db->Execute("DELETE FROM tblIdentityTrust WHERE LocalIdentityID NOT IN (SELECT LocalIdentityID FROM tblLocalIdentity);"); m_db->Execute("DELETE FROM tblIdentityTrust WHERE IdentityID NOT IN (SELECT IdentityID FROM tblIdentity);"); + m_log->WriteLog(LogFile::LOGLEVEL_DEBUG,"PeriodicDBMaintenance::Do1DayMaintenance"); + } void PeriodicDBMaintenance::Process() diff --git a/src/freenet/siteinserter.cpp b/src/freenet/siteinserter.cpp index 9ee3019..df4831c 100644 --- a/src/freenet/siteinserter.cpp +++ b/src/freenet/siteinserter.cpp @@ -127,14 +127,29 @@ void SiteInserter::GeneratePages(const long localidentityid, std::string &uskkey std::string publishboardliststr=""; bool publishtrustlist=false; bool publishboardlist=false; + std::string editionstr=""; st.ResultText(0,name); st.ResultText(1,key); st.ResultText(2,publishtrustliststr); st.ResultText(3,publishboardliststr); + st.ResultText(4,editionstr); publishtrustliststr=="true" ? publishtrustlist=true : publishtrustlist=false; publishboardliststr=="true" ? publishboardlist=true : publishboardlist=false; + // no edition exists - start at 0 + if(editionstr=="") + { + editionstr="0"; + } + // previous edition exists - add 1 + else + { + int edition=0; + StringFunctions::Convert(editionstr,edition); + edition++; + StringFunctions::Convert(edition,editionstr); + } filename=name+"-template.htm"; FILE *infile=fopen(filename.c_str(),"r+b"); @@ -173,7 +188,7 @@ void SiteInserter::GeneratePages(const long localidentityid, std::string &uskkey key.erase(0,3); key="USK"+key; } - key+=m_messagebase+"/0/"; + key+=m_messagebase+"/"+editionstr+"/"; uskkey=key; } diff --git a/src/global.cpp b/src/global.cpp index aed8c3e..38d51bc 100644 --- a/src/global.cpp +++ b/src/global.cpp @@ -508,6 +508,10 @@ void SetupDB() db->Execute("INSERT INTO tblIdentity(PublicKey,DateAdded,AddedMethod) VALUES('SSK@bloE1LJ~qzSYUkU2nt7sB9kq060D4HTQC66pk5Q8NpA,DOOASUnp0kj6tOdhZJ-h5Tk7Ka50FSrUgsH7tCG1usU,AQACAAE/','"+date.Format("%Y-%m-%d %H:%M:%S")+"','Initial Identity');"); // insert Flink's public key db->Execute("INSERT INTO tblIdentity(PublicKey,DateAdded,AddedMethod) VALUES('SSK@q2TtkNBOuuniyJ56~8NSopCs3ttwe5KlB31ugZtWmXA,6~PzIupS8YK7L6oFNpXGKJmHT2kBMDfwTg73nHdNur8,AQACAAE/','"+date.Format("%Y-%m-%d %H:%M:%S")+"','Initial Identity');"); + // insert Kane's public key + db->Execute("INSERT INTO tblIdentity(PublicKey,DateAdded,AddedMethod) VALUES('SSK@Ofm~yZivDJ5Z2fSzZbMiLEUUQaIc0KHRdZMBTaPLO6I,WLm4s4hNbOOurJ6ijfOq4odz7-dN7uTUvYxJRwWnlMI,AQACAAE/','"+date.Format("%Y-%m-%d %H:%M:%S")+"','Initial Identity');"); + // inserts boardstat's public key + db->Execute("INSERT INTO tblIdentity(PublicKey,DateAdded,AddedMethod) VALUES('SSK@aYWBb6zo2AM13XCNhsmmRKMANEx6PG~C15CWjdZziKA,X1pAG4EIqR1gAiyGFVZ1iiw-uTlh460~rFACJ7ZHQXk,AQACAAE/','"+date.Format("%Y-%m-%d %H:%M:%S")+"','Initial Identity');"); // TODO remove sometime after 0.1.17 FixCapitalBoardNames(); diff --git a/src/http/ipagehandler.cpp b/src/http/ipagehandler.cpp index 3565aab..8599c23 100644 --- a/src/http/ipagehandler.cpp +++ b/src/http/ipagehandler.cpp @@ -2,6 +2,8 @@ #include "../../include/http/httpdefs.h" #include "../../include/stringfunctions.h" +#include + #ifdef XMEM #include #endif diff --git a/src/http/pages/insertedfilespage.cpp b/src/http/pages/insertedfilespage.cpp index c9d4684..1fab7cd 100644 --- a/src/http/pages/insertedfilespage.cpp +++ b/src/http/pages/insertedfilespage.cpp @@ -10,25 +10,40 @@ const std::string InsertedFilesPage::GeneratePage(const std::string &method, con { std::string content="

Inserted Files

"; - SQLite3DB::Statement st=m_db->Prepare("SELECT Key,FileName,Size FROM tblFileInserts WHERE Key IS NOT NULL ORDER BY FileName"); - st.Step(); - std::string node="localhost"; Option::Instance()->Get("FCPHost",node); std::string fproxyport="8888"; Option::Instance()->Get("FProxyPort",fproxyport); + + if(queryvars.find("formaction")!=queryvars.end() && (*queryvars.find("formaction")).second=="removefile" && queryvars.find("fileid")!=queryvars.end()) + { + SQLite3DB::Statement del=m_db->Prepare("DELETE FROM tblFileInserts WHERE FileInsertID=?;"); + del.Bind(0,(*queryvars.find("fileid")).second); + del.Step(); + } + + SQLite3DB::Statement st=m_db->Prepare("SELECT Key,FileName,Size,FileInsertID FROM tblFileInserts WHERE Key IS NOT NULL ORDER BY FileName"); + st.Step(); + while(st.RowReturned()) { std::string key=""; std::string filename=""; std::string sizestr=""; + std::string insertidstr=""; st.ResultText(0,key); st.ResultText(1,filename); st.ResultText(2,sizestr); + st.ResultText(3,insertidstr); content+=""+SanitizeOutput(filename)+" - "+sizestr+" bytes"; + content+="
"; + content+=""; + content+=""; + content+=""; + content+="
"; content+="
"; st.Step(); diff --git a/src/main.cpp b/src/main.cpp index 4bbcb70..69edc54 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -5,9 +5,8 @@ #include #include #include - -//debug -#include "../include/freenet/fcpv2.h" +#include +#include #ifdef _WIN32 #include "../include/fmsservice.h" diff --git a/src/message.cpp b/src/message.cpp index c0bed87..d7aaf3f 100644 --- a/src/message.cpp +++ b/src/message.cpp @@ -696,8 +696,9 @@ const bool Message::ParseNNTPMessage(const std::string &nntpmessage) m_body+=bodypart; } // add a binary file attachment - else if((*i)->GetName()!="" && (*i)->GetLength()>0 && (*i)->GetContent()) + else if(((*i)->GetName()!="" || (*i)->GetFilename()!="") && (*i)->GetLength()>0 && (*i)->GetContent()) { + std::string filename=""; std::string contenttype=""; std::vector data((*i)->GetContent(),(*i)->GetContent()+(*i)->GetContentLength()); if((*i)->GetContentType()) @@ -710,7 +711,12 @@ const bool Message::ParseNNTPMessage(const std::string &nntpmessage) contenttype.erase(endpos); } } - m_fileattachments.push_back(fileattachment((*i)->GetName(),contenttype,data)); + filename=(*i)->GetFilename(); + if(filename=="") + { + filename=(*i)->GetName(); + } + m_fileattachments.push_back(fileattachment(filename,contenttype,data)); } } diff --git a/src/nntp/mime/Mime.cpp b/src/nntp/mime/Mime.cpp index d925590..723ae14 100644 --- a/src/nntp/mime/Mime.cpp +++ b/src/nntp/mime/Mime.cpp @@ -12,6 +12,7 @@ #include "../../../include/nntp/mime/Mime.h" #include #include +#include #ifndef _WIN32 #define stricmp strcasecmp diff --git a/src/nntp/nntplistener.cpp b/src/nntp/nntplistener.cpp index 01fa442..92455f7 100644 --- a/src/nntp/nntplistener.cpp +++ b/src/nntp/nntplistener.cpp @@ -5,6 +5,8 @@ #include "../../include/global.h" #include "../../include/stringfunctions.h" +#include + #ifdef _WIN32 #include #include diff --git a/src/nntp/uwildmat.cpp b/src/nntp/uwildmat.cpp index f726410..cee9ba2 100644 --- a/src/nntp/uwildmat.cpp +++ b/src/nntp/uwildmat.cpp @@ -66,6 +66,7 @@ //#include "libinn.h" #include "../../include/nntp/uwildmat.h" #include +#include #define ABORT -1 diff --git a/src/socketdefines.cpp b/src/socketdefines.cpp index 4b825f3..deddba4 100644 --- a/src/socketdefines.cpp +++ b/src/socketdefines.cpp @@ -1,5 +1,6 @@ #include "../include/socketdefines.h" #include +#include #ifdef XMEM #include diff --git a/src/uuidgenerator.cpp b/src/uuidgenerator.cpp index 65091de..9143bbc 100644 --- a/src/uuidgenerator.cpp +++ b/src/uuidgenerator.cpp @@ -1,5 +1,7 @@ #include "../include/uuidgenerator.h" +#include + #ifdef XMEM #include #endif -- 2.7.4