X-Git-Url: https://git.pterodactylus.net/?a=blobdiff_plain;f=src%2Fmessage.cpp;h=c0bed87b95d924608af95d2a9bd73a78d5ecda79;hb=52581afffd81f5a71c129d87e3ac822d9522f12d;hp=8582146a765cdc782b2a51d99049c6d788a2ba4f;hpb=bae54a5dae027ad0a6b0126ec9eeecd3bd2739eb;p=fms.git diff --git a/src/message.cpp b/src/message.cpp index 8582146..c0bed87 100644 --- a/src/message.cpp +++ b/src/message.cpp @@ -183,7 +183,8 @@ void Message::HandleAdministrationMessage() } else { - origmessagetrust=m_minlocalmessagetrust; + //origmessagetrust=m_minlocalmessagetrust; + origmessagetrust=50; } if(origmess.ResultNull(3)==false) { @@ -191,7 +192,8 @@ void Message::HandleAdministrationMessage() } else { - origtrustlisttrust=m_minlocaltrustlisttrust; + //origtrustlisttrust=m_minlocaltrustlisttrust; + origtrustlisttrust=50; } origmessagetrust+=changemessagetrust; @@ -282,7 +284,8 @@ void Message::HandleChangeTrust() } else { - localmessagetrust=m_minlocalmessagetrust; + //localmessagetrust=m_minlocalmessagetrust; + localmessagetrust=50; } localmessagetrust+=m_changemessagetrustonreply; @@ -322,6 +325,7 @@ void Message::Initialize() m_fromname=""; m_boards.clear(); m_inreplyto.clear(); + m_fileattachments.clear(); m_changemessagetrustonreply=0; Option::Instance()->Get("ChangeMessageTrustOnReply",tempval); StringFunctions::Convert(tempval,m_changemessagetrustonreply); @@ -691,6 +695,23 @@ const bool Message::ParseNNTPMessage(const std::string &nntpmessage) #endif m_body+=bodypart; } + // add a binary file attachment + else if((*i)->GetName()!="" && (*i)->GetLength()>0 && (*i)->GetContent()) + { + std::string contenttype=""; + std::vector data((*i)->GetContent(),(*i)->GetContent()+(*i)->GetContentLength()); + if((*i)->GetContentType()) + { + contenttype=(*i)->GetContentType(); + // find first ; tab cr or lf and erase it and everything after it + std::string::size_type endpos=contenttype.find_first_of(";\t\r\n "); + if(endpos!=std::string::npos) + { + contenttype.erase(endpos); + } + } + m_fileattachments.push_back(fileattachment((*i)->GetName(),contenttype,data)); + } } return true; @@ -732,6 +753,19 @@ const bool Message::StartFreenetInsert() st.Bind(2,xml.GetXML()); st.Step(); + // insert file attachments into database + st=m_db->Prepare("INSERT INTO tblFileInserts(MessageUUID,FileName,Size,MimeType,Data) VALUES(?,?,?,?,?);"); + for(std::vector::iterator i=m_fileattachments.begin(); i!=m_fileattachments.end(); i++) + { + st.Bind(0,m_messageuuid); + st.Bind(1,(*i).m_filename); + st.Bind(2,(long)(*i).m_data.size()); + st.Bind(3,(*i).m_mimetype); + st.Bind(4,&((*i).m_data[0]),(*i).m_data.size()); + st.Step(); + st.Reset(); + } + HandleChangeTrust(); return true; @@ -747,6 +781,10 @@ void Message::StripAdministrationBoards() st.Step(); if(st.RowReturned()) { + if(m_replyboardname==(*i)) + { + m_replyboardname=""; + } i=m_boards.erase(i); } else @@ -755,4 +793,8 @@ void Message::StripAdministrationBoards() } st.Reset(); } + if(m_replyboardname=="" && m_boards.begin()!=m_boards.end()) + { + m_replyboardname=(*m_boards.begin()); + } }