X-Git-Url: https://git.pterodactylus.net/?p=fms.git;a=blobdiff_plain;f=src%2Fnntp%2Fnntpconnection.cpp;h=eecbec605844ac1c1ef1d0ecebf7ad60591a481f;hp=99914cd3cea7694b093d0439ed3dfbde66917cfa;hb=3f6f19146f015fa8d2c89f1e72cd467dbc4115aa;hpb=1230cc420c955e75051d011d964bc68f061ba08c diff --git a/src/nntp/nntpconnection.cpp b/src/nntp/nntpconnection.cpp index 99914cd..eecbec6 100644 --- a/src/nntp/nntpconnection.cpp +++ b/src/nntp/nntpconnection.cpp @@ -268,6 +268,10 @@ const bool NNTPConnection::HandleGetTrustCommand(const NNTPCommand &command) std::string nntpname=""; for(int i=1; i > trustlist; + std::map trustlist; if(tr.GetTrustList(trustlist)) { SendBufferedLine("280 Trust list follows"); - for(std::map >::iterator i=trustlist.begin(); i!=trustlist.end(); i++) + for(std::map::iterator i=trustlist.begin(); i!=trustlist.end(); i++) { std::ostringstream tempstr; tempstr << (*i).first << "\t"; - if((*i).second.first>-1) + if((*i).second.m_localmessagetrust>-1) { - tempstr << (*i).second.first; + tempstr << (*i).second.m_localmessagetrust; } else { tempstr << "null"; } tempstr << "\t"; - if((*i).second.second>-1) + if((*i).second.m_localtrustlisttrust>-1) + { + tempstr << (*i).second.m_localtrustlisttrust; + } + else + { + tempstr << "null"; + } + tempstr << "\t"; + if((*i).second.m_peermessagetrust>-1) + { + tempstr << (*i).second.m_peermessagetrust; + } + else + { + tempstr << "null"; + } + tempstr << "\t"; + if((*i).second.m_peertrustlisttrust>-1) { - tempstr << (*i).second.second; + tempstr << (*i).second.m_peertrustlisttrust; } else { tempstr << "null"; } + tempstr << "\t"; + tempstr << (*i).second.m_messagetrustcomment; + tempstr << "\t"; + tempstr << (*i).second.m_trustlisttrustcomment; + SendBufferedLine(tempstr.str()); } SendBufferedLine("."); @@ -1086,26 +1113,76 @@ const bool NNTPConnection::HandleSetTrustCommand(const NNTPCommand &command) { std::string type=command.m_arguments[0]; StringFunctions::UpperCase(type,type); - if(type=="MESSAGE" || type=="TRUSTLIST") + if(type=="MESSAGE" || type=="TRUSTLIST" || type=="MESSAGECOMMENT" || type=="TRUSTLISTCOMMENT") { if(m_status.m_authenticated) { bool found=false; bool valid=false; int trust=-1; + std::string comment=""; std::string nntpname=""; - for(int i=1; i=-1 && trust<=100) + if(trust>=-1 && trust<=100) + { + valid=true; + } + } + else { + int startpos=-1; + // get nntpname + for(int i=1; i0 && command.m_arguments[i][0]!='\"') + { + if(i!=1) + { + nntpname+=" "; + } + nntpname+=command.m_arguments[i]; + } + else + { + startpos=i; + } + } + + // get comment + for(int i=startpos; i0 && comment[0]=='\"') + { + comment.erase(0,1); + } + if(comment.size()>0 && comment[comment.size()-1]=='\"') + { + comment.erase(comment.size()-1); + } + valid=true; } @@ -1125,6 +1202,20 @@ const bool NNTPConnection::HandleSetTrustCommand(const NNTPCommand &command) found=true; } } + if(type=="MESSAGECOMMENT") + { + if(tr.SetMessageTrustComment(nntpname,comment)) + { + found=true; + } + } + if(type=="TRUSTLISTCOMMENT") + { + if(tr.SetTrustListTrustComment(nntpname,comment)) + { + found=true; + } + } if(found && valid) {