2015-10-04 23:18:31 -04:00
|
|
|
/*
|
|
|
|
* libretroshare/src/services: rsreputation.h
|
|
|
|
*
|
|
|
|
* Services for RetroShare.
|
|
|
|
*
|
|
|
|
* Copyright 2015 by Cyril Soler
|
|
|
|
*
|
|
|
|
* This library is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU Library General Public
|
|
|
|
* License Version 2 as published by the Free Software Foundation.
|
|
|
|
*
|
|
|
|
* This library is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* Library General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Library General Public
|
|
|
|
* License along with this library; if not, write to the Free Software
|
|
|
|
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
|
|
|
|
* USA.
|
|
|
|
*
|
|
|
|
* Please report all bugs and problems to "csoler@users.sourceforge.net".
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include "retroshare/rsids.h"
|
|
|
|
#include "retroshare/rsgxsifacetypes.h"
|
|
|
|
|
|
|
|
class RsReputations
|
|
|
|
{
|
|
|
|
public:
|
2015-10-26 23:38:10 -04:00
|
|
|
static const float REPUTATION_THRESHOLD_ANTI_SPAM = 1.4f ;
|
2015-10-25 23:45:33 -04:00
|
|
|
static const float REPUTATION_THRESHOLD_DEFAULT = 1.0f ;
|
|
|
|
|
2015-10-04 23:18:31 -04:00
|
|
|
// This is the interface file for the reputation system
|
|
|
|
//
|
2015-10-06 23:56:39 -04:00
|
|
|
enum Opinion { OPINION_NEGATIVE = 0, OPINION_NEUTRAL = 1, OPINION_POSITIVE = 2 } ;
|
|
|
|
enum Assessment { ASSESSMENT_BAD = 0, ASSESSMENT_OK = 1 } ;
|
2015-10-04 23:18:31 -04:00
|
|
|
|
|
|
|
struct ReputationInfo
|
|
|
|
{
|
2016-01-01 22:36:07 -05:00
|
|
|
ReputationInfo() : mOwnOpinion(OPINION_NEUTRAL), mOverallReputationScore(REPUTATION_THRESHOLD_DEFAULT), mFriendAverage(REPUTATION_THRESHOLD_DEFAULT),mAssessment(ASSESSMENT_OK){}
|
|
|
|
|
2015-10-04 23:18:31 -04:00
|
|
|
RsReputations::Opinion mOwnOpinion ;
|
|
|
|
float mOverallReputationScore ;
|
2015-10-09 18:51:16 -04:00
|
|
|
float mFriendAverage ;
|
2015-10-06 23:56:39 -04:00
|
|
|
RsReputations::Assessment mAssessment; // this should help clients in taking decisions
|
2015-10-04 23:18:31 -04:00
|
|
|
};
|
|
|
|
|
|
|
|
virtual bool setOwnOpinion(const RsGxsId& key_id, const Opinion& op) =0;
|
|
|
|
virtual bool getReputationInfo(const RsGxsId& id,ReputationInfo& info) =0 ;
|
2015-10-06 23:56:39 -04:00
|
|
|
|
|
|
|
// This one is a proxy designed to allow fast checking of a GXS id.
|
2015-10-11 21:41:35 -04:00
|
|
|
// it basically returns true if assessment is not ASSESSMENT_OK
|
2015-10-06 23:56:39 -04:00
|
|
|
|
2015-10-11 21:41:35 -04:00
|
|
|
virtual bool isIdentityBanned(const RsGxsId& id) =0;
|
2015-10-04 23:18:31 -04:00
|
|
|
};
|
|
|
|
|
|
|
|
// To access reputations from anywhere
|
|
|
|
//
|
|
|
|
extern RsReputations *rsReputations ;
|