mirror of
https://github.com/RetroShare/RetroShare.git
synced 2024-12-29 01:16:20 -05:00
moved isIdentitybanned from p3GxsReputations to p3IdService, so as to avoid calling back p3IdService from p3GxsReputations, which simplifies the code
This commit is contained in:
parent
720c6fd915
commit
e611b2bb05
@ -34,7 +34,6 @@
|
||||
#include "pqi/p3historymgr.h"
|
||||
#include "retroshare/rspeers.h"
|
||||
#include "retroshare/rsiface.h"
|
||||
#include "retroshare/rsreputations.h"
|
||||
#include "retroshare/rsidentity.h"
|
||||
#include "rsserver/p3face.h"
|
||||
#include "gxs/rsgixs.h"
|
||||
@ -139,7 +138,7 @@ bool DistributedChatService::handleRecvChatLobbyMsgItem(RsChatMsgItem *ci)
|
||||
return false ;
|
||||
}
|
||||
|
||||
if(rsReputations->isIdentityBanned(cli->signature.keyId))
|
||||
if(rsIdentity->isBanned(cli->signature.keyId))
|
||||
{
|
||||
std::cerr << "(WW) Received lobby msg/item from banned identity " << cli->signature.keyId << ". Dropping it." << std::endl;
|
||||
return false ;
|
||||
@ -648,7 +647,7 @@ void DistributedChatService::handleRecvChatLobbyEventItem(RsChatLobbyEventItem *
|
||||
#endif
|
||||
time_t now = time(NULL) ;
|
||||
|
||||
if(rsReputations->isIdentityBanned(item->signature.keyId))
|
||||
if(rsIdentity->isBanned(item->signature.keyId))
|
||||
{
|
||||
std::cerr << "(WW) Received lobby msg/item from banned identity " << item->signature.keyId << ". Dropping it." << std::endl;
|
||||
return ;
|
||||
|
@ -191,7 +191,6 @@
|
||||
#include "turtle/p3turtle.h"
|
||||
#include "gxs/rsgixs.h"
|
||||
#include "retroshare/rspeers.h"
|
||||
#include "retroshare/rsreputations.h"
|
||||
|
||||
#include "p3grouter.h"
|
||||
#include "grouteritems.h"
|
||||
@ -1994,7 +1993,7 @@ bool p3GRouter::verifySignedDataItem(RsGRouterAbstractMsgItem *item,uint32_t& er
|
||||
{
|
||||
try
|
||||
{
|
||||
if(rsReputations->isIdentityBanned(item->signature.keyId))
|
||||
if(rsIdentity->isBanned(item->signature.keyId))
|
||||
{
|
||||
std::cerr << "(WW) received global router message from banned identity " << item->signature.keyId << ". Rejecting the message." << std::endl;
|
||||
return false ;
|
||||
|
@ -204,7 +204,6 @@
|
||||
#include "rsgxsnetservice.h"
|
||||
#include "gxssecurity.h"
|
||||
#include "retroshare/rsconfig.h"
|
||||
#include "retroshare/rsreputations.h"
|
||||
#include "retroshare/rsgxsflags.h"
|
||||
#include "retroshare/rsgxscircles.h"
|
||||
#include "pgp/pgpauxutils.h"
|
||||
@ -2928,9 +2927,8 @@ void RsGxsNetService::locked_genReqMsgTransaction(NxsTransaction* tr)
|
||||
#endif
|
||||
continue;
|
||||
}
|
||||
// FIXTESTS global variable rsReputations not available in unittests!
|
||||
if(rsReputations == 0){ std::cerr << "rsReputations==0, accepting all messages!" << std::endl; }
|
||||
if(rsReputations && rsReputations->isIdentityBanned(syncItem->authorId))
|
||||
|
||||
if(rsIdentity && rsIdentity->isBanned(syncItem->authorId))
|
||||
{
|
||||
#ifdef NXS_NET_DEBUG_1
|
||||
GXSNETDEBUG_PG(item->PeerId(),grpId) << ", Identity " << syncItem->authorId << " is banned. Not requesting message!" << std::endl;
|
||||
@ -3174,8 +3172,8 @@ void RsGxsNetService::locked_genReqGrpTransaction(NxsTransaction* tr)
|
||||
latestVersion = grpSyncItem->publishTs > metaIter->second->mPublishTs;
|
||||
}
|
||||
// FIXTESTS global variable rsReputations not available in unittests!
|
||||
if(rsReputations == 0){ std::cerr << "rsReputations==0, accepting all groups!" << std::endl; }
|
||||
if(!grpSyncItem->authorId.isNull() && rsReputations && rsReputations->isIdentityBanned(grpSyncItem->authorId))
|
||||
|
||||
if(!grpSyncItem->authorId.isNull() && rsIdentity && rsIdentity->isBanned(grpSyncItem->authorId))
|
||||
{
|
||||
#ifdef NXS_NET_DEBUG_0
|
||||
GXSNETDEBUG_PG(tr->mTransaction->PeerId(),grpId) << " Identity " << grpSyncItem->authorId << " is banned. Not syncing group." << std::endl;
|
||||
|
@ -28,7 +28,6 @@
|
||||
#include "rsgxsutil.h"
|
||||
#include "retroshare/rsgxsflags.h"
|
||||
#include "retroshare/rspeers.h"
|
||||
#include "retroshare/rsreputations.h"
|
||||
#include "pqi/pqihash.h"
|
||||
#include "gxs/rsgixs.h"
|
||||
|
||||
@ -165,7 +164,7 @@ bool RsGxsIntegrityCheck::check()
|
||||
std::cerr << "TimeStamping group authors' key ID " << grp->metaData->mAuthorId << " in group ID " << grp->grpId << std::endl;
|
||||
#endif
|
||||
|
||||
if(rsReputations!=NULL && !rsReputations->isIdentityBanned(grp->metaData->mAuthorId))
|
||||
if(rsIdentity!=NULL && !rsIdentity->isBanned(grp->metaData->mAuthorId))
|
||||
used_gxs_ids.insert(grp->metaData->mAuthorId) ;
|
||||
}
|
||||
}
|
||||
@ -247,7 +246,7 @@ bool RsGxsIntegrityCheck::check()
|
||||
#ifdef GXSUTIL_DEBUG
|
||||
std::cerr << "TimeStamping message authors' key ID " << msg->metaData->mAuthorId << " in message " << msg->msgId << ", group ID " << msg->grpId<< std::endl;
|
||||
#endif
|
||||
if(rsReputations!=NULL && !rsReputations->isIdentityBanned(msg->metaData->mAuthorId))
|
||||
if(rsIdentity!=NULL && !rsIdentity->isBanned(msg->metaData->mAuthorId))
|
||||
used_gxs_ids.insert(msg->metaData->mAuthorId) ;
|
||||
}
|
||||
|
||||
|
@ -253,6 +253,7 @@ virtual bool getRecognTagRequest(const RsGxsId &id, const std::string &comment,
|
||||
|
||||
virtual bool setAsRegularContact(const RsGxsId& id,bool is_a_contact) = 0 ;
|
||||
virtual bool isARegularContact(const RsGxsId& id) = 0 ;
|
||||
virtual bool isBanned(const RsGxsId& id) =0;
|
||||
|
||||
// Specific RsIdentity Functions....
|
||||
/* Specific Service Data */
|
||||
|
@ -50,14 +50,14 @@ public:
|
||||
};
|
||||
|
||||
virtual bool setOwnOpinion(const RsGxsId& key_id, const Opinion& op) =0;
|
||||
virtual bool getReputationInfo(const RsGxsId& id,ReputationInfo& info) =0 ;
|
||||
virtual bool getReputationInfo(const RsGxsId& id,const RsPgpId& owner_id,ReputationInfo& info) =0 ;
|
||||
virtual void setNodeAutoBanThreshold(uint32_t n) =0;
|
||||
virtual uint32_t nodeAutoBanThreshold() =0;
|
||||
|
||||
// This one is a proxy designed to allow fast checking of a GXS id.
|
||||
// it basically returns true if assessment is not ASSESSMENT_OK
|
||||
|
||||
virtual bool isIdentityBanned(const RsGxsId& id) =0;
|
||||
virtual bool isIdentityBanned(const RsGxsId& id,const RsPgpId& owner_node) =0;
|
||||
};
|
||||
|
||||
// To access reputations from anywhere
|
||||
|
@ -39,6 +39,7 @@
|
||||
/****
|
||||
* #define DEBUG_REPUTATION 1
|
||||
****/
|
||||
#define DEBUG_REPUTATION 1
|
||||
|
||||
/************ IMPLEMENTATION NOTES *********************************
|
||||
*
|
||||
@ -333,11 +334,35 @@ void p3GxsReputation::updateIdentityFlags()
|
||||
void p3GxsReputation::cleanup()
|
||||
{
|
||||
// remove opinions from friends that havn't been seen online for more than the specified delay
|
||||
|
||||
|
||||
#ifdef DEBUG_REPUTATION
|
||||
std::cerr << "p3GxsReputation::cleanup() " << std::endl;
|
||||
#endif
|
||||
std::cerr << __PRETTY_FUNCTION__ << ": not implemented. TODO!" << std::endl;
|
||||
std::cerr << "p3GxsReputation::cleanup() " << std::endl;
|
||||
|
||||
// remove optionions about identities that do not exist anymore. That will in particular avoid asking p3idservice about deleted
|
||||
// identities, which would cause an excess of hits to the database.
|
||||
|
||||
bool updated = false ;
|
||||
|
||||
RsStackMutex stack(mReputationMtx); /****** LOCKED MUTEX *******/
|
||||
|
||||
for(std::map<RsGxsId,Reputation>::iterator it(mReputations.begin());it!=mReputations.end();)
|
||||
if(it->second.mOpinions.empty() && it->second.mOwnOpinion == RsReputations::OPINION_NEUTRAL)
|
||||
{
|
||||
std::map<RsGxsId,Reputation>::iterator tmp(it) ;
|
||||
++tmp ;
|
||||
mReputations.erase(it) ;
|
||||
it = tmp ;
|
||||
#ifdef DEBUG_REPUTATION
|
||||
std::cerr << " ID " << it->first << ": own is neutral and no opinions from friends => remove entry" << std::endl;
|
||||
#endif
|
||||
updated = true ;
|
||||
}
|
||||
else
|
||||
++it ;
|
||||
|
||||
if(updated)
|
||||
IndicateConfigChanged() ;
|
||||
}
|
||||
|
||||
void p3GxsReputation::updateActiveFriends()
|
||||
@ -668,7 +693,7 @@ bool p3GxsReputation::updateLatestUpdate(RsPeerId peerid,time_t latest_update)
|
||||
* Opinion
|
||||
****/
|
||||
|
||||
bool p3GxsReputation::getReputationInfo(const RsGxsId& gxsid, RsReputations::ReputationInfo& info)
|
||||
bool p3GxsReputation::getReputationInfo(const RsGxsId& gxsid, const RsPgpId& owner_id, RsReputations::ReputationInfo& info)
|
||||
{
|
||||
if(gxsid.isNull())
|
||||
return false ;
|
||||
@ -678,25 +703,34 @@ bool p3GxsReputation::getReputationInfo(const RsGxsId& gxsid, RsReputations::Rep
|
||||
#ifdef DEBUG_REPUTATION
|
||||
std::cerr << "getReputationInfo() for " << gxsid << std::endl;
|
||||
#endif
|
||||
Reputation& rep(mReputations[gxsid]) ;
|
||||
std::map<RsGxsId,Reputation>::const_iterator it = mReputations.find(gxsid) ;
|
||||
|
||||
info.mOwnOpinion = RsReputations::Opinion(rep.mOwnOpinion) ;
|
||||
info.mOverallReputationScore = rep.mReputation ;
|
||||
info.mFriendAverage = rep.mFriendAverage ;
|
||||
|
||||
if( (rep.mIdentityFlags & REPUTATION_IDENTITY_FLAG_PGP_LINKED) && (mBannedPgpIds.find(rep.mOwnerNode) != mBannedPgpIds.end()))
|
||||
if(it == mReputations.end())
|
||||
{
|
||||
info.mAssessment = RsReputations::ASSESSMENT_BAD ;
|
||||
#ifdef DEBUG_REPUTATION
|
||||
std::cerr << "p3GxsReputations: identity " << gxsid << " is banned because owner node ID " << rep.mOwnerNode << " is banned." << std::endl;
|
||||
#endif
|
||||
return true;
|
||||
info.mOwnOpinion = RsReputations::OPINION_NEUTRAL ;
|
||||
info.mOverallReputationScore = RsReputations::REPUTATION_THRESHOLD_DEFAULT ;
|
||||
info.mFriendAverage = REPUTATION_THRESHOLD_DEFAULT ;
|
||||
}
|
||||
|
||||
if(info.mOverallReputationScore > REPUTATION_ASSESSMENT_THRESHOLD_X1)
|
||||
info.mAssessment = RsReputations::ASSESSMENT_OK ;
|
||||
else
|
||||
{
|
||||
const Reputation& rep(it->second) ;
|
||||
|
||||
info.mOwnOpinion = RsReputations::Opinion(rep.mOwnOpinion) ;
|
||||
info.mOverallReputationScore = rep.mReputation ;
|
||||
info.mFriendAverage = rep.mFriendAverage ;
|
||||
}
|
||||
|
||||
if(!owner_id.isNull() && (mBannedPgpIds.find(owner_id) != mBannedPgpIds.end()))
|
||||
{
|
||||
#ifdef DEBUG_REPUTATION
|
||||
std::cerr << "p3GxsReputations: identity " << gxsid << " is banned because owner node ID " << owner_id << " is banned." << std::endl;
|
||||
#endif
|
||||
info.mAssessment = RsReputations::ASSESSMENT_BAD ;
|
||||
}
|
||||
else if(info.mOverallReputationScore <= REPUTATION_ASSESSMENT_THRESHOLD_X1)
|
||||
info.mAssessment = RsReputations::ASSESSMENT_BAD ;
|
||||
else
|
||||
info.mAssessment = RsReputations::ASSESSMENT_OK ;
|
||||
|
||||
#ifdef DEBUG_REPUTATION
|
||||
std::cerr << " information present. OwnOp = " << info.mOwnOpinion << ", overall score=" << info.mAssessment << std::endl;
|
||||
@ -705,11 +739,12 @@ bool p3GxsReputation::getReputationInfo(const RsGxsId& gxsid, RsReputations::Rep
|
||||
return true ;
|
||||
}
|
||||
|
||||
bool p3GxsReputation::isIdentityBanned(const RsGxsId &id)
|
||||
bool p3GxsReputation::isIdentityBanned(const RsGxsId &id,const RsPgpId& owner_node)
|
||||
{
|
||||
RsReputations::ReputationInfo info ;
|
||||
|
||||
getReputationInfo(id,info) ;
|
||||
if(!getReputationInfo(id,owner_node,info))
|
||||
return false ;
|
||||
|
||||
#ifdef DEBUG_REPUTATION
|
||||
std::cerr << "isIdentityBanned(): returning " << (info.mAssessment == RsReputations::ASSESSMENT_BAD) << " for GXS id " << id << std::endl;
|
||||
|
@ -97,8 +97,8 @@ 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 isIdentityBanned(const RsGxsId& id) ;
|
||||
virtual bool getReputationInfo(const RsGxsId& id, const RsPgpId &owner_id, ReputationInfo& info) ;
|
||||
virtual bool isIdentityBanned(const RsGxsId& id, const RsPgpId &owner_node) ;
|
||||
|
||||
virtual void setNodeAutoBanThreshold(uint32_t n) ;
|
||||
virtual uint32_t nodeAutoBanThreshold() ;
|
||||
|
@ -264,7 +264,7 @@ time_t p3IdService::locked_getLastUsageTS(const RsGxsId& gxs_id)
|
||||
}
|
||||
void p3IdService::timeStampKey(const RsGxsId& gxs_id)
|
||||
{
|
||||
if(rsReputations->isIdentityBanned(gxs_id))
|
||||
if(isBanned(gxs_id))
|
||||
{
|
||||
std::cerr << "(II) p3IdService:timeStampKey(): refusing to time stamp key " << gxs_id << " because it is banned." << std::endl;
|
||||
return;
|
||||
@ -324,7 +324,7 @@ public:
|
||||
time_t now = time(NULL);
|
||||
const RsGxsId& gxs_id = entry.details.mId ;
|
||||
|
||||
bool is_id_banned = rsReputations->isIdentityBanned(gxs_id) ;
|
||||
bool is_id_banned = rsReputations->isIdentityBanned(gxs_id,entry.details.mPgpId) ;
|
||||
bool is_own_id = (bool)(entry.details.mFlags & RS_IDENTITY_FLAGS_IS_OWN_ID) ;
|
||||
bool is_known_id = (bool)(entry.details.mFlags & RS_IDENTITY_FLAGS_PGP_KNOWN) ;
|
||||
bool is_signed_id = (bool)(entry.details.mFlags & RS_IDENTITY_FLAGS_PGP_LINKED) ;
|
||||
@ -503,7 +503,7 @@ bool p3IdService:: getNickname(const RsGxsId &id, std::string &nickname)
|
||||
}
|
||||
#endif
|
||||
|
||||
bool p3IdService:: getIdDetails(const RsGxsId &id, RsIdentityDetails &details)
|
||||
bool p3IdService::getIdDetails(const RsGxsId &id, RsIdentityDetails &details)
|
||||
{
|
||||
#ifdef DEBUG_IDS
|
||||
std::cerr << "p3IdService::getIdDetails(" << id << ")";
|
||||
@ -524,7 +524,7 @@ bool p3IdService:: getIdDetails(const RsGxsId &id, RsIdentityDetails &details)
|
||||
if(details.mNickname.length() > RSID_MAXIMUM_NICKNAME_SIZE*4)
|
||||
details.mNickname = "[too long a name]" ;
|
||||
|
||||
rsReputations->getReputationInfo(id,details.mReputation) ;
|
||||
rsReputations->getReputationInfo(id,details.mPgpId,details.mReputation) ;
|
||||
|
||||
return true;
|
||||
}
|
||||
@ -536,6 +536,16 @@ bool p3IdService:: getIdDetails(const RsGxsId &id, RsIdentityDetails &details)
|
||||
return false;
|
||||
}
|
||||
|
||||
bool p3IdService::isBanned(const RsGxsId &id)
|
||||
{
|
||||
RsIdentityDetails det ;
|
||||
getIdDetails(id,det) ;
|
||||
|
||||
#ifdef DEBUG_REPUTATION
|
||||
std::cerr << "isIdentityBanned(): returning " << (det.mReputation.mAssessment == RsReputations::ASSESSMENT_BAD) << " for GXS id " << id << std::endl;
|
||||
#endif
|
||||
return det.mReputation.mAssessment == RsReputations::ASSESSMENT_BAD ;
|
||||
}
|
||||
|
||||
bool p3IdService::isOwnId(const RsGxsId& id)
|
||||
{
|
||||
|
@ -274,6 +274,7 @@ virtual bool getRecognTagRequest(const RsGxsId &id, const std::string &comment,
|
||||
|
||||
virtual bool setAsRegularContact(const RsGxsId& id,bool is_a_contact) ;
|
||||
virtual bool isARegularContact(const RsGxsId& id) ;
|
||||
virtual bool isBanned(const RsGxsId& id) ;
|
||||
|
||||
/**************** RsGixs Implementation ***************/
|
||||
|
||||
|
@ -26,7 +26,6 @@
|
||||
#include "gui/common/UIStateHelper.h"
|
||||
|
||||
#include <retroshare/rspeers.h>
|
||||
#include <retroshare/rsreputations.h>
|
||||
|
||||
// Data Requests.
|
||||
#define IDDETAILSDIALOG_IDDETAILS 1
|
||||
@ -261,7 +260,7 @@ void IdDetailsDialog::insertIdDetails(uint32_t token)
|
||||
#endif
|
||||
|
||||
RsReputations::ReputationInfo info ;
|
||||
rsReputations->getReputationInfo(RsGxsId(data.mMeta.mGroupId),info) ;
|
||||
rsReputations->getReputationInfo(RsGxsId(data.mMeta.mGroupId),data.mPgpId,info) ;
|
||||
|
||||
ui->neighborNodesOpinion_TF->setText(QString::number(info.mOverallReputationScore-1.0f));
|
||||
|
||||
|
@ -41,7 +41,6 @@
|
||||
#include "util/QtVersion.h"
|
||||
|
||||
#include <retroshare/rspeers.h>
|
||||
#include <retroshare/rsreputations.h>
|
||||
#include "retroshare/rsgxsflags.h"
|
||||
#include "retroshare/rsmsgs.h"
|
||||
#include <iostream>
|
||||
@ -1360,8 +1359,8 @@ bool IdDialog::fillIdListItem(const RsGxsIdGroup& data, QTreeWidgetItem *&item,
|
||||
if (!item)
|
||||
item = new TreeWidgetItem();
|
||||
|
||||
RsReputations::ReputationInfo info ;
|
||||
rsReputations->getReputationInfo(RsGxsId(data.mMeta.mGroupId),info) ;
|
||||
RsIdentityDetails idd ;
|
||||
rsIdentity->getIdDetails(RsGxsId(data.mMeta.mGroupId),idd) ;
|
||||
|
||||
item->setText(RSID_COL_NICKNAME, QString::fromUtf8(data.mMeta.mGroupName.c_str()).left(RSID_MAXIMUM_NICKNAME_SIZE));
|
||||
item->setText(RSID_COL_KEYID, QString::fromStdString(data.mMeta.mGroupId.toStdString()));
|
||||
@ -1372,13 +1371,10 @@ bool IdDialog::fillIdListItem(const RsGxsIdGroup& data, QTreeWidgetItem *&item,
|
||||
item->setData(RSID_COL_KEYID, Qt::UserRole,QVariant(item_flags)) ;
|
||||
|
||||
item->setTextAlignment(RSID_COL_VOTES, Qt::AlignRight);
|
||||
item->setData(RSID_COL_VOTES,Qt::DisplayRole, QString::number(info.mOverallReputationScore - 1.0f,'f',3));
|
||||
item->setData(RSID_COL_VOTES,Qt::DisplayRole, QString::number(idd.mReputation.mOverallReputationScore - 1.0f,'f',3));
|
||||
|
||||
if(isOwnId)
|
||||
{
|
||||
RsIdentityDetails idd ;
|
||||
rsIdentity->getIdDetails(RsGxsId(data.mMeta.mGroupId),idd) ;
|
||||
|
||||
QFont font = item->font(RSID_COL_NICKNAME) ;
|
||||
|
||||
font.setBold(true) ;
|
||||
@ -1740,7 +1736,7 @@ void IdDialog::insertIdDetails(uint32_t token)
|
||||
#endif
|
||||
|
||||
RsReputations::ReputationInfo info ;
|
||||
rsReputations->getReputationInfo(RsGxsId(data.mMeta.mGroupId),info) ;
|
||||
rsReputations->getReputationInfo(RsGxsId(data.mMeta.mGroupId),data.mPgpId,info) ;
|
||||
|
||||
ui->neighborNodesOpinion_TF->setText(QString::number(info.mFriendAverage - 1.0f));
|
||||
|
||||
@ -2021,10 +2017,10 @@ void IdDialog::IdListCustomPopupMenu( QPoint )
|
||||
#endif
|
||||
RsGxsId keyId((*it)->text(RSID_COL_KEYID).toStdString());
|
||||
|
||||
RsReputations::ReputationInfo info ;
|
||||
rsReputations->getReputationInfo(keyId,info) ;
|
||||
RsIdentityDetails det ;
|
||||
rsIdentity->getIdDetails(keyId,det) ;
|
||||
|
||||
switch(info.mOwnOpinion)
|
||||
switch(det.mReputation.mOwnOpinion)
|
||||
{
|
||||
case RsReputations::OPINION_NEGATIVE: ++n_negative_reputations ;
|
||||
break ;
|
||||
|
@ -905,7 +905,7 @@ bool GxsIdDetails::MakeIdDesc(const RsGxsId &id, bool doIcons, QString &str, QLi
|
||||
|
||||
QString GxsIdDetails::getName(const RsIdentityDetails &details)
|
||||
{
|
||||
if(rsReputations->isIdentityBanned(details.mId))
|
||||
if(rsIdentity->isBanned(details.mId))
|
||||
return tr("[Banned]") ;
|
||||
|
||||
QString name = QString::fromUtf8(details.mNickname.c_str()).left(RSID_MAXIMUM_NICKNAME_SIZE);
|
||||
@ -924,7 +924,7 @@ QString GxsIdDetails::getComment(const RsIdentityDetails &details)
|
||||
QString comment;
|
||||
QString nickname ;
|
||||
|
||||
bool banned = rsReputations->isIdentityBanned(details.mId) ;
|
||||
bool banned = rsIdentity->isBanned(details.mId) ;
|
||||
|
||||
if(details.mNickname.empty())
|
||||
nickname = tr("[Unknown]") ;
|
||||
@ -963,7 +963,7 @@ void GxsIdDetails::getIcons(const RsIdentityDetails &details, QList<QIcon> &icon
|
||||
{
|
||||
QPixmap pix ;
|
||||
|
||||
if(rsReputations->isIdentityBanned(details.mId))
|
||||
if(rsIdentity->isBanned(details.mId))
|
||||
{
|
||||
icons.clear() ;
|
||||
icons.push_back(QIcon(IMAGE_BANNED)) ;
|
||||
|
@ -117,14 +117,14 @@ void GxsIdRSTreeWidgetItem::setId(const RsGxsId &id, int column, bool retryWhenF
|
||||
|
||||
void GxsIdRSTreeWidgetItem::updateBannedState()
|
||||
{
|
||||
if(mBannedState != rsReputations->isIdentityBanned(mId))
|
||||
if(mBannedState != rsIdentity->isBanned(mId))
|
||||
forceUpdate() ;
|
||||
}
|
||||
|
||||
void GxsIdRSTreeWidgetItem::forceUpdate()
|
||||
{
|
||||
mIdFound = false;
|
||||
mBannedState = rsReputations->isIdentityBanned(mId) ;
|
||||
mBannedState = rsIdentity->isBanned(mId) ;
|
||||
|
||||
startProcess();
|
||||
}
|
||||
@ -170,7 +170,7 @@ QVariant GxsIdRSTreeWidgetItem::data(int column, int role) const
|
||||
|
||||
if(mId.isNull())
|
||||
return RSTreeWidgetItem::data(column, role);
|
||||
else if(rsReputations->isIdentityBanned(mId))
|
||||
else if(rsIdentity->isBanned(mId))
|
||||
pix = QImage(BANNED_IMAGE) ;
|
||||
else if (mAvatar.mSize == 0 || !pix.loadFromData(mAvatar.mData, mAvatar.mSize, "PNG"))
|
||||
pix = GxsIdDetails::makeDefaultIcon(mId);
|
||||
|
@ -985,7 +985,7 @@ QTreeWidgetItem *GxsForumThreadWidget::convertMsgToThreadWidget(const RsGxsForum
|
||||
// is flagged with a bad reputation
|
||||
|
||||
|
||||
bool redacted = rsReputations->isIdentityBanned(msg.mMeta.mAuthorId) ;
|
||||
bool redacted = rsIdentity->isBanned(msg.mMeta.mAuthorId) ;
|
||||
|
||||
GxsIdRSTreeWidgetItem *item = new GxsIdRSTreeWidgetItem(mThreadCompareRole,GxsIdDetails::ICON_TYPE_ALL || (redacted?(GxsIdDetails::ICON_TYPE_REDACTED):0));
|
||||
item->moveToThread(ui->threadTreeWidget->thread());
|
||||
@ -1408,7 +1408,7 @@ void GxsForumThreadWidget::insertMessageData(const RsGxsForumMsg &msg)
|
||||
return;
|
||||
}
|
||||
|
||||
bool redacted = rsReputations->isIdentityBanned(msg.mMeta.mAuthorId) ;
|
||||
bool redacted = rsIdentity->isBanned(msg.mMeta.mAuthorId) ;
|
||||
|
||||
mStateHelper->setActive(mTokenTypeMessageData, true);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user