mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-01-29 00:37:10 -05:00
Expose tokenservice methods trough GxsIfaceHelper
This commit is contained in:
parent
2f4b9b3e20
commit
d731b665db
@ -85,7 +85,7 @@ struct MsgSizeCount
|
|||||||
* @see GxsTransClient::receiveGxsTransMail(...),
|
* @see GxsTransClient::receiveGxsTransMail(...),
|
||||||
* @see GxsTransClient::notifyGxsTransSendStatus(...).
|
* @see GxsTransClient::notifyGxsTransSendStatus(...).
|
||||||
*/
|
*/
|
||||||
class p3GxsTrans : public RsGenExchange, public GxsTokenQueue, public p3Config, public RsGxsTrans
|
struct p3GxsTrans : RsGenExchange, GxsTokenQueue, p3Config, RsGxsTrans
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
p3GxsTrans( RsGeneralDataService* gds, RsNetworkExchangeService* nes,
|
p3GxsTrans( RsGeneralDataService* gds, RsNetworkExchangeService* nes,
|
||||||
@ -94,17 +94,16 @@ public:
|
|||||||
RS_SERVICE_TYPE_GXS_TRANS, &identities,
|
RS_SERVICE_TYPE_GXS_TRANS, &identities,
|
||||||
AuthenPolicy()),
|
AuthenPolicy()),
|
||||||
GxsTokenQueue(this),
|
GxsTokenQueue(this),
|
||||||
RsGxsTrans(this),
|
RsGxsTrans(static_cast<RsGxsIface&>(*this)),
|
||||||
mIdService(identities),
|
// always check 30 secs after start)
|
||||||
|
mLastMsgCleanup(time(NULL) - MAX_DELAY_BETWEEN_CLEANUPS + 30),
|
||||||
|
mIdService(identities),
|
||||||
mServClientsMutex("p3GxsTrans client services map mutex"),
|
mServClientsMutex("p3GxsTrans client services map mutex"),
|
||||||
mOutgoingMutex("p3GxsTrans outgoing queue map mutex"),
|
mOutgoingMutex("p3GxsTrans outgoing queue map mutex"),
|
||||||
mIngoingMutex("p3GxsTrans ingoing queue map mutex"),
|
mIngoingMutex("p3GxsTrans ingoing queue map mutex"),
|
||||||
|
mCleanupThread(nullptr),
|
||||||
mPerUserStatsMutex("p3GxsTrans user stats mutex"),
|
mPerUserStatsMutex("p3GxsTrans user stats mutex"),
|
||||||
mDataMutex("p3GxsTrans data mutex")
|
mDataMutex("p3GxsTrans data mutex") {}
|
||||||
{
|
|
||||||
mLastMsgCleanup = time(NULL) - MAX_DELAY_BETWEEN_CLEANUPS + 30; // always check 30 secs after start
|
|
||||||
mCleanupThread = NULL ;
|
|
||||||
}
|
|
||||||
|
|
||||||
virtual ~p3GxsTrans();
|
virtual ~p3GxsTrans();
|
||||||
|
|
||||||
|
@ -105,8 +105,7 @@ class RsGxsChannels: public RsGxsIfaceHelper, public RsGxsCommentService
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
|
||||||
explicit RsGxsChannels(RsGxsIface *gxs)
|
explicit RsGxsChannels(RsGxsIface& gxs) : RsGxsIfaceHelper(gxs) {}
|
||||||
:RsGxsIfaceHelper(gxs) {}
|
|
||||||
virtual ~RsGxsChannels() {}
|
virtual ~RsGxsChannels() {}
|
||||||
|
|
||||||
/* Specific Service Data */
|
/* Specific Service Data */
|
||||||
|
@ -127,8 +127,8 @@ class RsGxsCircles: public RsGxsIfaceHelper
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
|
||||||
RsGxsCircles(RsGxsIface *gxs) :RsGxsIfaceHelper(gxs) { return; }
|
RsGxsCircles(RsGxsIface& gxs) :RsGxsIfaceHelper(gxs) {}
|
||||||
virtual ~RsGxsCircles() { return; }
|
virtual ~RsGxsCircles() {}
|
||||||
|
|
||||||
/* External Interface (Cached stuff) */
|
/* External Interface (Cached stuff) */
|
||||||
virtual bool getCircleDetails(const RsGxsCircleId &id, RsGxsCircleDetails &details) = 0;
|
virtual bool getCircleDetails(const RsGxsCircleId &id, RsGxsCircleDetails &details) = 0;
|
||||||
|
@ -63,8 +63,7 @@ class RsGxsForums: public RsGxsIfaceHelper
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
|
||||||
explicit RsGxsForums(RsGxsIface *gxs)
|
explicit RsGxsForums(RsGxsIface& gxs) : RsGxsIfaceHelper(gxs) {}
|
||||||
:RsGxsIfaceHelper(gxs) {}
|
|
||||||
virtual ~RsGxsForums() {}
|
virtual ~RsGxsForums() {}
|
||||||
|
|
||||||
/* Specific Service Data */
|
/* Specific Service Data */
|
||||||
|
@ -35,9 +35,8 @@
|
|||||||
/*!
|
/*!
|
||||||
* Stores ids of changed gxs groups and messages. It is used to notify the GUI about changes.
|
* Stores ids of changed gxs groups and messages. It is used to notify the GUI about changes.
|
||||||
*/
|
*/
|
||||||
class RsGxsChanges
|
struct RsGxsChanges
|
||||||
{
|
{
|
||||||
public:
|
|
||||||
RsGxsChanges(): mService(0){}
|
RsGxsChanges(): mService(0){}
|
||||||
RsTokenService *mService;
|
RsTokenService *mService;
|
||||||
std::map<RsGxsGroupId, std::set<RsGxsMessageId> > mMsgs;
|
std::map<RsGxsGroupId, std::set<RsGxsMessageId> > mMsgs;
|
||||||
@ -49,13 +48,9 @@ public:
|
|||||||
/*!
|
/*!
|
||||||
* All implementations must offer thread safety
|
* All implementations must offer thread safety
|
||||||
*/
|
*/
|
||||||
class RsGxsIface
|
struct RsGxsIface
|
||||||
{
|
{
|
||||||
public:
|
virtual ~RsGxsIface() {}
|
||||||
|
|
||||||
virtual ~RsGxsIface(){};
|
|
||||||
|
|
||||||
public:
|
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* Gxs services should call this for automatic handling of
|
* Gxs services should call this for automatic handling of
|
||||||
|
@ -7,6 +7,7 @@
|
|||||||
* RetroShare GXS. Convenience interface implementation
|
* RetroShare GXS. Convenience interface implementation
|
||||||
*
|
*
|
||||||
* Copyright 2012 by Christopher Evi-Parker
|
* Copyright 2012 by Christopher Evi-Parker
|
||||||
|
* Copyright (C) 2018 Gioacchino Mazzurco <gio@eigenlab.org>
|
||||||
*
|
*
|
||||||
* This library is free software; you can redistribute it and/or
|
* This library is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU Library General Public
|
* modify it under the terms of the GNU Library General Public
|
||||||
@ -29,26 +30,24 @@
|
|||||||
#include "retroshare/rsgxsiface.h"
|
#include "retroshare/rsgxsiface.h"
|
||||||
#include "retroshare/rsreputations.h"
|
#include "retroshare/rsreputations.h"
|
||||||
#include "rsgxsflags.h"
|
#include "rsgxsflags.h"
|
||||||
|
#include "util/rsdeprecate.h"
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* The simple idea of this class is to implement the simple interface functions
|
* This class only make method of internal members visible tu upper level to
|
||||||
* of gen exchange.
|
* offer a more friendly API.
|
||||||
* This class provides convenience implementations of:
|
* This is just a workaround to awkward GXS API design, do not take it as an
|
||||||
* - Handle msg and group changes (client class must pass changes sent by RsGenExchange to it)
|
* example for your coding.
|
||||||
* - subscription to groups
|
* To properly fix the API design many changes with the implied chain reactions
|
||||||
* - retrieval of msgs and group ids and meta info
|
* are necessary, so at this point this workaround seems acceptable.
|
||||||
*/
|
*/
|
||||||
class RsGxsIfaceHelper
|
struct RsGxsIfaceHelper
|
||||||
{
|
{
|
||||||
public:
|
/*!
|
||||||
|
* @param gxs handle to RsGenExchange instance of service (Usually the
|
||||||
/*!
|
* service class itself)
|
||||||
*
|
*/
|
||||||
* @param gxs handle to RsGenExchange instance of service (Usually the service class itself)
|
RsGxsIfaceHelper(RsGxsIface& gxs) :
|
||||||
*/
|
mGxs(gxs), mTokenService(*gxs.getTokenService()) {}
|
||||||
RsGxsIfaceHelper(RsGxsIface* gxs)
|
|
||||||
: mGxs(gxs)
|
|
||||||
{}
|
|
||||||
|
|
||||||
~RsGxsIfaceHelper(){}
|
~RsGxsIfaceHelper(){}
|
||||||
|
|
||||||
@ -59,15 +58,7 @@ public:
|
|||||||
*/
|
*/
|
||||||
void receiveChanges(std::vector<RsGxsNotify *> &changes)
|
void receiveChanges(std::vector<RsGxsNotify *> &changes)
|
||||||
{
|
{
|
||||||
mGxs->receiveChanges(changes);
|
mGxs.receiveChanges(changes);
|
||||||
}
|
|
||||||
|
|
||||||
/*!
|
|
||||||
* @return handle to token service for this GXS service
|
|
||||||
*/
|
|
||||||
RsTokenService* getTokenService()
|
|
||||||
{
|
|
||||||
return mGxs->getTokenService();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Generic Lists */
|
/* Generic Lists */
|
||||||
@ -81,7 +72,7 @@ public:
|
|||||||
bool getGroupList(const uint32_t &token,
|
bool getGroupList(const uint32_t &token,
|
||||||
std::list<RsGxsGroupId> &groupIds)
|
std::list<RsGxsGroupId> &groupIds)
|
||||||
{
|
{
|
||||||
return mGxs->getGroupList(token, groupIds);
|
return mGxs.getGroupList(token, groupIds);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
@ -93,7 +84,7 @@ public:
|
|||||||
bool getMsgList(const uint32_t &token,
|
bool getMsgList(const uint32_t &token,
|
||||||
GxsMsgIdResult& msgIds)
|
GxsMsgIdResult& msgIds)
|
||||||
{
|
{
|
||||||
return mGxs->getMsgList(token, msgIds);
|
return mGxs.getMsgList(token, msgIds);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
@ -104,7 +95,7 @@ public:
|
|||||||
*/
|
*/
|
||||||
bool getMsgRelatedList(const uint32_t &token, MsgRelatedIdResult &msgIds)
|
bool getMsgRelatedList(const uint32_t &token, MsgRelatedIdResult &msgIds)
|
||||||
{
|
{
|
||||||
return mGxs->getMsgRelatedList(token, msgIds);
|
return mGxs.getMsgRelatedList(token, msgIds);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
@ -115,7 +106,7 @@ public:
|
|||||||
bool getGroupSummary(const uint32_t &token,
|
bool getGroupSummary(const uint32_t &token,
|
||||||
std::list<RsGroupMetaData> &groupInfo)
|
std::list<RsGroupMetaData> &groupInfo)
|
||||||
{
|
{
|
||||||
return mGxs->getGroupMeta(token, groupInfo);
|
return mGxs.getGroupMeta(token, groupInfo);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
@ -126,7 +117,7 @@ public:
|
|||||||
bool getMsgSummary(const uint32_t &token,
|
bool getMsgSummary(const uint32_t &token,
|
||||||
GxsMsgMetaMap &msgInfo)
|
GxsMsgMetaMap &msgInfo)
|
||||||
{
|
{
|
||||||
return mGxs->getMsgMeta(token, msgInfo);
|
return mGxs.getMsgMeta(token, msgInfo);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
@ -136,7 +127,7 @@ public:
|
|||||||
*/
|
*/
|
||||||
bool getMsgRelatedSummary(const uint32_t &token, GxsMsgRelatedMetaMap &msgInfo)
|
bool getMsgRelatedSummary(const uint32_t &token, GxsMsgRelatedMetaMap &msgInfo)
|
||||||
{
|
{
|
||||||
return mGxs->getMsgRelatedMeta(token, msgInfo);
|
return mGxs.getMsgRelatedMeta(token, msgInfo);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
@ -147,7 +138,7 @@ public:
|
|||||||
*/
|
*/
|
||||||
bool subscribeToGroup(uint32_t& token, const RsGxsGroupId& grpId, bool subscribe)
|
bool subscribeToGroup(uint32_t& token, const RsGxsGroupId& grpId, bool subscribe)
|
||||||
{
|
{
|
||||||
return mGxs->subscribeToGroup(token, grpId, subscribe);
|
return mGxs.subscribeToGroup(token, grpId, subscribe);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
@ -159,7 +150,7 @@ public:
|
|||||||
*/
|
*/
|
||||||
bool acknowledgeMsg(const uint32_t& token, std::pair<RsGxsGroupId, RsGxsMessageId>& msgId)
|
bool acknowledgeMsg(const uint32_t& token, std::pair<RsGxsGroupId, RsGxsMessageId>& msgId)
|
||||||
{
|
{
|
||||||
return mGxs->acknowledgeTokenMsg(token, msgId);
|
return mGxs.acknowledgeTokenMsg(token, msgId);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
@ -171,7 +162,7 @@ public:
|
|||||||
*/
|
*/
|
||||||
bool acknowledgeGrp(const uint32_t& token, RsGxsGroupId& grpId)
|
bool acknowledgeGrp(const uint32_t& token, RsGxsGroupId& grpId)
|
||||||
{
|
{
|
||||||
return mGxs->acknowledgeTokenGrp(token, grpId);
|
return mGxs.acknowledgeTokenGrp(token, grpId);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
@ -182,7 +173,7 @@ public:
|
|||||||
*/
|
*/
|
||||||
bool getServiceStatistic(const uint32_t& token, GxsServiceStatistic& stats)
|
bool getServiceStatistic(const uint32_t& token, GxsServiceStatistic& stats)
|
||||||
{
|
{
|
||||||
return mGxs->getServiceStatistic(token, stats);
|
return mGxs.getServiceStatistic(token, stats);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
@ -193,7 +184,7 @@ public:
|
|||||||
*/
|
*/
|
||||||
bool getGroupStatistic(const uint32_t& token, GxsGroupStatistic& stats)
|
bool getGroupStatistic(const uint32_t& token, GxsGroupStatistic& stats)
|
||||||
{
|
{
|
||||||
return mGxs->getGroupStatistic(token, stats);
|
return mGxs.getGroupStatistic(token, stats);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
@ -206,7 +197,7 @@ public:
|
|||||||
*/
|
*/
|
||||||
void setGroupReputationCutOff(uint32_t& token, const RsGxsGroupId& grpId, int CutOff)
|
void setGroupReputationCutOff(uint32_t& token, const RsGxsGroupId& grpId, int CutOff)
|
||||||
{
|
{
|
||||||
return mGxs->setGroupReputationCutOff(token, grpId, CutOff);
|
return mGxs.setGroupReputationCutOff(token, grpId, CutOff);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
@ -214,36 +205,86 @@ public:
|
|||||||
*/
|
*/
|
||||||
uint32_t getDefaultStoragePeriod()
|
uint32_t getDefaultStoragePeriod()
|
||||||
{
|
{
|
||||||
return mGxs->getDefaultStoragePeriod();
|
return mGxs.getDefaultStoragePeriod();
|
||||||
}
|
}
|
||||||
uint32_t getStoragePeriod(const RsGxsGroupId& grpId)
|
uint32_t getStoragePeriod(const RsGxsGroupId& grpId)
|
||||||
{
|
{
|
||||||
return mGxs->getStoragePeriod(grpId);
|
return mGxs.getStoragePeriod(grpId);
|
||||||
}
|
}
|
||||||
void setStoragePeriod(const RsGxsGroupId& grpId,uint32_t age_in_secs)
|
void setStoragePeriod(const RsGxsGroupId& grpId,uint32_t age_in_secs)
|
||||||
{
|
{
|
||||||
mGxs->setStoragePeriod(grpId,age_in_secs);
|
mGxs.setStoragePeriod(grpId,age_in_secs);
|
||||||
}
|
}
|
||||||
uint32_t getDefaultSyncPeriod()
|
uint32_t getDefaultSyncPeriod()
|
||||||
{
|
{
|
||||||
return mGxs->getDefaultSyncPeriod();
|
return mGxs.getDefaultSyncPeriod();
|
||||||
}
|
}
|
||||||
uint32_t getSyncPeriod(const RsGxsGroupId& grpId)
|
uint32_t getSyncPeriod(const RsGxsGroupId& grpId)
|
||||||
{
|
{
|
||||||
return mGxs->getSyncPeriod(grpId);
|
return mGxs.getSyncPeriod(grpId);
|
||||||
}
|
}
|
||||||
void setSyncPeriod(const RsGxsGroupId& grpId,uint32_t age_in_secs)
|
void setSyncPeriod(const RsGxsGroupId& grpId,uint32_t age_in_secs)
|
||||||
{
|
{
|
||||||
mGxs->setSyncPeriod(grpId,age_in_secs);
|
mGxs.setSyncPeriod(grpId,age_in_secs);
|
||||||
}
|
}
|
||||||
|
|
||||||
RsReputations::ReputationLevel minReputationForForwardingMessages(uint32_t group_sign_flags,uint32_t identity_flags)
|
RsReputations::ReputationLevel minReputationForForwardingMessages(uint32_t group_sign_flags,uint32_t identity_flags)
|
||||||
{
|
{
|
||||||
return mGxs->minReputationForForwardingMessages(group_sign_flags,identity_flags);
|
return mGxs.minReputationForForwardingMessages(group_sign_flags,identity_flags);
|
||||||
}
|
}
|
||||||
private:
|
|
||||||
|
|
||||||
RsGxsIface* mGxs;
|
/// @see RsTokenService::requestGroupInfo
|
||||||
|
bool requestGroupInfo( uint32_t& token, const RsTokReqOptions& opts,
|
||||||
|
const std::list<RsGxsGroupId> &groupIds )
|
||||||
|
{ return mTokenService.requestGroupInfo(token, 0, opts, groupIds); }
|
||||||
|
|
||||||
|
/// @see RsTokenService::requestGroupInfo
|
||||||
|
bool requestGroupInfo(uint32_t& token, const RsTokReqOptions& opts)
|
||||||
|
{ return mTokenService.requestGroupInfo(token, 0, opts); }
|
||||||
|
|
||||||
|
/// @see RsTokenService::requestMsgInfo
|
||||||
|
bool requestMsgInfo( uint32_t& token,
|
||||||
|
const RsTokReqOptions& opts, const GxsMsgReq& msgIds )
|
||||||
|
{ return mTokenService.requestMsgInfo(token, 0, opts, msgIds); }
|
||||||
|
|
||||||
|
/// @see RsTokenService::requestMsgInfo
|
||||||
|
bool requestMsgInfo(
|
||||||
|
uint32_t& token, const RsTokReqOptions& opts,
|
||||||
|
const std::list<RsGxsGroupId>& grpIds )
|
||||||
|
{ return mTokenService.requestMsgInfo(token, 0, opts, grpIds); }
|
||||||
|
|
||||||
|
/// @see RsTokenService::requestMsgRelatedInfo
|
||||||
|
bool requestMsgRelatedInfo(
|
||||||
|
uint32_t& token, const RsTokReqOptions& opts,
|
||||||
|
const std::vector<RsGxsGrpMsgIdPair>& msgIds )
|
||||||
|
{ return mTokenService.requestMsgRelatedInfo(token, 0, opts, msgIds); }
|
||||||
|
|
||||||
|
/// @see RsTokenService::requestStatus
|
||||||
|
RsTokenService::GxsRequestStatus requestStatus(uint32_t token)
|
||||||
|
{ return mTokenService.requestStatus(token); }
|
||||||
|
|
||||||
|
/// @see RsTokenService::requestServiceStatistic
|
||||||
|
void requestServiceStatistic(uint32_t& token)
|
||||||
|
{ mTokenService.requestServiceStatistic(token); }
|
||||||
|
|
||||||
|
/// @see RsTokenService::requestGroupStatistic
|
||||||
|
void requestGroupStatistic(uint32_t& token, const RsGxsGroupId& grpId)
|
||||||
|
{ mTokenService.requestGroupStatistic(token, grpId); }
|
||||||
|
|
||||||
|
/// @see RsTokenService::cancelRequest
|
||||||
|
bool cancelRequest(uint32_t token)
|
||||||
|
{ return mTokenService.cancelRequest(token); }
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @deprecated
|
||||||
|
* Token service methods are already exposed by this helper, so you should
|
||||||
|
* not need to get token service pointer directly anymore.
|
||||||
|
*/
|
||||||
|
RS_DEPRECATED RsTokenService* getTokenService() { return &mTokenService; }
|
||||||
|
|
||||||
|
private:
|
||||||
|
RsGxsIface& mGxs;
|
||||||
|
RsTokenService& mTokenService;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // RSGXSIFACEIMPL_H
|
#endif // RSGXSIFACEIMPL_H
|
||||||
|
@ -91,7 +91,7 @@ public:
|
|||||||
std::vector<RsGxsTransOutgoingRecord> outgoing_records;
|
std::vector<RsGxsTransOutgoingRecord> outgoing_records;
|
||||||
};
|
};
|
||||||
|
|
||||||
RsGxsTrans(RsGxsIface *gxs) : RsGxsIfaceHelper(gxs) {}
|
RsGxsTrans(RsGxsIface& gxs) : RsGxsIfaceHelper(gxs) {}
|
||||||
|
|
||||||
virtual ~RsGxsTrans() {}
|
virtual ~RsGxsTrans() {}
|
||||||
|
|
||||||
|
@ -343,7 +343,7 @@ struct RsIdentityDetails : RsSerializable
|
|||||||
|
|
||||||
struct RsIdentity : RsGxsIfaceHelper
|
struct RsIdentity : RsGxsIfaceHelper
|
||||||
{
|
{
|
||||||
explicit RsIdentity(RsGxsIface *gxs): RsGxsIfaceHelper(gxs) {}
|
explicit RsIdentity(RsGxsIface& gxs): RsGxsIfaceHelper(gxs) {}
|
||||||
virtual ~RsIdentity() {}
|
virtual ~RsIdentity() {}
|
||||||
|
|
||||||
/********************************************************************************************/
|
/********************************************************************************************/
|
||||||
|
@ -78,7 +78,7 @@ class RsPosted : public RsGxsIfaceHelper, public RsGxsCommentService
|
|||||||
//static const uint32_t FLAG_MSGTYPE_POST;
|
//static const uint32_t FLAG_MSGTYPE_POST;
|
||||||
//static const uint32_t FLAG_MSGTYPE_MASK;
|
//static const uint32_t FLAG_MSGTYPE_MASK;
|
||||||
|
|
||||||
explicit RsPosted(RsGxsIface* gxs) : RsGxsIfaceHelper(gxs) {}
|
explicit RsPosted(RsGxsIface& gxs) : RsGxsIfaceHelper(gxs) {}
|
||||||
virtual ~RsPosted() {}
|
virtual ~RsPosted() {}
|
||||||
|
|
||||||
/* Specific Service Data */
|
/* Specific Service Data */
|
||||||
|
@ -220,19 +220,14 @@ public:
|
|||||||
*/
|
*/
|
||||||
virtual void requestGroupStatistic(uint32_t& token, const RsGxsGroupId& grpId) = 0;
|
virtual void requestGroupStatistic(uint32_t& token, const RsGxsGroupId& grpId) = 0;
|
||||||
|
|
||||||
|
/*!
|
||||||
/* Cancel Request */
|
* @brief Cancel Request
|
||||||
|
* If this function returns false, it may be that the request has completed
|
||||||
/*!
|
* already. Useful for very expensive request.
|
||||||
* If this function returns false, it may be that the request has completed
|
* @param token the token of the request to cancel
|
||||||
* already. Useful for very expensive request. This is a blocking operation
|
* @return false if unusuccessful in cancelling request, true if successful
|
||||||
* @param token the token of the request to cancel
|
*/
|
||||||
* @return false if unusuccessful in cancelling request, true if successful
|
virtual bool cancelRequest(const uint32_t &token) = 0;
|
||||||
*/
|
|
||||||
virtual bool cancelRequest(const uint32_t &token) = 0;
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // RSTOKENSERVICE_H
|
#endif // RSTOKENSERVICE_H
|
||||||
|
@ -115,10 +115,10 @@ std::ostream &operator<<(std::ostream &out, const RsWikiComment &comment);
|
|||||||
|
|
||||||
class RsWiki: public RsGxsIfaceHelper
|
class RsWiki: public RsGxsIfaceHelper
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
|
||||||
RsWiki(RsGxsIface *gxs): RsGxsIfaceHelper(gxs) { return; }
|
RsWiki(RsGxsIface& gxs): RsGxsIfaceHelper(gxs) {}
|
||||||
virtual ~RsWiki() { return; }
|
virtual ~RsWiki() {}
|
||||||
|
|
||||||
/* Specific Service Data */
|
/* Specific Service Data */
|
||||||
virtual bool getCollections(const uint32_t &token, std::vector<RsWikiCollection> &collections) = 0;
|
virtual bool getCollections(const uint32_t &token, std::vector<RsWikiCollection> &collections) = 0;
|
||||||
|
@ -108,7 +108,7 @@ class RsWire: public RsGxsIfaceHelper
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
|
||||||
explicit RsWire(RsGxsIface *gxs): RsGxsIfaceHelper(gxs) {}
|
explicit RsWire(RsGxsIface& gxs) : RsGxsIfaceHelper(gxs) {}
|
||||||
virtual ~RsWire() {}
|
virtual ~RsWire() {}
|
||||||
|
|
||||||
/* Specific Service Data */
|
/* Specific Service Data */
|
||||||
|
@ -68,8 +68,12 @@ RsGxsChannels *rsGxsChannels = NULL;
|
|||||||
/******************* Startup / Tick ******************************************/
|
/******************* Startup / Tick ******************************************/
|
||||||
/********************************************************************************/
|
/********************************************************************************/
|
||||||
|
|
||||||
p3GxsChannels::p3GxsChannels(RsGeneralDataService *gds, RsNetworkExchangeService *nes, RsGixs* gixs)
|
p3GxsChannels::p3GxsChannels(
|
||||||
: RsGenExchange(gds, nes, new RsGxsChannelSerialiser(), RS_SERVICE_GXS_TYPE_CHANNELS, gixs, channelsAuthenPolicy()), RsGxsChannels(this), GxsTokenQueue(this)
|
RsGeneralDataService *gds, RsNetworkExchangeService *nes,
|
||||||
|
RsGixs* gixs ) :
|
||||||
|
RsGenExchange( gds, nes, new RsGxsChannelSerialiser(),
|
||||||
|
RS_SERVICE_GXS_TYPE_CHANNELS, gixs, channelsAuthenPolicy() ),
|
||||||
|
RsGxsChannels(static_cast<RsGxsIface&>(*this)), GxsTokenQueue(this)
|
||||||
{
|
{
|
||||||
// For Dummy Msgs.
|
// For Dummy Msgs.
|
||||||
mGenActive = false;
|
mGenActive = false;
|
||||||
|
@ -111,16 +111,16 @@ RsGxsCircles *rsGxsCircles = NULL;
|
|||||||
/******************* Startup / Tick ******************************************/
|
/******************* Startup / Tick ******************************************/
|
||||||
/********************************************************************************/
|
/********************************************************************************/
|
||||||
|
|
||||||
p3GxsCircles::p3GxsCircles(RsGeneralDataService *gds, RsNetworkExchangeService *nes,
|
p3GxsCircles::p3GxsCircles(
|
||||||
p3IdService *identities, PgpAuxUtils *pgpUtils)
|
RsGeneralDataService *gds, RsNetworkExchangeService *nes,
|
||||||
: RsGxsCircleExchange(gds, nes, new RsGxsCircleSerialiser(),
|
p3IdService *identities, PgpAuxUtils *pgpUtils) :
|
||||||
RS_SERVICE_GXS_TYPE_GXSCIRCLE, identities, circleAuthenPolicy()),
|
RsGxsCircleExchange(
|
||||||
RsGxsCircles(this), GxsTokenQueue(this), RsTickEvent(),
|
gds, nes, new RsGxsCircleSerialiser(), RS_SERVICE_GXS_TYPE_GXSCIRCLE,
|
||||||
mIdentities(identities),
|
identities, circleAuthenPolicy() ),
|
||||||
mPgpUtils(pgpUtils),
|
RsGxsCircles(static_cast<RsGxsIface&>(*this)), GxsTokenQueue(this),
|
||||||
mCircleMtx("p3GxsCircles"),
|
RsTickEvent(), mIdentities(identities), mPgpUtils(pgpUtils),
|
||||||
mCircleCache(DEFAULT_MEM_CACHE_SIZE, "GxsCircleCache")
|
mCircleMtx("p3GxsCircles"),
|
||||||
|
mCircleCache(DEFAULT_MEM_CACHE_SIZE, "GxsCircleCache" )
|
||||||
{
|
{
|
||||||
// Kick off Cache Testing, + Others.
|
// Kick off Cache Testing, + Others.
|
||||||
//RsTickEvent::schedule_in(CIRCLE_EVENT_CACHETEST, CACHETEST_PERIOD);
|
//RsTickEvent::schedule_in(CIRCLE_EVENT_CACHETEST, CACHETEST_PERIOD);
|
||||||
|
@ -55,7 +55,8 @@ p3GxsForums::p3GxsForums( RsGeneralDataService *gds,
|
|||||||
RsNetworkExchangeService *nes, RsGixs* gixs ) :
|
RsNetworkExchangeService *nes, RsGixs* gixs ) :
|
||||||
RsGenExchange( gds, nes, new RsGxsForumSerialiser(),
|
RsGenExchange( gds, nes, new RsGxsForumSerialiser(),
|
||||||
RS_SERVICE_GXS_TYPE_FORUMS, gixs, forumsAuthenPolicy()),
|
RS_SERVICE_GXS_TYPE_FORUMS, gixs, forumsAuthenPolicy()),
|
||||||
RsGxsForums(this), mGenToken(0), mGenActive(false), mGenCount(0)
|
RsGxsForums(static_cast<RsGxsIface&>(*this)), mGenToken(0),
|
||||||
|
mGenActive(false), mGenCount(0)
|
||||||
{
|
{
|
||||||
// Test Data disabled in Repo.
|
// Test Data disabled in Repo.
|
||||||
//RsTickEvent::schedule_in(FORUM_TESTEVENT_DUMMYDATA, DUMMYDATA_PERIOD);
|
//RsTickEvent::schedule_in(FORUM_TESTEVENT_DUMMYDATA, DUMMYDATA_PERIOD);
|
||||||
|
@ -156,12 +156,14 @@ RsIdentity *rsIdentity = NULL;
|
|||||||
/******************* Startup / Tick ******************************************/
|
/******************* Startup / Tick ******************************************/
|
||||||
/********************************************************************************/
|
/********************************************************************************/
|
||||||
|
|
||||||
p3IdService::p3IdService(RsGeneralDataService *gds, RsNetworkExchangeService *nes, PgpAuxUtils *pgpUtils)
|
p3IdService::p3IdService(
|
||||||
: RsGxsIdExchange(gds, nes, new RsGxsIdSerialiser(), RS_SERVICE_GXS_TYPE_GXSID, idAuthenPolicy()),
|
RsGeneralDataService *gds, RsNetworkExchangeService *nes,
|
||||||
RsIdentity(this), GxsTokenQueue(this), RsTickEvent(),
|
PgpAuxUtils *pgpUtils ) :
|
||||||
mKeyCache(GXSID_MAX_CACHE_SIZE, "GxsIdKeyCache"),
|
RsGxsIdExchange( gds, nes, new RsGxsIdSerialiser(),
|
||||||
mIdMtx("p3IdService"), mNes(nes),
|
RS_SERVICE_GXS_TYPE_GXSID, idAuthenPolicy() ),
|
||||||
mPgpUtils(pgpUtils)
|
RsIdentity(static_cast<RsGxsIface&>(*this)), GxsTokenQueue(this),
|
||||||
|
RsTickEvent(), mKeyCache(GXSID_MAX_CACHE_SIZE, "GxsIdKeyCache"),
|
||||||
|
mIdMtx("p3IdService"), mNes(nes), mPgpUtils(pgpUtils)
|
||||||
{
|
{
|
||||||
mBgSchedule_Mode = 0;
|
mBgSchedule_Mode = 0;
|
||||||
mBgSchedule_Active = false;
|
mBgSchedule_Active = false;
|
||||||
|
@ -40,13 +40,12 @@ RsPosted *rsPosted = NULL;
|
|||||||
/******************* Startup / Tick ******************************************/
|
/******************* Startup / Tick ******************************************/
|
||||||
/********************************************************************************/
|
/********************************************************************************/
|
||||||
|
|
||||||
p3Posted::p3Posted(RsGeneralDataService *gds, RsNetworkExchangeService *nes, RsGixs* gixs)
|
p3Posted::p3Posted(
|
||||||
:p3PostBase(gds, nes, gixs, new RsGxsPostedSerialiser(), RS_SERVICE_GXS_TYPE_POSTED),
|
RsGeneralDataService *gds, RsNetworkExchangeService *nes,
|
||||||
RsPosted(this)
|
RsGixs* gixs ) :
|
||||||
{
|
p3PostBase( gds, nes, gixs, new RsGxsPostedSerialiser(),
|
||||||
return;
|
RS_SERVICE_GXS_TYPE_POSTED ),
|
||||||
}
|
RsPosted(static_cast<RsGxsIface&>(*this)) {}
|
||||||
|
|
||||||
|
|
||||||
const std::string GXS_POSTED_APP_NAME = "gxsposted";
|
const std::string GXS_POSTED_APP_NAME = "gxsposted";
|
||||||
const uint16_t GXS_POSTED_APP_MAJOR_VERSION = 1;
|
const uint16_t GXS_POSTED_APP_MAJOR_VERSION = 1;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user