\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
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
long m_messagecount; // number of messages in this board\r
};\r
\r
-#endif _board_\r
+#endif // _board_\r
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
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
// 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
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
#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
#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
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
#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
Initialize();\r
}\r
\r
-MessageInserter::MessageInserter(FCPv2 *fcp):IIndexInserter(fcp)\r
+MessageInserter::MessageInserter(FCPv2 *fcp):IIndexInserter<std::string>(fcp)\r
{\r
Initialize();\r
}\r
Initialize();\r
}\r
\r
-MessageListInserter::MessageListInserter(FCPv2 *fcp):IIndexInserter(fcp)\r
+MessageListInserter::MessageListInserter(FCPv2 *fcp):IIndexInserter<long>(fcp)\r
{\r
Initialize();\r
}\r
Initialize();\r
}\r
\r
-MessageListRequester::MessageListRequester(FCPv2 *fcp):IIndexRequester(fcp)\r
+MessageListRequester::MessageListRequester(FCPv2 *fcp):IIndexRequester<long>(fcp)\r
{\r
Initialize();\r
}\r
Initialize();\r
}\r
\r
-MessageRequester::MessageRequester(FCPv2 *fcp):IIndexRequester(fcp)\r
+MessageRequester::MessageRequester(FCPv2 *fcp):IIndexRequester<std::string>(fcp)\r
{\r
Initialize();\r
}\r
#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
#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
#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
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
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
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
\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
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
#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
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
--- /dev/null
+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(;;) {