added bullets to show subscription status of circles. Enabled message sync in circles. Changed flags in GxsCirclesDetails to include new subscription flags

This commit is contained in:
csoler 2016-05-06 21:37:17 -04:00
parent 70648398e2
commit 83049259f2
10 changed files with 43 additions and 48 deletions

View File

@ -59,6 +59,12 @@ static const uint32_t GXS_CIRCLE_TYPE_LOCAL = 0x0004 ; // not distri
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_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. static const uint32_t GXS_CIRCLE_TYPE_YOUR_EYES_ONLY = 0x0006 ; // distributed to nodes signed by your own PGP key only.
static const uint32_t GXS_EXTERNAL_CIRCLE_FLAGS_IN_ADMIN_LIST = 0x0001 ;// user is validated by circle admin
static const uint32_t GXS_EXTERNAL_CIRCLE_FLAGS_SUBSCRIBED = 0x0002 ;// user has subscribed the group
static const uint32_t GXS_EXTERNAL_CIRCLE_FLAGS_ALLOWED = 0x0003 ;// user is allowed. Combines both flags above.
static const uint32_t GXS_CIRCLE_FLAGS_IS_EXTERNAL = 0x0008 ;// user is allowed
/* Permissions is part of GroupMetaData */ /* Permissions is part of GroupMetaData */
class GxsPermissions class GxsPermissions
@ -100,36 +106,15 @@ class RsGxsCircleMsg
class RsGxsCircleDetails class RsGxsCircleDetails
{ {
public: public:
RsGxsCircleDetails() : mCircleType(GXS_CIRCLE_TYPE_EXTERNAL), mIsExternal(true), mAmIAllowed(false) {} RsGxsCircleDetails() : mCircleType(GXS_CIRCLE_TYPE_EXTERNAL), mAmIAllowed(false) {}
RsGxsCircleId mCircleId; RsGxsCircleId mCircleId;
std::string mCircleName; std::string mCircleName;
uint32_t mCircleType; uint32_t mCircleType;
bool mIsExternal; uint32_t mSubscribeFlags ;
bool mAmIAllowed ;
#ifdef TO_REMOVE bool mAmIAllowed ;
bool operator ==(const RsGxsCircleDetails& rGxsDetails) {
return ( mCircleId == rGxsDetails.mCircleId
&& mCircleName == rGxsDetails.mCircleName
&& mCircleType == rGxsDetails.mCircleType
&& mIsExternal == rGxsDetails.mIsExternal
&& mAllowedGxsIds == rGxsDetails.mAllowedGxsIds
&& mAllowedNodes == rGxsDetails.mAllowedNodes
);
}
bool operator !=(const RsGxsCircleDetails& rGxsDetails) {
return ( mCircleId != rGxsDetails.mCircleId
|| mCircleName != rGxsDetails.mCircleName
|| mCircleType != rGxsDetails.mCircleType
|| mIsExternal != rGxsDetails.mIsExternal
|| mAllowedGxsIds != rGxsDetails.mAllowedGxsIds
|| mAllowedNodes != rGxsDetails.mAllowedNodes
);
}
#endif
std::set<RsGxsId> mAllowedGxsIds; std::set<RsGxsId> mAllowedGxsIds;
std::set<RsPgpId> mAllowedNodes; std::set<RsPgpId> mAllowedNodes;

View File

@ -1345,15 +1345,13 @@ int RsServer::StartupRetroShare()
mGxsCircles, mGxsCircles->getServiceInfo(), mGxsCircles, mGxsCircles->getServiceInfo(),
mGxsIdService, mGxsCircles,mGxsIdService, mGxsIdService, mGxsCircles,mGxsIdService,
pgpAuxUtils, pgpAuxUtils,
true,false); // synchronise group automatic true, // synchronise group automatic
// don't sync messages at all. true); // sync messages automatic, since they contain subscription requests.
mGxsCircles->setNetworkExchangeService(gxscircles_ns) ; mGxsCircles->setNetworkExchangeService(gxscircles_ns) ;
/**** Posted GXS service ****/ /**** Posted GXS service ****/
RsGeneralDataService* posted_ds = new RsDataService(currGxsDir + "/", "posted_db", RsGeneralDataService* posted_ds = new RsDataService(currGxsDir + "/", "posted_db",
RS_SERVICE_GXS_TYPE_POSTED, RS_SERVICE_GXS_TYPE_POSTED,
NULL, rsInitConfig->gxs_passwd); NULL, rsInitConfig->gxs_passwd);

View File

@ -266,12 +266,14 @@ bool p3GxsCircles:: getCircleDetails(const RsGxsCircleId &id, RsGxsCircleDetails
details.mCircleName = data.mCircleName; details.mCircleName = data.mCircleName;
details.mCircleType = data.mCircleType; details.mCircleType = data.mCircleType;
details.mIsExternal = data.mIsExternal;
details.mAllowedGxsIds = data.mAllowedGxsIds; details.mAllowedGxsIds = data.mAllowedGxsIds;
details.mAllowedNodes = data.mAllowedNodes; details.mAllowedNodes = data.mAllowedNodes;
details.mAmIAllowed = data.mAmIAllowed ; details.mAmIAllowed = data.mAmIAllowed ;
#warning p3GxsCircles::getCircleDetails(): make this right later when the backend is there
details.mSubscribeFlags = GXS_EXTERNAL_CIRCLE_FLAGS_IN_ADMIN_LIST ;
return true; return true;
} }
} }

