\r
void run();\r
\r
- // registration methods for children objects\r
+ // registration methods for child objects\r
void RegisterPeriodicProcessor(IPeriodicProcessor *obj);\r
void RegisterFCPConnected(IFCPConnected *obj);\r
void RegisterFCPMessageHandler(IFCPMessageHandler *obj);\r
\r
#define VERSION_MAJOR "0"\r
#define VERSION_MINOR "3"\r
-#define VERSION_RELEASE "19"\r
+#define VERSION_RELEASE "20"\r
#define FMS_VERSION VERSION_MAJOR"."VERSION_MINOR"."VERSION_RELEASE\r
-#define FMS_FREESITE_USK "USK@0npnMrqZNKRCRoGojZV93UNHCMN-6UU3rRSAmP6jNLE,~BG-edFtdCC1cSH4O3BWdeIYa8Sw5DfyrSV-TKdO5ec,AQACAAE/fms/79/"\r
-#define FMS_VERSION_EDITION "20"\r
+#define FMS_FREESITE_USK "USK@0npnMrqZNKRCRoGojZV93UNHCMN-6UU3rRSAmP6jNLE,~BG-edFtdCC1cSH4O3BWdeIYa8Sw5DfyrSV-TKdO5ec,AQACAAE/fms/80/"\r
+#define FMS_VERSION_EDITION "21"\r
\r
typedef Poco::ScopedLock<Poco::FastMutex> Guard;\r
\r
bool validated=false;\r
std::string tempname=Poco::TemporaryFile::tempName();\r
\r
+ if(data.size()==0)\r
+ {\r
+ return false;\r
+ }\r
+\r
FILE *outfile=fopen(tempname.c_str(),"w+b");\r
if(outfile)\r
{\r
\r
const bool Board::Load(const std::string &boardname) // same as loading form boardid - but using name\r
{\r
- /*\r
- SQLite3DB::Statement st=m_db->Prepare("SELECT BoardID FROM tblBoard WHERE BoardName=?;");\r
- st.Bind(0,boardname);\r
- st.Step();\r
- if(st.RowReturned())\r
- {\r
- int tempint;\r
- st.ResultInt(0,tempint);\r
- return Load(tempint);\r
- }\r
- else\r
- {\r
- return false;\r
- }\r
- */\r
\r
// clear current values\r
m_boardid=-1;\r
\r
void Board::SetDateFromString(const std::string &datestring)\r
{\r
- // break out date created - date should be in format yyyy-mm-dd HH:MM:SS, so we split on "-", " " (space), and ":"\r
int tzdiff=0;\r
if(Poco::DateTimeParser::tryParse(datestring,m_datecreated,tzdiff)==false)\r
{\r
\r
// receive the file\r
data.resize(datalength);\r
- m_fcp->ReceiveRaw(&data[0],datalength);\r
+ if(data.size()>0)\r
+ {\r
+ m_fcp->ReceiveRaw(&data[0],datalength);\r
+ }\r
\r
// parse file into xml and update the database\r
- if(xml.ParseXML(std::string(data.begin(),data.end()))==true)\r
+ if(data.size()>0 && xml.ParseXML(std::string(data.begin(),data.end()))==true)\r
{\r
\r
SQLite3DB::Statement brd=m_db->Prepare("SELECT BoardID,BoardName,BoardDescription FROM tblBoard WHERE BoardName=?;");\r
\r
// receive the file\r
data.resize(datalength);\r
- m_fcp->ReceiveRaw(&data[0],datalength);\r
+ if(data.size()>0)\r
+ {\r
+ m_fcp->ReceiveRaw(&data[0],datalength);\r
+ }\r
\r
// update latest edition #\r
std::vector<std::string> parts;\r
}\r
\r
// parse file into xml and update the database\r
- if(xml.ParseXML(std::string(data.begin(),data.end()))==true)\r
+ if(data.size()>0 && xml.ParseXML(std::string(data.begin(),data.end()))==true)\r
{\r
\r
SQLite3DB::Statement st=m_db->Prepare("REPLACE INTO tblFMSVersion(Major,Minor,Release,Notes,Changes,PageKey,SourceKey) VALUES(?,?,?,?,?,?,?);");\r
if(m_receivednodehello==true)\r
{\r
bool handled=false;\r
+\r
std::vector<IFCPMessageHandler *>::iterator i=m_fcpmessagehandlers.begin();\r
while(handled==false && i!=m_fcpmessagehandlers.end())\r
{\r
\r
// receive the file\r
data.resize(datalength);\r
- m_fcp->ReceiveRaw(&data[0],datalength);\r
+ if(data.size()>0)\r
+ {\r
+ m_fcp->ReceiveRaw(&data[0],datalength);\r
+ }\r
\r
// parse file into xml and update the database\r
- if(xml.ParseXML(std::string(data.begin(),data.end()))==true)\r
+ if(data.size()>0 && xml.ParseXML(std::string(data.begin(),data.end()))==true)\r
{\r
\r
ssk.SetPublicKey(xml.GetIdentity());\r
\r
// receive the file\r
data.resize(datalength);\r
- m_fcp->ReceiveRaw(&data[0],datalength);\r
+ if(data.size()>0)\r
+ {\r
+ m_fcp->ReceiveRaw(&data[0],datalength);\r
+ }\r
\r
// parse file into xml and update the database\r
- if(xml.ParseXML(std::string(data.begin(),data.end()))==true)\r
+ if(data.size()>0 && xml.ParseXML(std::string(data.begin(),data.end()))==true)\r
{\r
\r
st=m_db->Prepare("UPDATE tblIdentity SET Name=?, SingleUse=?, LastSeen=?, PublishTrustList=?, PublishBoardList=?, FreesiteEdition=? WHERE IdentityID=?");\r
// make sure we are on the next day or the appropriate amount of time has elapsed since the last insert\r
if(m_lastinserted.find(rs.GetInt(0))==m_lastinserted.end() || m_lastinserted[rs.GetInt(0)]<=lastinsert || m_lastinserted[rs.GetInt(0)].day()!=now.day())\r
{\r
- StartInsert(rs.GetInt(0));\r
m_lastinserted[rs.GetInt(0)]=now;\r
}\r
else\r
const bool IntroductionPuzzleInserter::StartInsert(const long &localidentityid)\r
{\r
Poco::DateTime now;\r
- std::string idstring;\r
+ std::string idstring="";\r
long index=0;\r
- std::string indexstr;\r
+ std::string indexstr="";\r
Poco::UUIDGenerator uuidgen;\r
Poco::UUID uuid;\r
- std::string messagebase;\r
+ std::string messagebase="";\r
IntroductionPuzzleXML xml;\r
- std::string encodedpuzzle;\r
- std::string solutionstring;\r
+ std::string encodedpuzzle="";\r
+ std::string solutionstring="";\r
FCPMessage message;\r
- std::string xmldata;\r
- std::string xmldatasizestr;\r
+ std::string xmldata="";\r
+ std::string xmldatasizestr="";\r
std::string privatekey="";\r
std::string publickey="";\r
std::string keypart="";\r
Option::Instance()->Get("MessageBase",messagebase);\r
\r
GenerateCaptcha(encodedpuzzle,solutionstring);\r
+ if(encodedpuzzle.size()==0)\r
+ {\r
+ m_log->fatal("IntroductionPuzzleInserter::StartInsert could not create introduction puzzle");\r
+ return false;\r
+ }\r
\r
try\r
{\r
\r
// receive the file\r
data.resize(datalength);\r
- m_fcp->ReceiveRaw(&data[0],datalength);\r
+ if(data.size()>0)\r
+ {\r
+ m_fcp->ReceiveRaw(&data[0],datalength);\r
+ }\r
\r
// parse file into xml and update the database\r
- if(xml.ParseXML(std::string(data.begin(),data.end()))==true)\r
+ if(data.size()>0 && xml.ParseXML(std::string(data.begin(),data.end()))==true)\r
{\r
\r
// check if last part of UUID matches first part of public key of identity who inserted it\r
\r
// receive the file\r
data.resize(datalength);\r
- m_fcp->ReceiveRaw(&data[0],datalength);\r
+ if(data.size()>0)\r
+ {\r
+ m_fcp->ReceiveRaw(&data[0],datalength);\r
+ }\r
\r
// parse file into xml and update the database\r
- if(xml.ParseXML(std::string(data.begin(),data.end()))==true)\r
+ if(data.size()>0 && xml.ParseXML(std::string(data.begin(),data.end()))==true)\r
{\r
\r
SQLite3DB::Statement st=m_db->Prepare("SELECT IdentityID FROM tblMessageRequests WHERE IdentityID=? AND Day=? AND RequestIndex=?;");\r
\r
// receive the file\r
data.resize(datalength);\r
- m_fcp->ReceiveRaw(&data[0],datalength);\r
+ if(data.size()>0)\r
+ {\r
+ m_fcp->ReceiveRaw(&data[0],datalength);\r
+ }\r
\r
// mark this index as received\r
st=m_db->Prepare("UPDATE tblMessageRequests SET Found='true' WHERE IdentityID=? AND Day=? AND RequestIndex=?;");\r
st.Finalize();\r
\r
// parse file into xml and update the database\r
- if(xml.ParseXML(std::string(data.begin(),data.end()))==true)\r
+ if(data.size()>0 && xml.ParseXML(std::string(data.begin(),data.end()))==true)\r
{\r
std::vector<std::string> boards=xml.GetBoards();\r
std::map<long,std::string> replyto=xml.GetInReplyTo();\r
\r
// receive the file\r
data.resize(datalength);\r
- m_fcp->ReceiveRaw(&data[0],datalength);\r
+ if(data.size()>0)\r
+ {\r
+ m_fcp->ReceiveRaw(&data[0],datalength);\r
+ }\r
\r
// get count of identities added in last 24 hours\r
st=m_db->Prepare("SELECT COUNT(*) FROM tblIdentity WHERE DateAdded>=?;");\r
now=Poco::DateTime();\r
\r
// parse file into xml and update the database\r
- if(xml.ParseXML(std::string(data.begin(),data.end()))==true)\r
+ if(data.size()>0 && xml.ParseXML(std::string(data.begin(),data.end()))==true)\r
{\r
// find the identity name and public key of the identity publishing the trust list\r
std::string publisherid="";\r
m_db->Execute("INSERT INTO tblIdentityTrust(LocalIdentityID,IdentityID) SELECT LocalIdentityID,IdentityID FROM tblLocalIdentity,tblIdentity WHERE LocalIdentityID || '_' || IdentityID NOT IN (SELECT LocalIdentityID || '_' || IdentityID FROM tblIdentityTrust);");\r
\r
content+="<h2>Created Identity</h2>";\r
+ content+="You must have at least 1 local identity that has set explicit trust list trust for one or more peers who are publishing trust lists or you will not be able to learn about other identities.";\r
}\r
else\r
{\r