mirror of
https://github.com/RetroShare/RetroShare.git
synced 2024-10-01 02:35:48 -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
@ -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
|
||||
};
|
||||
|
@ -315,7 +315,7 @@ void mark_circle_item(QTreeWidgetItem *item, const std::set<RsPgpId> &names)
|
||||
std::set<RsPgpId>::iterator it;
|
||||
for(it = names.begin(); it != names.end(); ++it)
|
||||
{
|
||||
if (details.mAllowedSignedPeers.end() != details.mAllowedSignedPeers.find(*it))
|
||||
if (details.mAllowedNodes.end() != details.mAllowedNodes.find(*it))
|
||||
{
|
||||
set_item_background(item, GREEN_BACKGROUND);
|
||||
std::cerr << "CirclesDialog mark_circle_item: found match: " << id;
|
||||
@ -387,15 +387,7 @@ void CirclesDialog::circle_selected()
|
||||
if (rsGxsCircles->getCircleDetails(id, details))
|
||||
{
|
||||
/* now mark all the members */
|
||||
std::set<RsPgpId> members;
|
||||
for( std::map<RsPgpId, std::set<RsGxsId> >::iterator it = details.mAllowedSignedPeers.begin(); it != details.mAllowedSignedPeers.end(); ++it)
|
||||
{
|
||||
members.insert(it->first);
|
||||
std::cerr << "Circle member: " << it->first;
|
||||
std::cerr << std::endl;
|
||||
}
|
||||
|
||||
mark_matching_tree(ui.treeWidget_friends, members, CIRCLEGROUP_FRIEND_COL_ID, GREEN_BACKGROUND);
|
||||
mark_matching_tree(ui.treeWidget_friends, details.mAllowedNodes, CIRCLEGROUP_FRIEND_COL_ID, GREEN_BACKGROUND);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -300,8 +300,8 @@ void CreateCircleDialog::addMember(const QString& keyId, const QString& idtype,
|
||||
void CreateCircleDialog::addCircle(const RsGxsCircleDetails &cirDetails)
|
||||
{
|
||||
typedef std::set<RsGxsId>::iterator itUnknownPeers;
|
||||
for (itUnknownPeers it = cirDetails.mAllowedAnonPeers.begin()
|
||||
; it != cirDetails.mAllowedAnonPeers.end()
|
||||
for (itUnknownPeers it = cirDetails.mAllowedGxsIds.begin()
|
||||
; it != cirDetails.mAllowedGxsIds.end()
|
||||
; ++it) {
|
||||
RsGxsId gxs_id = *it;
|
||||
RsIdentityDetails gxs_details ;
|
||||
@ -316,10 +316,10 @@ void CreateCircleDialog::addCircle(const RsGxsCircleDetails &cirDetails)
|
||||
}//if(!gxs_id.isNull() && rsIdentity->getIdDetails(gxs_id,gxs_details))
|
||||
}//for (itUnknownPeers it = cirDetails.mUnknownPeers.begin()
|
||||
|
||||
typedef std::map<RsPgpId, std::set<RsGxsId> >::const_iterator itAllowedPeers;
|
||||
for (itAllowedPeers it = cirDetails.mAllowedSignedPeers.begin() ; it != cirDetails.mAllowedSignedPeers.end() ; ++it )
|
||||
typedef std::set<RsPgpId>::const_iterator itAllowedPeers;
|
||||
for (itAllowedPeers it = cirDetails.mAllowedNodes.begin() ; it != cirDetails.mAllowedNodes.end() ; ++it )
|
||||
{
|
||||
RsPgpId gpg_id = it->first;
|
||||
RsPgpId gpg_id = *it;
|
||||
RsPeerDetails details ;
|
||||
if(!gpg_id.isNull() && rsPeers->getGPGDetails(gpg_id,details)) {
|
||||
|
||||
|
@ -501,13 +501,10 @@ void IdDialog::loadCircleGroupMeta(const uint32_t &token)
|
||||
item->setFont(CIRCLEGROUP_CIRCLE_COL_GROUPFLAGS,font) ;
|
||||
}
|
||||
|
||||
|
||||
#ifdef ID_DEBUG
|
||||
if (subscribed)
|
||||
item->setIcon(CIRCLEGROUP_CIRCLE_COL_GROUPNAME,QIcon(":icons/bullet_green_128.png")) ;
|
||||
else
|
||||
item->setIcon(CIRCLEGROUP_CIRCLE_COL_GROUPNAME,QIcon(":icons/bullet_yellow_128.png")) ;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -38,6 +38,17 @@ CircleWidget::~CircleWidget()
|
||||
delete ui;
|
||||
}
|
||||
|
||||
static bool same_RsGxsCircleDetails(const RsGxsCircleDetails& d1,const RsGxsCircleDetails& d2)
|
||||
{
|
||||
return ( d1.mCircleId == d2.mCircleId
|
||||
&& d1.mCircleName == d2.mCircleName
|
||||
&& d1.mCircleType == d2.mCircleType
|
||||
&& d1.mIsExternal == d2.mIsExternal
|
||||
&& d1.mAllowedGxsIds== d2.mAllowedGxsIds
|
||||
&& d1.mAllowedNodes == d2.mAllowedNodes
|
||||
);
|
||||
}
|
||||
|
||||
void CircleWidget::updateData(const RsGroupMetaData& gxs_group_info
|
||||
, const RsGxsCircleDetails& details)
|
||||
{
|
||||
@ -49,40 +60,40 @@ void CircleWidget::updateData(const RsGroupMetaData& gxs_group_info
|
||||
ui->label->setText(m_myName);
|
||||
ui->label->setToolTip(m_myName);
|
||||
update();
|
||||
//}//if (_group_info != gxs_group_info)
|
||||
//}
|
||||
|
||||
if (_circle_details != details) {
|
||||
if(!same_RsGxsCircleDetails(_circle_details , details))
|
||||
{
|
||||
_circle_details=details;
|
||||
typedef std::set<RsGxsId>::iterator itUnknownPeers;
|
||||
for (itUnknownPeers it = _circle_details.mAllowedAnonPeers.begin()
|
||||
; it != _circle_details.mAllowedAnonPeers.end()
|
||||
for (itUnknownPeers it = _circle_details.mAllowedGxsIds.begin()
|
||||
; it != _circle_details.mAllowedGxsIds.end()
|
||||
; ++it) {
|
||||
RsGxsId gxs_id = *it;
|
||||
if(!gxs_id.isNull()) {
|
||||
emit askForGXSIdentityWidget(gxs_id);
|
||||
}//if(!gxs_id.isNull())
|
||||
}//for (itUnknownPeers it = _circle_details.mUnknownPeers.begin()
|
||||
}
|
||||
}
|
||||
|
||||
typedef std::map<RsPgpId, std::set<RsGxsId> >::const_iterator itAllowedPeers;
|
||||
for (itAllowedPeers it = _circle_details.mAllowedSignedPeers.begin() ; it != _circle_details.mAllowedSignedPeers.end() ; ++it )
|
||||
typedef std::set<RsPgpId>::const_iterator itAllowedPeers;
|
||||
for (itAllowedPeers it = _circle_details.mAllowedNodes.begin() ; it != _circle_details.mAllowedNodes.end() ; ++it )
|
||||
{
|
||||
RsPgpId pgp_id = it->first;
|
||||
RsPgpId pgp_id = *it;
|
||||
emit askForPGPIdentityWidget(pgp_id);
|
||||
|
||||
std::set<RsGxsId> gxs_id_list = it->second;
|
||||
typedef std::set<RsGxsId>::const_iterator itGxsId;
|
||||
for (itGxsId curs=gxs_id_list.begin()
|
||||
; curs != gxs_id_list.end()
|
||||
; ++curs) {
|
||||
RsGxsId gxs_id = *curs;
|
||||
if(!gxs_id.isNull()) {
|
||||
emit askForGXSIdentityWidget(gxs_id);
|
||||
}//if(!gxs_id.isNull())
|
||||
}//for (itGxsId curs=gxs_id_list.begin()
|
||||
}//for (itAllowedPeers it = _circle_details.mAllowedPeers.begin()
|
||||
// std::set<RsGxsId> gxs_id_list = it->second;
|
||||
// typedef std::set<RsGxsId>::const_iterator itGxsId;
|
||||
// for (itGxsId curs=gxs_id_list.begin(); curs != gxs_id_list.end(); ++curs)
|
||||
// {
|
||||
// RsGxsId gxs_id = *curs;
|
||||
// if(!gxs_id.isNull())
|
||||
// emit askForGXSIdentityWidget(gxs_id);
|
||||
// }
|
||||
// }
|
||||
}
|
||||
|
||||
update();
|
||||
}//if (details!=_circle_details)
|
||||
}
|
||||
}
|
||||
|
||||
QSize CircleWidget::sizeHint()
|
||||
|
@ -441,7 +441,7 @@ void GxsGroupDialog::updateFromExistingMeta(const QString &description)
|
||||
|
||||
switch(mGrpMeta.mCircleType)
|
||||
{
|
||||
case GXS_CIRCLE_TYPE_YOUREYESONLY:
|
||||
case GXS_CIRCLE_TYPE_YOUR_FRIENDS_ONLY:
|
||||
ui.typeLocal->setChecked(true);
|
||||
distribution_string = tr("Your friends only") ;
|
||||
ui.localComboBox->loadCircles(GXS_CIRCLE_CHOOSER_PERSONAL, mGrpMeta.mInternalCircle);
|
||||
@ -740,7 +740,7 @@ bool GxsGroupDialog::setCircleParameters(RsGroupMetaData &meta)
|
||||
}
|
||||
else if (ui.typeLocal->isChecked())
|
||||
{
|
||||
meta.mCircleType = GXS_CIRCLE_TYPE_YOUREYESONLY;
|
||||
meta.mCircleType = GXS_CIRCLE_TYPE_YOUR_FRIENDS_ONLY;
|
||||
meta.mCircleId.clear();
|
||||
meta.mOriginator.clear();
|
||||
meta.mInternalCircle.clear() ;
|
||||
|
@ -817,7 +817,7 @@ void GxsForumThreadWidget::insertGroupData()
|
||||
distrib_string = tr("Restricted to members of circle ")+QString::fromStdString(group.mMeta.mCircleId.toStdString()) ;
|
||||
}
|
||||
break ;
|
||||
case GXS_CIRCLE_TYPE_YOUREYESONLY: distrib_string = tr("Your eyes only");
|
||||
case GXS_CIRCLE_TYPE_YOUR_FRIENDS_ONLY: distrib_string = tr("Your eyes only");
|
||||
break ;
|
||||
case GXS_CIRCLE_TYPE_LOCAL: distrib_string = tr("You and your friend nodes");
|
||||
break ;
|
||||
|
@ -214,7 +214,7 @@ bool GxsPeerNode::createIdentity(const std::string &name,
|
||||
|
||||
switch(circleType)
|
||||
{
|
||||
case GXS_CIRCLE_TYPE_YOUREYESONLY:
|
||||
case GXS_CIRCLE_TYPE_YOUR_FRIENDS_ONLY:
|
||||
id.mMeta.mInternalCircle = circleId;
|
||||
break;
|
||||
case GXS_CIRCLE_TYPE_LOCAL:
|
||||
@ -283,7 +283,7 @@ bool GxsPeerNode::createCircle(const std::string &name,
|
||||
// THIS is for LOCAL Storage....
|
||||
grp1.mLocalFriends = localMembers;
|
||||
break;
|
||||
case GXS_CIRCLE_TYPE_YOUREYESONLY:
|
||||
case GXS_CIRCLE_TYPE_YOUR_FRIENDS_ONLY:
|
||||
// Circle shouldn't use this.
|
||||
// but could potentially.
|
||||
grp1.mMeta.mInternalCircle = circleId;
|
||||
@ -343,7 +343,7 @@ bool GxsPeerNode::createGroup(const std::string &name,
|
||||
|
||||
switch(circleType)
|
||||
{
|
||||
case GXS_CIRCLE_TYPE_YOUREYESONLY:
|
||||
case GXS_CIRCLE_TYPE_YOUR_FRIENDS_ONLY:
|
||||
grp1.mMeta.mInternalCircle = circleId;
|
||||
break;
|
||||
case GXS_CIRCLE_TYPE_LOCAL:
|
||||
|
Loading…
Reference in New Issue
Block a user