diff --git a/libretroshare/src/gxs/rsgenexchange.cc b/libretroshare/src/gxs/rsgenexchange.cc index 7a7868c61..06b90ad17 100644 --- a/libretroshare/src/gxs/rsgenexchange.cc +++ b/libretroshare/src/gxs/rsgenexchange.cc @@ -238,11 +238,12 @@ void RsGenExchange::tick() bool RsGenExchange::messagePublicationTest(const RsGxsMsgMetaData& meta) { - time_t now = time(NULL) ; + time_t st = MESSAGE_STORE_PERIOD; + if(mNetService) st = mNetService->getKeepAge(meta.mGroupId, st); + time_t storageTimeLimit = meta.mPublishTs + st; - uint32_t store_limit = (mNetService == NULL)?MESSAGE_STORE_PERIOD:mNetService->getKeepAge(meta.mGroupId,MESSAGE_STORE_PERIOD) ; - - return meta.mMsgStatus & GXS_SERV::GXS_MSG_STATUS_KEEP || store_limit == 0 || meta.mPublishTs + store_limit >= now ; + return meta.mMsgStatus & GXS_SERV::GXS_MSG_STATUS_KEEP || + storageTimeLimit == 0 || storageTimeLimit >= time(NULL); } bool RsGenExchange::acknowledgeTokenMsg(const uint32_t& token, diff --git a/libretroshare/src/gxs/rsgenexchange.h b/libretroshare/src/gxs/rsgenexchange.h index 735e8ec38..6196b51af 100644 --- a/libretroshare/src/gxs/rsgenexchange.h +++ b/libretroshare/src/gxs/rsgenexchange.h @@ -428,11 +428,10 @@ protected: public: /*! - * Assigns a token value to passed integer - * The status of the token can still be queried from request status feature - * @warning the token space is shared with RsGenExchange backend, so do not - * modify tokens except does you have created by calling generatePublicToken() - * @return token + * Generate a new token, the status of the token can be queried from request + * status feature. + * @attention the token space is shared with RsGenExchange backend. + * @return Generated token */ uint32_t generatePublicToken(); @@ -486,7 +485,7 @@ public: * This allows the client service to acknowledge that their grps has \n * been created/modified and retrieve the create/modified grp ids * @param token the token related to modification/create request - * @param msgIds vector of ids of groups created/modified + * @param grpId ids of created/modified group * @return true if token exists false otherwise */ bool acknowledgeTokenGrp(const uint32_t& token, RsGxsGroupId& grpId); diff --git a/libretroshare/src/retroshare/rsgxsifacetypes.h b/libretroshare/src/retroshare/rsgxsifacetypes.h index 1c832bff5..5b82d1d14 100644 --- a/libretroshare/src/retroshare/rsgxsifacetypes.h +++ b/libretroshare/src/retroshare/rsgxsifacetypes.h @@ -34,26 +34,11 @@ class RsGxsGrpMetaData; class RsGxsMsgMetaData; -class RsGroupMetaData +struct RsGroupMetaData { -public: - - RsGroupMetaData() - { - mGroupFlags = 0; - mSignFlags = 0; - mSubscribeFlags = 0; - - mPop = 0; - mVisibleMsgCount = 0; - mLastPost = 0; - - mGroupStatus = 0; - mCircleType = 0; - mAuthenFlags = 0; - - mPublishTs = 0; - } + RsGroupMetaData() : mGroupFlags(0), mSignFlags(0), mPublishTs(0), + mCircleType(0), mAuthenFlags(0), mSubscribeFlags(0), mPop(0), + mVisibleMsgCount(0), mLastPost(0), mGroupStatus(0) {} void operator =(const RsGxsGrpMetaData& rGxsMeta); @@ -90,19 +75,9 @@ public: -class RsMsgMetaData +struct RsMsgMetaData { - -public: - - RsMsgMetaData() - { - mPublishTs = 0; - mMsgFlags = 0; - - mMsgStatus = 0; - mChildTs = 0; - } + RsMsgMetaData() : mPublishTs(0), mMsgFlags(0), mMsgStatus(0), mChildTs(0) {} void operator =(const RsGxsMsgMetaData& rGxsMeta); diff --git a/libretroshare/src/retroshare/rsgxsservice.h b/libretroshare/src/retroshare/rsgxsservice.h index 47f546c35..8f26e5262 100644 --- a/libretroshare/src/retroshare/rsgxsservice.h +++ b/libretroshare/src/retroshare/rsgxsservice.h @@ -11,22 +11,17 @@ typedef std::map > GxsMsgMetaMap; typedef std::map > GxsMsgRelatedMetaMap; /*! - * The aim of this class is to abstract - * how changes are represented so - * they can be determined outside the - * client API without explcitly - * enumerating all possible changes - * at the interface + * The aim of this class is to abstract how changes are represented so they can + * be determined outside the client API without explcitly enumerating all + * possible changes at the interface */ -class RsGxsNotify +struct RsGxsNotify { -public: - - enum NotifyType { TYPE_PUBLISH, TYPE_RECEIVE, TYPE_PROCESSED, TYPE_PUBLISHKEY }; - - virtual ~RsGxsNotify() {return; } - virtual NotifyType getType() = 0; + enum NotifyType + { TYPE_PUBLISH, TYPE_RECEIVE, TYPE_PROCESSED, TYPE_PUBLISHKEY }; + virtual ~RsGxsNotify() {} + virtual NotifyType getType() = 0; }; /*! diff --git a/libretroshare/src/services/p3gxsforums.cc b/libretroshare/src/services/p3gxsforums.cc index e8b1affeb..f27c255dd 100644 --- a/libretroshare/src/services/p3gxsforums.cc +++ b/libretroshare/src/services/p3gxsforums.cc @@ -53,17 +53,15 @@ const uint32_t GXSFORUMS_MSG_STORE_PERIOD = 60*60*24*31*12; // 12 months / 1 yea /******************* Startup / Tick ******************************************/ /********************************************************************************/ -p3GxsForums::p3GxsForums(RsGeneralDataService *gds, RsNetworkExchangeService *nes, RsGixs* gixs) - : RsGenExchange(gds, nes, new RsGxsForumSerialiser(), RS_SERVICE_GXS_TYPE_FORUMS, gixs, forumsAuthenPolicy(), GXSFORUMS_MSG_STORE_PERIOD), RsGxsForums(this) +p3GxsForums::p3GxsForums( RsGeneralDataService *gds, + RsNetworkExchangeService *nes, RsGixs* gixs ) : + RsGenExchange( gds, nes, new RsGxsForumSerialiser(), + RS_SERVICE_GXS_TYPE_FORUMS, gixs, forumsAuthenPolicy(), + GXSFORUMS_MSG_STORE_PERIOD), + RsGxsForums(this), mGenToken(0), mGenActive(false), mGenCount(0) { - // For Dummy Msgs. - mGenActive = false; - mGenCount = 0; - mGenToken = 0; - // Test Data disabled in Repo. //RsTickEvent::schedule_in(FORUM_TESTEVENT_DUMMYDATA, DUMMYDATA_PERIOD); - }