mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-01-28 08:16:59 -05:00
added people settings page, removed debug output
This commit is contained in:
parent
9d9b790a3e
commit
5bbaa1e8e5
@ -51,6 +51,8 @@ public:
|
|||||||
|
|
||||||
virtual bool setOwnOpinion(const RsGxsId& key_id, const Opinion& op) =0;
|
virtual bool setOwnOpinion(const RsGxsId& key_id, const Opinion& op) =0;
|
||||||
virtual bool getReputationInfo(const RsGxsId& id,ReputationInfo& info) =0 ;
|
virtual bool getReputationInfo(const RsGxsId& id,ReputationInfo& info) =0 ;
|
||||||
|
virtual void setNodeAutoBanThreshold(uint32_t n) =0;
|
||||||
|
virtual uint32_t nodeAutoBanThreshold() =0;
|
||||||
|
|
||||||
// This one is a proxy designed to allow fast checking of a GXS id.
|
// This one is a proxy designed to allow fast checking of a GXS id.
|
||||||
// it basically returns true if assessment is not ASSESSMENT_OK
|
// it basically returns true if assessment is not ASSESSMENT_OK
|
||||||
|
@ -39,7 +39,6 @@
|
|||||||
/****
|
/****
|
||||||
* #define DEBUG_REPUTATION 1
|
* #define DEBUG_REPUTATION 1
|
||||||
****/
|
****/
|
||||||
#define DEBUG_REPUTATION 1
|
|
||||||
|
|
||||||
/************ IMPLEMENTATION NOTES *********************************
|
/************ IMPLEMENTATION NOTES *********************************
|
||||||
*
|
*
|
||||||
@ -187,7 +186,6 @@ int p3GxsReputation::tick()
|
|||||||
}
|
}
|
||||||
|
|
||||||
static time_t last_identity_flags_update = 0 ;
|
static time_t last_identity_flags_update = 0 ;
|
||||||
static time_t last_banned_nodes_update = 0 ;
|
|
||||||
|
|
||||||
// no more than once per 5 second chunk.
|
// no more than once per 5 second chunk.
|
||||||
|
|
||||||
@ -201,6 +199,7 @@ int p3GxsReputation::tick()
|
|||||||
{
|
{
|
||||||
mLastBannedNodesUpdate = now ;
|
mLastBannedNodesUpdate = now ;
|
||||||
|
|
||||||
|
updateIdentityFlags() ; // needed before updateBannedNodesList!
|
||||||
updateBannedNodesList();
|
updateBannedNodesList();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -248,9 +247,9 @@ class ZeroInitCnt
|
|||||||
|
|
||||||
void p3GxsReputation::updateBannedNodesList()
|
void p3GxsReputation::updateBannedNodesList()
|
||||||
{
|
{
|
||||||
#ifdef DEBUG_REPUTATION
|
//#ifdef DEBUG_REPUTATION
|
||||||
std::cerr << "Updating PGP ban list based on signed GxsIds to ban" << std::endl;
|
std::cerr << "Updating PGP ban list based on signed GxsIds to ban" << std::endl;
|
||||||
#endif
|
//#endif
|
||||||
std::map<RsGxsId, Reputation> tmpreps ;
|
std::map<RsGxsId, Reputation> tmpreps ;
|
||||||
|
|
||||||
RsStackMutex stack(mReputationMtx); /****** LOCKED MUTEX *******/
|
RsStackMutex stack(mReputationMtx); /****** LOCKED MUTEX *******/
|
||||||
@ -267,9 +266,9 @@ void p3GxsReputation::updateBannedNodesList()
|
|||||||
if(mPgpAutoBanThreshold > 0)
|
if(mPgpAutoBanThreshold > 0)
|
||||||
for(std::map<RsPgpId,ZeroInitCnt>::const_iterator it(pgp_ids_to_ban.begin());it!=pgp_ids_to_ban.end();++it)
|
for(std::map<RsPgpId,ZeroInitCnt>::const_iterator it(pgp_ids_to_ban.begin());it!=pgp_ids_to_ban.end();++it)
|
||||||
{
|
{
|
||||||
#ifdef DEBUG_REPUTATION
|
//#ifdef DEBUG_REPUTATION
|
||||||
std::cerr << "PGP Id: " << it->first << ". Ban count=" << it->second << " - " << (( it->second >= mPgpAutoBanThreshold)?"Banned!":"OK" ) << std::endl;
|
std::cerr << "PGP Id: " << it->first << ". Ban count=" << it->second << " - " << (( it->second >= mPgpAutoBanThreshold)?"Banned!":"OK" ) << std::endl;
|
||||||
#endif
|
//#endif
|
||||||
if(it->second >= mPgpAutoBanThreshold)
|
if(it->second >= mPgpAutoBanThreshold)
|
||||||
mBannedPgpIds.insert(it->first) ;
|
mBannedPgpIds.insert(it->first) ;
|
||||||
}
|
}
|
||||||
@ -688,7 +687,9 @@ bool p3GxsReputation::getReputationInfo(const RsGxsId& gxsid, RsReputations::Rep
|
|||||||
if( (rep.mIdentityFlags & REPUTATION_IDENTITY_FLAG_PGP_LINKED) && (mBannedPgpIds.find(rep.mOwnerNode) != mBannedPgpIds.end()))
|
if( (rep.mIdentityFlags & REPUTATION_IDENTITY_FLAG_PGP_LINKED) && (mBannedPgpIds.find(rep.mOwnerNode) != mBannedPgpIds.end()))
|
||||||
{
|
{
|
||||||
info.mAssessment = RsReputations::ASSESSMENT_BAD ;
|
info.mAssessment = RsReputations::ASSESSMENT_BAD ;
|
||||||
|
#ifdef DEBUG_REPUTATION
|
||||||
std::cerr << "p3GxsReputations: identity " << gxsid << " is banned because owner node ID " << rep.mOwnerNode << " is banned." << std::endl;
|
std::cerr << "p3GxsReputations: identity " << gxsid << " is banned because owner node ID " << rep.mOwnerNode << " is banned." << std::endl;
|
||||||
|
#endif
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1019,9 +1020,9 @@ void p3GxsReputation::sendReputationRequests()
|
|||||||
int p3GxsReputation::sendReputationRequest(RsPeerId peerid)
|
int p3GxsReputation::sendReputationRequest(RsPeerId peerid)
|
||||||
{
|
{
|
||||||
#ifdef DEBUG_REPUTATION
|
#ifdef DEBUG_REPUTATION
|
||||||
|
time_t now = time(NULL) ;
|
||||||
std::cerr << " p3GxsReputation::sendReputationRequest(" << peerid << ") " ;
|
std::cerr << " p3GxsReputation::sendReputationRequest(" << peerid << ") " ;
|
||||||
#endif
|
#endif
|
||||||
time_t now = time(NULL) ;
|
|
||||||
|
|
||||||
/* */
|
/* */
|
||||||
RsGxsReputationRequestItem *requestItem = new RsGxsReputationRequestItem();
|
RsGxsReputationRequestItem *requestItem = new RsGxsReputationRequestItem();
|
||||||
|
55
retroshare-gui/src/gui/settings/PeoplePage.cpp
Normal file
55
retroshare-gui/src/gui/settings/PeoplePage.cpp
Normal file
@ -0,0 +1,55 @@
|
|||||||
|
/****************************************************************
|
||||||
|
* RetroShare is distributed under the following license:
|
||||||
|
*
|
||||||
|
* Copyright (C) 2006, crypton
|
||||||
|
*
|
||||||
|
* This program is free software; you can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU General Public License
|
||||||
|
* as published by the Free Software Foundation; either version 2
|
||||||
|
* of the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program 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 General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||||
|
* Boston, MA 02110-1301, USA.
|
||||||
|
****************************************************************/
|
||||||
|
|
||||||
|
#include "PeoplePage.h"
|
||||||
|
#include "rsharesettings.h"
|
||||||
|
#include "retroshare/rsreputations.h"
|
||||||
|
|
||||||
|
PeoplePage::PeoplePage(QWidget * parent, Qt::WindowFlags flags)
|
||||||
|
: ConfigPage(parent, flags)
|
||||||
|
{
|
||||||
|
ui.setupUi(this);
|
||||||
|
setAttribute(Qt::WA_QuitOnClose, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
PeoplePage::~PeoplePage()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Saves the changes on this page */
|
||||||
|
bool PeoplePage::save(QString &/*errmsg*/)
|
||||||
|
{
|
||||||
|
if(!ui.identityBan_CB->isChecked())
|
||||||
|
rsReputations->setNodeAutoBanThreshold(0) ;
|
||||||
|
else
|
||||||
|
rsReputations->setNodeAutoBanThreshold(ui.identityBanThreshold_SB->value()) ;
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Loads the settings for this page */
|
||||||
|
void PeoplePage::load()
|
||||||
|
{
|
||||||
|
uint32_t ban_limit = rsReputations->nodeAutoBanThreshold() ;
|
||||||
|
|
||||||
|
ui.identityBan_CB->setChecked(ban_limit > 0) ;
|
||||||
|
ui.identityBanThreshold_SB->setValue(ban_limit) ;
|
||||||
|
}
|
50
retroshare-gui/src/gui/settings/PeoplePage.h
Normal file
50
retroshare-gui/src/gui/settings/PeoplePage.h
Normal file
@ -0,0 +1,50 @@
|
|||||||
|
/****************************************************************
|
||||||
|
* RetroShare is distributed under the following license:
|
||||||
|
*
|
||||||
|
* Copyright (C) 2006, crypton
|
||||||
|
*
|
||||||
|
* This program is free software; you can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU General Public License
|
||||||
|
* as published by the Free Software Foundation; either version 2
|
||||||
|
* of the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program 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 General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||||
|
* Boston, MA 02110-1301, USA.
|
||||||
|
****************************************************************/
|
||||||
|
|
||||||
|
#ifndef PEOPLEPAGE_H
|
||||||
|
#define PEOPLEPAGE_H
|
||||||
|
|
||||||
|
#include <retroshare-gui/configpage.h>
|
||||||
|
#include "ui_PeoplePage.h"
|
||||||
|
|
||||||
|
class PeoplePage : public ConfigPage
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
|
||||||
|
public:
|
||||||
|
PeoplePage(QWidget * parent = 0, Qt::WindowFlags flags = 0);
|
||||||
|
~PeoplePage();
|
||||||
|
|
||||||
|
/** Saves the changes on this page */
|
||||||
|
virtual bool save(QString &errmsg);
|
||||||
|
/** Loads the settings for this page */
|
||||||
|
virtual void load();
|
||||||
|
|
||||||
|
virtual QPixmap iconPixmap() const { return QPixmap(":/icons/friends_128.png") ; }
|
||||||
|
virtual QString pageName() const { return tr("People") ; }
|
||||||
|
virtual QString helpText() const { return ""; }
|
||||||
|
|
||||||
|
private:
|
||||||
|
Ui::PeoplePage ui;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
84
retroshare-gui/src/gui/settings/PeoplePage.ui
Normal file
84
retroshare-gui/src/gui/settings/PeoplePage.ui
Normal file
@ -0,0 +1,84 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<ui version="4.0">
|
||||||
|
<class>PeoplePage</class>
|
||||||
|
<widget class="QWidget" name="PeoplePage">
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>0</x>
|
||||||
|
<y>0</y>
|
||||||
|
<width>1153</width>
|
||||||
|
<height>441</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<layout class="QVBoxLayout" name="verticalLayout">
|
||||||
|
<item>
|
||||||
|
<widget class="QGroupBox" name="generalGroupBox">
|
||||||
|
<property name="title">
|
||||||
|
<string>Identities handling</string>
|
||||||
|
</property>
|
||||||
|
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
||||||
|
<item>
|
||||||
|
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||||
|
<item>
|
||||||
|
<widget class="QCheckBox" name="identityBan_CB">
|
||||||
|
<property name="text">
|
||||||
|
<string>ban all identities of a node when more than</string>
|
||||||
|
</property>
|
||||||
|
<property name="checked">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QSpinBox" name="identityBanThreshold_SB">
|
||||||
|
<property name="maximum">
|
||||||
|
<number>10</number>
|
||||||
|
</property>
|
||||||
|
<property name="value">
|
||||||
|
<number>2</number>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QLabel" name="label">
|
||||||
|
<property name="text">
|
||||||
|
<string> of them have a negative opinion</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<spacer name="horizontalSpacer">
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Qt::Horizontal</enum>
|
||||||
|
</property>
|
||||||
|
<property name="sizeHint" stdset="0">
|
||||||
|
<size>
|
||||||
|
<width>40</width>
|
||||||
|
<height>20</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
</spacer>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<spacer name="verticalSpacer">
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Qt::Vertical</enum>
|
||||||
|
</property>
|
||||||
|
<property name="sizeHint" stdset="0">
|
||||||
|
<size>
|
||||||
|
<width>20</width>
|
||||||
|
<height>40</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
</spacer>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
<resources/>
|
||||||
|
<connections/>
|
||||||
|
</ui>
|
@ -36,6 +36,7 @@
|
|||||||
#include "RelayPage.h"
|
#include "RelayPage.h"
|
||||||
#include "ChatPage.h"
|
#include "ChatPage.h"
|
||||||
#include "ChannelPage.h"
|
#include "ChannelPage.h"
|
||||||
|
#include "PeoplePage.h"
|
||||||
#include "MessagePage.h"
|
#include "MessagePage.h"
|
||||||
#include "ForumPage.h"
|
#include "ForumPage.h"
|
||||||
#include "PostedPage.h"
|
#include "PostedPage.h"
|
||||||
@ -142,6 +143,7 @@ RSettingsWin::initStackedWidget()
|
|||||||
addPage(new PluginsPage() );
|
addPage(new PluginsPage() );
|
||||||
addPage(new NotifyPage());
|
addPage(new NotifyPage());
|
||||||
addPage(new CryptoPage());
|
addPage(new CryptoPage());
|
||||||
|
addPage(new PeoplePage());
|
||||||
addPage(new ChatPage());
|
addPage(new ChatPage());
|
||||||
addPage(new MessagePage());
|
addPage(new MessagePage());
|
||||||
addPage(new ChannelPage());
|
addPage(new ChannelPage());
|
||||||
|
@ -419,6 +419,7 @@ HEADERS += rshare.h \
|
|||||||
gui/settings/rsettings.h \
|
gui/settings/rsettings.h \
|
||||||
gui/settings/rsettingswin.h \
|
gui/settings/rsettingswin.h \
|
||||||
gui/settings/GeneralPage.h \
|
gui/settings/GeneralPage.h \
|
||||||
|
gui/settings/PeoplePage.h \
|
||||||
gui/settings/DirectoriesPage.h \
|
gui/settings/DirectoriesPage.h \
|
||||||
gui/settings/ServerPage.h \
|
gui/settings/ServerPage.h \
|
||||||
gui/settings/NetworkPage.h \
|
gui/settings/NetworkPage.h \
|
||||||
@ -602,6 +603,7 @@ FORMS += gui/StartDialog.ui \
|
|||||||
gui/settings/ServerPage.ui \
|
gui/settings/ServerPage.ui \
|
||||||
gui/settings/NetworkPage.ui \
|
gui/settings/NetworkPage.ui \
|
||||||
gui/settings/NotifyPage.ui \
|
gui/settings/NotifyPage.ui \
|
||||||
|
gui/settings/PeoplePage.ui \
|
||||||
gui/settings/CryptoPage.ui \
|
gui/settings/CryptoPage.ui \
|
||||||
gui/settings/MessagePage.ui \
|
gui/settings/MessagePage.ui \
|
||||||
gui/settings/NewTag.ui \
|
gui/settings/NewTag.ui \
|
||||||
@ -822,6 +824,7 @@ SOURCES += main.cpp \
|
|||||||
gui/settings/NetworkPage.cpp \
|
gui/settings/NetworkPage.cpp \
|
||||||
gui/settings/NotifyPage.cpp \
|
gui/settings/NotifyPage.cpp \
|
||||||
gui/settings/CryptoPage.cpp \
|
gui/settings/CryptoPage.cpp \
|
||||||
|
gui/settings/PeoplePage.cpp \
|
||||||
gui/settings/MessagePage.cpp \
|
gui/settings/MessagePage.cpp \
|
||||||
gui/settings/NewTag.cpp \
|
gui/settings/NewTag.cpp \
|
||||||
gui/settings/ForumPage.cpp \
|
gui/settings/ForumPage.cpp \
|
||||||
|
Loading…
x
Reference in New Issue
Block a user