mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-05-03 22:55:04 -04:00
cleaned the mess in Circles, due to mixing up GxsIds and PgpIds, which is now irrelevant because items for external circles are not sent based on PGP signatures anymore
This commit is contained in:
parent
c14c240f07
commit
34bd998c8e
12 changed files with 178 additions and 238 deletions
|
@ -2957,7 +2957,7 @@ void RsGenExchange::performUpdateValidation()
|
|||
|
||||
if(gu.validUpdate)
|
||||
{
|
||||
if(gu.newGrp->metaData->mCircleType == GXS_CIRCLE_TYPE_YOUREYESONLY)
|
||||
if(gu.newGrp->metaData->mCircleType == GXS_CIRCLE_TYPE_YOUR_FRIENDS_ONLY)
|
||||
gu.newGrp->metaData->mOriginator = gu.newGrp->PeerId();
|
||||
|
||||
// Keep subscriptionflag to what it was. This avoids clearing off the flag when updates to group meta information
|
||||
|
|
|
@ -4152,7 +4152,7 @@ bool RsGxsNetService::canSendGrpId(const RsPeerId& sslId, RsGxsGrpMetaData& grpM
|
|||
#endif
|
||||
}
|
||||
|
||||
if(circleType == GXS_CIRCLE_TYPE_YOUREYESONLY)
|
||||
if(circleType == GXS_CIRCLE_TYPE_YOUR_FRIENDS_ONLY)
|
||||
{
|
||||
#ifdef NXS_NET_DEBUG_4
|
||||
GXSNETDEBUG_PG(sslId,grpMeta.mGroupId)<< " YOUREYESONLY, checking further"<< std::endl;
|
||||
|
@ -4216,125 +4216,125 @@ bool RsGxsNetService::canSendGrpId(const RsPeerId& sslId, RsGxsGrpMetaData& grpM
|
|||
return true;
|
||||
}
|
||||
|
||||
bool RsGxsNetService::checkCanRecvMsgFromPeer(const RsPeerId& sslId, const RsGxsGrpMetaData& grpMeta, RsGxsCircleId &should_encrypt_id)
|
||||
bool RsGxsNetService::checkCanRecvMsgFromPeer(const RsPeerId& sslId, const RsGxsGrpMetaData& grpMeta, RsGxsCircleId& should_encrypt_id)
|
||||
{
|
||||
|
||||
#ifdef NXS_NET_DEBUG_4
|
||||
GXSNETDEBUG_PG(sslId,grpMeta.mGroupId) << "RsGxsNetService::checkCanRecvMsgFromPeer()";
|
||||
GXSNETDEBUG_PG(sslId,grpMeta.mGroupId) << " peer Id = " << sslId << ", grpId=" << grpMeta.mGroupId <<std::endl;
|
||||
#endif
|
||||
// first do the simple checks
|
||||
uint8_t circleType = grpMeta.mCircleType;
|
||||
should_encrypt_id.clear() ;
|
||||
#ifdef NXS_NET_DEBUG_4
|
||||
GXSNETDEBUG_PG(sslId,grpMeta.mGroupId) << "RsGxsNetService::checkCanRecvMsgFromPeer()";
|
||||
GXSNETDEBUG_PG(sslId,grpMeta.mGroupId) << " peer Id = " << sslId << ", grpId=" << grpMeta.mGroupId <<std::endl;
|
||||
#endif
|
||||
// first do the simple checks
|
||||
uint8_t circleType = grpMeta.mCircleType;
|
||||
should_encrypt_id.clear() ;
|
||||
|
||||
if(circleType == GXS_CIRCLE_TYPE_LOCAL)
|
||||
if(circleType == GXS_CIRCLE_TYPE_LOCAL)
|
||||
{
|
||||
#ifdef NXS_NET_DEBUG_4
|
||||
GXSNETDEBUG_PG(sslId,grpMeta.mGroupId) << " LOCAL_CIRCLE, cannot request sync from peer" << std::endl;
|
||||
#endif
|
||||
return false;
|
||||
}
|
||||
|
||||
if(circleType == GXS_CIRCLE_TYPE_PUBLIC)
|
||||
{
|
||||
#ifdef NXS_NET_DEBUG_4
|
||||
GXSNETDEBUG_PG(sslId,grpMeta.mGroupId) << " PUBLIC_CIRCLE, can request msg sync" << std::endl;
|
||||
#endif
|
||||
return true;
|
||||
}
|
||||
|
||||
if(circleType == GXS_CIRCLE_TYPE_EXTERNAL)
|
||||
{
|
||||
#ifdef NXS_NET_DEBUG_4
|
||||
GXSNETDEBUG_PG(sslId,grpMeta.mGroupId) << " Circle type: EXTERNAL => returning true. Msgs will be encrypted." << std::endl;
|
||||
#endif
|
||||
should_encrypt_id = grpMeta.mCircleId ;
|
||||
return true ;
|
||||
#ifdef TO_BE_REMOVED_OLD_VETTING_FOR_EXTERNAL_CIRCLES
|
||||
const RsGxsCircleId& circleId = grpMeta.mCircleId;
|
||||
if(circleId.isNull())
|
||||
{
|
||||
#ifdef NXS_NET_DEBUG_4
|
||||
GXSNETDEBUG_PG(sslId,grpMeta.mGroupId) << " LOCAL_CIRCLE, cannot request sync from peer" << std::endl;
|
||||
#endif
|
||||
return false;
|
||||
#ifdef NXS_NET_DEBUG_0
|
||||
GXSNETDEBUG_PG(sslId,grpMeta.mGroupId) << " ERROR; EXTERNAL_CIRCLE missing NULL CircleId";
|
||||
GXSNETDEBUG_PG(sslId,grpMeta.mGroupId) << grpMeta.mGroupId;
|
||||
GXSNETDEBUG_PG(sslId,grpMeta.mGroupId) << std::endl;
|
||||
#endif
|
||||
|
||||
// should just be shared. ? no - this happens for
|
||||
// Circle Groups which lose their CircleIds.
|
||||
// return true;
|
||||
}
|
||||
|
||||
if(circleType == GXS_CIRCLE_TYPE_PUBLIC)
|
||||
{
|
||||
#ifdef NXS_NET_DEBUG_4
|
||||
GXSNETDEBUG_PG(sslId,grpMeta.mGroupId) << " PUBLIC_CIRCLE, can request msg sync" << std::endl;
|
||||
#endif
|
||||
return true;
|
||||
}
|
||||
|
||||
if(circleType == GXS_CIRCLE_TYPE_EXTERNAL)
|
||||
if(mCircles->isLoaded(circleId))
|
||||
{
|
||||
#ifdef NXS_NET_DEBUG_4
|
||||
GXSNETDEBUG_PG(sslId,grpMeta.mGroupId) << " Circle type: EXTERNAL => returning true. Msgs will be encrypted." << std::endl;
|
||||
GXSNETDEBUG_PG(sslId,grpMeta.mGroupId) << " EXTERNAL_CIRCLE, checking mCircles->canSend" << std::endl;
|
||||
#endif
|
||||
should_encrypt_id = grpMeta.mCircleId ;
|
||||
return true ;
|
||||
#ifdef TO_BE_REMOVED_OLD_VETTING_FOR_EXTERNAL_CIRCLES
|
||||
const RsGxsCircleId& circleId = grpMeta.mCircleId;
|
||||
if(circleId.isNull())
|
||||
{
|
||||
#ifdef NXS_NET_DEBUG_0
|
||||
GXSNETDEBUG_PG(sslId,grpMeta.mGroupId) << " ERROR; EXTERNAL_CIRCLE missing NULL CircleId";
|
||||
GXSNETDEBUG_PG(sslId,grpMeta.mGroupId) << grpMeta.mGroupId;
|
||||
GXSNETDEBUG_PG(sslId,grpMeta.mGroupId) << std::endl;
|
||||
const RsPgpId& pgpId = mPgpUtils->getPGPId(sslId);
|
||||
return mCircles->canSend(circleId, pgpId);
|
||||
}
|
||||
else
|
||||
mCircles->loadCircle(circleId); // simply request for next pass
|
||||
|
||||
return false;
|
||||
#endif
|
||||
}
|
||||
|
||||
if(circleType == GXS_CIRCLE_TYPE_YOUR_FRIENDS_ONLY) // do not attempt to sync msg unless to originator or those permitted
|
||||
{
|
||||
#ifdef NXS_NET_DEBUG_4
|
||||
GXSNETDEBUG_PG(sslId,grpMeta.mGroupId) << " YOUREYESONLY, checking further" << std::endl;
|
||||
#endif
|
||||
// a non empty internal circle id means this
|
||||
// is the personal circle owner
|
||||
if(!grpMeta.mInternalCircle.isNull())
|
||||
{
|
||||
const RsGxsCircleId& internalCircleId = grpMeta.mInternalCircle;
|
||||
#ifdef NXS_NET_DEBUG_4
|
||||
GXSNETDEBUG_PG(sslId,grpMeta.mGroupId) << " have mInternalCircle - we are Group creator" << std::endl;
|
||||
GXSNETDEBUG_PG(sslId,grpMeta.mGroupId) << " mCircleId: " << grpMeta.mCircleId << std::endl;
|
||||
GXSNETDEBUG_PG(sslId,grpMeta.mGroupId) << " mInternalCircle: " << grpMeta.mInternalCircle << std::endl;
|
||||
#endif
|
||||
|
||||
// should just be shared. ? no - this happens for
|
||||
// Circle Groups which lose their CircleIds.
|
||||
// return true;
|
||||
}
|
||||
|
||||
if(mCircles->isLoaded(circleId))
|
||||
if(mCircles->isLoaded(internalCircleId))
|
||||
{
|
||||
#ifdef NXS_NET_DEBUG_4
|
||||
GXSNETDEBUG_PG(sslId,grpMeta.mGroupId) << " EXTERNAL_CIRCLE, checking mCircles->canSend" << std::endl;
|
||||
#endif
|
||||
#ifdef NXS_NET_DEBUG_4
|
||||
GXSNETDEBUG_PG(sslId,grpMeta.mGroupId) << " circle Loaded - checking mCircles->canSend" << std::endl;
|
||||
#endif
|
||||
const RsPgpId& pgpId = mPgpUtils->getPGPId(sslId);
|
||||
return mCircles->canSend(circleId, pgpId);
|
||||
bool should_encrypt ;
|
||||
return mCircles->canSend(internalCircleId, pgpId,should_encrypt);
|
||||
}
|
||||
else
|
||||
mCircles->loadCircle(circleId); // simply request for next pass
|
||||
mCircles->loadCircle(internalCircleId); // request for next pass
|
||||
|
||||
return false;
|
||||
#endif
|
||||
}
|
||||
|
||||
if(circleType == GXS_CIRCLE_TYPE_YOUREYESONLY) // do not attempt to sync msg unless to originator or those permitted
|
||||
else
|
||||
{
|
||||
#ifdef NXS_NET_DEBUG_4
|
||||
GXSNETDEBUG_PG(sslId,grpMeta.mGroupId) << " YOUREYESONLY, checking further" << std::endl;
|
||||
#endif
|
||||
// a non empty internal circle id means this
|
||||
// is the personal circle owner
|
||||
if(!grpMeta.mInternalCircle.isNull())
|
||||
// an empty internal circle id means this peer can only
|
||||
// send circle related info from peer he received it
|
||||
#ifdef NXS_NET_DEBUG_4
|
||||
GXSNETDEBUG_PG(sslId,grpMeta.mGroupId) << " mInternalCircle not set, someone else's personal circle" << std::endl;
|
||||
#endif
|
||||
if(grpMeta.mOriginator == sslId)
|
||||
{
|
||||
const RsGxsCircleId& internalCircleId = grpMeta.mInternalCircle;
|
||||
#ifdef NXS_NET_DEBUG_4
|
||||
GXSNETDEBUG_PG(sslId,grpMeta.mGroupId) << " have mInternalCircle - we are Group creator" << std::endl;
|
||||
GXSNETDEBUG_PG(sslId,grpMeta.mGroupId) << " mCircleId: " << grpMeta.mCircleId << std::endl;
|
||||
GXSNETDEBUG_PG(sslId,grpMeta.mGroupId) << " mInternalCircle: " << grpMeta.mInternalCircle << std::endl;
|
||||
#endif
|
||||
|
||||
if(mCircles->isLoaded(internalCircleId))
|
||||
{
|
||||
#ifdef NXS_NET_DEBUG_4
|
||||
GXSNETDEBUG_PG(sslId,grpMeta.mGroupId) << " circle Loaded - checking mCircles->canSend" << std::endl;
|
||||
#endif
|
||||
const RsPgpId& pgpId = mPgpUtils->getPGPId(sslId);
|
||||
bool should_encrypt ;
|
||||
return mCircles->canSend(internalCircleId, pgpId,should_encrypt);
|
||||
}
|
||||
else
|
||||
mCircles->loadCircle(internalCircleId); // request for next pass
|
||||
|
||||
return false;
|
||||
#ifdef NXS_NET_DEBUG_4
|
||||
GXSNETDEBUG_PG(sslId,grpMeta.mGroupId) << " Originator matches -> can send" << std::endl;
|
||||
#endif
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
// an empty internal circle id means this peer can only
|
||||
// send circle related info from peer he received it
|
||||
#ifdef NXS_NET_DEBUG_4
|
||||
GXSNETDEBUG_PG(sslId,grpMeta.mGroupId) << " mInternalCircle not set, someone else's personal circle" << std::endl;
|
||||
#endif
|
||||
if(grpMeta.mOriginator == sslId)
|
||||
{
|
||||
#ifdef NXS_NET_DEBUG_4
|
||||
GXSNETDEBUG_PG(sslId,grpMeta.mGroupId) << " Originator matches -> can send" << std::endl;
|
||||
#endif
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
#ifdef NXS_NET_DEBUG_4
|
||||
GXSNETDEBUG_PG(sslId,grpMeta.mGroupId) << " Originator doesn't match -> cannot send"<< std::endl;
|
||||
#endif
|
||||
return false;
|
||||
}
|
||||
#ifdef NXS_NET_DEBUG_4
|
||||
GXSNETDEBUG_PG(sslId,grpMeta.mGroupId) << " Originator doesn't match -> cannot send"<< std::endl;
|
||||
#endif
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
return true;
|
||||
}
|
||||
|
||||
bool RsGxsNetService::locked_CanReceiveUpdate(const RsNxsSyncMsgReqItem *item)
|
||||
|
@ -4639,7 +4639,7 @@ bool RsGxsNetService::canSendMsgIds(std::vector<RsGxsMsgMetaData*>& msgMetas, co
|
|||
return true ;
|
||||
}
|
||||
|
||||
if(circleType == GXS_CIRCLE_TYPE_YOUREYESONLY)
|
||||
if(circleType == GXS_CIRCLE_TYPE_YOUR_FRIENDS_ONLY)
|
||||
{
|
||||
#ifdef NXS_NET_DEBUG_4
|
||||
GXSNETDEBUG_PG(sslId,grpMeta.mGroupId) << " Circle type: YOUR EYES ONLY" << std::endl;
|
||||
|
|
|
@ -48,18 +48,18 @@ class RsGxsCircles;
|
|||
extern RsGxsCircles *rsGxsCircles;
|
||||
|
||||
typedef RsPgpId RsPgpId;
|
||||
//typedef RsGxsCircleId RsCircleInternalId;
|
||||
|
||||
#define GXS_CIRCLE_TYPE_PUBLIC 0x0001
|
||||
#define GXS_CIRCLE_TYPE_EXTERNAL 0x0002
|
||||
#define GXS_CIRCLE_TYPE_YOUREYESONLY 0x0003
|
||||
#define GXS_CIRCLE_TYPE_LOCAL 0x0004
|
||||
// The meaning of the different circle types is:
|
||||
//
|
||||
//
|
||||
static const uint32_t GXS_CIRCLE_TYPE_PUBLIC = 0x0001 ; // not restricted to a circle
|
||||
static const uint32_t GXS_CIRCLE_TYPE_EXTERNAL = 0x0002 ; // restricted to an external circle, made of RsGxsId
|
||||
static const uint32_t GXS_CIRCLE_TYPE_YOUR_FRIENDS_ONLY = 0x0003 ; // restricted to a subset of friend nodes of a given RS node given by a RsPgpId list
|
||||
static const uint32_t GXS_CIRCLE_TYPE_LOCAL = 0x0004 ; // not distributed at all
|
||||
static const uint32_t GXS_CIRCLE_TYPE_EXT_SELF = 0x0005 ; // self-restricted. Not used, except at creation time when the circle ID isn't known yet. Set to EXTERNAL afterwards.
|
||||
static const uint32_t GXS_CIRCLE_TYPE_YOUR_EYES_ONLY = 0x0006 ; // distributed to nodes signed by your own PGP key only.
|
||||
|
||||
// A special one - used only by Circles themselves - meaning Circle ID == Group ID.
|
||||
#define GXS_CIRCLE_TYPE_EXT_SELF 0x0005
|
||||
|
||||
/* Permissions is part of GroupMetaData
|
||||
*/
|
||||
/* Permissions is part of GroupMetaData */
|
||||
|
||||
class GxsPermissions
|
||||
{
|
||||
|
@ -109,13 +109,14 @@ class RsGxsCircleDetails
|
|||
bool mIsExternal;
|
||||
bool mAmIAllowed ;
|
||||
|
||||
#ifdef TO_REMOVE
|
||||
bool operator ==(const RsGxsCircleDetails& rGxsDetails) {
|
||||
return ( mCircleId == rGxsDetails.mCircleId
|
||||
&& mCircleName == rGxsDetails.mCircleName
|
||||
&& mCircleType == rGxsDetails.mCircleType
|
||||
&& mIsExternal == rGxsDetails.mIsExternal
|
||||
&& mAllowedAnonPeers == rGxsDetails.mAllowedAnonPeers
|
||||
&& mAllowedSignedPeers == rGxsDetails.mAllowedSignedPeers
|
||||
&& mAllowedGxsIds == rGxsDetails.mAllowedGxsIds
|
||||
&& mAllowedNodes == rGxsDetails.mAllowedNodes
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -124,13 +125,14 @@ class RsGxsCircleDetails
|
|||
|| mCircleName != rGxsDetails.mCircleName
|
||||
|| mCircleType != rGxsDetails.mCircleType
|
||||
|| mIsExternal != rGxsDetails.mIsExternal
|
||||
|| mAllowedAnonPeers != rGxsDetails.mAllowedAnonPeers
|
||||
|| mAllowedSignedPeers != rGxsDetails.mAllowedSignedPeers
|
||||
|| mAllowedGxsIds != rGxsDetails.mAllowedGxsIds
|
||||
|| mAllowedNodes != rGxsDetails.mAllowedNodes
|
||||
);
|
||||
}
|
||||
#endif
|
||||
|
||||
std::set<RsGxsId> mAllowedAnonPeers;
|
||||
std::map<RsPgpId, std::set<RsGxsId> > mAllowedSignedPeers;
|
||||
std::set<RsGxsId> mAllowedGxsIds;
|
||||
std::set<RsPgpId> mAllowedNodes;
|
||||
};
|
||||
|
||||
class RsGxsCircles: public RsGxsIfaceHelper
|
||||
|
|
|
@ -268,8 +268,8 @@ bool p3GxsCircles:: getCircleDetails(const RsGxsCircleId &id, RsGxsCircleDetails
|
|||
details.mCircleType = data.mCircleType;
|
||||
details.mIsExternal = data.mIsExternal;
|
||||
|
||||
details.mAllowedAnonPeers = data.mAllowedAnonPeers;
|
||||
details.mAllowedSignedPeers = data.mAllowedSignedPeers;
|
||||
details.mAllowedGxsIds = data.mAllowedGxsIds;
|
||||
details.mAllowedNodes = data.mAllowedNodes;
|
||||
|
||||
details.mAmIAllowed = data.mAmIAllowed ;
|
||||
return true;
|
||||
|
@ -409,13 +409,9 @@ bool p3GxsCircles::recipients(const RsGxsCircleId& circleId, std::list<RsGxsId>&
|
|||
if(!getCircleDetails(circleId, details))
|
||||
return false;
|
||||
|
||||
for(std::set<RsGxsId>::const_iterator it(details.mAllowedAnonPeers.begin());it!=details.mAllowedAnonPeers.end();++it)
|
||||
for(std::set<RsGxsId>::const_iterator it(details.mAllowedGxsIds.begin());it!=details.mAllowedGxsIds.end();++it)
|
||||
gxs_ids.push_back(*it) ;
|
||||
|
||||
for(std::map<RsPgpId,std::set<RsGxsId> >::const_iterator it(details.mAllowedSignedPeers.begin());it!=details.mAllowedSignedPeers.end();++it)
|
||||
for(std::set<RsGxsId>::const_iterator it2(it->second.begin());it2!=it->second.end();++it2)
|
||||
gxs_ids.push_back(*it2) ;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -574,53 +570,36 @@ bool RsGxsCircleCache::loadSubCircle(const RsGxsCircleCache &subcircle)
|
|||
return true;
|
||||
}
|
||||
|
||||
bool RsGxsCircleCache::getAllowedPeersList(std::list<RsPgpId> &friendlist) const
|
||||
bool RsGxsCircleCache::getAllowedPeersList(std::list<RsPgpId>& friendlist) const
|
||||
{
|
||||
std::map<RsPgpId, std::set<RsGxsId> >::const_iterator it;
|
||||
for(it = mAllowedSignedPeers.begin(); it != mAllowedSignedPeers.end(); ++it)
|
||||
{
|
||||
friendlist.push_back(it->first);
|
||||
}
|
||||
friendlist.clear() ;
|
||||
|
||||
for(std::set<RsPgpId>::const_iterator it = mAllowedNodes.begin(); it != mAllowedNodes.end(); ++it)
|
||||
friendlist.push_back(*it) ;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool RsGxsCircleCache::isAllowedPeer(const RsGxsId &id) const
|
||||
bool RsGxsCircleCache::isAllowedPeer(const RsGxsId& id) const
|
||||
{
|
||||
if(mUnprocessedPeers.find(id) != mUnprocessedPeers.end())
|
||||
return true ;
|
||||
|
||||
if(mAllowedAnonPeers.find(id) != mAllowedAnonPeers.end())
|
||||
if(mAllowedGxsIds.find(id) != mAllowedGxsIds.end())
|
||||
return true ;
|
||||
|
||||
for(std::map<RsPgpId,std::set<RsGxsId> >::const_iterator it = mAllowedSignedPeers.begin();it!=mAllowedSignedPeers.end();++it)
|
||||
if(it->second.find(id) != it->second.end())
|
||||
return true ;
|
||||
|
||||
return false ;
|
||||
}
|
||||
|
||||
bool RsGxsCircleCache::isAllowedPeer(const RsPgpId &id) const
|
||||
{
|
||||
std::map<RsPgpId, std::set<RsGxsId> >::const_iterator it = mAllowedSignedPeers.find(id);
|
||||
if (it != mAllowedSignedPeers.end())
|
||||
{
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
return mAllowedNodes.find(id) != mAllowedNodes.end() ;
|
||||
}
|
||||
|
||||
bool RsGxsCircleCache::addAllowedPeer(const RsPgpId &pgpId, const RsGxsId &gxsId)
|
||||
{
|
||||
/* created if doesn't exist */
|
||||
mAllowedSignedPeers[pgpId].insert(gxsId);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
bool RsGxsCircleCache::addLocalFriend(const RsPgpId &pgpId)
|
||||
{
|
||||
/* empty list as no GxsID associated */
|
||||
mAllowedSignedPeers.insert(std::make_pair(pgpId,std::set<RsGxsId>()));
|
||||
mAllowedNodes.insert(pgpId) ;
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -1027,33 +1006,7 @@ bool p3GxsCircles::cache_load_for_token(uint32_t token)
|
|||
|
||||
/* check cache */
|
||||
if (mIdentities->haveKey(*pit))
|
||||
{
|
||||
/* we can process now! */
|
||||
RsIdentityDetails details;
|
||||
if (mIdentities->getIdDetails(*pit, details))
|
||||
{
|
||||
if ((details.mFlags & RS_IDENTITY_FLAGS_PGP_LINKED) &&(details.mFlags & RS_IDENTITY_FLAGS_PGP_KNOWN))
|
||||
{
|
||||
#ifdef DEBUG_CIRCLES
|
||||
std::cerr << " Is Known -> AllowedPeer: " << *pit << std::endl;
|
||||
#endif
|
||||
cache.addAllowedPeer(details.mPgpId, *pit);
|
||||
}
|
||||
else
|
||||
{
|
||||
#ifdef DEBUG_CIRCLES
|
||||
std::cerr << " Is Unknown -> UnknownPeer: " << *pit << std::endl;
|
||||
#endif
|
||||
cache.mAllowedAnonPeers.insert(*pit);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
std::cerr << "p3GxsCircles::cache_load_for_token() ERROR no details: " << *pit;
|
||||
std::cerr << std::endl;
|
||||
// ERROR.
|
||||
}
|
||||
}
|
||||
cache.mAllowedGxsIds.insert(*pit);
|
||||
else
|
||||
{
|
||||
#ifdef DEBUG_CIRCLES
|
||||
|
@ -1226,27 +1179,12 @@ bool p3GxsCircles::cache_reloadids(const RsGxsCircleId &circleId)
|
|||
RsIdentityDetails details;
|
||||
if (mIdentities->getIdDetails(*pit, details))
|
||||
{
|
||||
if ((details.mFlags & RS_IDENTITY_FLAGS_PGP_LINKED) &&(details.mFlags & RS_IDENTITY_FLAGS_PGP_KNOWN))
|
||||
{
|
||||
cache.addAllowedPeer(details.mPgpId, *pit);
|
||||
|
||||
cache.mAllowedGxsIds.insert(*pit);
|
||||
#ifdef DEBUG_CIRCLES
|
||||
std::cerr << "p3GxsCircles::cache_reloadids() AllowedPeer: ";
|
||||
std::cerr << *pit;
|
||||
std::cerr << std::endl;
|
||||
#endif // DEBUG_CIRCLES
|
||||
}
|
||||
else
|
||||
{
|
||||
cache.mAllowedAnonPeers.insert(*pit);
|
||||
|
||||
#ifdef DEBUG_CIRCLES
|
||||
std::cerr << "p3GxsCircles::cache_reloadids() UnknownPeer: ";
|
||||
std::cerr << *pit;
|
||||
std::cerr << std::endl;
|
||||
#endif // DEBUG_CIRCLES
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -1333,7 +1271,7 @@ bool p3GxsCircles::checkCircleCacheForAutoSubscribe(RsGxsCircleCache &cache)
|
|||
|
||||
const RsPgpId& ownPgpId = mPgpUtils->getPGPOwnId();
|
||||
|
||||
bool am_I_allowed = cache.mAmIAllowed || (cache.mAllowedSignedPeers.find(ownPgpId) != cache.mAllowedSignedPeers.end()) ;
|
||||
bool am_I_allowed = cache.mAmIAllowed || (cache.mAllowedNodes.find(ownPgpId) != cache.mAllowedNodes.end()) ;
|
||||
|
||||
if(am_I_allowed)
|
||||
{
|
||||
|
|
|
@ -135,7 +135,7 @@ class RsGxsCircleCache
|
|||
bool getAllowedPeersList(std::list<RsPgpId> &friendlist) const;
|
||||
bool isAllowedPeer(const RsPgpId &id) const;
|
||||
bool isAllowedPeer(const RsGxsId &id) const;
|
||||
bool addAllowedPeer(const RsPgpId &pgpid, const RsGxsId &gxsId);
|
||||
bool addAllowedPeer(const RsPgpId &pgpid);
|
||||
bool addLocalFriend(const RsPgpId &pgpid);
|
||||
|
||||
RsGxsCircleId mCircleId;
|
||||
|
@ -155,8 +155,8 @@ class RsGxsCircleCache
|
|||
#endif
|
||||
std::set<RsGxsId> mUnprocessedPeers;
|
||||
|
||||
std::set<RsGxsId> mAllowedAnonPeers;
|
||||
std::map<RsPgpId, std::set<RsGxsId> > mAllowedSignedPeers;
|
||||
std::set<RsGxsId> mAllowedGxsIds;
|
||||
std::set<RsPgpId> mAllowedNodes;
|
||||
|
||||
RsPeerId mOriginator ; // peer who sent the data, in case we need to ask for ids
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue