mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-01-27 07:47:03 -05:00
Merge pull request #2261 from csoler/v0.6-BugFixing_6
Better display of last seen info in groups
This commit is contained in:
commit
42dd13b0e6
@ -1381,6 +1381,15 @@ bool RsGenExchange::getGroupMeta(const uint32_t &token, std::list<RsGroupMetaDat
|
|||||||
m.mVisibleMsgCount = 0 ;
|
m.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.
|
||||||
|
|
||||||
|
m.mLastSeen = (IS_GROUP_SUBSCRIBED(gMeta.mSubscribeFlags)) ? time(nullptr) : service_getLastGroupSeenTs(gMeta.mGroupId);
|
||||||
|
|
||||||
|
#ifdef GEN_EXCH_DEBUG
|
||||||
|
std::cerr << "Group: " << gMeta.mGroupId << " name \"" << gMeta.mGroupName << "\" last seen=" << m.mLastSeen << " now=" << time(nullptr) << std::endl;
|
||||||
|
#endif
|
||||||
|
|
||||||
groupInfo.push_back(m);
|
groupInfo.push_back(m);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1556,6 +1565,7 @@ bool RsGenExchange::getGroupData(const uint32_t &token, std::vector<RsGxsGrpItem
|
|||||||
|
|
||||||
if((!(IS_GROUP_SUBSCRIBED(gItem->meta.mSubscribeFlags))) || gItem->meta.mLastPost == 0)
|
if((!(IS_GROUP_SUBSCRIBED(gItem->meta.mSubscribeFlags))) || gItem->meta.mLastPost == 0)
|
||||||
gItem->meta.mLastPost = sts.mLastGroupModificationTS ;
|
gItem->meta.mLastPost = sts.mLastGroupModificationTS ;
|
||||||
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -1563,6 +1573,14 @@ bool RsGenExchange::getGroupData(const uint32_t &token, std::vector<RsGxsGrpItem
|
|||||||
gItem->meta.mVisibleMsgCount = 0;
|
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);
|
||||||
|
|
||||||
|
#ifdef GEN_EXCH_DEBUG
|
||||||
|
std::cerr << "Group: " << gItem->meta.mGroupId << " name \"" << gItem->meta.mGroupName << "\" last seen=" << gItem->meta.mLastSeen << " now=" << time(nullptr) << std::endl;
|
||||||
|
#endif
|
||||||
|
|
||||||
// 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.
|
// 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.
|
// As a consequence, it's important to supply a correct value in this flag before the data can be edited/updated.
|
||||||
|
@ -667,6 +667,14 @@ protected:
|
|||||||
*/
|
*/
|
||||||
virtual bool service_checkIfGroupIsStillUsed(const RsGxsGrpMetaData& /* meta */) { return true; } // see RsGenExchange
|
virtual bool service_checkIfGroupIsStillUsed(const RsGxsGrpMetaData& /* meta */) { return true; } // see RsGenExchange
|
||||||
|
|
||||||
|
/*!
|
||||||
|
* \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:
|
public:
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
|
@ -91,6 +91,7 @@ struct RsGroupMetaData : RsSerializable
|
|||||||
uint32_t mPop; // Popularity = number of friend subscribers
|
uint32_t mPop; // Popularity = number of friend subscribers
|
||||||
uint32_t mVisibleMsgCount; // Max messages reported by friends
|
uint32_t mVisibleMsgCount; // Max messages reported by friends
|
||||||
rstime_t mLastPost; // Timestamp for last message. Not used yet.
|
rstime_t mLastPost; // Timestamp for last message. Not used yet.
|
||||||
|
rstime_t mLastSeen; // Last time the group was advertised by friends.
|
||||||
|
|
||||||
uint32_t mGroupStatus;
|
uint32_t mGroupStatus;
|
||||||
|
|
||||||
|
@ -1700,6 +1700,24 @@ bool p3GxsCircles::locked_checkCircleCacheForAutoSubscribe(RsGxsCircleCache& cac
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
rstime_t p3GxsCircles::service_getLastGroupSeenTs(const RsGxsGroupId& gid)
|
||||||
|
{
|
||||||
|
rstime_t now = time(nullptr);
|
||||||
|
|
||||||
|
RS_STACK_MUTEX(mKnownCirclesMtx);
|
||||||
|
|
||||||
|
auto it = mKnownCircles.find(gid);
|
||||||
|
bool unknown_posted = (it == mKnownCircles.end());
|
||||||
|
|
||||||
|
if(unknown_posted)
|
||||||
|
{
|
||||||
|
mKnownCircles[gid] = now;
|
||||||
|
IndicateConfigChanged();
|
||||||
|
return now;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
return it->second;
|
||||||
|
}
|
||||||
bool p3GxsCircles::service_checkIfGroupIsStillUsed(const RsGxsGrpMetaData& meta)
|
bool p3GxsCircles::service_checkIfGroupIsStillUsed(const RsGxsGrpMetaData& meta)
|
||||||
{
|
{
|
||||||
#ifdef GXSFORUMS_CHANNELS
|
#ifdef GXSFORUMS_CHANNELS
|
||||||
|
@ -290,6 +290,7 @@ public:
|
|||||||
virtual void updateGroup(uint32_t &token, RsGxsCircleGroup &group) override;
|
virtual void updateGroup(uint32_t &token, RsGxsCircleGroup &group) override;
|
||||||
|
|
||||||
virtual bool service_checkIfGroupIsStillUsed(const RsGxsGrpMetaData& meta) override;
|
virtual bool service_checkIfGroupIsStillUsed(const RsGxsGrpMetaData& meta) override;
|
||||||
|
virtual rstime_t service_getLastGroupSeenTs(const RsGxsGroupId&) override;
|
||||||
|
|
||||||
/* membership management for external circles */
|
/* membership management for external circles */
|
||||||
|
|
||||||
|
@ -417,6 +417,24 @@ void p3GxsForums::service_tick()
|
|||||||
return;
|
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)
|
bool p3GxsForums::service_checkIfGroupIsStillUsed(const RsGxsGrpMetaData& meta)
|
||||||
{
|
{
|
||||||
#ifdef GXSFORUMS_DEBUG
|
#ifdef GXSFORUMS_DEBUG
|
||||||
|
@ -53,6 +53,7 @@ protected:
|
|||||||
virtual bool loadList(std::list<RsItem *>& loadList) override; // @see p3Config::loadList(std::list<RsItem *>&)
|
virtual bool loadList(std::list<RsItem *>& loadList) override; // @see p3Config::loadList(std::list<RsItem *>&)
|
||||||
|
|
||||||
virtual bool service_checkIfGroupIsStillUsed(const RsGxsGrpMetaData& meta) override;
|
virtual bool service_checkIfGroupIsStillUsed(const RsGxsGrpMetaData& meta) override;
|
||||||
|
virtual rstime_t service_getLastGroupSeenTs(const RsGxsGroupId&) override;
|
||||||
public:
|
public:
|
||||||
/// @see RsGxsForums::createForumV2
|
/// @see RsGxsForums::createForumV2
|
||||||
bool createForumV2(
|
bool createForumV2(
|
||||||
|
@ -695,7 +695,12 @@ void IdDialog::loadCircles(const std::list<RsGroupMetaData>& groupInfo)
|
|||||||
if(am_I_subscribed)
|
if(am_I_subscribed)
|
||||||
tooltip += tr("subscribed (Receive/forward membership requests from others and invite list).") ;
|
tooltip += tr("subscribed (Receive/forward membership requests from others and invite list).") ;
|
||||||
else
|
else
|
||||||
|
{
|
||||||
|
if(vit->mLastSeen>0)
|
||||||
|
tooltip += tr("unsubscribed (Only receive invite list). Last seen: %1 days ago.").arg( (time(nullptr)-vit->mLastSeen)/86400 );
|
||||||
|
else
|
||||||
tooltip += tr("unsubscribed (Only receive invite list).");
|
tooltip += tr("unsubscribed (Only receive invite list).");
|
||||||
|
}
|
||||||
|
|
||||||
tooltip += "\n"+tr("Your status: ") ;
|
tooltip += "\n"+tr("Your status: ") ;
|
||||||
|
|
||||||
|
@ -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("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));
|
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]");
|
QString distrib_string = tr("[unknown]");
|
||||||
switch(static_cast<RsGxsCircleType>(group.mMeta.mCircleType))
|
switch(static_cast<RsGxsCircleType>(group.mMeta.mCircleType))
|
||||||
|
Loading…
x
Reference in New Issue
Block a user