mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-04-11 10:19:42 -04:00
added info about last time unsubscribed circles and forums have been advertised by subscribed friends
This commit is contained in:
parent
c9a92bc58a
commit
5292ff0af5
@ -1384,7 +1384,9 @@ bool RsGenExchange::getGroupMeta(const uint32_t &token, std::list<RsGroupMetaDat
|
||||
// We could save this in the net service, but it's a bit more than that since some services have
|
||||
// specific usage footprints for their groups.
|
||||
|
||||
m.mLastSeen = (IS_GROUP_SUBSCRIBED(gMeta.mSubscribeFlags)) ? time(nullptr) : service_getLastGroupUsageTs(gMeta.mGroupId);
|
||||
m.mLastSeen = (IS_GROUP_SUBSCRIBED(gMeta.mSubscribeFlags)) ? time(nullptr) : service_getLastGroupSeenTs(gMeta.mGroupId);
|
||||
|
||||
std::cerr << "Group: " << gMeta.mGroupId << " name \"" << gMeta.mGroupName << "\" last seen=" << m.mLastSeen << " now=" << time(nullptr) << std::endl;
|
||||
|
||||
groupInfo.push_back(m);
|
||||
}
|
||||
@ -1561,6 +1563,7 @@ bool RsGenExchange::getGroupData(const uint32_t &token, std::vector<RsGxsGrpItem
|
||||
|
||||
if((!(IS_GROUP_SUBSCRIBED(gItem->meta.mSubscribeFlags))) || gItem->meta.mLastPost == 0)
|
||||
gItem->meta.mLastPost = sts.mLastGroupModificationTS ;
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -1568,6 +1571,12 @@ bool RsGenExchange::getGroupData(const uint32_t &token, std::vector<RsGxsGrpItem
|
||||
gItem->meta.mVisibleMsgCount = 0;
|
||||
}
|
||||
|
||||
// We could save this in the net service, but it's a bit more than that since some services have
|
||||
// specific usage footprints for their groups.
|
||||
|
||||
gItem->meta.mLastSeen = (IS_GROUP_SUBSCRIBED(gItem->meta.mSubscribeFlags)) ? time(nullptr) : service_getLastGroupSeenTs(gItem->meta.mGroupId);
|
||||
|
||||
std::cerr << "Group: " << gItem->meta.mGroupId << " name \"" << gItem->meta.mGroupName << "\" last seen=" << gItem->meta.mLastSeen << " now=" << time(nullptr) << std::endl;
|
||||
|
||||
// Also check the group privacy flags. A while ago, it as possible to publish a group without privacy flags. Now it is not possible anymore.
|
||||
// As a consequence, it's important to supply a correct value in this flag before the data can be edited/updated.
|
||||
|
@ -666,7 +666,15 @@ protected:
|
||||
* that the group is always in use.
|
||||
*/
|
||||
virtual bool service_checkIfGroupIsStillUsed(const RsGxsGrpMetaData& /* meta */) { return true; } // see RsGenExchange
|
||||
virtual rstime_t service_getLastGroupUsageTs(const RsGxsGroupId&) { return 0; }
|
||||
|
||||
/*!
|
||||
* \brief service_getLastGroupSeenTs
|
||||
* \return
|
||||
* returns the last time a friend sent information (statistics) about this group. That practically means when the
|
||||
* group was still being subscribed by at least one friend. This is used by service_checkIfGroupIsStillUsed() to
|
||||
* help getting rid of dead groups.
|
||||
*/
|
||||
virtual rstime_t service_getLastGroupSeenTs(const RsGxsGroupId&) { return 0; }
|
||||
public:
|
||||
|
||||
/*!
|
||||
|
@ -1700,7 +1700,7 @@ bool p3GxsCircles::locked_checkCircleCacheForAutoSubscribe(RsGxsCircleCache& cac
|
||||
return true;
|
||||
}
|
||||
|
||||
rstime_t p3GxsCircles::service_getLastGroupUsageTs(const RsGxsGroupId& gid)
|
||||
rstime_t p3GxsCircles::service_getLastGroupSeenTs(const RsGxsGroupId& gid)
|
||||
{
|
||||
rstime_t now = time(nullptr);
|
||||
|
||||
@ -1710,7 +1710,11 @@ rstime_t p3GxsCircles::service_getLastGroupUsageTs(const RsGxsGroupId& gid)
|
||||
bool unknown_posted = (it == mKnownCircles.end());
|
||||
|
||||
if(unknown_posted)
|
||||
{
|
||||
mKnownCircles[gid] = now;
|
||||
IndicateConfigChanged();
|
||||
return now;
|
||||
}
|
||||
else
|
||||
return it->second;
|
||||
}
|
||||
|
@ -290,7 +290,7 @@ public:
|
||||
virtual void updateGroup(uint32_t &token, RsGxsCircleGroup &group) override;
|
||||
|
||||
virtual bool service_checkIfGroupIsStillUsed(const RsGxsGrpMetaData& meta) override;
|
||||
virtual rstime_t service_getLastGroupUsageTs(const RsGxsGroupId&) override;
|
||||
virtual rstime_t service_getLastGroupSeenTs(const RsGxsGroupId&) override;
|
||||
|
||||
/* membership management for external circles */
|
||||
|
||||
|
@ -417,6 +417,24 @@ void p3GxsForums::service_tick()
|
||||
return;
|
||||
}
|
||||
|
||||
rstime_t p3GxsForums::service_getLastGroupSeenTs(const RsGxsGroupId& gid)
|
||||
{
|
||||
rstime_t now = time(nullptr);
|
||||
|
||||
RS_STACK_MUTEX(mKnownForumsMutex);
|
||||
|
||||
auto it = mKnownForums.find(gid);
|
||||
bool unknown_forum = it == mKnownForums.end();
|
||||
|
||||
if(unknown_forum)
|
||||
{
|
||||
mKnownForums[gid] = now;
|
||||
IndicateConfigChanged();
|
||||
return now;
|
||||
}
|
||||
else
|
||||
return it->second;
|
||||
}
|
||||
bool p3GxsForums::service_checkIfGroupIsStillUsed(const RsGxsGrpMetaData& meta)
|
||||
{
|
||||
#ifdef GXSFORUMS_DEBUG
|
||||
|
@ -53,6 +53,7 @@ protected:
|
||||
virtual bool loadList(std::list<RsItem *>& loadList) override; // @see p3Config::loadList(std::list<RsItem *>&)
|
||||
|
||||
virtual bool service_checkIfGroupIsStillUsed(const RsGxsGrpMetaData& meta) override;
|
||||
virtual rstime_t service_getLastGroupSeenTs(const RsGxsGroupId&) override;
|
||||
public:
|
||||
/// @see RsGxsForums::createForumV2
|
||||
bool createForumV2(
|
||||
|
@ -1065,6 +1065,11 @@ void GxsForumThreadWidget::updateForumDescription(bool success)
|
||||
forum_description += QString("<b>%1: \t</b>%2<br/>").arg(tr("Synchronization"),getDurationString( rsGxsForums->getSyncPeriod(group.mMeta.mGroupId)/86400 )) ;
|
||||
forum_description += QString("<b>%1: \t</b>%2<br/>").arg(tr("Storage"),getDurationString( rsGxsForums->getStoragePeriod(group.mMeta.mGroupId)/86400));
|
||||
}
|
||||
else
|
||||
{
|
||||
if(group.mMeta.mLastSeen > 0)
|
||||
forum_description += QString("<b>%1: \t</b>%2 days ago<br/>").arg(tr("Last seen at friends:"),QString::number((time(nullptr) - group.mMeta.mLastSeen)/86400));
|
||||
}
|
||||
|
||||
QString distrib_string = tr("[unknown]");
|
||||
switch(static_cast<RsGxsCircleType>(group.mMeta.mCircleType))
|
||||
|
Loading…
x
Reference in New Issue
Block a user