From: SomeDude Date: Fri, 25 Jan 2008 16:42:00 +0000 (+0100) Subject: version 0.1.1 X-Git-Url: https://git.pterodactylus.net/?a=commitdiff_plain;h=868c533e84b3c81b6604b45b84efa32073aa20b4;p=fms.git version 0.1.1 --- diff --git a/CMakeLists.txt b/CMakeLists.txt index 5217bdc..ddf3dad 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -58,34 +58,35 @@ src/xyssl/sha1.c ADD_DEFINITIONS(-DTIXML_USE_STL) -ADD_LIBRARY(sqlite3 libs/sqlite3/sqlite3.c) -ADD_LIBRARY(tinyxml libs/tinyxml/tinystr.cpp libs/tinyxml/tinyxml.cpp libs/tinyxml/tinyxmlerror.cpp libs/tinyxml/tinyxmlparser.cpp) - ADD_EXECUTABLE(fms ${FMS_SRC}) INCLUDE_DIRECTORIES(libs/sqlite3 libs/tinyxml) -TARGET_LINK_LIBRARIES(fms sqlite3 tinyxml) - IF(WIN32) TARGET_LINK_LIBRARIES(fms ws2_32) ENDIF(WIN32) -#FIND_LIBRARY(SQLITE3_LIBRARY NAMES sqlite3 sqlite3_s) -#FIND_LIBRARY(TINYXML_LIBRARY NAMES tinyxml tinyxml_s) +FIND_LIBRARY(SQLITE3_LIBRARY NAMES sqlite3 sqlite3_s) +FIND_LIBRARY(TINYXML_LIBRARY NAMES tinyxml tinyxml_s) FIND_LIBRARY(ZTHREADS_LIBRARY NAMES zthread ZThread zthread_s) -#IF(SQLITE3_LIBRARY) -# TARGET_LINK_LIBRARIES(fms ${SQLITE3_LIBRARY}) -#ELSE(SQLITE3_LIBRARY) -# MESSAGE(FATAL_ERROR "Could not find SQLite library. You must set the location manually.") -#ENDIF(SQLITE3_LIBRARY) +IF(SQLITE3_LIBRARY) + TARGET_LINK_LIBRARIES(fms ${SQLITE3_LIBRARY}) +ELSE(SQLITE3_LIBRARY) + MESSAGE(STATUS "Could not find system SQLite library. Will compile from included source.") + ADD_LIBRARY(sqlite3 libs/sqlite3/sqlite3.c) + TARGET_LINK_LIBRARIES(fms sqlite3) +ADD_LIBRARY(tinyxml libs/tinyxml/tinystr.cpp libs/tinyxml/tinyxml.cpp libs/tinyxml/tinyxmlerror.cpp libs/tinyxml/tinyxmlparser.cpp) + +ENDIF(SQLITE3_LIBRARY) -#IF(TINYXML_LIBRARY) -# TARGET_LINK_LIBRARIES(fms ${TINYXML_LIBRARY}) -#ELSE(TINYXML_LIBRARY) -# MESSAGE(FATAL_ERROR "Could not find TinyXML library. You must set the location manually.") -#ENDIF(TINYXML_LIBRARY) +IF(TINYXML_LIBRARY) + TARGET_LINK_LIBRARIES(fms ${TINYXML_LIBRARY}) +ELSE(TINYXML_LIBRARY) + MESSAGE(STATUS "Could not find system TinyXML library. Will compile from included source.") + ADD_LIBRARY(tinyxml libs/tinyxml/tinystr.cpp libs/tinyxml/tinyxml.cpp libs/tinyxml/tinyxmlerror.cpp libs/tinyxml/tinyxmlparser.cpp) + TARGET_LINK_LIBRARIES(fms tinyxml) +ENDIF(TINYXML_LIBRARY) IF(ZTHREADS_LIBRARY) TARGET_LINK_LIBRARIES(fms ${ZTHREADS_LIBRARY}) diff --git a/admin/introduce.php b/admin/introduce.php index e3fbd89..aafb20c 100644 --- a/admin/introduce.php +++ b/admin/introduce.php @@ -53,7 +53,7 @@ function content() print "
Type answers for a few puzzles and submit
"; - $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;"); + $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;"); $st->execute(); // only show latest captcha for each known identity diff --git a/include/board.h b/include/board.h index 2230f00..64797ae 100644 --- a/include/board.h +++ b/include/board.h @@ -35,4 +35,4 @@ private: long m_messagecount; // number of messages in this board }; -#endif _board_ +#endif // _board_ diff --git a/include/freenet/iindexinserter.h b/include/freenet/iindexinserter.h index d7093a3..ccf1cd5 100644 --- a/include/freenet/iindexinserter.h +++ b/include/freenet/iindexinserter.h @@ -145,7 +145,7 @@ void IIndexInserter::RegisterWithThread(FreenetMasterThread *thread) template void IIndexInserter::RemoveFromInsertList(const IDTYPE identityid) { - std::vector::iterator i=m_inserting.begin(); + typename std::vector::iterator i=m_inserting.begin(); while(i!=m_inserting.end() && (*i)!=identityid) { i++; diff --git a/include/freenet/iindexrequester.h b/include/freenet/iindexrequester.h index 6ba9ae7..8f9e4e5 100644 --- a/include/freenet/iindexrequester.h +++ b/include/freenet/iindexrequester.h @@ -134,13 +134,14 @@ void IIndexRequester::InitializeIIndexRequester() template void IIndexRequester::Process() { - // max is the smaller of the config value or the total number of identities we will request from + // max is the smaller of the config value or the total number of ids we will request from long max=m_maxrequests>m_ids.size() ? m_ids.size() : m_maxrequests; // try to keep up to max requests going if(m_requesting.size()::iterator i=m_ids.begin(); + typename std::map::iterator i=m_ids.begin(); + while(i!=m_ids.end() && (*i).second==true) { i++; @@ -160,7 +161,7 @@ void IIndexRequester::Process() // this will recheck for ids every minute DateTime now; now.SetToGMTime(); - if(m_tempdate<(now-(1.0/1440.0))) + if(m_ids.size()==0 && m_tempdate<(now-(1.0/1440.0))) { PopulateIDList(); m_tempdate=now; @@ -179,7 +180,7 @@ void IIndexRequester::RegisterWithThread(FreenetMasterThread *thread) template void IIndexRequester::RemoveFromRequestList(const IDTYPE id) { - std::vector::iterator i=m_requesting.begin(); + typename std::vector::iterator i=m_requesting.begin(); while(i!=m_requesting.end() && (*i)!=id) { i++; diff --git a/include/global.h b/include/global.h index b823d73..2b0fe20 100644 --- a/include/global.h +++ b/include/global.h @@ -4,7 +4,7 @@ #include #include -#define FMS_VERSION "0.1.0" +#define FMS_VERSION "0.1.1" // opens database and creates tables and initial inserts if necessary void SetupDB(); diff --git a/include/nntp/nntpconnection.h b/include/nntp/nntpconnection.h index d2bf167..dd365c4 100644 --- a/include/nntp/nntpconnection.h +++ b/include/nntp/nntpconnection.h @@ -9,6 +9,17 @@ #include #include +#ifdef _WIN32 + +#else + #include + #include + #include + #include + #include + #include +#endif + class NNTPConnection:public ZThread::Runnable,public ILogger//,public IDatabase { public: @@ -51,7 +62,7 @@ private: void HandlePostedMessage(const std::string &message); void SendArticleParts(const NNTPCommand &command); - void SendArticleOverInfo(const Message &message); + void SendArticleOverInfo(Message &message); // various NNTP commands to handle const bool HandleQuitCommand(const NNTPCommand &command); diff --git a/include/nntp/uwildmat.h b/include/nntp/uwildmat.h index e999113..5e56190 100644 --- a/include/nntp/uwildmat.h +++ b/include/nntp/uwildmat.h @@ -1,7 +1,9 @@ #ifndef _uwildmat_ #define _uwildmat_ -#include "../pstdint.h" +#ifdef _WIN32 + #include "../pstdint.h" +#endif /* ** WILDMAT MATCHING diff --git a/src/freenet/messageinserter.cpp b/src/freenet/messageinserter.cpp index acd6bfe..d28e262 100644 --- a/src/freenet/messageinserter.cpp +++ b/src/freenet/messageinserter.cpp @@ -5,7 +5,7 @@ MessageInserter::MessageInserter() Initialize(); } -MessageInserter::MessageInserter(FCPv2 *fcp):IIndexInserter(fcp) +MessageInserter::MessageInserter(FCPv2 *fcp):IIndexInserter(fcp) { Initialize(); } diff --git a/src/freenet/messagelistinserter.cpp b/src/freenet/messagelistinserter.cpp index 57d40f9..09a6137 100644 --- a/src/freenet/messagelistinserter.cpp +++ b/src/freenet/messagelistinserter.cpp @@ -11,7 +11,7 @@ MessageListInserter::MessageListInserter() Initialize(); } -MessageListInserter::MessageListInserter(FCPv2 *fcp):IIndexInserter(fcp) +MessageListInserter::MessageListInserter(FCPv2 *fcp):IIndexInserter(fcp) { Initialize(); } diff --git a/src/freenet/messagelistrequester.cpp b/src/freenet/messagelistrequester.cpp index a177b7e..763ba9f 100644 --- a/src/freenet/messagelistrequester.cpp +++ b/src/freenet/messagelistrequester.cpp @@ -10,7 +10,7 @@ MessageListRequester::MessageListRequester() Initialize(); } -MessageListRequester::MessageListRequester(FCPv2 *fcp):IIndexRequester(fcp) +MessageListRequester::MessageListRequester(FCPv2 *fcp):IIndexRequester(fcp) { Initialize(); } diff --git a/src/freenet/messagerequester.cpp b/src/freenet/messagerequester.cpp index 7acb44d..d59a7c0 100644 --- a/src/freenet/messagerequester.cpp +++ b/src/freenet/messagerequester.cpp @@ -10,7 +10,7 @@ MessageRequester::MessageRequester() Initialize(); } -MessageRequester::MessageRequester(FCPv2 *fcp):IIndexRequester(fcp) +MessageRequester::MessageRequester(FCPv2 *fcp):IIndexRequester(fcp) { Initialize(); } diff --git a/src/nntp/mime/Mime.cpp b/src/nntp/mime/Mime.cpp index e79d059..fcadcd5 100644 --- a/src/nntp/mime/Mime.cpp +++ b/src/nntp/mime/Mime.cpp @@ -13,6 +13,12 @@ #include #include +#ifndef _WIN32 + #define stricmp strcasecmp + #define strnicmp strncasecmp + #define memicmp memcmp +#endif + #ifdef _DEBUG #undef THIS_FILE static char THIS_FILE[]=__FILE__; @@ -464,7 +470,16 @@ list::iterator CMimeHeader::FindField(const char* pszFieldName) #include #include #include -#include + +#ifdef _WIN32 + #include +#else + #include +#endif + +#ifndef O_BINARY + #define O_BINARY 0 +#endif // initialize the content with text int CMimeBody::SetText(const char* pbText, int nLength/*=0*/) diff --git a/src/nntp/mime/MimeCode.cpp b/src/nntp/mime/MimeCode.cpp index 7de6c99..3f819dd 100644 --- a/src/nntp/mime/MimeCode.cpp +++ b/src/nntp/mime/MimeCode.cpp @@ -19,6 +19,12 @@ static char THIS_FILE[]=__FILE__; #define new DEBUG_NEW #endif +#ifndef _WIN32 + #define stricmp strcasecmp + #define strnicmp strncasecmp + #define memicmp memcmp +#endif + ////////////////////////////////////////////////////////////////////// // CMimeEnvironment - global environment to manage encoding/decoding ////////////////////////////////////////////////////////////////////// diff --git a/src/nntp/nntpconnection.cpp b/src/nntp/nntpconnection.cpp index 5ee9776..ac75d4d 100644 --- a/src/nntp/nntpconnection.cpp +++ b/src/nntp/nntpconnection.cpp @@ -24,7 +24,7 @@ NNTPConnection::NNTPConnection(SOCKET sock) m_status.m_allowpost=false; m_status.m_boardid=-1; m_status.m_messageid=-1; - m_status.m_mode=ClientMode::MODE_NONE; + m_status.m_mode=MODE_NONE; Option::instance()->Get("NNTPAllowPost",tempval); if(tempval=="true") @@ -479,7 +479,7 @@ const bool NNTPConnection::HandleModeCommand(const NNTPCommand &command) StringFunctions::UpperCase(arg,arg); if(arg=="READER") { - m_status.m_mode=ClientMode::MODE_READER; + m_status.m_mode=MODE_READER; if(m_status.m_allowpost==true) { SendBufferedLine("200 Posting allowed"); @@ -865,7 +865,7 @@ const bool NNTPConnection::HandleQuitCommand(const NNTPCommand &command) void NNTPConnection::run() { struct timeval tv; - FD_SET writefs,readfs; + fd_set writefs,readfs; int rval; // seed random number generater for this thread @@ -919,7 +919,7 @@ void NNTPConnection::run() } -void NNTPConnection::SendArticleOverInfo(const Message &message) +void NNTPConnection::SendArticleOverInfo(Message &message) { std::string tempval; std::string line; @@ -934,7 +934,7 @@ void NNTPConnection::SendArticleOverInfo(const Message &message) references=message.GetInReplyTo(); if(references.size()>0) { - for(std::map::const_reverse_iterator i=references.rbegin(); i!=references.rend(); i++) + for(std::map::reverse_iterator i=references.rbegin(); i!=references.rend(); i++) { if(i!=references.rbegin()) { diff --git a/src/nntp/nntplistener.cpp b/src/nntp/nntplistener.cpp index 4d1c37d..29f8eb4 100644 --- a/src/nntp/nntplistener.cpp +++ b/src/nntp/nntplistener.cpp @@ -9,7 +9,8 @@ #include #include #else - + #include // gcc - IPPROTO_ consts + #include // gcc - addrinfo #endif #ifdef XMEM @@ -29,7 +30,7 @@ NNTPListener::~NNTPListener() void NNTPListener::run() { int rval; - struct fd_set readfs; + fd_set readfs; struct timeval tv; std::vector::iterator listeni; SOCKET highsocket; diff --git a/zthread-gcc4.patch b/zthread-gcc4.patch new file mode 100644 index 0000000..9c3ecf6 --- /dev/null +++ b/zthread-gcc4.patch @@ -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::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(;;) {