mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-07-31 18:29:02 -04:00
made RsReputation::overallReputationLevel() to also return the identity ownership flags so that we dont need to rely on async calls to p3IdService to get them
This commit is contained in:
parent
013eb93f70
commit
6a9b697e42
6 changed files with 46 additions and 15 deletions
|
@ -768,14 +768,45 @@ bool p3GxsReputation::updateLatestUpdate(RsPeerId peerid,time_t latest_update)
|
|||
* Opinion
|
||||
****/
|
||||
|
||||
RsReputations::ReputationLevel p3GxsReputation::overallReputationLevel(const RsGxsId& id)
|
||||
RsReputations::ReputationLevel p3GxsReputation::overallReputationLevel(const RsGxsId& id,uint32_t *identity_flags)
|
||||
{
|
||||
ReputationInfo info ;
|
||||
getReputationInfo(id,RsPgpId(),info) ;
|
||||
|
||||
RsPgpId owner_id ;
|
||||
|
||||
if(identity_flags)
|
||||
getIdentityFlagsAndOwnerId(id,*identity_flags,owner_id);
|
||||
|
||||
return info.mOverallReputationLevel ;
|
||||
}
|
||||
|
||||
bool p3GxsReputation::getIdentityFlagsAndOwnerId(const RsGxsId& gxsid, uint32_t& identity_flags,RsPgpId& owner_id)
|
||||
{
|
||||
if(gxsid.isNull())
|
||||
return false ;
|
||||
|
||||
RsStackMutex stack(mReputationMtx); /****** LOCKED MUTEX *******/
|
||||
|
||||
std::map<RsGxsId,Reputation>::iterator it = mReputations.find(gxsid) ;
|
||||
|
||||
if(it == mReputations.end())
|
||||
return false ;
|
||||
|
||||
if(!(it->second.mIdentityFlags & REPUTATION_IDENTITY_FLAG_UP_TO_DATE))
|
||||
return false ;
|
||||
|
||||
if(it->second.mIdentityFlags & REPUTATION_IDENTITY_FLAG_PGP_LINKED)
|
||||
identity_flags |= RS_IDENTITY_FLAGS_PGP_LINKED ;
|
||||
|
||||
if(it->second.mIdentityFlags & REPUTATION_IDENTITY_FLAG_PGP_KNOWN)
|
||||
identity_flags |= RS_IDENTITY_FLAGS_PGP_KNOWN ;
|
||||
|
||||
owner_id = it->second.mOwnerNode ;
|
||||
|
||||
return true ;
|
||||
}
|
||||
|
||||
bool p3GxsReputation::getReputationInfo(const RsGxsId& gxsid, const RsPgpId& ownerNode, RsReputations::ReputationInfo& info, bool stamp)
|
||||
{
|
||||
if(gxsid.isNull())
|
||||
|
|
|
@ -115,7 +115,7 @@ public:
|
|||
|
||||
virtual bool isNodeBanned(const RsPgpId& id);
|
||||
virtual void banNode(const RsPgpId& id,bool b) ;
|
||||
virtual ReputationLevel overallReputationLevel(const RsGxsId& id);
|
||||
virtual ReputationLevel overallReputationLevel(const RsGxsId& id,uint32_t *identity_flags=NULL);
|
||||
|
||||
virtual void setNodeAutoPositiveOpinionForContacts(bool b) ;
|
||||
virtual bool nodeAutoPositiveOpinionForContacts() ;
|
||||
|
@ -143,6 +143,7 @@ public:
|
|||
virtual bool loadList(std::list<RsItem*>& load) ;
|
||||
|
||||
private:
|
||||
bool getIdentityFlagsAndOwnerId(const RsGxsId& gxsid, uint32_t& identity_flags, RsPgpId &owner_id);
|
||||
|
||||
bool processIncoming();
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue