version 0.1.1
authorSomeDude <SomeDude@NuBL7aaJ6Cn4fB7GXFb9Zfi8w1FhPyW3oKgU9TweZMw>
Fri, 25 Jan 2008 16:42:00 +0000 (17:42 +0100)
committerDavid ‘Bombe’ Roden <bombe@freenetproject.org>
Fri, 25 Jan 2008 16:42:00 +0000 (17:42 +0100)
17 files changed:
CMakeLists.txt
admin/introduce.php
include/board.h
include/freenet/iindexinserter.h
include/freenet/iindexrequester.h
include/global.h
include/nntp/nntpconnection.h
include/nntp/uwildmat.h
src/freenet/messageinserter.cpp
src/freenet/messagelistinserter.cpp
src/freenet/messagelistrequester.cpp
src/freenet/messagerequester.cpp
src/nntp/mime/Mime.cpp
src/nntp/mime/MimeCode.cpp
src/nntp/nntpconnection.cpp
src/nntp/nntplistener.cpp
zthread-gcc4.patch [new file with mode: 0644]

index 5217bdc..ddf3dad 100644 (file)
@@ -58,34 +58,35 @@ src/xyssl/sha1.c
 \r
 ADD_DEFINITIONS(-DTIXML_USE_STL)\r
 \r
-ADD_LIBRARY(sqlite3 libs/sqlite3/sqlite3.c)\r
-ADD_LIBRARY(tinyxml libs/tinyxml/tinystr.cpp libs/tinyxml/tinyxml.cpp libs/tinyxml/tinyxmlerror.cpp libs/tinyxml/tinyxmlparser.cpp)\r
-\r
 ADD_EXECUTABLE(fms ${FMS_SRC})\r
 \r
 INCLUDE_DIRECTORIES(libs/sqlite3 libs/tinyxml)\r
 \r
-TARGET_LINK_LIBRARIES(fms sqlite3 tinyxml)\r
-\r
 IF(WIN32)\r
        TARGET_LINK_LIBRARIES(fms ws2_32)\r
 ENDIF(WIN32)\r
 \r
-#FIND_LIBRARY(SQLITE3_LIBRARY NAMES sqlite3 sqlite3_s)\r
-#FIND_LIBRARY(TINYXML_LIBRARY NAMES tinyxml tinyxml_s)\r
+FIND_LIBRARY(SQLITE3_LIBRARY NAMES sqlite3 sqlite3_s)\r
+FIND_LIBRARY(TINYXML_LIBRARY NAMES tinyxml tinyxml_s)\r
 FIND_LIBRARY(ZTHREADS_LIBRARY NAMES zthread ZThread zthread_s)\r
 \r
-#IF(SQLITE3_LIBRARY)\r
-#      TARGET_LINK_LIBRARIES(fms ${SQLITE3_LIBRARY})\r
-#ELSE(SQLITE3_LIBRARY)\r
-#      MESSAGE(FATAL_ERROR "Could not find SQLite library.  You must set the location manually.")\r
-#ENDIF(SQLITE3_LIBRARY)\r
+IF(SQLITE3_LIBRARY)\r
+       TARGET_LINK_LIBRARIES(fms ${SQLITE3_LIBRARY})\r
+ELSE(SQLITE3_LIBRARY)\r
+       MESSAGE(STATUS "Could not find system SQLite library.  Will compile from included source.")\r
+       ADD_LIBRARY(sqlite3 libs/sqlite3/sqlite3.c)\r
+       TARGET_LINK_LIBRARIES(fms sqlite3)\r
+ADD_LIBRARY(tinyxml libs/tinyxml/tinystr.cpp libs/tinyxml/tinyxml.cpp libs/tinyxml/tinyxmlerror.cpp libs/tinyxml/tinyxmlparser.cpp)\r
+\r
+ENDIF(SQLITE3_LIBRARY)\r
 \r
