X-Git-Url: https://git.pterodactylus.net/?a=blobdiff_plain;f=src%2Fnntp%2Fnntpconnection.cpp;h=eecbec605844ac1c1ef1d0ecebf7ad60591a481f;hb=3f6f19146f015fa8d2c89f1e72cd467dbc4115aa;hp=54d7c9417a463eb5af33d673b47ab5c1e3736f19;hpb=7ddb1aeb0b3dc7384597e75f7b3557f2d8f6d14c;p=fms.git diff --git a/src/nntp/nntpconnection.cpp b/src/nntp/nntpconnection.cpp index 54d7c94..eecbec6 100644 --- a/src/nntp/nntpconnection.cpp +++ b/src/nntp/nntpconnection.cpp @@ -259,7 +259,7 @@ const bool NNTPConnection::HandleGetTrustCommand(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=="PEERMESSAGE" || type=="PEERTRUSTLIST") { if(m_status.m_authenticated) { @@ -268,6 +268,10 @@ const bool NNTPConnection::HandleGetTrustCommand(const NNTPCommand &command) std::string nntpname=""; for(int i=1; i=0 && found) { @@ -326,31 +344,54 @@ const bool NNTPConnection::HandleGetTrustListCommand(const NNTPCommand &command) if(m_status.m_authenticated) { TrustExtension tr(m_status.m_authuser.GetID()); - std::map > 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("."); @@ -1072,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(command.m_arguments[command.m_arguments.size()-1]!="null") + { + StringFunctions::Convert(command.m_arguments[command.m_arguments.size()-1],trust); + } + + 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; } @@ -1111,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) {