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:
csoler 2016-04-17 17:13:42 -04:00
parent c14c240f07
commit 34bd998c8e
12 changed files with 178 additions and 238 deletions

View File

@ -2957,7 +2957,7 @@ void RsGenExchange::performUpdateValidation()
if(gu.validUpdate) 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(); 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 // Keep subscriptionflag to what it was. This avoids clearing off the flag when updates to group meta information

View File

@ -4152,7 +4152,7 @@ bool RsGxsNetService::canSendGrpId(const RsPeerId& sslId, RsGxsGrpMetaData& grpM
#endif #endif
} }
if(circleType == GXS_CIRCLE_TYPE_YOUREYESONLY) if(circleType == GXS_CIRCLE_TYPE_YOUR_FRIENDS_ONLY)
{ {
#ifdef NXS_NET_DEBUG_4 #ifdef NXS_NET_DEBUG_4
GXSNETDEBUG_PG(sslId,grpMeta.mGroupId)<< " YOUREYESONLY, checking further"<< std::endl; GXSNETDEBUG_PG(sslId,grpMeta.mGroupId)<< " YOUREYESONLY, checking further"<< std::endl;
@ -4216,30 +4216,30 @@ bool RsGxsNetService::canSendGrpId(const RsPeerId& sslId, RsGxsGrpMetaData& grpM
return true; 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 #ifdef NXS_NET_DEBUG_4
GXSNETDEBUG_PG(sslId,grpMeta.mGroupId) << "RsGxsNetService::checkCanRecvMsgFromPeer()"; GXSNETDEBUG_PG(sslId,grpMeta.mGroupId) << "RsGxsNetService::checkCanRecvMsgFromPeer()";
GXSNETDEBUG_PG(sslId,grpMeta.mGroupId) << " peer Id = " << sslId << ", grpId=" << grpMeta.mGroupId <<std::endl; GXSNETDEBUG_PG(sslId,grpMeta.mGroupId) << " peer Id = " << sslId << ", grpId=" << grpMeta.mGroupId <<std::endl;
#endif #endif
// first do the simple checks // first do the simple checks
uint8_t circleType = grpMeta.mCircleType; uint8_t circleType = grpMeta.mCircleType;
should_encrypt_id.clear() ; should_encrypt_id.clear() ;
if(circleType == GXS_CIRCLE_TYPE_LOCAL) if(circleType == GXS_CIRCLE_TYPE_LOCAL)
{ {
#ifdef NXS_NET_DEBUG_4 #ifdef NXS_NET_DEBUG_4
GXSNETDEBUG_PG(sslId,grpMeta.mGroupId) << " LOCAL_CIRCLE, cannot request sync from peer" << std::endl; GXSNETDEBUG_PG(sslId,grpMeta.mGroupId) << " LOCAL_CIRCLE, cannot request sync from peer" << std::endl;
#endif #endif
return false; return false;
} }
if(circleType == GXS_CIRCLE_TYPE_PUBLIC) if(circleType == GXS_CIRCLE_TYPE_PUBLIC)
{ {
#ifdef NXS_NET_DEBUG_4 #ifdef NXS_NET_DEBUG_4
GXSNETDEBUG_PG(sslId,grpMeta.mGroupId) << " PUBLIC_CIRCLE, can request msg sync" << std::endl; GXSNETDEBUG_PG(sslId,grpMeta.mGroupId) << " PUBLIC_CIRCLE, can request msg sync" << std::endl;
#endif #endif
return true; return true;
} }
@ -4267,9 +4267,9 @@ bool RsGxsNetService::checkCanRecvMsgFromPeer(const RsPeerId& sslId, const RsGxs
if(mCircles->isLoaded(circleId)) if(mCircles->isLoaded(circleId))
{ {
#ifdef NXS_NET_DEBUG_4 #ifdef NXS_NET_DEBUG_4
GXSNETDEBUG_PG(sslId,grpMeta.mGroupId) << " EXTERNAL_CIRCLE, checking mCircles->canSend" << std::endl; GXSNETDEBUG_PG(sslId,grpMeta.mGroupId) << " EXTERNAL_CIRCLE, checking mCircles->canSend" << std::endl;
#endif #endif
const RsPgpId& pgpId = mPgpUtils->getPGPId(sslId); const RsPgpId& pgpId = mPgpUtils->getPGPId(sslId);
return mCircles->canSend(circleId, pgpId); return mCircles->canSend(circleId, pgpId);
} }
@ -4280,27 +4280,27 @@ bool RsGxsNetService::checkCanRecvMsgFromPeer(const RsPeerId& sslId, const RsGxs
#endif #endif
} }
if(circleType == GXS_CIRCLE_TYPE_YOUREYESONLY) // do not attempt to sync msg unless to originator or those permitted 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 #ifdef NXS_NET_DEBUG_4
GXSNETDEBUG_PG(sslId,grpMeta.mGroupId) << " YOUREYESONLY, checking further" << std::endl; GXSNETDEBUG_PG(sslId,grpMeta.mGroupId) << " YOUREYESONLY, checking further" << std::endl;
#endif #endif
// a non empty internal circle id means this // a non empty internal circle id means this
// is the personal circle owner // is the personal circle owner
if(!grpMeta.mInternalCircle.isNull()) if(!grpMeta.mInternalCircle.isNull())
{ {
const RsGxsCircleId& internalCircleId = grpMeta.mInternalCircle; const RsGxsCircleId& internalCircleId = grpMeta.mInternalCircle;
#ifdef NXS_NET_DEBUG_4 #ifdef NXS_NET_DEBUG_4
GXSNETDEBUG_PG(sslId,grpMeta.mGroupId) << " have mInternalCircle - we are Group creator" << std::endl; 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) << " mCircleId: " << grpMeta.mCircleId << std::endl;
GXSNETDEBUG_PG(sslId,grpMeta.mGroupId) << " mInternalCircle: " << grpMeta.mInternalCircle << std::endl; GXSNETDEBUG_PG(sslId,grpMeta.mGroupId) << " mInternalCircle: " << grpMeta.mInternalCircle << std::endl;
#endif #endif
if(mCircles->isLoaded(internalCircleId)) if(mCircles->isLoaded(internalCircleId))
{ {
#ifdef NXS_NET_DEBUG_4 #ifdef NXS_NET_DEBUG_4
GXSNETDEBUG_PG(sslId,grpMeta.mGroupId) << " circle Loaded - checking mCircles->canSend" << std::endl; GXSNETDEBUG_PG(sslId,grpMeta.mGroupId) << " circle Loaded - checking mCircles->canSend" << std::endl;
#endif #endif
const RsPgpId& pgpId = mPgpUtils->getPGPId(sslId); const RsPgpId& pgpId = mPgpUtils->getPGPId(sslId);
bool should_encrypt ; bool should_encrypt ;
return mCircles->canSend(internalCircleId, pgpId,should_encrypt); return mCircles->canSend(internalCircleId, pgpId,should_encrypt);
@ -4314,21 +4314,21 @@ bool RsGxsNetService::checkCanRecvMsgFromPeer(const RsPeerId& sslId, const RsGxs
{ {
// an empty internal circle id means this peer can only // an empty internal circle id means this peer can only
// send circle related info from peer he received it // send circle related info from peer he received it
#ifdef NXS_NET_DEBUG_4 #ifdef NXS_NET_DEBUG_4
GXSNETDEBUG_PG(sslId,grpMeta.mGroupId) << " mInternalCircle not set, someone else's personal circle" << std::endl; GXSNETDEBUG_PG(sslId,grpMeta.mGroupId) << " mInternalCircle not set, someone else's personal circle" << std::endl;
#endif #endif
if(grpMeta.mOriginator == sslId) if(grpMeta.mOriginator == sslId)
{ {
#ifdef NXS_NET_DEBUG_4 #ifdef NXS_NET_DEBUG_4
GXSNETDEBUG_PG(sslId,grpMeta.mGroupId) << " Originator matches -> can send" << std::endl; GXSNETDEBUG_PG(sslId,grpMeta.mGroupId) << " Originator matches -> can send" << std::endl;
#endif #endif
return true; return true;
} }
else else
{ {
#ifdef NXS_NET_DEBUG_4 #ifdef NXS_NET_DEBUG_4
GXSNETDEBUG_PG(sslId,grpMeta.mGroupId) << " Originator doesn't match -> cannot send"<< std::endl; GXSNETDEBUG_PG(sslId,grpMeta.mGroupId) << " Originator doesn't match -> cannot send"<< std::endl;
#endif #endif
return false; return false;
} }
} }
@ -4639,7 +4639,7 @@ bool RsGxsNetService::canSendMsgIds(std::vector<RsGxsMsgMetaData*>& msgMetas, co
return true ; return true ;
} }
if(circleType == GXS_CIRCLE_TYPE_YOUREYESONLY) if(circleType == GXS_CIRCLE_TYPE_YOUR_FRIENDS_ONLY)
{ {
#ifdef NXS_NET_DEBUG_4 #ifdef NXS_NET_DEBUG_4
GXSNETDEBUG_PG(sslId,grpMeta.mGroupId) << " Circle type: YOUR EYES ONLY" << std::endl; GXSNETDEBUG_PG(sslId,grpMeta.mGroupId) << " Circle type: YOUR EYES ONLY" << std::endl;

View File

@ -48,18 +48,18 @@ class RsGxsCircles;
extern RsGxsCircles *rsGxsCircles; extern RsGxsCircles *rsGxsCircles;
typedef RsPgpId RsPgpId; typedef RsPgpId RsPgpId;
//typedef RsGxsCircleId RsCircleInternalId;
#define GXS_CIRCLE_TYPE_PUBLIC 0x0001 // The meaning of the different circle types is:
#define GXS_CIRCLE_TYPE_EXTERNAL 0x0002 //
#define GXS_CIRCLE_TYPE_YOUREYESONLY 0x0003 //
#define GXS_CIRCLE_TYPE_LOCAL 0x0004 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. /* Permissions is part of GroupMetaData */
#define GXS_CIRCLE_TYPE_EXT_SELF 0x0005
/* Permissions is part of GroupMetaData
*/
class GxsPermissions class GxsPermissions
{ {
@ -109,13 +109,14 @@ class RsGxsCircleDetails
bool mIsExternal; bool mIsExternal;
bool mAmIAllowed ; bool mAmIAllowed ;
#ifdef TO_REMOVE
bool operator ==(const RsGxsCircleDetails& rGxsDetails) { bool operator ==(const RsGxsCircleDetails& rGxsDetails) {
return ( mCircleId == rGxsDetails.mCircleId return ( mCircleId == rGxsDetails.mCircleId
&& mCircleName == rGxsDetails.mCircleName && mCircleName == rGxsDetails.mCircleName
&& mCircleType == rGxsDetails.mCircleType && mCircleType == rGxsDetails.mCircleType
&& mIsExternal == rGxsDetails.mIsExternal && mIsExternal == rGxsDetails.mIsExternal
&& mAllowedAnonPeers == rGxsDetails.mAllowedAnonPeers && mAllowedGxsIds == rGxsDetails.mAllowedGxsIds
&& mAllowedSignedPeers == rGxsDetails.mAllowedSignedPeers && mAllowedNodes == rGxsDetails.mAllowedNodes
); );
} }
@ -124,13 +125,14 @@ class RsGxsCircleDetails
|| mCircleName != rGxsDetails.mCircleName || mCircleName != rGxsDetails.mCircleName
|| mCircleType != rGxsDetails.mCircleType || mCircleType != rGxsDetails.mCircleType
|| mIsExternal != rGxsDetails.mIsExternal || mIsExternal != rGxsDetails.mIsExternal
|| mAllowedAnonPeers != rGxsDetails.mAllowedAnonPeers || mAllowedGxsIds != rGxsDetails.mAllowedGxsIds
|| mAllowedSignedPeers != rGxsDetails.mAllowedSignedPeers || mAllowedNodes != rGxsDetails.mAllowedNodes
); );
} }
#endif
std::set<RsGxsId> mAllowedAnonPeers; std::set<RsGxsId> mAllowedGxsIds;
std::map<RsPgpId, std::set<RsGxsId> > mAllowedSignedPeers; std::set<RsPgpId> mAllowedNodes;
}; };
class RsGxsCircles: public RsGxsIfaceHelper class RsGxsCircles: public RsGxsIfaceHelper

View File

@ -268,8 +268,8 @@ bool p3GxsCircles:: getCircleDetails(const RsGxsCircleId &id, RsGxsCircleDetails
details.mCircleType = data.mCircleType; details.mCircleType = data.mCircleType;
details.mIsExternal = data.mIsExternal; details.mIsExternal = data.mIsExternal;
details.mAllowedAnonPeers = data.mAllowedAnonPeers; details.mAllowedGxsIds = data.mAllowedGxsIds;
details.mAllowedSignedPeers = data.mAllowedSignedPeers; details.mAllowedNodes = data.mAllowedNodes;
details.mAmIAllowed = data.mAmIAllowed ; details.mAmIAllowed = data.mAmIAllowed ;
return true; return true;
@ -409,13 +409,9 @@ bool p3GxsCircles::recipients(const RsGxsCircleId& circleId, std::list<RsGxsId>&
if(!getCircleDetails(circleId, details)) if(!getCircleDetails(circleId, details))
return false; 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) ; 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; return true;
} }
@ -574,26 +570,22 @@ bool RsGxsCircleCache::loadSubCircle(const RsGxsCircleCache &subcircle)
return true; 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; friendlist.clear() ;
for(it = mAllowedSignedPeers.begin(); it != mAllowedSignedPeers.end(); ++it)
{ for(std::set<RsPgpId>::const_iterator it = mAllowedNodes.begin(); it != mAllowedNodes.end(); ++it)
friendlist.push_back(it->first); friendlist.push_back(*it) ;
}
return true; return true;
} }
bool RsGxsCircleCache::isAllowedPeer(const RsGxsId &id) const bool RsGxsCircleCache::isAllowedPeer(const RsGxsId& id) const
{ {
if(mUnprocessedPeers.find(id) != mUnprocessedPeers.end()) if(mUnprocessedPeers.find(id) != mUnprocessedPeers.end())
return true ; 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 true ;
return false ; return false ;
@ -601,26 +593,13 @@ bool RsGxsCircleCache::isAllowedPeer(const RsGxsId &id) const
bool RsGxsCircleCache::isAllowedPeer(const RsPgpId &id) const bool RsGxsCircleCache::isAllowedPeer(const RsPgpId &id) const
{ {
std::map<RsPgpId, std::set<RsGxsId> >::const_iterator it = mAllowedSignedPeers.find(id); return mAllowedNodes.find(id) != mAllowedNodes.end() ;
if (it != mAllowedSignedPeers.end())
{
return true;
}
return false;
} }
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) bool RsGxsCircleCache::addLocalFriend(const RsPgpId &pgpId)
{ {
/* empty list as no GxsID associated */ /* empty list as no GxsID associated */
mAllowedSignedPeers.insert(std::make_pair(pgpId,std::set<RsGxsId>())); mAllowedNodes.insert(pgpId) ;
return true; return true;
} }
@ -1027,33 +1006,7 @@ bool p3GxsCircles::cache_load_for_token(uint32_t token)
/* check cache */ /* check cache */
if (mIdentities->haveKey(*pit)) if (mIdentities->haveKey(*pit))
{ cache.mAllowedGxsIds.insert(*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.
}
}
else else
{ {
#ifdef DEBUG_CIRCLES #ifdef DEBUG_CIRCLES
@ -1226,27 +1179,12 @@ bool p3GxsCircles::cache_reloadids(const RsGxsCircleId &circleId)
RsIdentityDetails details; RsIdentityDetails details;
if (mIdentities->getIdDetails(*pit, details)) if (mIdentities->getIdDetails(*pit, details))
{ {
if ((details.mFlags & RS_IDENTITY_FLAGS_PGP_LINKED) &&(details.mFlags & RS_IDENTITY_FLAGS_PGP_KNOWN)) cache.mAllowedGxsIds.insert(*pit);
{
cache.addAllowedPeer(details.mPgpId, *pit);
#ifdef DEBUG_CIRCLES #ifdef DEBUG_CIRCLES
std::cerr << "p3GxsCircles::cache_reloadids() AllowedPeer: "; std::cerr << "p3GxsCircles::cache_reloadids() AllowedPeer: ";
std::cerr << *pit; std::cerr << *pit;
std::cerr << std::endl; std::cerr << std::endl;
#endif // DEBUG_CIRCLES #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 else
{ {
@ -1333,7 +1271,7 @@ bool p3GxsCircles::checkCircleCacheForAutoSubscribe(RsGxsCircleCache &cache)
const RsPgpId& ownPgpId = mPgpUtils->getPGPOwnId(); 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) if(am_I_allowed)
{ {

View File

@ -135,7 +135,7 @@ class RsGxsCircleCache
bool getAllowedPeersList(std::list<RsPgpId> &friendlist) const; bool getAllowedPeersList(std::list<RsPgpId> &friendlist) const;
bool isAllowedPeer(const RsPgpId &id) const; bool isAllowedPeer(const RsPgpId &id) const;
bool isAllowedPeer(const RsGxsId &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); bool addLocalFriend(const RsPgpId &pgpid);
RsGxsCircleId mCircleId; RsGxsCircleId mCircleId;
@ -155,8 +155,8 @@ class RsGxsCircleCache
#endif #endif
std::set<RsGxsId> mUnprocessedPeers; std::set<RsGxsId> mUnprocessedPeers;
std::set<RsGxsId> mAllowedAnonPeers; std::set<RsGxsId> mAllowedGxsIds;
std::map<RsPgpId, std::set<RsGxsId> > mAllowedSignedPeers; std::set<RsPgpId> mAllowedNodes;
RsPeerId mOriginator ; // peer who sent the data, in case we need to ask for ids RsPeerId mOriginator ; // peer who sent the data, in case we need to ask for ids
}; };

View File

@ -315,7 +315,7 @@ void mark_circle_item(QTreeWidgetItem *item, const std::set<RsPgpId> &names)
std::set<RsPgpId>::iterator it; std::set<RsPgpId>::iterator it;
for(it = names.begin(); it != names.end(); ++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); set_item_background(item, GREEN_BACKGROUND);
std::cerr << "CirclesDialog mark_circle_item: found match: " << id; std::cerr << "CirclesDialog mark_circle_item: found match: " << id;
@ -387,15 +387,7 @@ void CirclesDialog::circle_selected()
if (rsGxsCircles->getCircleDetails(id, details)) if (rsGxsCircles->getCircleDetails(id, details))
{ {
/* now mark all the members */ /* now mark all the members */
std::set<RsPgpId> members; mark_matching_tree(ui.treeWidget_friends, details.mAllowedNodes, CIRCLEGROUP_FRIEND_COL_ID, GREEN_BACKGROUND);
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);
} }
else else
{ {

View File

@ -300,8 +300,8 @@ void CreateCircleDialog::addMember(const QString& keyId, const QString& idtype,
void CreateCircleDialog::addCircle(const RsGxsCircleDetails &cirDetails) void CreateCircleDialog::addCircle(const RsGxsCircleDetails &cirDetails)
{ {
typedef std::set<RsGxsId>::iterator itUnknownPeers; typedef std::set<RsGxsId>::iterator itUnknownPeers;
for (itUnknownPeers it = cirDetails.mAllowedAnonPeers.begin() for (itUnknownPeers it = cirDetails.mAllowedGxsIds.begin()
; it != cirDetails.mAllowedAnonPeers.end() ; it != cirDetails.mAllowedGxsIds.end()
; ++it) { ; ++it) {
RsGxsId gxs_id = *it; RsGxsId gxs_id = *it;
RsIdentityDetails gxs_details ; RsIdentityDetails gxs_details ;
@ -316,10 +316,10 @@ void CreateCircleDialog::addCircle(const RsGxsCircleDetails &cirDetails)
}//if(!gxs_id.isNull() && rsIdentity->getIdDetails(gxs_id,gxs_details)) }//if(!gxs_id.isNull() && rsIdentity->getIdDetails(gxs_id,gxs_details))
}//for (itUnknownPeers it = cirDetails.mUnknownPeers.begin() }//for (itUnknownPeers it = cirDetails.mUnknownPeers.begin()
typedef std::map<RsPgpId, std::set<RsGxsId> >::const_iterator itAllowedPeers; typedef std::set<RsPgpId>::const_iterator itAllowedPeers;
for (itAllowedPeers it = cirDetails.mAllowedSignedPeers.begin() ; it != cirDetails.mAllowedSignedPeers.end() ; ++it ) for (itAllowedPeers it = cirDetails.mAllowedNodes.begin() ; it != cirDetails.mAllowedNodes.end() ; ++it )
{ {
RsPgpId gpg_id = it->first; RsPgpId gpg_id = *it;
RsPeerDetails details ; RsPeerDetails details ;
if(!gpg_id.isNull() && rsPeers->getGPGDetails(gpg_id,details)) { if(!gpg_id.isNull() && rsPeers->getGPGDetails(gpg_id,details)) {

View File

@ -501,13 +501,10 @@ void IdDialog::loadCircleGroupMeta(const uint32_t &token)
item->setFont(CIRCLEGROUP_CIRCLE_COL_GROUPFLAGS,font) ; item->setFont(CIRCLEGROUP_CIRCLE_COL_GROUPFLAGS,font) ;
} }
#ifdef ID_DEBUG
if (subscribed) if (subscribed)
item->setIcon(CIRCLEGROUP_CIRCLE_COL_GROUPNAME,QIcon(":icons/bullet_green_128.png")) ; item->setIcon(CIRCLEGROUP_CIRCLE_COL_GROUPNAME,QIcon(":icons/bullet_green_128.png")) ;
else else
item->setIcon(CIRCLEGROUP_CIRCLE_COL_GROUPNAME,QIcon(":icons/bullet_yellow_128.png")) ; item->setIcon(CIRCLEGROUP_CIRCLE_COL_GROUPNAME,QIcon(":icons/bullet_yellow_128.png")) ;
#endif
} }
} }

View File

@ -38,6 +38,17 @@ CircleWidget::~CircleWidget()
delete ui; 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 void CircleWidget::updateData(const RsGroupMetaData& gxs_group_info
, const RsGxsCircleDetails& details) , const RsGxsCircleDetails& details)
{ {
@ -49,40 +60,40 @@ void CircleWidget::updateData(const RsGroupMetaData& gxs_group_info
ui->label->setText(m_myName); ui->label->setText(m_myName);
ui->label->setToolTip(m_myName); ui->label->setToolTip(m_myName);
update(); update();
//}//if (_group_info != gxs_group_info) //}
if (_circle_details != details) { if(!same_RsGxsCircleDetails(_circle_details , details))
{
_circle_details=details; _circle_details=details;
typedef std::set<RsGxsId>::iterator itUnknownPeers; typedef std::set<RsGxsId>::iterator itUnknownPeers;
for (itUnknownPeers it = _circle_details.mAllowedAnonPeers.begin() for (itUnknownPeers it = _circle_details.mAllowedGxsIds.begin()
; it != _circle_details.mAllowedAnonPeers.end() ; it != _circle_details.mAllowedGxsIds.end()
; ++it) { ; ++it) {
RsGxsId gxs_id = *it; RsGxsId gxs_id = *it;
if(!gxs_id.isNull()) { if(!gxs_id.isNull()) {
emit askForGXSIdentityWidget(gxs_id); 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; typedef std::set<RsPgpId>::const_iterator itAllowedPeers;
for (itAllowedPeers it = _circle_details.mAllowedSignedPeers.begin() ; it != _circle_details.mAllowedSignedPeers.end() ; ++it ) 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); emit askForPGPIdentityWidget(pgp_id);
std::set<RsGxsId> gxs_id_list = it->second; // std::set<RsGxsId> gxs_id_list = it->second;
typedef std::set<RsGxsId>::const_iterator itGxsId; // typedef std::set<RsGxsId>::const_iterator itGxsId;
for (itGxsId curs=gxs_id_list.begin() // for (itGxsId curs=gxs_id_list.begin(); curs != gxs_id_list.end(); ++curs)
; curs != gxs_id_list.end() // {
; ++curs) { // RsGxsId gxs_id = *curs;
RsGxsId gxs_id = *curs; // if(!gxs_id.isNull())
if(!gxs_id.isNull()) { // emit askForGXSIdentityWidget(gxs_id);
emit askForGXSIdentityWidget(gxs_id); // }
}//if(!gxs_id.isNull()) // }
}//for (itGxsId curs=gxs_id_list.begin() }
}//for (itAllowedPeers it = _circle_details.mAllowedPeers.begin()
update(); update();
}//if (details!=_circle_details) }
} }
QSize CircleWidget::sizeHint() QSize CircleWidget::sizeHint()

View File

@ -441,7 +441,7 @@ void GxsGroupDialog::updateFromExistingMeta(const QString &description)
switch(mGrpMeta.mCircleType) switch(mGrpMeta.mCircleType)
{ {
case GXS_CIRCLE_TYPE_YOUREYESONLY: case GXS_CIRCLE_TYPE_YOUR_FRIENDS_ONLY:
ui.typeLocal->setChecked(true); ui.typeLocal->setChecked(true);
distribution_string = tr("Your friends only") ; distribution_string = tr("Your friends only") ;
ui.localComboBox->loadCircles(GXS_CIRCLE_CHOOSER_PERSONAL, mGrpMeta.mInternalCircle); ui.localComboBox->loadCircles(GXS_CIRCLE_CHOOSER_PERSONAL, mGrpMeta.mInternalCircle);
@ -740,7 +740,7 @@ bool GxsGroupDialog::setCircleParameters(RsGroupMetaData &meta)
} }
else if (ui.typeLocal->isChecked()) else if (ui.typeLocal->isChecked())
{ {
meta.mCircleType = GXS_CIRCLE_TYPE_YOUREYESONLY; meta.mCircleType = GXS_CIRCLE_TYPE_YOUR_FRIENDS_ONLY;
meta.mCircleId.clear(); meta.mCircleId.clear();
meta.mOriginator.clear(); meta.mOriginator.clear();
meta.mInternalCircle.clear() ; meta.mInternalCircle.clear() ;

View File

@ -817,7 +817,7 @@ void GxsForumThreadWidget::insertGroupData()
distrib_string = tr("Restricted to members of circle ")+QString::fromStdString(group.mMeta.mCircleId.toStdString()) ; distrib_string = tr("Restricted to members of circle ")+QString::fromStdString(group.mMeta.mCircleId.toStdString()) ;
} }
break ; 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 ; break ;
case GXS_CIRCLE_TYPE_LOCAL: distrib_string = tr("You and your friend nodes"); case GXS_CIRCLE_TYPE_LOCAL: distrib_string = tr("You and your friend nodes");
break ; break ;

View File

@ -214,7 +214,7 @@ bool GxsPeerNode::createIdentity(const std::string &name,
switch(circleType) switch(circleType)
{ {
case GXS_CIRCLE_TYPE_YOUREYESONLY: case GXS_CIRCLE_TYPE_YOUR_FRIENDS_ONLY:
id.mMeta.mInternalCircle = circleId; id.mMeta.mInternalCircle = circleId;
break; break;
case GXS_CIRCLE_TYPE_LOCAL: case GXS_CIRCLE_TYPE_LOCAL:
@ -283,7 +283,7 @@ bool GxsPeerNode::createCircle(const std::string &name,
// THIS is for LOCAL Storage.... // THIS is for LOCAL Storage....
grp1.mLocalFriends = localMembers; grp1.mLocalFriends = localMembers;
break; break;
case GXS_CIRCLE_TYPE_YOUREYESONLY: case GXS_CIRCLE_TYPE_YOUR_FRIENDS_ONLY:
// Circle shouldn't use this. // Circle shouldn't use this.
// but could potentially. // but could potentially.
grp1.mMeta.mInternalCircle = circleId; grp1.mMeta.mInternalCircle = circleId;
@ -343,7 +343,7 @@ bool GxsPeerNode::createGroup(const std::string &name,
switch(circleType) switch(circleType)
{ {
case GXS_CIRCLE_TYPE_YOUREYESONLY: case GXS_CIRCLE_TYPE_YOUR_FRIENDS_ONLY:
grp1.mMeta.mInternalCircle = circleId; grp1.mMeta.mInternalCircle = circleId;
break; break;
case GXS_CIRCLE_TYPE_LOCAL: case GXS_CIRCLE_TYPE_LOCAL: