mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-06-08 06:32:55 -04:00
added button in forums to flag poster identity as bad
This commit is contained in:
parent
ce96e88925
commit
338fcee865
9 changed files with 50 additions and 11 deletions
|
@ -40,6 +40,7 @@ public:
|
||||||
{
|
{
|
||||||
RsReputations::Opinion mOwnOpinion ;
|
RsReputations::Opinion mOwnOpinion ;
|
||||||
float mOverallReputationScore ;
|
float mOverallReputationScore ;
|
||||||
|
float mFriendAverage ;
|
||||||
RsReputations::Assessment mAssessment; // this should help clients in taking decisions
|
RsReputations::Assessment mAssessment; // this should help clients in taking decisions
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -524,6 +524,7 @@ bool p3GxsReputation::getReputationInfo(const RsGxsId& gxsid, RsReputations::Rep
|
||||||
if (it == mReputations.end())
|
if (it == mReputations.end())
|
||||||
{
|
{
|
||||||
info.mOwnOpinion = RsReputations::OPINION_NEUTRAL ;
|
info.mOwnOpinion = RsReputations::OPINION_NEUTRAL ;
|
||||||
|
info.mFriendAverage = RsReputations::OPINION_NEUTRAL ;
|
||||||
info.mOverallReputationScore = float(RsReputations::OPINION_NEUTRAL) ;
|
info.mOverallReputationScore = float(RsReputations::OPINION_NEUTRAL) ;
|
||||||
info.mAssessment = RsReputations::ASSESSMENT_OK ;
|
info.mAssessment = RsReputations::ASSESSMENT_OK ;
|
||||||
#ifdef DEBUG_REPUTATION
|
#ifdef DEBUG_REPUTATION
|
||||||
|
@ -533,7 +534,8 @@ bool p3GxsReputation::getReputationInfo(const RsGxsId& gxsid, RsReputations::Rep
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
info.mOwnOpinion = RsReputations::Opinion(it->second.mOwnOpinion) ;
|
info.mOwnOpinion = RsReputations::Opinion(it->second.mOwnOpinion) ;
|
||||||
info.mOverallReputationScore = float(it->second.mReputation) ;
|
info.mOverallReputationScore = it->second.mReputation ;
|
||||||
|
info.mFriendAverage = it->second.mFriendAverage ;
|
||||||
|
|
||||||
if(info.mOverallReputationScore > REPUTATION_ASSESSMENT_THRESHOLD_X1)
|
if(info.mOverallReputationScore > REPUTATION_ASSESSMENT_THRESHOLD_X1)
|
||||||
info.mAssessment = RsReputations::ASSESSMENT_OK ;
|
info.mAssessment = RsReputations::ASSESSMENT_OK ;
|
||||||
|
@ -874,9 +876,15 @@ float Reputation::updateReputation(uint32_t average_active_friends)
|
||||||
friend_total += it->second - 1;
|
friend_total += it->second - 1;
|
||||||
|
|
||||||
if(mOpinions.empty()) // includes the case of no friends!
|
if(mOpinions.empty()) // includes the case of no friends!
|
||||||
|
{
|
||||||
mReputation = 1.0f;
|
mReputation = 1.0f;
|
||||||
|
mFriendAverage = 1.0f ;
|
||||||
|
}
|
||||||
else
|
else
|
||||||
mReputation = 1.0f + friend_total / float(std::max(average_active_friends,(uint32_t)mOpinions.size())) ;
|
{
|
||||||
|
mFriendAverage = 1.0+friend_total / float(std::max(average_active_friends,(uint32_t)mOpinions.size()));
|
||||||
|
mReputation = mFriendAverage ;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
mReputation = (float)mOwnOpinion ;
|
mReputation = (float)mOwnOpinion ;
|
||||||
|
@ -893,7 +901,7 @@ void p3GxsReputation::debug_print()
|
||||||
|
|
||||||
for(std::map<RsGxsId,Reputation>::const_iterator it(mReputations.begin());it!=mReputations.end();++it)
|
for(std::map<RsGxsId,Reputation>::const_iterator it(mReputations.begin());it!=mReputations.end();++it)
|
||||||
{
|
{
|
||||||
std::cerr << " ID=" << it->first << ", own: " << it->second.mOwnOpinion << ", global_score: " << it->second.mReputation
|
std::cerr << " ID=" << it->first << ", own: " << it->second.mOwnOpinion << ", Friend average: " << it->second.mFriendAverage << ", global_score: " << it->second.mReputation
|
||||||
<< ", last own update: " << now - it->second.mOwnOpinionTs << " secs ago." << std::endl;
|
<< ", last own update: " << now - it->second.mOwnOpinionTs << " secs ago." << std::endl;
|
||||||
|
|
||||||
for(std::map<RsPeerId,RsReputations::Opinion>::const_iterator it2(it->second.mOpinions.begin());it2!=it->second.mOpinions.end();++it2)
|
for(std::map<RsPeerId,RsReputations::Opinion>::const_iterator it2(it->second.mOpinions.begin());it2!=it->second.mOpinions.end();++it2)
|
||||||
|
|
|
@ -70,6 +70,7 @@ public:
|
||||||
int32_t mOwnOpinion;
|
int32_t mOwnOpinion;
|
||||||
time_t mOwnOpinionTs;
|
time_t mOwnOpinionTs;
|
||||||
|
|
||||||
|
float mFriendAverage ;
|
||||||
float mReputation;
|
float mReputation;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -680,7 +680,10 @@ void IdDialog::insertIdDetails(uint32_t token)
|
||||||
RsReputations::ReputationInfo info ;
|
RsReputations::ReputationInfo info ;
|
||||||
rsReputations->getReputationInfo(RsGxsId(data.mMeta.mGroupId),info) ;
|
rsReputations->getReputationInfo(RsGxsId(data.mMeta.mGroupId),info) ;
|
||||||
|
|
||||||
ui->overallOpinion_TF->setText(QString::number(info.mOverallReputationScore));
|
ui->neighborNodesOpinion_TF->setText(QString::number(info.mOverallReputationScore-1.0f));
|
||||||
|
|
||||||
|
ui->overallOpinion_TF->setText(QString::number(info.mOverallReputationScore-1.0f) +" ("+
|
||||||
|
((info.mAssessment == RsReputations::ASSESSMENT_OK)? tr("OK") : tr("Banned")) +")" ) ;
|
||||||
|
|
||||||
switch(info.mOwnOpinion)
|
switch(info.mOwnOpinion)
|
||||||
{
|
{
|
||||||
|
@ -690,8 +693,6 @@ void IdDialog::insertIdDetails(uint32_t token)
|
||||||
default:
|
default:
|
||||||
std::cerr << "Unexpected value in own opinion: " << info.mOwnOpinion << std::endl;
|
std::cerr << "Unexpected value in own opinion: " << info.mOwnOpinion << std::endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
//ui->neighborNodesOpinion_TF->setText(QString::number(info.m));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void IdDialog::modifyReputation()
|
void IdDialog::modifyReputation()
|
||||||
|
@ -740,11 +741,9 @@ void IdDialog::modifyReputation()
|
||||||
std::cerr << std::endl;
|
std::cerr << std::endl;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef SUSPENDED
|
|
||||||
// trigger refresh when finished.
|
// trigger refresh when finished.
|
||||||
// basic / anstype are not needed.
|
// basic / anstype are not needed.
|
||||||
mIdQueue->queueRequest(token, 0, 0, IDDIALOG_REFRESH);
|
requestIdDetails();
|
||||||
#endif
|
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
@ -485,6 +485,9 @@
|
||||||
<layout class="QGridLayout" name="gridLayout_2">
|
<layout class="QGridLayout" name="gridLayout_2">
|
||||||
<item row="2" column="1">
|
<item row="2" column="1">
|
||||||
<widget class="QLineEdit" name="neighborNodesOpinion_TF">
|
<widget class="QLineEdit" name="neighborNodesOpinion_TF">
|
||||||
|
<property name="toolTip">
|
||||||
|
<string><html><head/><body><p>Average opinion of neighbor nodes about this identity. Negative is bad,</p><p>positive is good. Zero is neutral.</p></body></html></string>
|
||||||
|
</property>
|
||||||
<property name="readOnly">
|
<property name="readOnly">
|
||||||
<bool>true</bool>
|
<bool>true</bool>
|
||||||
</property>
|
</property>
|
||||||
|
@ -530,12 +533,16 @@ p, li { white-space: pre-wrap; }
|
||||||
<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><br /></p></body></html></string>
|
<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><br /></p></body></html></string>
|
||||||
</property>
|
</property>
|
||||||
<property name="currentIndex">
|
<property name="currentIndex">
|
||||||
<number>1</number>
|
<number>0</number>
|
||||||
</property>
|
</property>
|
||||||
<item>
|
<item>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Negative</string>
|
<string>Negative</string>
|
||||||
</property>
|
</property>
|
||||||
|
<property name="icon">
|
||||||
|
<iconset>
|
||||||
|
<normaloff>../icons/yellow_biohazard64.png</normaloff>../icons/yellow_biohazard64.png</iconset>
|
||||||
|
</property>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
|
@ -551,6 +558,9 @@ p, li { white-space: pre-wrap; }
|
||||||
</item>
|
</item>
|
||||||
<item row="3" column="1">
|
<item row="3" column="1">
|
||||||
<widget class="QLineEdit" name="overallOpinion_TF">
|
<widget class="QLineEdit" name="overallOpinion_TF">
|
||||||
|
<property name="toolTip">
|
||||||
|
<string><html><head/><body><p>Overall reputation score, accounting for yours and your friends'.</p><p>Negative is bad, positive is good. Zero is neutral. If the score is too low,</p><p>the identity is flagged as bad, and will be filtered out in forums, chat lobbies,</p><p>channels, etc.</p></body></html></string>
|
||||||
|
</property>
|
||||||
<property name="readOnly">
|
<property name="readOnly">
|
||||||
<bool>true</bool>
|
<bool>true</bool>
|
||||||
</property>
|
</property>
|
||||||
|
|
|
@ -41,6 +41,7 @@
|
||||||
#include "util/QtVersion.h"
|
#include "util/QtVersion.h"
|
||||||
|
|
||||||
#include <retroshare/rsgxsforums.h>
|
#include <retroshare/rsgxsforums.h>
|
||||||
|
#include <retroshare/rsreputations.h>
|
||||||
#include <retroshare/rspeers.h>
|
#include <retroshare/rspeers.h>
|
||||||
// These should be in retroshare/ folder.
|
// These should be in retroshare/ folder.
|
||||||
#include "retroshare/rsgxsflags.h"
|
#include "retroshare/rsgxsflags.h"
|
||||||
|
@ -57,6 +58,7 @@
|
||||||
#define IMAGE_DOWNLOAD ":/images/start.png"
|
#define IMAGE_DOWNLOAD ":/images/start.png"
|
||||||
#define IMAGE_DOWNLOADALL ":/images/startall.png"
|
#define IMAGE_DOWNLOADALL ":/images/startall.png"
|
||||||
#define IMAGE_COPYLINK ":/images/copyrslink.png"
|
#define IMAGE_COPYLINK ":/images/copyrslink.png"
|
||||||
|
#define IMAGE_BIOHAZARD ":/icons/yellow_biohazard64.png"
|
||||||
|
|
||||||
#define VIEW_LAST_POST 0
|
#define VIEW_LAST_POST 0
|
||||||
#define VIEW_THREADED 1
|
#define VIEW_THREADED 1
|
||||||
|
@ -406,6 +408,9 @@ void GxsForumThreadWidget::threadListCustomPopupMenu(QPoint /*point*/)
|
||||||
QAction *replyauthorAct = new QAction(QIcon(IMAGE_MESSAGEREPLY), tr("Reply with private message"), &contextMnu);
|
QAction *replyauthorAct = new QAction(QIcon(IMAGE_MESSAGEREPLY), tr("Reply with private message"), &contextMnu);
|
||||||
connect(replyauthorAct, SIGNAL(triggered()), this, SLOT(replytomessage()));
|
connect(replyauthorAct, SIGNAL(triggered()), this, SLOT(replytomessage()));
|
||||||
|
|
||||||
|
QAction *flagasbadAct = new QAction(QIcon(IMAGE_BIOHAZARD), tr("Flag this person as bad"), &contextMnu);
|
||||||
|
connect(flagasbadAct, SIGNAL(triggered()), this, SLOT(flagpersonasbad()));
|
||||||
|
|
||||||
QAction *newthreadAct = new QAction(QIcon(IMAGE_MESSAGE), tr("Start New Thread"), &contextMnu);
|
QAction *newthreadAct = new QAction(QIcon(IMAGE_MESSAGE), tr("Start New Thread"), &contextMnu);
|
||||||
newthreadAct->setEnabled (IS_GROUP_SUBSCRIBED(mSubscribeFlags));
|
newthreadAct->setEnabled (IS_GROUP_SUBSCRIBED(mSubscribeFlags));
|
||||||
connect(newthreadAct , SIGNAL(triggered()), this, SLOT(createthread()));
|
connect(newthreadAct , SIGNAL(triggered()), this, SLOT(createthread()));
|
||||||
|
@ -484,6 +489,8 @@ void GxsForumThreadWidget::threadListCustomPopupMenu(QPoint /*point*/)
|
||||||
contextMnu.addAction(expandAll);
|
contextMnu.addAction(expandAll);
|
||||||
contextMnu.addAction(collapseAll);
|
contextMnu.addAction(collapseAll);
|
||||||
|
|
||||||
|
contextMnu.addSeparator();
|
||||||
|
contextMnu.addAction(flagasbadAct);
|
||||||
contextMnu.addSeparator();
|
contextMnu.addSeparator();
|
||||||
contextMnu.addAction(replyauthorAct);
|
contextMnu.addAction(replyauthorAct);
|
||||||
|
|
||||||
|
@ -1685,6 +1692,17 @@ static QString buildReplyHeader(const RsMsgMetaData &meta)
|
||||||
return header;
|
return header;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void GxsForumThreadWidget::flagpersonasbad()
|
||||||
|
{
|
||||||
|
if (groupId().isNull() || mThreadId.isNull()) {
|
||||||
|
QMessageBox::information(this, tr("RetroShare"),tr("You cant reply to a non-existant Message"));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Get Message ... then complete replyMessageData().
|
||||||
|
rsReputations->setOwnOpinion(RsGxsId(groupId()),RsReputations::OPINION_NEGATIVE) ;
|
||||||
|
}
|
||||||
|
|
||||||
void GxsForumThreadWidget::replytomessage()
|
void GxsForumThreadWidget::replytomessage()
|
||||||
{
|
{
|
||||||
if (groupId().isNull() || mThreadId.isNull()) {
|
if (groupId().isNull() || mThreadId.isNull()) {
|
||||||
|
|
|
@ -101,6 +101,7 @@ private slots:
|
||||||
void downloadAllFiles();
|
void downloadAllFiles();
|
||||||
|
|
||||||
void changedViewBox();
|
void changedViewBox();
|
||||||
|
void flagpersonasbad();
|
||||||
|
|
||||||
void filterColumnChanged(int column);
|
void filterColumnChanged(int column);
|
||||||
void filterItems(const QString &text);
|
void filterItems(const QString &text);
|
||||||
|
|
|
@ -60,5 +60,6 @@
|
||||||
<file>icons/user-busy_64.png</file>
|
<file>icons/user-busy_64.png</file>
|
||||||
<file>icons/user-offline_64.png</file>
|
<file>icons/user-offline_64.png</file>
|
||||||
<file>icons/user-online_64.png</file>
|
<file>icons/user-online_64.png</file>
|
||||||
|
<file>icons/yellow_biohazard64.png</file>
|
||||||
</qresource>
|
</qresource>
|
||||||
</RCC>
|
</RCC>
|
||||||
|
|
BIN
retroshare-gui/src/gui/icons/yellow_biohazard64.png
Normal file
BIN
retroshare-gui/src/gui/icons/yellow_biohazard64.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 9.9 KiB |
Loading…
Add table
Add a link
Reference in a new issue