X-Git-Url: https://git.pterodactylus.net/?a=blobdiff_plain;f=src%2Ffreenet%2Fmessagerequester.cpp;h=70a5dba79f1c1ce0dc7d93a541a057109f0066f0;hb=9a14c0d9f7f7c319e539583b93664953764e83b7;hp=c9b78bb94b5271b1b3ba784afe58bb583be9a4eb;hpb=b4f4686250878cdf4fcb2986a2ea6546cba867d1;p=fms.git diff --git a/src/freenet/messagerequester.cpp b/src/freenet/messagerequester.cpp index c9b78bb..70a5dba 100644 --- a/src/freenet/messagerequester.cpp +++ b/src/freenet/messagerequester.cpp @@ -206,6 +206,25 @@ const bool MessageRequester::HandleAllData(FCPMessage &message) if(validmessage && savetoboardcount>0) { + std::string nntpbody=""; + nntpbody=xml.GetBody(); + + //add file keys/sizes to body + std::vector fileattachments=xml.GetFileAttachments(); + if(fileattachments.size()>0) + { + nntpbody+="\r\nAttachments"; + } + for(std::vector::iterator i=fileattachments.begin(); i!=fileattachments.end(); i++) + { + std::string sizestr="0"; + StringFunctions::Convert((*i).m_size,sizestr); + + nntpbody+="\r\n"+(*i).m_key; + nntpbody+="\r\n"+sizestr+" bytes"; + nntpbody+="\r\n"; + } + st=m_db->Prepare("INSERT INTO tblMessage(IdentityID,FromName,MessageDate,MessageTime,Subject,MessageUUID,ReplyBoardID,Body,MessageIndex) VALUES(?,?,?,?,?,?,?,?,?);"); st.Bind(0,identityid); st.Bind(1,GetIdentityName(identityid)); @@ -214,7 +233,7 @@ const bool MessageRequester::HandleAllData(FCPMessage &message) st.Bind(4,xml.GetSubject()); st.Bind(5,xml.GetMessageID()); st.Bind(6,GetBoardID(xml.GetReplyBoard(),GetIdentityName(identityid))); - st.Bind(7,xml.GetBody()); + st.Bind(7,nntpbody); st.Bind(8,index); inserted=st.Step(true); int messageid=st.GetLastInsertRowID(); @@ -348,6 +367,7 @@ void MessageRequester::Initialize() { m_log->WriteLog(LogFile::LOGLEVEL_WARNING,"Option MaxBoardsPerMessage is currently set at "+tempval+". This value might be incorrectly configured."); } + Option::Instance()->Get("SaveMessagesFromNewBoards",tempval); if(tempval=="true") { @@ -357,6 +377,17 @@ void MessageRequester::Initialize() { m_savemessagesfromnewboards=false; } + + Option::Instance()->Get("LocalTrustOverridesPeerTrust",tempval); + if(tempval=="true") + { + m_localtrustoverrides=true; + } + else + { + m_localtrustoverrides=false; + } + } void MessageRequester::PopulateIDList() @@ -373,9 +404,16 @@ void MessageRequester::PopulateIDList() sql="SELECT tblIdentity.IdentityID,Day,RequestIndex "; sql+="FROM tblMessageRequests INNER JOIN tblIdentity ON tblMessageRequests.IdentityID=tblIdentity.IdentityID "; - sql+="WHERE (tblIdentity.LocalMessageTrust IS NULL OR tblIdentity.LocalMessageTrust>=(SELECT OptionValue FROM tblOption WHERE Option='MinLocalMessageTrust')) "; - sql+="AND FromMessageList='true' AND Found='false' AND Day>='"+date.Format("%Y-%m-%d")+"' "; - sql+="AND (tblIdentity.PeerMessageTrust IS NULL OR tblIdentity.PeerMessageTrust>=(SELECT OptionValue FROM tblOption WHERE Option='MinPeerMessageTrust')) "; + sql+="WHERE FromMessageList='true' AND Found='false' AND Day>='"+date.Format("%Y-%m-%d")+"' "; + if(m_localtrustoverrides==false) + { + sql+="AND (tblIdentity.LocalMessageTrust IS NULL OR tblIdentity.LocalMessageTrust>=(SELECT OptionValue FROM tblOption WHERE Option='MinLocalMessageTrust')) "; + sql+="AND (tblIdentity.PeerMessageTrust IS NULL OR tblIdentity.PeerMessageTrust>=(SELECT OptionValue FROM tblOption WHERE Option='MinPeerMessageTrust')) "; + } + else + { + sql+="AND (tblIdentity.LocalMessageTrust>=(SELECT OptionValue FROM tblOption WHERE Option='MinLocalMessageTrust') OR (tblIdentity.LocalMessageTrust IS NULL AND (tblIdentity.PeerMessageTrust IS NULL OR tblIdentity.PeerMessageTrust>=(SELECT OptionValue FROM tblOption WHERE Option='MinPeerMessageTrust')))) "; + } sql+="AND tblIdentity.Name <> '' "; sql+=";";