View File

@ -164,12 +164,10 @@ class RsGxsCircleCache
class PgpAuxUtils; class PgpAuxUtils;
class p3GxsCircles: public RsGxsCircleExchange, public RsGxsCircles, class p3GxsCircles: public RsGxsCircleExchange, public RsGxsCircles, public GxsTokenQueue, public RsTickEvent
public GxsTokenQueue, public RsTickEvent
{ {
public: public:
p3GxsCircles(RsGeneralDataService* gds, RsNetworkExchangeService* nes, p3GxsCircles(RsGeneralDataService* gds, RsNetworkExchangeService* nes, p3IdService *identities, PgpAuxUtils *pgpUtils);
p3IdService *identities, PgpAuxUtils *pgpUtils);
virtual RsServiceInfo getServiceInfo(); virtual RsServiceInfo getServiceInfo();

View File

@ -407,7 +407,6 @@ void IdDialog::loadCircleGroupMeta(const uint32_t &token)
rsGxsCircles->getCircleDetails(RsGxsCircleId(vit->mGroupId), details) ; rsGxsCircles->getCircleDetails(RsGxsCircleId(vit->mGroupId), details) ;
bool should_re_add = true ; bool should_re_add = true ;
bool subscribed = vit->mSubscribeFlags & GXS_SERV::GROUP_SUBSCRIBE_SUBSCRIBED ;
bool am_I_in_circle = details.mAmIAllowed ; bool am_I_in_circle = details.mAmIAllowed ;
QTreeWidgetItem *item = NULL ; QTreeWidgetItem *item = NULL ;
@ -495,16 +494,28 @@ void IdDialog::loadCircleGroupMeta(const uint32_t &token)
item->setFont(CIRCLEGROUP_CIRCLE_COL_GROUPFLAGS,font) ; item->setFont(CIRCLEGROUP_CIRCLE_COL_GROUPFLAGS,font) ;
} }
if (subscribed) switch(details.mSubscribeFlags)
{ {
item->setIcon(CIRCLEGROUP_CIRCLE_COL_GROUPNAME,QIcon(":icons/bullet_green_128.png")) ; case GXS_EXTERNAL_CIRCLE_FLAGS_SUBSCRIBED:
item->setToolTip(CIRCLEGROUP_CIRCLE_COL_GROUPNAME,tr("This circle is \"subscribed\" i.e. advertised to neighbor nodes")) ; item->setIcon(CIRCLEGROUP_CIRCLE_COL_GROUPNAME,QIcon(":icons/bullet_yellow_128.png")) ;
} item->setToolTip(CIRCLEGROUP_CIRCLE_COL_GROUPNAME,tr("Your request to be in this group is still pending. You need to wait the administrator to validate it.")) ;
else break ;
{
item->setIcon(CIRCLEGROUP_CIRCLE_COL_GROUPNAME,QIcon(":icons/bullet_yellow_128.png")) ; case GXS_EXTERNAL_CIRCLE_FLAGS_IN_ADMIN_LIST:
item->setToolTip(CIRCLEGROUP_CIRCLE_COL_GROUPNAME,"") ; item->setIcon(CIRCLEGROUP_CIRCLE_COL_GROUPNAME,QIcon(":icons/bullet_blue_128.png")) ;
} item->setToolTip(CIRCLEGROUP_CIRCLE_COL_GROUPNAME,tr("You are invited to this group by the administrator. Right click to join the group.")) ;
break ;
case GXS_EXTERNAL_CIRCLE_FLAGS_IN_ADMIN_LIST | GXS_EXTERNAL_CIRCLE_FLAGS_SUBSCRIBED:
item->setIcon(CIRCLEGROUP_CIRCLE_COL_GROUPNAME,QIcon(":icons/bullet_green_128.png")) ;
item->setToolTip(CIRCLEGROUP_CIRCLE_COL_GROUPNAME,tr("You are a member of this group.")) ;
break ;
default:
item->setIcon(CIRCLEGROUP_CIRCLE_COL_GROUPNAME,QIcon()) ;
item->setToolTip(CIRCLEGROUP_CIRCLE_COL_GROUPNAME,"") ;
break ;
}
} }
} }

View File

@ -43,7 +43,7 @@ static bool same_RsGxsCircleDetails(const RsGxsCircleDetails& d1,const RsGxsCirc
return ( d1.mCircleId == d2.mCircleId return ( d1.mCircleId == d2.mCircleId
&& d1.mCircleName == d2.mCircleName && d1.mCircleName == d2.mCircleName
&& d1.mCircleType == d2.mCircleType && d1.mCircleType == d2.mCircleType
&& d1.mIsExternal == d2.mIsExternal && d1.mSubscribeFlags == d2.mSubscribeFlags
&& d1.mAllowedGxsIds== d2.mAllowedGxsIds && d1.mAllowedGxsIds== d2.mAllowedGxsIds
&& d1.mAllowedNodes == d2.mAllowedNodes && d1.mAllowedNodes == d2.mAllowedNodes
); );

View File

@ -286,7 +286,7 @@ void PeopleDialog::insertCircles(uint32_t token)
continue ; continue ;
}//if(!rsGxsCircles->getCircleDetails(RsGxsCircleId(git->mGroupId), details)) }//if(!rsGxsCircles->getCircleDetails(RsGxsCircleId(git->mGroupId), details))
if (!details.mIsExternal){ if (details.mCircleType != GXS_CIRCLE_TYPE_EXTERNAL){
std::map<RsGxsGroupId, CircleWidget*>::iterator itFound; std::map<RsGxsGroupId, CircleWidget*>::iterator itFound;
if((itFound=_int_circles_widgets.find(gsItem.mGroupId)) == _int_circles_widgets.end()) { if((itFound=_int_circles_widgets.find(gsItem.mGroupId)) == _int_circles_widgets.end()) {
std::cerr << "PeopleDialog::insertExtCircles() add new Internal GroupId: " << gsItem.mGroupId; std::cerr << "PeopleDialog::insertExtCircles() add new Internal GroupId: " << gsItem.mGroupId;

View File

@ -288,7 +288,7 @@ void GxsChannelPostsWidget::insertChannelDetails(const RsGxsChannelGroup &group)
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_EYES_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

@ -10,6 +10,7 @@
<file>icons/blank_green_128.png</file> <file>icons/blank_green_128.png</file>
<file>icons/browsable_blue_128.png</file> <file>icons/browsable_blue_128.png</file>
<file>icons/browsable_green_128.png</file> <file>icons/browsable_green_128.png</file>
<file>icons/bullet_blue_128.png</file>
<file>icons/bullet_green_128.png</file> <file>icons/bullet_green_128.png</file>
<file>icons/bullet_grey_128.png</file> <file>icons/bullet_grey_128.png</file>
<file>icons/bullet_red_128.png</file> <file>icons/bullet_red_128.png</file>

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.2 KiB