version 0.2.13
authorSomeDude <SomeDude@NuBL7aaJ6Cn4fB7GXFb9Zfi8w1FhPyW3oKgU9TweZMw>
Sat, 3 May 2008 07:43:00 +0000 (09:43 +0200)
committerDavid ‘Bombe’ Roden <bombe@freenetproject.org>
Sat, 3 May 2008 07:43:00 +0000 (09:43 +0200)
19 files changed:
include/freenet/captcha/simplecaptcha.h
include/global.h
include/nntp/mime/MimeCode.h
src/db/sqlite3recordset.cpp
src/freenet/captcha/simplecaptcha.cpp
src/freenet/fcpv2.cpp
src/freenet/freenetmasterthread.cpp
src/freenet/periodicdbmaintenance.cpp
src/freenet/siteinserter.cpp
src/global.cpp
src/http/ipagehandler.cpp
src/http/pages/insertedfilespage.cpp
src/main.cpp
src/message.cpp
src/nntp/mime/Mime.cpp
src/nntp/nntplistener.cpp
src/nntp/uwildmat.cpp
src/socketdefines.cpp
src/uuidgenerator.cpp

index 4dec4dc..2bd3d0a 100644 (file)
@@ -1,6 +1,8 @@
 #ifndef _simple_captcha_\r
 #define _simple_captcha_\r
 \r
+#include <string>\r
+\r
 #include "icaptcha.h"\r
 \r
 class SimpleCaptcha:public ICaptcha\r
index 6258372..b1b315b 100644 (file)
@@ -5,7 +5,7 @@
 #include <vector>\r
 #include "pthreadwrapper/thread.h"\r
 \r
-#define FMS_VERSION    "0.2.12"\r
+#define FMS_VERSION    "0.2.13"\r
 \r
 // opens database and creates tables and initial inserts if necessary\r
 void SetupDB();\r
index 0b828df..d3d7402 100644 (file)
@@ -16,6 +16,7 @@
 #pragma once\r
 #endif // _MSC_VER > 1000\r
 \r
+#include <cstring>\r
 #include <utility>\r
 #include <string>\r
 #include <list>\r
index 137f7b3..c85a49c 100644 (file)
@@ -1,5 +1,7 @@
 #include "../../include/db/sqlite3db/sqlite3recordset.h"\r
 \r
+#include <cstdlib>\r
+\r
 #ifdef XMEM\r
        #include <xmem.h>\r
 #endif\r
index 41d7166..7539f80 100644 (file)
@@ -3,6 +3,8 @@
 #include "../../../include/freenet/captcha/easybmp/EasyBMP_Font.h"\r
 #include "../../../include/freenet/captcha/easybmp/EasyBMP_Geometry.h"\r
 \r
+#include <cstdlib>\r
+\r
 #ifdef XMEM\r
        #include <xmem.h>\r
 #endif\r
index 81d706c..16a7348 100644 (file)
@@ -2,6 +2,7 @@
 #include <cstdio>\r
 #include <cstdarg>\r
 #include <sstream>\r
+#include <cstring>\r
 \r
 #ifdef _WIN32\r
        #include <ws2tcpip.h>\r
index 73d26b6..a6445ad 100644 (file)
 #include "../../include/freenet/boardlistrequester.h"\r
 #include "../../include/freenet/siteinserter.h"\r
 #include "../../include/freenet/fileinserter.h"\r
-\r
 #include "../../include/pthreadwrapper/thread.h"\r
 \r
+#include <cstdlib>\r
+\r
 #ifdef XMEM\r
        #include <xmem.h>\r
 #endif\r
index 073da19..caf14ab 100644 (file)
@@ -143,8 +143,6 @@ void PeriodicDBMaintenance::Do1DayMaintenance()
        m_db->Execute("DELETE FROM tblIntroductionPuzzleInserts WHERE Day<='"+date.Format("%Y-%m-%d")+"';");\r
        m_db->Execute("DELETE FROM tblIntroductionPuzzleRequests WHERE Day<='"+date.Format("%Y-%m-%d")+"';");\r
 \r
-       m_log->WriteLog(LogFile::LOGLEVEL_DEBUG,"PeriodicDBMaintenance::Do1DayMaintenance");\r
-\r
        // delete all identities we've never seen and were added more than 20 days ago\r
        date.SetToGMTime();\r
        date.Add(0,0,0,-20);\r
@@ -249,6 +247,8 @@ void PeriodicDBMaintenance::Do1DayMaintenance()
        m_db->Execute("DELETE FROM tblIdentityTrust WHERE LocalIdentityID NOT IN (SELECT LocalIdentityID FROM tblLocalIdentity);");\r
        m_db->Execute("DELETE FROM tblIdentityTrust WHERE IdentityID NOT IN (SELECT IdentityID FROM tblIdentity);");\r
 \r
+       m_log->WriteLog(LogFile::LOGLEVEL_DEBUG,"PeriodicDBMaintenance::Do1DayMaintenance");\r
+\r
 }\r
 \r
 void PeriodicDBMaintenance::Process()\r
index 9ee3019..df4831c 100644 (file)
@@ -127,14 +127,29 @@ void SiteInserter::GeneratePages(const long localidentityid, std::string &uskkey
                std::string publishboardliststr="";\r
                bool publishtrustlist=false;\r
                bool publishboardlist=false;\r
+               std::string editionstr="";\r
 \r
                st.ResultText(0,name);\r
                st.ResultText(1,key);\r
                st.ResultText(2,publishtrustliststr);\r
                st.ResultText(3,publishboardliststr);\r
+               st.ResultText(4,editionstr);\r
 \r
                publishtrustliststr=="true" ? publishtrustlist=true : publishtrustlist=false;\r
                publishboardliststr=="true" ? publishboardlist=true : publishboardlist=false;\r
+               // no edition exists - start at 0\r
+               if(editionstr=="")\r
+               {\r
+                       editionstr="0";\r
+               }\r
+               // previous edition exists - add 1\r
+               else\r
+               {\r
+                       int edition=0;\r
+                       StringFunctions::Convert(editionstr,edition);\r
+                       edition++;\r
+                       StringFunctions::Convert(edition,editionstr);\r
+               }\r
 \r
                filename=name+"-template.htm";\r
                FILE *infile=fopen(filename.c_str(),"r+b");\r
@@ -173,7 +188,7 @@ void SiteInserter::GeneratePages(const long localidentityid, std::string &uskkey
                                key.erase(0,3);\r
                                key="USK"+key;\r
                        }\r
-                       key+=m_messagebase+"/0/";\r
+                       key+=m_messagebase+"/"+editionstr+"/";\r
                        uskkey=key;\r
 \r
                }\r
index aed8c3e..38d51bc 100644 (file)
@@ -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');");\r
        // insert Flink's public key\r
        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');");\r
+       // insert Kane's public key\r
+       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');");\r
+       // inserts boardstat's public key\r
+       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');");\r
 \r
        // TODO remove sometime after 0.1.17\r
        FixCapitalBoardNames();\r
index 3565aab..8599c23 100644 (file)
@@ -2,6 +2,8 @@
 #include "../../include/http/httpdefs.h"\r
 #include "../../include/stringfunctions.h"\r
 \r
+#include <cstring>\r
+\r
 #ifdef XMEM\r
        #include <xmem.h>\r
 #endif\r
index c9d4684..1fab7cd 100644 (file)
@@ -10,25 +10,40 @@ const std::string InsertedFilesPage::GeneratePage(const std::string &method, con
 {\r
        std::string content="<h2>Inserted Files</h2>";\r
 \r
-       SQLite3DB::Statement st=m_db->Prepare("SELECT Key,FileName,Size FROM tblFileInserts WHERE Key IS NOT NULL ORDER BY FileName");\r
-       st.Step();\r
-\r
        std::string node="localhost";\r
        Option::Instance()->Get("FCPHost",node);\r
        std::string fproxyport="8888";\r
        Option::Instance()->Get("FProxyPort",fproxyport);\r
 \r
+\r
+       if(queryvars.find("formaction")!=queryvars.end() && (*queryvars.find("formaction")).second=="removefile" && queryvars.find("fileid")!=queryvars.end())\r
+       {\r
+               SQLite3DB::Statement del=m_db->Prepare("DELETE FROM tblFileInserts WHERE FileInsertID=?;");\r
+               del.Bind(0,(*queryvars.find("fileid")).second);\r
+               del.Step();\r
+       }\r
+\r
+       SQLite3DB::Statement st=m_db->Prepare("SELECT Key,FileName,Size,FileInsertID FROM tblFileInserts WHERE Key IS NOT NULL ORDER BY FileName");\r
+       st.Step();\r
+\r
        while(st.RowReturned())\r
        {\r
                std::string key="";\r
                std::string filename="";\r
                std::string sizestr="";\r
+               std::string insertidstr="";\r
 \r
                st.ResultText(0,key);\r
                st.ResultText(1,filename);\r
                st.ResultText(2,sizestr);\r
+               st.ResultText(3,insertidstr);\r
 \r
                content+="<a href=\"http://"+node+":"+fproxyport+"/"+StringFunctions::UriEncode(key)+"\">"+SanitizeOutput(filename)+"</a> - "+sizestr+" bytes";\r
+               content+="<form name=\"frmRemove"+insertidstr+"\" method=\"POST\">";\r
+               content+="<input type=\"hidden\" name=\"formaction\" value=\"removefile\">";\r
+               content+="<input type=\"hidden\" name=\"fileid\" value=\""+insertidstr+"\">";\r
+               content+="<input type=\"submit\" value=\"Remove\">";\r
+               content+="</form>";\r
                content+="<br>";\r
 \r
                st.Step();\r
index 4bbcb70..69edc54 100644 (file)
@@ -5,9 +5,8 @@
 #include <ctime>\r
 #include <csignal>\r
 #include <iostream>\r
-\r
-//debug\r
-#include "../include/freenet/fcpv2.h"\r
+#include <cstring>\r
+#include <cstdlib>\r
 \r
 #ifdef _WIN32\r
        #include "../include/fmsservice.h"\r
index c0bed87..d7aaf3f 100644 (file)
@@ -696,8 +696,9 @@ const bool Message::ParseNNTPMessage(const std::string &nntpmessage)
                        m_body+=bodypart;\r
                }\r
                // add a binary file attachment\r
-               else if((*i)->GetName()!="" && (*i)->GetLength()>0 && (*i)->GetContent())\r
+               else if(((*i)->GetName()!="" || (*i)->GetFilename()!="") && (*i)->GetLength()>0 && (*i)->GetContent())\r
                {\r
+                       std::string filename="";\r
                        std::string contenttype="";\r
                        std::vector<unsigned char> data((*i)->GetContent(),(*i)->GetContent()+(*i)->GetContentLength());\r
                        if((*i)->GetContentType())\r
@@ -710,7 +711,12 @@ const bool Message::ParseNNTPMessage(const std::string &nntpmessage)
                                        contenttype.erase(endpos);\r
                                }\r
                        }\r
-                       m_fileattachments.push_back(fileattachment((*i)->GetName(),contenttype,data));\r
+                       filename=(*i)->GetFilename();\r
+                       if(filename=="")\r
+                       {\r
+                               filename=(*i)->GetName();\r
+                       }\r
+                       m_fileattachments.push_back(fileattachment(filename,contenttype,data));\r
                }\r
        }\r
 \r
index d925590..723ae14 100644 (file)
@@ -12,6 +12,7 @@
 #include "../../../include/nntp/mime/Mime.h"\r
 #include <stdlib.h>\r
 #include <time.h>\r
+#include <cstring>\r
 \r
 #ifndef _WIN32\r
        #define stricmp strcasecmp\r
index 01fa442..92455f7 100644 (file)
@@ -5,6 +5,8 @@
 #include "../../include/global.h"\r
 #include "../../include/stringfunctions.h"\r
 \r
+#include <cstring>\r
+\r
 #ifdef _WIN32\r
        #include <winsock2.h>\r
        #include <ws2tcpip.h>\r
index f726410..cee9ba2 100644 (file)
@@ -66,6 +66,7 @@
 //#include "libinn.h"\r
 #include "../../include/nntp/uwildmat.h"\r
 #include <string>\r
+#include <cstring>\r
 \r
 #define ABORT -1\r
 \r
index 4b825f3..deddba4 100644 (file)
@@ -1,5 +1,6 @@
 #include "../include/socketdefines.h"\r
 #include <cerrno>\r
+#include <cstring>\r
 \r
 #ifdef XMEM\r
        #include <xmem.h>\r
index 65091de..9143bbc 100644 (file)
@@ -1,5 +1,7 @@
 #include "../include/uuidgenerator.h"\r
 \r
+#include <cstdlib>\r
+\r
 #ifdef XMEM\r
        #include <xmem.h>\r
 #endif\r