mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-05-02 22:25:04 -04:00
enabled bannign button in forums, and disable message passing for banned users
This commit is contained in:
parent
e309dd6fed
commit
1a76bea6ff
9 changed files with 45 additions and 25 deletions
|
@ -1997,7 +1997,13 @@ void RsGxsNetService::locked_genReqMsgTransaction(NxsTransaction* tr)
|
|||
std::cerr << ", no group meta found. Givign up." << std::endl;
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
if(rsReputations->isIdentityBanned(syncItem->authorId))
|
||||
{
|
||||
std::cerr << ", Identity " << syncItem->authorId << " is banned. Not requesting message!" << std::endl;
|
||||
continue ;
|
||||
}
|
||||
|
||||
if(mReputations->haveReputation(syncItem->authorId) || noAuthor)
|
||||
{
|
||||
GixsReputation rep;
|
||||
|
@ -2010,7 +2016,7 @@ void RsGxsNetService::locked_genReqMsgTransaction(NxsTransaction* tr)
|
|||
|
||||
// if author is required for this message, it will simply get dropped
|
||||
// at genexchange side of things
|
||||
if(rsReputations->isIdentityOk(syncItem->authorId) && rep.score > (int)grpMeta->mReputationCutOff || noAuthor)
|
||||
if(rep.score > (int)grpMeta->mReputationCutOff || noAuthor)
|
||||
{
|
||||
#ifdef NXS_NET_DEBUG
|
||||
std::cerr << ", passed! Adding message to req list." << std::endl;
|
||||
|
@ -2211,7 +2217,13 @@ void RsGxsNetService::locked_genReqGrpTransaction(NxsTransaction* tr)
|
|||
haveItem = true;
|
||||
latestVersion = grpSyncItem->publishTs > metaIter->second->mPublishTs;
|
||||
}
|
||||
|
||||
|
||||
if(rsReputations->isIdentityBanned(grpSyncItem->authorId))
|
||||
{
|
||||
std::cerr << " Identity " << grpSyncItem->authorId << " is banned. Not syncing group." << std::endl;
|
||||
continue ;
|
||||
}
|
||||
|
||||
if( (mGrpAutoSync && !haveItem) || latestVersion)
|
||||
{
|
||||
// determine if you need to check reputation
|
||||
|
@ -2226,7 +2238,7 @@ void RsGxsNetService::locked_genReqGrpTransaction(NxsTransaction* tr)
|
|||
GixsReputation rep;
|
||||
mReputations->getReputation(grpSyncItem->authorId, rep);
|
||||
|
||||
if(rep.score >= GIXS_CUT_OFF && rsReputations->isIdentityOk(grpSyncItem->authorId))
|
||||
if(rep.score >= GIXS_CUT_OFF)
|
||||
{
|
||||
addGroupItemToList(tr, grpId, transN, reqList);
|
||||
std::cerr << " reputation cut off: limit=" << GIXS_CUT_OFF << " value=" << rep.score << ": allowed." << std::endl;
|
||||
|
|
|
@ -32,6 +32,7 @@
|
|||
|
||||
#include "retroshare/rstokenservice.h"
|
||||
#include "retroshare/rsgxsifacehelper.h"
|
||||
#include "retroshare/rsreputations.h"
|
||||
#include "retroshare/rsids.h"
|
||||
#include "serialiser/rstlvimage.h"
|
||||
#include "retroshare/rsgxscommon.h"
|
||||
|
@ -158,8 +159,7 @@ class RsIdentityDetails
|
|||
{
|
||||
public:
|
||||
RsIdentityDetails()
|
||||
:mIsOwnId(false), mPgpLinked(false), mPgpKnown(false),
|
||||
mReputation(), mLastUsageTS(0) { return; }
|
||||
:mIsOwnId(false), mPgpLinked(false), mPgpKnown(false), mLastUsageTS(0) { return; }
|
||||
|
||||
RsGxsId mId;
|
||||
|
||||
|
@ -175,9 +175,12 @@ public:
|
|||
// Recogn details.
|
||||
std::list<RsRecognTag> mRecognTags;
|
||||
|
||||
// reputation details.
|
||||
GxsReputation mReputation;
|
||||
bool mBanned ;
|
||||
// Cyril: Reputation details. At some point we might want to merge information
|
||||
// between the two into a single global score. Since the old reputation system
|
||||
// is not finished yet, I leave this in place. We should decide what to do with it.
|
||||
|
||||
GxsReputation mReputation_oldSystem; // this is the old "mReputation" field, which apparently is not used.
|
||||
RsReputations::ReputationInfo mReputation;
|
||||
|
||||
// avatar
|
||||
RsGxsImage mAvatar ;
|
||||
|
|
|
@ -48,9 +48,9 @@ public:
|
|||
virtual bool getReputationInfo(const RsGxsId& id,ReputationInfo& info) =0 ;
|
||||
|
||||
// This one is a proxy designed to allow fast checking of a GXS id.
|
||||
// it basically returns true if assessment is ASSESSMENT_OK
|
||||
// it basically returns true if assessment is not ASSESSMENT_OK
|
||||
|
||||
virtual bool isIdentityOk(const RsGxsId& id) =0;
|
||||
virtual bool isIdentityBanned(const RsGxsId& id) =0;
|
||||
};
|
||||
|
||||
// To access reputations from anywhere
|
||||
|
|
|
@ -550,16 +550,16 @@ bool p3GxsReputation::getReputationInfo(const RsGxsId& gxsid, RsReputations::Rep
|
|||
return true ;
|
||||
}
|
||||
|
||||
bool p3GxsReputation::isIdentityOk(const RsGxsId &id)
|
||||
bool p3GxsReputation::isIdentityBanned(const RsGxsId &id)
|
||||
{
|
||||
RsReputations::ReputationInfo info ;
|
||||
|
||||
getReputationInfo(id,info) ;
|
||||
|
||||
#ifdef DEBUG_REPUTATION
|
||||
std::cerr << "isIdentityOk(): returning " << (info.mAssessment == RsReputations::ASSESSMENT_OK) << " for GXS id " << id << std::endl;
|
||||
std::cerr << "isIdentityBanned(): returning " << (info.mAssessment == RsReputations::ASSESSMENT_BAD) << " for GXS id " << id << std::endl;
|
||||
#endif
|
||||
return info.mAssessment == RsReputations::ASSESSMENT_OK ;
|
||||
return info.mAssessment == RsReputations::ASSESSMENT_BAD ;
|
||||
}
|
||||
|
||||
bool p3GxsReputation::setOwnOpinion(const RsGxsId& gxsid, const RsReputations::Opinion& opinion)
|
||||
|
|
|
@ -90,7 +90,7 @@ class p3GxsReputation: public p3Service, public p3Config, public RsReputations /
|
|||
/***** Interface for RsReputations *****/
|
||||
virtual bool setOwnOpinion(const RsGxsId& key_id, const Opinion& op) ;
|
||||
virtual bool getReputationInfo(const RsGxsId& id,ReputationInfo& info) ;
|
||||
virtual bool isIdentityOk(const RsGxsId& id) ;
|
||||
virtual bool isIdentityBanned(const RsGxsId& id) ;
|
||||
|
||||
/***** overloaded from p3Service *****/
|
||||
virtual int tick();
|
||||
|
|
|
@ -412,6 +412,8 @@ bool p3IdService:: getIdDetails(const RsGxsId &id, RsIdentityDetails &details)
|
|||
// one utf8 symbol can be at most 4 bytes long - would be better to measure real unicode length !!!
|
||||
if(details.mNickname.length() > RSID_MAXIMUM_NICKNAME_SIZE*4)
|
||||
details.mNickname = "[too long a name]" ;
|
||||
|
||||
rsReputations->getReputationInfo(id,details.mReputation) ;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -421,6 +423,9 @@ bool p3IdService:: getIdDetails(const RsGxsId &id, RsIdentityDetails &details)
|
|||
{
|
||||
details = data.details;
|
||||
details.mLastUsageTS = locked_getLastUsageTS(id) ;
|
||||
|
||||
rsReputations->getReputationInfo(id,details.mReputation) ;
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
@ -831,7 +836,7 @@ bool p3IdService::getReputation(const RsGxsId &id, GixsReputation &rep)
|
|||
if (mPublicKeyCache.fetch(id, data))
|
||||
{
|
||||
rep.id = id;
|
||||
rep.score = data.details.mReputation.mOverallScore;
|
||||
rep.score = 0;//data.details.mReputation.mOverallScore;
|
||||
#ifdef DEBUG_IDS
|
||||
std::cerr << "p3IdService::getReputation() id: ";
|
||||
std::cerr << id.toStdString() << " score: " <<
|
||||
|
@ -1669,14 +1674,14 @@ void RsGxsIdCache::updateServiceString(std::string serviceString)
|
|||
}
|
||||
|
||||
// copy over Reputation scores.
|
||||
details.mReputation = ssdata.score.rep;
|
||||
//details.mReputation = ssdata.score.rep;
|
||||
}
|
||||
else
|
||||
{
|
||||
details.mPgpKnown = false;
|
||||
details.mPgpId.clear();
|
||||
details.mReputation.updateIdScore(false, false);
|
||||
details.mReputation.update();
|
||||
//details.mReputation.updateIdScore(false, false);
|
||||
//details.mReputation.update();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue