mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-05-02 22:25:04 -04:00
added some backend for reputation system
This commit is contained in:
parent
c17dddb79c
commit
317e7ea5ab
7 changed files with 54 additions and 26 deletions
|
@ -708,6 +708,7 @@ gxs {
|
|||
gxs/rsgxsnetservice.h \
|
||||
retroshare/rsgxsflags.h \
|
||||
retroshare/rsgxsifacetypes.h \
|
||||
retroshare/rsreputations.h \
|
||||
gxs/rsgenexchange.h \
|
||||
gxs/rsnxsobserver.h \
|
||||
gxs/rsgxsdata.h \
|
||||
|
|
|
@ -215,12 +215,6 @@ public:
|
|||
/********************************************************************************************/
|
||||
/********************************************************************************************/
|
||||
|
||||
enum Opinion {
|
||||
OPINION_NEGATIVE = -1,
|
||||
OPINION_NEUTRAL = 0,
|
||||
OPINION_POSITIVE = 1
|
||||
};
|
||||
|
||||
// For Other Services....
|
||||
// It should be impossible for them to get a message which we don't have the identity.
|
||||
// Its a major error if we don't have the identity.
|
||||
|
|
|
@ -40,6 +40,7 @@ extern RsPluginHandler *rsPlugins ;
|
|||
|
||||
class p3Service ;
|
||||
class RsServiceControl ;
|
||||
class RsReputations ;
|
||||
class RsTurtle ;
|
||||
class RsDht ;
|
||||
class RsDisc ;
|
||||
|
@ -116,6 +117,7 @@ public:
|
|||
RsUtil::inited_ptr<PgpAuxUtils> mPgpAuxUtils;
|
||||
RsUtil::inited_ptr<RsGxsForums> mGxsForums;
|
||||
RsUtil::inited_ptr<RsGxsChannels> mGxsChannels;
|
||||
RsUtil::inited_ptr<RsReputations> mReputations;
|
||||
};
|
||||
|
||||
class RsPlugin
|
||||
|
|
|
@ -819,6 +819,7 @@ bool RsInit::SetHiddenLocation(const std::string& hiddenaddress, uint16_t port)
|
|||
|
||||
RsFiles *rsFiles = NULL;
|
||||
RsTurtle *rsTurtle = NULL ;
|
||||
RsReputations *rsReputations = NULL ;
|
||||
#ifdef ENABLE_GROUTER
|
||||
RsGRouter *rsGRouter = NULL ;
|
||||
#endif
|
||||
|
@ -847,6 +848,7 @@ RsGRouter *rsGRouter = NULL ;
|
|||
#endif
|
||||
#endif
|
||||
|
||||
#include "services/p3gxsreputation.h"
|
||||
#include "services/p3serviceinfo.h"
|
||||
#include "services/p3heartbeat.h"
|
||||
#include "services/p3discovery2.h"
|
||||
|
@ -1357,6 +1359,11 @@ int RsServer::StartupRetroShare()
|
|||
|
||||
mPosted->setNetworkExchangeService(posted_ns) ;
|
||||
|
||||
/**** Reputation system ****/
|
||||
|
||||
p3GxsReputation *mReputations = new p3GxsReputation(mLinkMgr) ;
|
||||
rsReputations = mReputations ;
|
||||
|
||||
/**** Wiki GXS service ****/
|
||||
|
||||
|
||||
|
@ -1489,8 +1496,8 @@ int RsServer::StartupRetroShare()
|
|||
pqih -> addService(mDisc,true);
|
||||
pqih -> addService(msgSrv,true);
|
||||
pqih -> addService(chatSrv,true);
|
||||
pqih -> addService(mStatusSrv,true);
|
||||
|
||||
pqih -> addService(mStatusSrv,true);
|
||||
pqih -> addService(mReputations,true);
|
||||
|
||||
// set interfaces for plugins
|
||||
//
|
||||
|
@ -1511,6 +1518,8 @@ int RsServer::StartupRetroShare()
|
|||
interfaces.mPgpAuxUtils = pgpAuxUtils;
|
||||
interfaces.mGxsForums = mGxsForums;
|
||||
interfaces.mGxsChannels = mGxsChannels;
|
||||
interfaces.mReputations = mReputations;
|
||||
|
||||
mPluginsManager->setInterfaces(interfaces);
|
||||
|
||||
// now add plugin objects inside the loop:
|
||||
|
@ -1598,12 +1607,13 @@ int RsServer::StartupRetroShare()
|
|||
mConfigMgr->addConfiguration("peers.cfg", mPeerMgr);
|
||||
mConfigMgr->addConfiguration("general.cfg", mGeneralConfig);
|
||||
mConfigMgr->addConfiguration("msgs.cfg", msgSrv);
|
||||
mConfigMgr->addConfiguration("chat.cfg", chatSrv);
|
||||
mConfigMgr->addConfiguration("p3History.cfg", mHistoryMgr);
|
||||
mConfigMgr->addConfiguration("p3Status.cfg", mStatusSrv);
|
||||
mConfigMgr->addConfiguration("turtle.cfg", tr);
|
||||
mConfigMgr->addConfiguration("banlist.cfg", mBanList);
|
||||
mConfigMgr->addConfiguration("servicecontrol.cfg", serviceCtrl);
|
||||
mConfigMgr->addConfiguration("chat.cfg", chatSrv);
|
||||
mConfigMgr->addConfiguration("p3History.cfg", mHistoryMgr);
|
||||
mConfigMgr->addConfiguration("p3Status.cfg", mStatusSrv);
|
||||
mConfigMgr->addConfiguration("turtle.cfg", tr);
|
||||
mConfigMgr->addConfiguration("banlist.cfg", mBanList);
|
||||
mConfigMgr->addConfiguration("servicecontrol.cfg", serviceCtrl);
|
||||
mConfigMgr->addConfiguration("reputations.cfg", mReputations);
|
||||
#ifdef ENABLE_GROUTER
|
||||
mConfigMgr->addConfiguration("grouter.cfg", gr);
|
||||
#endif
|
||||
|
|
|
@ -380,7 +380,13 @@ bool p3GxsReputation::updateLatestUpdate(RsPeerId peerid, time_t ts)
|
|||
* Opinion
|
||||
****/
|
||||
|
||||
bool p3GxsReputation::updateOpinion(const RsGxsId& gxsid, int opinion)
|
||||
bool p3GxsReputation::getReputationInfo(const RsGxsId& gxsid, RsReputations::ReputationInfo& info)
|
||||
{
|
||||
std::cerr << __PRETTY_FUNCTION__ << ": not implemented yet!" << std::endl;
|
||||
return true ;
|
||||
}
|
||||
|
||||
bool p3GxsReputation::setOwnOpinion(const RsGxsId& gxsid, const RsReputations::Opinion& opinion)
|
||||
{
|
||||
RsStackMutex stack(mReputationMtx); /****** LOCKED MUTEX *******/
|
||||
|
||||
|
|
|
@ -35,6 +35,7 @@
|
|||
#include "serialiser/rsgxsreputationitems.h"
|
||||
|
||||
#include "retroshare/rsidentity.h"
|
||||
#include "retroshare/rsreputations.h"
|
||||
#include "services/p3service.h"
|
||||
|
||||
|
||||
|
@ -80,14 +81,16 @@ int32_t CalculateReputation();
|
|||
*
|
||||
*/
|
||||
|
||||
class p3GxsReputation: public p3Service, public p3Config /* , public pqiMonitor */
|
||||
class p3GxsReputation: public p3Service, public p3Config, public RsReputations /* , public pqiMonitor */
|
||||
{
|
||||
public:
|
||||
p3GxsReputation(p3LinkMgr *lm);
|
||||
virtual RsServiceInfo getServiceInfo();
|
||||
|
||||
/***** Interface for p3idservice *****/
|
||||
|
||||
/***** Interface for RsReputations *****/
|
||||
virtual bool setOwnOpinion(const RsGxsId& key_id, const Opinion& op) ;
|
||||
virtual bool getReputationInfo(const RsGxsId& id,ReputationInfo& info) ;
|
||||
|
||||
virtual bool updateOpinion(const RsGxsId& gxsid, int opinion);
|
||||
|
||||
/***** overloaded from p3Service *****/
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue