X-Git-Url: https://git.pterodactylus.net/?a=blobdiff_plain;ds=sidebyside;f=src%2Fmessage.cpp;h=d8adc87c64c1f334f87ea0f7c2ac76c225b2c645;hb=ee580d19b7920904587e18d72a3465d52eab6204;hp=41add1081e9d0acca8ec5e8585cae1fea11c6b9e;hpb=52c0819bfc1d083c6e0738f75f0d7eeba521295a;p=fms.git diff --git a/src/message.cpp b/src/message.cpp index 41add10..d8adc87 100644 --- a/src/message.cpp +++ b/src/message.cpp @@ -140,8 +140,22 @@ void Message::HandleAdministrationMessage() { origmess.ResultInt(0,identityid); origmess.ResultText(1,identityname); - origmess.ResultInt(2,origmessagetrust); - origmess.ResultInt(3,origtrustlisttrust); + if(origmess.ResultNull(2)==false) + { + origmess.ResultInt(2,origmessagetrust); + } + else + { + origmessagetrust=50; + } + if(origmess.ResultNull(3)==false) + { + origmess.ResultInt(3,origtrustlisttrust); + } + else + { + origtrustlisttrust=50; + } origmessagetrust+=changemessagetrust; origtrustlisttrust+=changetrustlisttrust; @@ -222,7 +236,14 @@ void Message::HandleChangeTrust() int localmessagetrust=0; st.ResultInt(0,identityid); - st.ResultInt(1,localmessagetrust); + if(st.ResultNull(1)==false) + { + st.ResultInt(1,localmessagetrust); + } + else + { + localmessagetrust=50; + } localmessagetrust+=m_changemessagetrustonreply; if(localmessagetrust<0) @@ -258,6 +279,15 @@ void Message::Initialize() m_changemessagetrustonreply=0; Option::Instance()->Get("ChangeMessageTrustOnReply",tempval); StringFunctions::Convert(tempval,m_changemessagetrustonreply); + Option::Instance()->Get("AddNewPostFromIdentities",tempval); + if(tempval=="true") + { + m_addnewpostfromidentities=true; + } + else + { + m_addnewpostfromidentities=false; + } } const bool Message::Load(const long messageid, const long boardid) @@ -587,7 +617,7 @@ const bool Message::ParseNNTPMessage(const std::string &nntpmessage) return true; } -void Message::StartFreenetInsert() +const bool Message::StartFreenetInsert() { MessageXML xml; @@ -618,12 +648,19 @@ void Message::StartFreenetInsert() // couldn't find identity with this name - insert a new identity if(!st.RowReturned()) { - DateTime now; - now.SetToGMTime(); - st=m_db->Prepare("INSERT INTO tblLocalIdentity(Name) VALUES(?);"); - st.Bind(0,m_fromname); - st.Step(true); - localidentityid=st.GetLastInsertRowID(); + if(m_addnewpostfromidentities==true) + { + DateTime now; + now.SetToGMTime(); + st=m_db->Prepare("INSERT INTO tblLocalIdentity(Name) VALUES(?);"); + st.Bind(0,m_fromname); + st.Step(true); + localidentityid=st.GetLastInsertRowID(); + } + else + { + return false; + } } else { @@ -638,4 +675,6 @@ void Message::StartFreenetInsert() HandleChangeTrust(); + return true; + }