diff --git a/libretroshare/src/gxs/rsdataservice.cc b/libretroshare/src/gxs/rsdataservice.cc index d706fc3eb..340ecfbe9 100644 --- a/libretroshare/src/gxs/rsdataservice.cc +++ b/libretroshare/src/gxs/rsdataservice.cc @@ -327,7 +327,7 @@ RsGxsGrpMetaData* RsDataService::locked_getGrpMeta(RetroCursor &c) // local meta grpMeta->mSubscribeFlags = c.getInt32(COL_GRP_SUBCR_FLAG); grpMeta->mPop = c.getInt32(COL_GRP_POP); - grpMeta->mMsgCount = c.getInt32(COL_MSG_COUNT); + grpMeta->mVisibleMsgCount = c.getInt32(COL_MSG_COUNT); grpMeta->mLastPost = c.getInt32(COL_GRP_LAST_POST); grpMeta->mGroupStatus = c.getInt32(COL_GRP_STATUS); @@ -743,7 +743,7 @@ int RsDataService::storeGroup(std::map &grp) // local meta data cv.put(KEY_GRP_SUBCR_FLAG, (int32_t)grpMetaPtr->mSubscribeFlags); cv.put(KEY_GRP_POP, (int32_t)grpMetaPtr->mPop); - cv.put(KEY_MSG_COUNT, (int32_t)grpMetaPtr->mMsgCount); + cv.put(KEY_MSG_COUNT, (int32_t)grpMetaPtr->mVisibleMsgCount); cv.put(KEY_GRP_STATUS, (int32_t)grpMetaPtr->mGroupStatus); cv.put(KEY_GRP_LAST_POST, (int32_t)grpMetaPtr->mLastPost); @@ -838,7 +838,7 @@ int RsDataService::updateGroup(std::map &grp) // local meta data cv.put(KEY_GRP_SUBCR_FLAG, (int32_t)grpMetaPtr->mSubscribeFlags); cv.put(KEY_GRP_POP, (int32_t)grpMetaPtr->mPop); - cv.put(KEY_MSG_COUNT, (int32_t)grpMetaPtr->mMsgCount); + cv.put(KEY_MSG_COUNT, (int32_t)grpMetaPtr->mVisibleMsgCount); cv.put(KEY_GRP_STATUS, (int32_t)grpMetaPtr->mGroupStatus); cv.put(KEY_GRP_LAST_POST, (int32_t)grpMetaPtr->mLastPost); diff --git a/libretroshare/src/gxs/rsgds.h b/libretroshare/src/gxs/rsgds.h index cd0210587..1c5c1a500 100644 --- a/libretroshare/src/gxs/rsgds.h +++ b/libretroshare/src/gxs/rsgds.h @@ -75,6 +75,23 @@ public: }; +/*! + * This is used to query network statistics for a given group. This is useful to e.g. show group + * popularity, or number of visible messages for unsubscribed group. + */ + +class RsGroupNetworkStats +{ +public: + RsGroupNetworkStats() + { + mMaxVisibleCount = 0 ; + } + + uint32_t mSuppliers ; + uint32_t mMaxVisibleCount ; +}; + typedef std::map > NxsMsgDataResult; typedef std::map > NxsMsgRelatedDataResult; typedef std::map > GxsMsgResult; // diff --git a/libretroshare/src/gxs/rsgenexchange.cc b/libretroshare/src/gxs/rsgenexchange.cc index e52678500..ddfa436a8 100644 --- a/libretroshare/src/gxs/rsgenexchange.cc +++ b/libretroshare/src/gxs/rsgenexchange.cc @@ -1146,11 +1146,18 @@ bool RsGenExchange::getGroupMeta(const uint32_t &token, std::listgetGroupPopularity((*lit)->mGroupId) ; - else - m.mPop= 0 ; + if(mNetService != NULL && mNetService->getGroupNetworkStats((*lit)->mGroupId,sts)) + { + m.mPop = sts.mSuppliers ; + m.mVisibleMsgCount = sts.mMaxVisibleCount ; + } + else + { + m.mPop= 0 ; + m.mVisibleMsgCount = 0 ; + } groupInfo.push_back(m); delete (*lit); @@ -1251,10 +1258,18 @@ bool RsGenExchange::getGroupData(const uint32_t &token, std::vectormeta = *((*lit)->metaData); - if(mNetService != NULL) - gItem->meta.mPop = mNetService->getGroupPopularity(gItem->meta.mGroupId) ; + RsGroupNetworkStats sts ; + + if(mNetService != NULL && mNetService->getGroupNetworkStats(gItem->meta.mGroupId,sts)) + { + gItem->meta.mPop = sts.mSuppliers ; + gItem->meta.mVisibleMsgCount = sts.mMaxVisibleCount; + } else - gItem->meta.mPop= 0 ; + { + gItem->meta.mPop = 0 ; + gItem->meta.mVisibleMsgCount = 0 ; + } grpItem.push_back(gItem); } else diff --git a/libretroshare/src/gxs/rsgxsdata.cc b/libretroshare/src/gxs/rsgxsdata.cc index e32943ea4..61cd52023 100644 --- a/libretroshare/src/gxs/rsgxsdata.cc +++ b/libretroshare/src/gxs/rsgxsdata.cc @@ -77,7 +77,7 @@ void RsGxsGrpMetaData::clear(){ mSubscribeFlags = 0; mPop = 0; - mMsgCount = 0; + mVisibleMsgCount = 0; mGroupStatus = 0; mLastPost = 0; mReputationCutOff = 0; @@ -284,17 +284,17 @@ bool RsGxsMsgMetaData::deserialise(void *data, uint32_t *size) void RsGxsGrpMetaData::operator =(const RsGroupMetaData& rMeta) { - this->mAuthorId = rMeta.mAuthorId; - this->mGroupFlags = rMeta.mGroupFlags; - this->mGroupId = rMeta.mGroupId; - this->mGroupStatus = rMeta.mGroupStatus ; - this->mLastPost = rMeta.mLastPost; - this->mMsgCount = rMeta.mMsgCount ; - this->mPop = rMeta.mPop; - this->mPublishTs = rMeta.mPublishTs; - this->mSubscribeFlags = rMeta.mSubscribeFlags; - this->mGroupName = rMeta.mGroupName; - this->mServiceString = rMeta.mServiceString; + this->mAuthorId = rMeta.mAuthorId; + this->mGroupFlags = rMeta.mGroupFlags; + this->mGroupId = rMeta.mGroupId; + this->mGroupStatus = rMeta.mGroupStatus ; + this->mLastPost = rMeta.mLastPost; + this->mVisibleMsgCount = rMeta.mVisibleMsgCount ; + this->mPop = rMeta.mPop; + this->mPublishTs = rMeta.mPublishTs; + this->mSubscribeFlags = rMeta.mSubscribeFlags; + this->mGroupName = rMeta.mGroupName; + this->mServiceString = rMeta.mServiceString; this->mSignFlags = rMeta.mSignFlags; this->mCircleId = rMeta.mCircleId; this->mCircleType = rMeta.mCircleType; @@ -307,18 +307,18 @@ void RsGxsGrpMetaData::operator =(const RsGroupMetaData& rMeta) void RsGxsMsgMetaData::operator =(const RsMsgMetaData& rMeta) { - this->mAuthorId = rMeta.mAuthorId; - this->mChildTs = rMeta.mChildTs ; - this->mGroupId = rMeta.mGroupId; - this->mMsgFlags = rMeta.mMsgFlags ; - this->mMsgId = rMeta.mMsgId ; - this->mMsgName = rMeta.mMsgName; - this->mMsgStatus = rMeta.mMsgStatus; - this->mOrigMsgId = rMeta.mOrigMsgId; - this->mParentId = rMeta.mParentId ; - this->mPublishTs = rMeta.mPublishTs ; - this->mThreadId = rMeta.mThreadId; - this->mServiceString = rMeta.mServiceString; + this->mAuthorId = rMeta.mAuthorId; + this->mChildTs = rMeta.mChildTs ; + this->mGroupId = rMeta.mGroupId; + this->mMsgFlags = rMeta.mMsgFlags ; + this->mMsgId = rMeta.mMsgId ; + this->mMsgName = rMeta.mMsgName; + this->mMsgStatus = rMeta.mMsgStatus; + this->mOrigMsgId = rMeta.mOrigMsgId; + this->mParentId = rMeta.mParentId ; + this->mPublishTs = rMeta.mPublishTs ; + this->mThreadId = rMeta.mThreadId; + this->mServiceString = rMeta.mServiceString; } diff --git a/libretroshare/src/gxs/rsgxsdata.h b/libretroshare/src/gxs/rsgxsdata.h index 2835861d0..91cb92da3 100644 --- a/libretroshare/src/gxs/rsgxsdata.h +++ b/libretroshare/src/gxs/rsgxsdata.h @@ -71,9 +71,9 @@ public: uint32_t mSubscribeFlags; - uint32_t mPop; // HOW DO WE DO THIS NOW. - uint32_t mMsgCount; // ??? - uint32_t mLastPost; // ??? + uint32_t mPop; // Number of friends who subscribed + uint32_t mVisibleMsgCount; // Max number of messages reported by a single friend (used for unsubscribed groups) + uint32_t mLastPost; // Time stamp of last post (not yet filled) uint32_t mReputationCutOff; uint32_t mGrpSize; diff --git a/libretroshare/src/gxs/rsgxsnetservice.cc b/libretroshare/src/gxs/rsgxsnetservice.cc index 47c0ba998..d0a0ed69c 100644 --- a/libretroshare/src/gxs/rsgxsnetservice.cc +++ b/libretroshare/src/gxs/rsgxsnetservice.cc @@ -37,7 +37,6 @@ /*** * #define NXS_NET_DEBUG 1 ***/ -// #define NXS_NET_DEBUG 1 #define GIXS_CUT_OFF 0 @@ -278,11 +277,11 @@ void RsGxsNetService::syncWithPeers() { RsGxsGrpMetaData* meta = mit->second; - if(meta->mSubscribeFlags & GXS_SERV::GROUP_SUBSCRIBE_SUBSCRIBED ) - { - toRequest.insert(std::make_pair(mit->first, meta)); - }else - delete meta; +// if(meta->mSubscribeFlags & GXS_SERV::GROUP_SUBSCRIBE_SUBSCRIBED ) + // { + toRequest.insert(std::make_pair(mit->first, meta)); + // }else + // delete meta; } grpMeta.clear(); @@ -557,7 +556,7 @@ void RsGxsNetService::locked_createTransactionFromPending(GrpRespPending* grpPen std::cerr << "locked_createTransactionFromPending() from peer " << grpPend->mPeerId << std::endl; #endif GrpAuthorV::const_iterator cit = grpPend->mGrpAuthV.begin(); - std::list reqList; + std::list reqList; uint32_t transN = locked_getTransactionId(); for(; cit != grpPend->mGrpAuthV.end(); ++cit) { @@ -1434,16 +1433,19 @@ void RsGxsNetService::processTransactions() } } -int RsGxsNetService::getGroupPopularity(const RsGxsGroupId& gid) +bool RsGxsNetService::getGroupNetworkStats(const RsGxsGroupId& gid,RsGroupNetworkStats& stats) { - RS_STACK_MUTEX(mNxsMutex) ; + RS_STACK_MUTEX(mNxsMutex) ; - std::map >::const_iterator it = mGroupSuppliers.find(gid) ; + std::map::const_iterator it = mGroupNetworkStats.find(gid) ; - if(it == mGroupSuppliers.end()) - return 0 ; - else - return it->second.size(); + if(it == mGroupNetworkStats.end()) + return false ; + + stats.mSuppliers = it->second.suppliers.size(); + stats.mMaxVisibleCount = it->second.max_visible_count ; + + return true ; } void RsGxsNetService::processCompletedTransactions() @@ -1820,6 +1822,15 @@ void RsGxsNetService::locked_genReqMsgTransaction(NxsTransaction* tr) RsNxsSyncMsgItem* item = msgItemL.front(); const RsGxsGroupId& grpId = item->grpId; + // store the count for the peer who sent the message list + uint32_t mcount = msgItemL.size() ; + RsPeerId pid = msgItemL.front()->PeerId() ; + + RsGroupNetworkStatsRecord& gnsr = mGroupNetworkStats[grpId]; + + gnsr.suppliers.insert(pid) ; + gnsr.max_visible_count = std::max(gnsr.max_visible_count, mcount) ; + #ifdef NXS_NET_DEBUG std::cerr << " grpId = " << grpId << std::endl; std::cerr << " retrieving grp mesta data..." << std::endl; @@ -1829,6 +1840,9 @@ void RsGxsNetService::locked_genReqMsgTransaction(NxsTransaction* tr) mDataStore->retrieveGxsGrpMetaData(grpMetaMap); RsGxsGrpMetaData* grpMeta = grpMetaMap[grpId]; + if(! (grpMeta->mSubscribeFlags & GXS_SERV::GROUP_SUBSCRIBE_SUBSCRIBED )) + return ; + int cutoff = 0; if(grpMeta != NULL) cutoff = grpMeta->mReputationCutOff; @@ -2864,7 +2878,7 @@ void RsGxsNetService::handleRecvSyncMessage(RsNxsSyncMsg* item) // We do that early, so as to get info about who sends data about which group, // even when the group doesn't need update. - mGroupSuppliers[item->grpId].insert(item->PeerId()) ; + mGroupNetworkStats[item->grpId].suppliers.insert(item->PeerId()) ; if(!locked_CanReceiveUpdate(item)) return; diff --git a/libretroshare/src/gxs/rsgxsnetservice.h b/libretroshare/src/gxs/rsgxsnetservice.h index 0d3d17c10..d8d8d5ad9 100644 --- a/libretroshare/src/gxs/rsgxsnetservice.h +++ b/libretroshare/src/gxs/rsgxsnetservice.h @@ -48,6 +48,15 @@ typedef std::map TransactionsPeerMap; class PgpAuxUtils; +class RsGroupNetworkStatsRecord +{ + public: + RsGroupNetworkStatsRecord() { max_visible_count= 0 ; } + + std::set suppliers ; + uint32_t max_visible_count ; +}; + /*! * This class implements the RsNetWorkExchangeService * using transactions to handle synchrnisation of Nxs items between @@ -128,7 +137,11 @@ public: virtual int sharePublishKey(const RsGxsGroupId& grpId,const std::list& peers) ; - virtual int getGroupPopularity(const RsGxsGroupId& id) ; + /*! + * Returns statistics for the group networking activity: popularity (number of friends subscribers) and max_visible_msg_count, + * that is the max nnumber of messages reported by a friend. + */ + virtual bool getGroupNetworkStats(const RsGxsGroupId& id,RsGroupNetworkStats& stats) ; /* p3Config methods */ public: @@ -477,7 +490,7 @@ private: ServerMsgMap mServerMsgUpdateMap; ClientGrpMap mClientGrpUpdateMap; - std::map > mGroupSuppliers ; + std::map mGroupNetworkStats ; RsGxsServerGrpUpdateItem* mGrpServerUpdateItem; RsServiceInfo mServiceInfo; diff --git a/libretroshare/src/gxs/rsnxs.h b/libretroshare/src/gxs/rsnxs.h index 354df8d26..9faa4593c 100644 --- a/libretroshare/src/gxs/rsnxs.h +++ b/libretroshare/src/gxs/rsnxs.h @@ -111,6 +111,12 @@ public: */ virtual int requestGrp(const std::list& grpId, const RsPeerId& peerId) = 0; + /*! + * returns some stats about this group related to the network visibility. + * For now, only one statistics: + * max_known_messages: max number of messages reported by a friend. This is used to display unsubscribed group content. + */ + virtual bool getGroupNetworkStats(const RsGxsGroupId& grpId,RsGroupNetworkStats& stats)=0; /*! * Request for this group is sent through to peers on your network @@ -118,12 +124,6 @@ public: */ virtual int sharePublishKey(const RsGxsGroupId& grpId,const std::list& peers)=0 ; - /*! - * Request the number of peers who sent info about this group, as an indicator - * of group popularity. - */ - virtual int getGroupPopularity(const RsGxsGroupId& id) = 0 ; - }; #endif // RSGNP_H diff --git a/libretroshare/src/retroshare/rsgxsifacetypes.h b/libretroshare/src/retroshare/rsgxsifacetypes.h index 3eb123667..cb05e6149 100644 --- a/libretroshare/src/retroshare/rsgxsifacetypes.h +++ b/libretroshare/src/retroshare/rsgxsifacetypes.h @@ -44,7 +44,7 @@ public: mSubscribeFlags = 0; mPop = 0; - mMsgCount = 0; + mVisibleMsgCount = 0; mLastPost = 0; mGroupStatus = 0; @@ -76,9 +76,9 @@ public: uint32_t mSubscribeFlags; - uint32_t mPop; // HOW DO WE DO THIS NOW. - uint32_t mMsgCount; // ??? - time_t mLastPost; // ??? + uint32_t mPop; // Popularity = number of friend subscribers + uint32_t mVisibleMsgCount; // Max messages reported by friends + time_t mLastPost; // Timestamp for last message. Not used yet. uint32_t mGroupStatus; std::string mServiceString; // Service Specific Free-Form extra storage. @@ -142,18 +142,19 @@ public: mNumThreadMsgsNew = 0; mNumThreadMsgsUnread = 0; mNumChildMsgsNew = 0; - mNumChildMsgsUnread = 0; + mNumChildMsgsUnread = 0; } public: /// number of message - RsGxsGroupId mGrpId; - uint32_t mNumMsgs; + RsGxsGroupId mGrpId; + + uint32_t mNumMsgs; // from the database uint32_t mTotalSizeOfMsgs; uint32_t mNumThreadMsgsNew; uint32_t mNumThreadMsgsUnread; uint32_t mNumChildMsgsNew; - uint32_t mNumChildMsgsUnread; + uint32_t mNumChildMsgsUnread; }; class GxsServiceStatistic diff --git a/libretroshare/src/serialiser/rsgxsitems.cc b/libretroshare/src/serialiser/rsgxsitems.cc index 49f6990c2..2fc738cab 100644 --- a/libretroshare/src/serialiser/rsgxsitems.cc +++ b/libretroshare/src/serialiser/rsgxsitems.cc @@ -10,48 +10,48 @@ #include "gxs/rsgxsdata.h" #include - void RsMsgMetaData::operator =(const RsGxsMsgMetaData& rGxsMeta) - { - this->mAuthorId = rGxsMeta.mAuthorId; - this->mChildTs = rGxsMeta.mChildTs; - this->mGroupId = rGxsMeta.mGroupId; - this->mMsgFlags = rGxsMeta.mMsgFlags; - this->mMsgId = rGxsMeta.mMsgId; - this->mMsgName = rGxsMeta.mMsgName; - this->mMsgStatus = rGxsMeta.mMsgStatus; - this->mOrigMsgId = rGxsMeta.mOrigMsgId; - this->mParentId = rGxsMeta.mParentId; - this->mPublishTs = rGxsMeta.mPublishTs; - this->mThreadId = rGxsMeta.mThreadId; - this->mServiceString = rGxsMeta.mServiceString; + void RsMsgMetaData::operator =(const RsGxsMsgMetaData& rGxsMeta) + { + this->mAuthorId = rGxsMeta.mAuthorId; + this->mChildTs = rGxsMeta.mChildTs; + this->mGroupId = rGxsMeta.mGroupId; + this->mMsgFlags = rGxsMeta.mMsgFlags; + this->mMsgId = rGxsMeta.mMsgId; + this->mMsgName = rGxsMeta.mMsgName; + this->mMsgStatus = rGxsMeta.mMsgStatus; + this->mOrigMsgId = rGxsMeta.mOrigMsgId; + this->mParentId = rGxsMeta.mParentId; + this->mPublishTs = rGxsMeta.mPublishTs; + this->mThreadId = rGxsMeta.mThreadId; + this->mServiceString = rGxsMeta.mServiceString; - } + } - void RsGroupMetaData::operator =(const RsGxsGrpMetaData& rGxsMeta) - { - this->mAuthorId = rGxsMeta.mAuthorId; - this->mGroupFlags = rGxsMeta.mGroupFlags; - this->mGroupId = rGxsMeta.mGroupId; - this->mGroupStatus = rGxsMeta.mGroupStatus; - this->mLastPost = rGxsMeta.mLastPost; - this->mMsgCount = rGxsMeta.mMsgCount; - this->mPop = rGxsMeta.mPop; - this->mPublishTs = rGxsMeta.mPublishTs; - this->mSubscribeFlags = rGxsMeta.mSubscribeFlags; - this->mGroupName = rGxsMeta.mGroupName; - this->mServiceString = rGxsMeta.mServiceString; - this->mSignFlags = rGxsMeta.mSignFlags; - this->mCircleId = rGxsMeta.mCircleId; - this->mCircleType = rGxsMeta.mCircleType; - this->mInternalCircle = rGxsMeta.mInternalCircle; - this->mOriginator = rGxsMeta.mOriginator; - this->mAuthenFlags = rGxsMeta.mAuthenFlags; + void RsGroupMetaData::operator =(const RsGxsGrpMetaData& rGxsMeta) + { + this->mAuthorId = rGxsMeta.mAuthorId; + this->mGroupFlags = rGxsMeta.mGroupFlags; + this->mGroupId = rGxsMeta.mGroupId; + this->mGroupStatus = rGxsMeta.mGroupStatus; + this->mLastPost = rGxsMeta.mLastPost; + this->mVisibleMsgCount = rGxsMeta.mVisibleMsgCount; + this->mPop = rGxsMeta.mPop; + this->mPublishTs = rGxsMeta.mPublishTs; + this->mSubscribeFlags = rGxsMeta.mSubscribeFlags; + this->mGroupName = rGxsMeta.mGroupName; + this->mServiceString = rGxsMeta.mServiceString; + this->mSignFlags = rGxsMeta.mSignFlags; + this->mCircleId = rGxsMeta.mCircleId; + this->mCircleType = rGxsMeta.mCircleType; + this->mInternalCircle = rGxsMeta.mInternalCircle; + this->mOriginator = rGxsMeta.mOriginator; + this->mAuthenFlags = rGxsMeta.mAuthenFlags; // std::cout << "rGxsMeta.mParentGrpId= " <mParentGrpId= " <mParentGrpId<<"\n"; this->mParentGrpId = rGxsMeta.mParentGrpId; - } + } std::ostream &operator<<(std::ostream &out, const RsGroupMetaData &meta) { diff --git a/libretroshare/src/services/p3gxschannels.cc b/libretroshare/src/services/p3gxschannels.cc index 791da701d..401821954 100644 --- a/libretroshare/src/services/p3gxschannels.cc +++ b/libretroshare/src/services/p3gxschannels.cc @@ -45,7 +45,6 @@ /**** * #define GXSCHANNEL_DEBUG 1 ****/ -#define GXSCHANNEL_DEBUG 1 RsGxsChannels *rsGxsChannels = NULL; diff --git a/retroshare-gui/src/gui/common/GroupTreeWidget.cpp b/retroshare-gui/src/gui/common/GroupTreeWidget.cpp index a92438cec..4bb08a479 100644 --- a/retroshare-gui/src/gui/common/GroupTreeWidget.cpp +++ b/retroshare-gui/src/gui/common/GroupTreeWidget.cpp @@ -22,6 +22,7 @@ #include #include +#include "retroshare/rsgxsflags.h" #include "GroupTreeWidget.h" #include "ui_GroupTreeWidget.h" @@ -353,18 +354,22 @@ void GroupTreeWidget::fillGroupItems(QTreeWidgetItem *categoryItem, const QList< item->setIcon(COLUMN_NAME, itemInfo.icon); /* Set popularity */ - QString tooltip = PopularityDefs::tooltip(itemInfo.popularity); + QString tooltip = PopularityDefs::tooltip(itemInfo.popularity); + item->setIcon(COLUMN_POPULARITY, PopularityDefs::icon(itemInfo.popularity)); item->setData(COLUMN_DATA, ROLE_POPULARITY, -itemInfo.popularity); // negative for correct sorting /* Set tooltip */ if (itemInfo.privatekey) { tooltip += "\n" + tr("Private Key Available"); - } + } + if(!IS_GROUP_SUBSCRIBED(itemInfo.subscribeFlags)) + tooltip += "\n" + QString::number(itemInfo.max_visible_posts) + " messages available" ; + item->setToolTip(COLUMN_NAME, tooltip); item->setToolTip(COLUMN_POPULARITY, tooltip); - item->setData(COLUMN_DATA, ROLE_SUBSCRIBE_FLAGS, itemInfo.subscribeFlags); + item->setData(COLUMN_DATA, ROLE_SUBSCRIBE_FLAGS, itemInfo.subscribeFlags); /* Set color */ QBrush brush; diff --git a/retroshare-gui/src/gui/common/GroupTreeWidget.h b/retroshare-gui/src/gui/common/GroupTreeWidget.h index 901056a24..24ee20095 100644 --- a/retroshare-gui/src/gui/common/GroupTreeWidget.h +++ b/retroshare-gui/src/gui/common/GroupTreeWidget.h @@ -48,7 +48,8 @@ public: { popularity = 0; privatekey = false; - subscribeFlags = 0; + subscribeFlags = 0; + max_visible_posts =0; } public: @@ -59,7 +60,8 @@ public: QDateTime lastpost; QIcon icon; bool privatekey; - int subscribeFlags; + quint32 subscribeFlags; + quint32 max_visible_posts ; }; class GroupTreeWidget : public QWidget diff --git a/retroshare-gui/src/gui/gxs/GxsGroupFrameDialog.cpp b/retroshare-gui/src/gui/gxs/GxsGroupFrameDialog.cpp index be2b08d8a..ce8ac2557 100644 --- a/retroshare-gui/src/gui/gxs/GxsGroupFrameDialog.cpp +++ b/retroshare-gui/src/gui/gxs/GxsGroupFrameDialog.cpp @@ -61,7 +61,6 @@ * these will need to be addressed in the future. * -> Child TS (for sorting) is not handled by GXS, this will probably have to be done in the GUI. * -> Need to handle IDs properly. - * -> Popularity not handled in GXS yet. * -> Much more to do. */ @@ -655,6 +654,7 @@ void GxsGroupFrameDialog::groupInfoToGroupItemInfo(const RsGroupMetaData &groupI groupItemInfo.lastpost = QDateTime::fromTime_t(groupInfo.mLastPost); groupItemInfo.subscribeFlags = groupInfo.mSubscribeFlags; groupItemInfo.privatekey = IS_GROUP_PUBLISHER(groupInfo.mSubscribeFlags) ; + groupItemInfo.max_visible_posts = groupInfo.mVisibleMsgCount ; #if TOGXS if (groupInfo.mGroupFlags & RS_DISTRIB_AUTHEN_REQ) { @@ -904,7 +904,7 @@ void GxsGroupFrameDialog::loadGroupStatistics(const uint32_t &token) return; } - ui->groupTreeWidget->setUnreadCount(item, mCountChildMsgs ? (stats.mNumThreadMsgsUnread + stats.mNumChildMsgsUnread) : stats.mNumThreadMsgsUnread); + ui->groupTreeWidget->setUnreadCount(item, mCountChildMsgs ? (stats.mNumThreadMsgsUnread + stats.mNumChildMsgsUnread) : stats.mNumThreadMsgsUnread); } /*********************** **** **** **** ***********************/ diff --git a/retroshare-gui/src/gui/gxsforums/GxsForumThreadWidget.cpp b/retroshare-gui/src/gui/gxsforums/GxsForumThreadWidget.cpp index b13c0c275..db0a15460 100644 --- a/retroshare-gui/src/gui/gxsforums/GxsForumThreadWidget.cpp +++ b/retroshare-gui/src/gui/gxsforums/GxsForumThreadWidget.cpp @@ -691,8 +691,15 @@ void GxsForumThreadWidget::insertGroupData(const RsGxsForumGroup &group) #endif mSubscribeFlags = group.mMeta.mSubscribeFlags; - ui->forumName->setText(QString::fromUtf8(group.mMeta.mGroupName.c_str())); - mForumDescription = QString::fromUtf8(group.mDescription.c_str()); + ui->forumName->setText(QString::fromUtf8(group.mMeta.mGroupName.c_str())); + + mForumDescription = QString(); + mForumDescription += QString("Forum name: \t")+QString::fromStdString( group.mMeta.mGroupName)+"
" ; + mForumDescription += QString("Subscribers: \t")+QString::number( group.mMeta.mPop)+"
" ; + mForumDescription += QString("Posts: \t")+QString::number(group.mMeta.mVisibleMsgCount)+"
" ; + mForumDescription += QString("Description: ")+"

" ; + + mForumDescription += QString::fromUtf8(group.mDescription.c_str()); ui->subscribeToolButton->setSubscribed(IS_GROUP_SUBSCRIBED(mSubscribeFlags)); mStateHelper->setWidgetEnabled(ui->newthreadButton, (IS_GROUP_SUBSCRIBED(mSubscribeFlags)));