X-Git-Url: https://git.pterodactylus.net/?p=fms.git;a=blobdiff_plain;f=src%2Fmessage.cpp;h=53d8b34dd1873f233d296f4a9de2ce60f567dfc2;hp=d7aaf3fc12bf26896b5cccedb999fa6a08ed00ad;hb=14fff12d9df0ee30e2df4bf9d22c2e83065816df;hpb=44f964d9b2b2d55a5b5672e9297717bd25fa8ee2 diff --git a/src/message.cpp b/src/message.cpp index d7aaf3f..53d8b34 100644 --- a/src/message.cpp +++ b/src/message.cpp @@ -729,50 +729,56 @@ const bool Message::StartFreenetInsert() MessageXML xml; int localidentityid=-1; - xml.SetMessageID(m_messageuuid); - xml.SetSubject(m_subject); - xml.SetBody(m_body); - xml.SetReplyBoard(m_replyboardname); - xml.SetDate(m_datetime.Format("%Y-%m-%d")); - xml.SetTime(m_datetime.Format("%H:%M:%S")); - StripAdministrationBoards(); - for(std::vector::iterator i=m_boards.begin(); i!=m_boards.end(); i++) - { - xml.AddBoard((*i)); - } - - for(std::map::iterator j=m_inreplyto.begin(); j!=m_inreplyto.end(); j++) - { - xml.AddInReplyTo((*j).first,(*j).second); - } - localidentityid=FindLocalIdentityID(m_fromname); - if(localidentityid==-1) + if(m_boards.size()>0) { - return false; - } - SQLite3DB::Statement st=m_db->Prepare("INSERT INTO tblMessageInserts(LocalIdentityID,MessageUUID,MessageXML) VALUES(?,?,?);"); - st.Bind(0,localidentityid); - st.Bind(1,m_messageuuid); - st.Bind(2,xml.GetXML()); - st.Step(); + xml.SetMessageID(m_messageuuid); + xml.SetSubject(m_subject); + xml.SetBody(m_body); + xml.SetReplyBoard(m_replyboardname); + xml.SetDate(m_datetime.Format("%Y-%m-%d")); + xml.SetTime(m_datetime.Format("%H:%M:%S")); + + for(std::vector::iterator i=m_boards.begin(); i!=m_boards.end(); i++) + { + xml.AddBoard((*i)); + } + + for(std::map::iterator j=m_inreplyto.begin(); j!=m_inreplyto.end(); j++) + { + xml.AddInReplyTo((*j).first,(*j).second); + } - // 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()); + localidentityid=FindLocalIdentityID(m_fromname); + if(localidentityid==-1) + { + return false; + } + + SQLite3DB::Statement st=m_db->Prepare("INSERT INTO tblMessageInserts(LocalIdentityID,MessageUUID,MessageXML) VALUES(?,?,?);"); + st.Bind(0,localidentityid); + st.Bind(1,m_messageuuid); + st.Bind(2,xml.GetXML()); st.Step(); - st.Reset(); - } - HandleChangeTrust(); + // 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;