From 052a65219b019d3d7dcf23ae3f015ec5c1c0554d Mon Sep 17 00:00:00 2001 From: Gioacchino Mazzurco Date: Mon, 2 Jan 2017 22:29:22 +0100 Subject: [PATCH] Cleanup rstokenservice defines Removed unused defines Marked for future cleanup the ones the needed ones to refactor as inner enums in future --- libretroshare/src/gxs/rsgxsdataaccess.cc | 32 ++--------------- libretroshare/src/retroshare/rstokenservice.h | 35 ++++++++----------- 2 files changed, 17 insertions(+), 50 deletions(-) diff --git a/libretroshare/src/gxs/rsgxsdataaccess.cc b/libretroshare/src/gxs/rsgxsdataaccess.cc index 11cb4217e..5913b455d 100644 --- a/libretroshare/src/gxs/rsgxsdataaccess.cc +++ b/libretroshare/src/gxs/rsgxsdataaccess.cc @@ -28,31 +28,7 @@ #include "rsgxsdataaccess.h" #include "retroshare/rsgxsflags.h" -// This bit will be filled out over time. -#define RS_TOKREQOPT_MSG_VERSIONS 0x0001 // MSGRELATED: Returns All MsgIds with OrigMsgId = MsgId. -#define RS_TOKREQOPT_MSG_ORIGMSG 0x0002 // MSGLIST: All Unique OrigMsgIds in a Group. -#define RS_TOKREQOPT_MSG_LATEST 0x0004 // MSGLIST: All Latest MsgIds in Group. MSGRELATED: Latest MsgIds for Input Msgs. - -#define RS_TOKREQOPT_MSG_THREAD 0x0010 // MSGRELATED: All Msgs in Thread. MSGLIST: All Unique Thread Ids in Group. -#define RS_TOKREQOPT_MSG_PARENT 0x0020 // MSGRELATED: All Children Msgs. - -#define RS_TOKREQOPT_MSG_AUTHOR 0x0040 // MSGLIST: Messages from this AuthorId - - -// Status Filtering... should it be a different Option Field. -#define RS_TOKREQOPT_GROUP_UPDATED 0x0100 // GROUPLIST: Groups that have been updated. -#define RS_TOKREQOPT_MSG_UPDATED 0x0200 // MSGLIST: Msg that have been updated from specified groups. -#define RS_TOKREQOPT_MSG_UPDATED 0x0200 // MSGLIST: Msg that have been updated from specified groups. - -// Read Status. -#define RS_TOKREQOPT_READ 0x0001 -#define RS_TOKREQOPT_UNREAD 0x0002 - -#define RS_TOKREQ_ANSTYPE_LIST 0x0001 -#define RS_TOKREQ_ANSTYPE_SUMMARY 0x0002 -#define RS_TOKREQ_ANSTYPE_DATA 0x0003 - - +// TODO CLEANUP: This should be an enum defined in rstokenservice.h const uint8_t RsTokenService::GXS_REQUEST_V2_STATUS_FAILED = 0; const uint8_t RsTokenService::GXS_REQUEST_V2_STATUS_PENDING = 1; const uint8_t RsTokenService::GXS_REQUEST_V2_STATUS_PARTIAL = 2; @@ -65,10 +41,8 @@ * #define DATA_DEBUG 1 **********/ -RsGxsDataAccess::RsGxsDataAccess(RsGeneralDataService* ds) - : mDataStore(ds), mDataMutex("RsGxsDataAccess"), mNextToken(0) -{ -} +RsGxsDataAccess::RsGxsDataAccess(RsGeneralDataService* ds) : + mDataStore(ds), mDataMutex("RsGxsDataAccess"), mNextToken(0) {} bool RsGxsDataAccess::requestGroupInfo(uint32_t &token, uint32_t ansType, const RsTokReqOptions &opts, diff --git a/libretroshare/src/retroshare/rstokenservice.h b/libretroshare/src/retroshare/rstokenservice.h index 954148359..1ebef7080 100644 --- a/libretroshare/src/retroshare/rstokenservice.h +++ b/libretroshare/src/retroshare/rstokenservice.h @@ -30,9 +30,9 @@ #include #include -//#include "gxs/rsgxs.h" #include "retroshare/rsgxsifacetypes.h" +// TODO CLEANUP: GXS_REQUEST_TYPE_* should be an inner enum of RsTokReqOptions #define GXS_REQUEST_TYPE_GROUP_DATA 0x00010000 #define GXS_REQUEST_TYPE_GROUP_META 0x00020000 #define GXS_REQUEST_TYPE_GROUP_IDS 0x00040000 @@ -48,41 +48,33 @@ #define GXS_REQUEST_TYPE_SERVICE_STATS 0x03200000 -// This bit will be filled out over time. +// TODO CLEANUP: RS_TOKREQOPT_MSG_* should be an inner enum of RsTokReqOptions #define RS_TOKREQOPT_MSG_VERSIONS 0x0001 // MSGRELATED: Returns All MsgIds with OrigMsgId = MsgId. #define RS_TOKREQOPT_MSG_ORIGMSG 0x0002 // MSGLIST: All Unique OrigMsgIds in a Group. #define RS_TOKREQOPT_MSG_LATEST 0x0004 // MSGLIST: All Latest MsgIds in Group. MSGRELATED: Latest MsgIds for Input Msgs. - #define RS_TOKREQOPT_MSG_THREAD 0x0010 // MSGRELATED: All Msgs in Thread. MSGLIST: All Unique Thread Ids in Group. #define RS_TOKREQOPT_MSG_PARENT 0x0020 // MSGRELATED: All Children Msgs. - #define RS_TOKREQOPT_MSG_AUTHOR 0x0040 // MSGLIST: Messages from this AuthorId -// Read Status. -#define RS_TOKREQOPT_READ 0x0001 -#define RS_TOKREQOPT_UNREAD 0x0002 -#define RS_TOKREQ_ANSTYPE_LIST 0x0001 -#define RS_TOKREQ_ANSTYPE_SUMMARY 0x0002 -#define RS_TOKREQ_ANSTYPE_DATA 0x0003 -#define RS_TOKREQ_ANSTYPE_ACK 0x0004 +/* TODO CLEANUP: RS_TOKREQ_ANSTYPE_* values are not used by RsTokenService or + * its implementation, and may be arbitrarly defined by each GXS client, should + * be removed from here */ +#define RS_TOKREQ_ANSTYPE_LIST 0x0001 +#define RS_TOKREQ_ANSTYPE_SUMMARY 0x0002 +#define RS_TOKREQ_ANSTYPE_DATA 0x0003 +#define RS_TOKREQ_ANSTYPE_ACK 0x0004 /*! * This class provides useful generic support for GXS style services. * I expect much of this will be incorporated into the base GXS. */ -class RsTokReqOptions +struct RsTokReqOptions { -public: -RsTokReqOptions() -{ - mOptions = 0; - mStatusFilter = 0; mStatusMask = 0; mSubscribeFilter = 0; - mSubscribeMask = 0; - mMsgFlagMask = 0; mMsgFlagFilter = 0; - mBefore = 0; mAfter = 0; mReqType = 0; -} + RsTokReqOptions() : mOptions(0), mStatusFilter(0), mStatusMask(0), + mMsgFlagMask(0), mMsgFlagFilter(0), mReqType(0), mSubscribeFilter(0), + mSubscribeMask(0), mBefore(0), mAfter(0) {} uint32_t mOptions; @@ -115,6 +107,7 @@ class RsTokenService public: + // TODO CLEANUP: This should be an enum static const uint8_t GXS_REQUEST_V2_STATUS_FAILED; static const uint8_t GXS_REQUEST_V2_STATUS_PENDING; static const uint8_t GXS_REQUEST_V2_STATUS_PARTIAL;