-#IF(TINYXML_LIBRARY)\r
-#      TARGET_LINK_LIBRARIES(fms ${TINYXML_LIBRARY})\r
-#ELSE(TINYXML_LIBRARY)\r
-#      MESSAGE(FATAL_ERROR "Could not find TinyXML library.  You must set the location manually.")\r
-#ENDIF(TINYXML_LIBRARY)\r
+IF(TINYXML_LIBRARY)\r
+       TARGET_LINK_LIBRARIES(fms ${TINYXML_LIBRARY})\r
+ELSE(TINYXML_LIBRARY)\r
+       MESSAGE(STATUS "Could not find system TinyXML library.  Will compile from included source.")\r
+       ADD_LIBRARY(tinyxml libs/tinyxml/tinystr.cpp libs/tinyxml/tinyxml.cpp libs/tinyxml/tinyxmlerror.cpp libs/tinyxml/tinyxmlparser.cpp)\r
+       TARGET_LINK_LIBRARIES(fms tinyxml)\r
+ENDIF(TINYXML_LIBRARY)\r
 \r
 IF(ZTHREADS_LIBRARY)\r
        TARGET_LINK_LIBRARIES(fms ${ZTHREADS_LIBRARY})\r
index e3fbd89..aafb20c 100644 (file)
@@ -53,7 +53,7 @@ function content()
        print "<br>Type answers for a few puzzles and submit<br>";\r
        \r
        \r
-       $st=$db->prepare("SELECT UUID,Day,IdentityID FROM tblIntroductionPuzzleRequests WHERE UUID NOT IN (SELECT UUID FROM tblIdentityIntroductionInserts) AND Day>='".gmdate('Y-m-d',strtotime('-1 day'))."' AND Found='true' ORDER BY IdentityID, RequestIndex DESC;");\r
+       $st=$db->prepare("SELECT UUID,Day,IdentityID FROM tblIntroductionPuzzleRequests WHERE UUID NOT IN (SELECT UUID FROM tblIdentityIntroductionInserts) AND Day>='".gmdate('Y-m-d',strtotime('-1 day'))."' AND Found='true' ORDER BY IdentityID, Day DESC, RequestIndex DESC;");\r
        $st->execute();\r
        \r
        // only show latest captcha for each known identity\r
index 2230f00..64797ae 100644 (file)
@@ -35,4 +35,4 @@ private:
        long m_messagecount;            // number of messages in this board\r
 };\r
 \r
-#endif _board_\r
+#endif // _board_\r
index d7093a3..ccf1cd5 100644 (file)
@@ -145,7 +145,7 @@ void IIndexInserter<IDTYPE>::RegisterWithThread(FreenetMasterThread *thread)
 template <class IDTYPE>\r
 void IIndexInserter<IDTYPE>::RemoveFromInsertList(const IDTYPE identityid)\r
 {\r
-       std::vector<IDTYPE>::iterator i=m_inserting.begin();\r
+       typename std::vector<IDTYPE>::iterator i=m_inserting.begin();\r
        while(i!=m_inserting.end() && (*i)!=identityid)\r
        {\r
                i++;\r
index 6ba9ae7..8f9e4e5 100644 (file)
@@ -134,13 +134,14 @@ void IIndexRequester<IDTYPE>::InitializeIIndexRequester()
 template <class IDTYPE>\r
 void IIndexRequester<IDTYPE>::Process()\r
 {\r
-       // max is the smaller of the config value or the total number of identities we will request from\r
+       // max is the smaller of the config value or the total number of ids we will request from\r
        long max=m_maxrequests>m_ids.size() ? m_ids.size() : m_maxrequests;\r
 \r
        // try to keep up to max requests going\r
        if(m_requesting.size()<max)\r
        {\r
-               std::map<IDTYPE,bool>::iterator i=m_ids.begin();\r
+               typename std::map<IDTYPE,bool>::iterator i=m_ids.begin();\r
+\r
                while(i!=m_ids.end() && (*i).second==true)\r
                {\r
                        i++;\r
@@ -160,7 +161,7 @@ void IIndexRequester<IDTYPE>::Process()
        // this will recheck for ids every minute\r
        DateTime now;\r
        now.SetToGMTime();\r
-       if(m_tempdate<(now-(1.0/1440.0)))\r
+       if(m_ids.size()==0 && m_tempdate<(now-(1.0/1440.0)))\r
        {\r
                PopulateIDList();\r
                m_tempdate=now;\r
@@ -179,7 +180,7 @@ void IIndexRequester<IDTYPE>::RegisterWithThread(FreenetMasterThread *thread)
 template <class IDTYPE>\r
 void IIndexRequester<IDTYPE>::RemoveFromRequestList(const IDTYPE id)\r
 {\r
-       std::vector<IDTYPE>::iterator i=m_requesting.begin();\r
+       typename std::vector<IDTYPE>::iterator i=m_requesting.begin();\r
        while(i!=m_requesting.end() && (*i)!=id)\r
        {\r
                i++;\r
index b823d73..2b0fe20 100644 (file)
@@ -4,7 +4,7 @@
 #include <vector>\r
 #include <zthread/Thread.h>\r
 \r
-#define FMS_VERSION    "0.1.0"\r
+#define FMS_VERSION    "0.1.1"\r
 \r
 // opens database and creates tables and initial inserts if necessary\r
 void SetupDB();\r
index d2bf167..dd365c4 100644 (file)
@@ -9,6 +9,17 @@
 #include <vector>\r
 #include <zthread/Runnable.h>\r
 \r
+#ifdef _WIN32\r
+\r
+#else\r
+       #include <sys/socket.h>\r
+       #include <sys/select.h>\r
+       #include <sys/types.h>\r
+       #include <netdb.h>\r
+       #include <netinet/in.h>\r
+       #include <arpa/inet.h>\r
+#endif\r
+\r
 class NNTPConnection:public ZThread::Runnable,public ILogger//,public IDatabase\r
 {\r
 public:\r
@@ -51,7 +62,7 @@ private:
        void HandlePostedMessage(const std::string &message);\r
 \r
        void SendArticleParts(const NNTPCommand &command);\r
-       void SendArticleOverInfo(const Message &message);\r
+       void SendArticleOverInfo(Message &message);\r
 \r
        // various NNTP commands to handle\r
        const bool HandleQuitCommand(const NNTPCommand &command);\r
index e999113..5e56190 100644 (file)
@@ -1,7 +1,9 @@
 #ifndef _uwildmat_\r
 #define _uwildmat_\r
 \r
-#include "../pstdint.h"\r
+#ifdef _WIN32\r
+       #include "../pstdint.h"\r
+#endif\r
 \r
 /*\r
 **  WILDMAT MATCHING\r
index acd6bfe..d28e262 100644 (file)
@@ -5,7 +5,7 @@ MessageInserter::MessageInserter()
        Initialize();\r
 }\r
 \r
-MessageInserter::MessageInserter(FCPv2 *fcp):IIndexInserter(fcp)\r
+MessageInserter::MessageInserter(FCPv2 *fcp):IIndexInserter<std::string>(fcp)\r
 {\r
        Initialize();\r
 }\r
index 57d40f9..09a6137 100644 (file)
@@ -11,7 +11,7 @@ MessageListInserter::MessageListInserter()
        Initialize();\r
 }\r
 \r
-MessageListInserter::MessageListInserter(FCPv2 *fcp):IIndexInserter(fcp)\r
+MessageListInserter::MessageListInserter(FCPv2 *fcp):IIndexInserter<long>(fcp)\r
 {\r
        Initialize();\r
 }\r
index a177b7e..763ba9f 100644 (file)
@@ -10,7 +10,7 @@ MessageListRequester::MessageListRequester()
        Initialize();\r
 }\r
 \r
-MessageListRequester::MessageListRequester(FCPv2 *fcp):IIndexRequester(fcp)\r
+MessageListRequester::MessageListRequester(FCPv2 *fcp):IIndexRequester<long>(fcp)\r
 {\r
        Initialize();\r
 }\r
index 7acb44d..d59a7c0 100644 (file)
@@ -10,7 +10,7 @@ MessageRequester::MessageRequester()
        Initialize();\r
 }\r
 \r
-MessageRequester::MessageRequester(FCPv2 *fcp):IIndexRequester(fcp)\r
+MessageRequester::MessageRequester(FCPv2 *fcp):IIndexRequester<std::string>(fcp)\r
 {\r
        Initialize();\r
 }\r
index e79d059..fcadcd5 100644 (file)
 #include <stdlib.h>\r
 #include <time.h>\r
 \r
+#ifndef _WIN32\r
+       #define stricmp strcasecmp\r
+       #define strnicmp strncasecmp\r
+       #define memicmp memcmp\r
+#endif\r
+\r
 #ifdef _DEBUG\r
 #undef THIS_FILE\r
 static char THIS_FILE[]=__FILE__;\r
@@ -464,7 +470,16 @@ list<CMimeField>::iterator CMimeHeader::FindField(const char* pszFieldName)
 #include <fcntl.h>\r
 #include <sys/types.h>\r
 #include <sys/stat.h>\r
-#include <io.h>\r
+\r
+#ifdef _WIN32\r
+       #include <io.h>\r
+#else\r
+       #include <sys/io.h>\r
+#endif\r
+\r
+#ifndef O_BINARY\r
+       #define O_BINARY 0\r
+#endif\r
 \r
 // initialize the content with text\r
 int CMimeBody::SetText(const char* pbText, int nLength/*=0*/)\r
index 7de6c99..3f819dd 100644 (file)
@@ -19,6 +19,12 @@ static char THIS_FILE[]=__FILE__;
 #define new DEBUG_NEW\r
 #endif\r
 \r
+#ifndef _WIN32\r
+       #define stricmp strcasecmp\r
+       #define strnicmp strncasecmp\r
+       #define memicmp memcmp\r
+#endif\r
+\r
 //////////////////////////////////////////////////////////////////////\r
 // CMimeEnvironment - global environment to manage encoding/decoding\r
 //////////////////////////////////////////////////////////////////////\r
index 5ee9776..ac75d4d 100644 (file)
@@ -24,7 +24,7 @@ NNTPConnection::NNTPConnection(SOCKET sock)
        m_status.m_allowpost=false;\r
        m_status.m_boardid=-1;\r
        m_status.m_messageid=-1;\r
-       m_status.m_mode=ClientMode::MODE_NONE;\r
+       m_status.m_mode=MODE_NONE;\r
 \r
        Option::instance()->Get("NNTPAllowPost",tempval);\r
        if(tempval=="true")\r
@@ -479,7 +479,7 @@ const bool NNTPConnection::HandleModeCommand(const NNTPCommand &command)
                StringFunctions::UpperCase(arg,arg);\r
                if(arg=="READER")\r
                {\r
-                       m_status.m_mode=ClientMode::MODE_READER;\r
+                       m_status.m_mode=MODE_READER;\r
                        if(m_status.m_allowpost==true)\r
                        {\r
                                SendBufferedLine("200 Posting allowed");\r
@@ -865,7 +865,7 @@ const bool NNTPConnection::HandleQuitCommand(const NNTPCommand &command)
 void NNTPConnection::run()\r
 {\r
        struct timeval tv;\r
-       FD_SET writefs,readfs;\r
+       fd_set writefs,readfs;\r
        int rval;\r
 \r
        // seed random number generater for this thread\r
@@ -919,7 +919,7 @@ void NNTPConnection::run()
        \r
 }\r
 \r
-void NNTPConnection::SendArticleOverInfo(const Message &message)\r
+void NNTPConnection::SendArticleOverInfo(Message &message)\r
 {\r
        std::string tempval;\r
        std::string line;\r
@@ -934,7 +934,7 @@ void NNTPConnection::SendArticleOverInfo(const Message &message)
        references=message.GetInReplyTo();\r
        if(references.size()>0)\r
        {\r
-               for(std::map<long,std::string>::const_reverse_iterator i=references.rbegin(); i!=references.rend(); i++)\r
+               for(std::map<long,std::string>::reverse_iterator i=references.rbegin(); i!=references.rend(); i++)\r
                {\r
                        if(i!=references.rbegin())\r
                        {\r
index 4d1c37d..29f8eb4 100644 (file)
@@ -9,7 +9,8 @@
        #include <winsock2.h>\r
        #include <ws2tcpip.h>\r
 #else\r
-\r
+       #include <netinet/in.h>  // gcc - IPPROTO_ consts\r
+       #include <netdb.h>       // gcc - addrinfo\r
 #endif\r
 \r
 #ifdef XMEM\r
@@ -29,7 +30,7 @@ NNTPListener::~NNTPListener()
 void NNTPListener::run()\r
 {\r
        int rval;\r
-       struct fd_set readfs;\r
+       fd_set readfs;\r
        struct timeval tv;\r
        std::vector<SOCKET>::iterator listeni;\r
        SOCKET highsocket;\r
diff --git a/zthread-gcc4.patch b/zthread-gcc4.patch
new file mode 100644 (file)
index 0000000..9c3ecf6
--- /dev/null
@@ -0,0 +1,96 @@
+diff -ru ZThread-2.3.2-old/include/zthread/Guard.h ZThread-2.3.2/include/zthread/Guard.h
+--- ZThread-2.3.2-old/include/zthread/Guard.h  2005-03-12 21:10:09.000000000 -0500
++++ ZThread-2.3.2/include/zthread/Guard.h      2006-09-10 14:10:08.000000000 -0400
+@@ -491,7 +491,7 @@
+     
+   try {
+     
+-    if(!isDisabled())
++    if(!LockHolder<LockType>::isDisabled())
+       LockingPolicy::destroyScope(*this);
+     
+   } catch (...) { /* ignore */ }  
+diff -ru ZThread-2.3.2-old/src/MutexImpl.h ZThread-2.3.2/src/MutexImpl.h
+--- ZThread-2.3.2-old/src/MutexImpl.h  2005-03-12 22:59:15.000000000 -0500
++++ ZThread-2.3.2/src/MutexImpl.h      2006-09-10 14:13:31.000000000 -0400
+@@ -153,7 +153,7 @@
+       _owner = self;
+-      ownerAcquired(self);
++      Behavior::ownerAcquired(self);
+       
+     }
+@@ -164,7 +164,7 @@
+       _waiters.insert(self);
+       m.acquire();
+-      waiterArrived(self);
++      Behavior::waiterArrived(self);
+       {        
+       
+@@ -173,7 +173,7 @@
+       
+       }
+-      waiterDeparted(self);
++      Behavior::waiterDeparted(self);
+       m.release();
+         
+@@ -192,7 +192,7 @@
+           assert(_owner == 0);
+           _owner = self;    
+-          ownerAcquired(self);
++          Behavior::ownerAcquired(self);
+           break;
+         
+@@ -236,7 +236,7 @@
+       _owner = self;
+-      ownerAcquired(self);
++      Behavior::ownerAcquired(self);
+       
+     }
+@@ -253,7 +253,7 @@
+       
+         m.acquire();
+-        waiterArrived(self);
++        Behavior::waiterArrived(self);
+       
+         {
+         
+@@ -262,7 +262,7 @@
+         
+         }
+-        waiterDeparted(self);
++        Behavior::waiterDeparted(self);
+       
+         m.release();
+         
+@@ -284,7 +284,7 @@
+           assert(0 == _owner);
+           _owner = self;
+-          ownerAcquired(self);
++          Behavior::ownerAcquired(self);
+         
+           break;
+         
+@@ -326,7 +326,7 @@
+     _owner = 0;
+-    ownerReleased(impl);
++    Behavior::ownerReleased(impl);
+   
+     // Try to find a waiter with a backoff & retry scheme
+     for(;;) {