fixed merge upstream/master
3
.gitmodules
vendored
@ -4,3 +4,6 @@
|
||||
[submodule "cmark"]
|
||||
path = supportlibs/cmark
|
||||
url = https://github.com/commonmark/cmark.git
|
||||
[submodule "build_scripts/OBS"]
|
||||
path = build_scripts/OBS
|
||||
url = https://github.com/RetroShare/OBS.git
|
||||
|
@ -10,7 +10,7 @@ matrix:
|
||||
sudo: required
|
||||
compiler: gcc
|
||||
- os: osx
|
||||
osx_image: xcode9.3
|
||||
osx_image: xcode10.1
|
||||
compiler: clang
|
||||
sudo: false
|
||||
|
||||
@ -48,7 +48,7 @@ addons:
|
||||
|
||||
before_script:
|
||||
- if [ $TRAVIS_OS_NAME == linux ]; then qmake QMAKE_CC=$CC QMAKE_CXX=$CXX; fi
|
||||
- if [ $TRAVIS_OS_NAME == osx ]; then qmake QMAKE_CC=$CC QMAKE_CXX=$CXX CONFIG+=rs_macos10.13 CONFIG+=no_retroshare_plugins INCLUDEPATH+=/usr/local/opt/openssl/include/ INCLUDEPATH+=/usr/local/Cellar/sqlcipher/4.0.1/include INCLUDEPATH+=/usr/local/Cellar/libmicrohttpd/0.9.62_1/include QMAKE_LIBDIR+=/usr/local/opt/openssl/lib/ QMAKE_LIBDIR+=/usr/local/Cellar/libmicrohttpd/0.9.62_1/lib QMAKE_LIBDIR+=/usr/local/Cellar/sqlcipher/4.0.1/lib; fi
|
||||
- if [ $TRAVIS_OS_NAME == osx ]; then qmake QMAKE_CC=$CC QMAKE_CXX=$CXX CONFIG+=rs_macos10.14 CONFIG+=no_retroshare_plugins INCLUDEPATH+=/usr/local/opt/openssl/include/ INCLUDEPATH+=/usr/local/Cellar/sqlcipher/4.0.1/include INCLUDEPATH+=/usr/local/Cellar/libmicrohttpd/0.9.62_1/include QMAKE_LIBDIR+=/usr/local/opt/openssl/lib/ QMAKE_LIBDIR+=/usr/local/Cellar/libmicrohttpd/0.9.62_1/lib QMAKE_LIBDIR+=/usr/local/Cellar/sqlcipher/4.0.1/lib; fi
|
||||
|
||||
script:
|
||||
- if [ $TRAVIS_OS_NAME == osx ] && [ "${COVERITY_SCAN_BRANCH}" != 1 ]; then make -j4; fi
|
||||
|
@ -1,30 +0,0 @@
|
||||
app: retroshare-service
|
||||
|
||||
build:
|
||||
packages:
|
||||
- gcc7
|
||||
- gcc7-c++
|
||||
- libxapian-devel
|
||||
- doxygen
|
||||
- linuxdeployqt
|
||||
- desktop-file-utils
|
||||
- glib2-devel
|
||||
- sqlcipher-devel
|
||||
- libqt5-qtbase-devel
|
||||
- libqt5-qttools-devel
|
||||
- openssl-devel
|
||||
- update-desktop-files
|
||||
- libbz2-devel
|
||||
- libupnp-devel
|
||||
|
||||
script:
|
||||
- cd $BUILD_SOURCE_DIR
|
||||
- tar -xf RetroShare-git.tar.gz
|
||||
- cd RetroShare-git
|
||||
- ls $(which gcc)*
|
||||
- ls $(which g++)*
|
||||
- qmake-qt5 QMAKE_CC=gcc-7 QMAKE_CXX=g++-7 PREFIX=/usr CONFIG-=debug CONFIG+=release CONFIG+=no_retroshare_nogui CONFIG+=no_retroshare_plugins CONFIG+=no_retroshare_qml_app CONFIG+=no_retroshare_android_notify_service CONFIG+=no_retroshare_plugins CONFIG+=ipv6 CONFIG+=no_retroshare_nogui CONFIG+=no_tests CONFIG+=rs_jsonapi CONFIG+=no_retroshare_android_service CONFIG+=rs_deep_search CONFIG+=no_libresapilocalserver CONFIG+=no_retroshare_gui CONFIG+=no_libresapihttpserver CONFIG+=retroshare_service CONFIG+=no_libresapi CONFIG+=c++11 CONFIG+=appimage
|
||||
- make -j$(nproc) || make -j$(nproc) || make
|
||||
- make INSTALL_ROOT=$BUILD_APPDIR install
|
||||
- unset QTDIR; unset QT_PLUGIN_PATH ; unset LD_LIBRARY_PATH
|
||||
- linuxdeployqt $BUILD_APPDIR/usr/share/applications/*.desktop -bundle-non-qt-libs -verbose=3 -no-strip
|
@ -1,45 +0,0 @@
|
||||
# Maintainer: Gioacchino Mazzurco <gio@eigenlab.org>
|
||||
# Contributor: AsamK
|
||||
# Contributor: sehraf
|
||||
# Contributor: stqn
|
||||
# Contributor: JHeaton <jheaton at archlinux dot us>
|
||||
# Contributor: Tristero <tristero at online dot de>
|
||||
# Contributor: funkyou
|
||||
|
||||
pkgname=retroshare-service-git
|
||||
pkgver=git
|
||||
pkgrel=0
|
||||
pkgdesc="Serverless encrypted instant messenger with filesharing, chatgroups, e-mail. System service version."
|
||||
arch=('i686' 'x86_64' 'armv6h' 'armv7h')
|
||||
url="https://retroshare.net/"
|
||||
license=('AGPL' 'GPL' 'LGPL')
|
||||
depends=('bzip2' 'libupnp' 'libzip' 'openssl' 'rapidjson' 'sqlcipher' 'xapian-core')
|
||||
makedepends=('cmake' 'doxygen' 'git' 'pkgconf' 'qt5-tools')
|
||||
provides=('retroshare-service')
|
||||
conflicts=('retroshare-service')
|
||||
|
||||
source=(RetroShare-${pkgver}.tar.gz)
|
||||
|
||||
md5sums=('3c66108223b427d617b962aff0755378')
|
||||
|
||||
prepare() {
|
||||
cd "${srcdir}/RetroShare-${pkgver}"
|
||||
}
|
||||
|
||||
build() {
|
||||
cd "${srcdir}/RetroShare-${pkgver}"
|
||||
qmake-qt5 PREFIX=/usr DATA_DIR=/usr/share/retroshare CONFIG-=debug \
|
||||
CONFIG+=ipv6 CONFIG+=no_retroshare_android_service \
|
||||
CONFIG+=no_retroshare_android_notify_service \
|
||||
CONFIG+=no_retroshare_plugins CONFIG+=no_retroshare_nogui \
|
||||
CONFIG+=no_retroshare_gui CONFIG+=no_tests CONFIG+=no_libresapi \
|
||||
CONFIG+=no_libresapihttpserver CONFIG+=no_libresapilocalserver \
|
||||
CONFIG+=retroshare_service CONFIG+=rs_jsonapi CONFIG+=rs_deep_search \
|
||||
CONFIG+=release
|
||||
make -j$(nproc) || make -j$(nproc) || make
|
||||
}
|
||||
|
||||
package() {
|
||||
cd "${srcdir}/RetroShare-${pkgver}"
|
||||
make INSTALL_ROOT="${pkgdir}" install
|
||||
}
|
@ -1,5 +0,0 @@
|
||||
retroshare-service-git (0.6.9999) stable; urgency=low
|
||||
|
||||
Add retroshare-service-git package
|
||||
|
||||
-- Gioacchino Mazzurco <gio@eigenlab.org> Tue, 08 Oct 2018 15:40:00 +0100
|
@ -1 +0,0 @@
|
||||
7
|
@ -1,18 +0,0 @@
|
||||
Source: retroshare-service-git
|
||||
Section: devel
|
||||
Priority: standard
|
||||
Maintainer: Cyril Soler <csoler@users.sourceforge.net>
|
||||
Standards-Version: 3.9.3
|
||||
Homepage: http://retroshare.net
|
||||
|
||||
Package: retroshare-service-git
|
||||
Architecture: any
|
||||
Depends: ${shlibs:Depends}, ${misc:Depends}
|
||||
Description: Secure communication with friends
|
||||
RetroShare is a Free and Open Source, private and secure decentralized
|
||||
communication platform. It lets you to securely chat and share files with your
|
||||
friends and family, using a web-of-trust to authenticate peers and OpenSSL to
|
||||
encrypt all communication. RetroShare provides filesharing, chat, messages,
|
||||
forums and channels.
|
||||
This package provide a headless RetroShare node that can be controlled only
|
||||
using the JSON API.
|
@ -1,2 +0,0 @@
|
||||
debian/tmp/usr/bin/retroshare-service
|
||||
debian/tmp/usr/share/retroshare/bdboot.txt
|
@ -1,59 +0,0 @@
|
||||
#!/usr/bin/make -f
|
||||
|
||||
configure: configure-stamp
|
||||
configure-stamp:
|
||||
dh_testdir
|
||||
qmake --version
|
||||
qmake CONFIG-=debug CONFIG+=release PREFIX=/usr LIB_DIR=/usr/lib \
|
||||
CONFIG+=no_retroshare_plugins CONFIG+=no_retroshare_nogui \
|
||||
CONFIG+=no_retroshare_gui CONFIG+=no_tests CONFIG+=no_libresapi \
|
||||
CONFIG+=no_libresapihttpserver CONFIG+=no_libresapilocalserver \
|
||||
CONFIG+=retroshare_service CONFIG+=rs_jsonapi CONFIG+=rs_deep_search \
|
||||
CONFIG+=c++11 RetroShare.pro
|
||||
touch $@
|
||||
|
||||
build: build-stamp
|
||||
build-stamp: configure-stamp
|
||||
dh_testdir
|
||||
$(MAKE) -j$(shell nproc) || $(MAKE) -j$(shell nproc) || $(MAKE)
|
||||
touch $@
|
||||
|
||||
clean:
|
||||
dh_testdir
|
||||
dh_testroot
|
||||
rm -f configure-stamp build-stamp
|
||||
# Add here commands to clean up after the build process.
|
||||
[ ! -f Makefile ] || $(MAKE) distclean
|
||||
dh_clean
|
||||
|
||||
install: build
|
||||
dh_testdir
|
||||
dh_testroot
|
||||
dh_clean -k
|
||||
#dh_installdirs
|
||||
$(MAKE) INSTALL_ROOT=$(CURDIR)/debian/tmp install
|
||||
|
||||
# Build architecture-independent files here.
|
||||
binary-indep: build install
|
||||
# We have nothing to do by default.
|
||||
|
||||
# Build architecture-dependent files here.
|
||||
binary-arch: build install
|
||||
dh_testdir
|
||||
dh_testroot
|
||||
dh_install --list-missing
|
||||
#dh_installdocs
|
||||
#dh_installexamples
|
||||
#dh_installman
|
||||
dh_link
|
||||
dh_strip
|
||||
dh_compress
|
||||
dh_fixperms
|
||||
dh_installdeb
|
||||
dh_shlibdeps
|
||||
dh_gencontrol
|
||||
dh_md5sums
|
||||
dh_builddeb
|
||||
|
||||
binary: binary-indep binary-arch
|
||||
.PHONY: build clean binary-indep binary-arch binary install configure
|
@ -1,11 +0,0 @@
|
||||
Format: 1.0
|
||||
Source: retroshare-service-git
|
||||
Binary: retroshare-service-git
|
||||
Architecture: any
|
||||
Version: 0.6.9999
|
||||
Maintainer: Cyril Soler <csoler@users.sourceforge.net>
|
||||
Homepage: https://retroshare.net
|
||||
Standards-Version: 3.8.1
|
||||
Build-Depends: cmake, debhelper (>= 7), doxygen, git, libglib2.0-dev, libupnp-dev, qtbase5-dev, qt5-default, libssl-dev, libbz2-dev, libsqlcipher-dev, libxapian-dev
|
||||
Files:
|
||||
f562e399ef7d44ebc01362f365b4f30b 23617604 RetroShare-git.tar.gz
|
1
build_scripts/OBS
Submodule
@ -0,0 +1 @@
|
||||
Subproject commit aafa7aef112f5701c039a13864e1d446d2fbfe46
|
@ -1,120 +0,0 @@
|
||||
Name: retroshare-service-git
|
||||
Version: 0.6.9999
|
||||
Release: 0
|
||||
License: GNU AFFERO GENERAL PUBLIC LICENSE version 3
|
||||
Summary: Secure chat and file sharing
|
||||
Group: Productivity/Networking/Other
|
||||
Url: http://retroshare.net
|
||||
#Source0: https://github.com/RetroShare/RetroShare/archive/v%{version}.tar.gz#/RetroShare-%{version}.tar.gz
|
||||
Source0: RetroShare-git.tar.gz
|
||||
#Patch0: various.patch
|
||||
BuildRoot: %{_tmppath}/%{name}
|
||||
Conflicts: retroshare-service
|
||||
Requires: libupnp openssl sqlcipher
|
||||
BuildRequires: cmake doxygen git libupnp-devel openssl-devel sqlcipher-devel
|
||||
|
||||
%if %{defined centos_version}
|
||||
BuildRequires: qt5-qtbase-devel qt5-qttools-devel qt5-qttools-static
|
||||
Requires: qt5-qtbase
|
||||
%endif
|
||||
|
||||
%if 0%{?fedora_version}
|
||||
BuildRequires: gcc-c++
|
||||
BuildRequires: fdupes xapian-core-devel
|
||||
BuildRequires: qt5-qtbase-devel qt5-qttools-devel qt5-qttools-static
|
||||
Requires: qt5-qtbase xapian-core
|
||||
%endif
|
||||
|
||||
%if %{defined mageia}
|
||||
BuildRequires: gcc-c++
|
||||
BuildRequires: libzlib-devel libbzip2-devel
|
||||
BuildRequires: libqt5core-devel libqt5xml-devel libxapian-devel
|
||||
Requires: libqt5core libqt5xml5 libxapian
|
||||
%endif
|
||||
|
||||
%if 0%{?suse_version}
|
||||
BuildRequires: gcc7 gcc7-c++
|
||||
BuildRequires: fdupes libbz2-devel
|
||||
BuildRequires: libqt5-qtbase-devel libqt5-qttools-devel
|
||||
BuildRequires: libxapian-devel update-desktop-files
|
||||
Requires: libbz2 libxapian
|
||||
%endif
|
||||
|
||||
%if 0%{?fedora_version} >= 27
|
||||
%undefine _debugsource_packages
|
||||
%undefine _debuginfo_subpackages
|
||||
%endif
|
||||
|
||||
%description
|
||||
RetroShare is a cross-platform F2F communication platform.
|
||||
It lets you share securely with your friends, using PGP
|
||||
to authenticate peers and OpenSSL to encrypt all communication.
|
||||
RetroShare provides filesharing, chat, messages and channels.
|
||||
This package provides RetroShare system service that can be
|
||||
controlled only via JSON API.
|
||||
|
||||
Authors:
|
||||
see http://retroshare.net/
|
||||
--------
|
||||
|
||||
%prep
|
||||
%setup -n RetroShare-git
|
||||
#%patch0 -p0
|
||||
|
||||
%build
|
||||
|
||||
nproc
|
||||
qmake --version || qmake-qt5 --version
|
||||
ls $(which gcc)*
|
||||
ls $(which g++)*
|
||||
|
||||
BUILD_CC=""
|
||||
BUILD_CXX=""
|
||||
BUILD_DEEPSEARCH="CONFIG+=rs_deep_search"
|
||||
QMAKE="qmake-qt5"
|
||||
|
||||
%if %{defined centos_version}
|
||||
# Xapian is not availabe on Centos 7
|
||||
BUILD_DEEPSEARCH="CONFIG+=no_rs_deep_search"
|
||||
%endif
|
||||
|
||||
%if %{defined mageia}
|
||||
QMAKE="qmake"
|
||||
%endif
|
||||
|
||||
%if 0%{?suse_version}
|
||||
BUILD_CC="QMAKE_CC=gcc-7"
|
||||
BUILD_CXX="QMAKE_CXX=g++-7"
|
||||
%endif
|
||||
|
||||
$QMAKE $BUILD_CC $BUILD_CXX QMAKE_STRIP=echo PREFIX="%{_prefix}" \
|
||||
BIN_DIR="%{_bindir}" \
|
||||
LIB_DIR="%{_libdir}" DATA_DIR="%{_datadir}/retroshare" CONFIG-=debug \
|
||||
CONFIG+=ipv6 CONFIG+=no_retroshare_android_service \
|
||||
CONFIG+=no_retroshare_android_notify_service \
|
||||
CONFIG+=no_retroshare_plugins CONFIG+=no_retroshare_nogui \
|
||||
CONFIG+=no_retroshare_gui CONFIG+=no_tests CONFIG+=no_libresapi \
|
||||
CONFIG+=no_libresapihttpserver CONFIG+=no_libresapilocalserver \
|
||||
CONFIG+=retroshare_service CONFIG+=rs_jsonapi ${BUILD_DEEPSEARCH} \
|
||||
CONFIG+=release RetroShare.pro
|
||||
make -j$(nproc) || make -j$(nproc) || make
|
||||
|
||||
%install
|
||||
rm -rf $RPM_BUILD_ROOT
|
||||
make INSTALL_ROOT=$RPM_BUILD_ROOT install
|
||||
|
||||
%if 0%{?centos_version} < 800
|
||||
%else
|
||||
%fdupes %{buildroot}/%{_prefix}
|
||||
%endif
|
||||
|
||||
%clean
|
||||
rm -rf $RPM_BUILD_ROOT
|
||||
|
||||
%files
|
||||
%defattr(-, root, root)
|
||||
%{_bindir}/retroshare-service
|
||||
%defattr(644, root, root)
|
||||
%{_datadir}/retroshare
|
||||
|
||||
%changelog
|
@ -2,10 +2,10 @@
|
||||
Encoding=UTF-8
|
||||
Version=1.0
|
||||
Name=RetroShare
|
||||
Comment=Securely share files with your friends
|
||||
Comment=Securely communicate with your friends
|
||||
Exec=/usr/bin/retroshare %U
|
||||
Icon=/usr/share/pixmaps/retroshare.xpm
|
||||
Terminal=false
|
||||
Type=Application
|
||||
Categories=Application;Network;
|
||||
Categories=Application;Network;P2P;Feed;Chat;InstantMessaging
|
||||
MimeType=x-scheme-handler/retroshare;
|
||||
|
@ -29,7 +29,7 @@
|
||||
#include "util/rstime.h"
|
||||
|
||||
class RsPeers;
|
||||
class RsIdentity;
|
||||
struct RsIdentity;
|
||||
|
||||
namespace resource_api
|
||||
{
|
||||
|
@ -504,7 +504,7 @@ void IdentityHandler::handleGetIdentityDetails(Request& req, Response& resp)
|
||||
|
||||
resp.mDataStream << makeKeyValue("bannned_node", rsReputations->isNodeBanned(data.mPgpId));
|
||||
|
||||
RsReputations::ReputationInfo info;
|
||||
RsReputationInfo info;
|
||||
rsReputations->getReputationInfo(RsGxsId(data.mMeta.mGroupId), data.mPgpId, info);
|
||||
resp.mDataStream << makeKeyValue("friends_positive_votes", info.mFriendsPositiveVotes);
|
||||
resp.mDataStream << makeKeyValue("friends_negative_votes", info.mFriendsNegativeVotes);
|
||||
@ -637,18 +637,12 @@ void IdentityHandler::handleSetOpinion(Request& req, Response& resp)
|
||||
int own_opinion;
|
||||
req.mStream << makeKeyValueReference("own_opinion", own_opinion);
|
||||
|
||||
RsReputations::Opinion opinion;
|
||||
RsOpinion opinion;
|
||||
switch(own_opinion)
|
||||
{
|
||||
case 0:
|
||||
opinion = RsReputations::OPINION_NEGATIVE;
|
||||
break;
|
||||
case 1: opinion =
|
||||
RsReputations::OPINION_NEUTRAL;
|
||||
break;
|
||||
case 2:
|
||||
opinion = RsReputations::OPINION_POSITIVE;
|
||||
break;
|
||||
case 0: opinion = RsOpinion::NEGATIVE; break;
|
||||
case 1: opinion = RsOpinion::NEUTRAL; break;
|
||||
case 2: opinion = RsOpinion::POSITIVE; break;
|
||||
default:
|
||||
resp.setFail();
|
||||
return;
|
||||
|
@ -28,7 +28,7 @@
|
||||
#include "ResourceRouter.h"
|
||||
#include "StateTokenServer.h"
|
||||
|
||||
class RsIdentity;
|
||||
struct RsIdentity;
|
||||
|
||||
namespace resource_api
|
||||
{
|
||||
|
@ -135,13 +135,13 @@ void DistantChatService::handleRecvChatStatusItem(RsChatStatusItem *cs)
|
||||
std::cerr << "DistantChatService::handleRecvChatStatusItem(): received keep alive packet for inactive chat! peerId=" << cs->PeerId() << std::endl;
|
||||
}
|
||||
|
||||
bool DistantChatService::acceptDataFromPeer(const RsGxsId& gxs_id,const RsGxsTunnelId& tunnel_id,bool is_client_side)
|
||||
bool DistantChatService::acceptDataFromPeer(const RsGxsId& gxs_id,const RsGxsTunnelId& tunnel_id,bool am_I_client_side)
|
||||
{
|
||||
bool res = true ;
|
||||
|
||||
if(is_client_side) // always accept distant chat when we're the client side.
|
||||
if(am_I_client_side) // always accept distant chat when we're the client side.
|
||||
return true ;
|
||||
|
||||
bool res = true ;
|
||||
|
||||
if(mDistantChatPermissions & RS_DISTANT_CHAT_CONTACT_PERMISSION_FLAG_FILTER_NON_CONTACTS)
|
||||
res = (rsIdentity!=NULL) && rsIdentity->isARegularContact(gxs_id) ;
|
||||
|
||||
|
@ -91,7 +91,7 @@ public:
|
||||
virtual void connectToGxsTunnelService(RsGxsTunnelService *tunnel_service) ;
|
||||
|
||||
private:
|
||||
virtual bool acceptDataFromPeer(const RsGxsId& gxs_id, const RsGxsTunnelService::RsGxsTunnelId& tunnel_id, bool is_client_side) ;
|
||||
virtual bool acceptDataFromPeer(const RsGxsId& gxs_id, const RsGxsTunnelService::RsGxsTunnelId& tunnel_id, bool am_I_client_side) ;
|
||||
virtual void notifyTunnelStatus(const RsGxsTunnelService::RsGxsTunnelId& tunnel_id,uint32_t tunnel_status) ;
|
||||
virtual void receiveData(const RsGxsTunnelService::RsGxsTunnelId& id,unsigned char *data,uint32_t data_size) ;
|
||||
|
||||
|
@ -136,7 +136,8 @@ bool DistributedChatService::handleRecvChatLobbyMsgItem(RsChatMsgItem *ci)
|
||||
return false ;
|
||||
}
|
||||
|
||||
if(rsReputations->overallReputationLevel(cli->signature.keyId) == RsReputations::REPUTATION_LOCALLY_NEGATIVE)
|
||||
if( rsReputations->overallReputationLevel(cli->signature.keyId) ==
|
||||
RsReputationLevel::LOCALLY_NEGATIVE )
|
||||
{
|
||||
std::cerr << "(WW) Received lobby msg/item from banned identity " << cli->signature.keyId << ". Dropping it." << std::endl;
|
||||
return false ;
|
||||
@ -677,9 +678,10 @@ void DistributedChatService::handleRecvChatLobbyEventItem(RsChatLobbyEventItem *
|
||||
#ifdef DEBUG_CHAT_LOBBIES
|
||||
std::cerr << "Received ChatLobbyEvent item of type " << (int)(item->event_type) << ", and string=" << item->string1 << std::endl;
|
||||
#endif
|
||||
rstime_t now = time(NULL) ;
|
||||
rstime_t now = time(nullptr);
|
||||
|
||||
if(rsReputations->overallReputationLevel(item->signature.keyId) == RsReputations::REPUTATION_LOCALLY_NEGATIVE)
|
||||
if( rsReputations->overallReputationLevel(item->signature.keyId) ==
|
||||
RsReputationLevel::LOCALLY_NEGATIVE )
|
||||
{
|
||||
std::cerr << "(WW) Received lobby msg/item from banned identity " << item->signature.keyId << ". Dropping it." << std::endl;
|
||||
return ;
|
||||
|
@ -44,34 +44,40 @@
|
||||
*
|
||||
*/
|
||||
|
||||
const double FT_TM_MAX_PEER_RATE = 100 * 1024 * 1024; /* 100MB/s */
|
||||
const double FT_TM_MAX_PEER_RATE = 100 * 1024 * 1024; /* 100MB/s */
|
||||
const uint32_t FT_TM_MAX_RESETS = 5;
|
||||
const uint32_t FT_TM_MINIMUM_CHUNK = 1024; /* ie 1Kb / sec */
|
||||
const uint32_t FT_TM_RESTART_DOWNLOAD = 20; /* 20 seconds */
|
||||
const uint32_t FT_TM_DOWNLOAD_TIMEOUT = 10; /* 10 seconds */
|
||||
//const uint32_t FT_TM_CRC_MAP_MAX_WAIT_PER_GIG = 20; /* 20 seconds per gigabyte */
|
||||
|
||||
// const double FT_TM_MAX_INCREASE = 1.00;
|
||||
// const double FT_TM_MIN_INCREASE = -0.10;
|
||||
const uint32_t FT_TM_MINIMUM_CHUNK = 1024; /* ie 1Kb / sec */
|
||||
const uint32_t FT_TM_DEFAULT_TRANSFER_RATE = 20*1024; /* ie 20 Kb/sec */
|
||||
const uint32_t FT_TM_RESTART_DOWNLOAD = 20; /* 20 seconds */
|
||||
const uint32_t FT_TM_DOWNLOAD_TIMEOUT = 10; /* 10 seconds */
|
||||
|
||||
const double FT_TM_RATE_INCREASE_SLOWER = 0.05 ;
|
||||
const double FT_TM_RATE_INCREASE_AVERAGE = 0.3 ;
|
||||
const double FT_TM_RATE_INCREASE_FASTER = 1.0 ;
|
||||
|
||||
//const int32_t FT_TM_FAST_RTT = 1.0;
|
||||
//const int32_t FT_TM_STD_RTT = 5.0;
|
||||
//const int32_t FT_TM_SLOW_RTT = 20.0;
|
||||
|
||||
//const uint32_t FT_TM_CRC_MAP_STATE_NOCHECK = 0 ;
|
||||
//const uint32_t FT_TM_CRC_MAP_STATE_DONT_HAVE = 1 ;
|
||||
//const uint32_t FT_TM_CRC_MAP_STATE_HAVE = 2 ;
|
||||
|
||||
#define FT_TM_FLAG_DOWNLOADING 0
|
||||
#define FT_TM_FLAG_CANCELED 1
|
||||
#define FT_TM_FLAG_COMPLETE 2
|
||||
#define FT_TM_FLAG_CHECKING 3
|
||||
#define FT_TM_FLAG_CHUNK_CRC 4
|
||||
|
||||
peerInfo::peerInfo(const RsPeerId& peerId_in)
|
||||
:peerId(peerId_in),state(PQIPEER_NOT_ONLINE),desiredRate(FT_TM_DEFAULT_TRANSFER_RATE),actualRate(FT_TM_DEFAULT_TRANSFER_RATE),
|
||||
lastTS(0),
|
||||
recvTS(0), lastTransfers(0), nResets(0),
|
||||
rtt(0), rttActive(false), rttStart(0), rttOffset(0),
|
||||
mRateIncrease(1)
|
||||
{
|
||||
}
|
||||
// peerInfo(const RsPeerId& peerId_in,uint32_t state_in,uint32_t maxRate_in):
|
||||
// peerId(peerId_in),state(state_in),desiredRate(maxRate_in),actualRate(0),
|
||||
// lastTS(0),
|
||||
// recvTS(0), lastTransfers(0), nResets(0),
|
||||
// rtt(0), rttActive(false), rttStart(0), rttOffset(0),
|
||||
// mRateIncrease(1)
|
||||
// {
|
||||
// return;
|
||||
// }
|
||||
ftTransferModule::ftTransferModule(ftFileCreator *fc, ftDataMultiplex *dm, ftController *c)
|
||||
:mFileCreator(fc), mMultiplexor(dm), mFtController(c), tfMtx("ftTransferModule"), mFlag(FT_TM_FLAG_DOWNLOADING),mPriority(SPEED_NORMAL)
|
||||
{
|
||||
|
@ -54,39 +54,32 @@ class HashThread ;
|
||||
class peerInfo
|
||||
{
|
||||
public:
|
||||
explicit peerInfo(const RsPeerId& peerId_in):peerId(peerId_in),state(PQIPEER_NOT_ONLINE),desiredRate(0),actualRate(0),
|
||||
lastTS(0),
|
||||
recvTS(0), lastTransfers(0), nResets(0),
|
||||
rtt(0), rttActive(false), rttStart(0), rttOffset(0),
|
||||
mRateIncrease(1)
|
||||
{
|
||||
return;
|
||||
}
|
||||
peerInfo(const RsPeerId& peerId_in,uint32_t state_in,uint32_t maxRate_in):
|
||||
peerId(peerId_in),state(state_in),desiredRate(maxRate_in),actualRate(0),
|
||||
lastTS(0),
|
||||
recvTS(0), lastTransfers(0), nResets(0),
|
||||
rtt(0), rttActive(false), rttStart(0), rttOffset(0),
|
||||
mRateIncrease(1)
|
||||
{
|
||||
return;
|
||||
}
|
||||
explicit peerInfo(const RsPeerId& peerId_in);
|
||||
|
||||
// peerInfo(const RsPeerId& peerId_in,uint32_t state_in,uint32_t maxRate_in):
|
||||
// peerId(peerId_in),state(state_in),desiredRate(maxRate_in),actualRate(0),
|
||||
// lastTS(0),
|
||||
// recvTS(0), lastTransfers(0), nResets(0),
|
||||
// rtt(0), rttActive(false), rttStart(0), rttOffset(0),
|
||||
// mRateIncrease(1)
|
||||
// {
|
||||
// return;
|
||||
// }
|
||||
RsPeerId peerId;
|
||||
uint32_t state;
|
||||
double desiredRate;
|
||||
double actualRate;
|
||||
double desiredRate; /* speed at which the data should be requested */
|
||||
double actualRate; /* actual speed at which the data is received */
|
||||
|
||||
rstime_t lastTS; /* last Request */
|
||||
rstime_t recvTS; /* last Recv */
|
||||
uint32_t lastTransfers; /* data recvd in last second */
|
||||
uint32_t nResets; /* count to disable non-existant files */
|
||||
rstime_t lastTS; /* last Request */
|
||||
rstime_t recvTS; /* last Recv */
|
||||
uint32_t lastTransfers; /* data recvd in last second */
|
||||
uint32_t nResets; /* count to disable non-existant files */
|
||||
|
||||
/* rrt rate control */
|
||||
uint32_t rtt; /* last rtt */
|
||||
bool rttActive; /* have we initialised an rtt measurement */
|
||||
rstime_t rttStart; /* ts of request */
|
||||
uint64_t rttOffset; /* end of request */
|
||||
float mRateIncrease; /* current rate */
|
||||
uint32_t rtt; /* last rtt */
|
||||
bool rttActive; /* have we initialised an rtt measurement */
|
||||
rstime_t rttStart; /* ts of request */
|
||||
uint64_t rttOffset; /* end of request */
|
||||
float mRateIncrease; /* current rate increase factor */
|
||||
};
|
||||
|
||||
class ftFileStatus
|
||||
|
@ -2014,7 +2014,8 @@ bool p3GRouter::verifySignedDataItem(RsGRouterAbstractMsgItem *item,const RsIden
|
||||
{
|
||||
try
|
||||
{
|
||||
if(rsReputations->overallReputationLevel(item->signature.keyId) == RsReputations::REPUTATION_LOCALLY_NEGATIVE)
|
||||
if( rsReputations->overallReputationLevel(item->signature.keyId) ==
|
||||
RsReputationLevel::LOCALLY_NEGATIVE )
|
||||
{
|
||||
std::cerr << "(WW) received global router message from banned identity " << item->signature.keyId << ". Rejecting the message." << std::endl;
|
||||
return false ;
|
||||
|
@ -912,7 +912,8 @@ int RsGenExchange::validateMsg(RsNxsMsg *msg, const uint32_t& grpFlag, const uin
|
||||
// now check reputation of the message author. The reputation will need to be at least as high as this value for the msg to validate.
|
||||
// At validation step, we accept all messages, except the ones signed by locally rejected identities.
|
||||
|
||||
if(details.mReputation.mOverallReputationLevel == RsReputations::REPUTATION_LOCALLY_NEGATIVE)
|
||||
if( details.mReputation.mOverallReputationLevel ==
|
||||
RsReputationLevel::LOCALLY_NEGATIVE )
|
||||
{
|
||||
#ifdef GEN_EXCH_DEBUG
|
||||
std::cerr << "RsGenExchange::validateMsg(): message from " << metaData.mAuthorId << ", rejected because reputation level (" << details.mReputation.mOverallReputationLevel <<") indicate that you banned this ID." << std::endl;
|
||||
@ -1848,7 +1849,8 @@ uint32_t RsGenExchange::getDefaultSyncPeriod()
|
||||
}
|
||||
}
|
||||
|
||||
RsReputations::ReputationLevel RsGenExchange::minReputationForForwardingMessages(uint32_t group_sign_flags,uint32_t identity_sign_flags)
|
||||
RsReputationLevel RsGenExchange::minReputationForForwardingMessages(
|
||||
uint32_t group_sign_flags, uint32_t identity_sign_flags )
|
||||
{
|
||||
return RsNetworkExchangeService::minReputationForForwardingMessages(group_sign_flags,identity_sign_flags);
|
||||
}
|
||||
|
@ -710,9 +710,10 @@ public:
|
||||
virtual bool getGroupNetworkStats(const RsGxsGroupId& grpId,RsGroupNetworkStats& stats);
|
||||
|
||||
uint16_t serviceType() const { return mServType ; }
|
||||
uint32_t serviceFullType() const { return ((uint32_t)mServType << 8) + (((uint32_t) RS_PKT_VERSION_SERVICE) << 24); }
|
||||
uint32_t serviceFullType() const { return RsServiceInfo::RsServiceInfoUIn16ToFullServiceId(mServType); }
|
||||
|
||||
virtual RsReputations::ReputationLevel minReputationForForwardingMessages(uint32_t group_sign_flags,uint32_t identity_flags);
|
||||
virtual RsReputationLevel minReputationForForwardingMessages(
|
||||
uint32_t group_sign_flags, uint32_t identity_flags );
|
||||
protected:
|
||||
|
||||
/** Notifications **/
|
||||
|
@ -178,25 +178,23 @@ public:
|
||||
uint32_t reputation_level ;
|
||||
};
|
||||
|
||||
class RsGixsReputation
|
||||
struct RsGixsReputation
|
||||
{
|
||||
public:
|
||||
// get Reputation.
|
||||
virtual RsReputations::ReputationLevel overallReputationLevel(const RsGxsId& id,uint32_t *identity_flags=NULL) = 0;
|
||||
virtual RsReputationLevel overallReputationLevel(
|
||||
const RsGxsId& id, uint32_t* identity_flags = nullptr ) = 0;
|
||||
virtual ~RsGixsReputation(){}
|
||||
};
|
||||
|
||||
/*** This Class pulls all the GXS Interfaces together ****/
|
||||
|
||||
class RsGxsIdExchange:
|
||||
public RsGenExchange,
|
||||
public RsGixs
|
||||
struct RsGxsIdExchange : RsGenExchange, RsGixs
|
||||
{
|
||||
public:
|
||||
RsGxsIdExchange(RsGeneralDataService* gds, RsNetworkExchangeService* ns, RsSerialType* serviceSerialiser, uint16_t mServType, uint32_t authenPolicy)
|
||||
:RsGenExchange(gds,ns,serviceSerialiser,mServType, this, authenPolicy) { return; }
|
||||
virtual ~RsGxsIdExchange() { return; }
|
||||
|
||||
RsGxsIdExchange(
|
||||
RsGeneralDataService* gds, RsNetworkExchangeService* ns,
|
||||
RsSerialType* serviceSerialiser, uint16_t mServType,
|
||||
uint32_t authenPolicy )
|
||||
: RsGenExchange(
|
||||
gds, ns, serviceSerialiser, mServType, this, authenPolicy ) {}
|
||||
};
|
||||
|
||||
|
||||
|
@ -3034,7 +3034,8 @@ void RsGxsNetService::locked_genReqMsgTransaction(NxsTransaction* tr)
|
||||
// - if author is locally banned, do not download.
|
||||
// - if author is not locally banned, download, whatever friends' opinion might be.
|
||||
|
||||
if(mReputations->overallReputationLevel(syncItem->authorId) == RsReputations::REPUTATION_LOCALLY_NEGATIVE)
|
||||
if( mReputations->overallReputationLevel(syncItem->authorId) ==
|
||||
RsReputationLevel::LOCALLY_NEGATIVE )
|
||||
{
|
||||
#ifdef NXS_NET_DEBUG_1
|
||||
GXSNETDEBUG_PG(item->PeerId(),grpId) << ", Identity " << syncItem->authorId << " is banned. Not requesting message!" << std::endl;
|
||||
@ -3239,7 +3240,9 @@ void RsGxsNetService::locked_genReqGrpTransaction(NxsTransaction* tr)
|
||||
// FIXTESTS global variable rsReputations not available in unittests!
|
||||
|
||||
#warning csoler 2016-12-23: Update the code below to correctly send/recv dependign on reputation
|
||||
if(!grpSyncItem->authorId.isNull() && mReputations->overallReputationLevel(grpSyncItem->authorId) == RsReputations::REPUTATION_LOCALLY_NEGATIVE)
|
||||
if( !grpSyncItem->authorId.isNull() &&
|
||||
mReputations->overallReputationLevel(grpSyncItem->authorId) ==
|
||||
RsReputationLevel::LOCALLY_NEGATIVE )
|
||||
{
|
||||
#ifdef NXS_NET_DEBUG_0
|
||||
GXSNETDEBUG_PG(tr->mTransaction->PeerId(),grpId) << " Identity " << grpSyncItem->authorId << " is banned. Not syncing group." << std::endl;
|
||||
|
@ -40,7 +40,8 @@ bool AuthorPending::expired() const
|
||||
bool AuthorPending::getAuthorRep(GixsReputation& rep, const RsGxsId& authorId, const RsPeerId& /*peerId*/)
|
||||
{
|
||||
rep.id = authorId ;
|
||||
rep.reputation_level = mRep->overallReputationLevel(authorId);
|
||||
rep.reputation_level =
|
||||
static_cast<uint32_t>(mRep->overallReputationLevel(authorId));
|
||||
|
||||
#warning csoler 2017-01-10: Can it happen that reputations do not have the info yet?
|
||||
return true ;
|
||||
|
@ -204,7 +204,10 @@ bool RsGxsIntegrityCheck::check()
|
||||
#ifdef DEBUG_GXSUTIL
|
||||
GXSUTIL_DEBUG() << "TimeStamping group authors' key ID " << grp->metaData->mAuthorId << " in group ID " << grp->grpId << std::endl;
|
||||
#endif
|
||||
if( rsReputations && rsReputations->overallReputationLevel(grp->metaData->mAuthorId ) > RsReputations::REPUTATION_LOCALLY_NEGATIVE )
|
||||
if( rsReputations &&
|
||||
rsReputations->overallReputationLevel(
|
||||
grp->metaData->mAuthorId ) >
|
||||
RsReputationLevel::LOCALLY_NEGATIVE )
|
||||
used_gxs_ids.insert(std::make_pair(grp->metaData->mAuthorId, RsIdentityUsage(mGenExchangeClient->serviceType(), RsIdentityUsage::GROUP_AUTHOR_KEEP_ALIVE,grp->grpId)));
|
||||
}
|
||||
}
|
||||
@ -388,7 +391,10 @@ bool RsGxsIntegrityCheck::check()
|
||||
#ifdef DEBUG_GXSUTIL
|
||||
GXSUTIL_DEBUG() << "TimeStamping message authors' key ID " << msg->metaData->mAuthorId << " in message " << msg->msgId << ", group ID " << msg->grpId<< std::endl;
|
||||
#endif
|
||||
if(rsReputations!=NULL && rsReputations->overallReputationLevel(msg->metaData->mAuthorId) > RsReputations::REPUTATION_LOCALLY_NEGATIVE)
|
||||
if( rsReputations &&
|
||||
rsReputations->overallReputationLevel(
|
||||
msg->metaData->mAuthorId ) >
|
||||
RsReputationLevel::LOCALLY_NEGATIVE )
|
||||
used_gxs_ids.insert(std::make_pair(msg->metaData->mAuthorId,RsIdentityUsage(mGenExchangeClient->serviceType(),RsIdentityUsage::MESSAGE_AUTHOR_KEEP_ALIVE,msg->metaData->mGroupId,msg->metaData->mMsgId))) ;
|
||||
}
|
||||
}
|
||||
|
@ -253,13 +253,14 @@ public:
|
||||
* \param identity_flags Flags of the identity
|
||||
* \return
|
||||
*/
|
||||
static RsReputations::ReputationLevel minReputationForRequestingMessages(uint32_t /* group_sign_flags */, uint32_t /* identity_flags */)
|
||||
static RsReputationLevel minReputationForRequestingMessages(
|
||||
uint32_t /* group_sign_flags */, uint32_t /* identity_flags */ )
|
||||
{
|
||||
// We always request messages, except if the author identity is locally banned.
|
||||
|
||||
return RsReputations::REPUTATION_REMOTELY_NEGATIVE;
|
||||
return RsReputationLevel::REMOTELY_NEGATIVE;
|
||||
}
|
||||
static RsReputations::ReputationLevel minReputationForForwardingMessages(uint32_t group_sign_flags, uint32_t identity_flags)
|
||||
static RsReputationLevel minReputationForForwardingMessages(
|
||||
uint32_t group_sign_flags, uint32_t identity_flags )
|
||||
{
|
||||
// If anti-spam is enabled, do not send messages from authors with bad reputation. The policy is to only forward messages if the reputation of the author is at least
|
||||
// equal to the minimal reputation in the table below (R=remotely, L=locally, P=positive, N=negative, O=neutral) :
|
||||
@ -277,20 +278,20 @@ public:
|
||||
//
|
||||
|
||||
if(identity_flags & RS_IDENTITY_FLAGS_PGP_KNOWN)
|
||||
return RsReputations::REPUTATION_NEUTRAL;
|
||||
return RsReputationLevel::NEUTRAL;
|
||||
else if(identity_flags & RS_IDENTITY_FLAGS_PGP_LINKED)
|
||||
{
|
||||
if(group_sign_flags & GXS_SERV::FLAG_AUTHOR_AUTHENTICATION_GPG_KNOWN)
|
||||
return RsReputations::REPUTATION_REMOTELY_POSITIVE;
|
||||
return RsReputationLevel::REMOTELY_POSITIVE;
|
||||
else
|
||||
return RsReputations::REPUTATION_NEUTRAL;
|
||||
return RsReputationLevel::NEUTRAL;
|
||||
}
|
||||
else
|
||||
{
|
||||
if( (group_sign_flags & GXS_SERV::FLAG_AUTHOR_AUTHENTICATION_GPG_KNOWN) || (group_sign_flags & GXS_SERV::FLAG_AUTHOR_AUTHENTICATION_GPG))
|
||||
return RsReputations::REPUTATION_REMOTELY_POSITIVE;
|
||||
return RsReputationLevel::REMOTELY_POSITIVE;
|
||||
else
|
||||
return RsReputations::REPUTATION_NEUTRAL;
|
||||
return RsReputationLevel::NEUTRAL;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
@ -1256,31 +1256,38 @@ bool p3GxsTrans::acceptNewMessage(const RsGxsMsgMetaData *msgMeta,uint32_t msg_s
|
||||
uint32_t max_size = 0 ;
|
||||
uint32_t identity_flags = 0 ;
|
||||
|
||||
RsReputations::ReputationLevel rep_lev = rsReputations->overallReputationLevel(msgMeta->mAuthorId,&identity_flags);
|
||||
RsReputationLevel rep_lev =
|
||||
rsReputations->overallReputationLevel(
|
||||
msgMeta->mAuthorId, &identity_flags );
|
||||
|
||||
switch(rep_lev)
|
||||
{
|
||||
case RsReputations::REPUTATION_REMOTELY_NEGATIVE: max_count = GXSTRANS_MAX_COUNT_REMOTELY_NEGATIVE_DEFAULT;
|
||||
max_size = GXSTRANS_MAX_SIZE_REMOTELY_NEGATIVE_DEFAULT;
|
||||
break ;
|
||||
case RsReputations::REPUTATION_NEUTRAL: max_count = GXSTRANS_MAX_COUNT_NEUTRAL_DEFAULT;
|
||||
max_size = GXSTRANS_MAX_SIZE_NEUTRAL_DEFAULT;
|
||||
break ;
|
||||
case RsReputations::REPUTATION_REMOTELY_POSITIVE: max_count = GXSTRANS_MAX_COUNT_REMOTELY_POSITIVE_DEFAULT;
|
||||
max_size = GXSTRANS_MAX_SIZE_REMOTELY_POSITIVE_DEFAULT;
|
||||
break ;
|
||||
case RsReputations::REPUTATION_LOCALLY_POSITIVE: max_count = GXSTRANS_MAX_COUNT_LOCALLY_POSITIVE_DEFAULT;
|
||||
max_size = GXSTRANS_MAX_SIZE_LOCALLY_POSITIVE_DEFAULT;
|
||||
break ;
|
||||
default:
|
||||
case RsReputations::REPUTATION_LOCALLY_NEGATIVE: max_count = 0 ;
|
||||
max_size = 0 ;
|
||||
case RsReputationLevel::REMOTELY_NEGATIVE:
|
||||
max_count = GXSTRANS_MAX_COUNT_REMOTELY_NEGATIVE_DEFAULT;
|
||||
max_size = GXSTRANS_MAX_SIZE_REMOTELY_NEGATIVE_DEFAULT;
|
||||
break ;
|
||||
case RsReputationLevel::NEUTRAL:
|
||||
max_count = GXSTRANS_MAX_COUNT_NEUTRAL_DEFAULT;
|
||||
max_size = GXSTRANS_MAX_SIZE_NEUTRAL_DEFAULT;
|
||||
break;
|
||||
case RsReputationLevel::REMOTELY_POSITIVE:
|
||||
max_count = GXSTRANS_MAX_COUNT_REMOTELY_POSITIVE_DEFAULT;
|
||||
max_size = GXSTRANS_MAX_SIZE_REMOTELY_POSITIVE_DEFAULT;
|
||||
break;
|
||||
case RsReputationLevel::LOCALLY_POSITIVE:
|
||||
max_count = GXSTRANS_MAX_COUNT_LOCALLY_POSITIVE_DEFAULT;
|
||||
max_size = GXSTRANS_MAX_SIZE_LOCALLY_POSITIVE_DEFAULT;
|
||||
break;
|
||||
case RsReputationLevel::LOCALLY_NEGATIVE: // fallthrough
|
||||
default:
|
||||
max_count = 0;
|
||||
max_size = 0;
|
||||
break;
|
||||
}
|
||||
|
||||
bool pgp_linked = identity_flags & RS_IDENTITY_FLAGS_PGP_LINKED ;
|
||||
bool pgp_linked = identity_flags & RS_IDENTITY_FLAGS_PGP_LINKED;
|
||||
|
||||
if(rep_lev <= RsReputations::REPUTATION_NEUTRAL && !pgp_linked)
|
||||
if(rep_lev <= RsReputationLevel::NEUTRAL && !pgp_linked)
|
||||
{
|
||||
max_count /= 10 ;
|
||||
max_size /= 10 ;
|
||||
@ -1288,7 +1295,7 @@ bool p3GxsTrans::acceptNewMessage(const RsGxsMsgMetaData *msgMeta,uint32_t msg_s
|
||||
|
||||
RS_STACK_MUTEX(mPerUserStatsMutex);
|
||||
|
||||
MsgSizeCount& s(per_user_statistics[msgMeta->mAuthorId]) ;
|
||||
MsgSizeCount& s(per_user_statistics[msgMeta->mAuthorId]);
|
||||
|
||||
#ifdef DEBUG_GXSTRANS
|
||||
std::cerr << "GxsTrans::acceptMessage(): size=" << msg_size << ", grp=" << msgMeta->mGroupId << ", gxs_id=" << msgMeta->mAuthorId << ", pgp_linked=" << pgp_linked << ", current (size,cnt)=("
|
||||
|
@ -370,11 +370,11 @@ void p3GxsTunnelService::handleRecvTunnelDataItem(const RsGxsTunnelId& tunnel_id
|
||||
std::map<RsGxsTunnelId,GxsTunnelPeerInfo>::iterator it2 = _gxs_tunnel_contacts.find(tunnel_id) ;
|
||||
|
||||
if(it2 != _gxs_tunnel_contacts.end())
|
||||
{
|
||||
it2->second.client_services.insert(item->service_id) ;
|
||||
peer_from = it2->second.to_gxs_id ;
|
||||
is_client_side = (it2->second.direction == RsTurtleGenericDataItem::DIRECTION_CLIENT);
|
||||
}
|
||||
{
|
||||
it2->second.client_services.insert(item->service_id) ;
|
||||
peer_from = it2->second.to_gxs_id ;
|
||||
is_client_side = (it2->second.direction == RsTurtleGenericDataItem::DIRECTION_SERVER);
|
||||
}
|
||||
|
||||
// Check if the item has already been received. This is necessary because we actually re-send items until an ACK is received. If the ACK gets lost (connection interrupted) the
|
||||
// item may be received twice. This is conservative and ensure that no item is lost nor received twice.
|
||||
|
@ -193,12 +193,6 @@ linux-* {
|
||||
}
|
||||
}
|
||||
|
||||
#CONFIG += version_detail_bash_script
|
||||
|
||||
# linux/bsd can use either - libupnp is more complete and packaged.
|
||||
#CONFIG += upnp_miniupnpc
|
||||
CONFIG += upnp_libupnp
|
||||
|
||||
# Check if the systems libupnp has been Debian-patched
|
||||
system(grep -E 'char[[:space:]]+PublisherUrl' /usr/include/upnp/upnp.h >/dev/null 2>&1) {
|
||||
# Normal libupnp
|
||||
@ -207,8 +201,9 @@ linux-* {
|
||||
DEFINES *= PATCHED_LIBUPNP
|
||||
}
|
||||
|
||||
PKGCONFIG *= libssl libupnp
|
||||
PKGCONFIG *= libcrypto zlib
|
||||
PKGCONFIG *= libssl
|
||||
equals(RS_UPNP_LIB, "upnp ixml threadutil"):PKGCONFIG *= libupnp
|
||||
PKGCONFIG *= libcrypto zlib
|
||||
no_sqlcipher:PKGCONFIG *= sqlite3
|
||||
LIBS *= -ldl
|
||||
|
||||
@ -240,8 +235,6 @@ win32-x-g++ {
|
||||
QMAKE_AR = i586-mingw32msvc-ar
|
||||
DEFINES *= STATICLIB WIN32
|
||||
|
||||
CONFIG += upnp_miniupnpc
|
||||
|
||||
SSL_DIR=../../../../openssl
|
||||
UPNPC_DIR = ../../../../miniupnpc-1.3
|
||||
GPG_ERROR_DIR = ../../../../libgpg-error-1.7
|
||||
@ -309,10 +302,6 @@ freebsd-* {
|
||||
INCLUDEPATH *= /usr/local/include/glib-2.0
|
||||
|
||||
QMAKE_CXXFLAGS *= -Dfseeko64=fseeko -Dftello64=ftello -Dstat64=stat -Dstatvfs64=statvfs -Dfopen64=fopen
|
||||
|
||||
# linux/bsd can use either - libupnp is more complete and packaged.
|
||||
#CONFIG += upnp_miniupnpc
|
||||
CONFIG += upnp_libupnp
|
||||
}
|
||||
|
||||
################################# OpenBSD ##########################################
|
||||
@ -322,8 +311,6 @@ openbsd-* {
|
||||
INCLUDEPATH += $$system(pkg-config --cflags glib-2.0 | sed -e "s/-I//g")
|
||||
|
||||
QMAKE_CXXFLAGS *= -Dfseeko64=fseeko -Dftello64=ftello -Dstat64=stat -Dstatvfs64=statvfs -Dfopen64=fopen
|
||||
|
||||
CONFIG += upnp_libupnp
|
||||
}
|
||||
|
||||
################################# Haiku ##########################################
|
||||
@ -335,7 +322,6 @@ haiku-* {
|
||||
INCLUDEPATH *= $${OPENPGPSDK_DIR} ../openpgpsdk
|
||||
DEFINES *= NO_SQLCIPHER
|
||||
CONFIG += release
|
||||
CONFIG += upnp_libupnp
|
||||
DESTDIR = lib
|
||||
}
|
||||
|
||||
@ -661,12 +647,6 @@ SOURCES += util/folderiterator.cc \
|
||||
util/rstime.cc \
|
||||
util/rsurl.cc
|
||||
|
||||
## Added for retrocompatibility remove ASAP
|
||||
isEmpty(RS_UPNP_LIB) {
|
||||
upnp_miniupnpc:RS_UPNP_LIB=miniupnpc
|
||||
upnp_libupnp:RS_UPNP_LIB="upnp ixml threadutil"
|
||||
}
|
||||
|
||||
equals(RS_UPNP_LIB, miniupnpc) {
|
||||
HEADERS += upnp/upnputil.h upnp/upnphandler_miniupnp.h
|
||||
SOURCES += upnp/upnputil.c upnp/upnphandler_miniupnp.cc
|
||||
@ -676,8 +656,6 @@ equals(RS_UPNP_LIB, miniupnpc) {
|
||||
DEFINES *= RS_USE_LIBUPNP
|
||||
}
|
||||
|
||||
|
||||
|
||||
zeroconf {
|
||||
|
||||
HEADERS += zeroconf/p3zeroconf.h \
|
||||
@ -776,6 +754,7 @@ SOURCES += serialiser/rsserializable.cc \
|
||||
|
||||
# Identity Service
|
||||
HEADERS += retroshare/rsidentity.h \
|
||||
retroshare/rsreputations.h \
|
||||
gxs/rsgixs.h \
|
||||
services/p3idservice.h \
|
||||
rsitems/rsgxsiditems.h \
|
||||
|
@ -459,10 +459,7 @@ bool p3ServiceControl::checkFilter(uint32_t serviceId, const RsPeerId &peerId)
|
||||
#endif
|
||||
|
||||
// must allow ServiceInfo through, or we have nothing!
|
||||
#define FULLID_SERVICEINFO ((((uint32_t) RS_PKT_VERSION_SERVICE) << 24) + ((RS_SERVICE_TYPE_SERVICEINFO) << 8))
|
||||
|
||||
//if (serviceId == RS_SERVICE_TYPE_SERVICEINFO)
|
||||
if (serviceId == FULLID_SERVICEINFO)
|
||||
if (serviceId == RsServiceInfo::RsServiceInfoUIn16ToFullServiceId(RS_SERVICE_TYPE_SERVICEINFO))
|
||||
{
|
||||
#ifdef SERVICECONTROL_DEBUG
|
||||
std::cerr << "p3ServiceControl::checkFilter() Allowed SERVICEINFO";
|
||||
|
@ -42,7 +42,7 @@ class RsGxsChannels;
|
||||
*/
|
||||
extern RsGxsChannels* rsGxsChannels;
|
||||
|
||||
// These should be in rsgxscommon.h
|
||||
|
||||
struct RsGxsChannelGroup : RsSerializable
|
||||
{
|
||||
RsGroupMetaData mMeta;
|
||||
|
@ -3,7 +3,8 @@
|
||||
* *
|
||||
* libretroshare: retroshare core library *
|
||||
* *
|
||||
* Copyright 2012-2012 by Robert Fernie <retroshare@lunamutt.com> *
|
||||
* Copyright (C) 2012 Robert Fernie <retroshare@lunamutt.com> *
|
||||
* Copyright (C) 2018 Gioacchino Mazzurco <gio@eigenlab.org> *
|
||||
* *
|
||||
* This program is free software: you can redistribute it and/or modify *
|
||||
* it under the terms of the GNU Lesser General Public License as *
|
||||
@ -19,34 +20,31 @@
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>. *
|
||||
* *
|
||||
*******************************************************************************/
|
||||
#ifndef RETROSHARE_GXSCIRCLES_INTERFACE_H
|
||||
#define RETROSHARE_GXSCIRCLES_INTERFACE_H
|
||||
#pragma once
|
||||
|
||||
#include <inttypes.h>
|
||||
#include <cstdint>
|
||||
#include <string>
|
||||
#include <list>
|
||||
#include <set>
|
||||
|
||||
#include "retroshare/rstypes.h"
|
||||
|
||||
//typedef std::string RsGxsCircleId;
|
||||
//typedef RsPgpId RsPgpId;
|
||||
//typedef std::string RsCircleInternalId;
|
||||
|
||||
#include "retroshare/rstokenservice.h"
|
||||
#include "retroshare/rsgxsifacehelper.h"
|
||||
|
||||
#include "retroshare/rsidentity.h"
|
||||
#include "serialiser/rsserializable.h"
|
||||
|
||||
|
||||
/* The Main Interface Class - for information about your Peers */
|
||||
class RsGxsCircles;
|
||||
extern RsGxsCircles *rsGxsCircles;
|
||||
|
||||
typedef RsPgpId RsPgpId;
|
||||
/**
|
||||
* Pointer to global instance of RsGxsCircles service implementation
|
||||
* @jsonapi{development}
|
||||
*/
|
||||
extern RsGxsCircles* rsGxsCircles;
|
||||
|
||||
|
||||
// TODO: convert to enum
|
||||
/// The meaning of the different circle types is:
|
||||
/// TODO: convert to enum
|
||||
static const uint32_t GXS_CIRCLE_TYPE_UNKNOWN = 0x0000 ; /// Used to detect uninizialized values.
|
||||
static const uint32_t GXS_CIRCLE_TYPE_PUBLIC = 0x0001 ; // not restricted to a circle
|
||||
static const uint32_t GXS_CIRCLE_TYPE_EXTERNAL = 0x0002 ; // restricted to an external circle, made of RsGxsId
|
||||
@ -62,90 +60,207 @@ static const uint32_t GXS_EXTERNAL_CIRCLE_FLAGS_ALLOWED = 0x0007 ;// user
|
||||
|
||||
static const uint32_t GXS_CIRCLE_FLAGS_IS_EXTERNAL = 0x0008 ;// user is allowed
|
||||
|
||||
/* Permissions is part of GroupMetaData */
|
||||
|
||||
class GxsPermissions
|
||||
struct RsGxsCircleGroup : RsSerializable
|
||||
{
|
||||
public:
|
||||
uint32_t mCircleType; // PUBLIC, EXTERNAL or YOUREYESONLY.
|
||||
RsGxsCircleId mCircleId; // If EXTERNAL, otherwise Blank.
|
||||
virtual ~RsGxsCircleGroup() {}
|
||||
|
||||
// BELOW IS NOT SERIALISED - BUT MUST BE STORED LOCALLY BY GXS. (If YOUREYESONLY)
|
||||
RsPeerId mOriginator;
|
||||
RsGxsCircleId mInternalCircle; // if Originator == ownId, otherwise blank.
|
||||
RsGroupMetaData mMeta;
|
||||
|
||||
std::set<RsPgpId> mLocalFriends;
|
||||
std::set<RsGxsId> mInvitedMembers;
|
||||
std::set<RsGxsCircleId> mSubCircles;
|
||||
#ifdef V07_NON_BACKWARD_COMPATIBLE_CHANGE_UNNAMED
|
||||
# error "Add description, and multiple owners/administrators to circles"
|
||||
// or better in general to GXS groups
|
||||
#endif
|
||||
|
||||
/// @see RsSerializable
|
||||
void serial_process( RsGenericSerializer::SerializeJob j,
|
||||
RsGenericSerializer::SerializeContext& ctx) override
|
||||
{
|
||||
RS_SERIAL_PROCESS(mMeta);
|
||||
RS_SERIAL_PROCESS(mLocalFriends);
|
||||
RS_SERIAL_PROCESS(mInvitedMembers);
|
||||
RS_SERIAL_PROCESS(mSubCircles);
|
||||
}
|
||||
};
|
||||
|
||||
class RsGxsCircleGroup
|
||||
struct RsGxsCircleMsg : RsSerializable
|
||||
{
|
||||
public:
|
||||
RsGroupMetaData mMeta; // includes GxsPermissions, for control of group distribution.
|
||||
virtual ~RsGxsCircleMsg() {}
|
||||
|
||||
std::set<RsPgpId> mLocalFriends;
|
||||
std::set<RsGxsId> mInvitedMembers;
|
||||
std::set<RsGxsCircleId> mSubCircles;
|
||||
|
||||
// Not Serialised.
|
||||
// Internally inside rsCircles, this will be turned into:
|
||||
// std::list<RsPeerId> mAllowedFriends;
|
||||
};
|
||||
|
||||
class RsGxsCircleMsg
|
||||
{
|
||||
public:
|
||||
RsMsgMetaData mMeta;
|
||||
|
||||
// Signature by user signifying that they want to be part of the group.
|
||||
// maybe Phase 3.
|
||||
#ifndef V07_NON_BACKWARD_COMPATIBLE_CHANGE_UNNAMED
|
||||
/* This is horrible and should be changed into yet to be defined something
|
||||
* reasonable in next non retrocompatible version */
|
||||
std::string stuff;
|
||||
#endif
|
||||
|
||||
/// @see RsSerializable
|
||||
void serial_process( RsGenericSerializer::SerializeJob j,
|
||||
RsGenericSerializer::SerializeContext& ctx) override
|
||||
{
|
||||
RS_SERIAL_PROCESS(mMeta);
|
||||
RS_SERIAL_PROCESS(stuff);
|
||||
}
|
||||
};
|
||||
|
||||
class RsGxsCircleDetails
|
||||
struct RsGxsCircleDetails : RsSerializable
|
||||
{
|
||||
public:
|
||||
RsGxsCircleDetails() : mCircleType(GXS_CIRCLE_TYPE_EXTERNAL), mAmIAllowed(false) {}
|
||||
|
||||
RsGxsCircleId mCircleId;
|
||||
std::string mCircleName;
|
||||
RsGxsCircleDetails() :
|
||||
mCircleType(GXS_CIRCLE_TYPE_EXTERNAL), mAmIAllowed(false) {}
|
||||
~RsGxsCircleDetails() {}
|
||||
|
||||
uint32_t mCircleType;
|
||||
RsGxsCircleId mRestrictedCircleId;
|
||||
|
||||
bool mAmIAllowed ; // true when one of load GXS ids belong to the circle allowed list (admin list & subscribed list).
|
||||
RsGxsCircleId mCircleId;
|
||||
std::string mCircleName;
|
||||
|
||||
std::set<RsGxsId> mAllowedGxsIds; // This crosses admin list and subscribed list
|
||||
std::set<RsPgpId> mAllowedNodes;
|
||||
|
||||
std::map<RsGxsId,uint32_t> mSubscriptionFlags ; // subscription flags for all ids
|
||||
uint32_t mCircleType;
|
||||
RsGxsCircleId mRestrictedCircleId;
|
||||
|
||||
/** true when one of load GXS ids belong to the circle allowed list (admin
|
||||
* list & subscribed list). */
|
||||
bool mAmIAllowed;
|
||||
|
||||
/// This crosses admin list and subscribed list
|
||||
std::set<RsGxsId> mAllowedGxsIds;
|
||||
std::set<RsPgpId> mAllowedNodes;
|
||||
|
||||
/// subscription flags for all ids
|
||||
std::map<RsGxsId,uint32_t> mSubscriptionFlags;
|
||||
|
||||
/// @see RsSerializable
|
||||
void serial_process( RsGenericSerializer::SerializeJob j,
|
||||
RsGenericSerializer::SerializeContext& ctx) override
|
||||
{
|
||||
RS_SERIAL_PROCESS(mCircleId);
|
||||
RS_SERIAL_PROCESS(mCircleName);
|
||||
RS_SERIAL_PROCESS(mCircleType);
|
||||
RS_SERIAL_PROCESS(mRestrictedCircleId);
|
||||
RS_SERIAL_PROCESS(mAmIAllowed);
|
||||
RS_SERIAL_PROCESS(mAllowedGxsIds);
|
||||
RS_SERIAL_PROCESS(mAllowedNodes);
|
||||
RS_SERIAL_PROCESS(mSubscriptionFlags);
|
||||
}
|
||||
};
|
||||
|
||||
class RsGxsCircles: public RsGxsIfaceHelper
|
||||
{
|
||||
public:
|
||||
|
||||
RsGxsCircles(RsGxsIface& gxs) :RsGxsIfaceHelper(gxs) {}
|
||||
RsGxsCircles(RsGxsIface& gxs) : RsGxsIfaceHelper(gxs) {}
|
||||
virtual ~RsGxsCircles() {}
|
||||
|
||||
/* External Interface (Cached stuff) */
|
||||
virtual bool getCircleDetails(const RsGxsCircleId &id, RsGxsCircleDetails &details) = 0;
|
||||
virtual bool getCircleExternalIdList(std::list<RsGxsCircleId> &circleIds) = 0;
|
||||
virtual bool getCirclePersonalIdList(std::list<RsGxsCircleId> &circleIds) = 0;
|
||||
/**
|
||||
* @brief Create new circle
|
||||
* @jsonapi{development}
|
||||
* @param[inout] cData input name and flags of the circle, storage for
|
||||
* generated circle data id etc.
|
||||
* @return false if something failed, true otherwhise
|
||||
*/
|
||||
virtual bool createCircle(RsGxsCircleGroup& cData) = 0;
|
||||
|
||||
/* membership management for external circles */
|
||||
/**
|
||||
* @brief Edit own existing circle
|
||||
* @jsonapi{development}
|
||||
* @param[inout] cData Circle data with modifications, storage for data
|
||||
* updatedad during the operation.
|
||||
* @return false if something failed, true otherwhise
|
||||
*/
|
||||
virtual bool editCircle(RsGxsCircleGroup& cData) = 0;
|
||||
|
||||
virtual bool requestCircleMembership(const RsGxsId& own_gxsid,const RsGxsCircleId& circle_id)=0 ;
|
||||
virtual bool cancelCircleMembership(const RsGxsId& own_gxsid,const RsGxsCircleId& circle_id)=0 ;
|
||||
/**
|
||||
* @brief Get circle details. Memory cached
|
||||
* @jsonapi{development}
|
||||
* @param[in] id Id of the circle
|
||||
* @param[out] details Storage for the circle details
|
||||
* @return false if something failed, true otherwhise
|
||||
*/
|
||||
virtual bool getCircleDetails(
|
||||
const RsGxsCircleId& id, RsGxsCircleDetails& details ) = 0;
|
||||
|
||||
/* standard load */
|
||||
virtual bool getGroupData(const uint32_t &token, std::vector<RsGxsCircleGroup> &groups) = 0;
|
||||
virtual bool getMsgData(const uint32_t &token, std::vector<RsGxsCircleMsg> &msgs) = 0;
|
||||
/**
|
||||
* @brief Get list of known external circles ids. Memory cached
|
||||
* @jsonapi{development}
|
||||
* @param[in] circleIds Storage for circles id list
|
||||
* @return false if something failed, true otherwhise
|
||||
*/
|
||||
virtual bool getCircleExternalIdList(
|
||||
std::list<RsGxsCircleId>& circleIds ) = 0;
|
||||
|
||||
/* make new group */
|
||||
/**
|
||||
* @brief Get circles summaries list.
|
||||
* @jsonapi{development}
|
||||
* @param[out] circles list where to store the circles summaries
|
||||
* @return false if something failed, true otherwhise
|
||||
*/
|
||||
virtual bool getCirclesSummaries(std::list<RsGroupMetaData>& circles) = 0;
|
||||
|
||||
/**
|
||||
* @brief Get circles information
|
||||
* @jsonapi{development}
|
||||
* @param[in] circlesIds ids of the circles of which to get the informations
|
||||
* @param[out] circlesInfo storage for the circles informations
|
||||
* @return false if something failed, true otherwhise
|
||||
*/
|
||||
virtual bool getCirclesInfo(
|
||||
const std::list<RsGxsGroupId>& circlesIds,
|
||||
std::vector<RsGxsCircleGroup>& circlesInfo ) = 0;
|
||||
|
||||
/**
|
||||
* @brief Get circle requests
|
||||
* @jsonapi{development}
|
||||
* @param[in] circleId id of the circle of which the requests are requested
|
||||
* @param[out] requests storage for the circle requests
|
||||
* @return false if something failed, true otherwhise
|
||||
*/
|
||||
virtual bool getCircleRequests( const RsGxsGroupId& circleId,
|
||||
std::vector<RsGxsCircleMsg>& requests ) = 0;
|
||||
|
||||
/**
|
||||
* @brief Invite identities to circle
|
||||
* @jsonapi{development}
|
||||
* @param[in] identities ids of the identities to invite
|
||||
* @param[in] circleId Id of the circle you own and want to invite ids in
|
||||
* @return false if something failed, true otherwhise
|
||||
*/
|
||||
virtual bool inviteIdsToCircle( const std::set<RsGxsId>& identities,
|
||||
const RsGxsCircleId& circleId ) = 0;
|
||||
|
||||
/**
|
||||
* @brief Request circle membership, or accept circle invitation
|
||||
* @jsonapi{development}
|
||||
* @param[in] ownGxsId Id of own identity to introduce to the circle
|
||||
* @param[in] circleId Id of the circle to which ask for inclusion
|
||||
* @return false if something failed, true otherwhise
|
||||
*/
|
||||
virtual bool requestCircleMembership(
|
||||
const RsGxsId& ownGxsId, const RsGxsCircleId& circleId ) = 0;
|
||||
|
||||
/**
|
||||
* @brief Leave given circle
|
||||
* @jsonapi{development}
|
||||
* @param[in] ownGxsId Own id to remove from the circle
|
||||
* @param[in] circleId Id of the circle to leave
|
||||
* @return false if something failed, true otherwhise
|
||||
*/
|
||||
virtual bool cancelCircleMembership(
|
||||
const RsGxsId& ownGxsId, const RsGxsCircleId& circleId ) = 0;
|
||||
|
||||
RS_DEPRECATED_FOR("getCirclesSummaries getCirclesInfo")
|
||||
virtual bool getGroupData(
|
||||
const uint32_t& token, std::vector<RsGxsCircleGroup>& groups ) = 0;
|
||||
|
||||
RS_DEPRECATED_FOR(getCirclesRequests)
|
||||
virtual bool getMsgData(
|
||||
const uint32_t& token, std::vector<RsGxsCircleMsg>& msgs ) = 0;
|
||||
|
||||
/// make new group
|
||||
RS_DEPRECATED_FOR(createCircle)
|
||||
virtual void createGroup(uint32_t& token, RsGxsCircleGroup &group) = 0;
|
||||
|
||||
/* update an existing group */
|
||||
/// update an existing group
|
||||
RS_DEPRECATED_FOR("editCircle, inviteIdsToCircle")
|
||||
virtual void updateGroup(uint32_t &token, RsGxsCircleGroup &group) = 0;
|
||||
};
|
||||
|
||||
|
||||
|
||||
#endif
|
||||
|
@ -169,8 +169,8 @@ struct RsGxsCommentService
|
||||
virtual bool getRelatedComments( uint32_t token,
|
||||
std::vector<RsGxsComment> &comments ) = 0;
|
||||
|
||||
virtual bool createComment(uint32_t &token, RsGxsComment &comment) = 0;
|
||||
virtual bool createVote(uint32_t &token, RsGxsVote &vote) = 0;
|
||||
virtual bool createNewComment(uint32_t &token, RsGxsComment &comment) = 0;
|
||||
virtual bool createNewVote(uint32_t &token, RsGxsVote &vote) = 0;
|
||||
|
||||
virtual bool acknowledgeComment(
|
||||
uint32_t token,
|
||||
|
@ -217,7 +217,8 @@ struct RsGxsIface
|
||||
virtual uint32_t getSyncPeriod(const RsGxsGroupId& grpId) = 0;
|
||||
virtual void setSyncPeriod(const RsGxsGroupId& grpId,uint32_t age_in_secs) = 0;
|
||||
|
||||
virtual RsReputations::ReputationLevel minReputationForForwardingMessages(uint32_t group_sign_flags,uint32_t identity_flags)=0;
|
||||
virtual RsReputationLevel minReputationForForwardingMessages(
|
||||
uint32_t group_sign_flags,uint32_t identity_flags ) = 0;
|
||||
};
|
||||
|
||||
|
||||
|
@ -228,7 +228,8 @@ struct RsGxsIfaceHelper
|
||||
mGxs.setSyncPeriod(grpId,age_in_secs);
|
||||
}
|
||||
|
||||
RsReputations::ReputationLevel minReputationForForwardingMessages(uint32_t group_sign_flags,uint32_t identity_flags)
|
||||
RsReputationLevel minReputationForForwardingMessages(
|
||||
uint32_t group_sign_flags, uint32_t identity_flags )
|
||||
{
|
||||
return mGxs.minReputationForForwardingMessages(group_sign_flags,identity_flags);
|
||||
}
|
||||
|
@ -90,7 +90,9 @@ struct RsGroupMetaData : RsSerializable
|
||||
rstime_t mLastPost; // Timestamp for last message. Not used yet.
|
||||
|
||||
uint32_t mGroupStatus;
|
||||
std::string mServiceString; // Service Specific Free-Form extra storage.
|
||||
|
||||
/// Service Specific Free-Form local (non-synced) extra storage.
|
||||
std::string mServiceString;
|
||||
RsPeerId mOriginator;
|
||||
RsGxsCircleId mInternalCircle;
|
||||
|
||||
|
@ -62,7 +62,7 @@ public:
|
||||
|
||||
// Gives feedback about type of data that is allowed in. For security reasons, this always needs to be re-derived (Clients can return true on default)
|
||||
|
||||
virtual bool acceptDataFromPeer(const RsGxsId& gxs_id,const RsGxsTunnelId& tunnel_id,bool is_client_side) = 0 ;
|
||||
virtual bool acceptDataFromPeer(const RsGxsId& gxs_id,const RsGxsTunnelId& tunnel_id,bool am_I_client_side) = 0 ;
|
||||
};
|
||||
|
||||
class GxsTunnelInfo
|
||||
|
@ -4,7 +4,7 @@
|
||||
* libretroshare: retroshare core library *
|
||||
* *
|
||||
* Copyright (C) 2012 Robert Fernie <retroshare@lunamutt.com> *
|
||||
* Copyright (C) 2018 Gioacchino Mazzurco <gio@eigenlab.org> *
|
||||
* Copyright (C) 2019 Gioacchino Mazzurco <gio@eigenlab.org> *
|
||||
* *
|
||||
* This program is free software: you can redistribute it and/or modify *
|
||||
* it under the terms of the GNU Lesser General Public License as *
|
||||
@ -20,12 +20,12 @@
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>. *
|
||||
* *
|
||||
*******************************************************************************/
|
||||
#ifndef RETROSHARE_IDENTITY_GUI_INTERFACE_H
|
||||
#define RETROSHARE_IDENTITY_GUI_INTERFACE_H
|
||||
#pragma once
|
||||
|
||||
#include <inttypes.h>
|
||||
#include <cstdint>
|
||||
#include <string>
|
||||
#include <list>
|
||||
#include <vector>
|
||||
|
||||
#include "retroshare/rstokenservice.h"
|
||||
#include "retroshare/rsgxsifacehelper.h"
|
||||
@ -37,9 +37,13 @@
|
||||
#include "serialiser/rstypeserializer.h"
|
||||
#include "util/rsdeprecate.h"
|
||||
|
||||
/* The Main Interface Class - for information about your Peers */
|
||||
struct RsIdentity;
|
||||
extern RsIdentity *rsIdentity;
|
||||
|
||||
/**
|
||||
* Pointer to global instance of RsIdentity service implementation
|
||||
* @jsonapi{development}
|
||||
*/
|
||||
extern RsIdentity* rsIdentity;
|
||||
|
||||
|
||||
// GroupFlags: Only one so far:
|
||||
@ -106,7 +110,7 @@ struct RsGxsIdGroup : RsSerializable
|
||||
{
|
||||
RsGxsIdGroup() :
|
||||
mLastUsageTS(0), mPgpKnown(false), mIsAContact(false) {}
|
||||
~RsGxsIdGroup() {}
|
||||
virtual ~RsGxsIdGroup() {}
|
||||
|
||||
RsGroupMetaData mMeta;
|
||||
|
||||
@ -144,18 +148,18 @@ struct RsGxsIdGroup : RsSerializable
|
||||
|
||||
/// @see RsSerializable
|
||||
void serial_process( RsGenericSerializer::SerializeJob j,
|
||||
RsGenericSerializer::SerializeContext& ctx );
|
||||
RsGenericSerializer::SerializeContext& ctx ) override;
|
||||
};
|
||||
|
||||
std::ostream &operator<<(std::ostream &out, const RsGxsIdGroup &group);
|
||||
|
||||
// DATA TYPE FOR EXTERNAL INTERFACE.
|
||||
|
||||
class RsRecognTag
|
||||
struct RsRecognTag
|
||||
{
|
||||
public:
|
||||
RsRecognTag(uint16_t tc, uint16_t tt, bool v)
|
||||
:tag_class(tc), tag_type(tt), valid(v) { return; }
|
||||
RsRecognTag(uint16_t tc, uint16_t tt, bool v) :
|
||||
tag_class(tc), tag_type(tt), valid(v) {}
|
||||
|
||||
uint16_t tag_class;
|
||||
uint16_t tag_type;
|
||||
bool valid;
|
||||
@ -268,11 +272,11 @@ struct RsIdentityUsage : RsSerializable
|
||||
std::string mComment;
|
||||
|
||||
bool operator<(const RsIdentityUsage& u) const { return mHash < u.mHash; }
|
||||
RsFileHash mHash ;
|
||||
RsFileHash mHash;
|
||||
|
||||
/// @see RsSerializable
|
||||
void serial_process( RsGenericSerializer::SerializeJob j,
|
||||
RsGenericSerializer::SerializeContext& ctx )
|
||||
RsGenericSerializer::SerializeContext& ctx ) override
|
||||
{
|
||||
RS_SERIAL_PROCESS(mServiceId);
|
||||
RS_SERIAL_PROCESS(mUsageCode);
|
||||
@ -311,7 +315,7 @@ struct RsIdentityDetails : RsSerializable
|
||||
* reputation system is not finished yet, I leave this in place. We should
|
||||
* decide what to do with it.
|
||||
*/
|
||||
RsReputations::ReputationInfo mReputation;
|
||||
RsReputationInfo mReputation;
|
||||
|
||||
RsGxsImage mAvatar;
|
||||
|
||||
@ -329,7 +333,7 @@ struct RsIdentityDetails : RsSerializable
|
||||
RS_SERIAL_PROCESS(mFlags);
|
||||
RS_SERIAL_PROCESS(mPgpId);
|
||||
//RS_SERIAL_PROCESS(mReputation);
|
||||
//RS_SERIAL_PROCESS(mAvatar);
|
||||
RS_SERIAL_PROCESS(mAvatar);
|
||||
RS_SERIAL_PROCESS(mPublishTS);
|
||||
RS_SERIAL_PROCESS(mLastUsageTS);
|
||||
RS_SERIAL_PROCESS(mUseCases);
|
||||
@ -338,73 +342,214 @@ struct RsIdentityDetails : RsSerializable
|
||||
|
||||
|
||||
|
||||
|
||||
/** The Main Interface Class for GXS people identities */
|
||||
struct RsIdentity : RsGxsIfaceHelper
|
||||
{
|
||||
explicit RsIdentity(RsGxsIface& gxs): RsGxsIfaceHelper(gxs) {}
|
||||
virtual ~RsIdentity() {}
|
||||
explicit RsIdentity(RsGxsIface& gxs) : RsGxsIfaceHelper(gxs) {}
|
||||
virtual ~RsIdentity() {}
|
||||
|
||||
/********************************************************************************************/
|
||||
/********************************************************************************************/
|
||||
/**
|
||||
* @brief Create a new identity
|
||||
* @jsonapi{development}
|
||||
* @param[out] id storage for the created identity Id
|
||||
* @param[in] name Name of the identity
|
||||
* @param[in] avatar Image associated to the identity
|
||||
* @param[in] pseudonimous true for unsigned identity, false otherwise
|
||||
* @param[in] pgpPassword password to unlock PGP to sign identity,
|
||||
* not implemented yet
|
||||
* @return false on error, true otherwise
|
||||
*/
|
||||
virtual bool createIdentity(
|
||||
RsGxsId& id,
|
||||
const std::string& name, const RsGxsImage& avatar = RsGxsImage(),
|
||||
bool pseudonimous = true, const std::string& pgpPassword = "" ) = 0;
|
||||
|
||||
// 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.
|
||||
/**
|
||||
* @brief Locally delete given identity
|
||||
* @jsonapi{development}
|
||||
* @param[in] id Id of the identity
|
||||
* @return false on error, true otherwise
|
||||
*/
|
||||
virtual bool deleteIdentity(RsGxsId& id) = 0;
|
||||
|
||||
// We cache all identities, and provide alternative (instantaneous)
|
||||
// functions to extract info, rather than the standard Token system.
|
||||
/**
|
||||
* @brief Update identity data (name, avatar...)
|
||||
* @jsonapi{development}
|
||||
* @param[in] identityData updated identiy data
|
||||
* @return false on error, true otherwise
|
||||
*/
|
||||
virtual bool updateIdentity(RsGxsIdGroup& identityData) = 0;
|
||||
|
||||
//virtual bool getNickname(const RsGxsId &id, std::string &nickname) = 0;
|
||||
virtual bool getIdDetails(const RsGxsId &id, RsIdentityDetails &details) = 0;
|
||||
/**
|
||||
* @brief Get identity details, from the cache
|
||||
* @param[in] id Id of the identity
|
||||
* @param[out] details Storage for the identity details
|
||||
* @return false on error, true otherwise
|
||||
*/
|
||||
virtual bool getIdDetails(const RsGxsId& id, RsIdentityDetails& details) = 0;
|
||||
|
||||
// Fills up list of all own ids. Returns false if ids are not yet loaded.
|
||||
virtual bool getOwnIds(std::list<RsGxsId> &ownIds,bool only_signed_ids = false) = 0;
|
||||
virtual bool isOwnId(const RsGxsId& id) = 0;
|
||||
/**
|
||||
* @brief Get last seen usage time of given identity
|
||||
* @jsonapi{development}
|
||||
* @param[in] id Id of the identity
|
||||
* @return timestamp of last seen usage
|
||||
*/
|
||||
virtual rstime_t getLastUsageTS(const RsGxsId& id) = 0;
|
||||
|
||||
//
|
||||
virtual bool submitOpinion(uint32_t& token, const RsGxsId &id,
|
||||
bool absOpinion, int score) = 0;
|
||||
virtual bool createIdentity(uint32_t& token, RsIdentityParameters ¶ms) = 0;
|
||||
/**
|
||||
* @brief Get own signed ids
|
||||
* @jsonapi{development}
|
||||
* @param[out] ids storage for the ids
|
||||
* @return false on error, true otherwise
|
||||
*/
|
||||
virtual bool getOwnSignedIds(std::vector<RsGxsId> ids) = 0;
|
||||
|
||||
virtual bool updateIdentity(uint32_t& token, RsGxsIdGroup &group) = 0;
|
||||
virtual bool deleteIdentity(uint32_t& token, RsGxsIdGroup &group) = 0;
|
||||
/**
|
||||
* @brief Get own pseudonimous (unsigned) ids
|
||||
* @jsonapi{development}
|
||||
* @param[out] ids storage for the ids
|
||||
* @return false on error, true otherwise
|
||||
*/
|
||||
virtual bool getOwnPseudonimousIds(std::vector<RsGxsId> ids) = 0;
|
||||
|
||||
virtual void setDeleteBannedNodesThreshold(uint32_t days) =0;
|
||||
virtual uint32_t deleteBannedNodesThreshold() =0;
|
||||
/**
|
||||
* @brief Check if an id is own
|
||||
* @jsonapi{development}
|
||||
* @param[in] id Id to check
|
||||
* @return true if the id is own, false otherwise
|
||||
*/
|
||||
virtual bool isOwnId(const RsGxsId& id) = 0;
|
||||
|
||||
virtual bool parseRecognTag(const RsGxsId &id, const std::string &nickname,
|
||||
const std::string &tag, RsRecognTagDetails &details) = 0;
|
||||
virtual bool getRecognTagRequest(const RsGxsId &id, const std::string &comment,
|
||||
uint16_t tag_class, uint16_t tag_type, std::string &tag) = 0;
|
||||
/**
|
||||
* @brief Get base64 representation of an identity
|
||||
* @jsonapi{development}
|
||||
* @param[in] id Id of the identity
|
||||
* @param[out] base64String storage for the identity base64
|
||||
* @return false on error, true otherwise
|
||||
*/
|
||||
virtual bool identityToBase64( const RsGxsId& id,
|
||||
std::string& base64String ) = 0;
|
||||
|
||||
virtual bool setAsRegularContact(const RsGxsId& id,bool is_a_contact) = 0 ;
|
||||
virtual bool isARegularContact(const RsGxsId& id) = 0 ;
|
||||
/**
|
||||
* @brief Import identity from base64 representation
|
||||
* @jsonapi{development}
|
||||
* @param[in] base64String base64 representation of the identity to import
|
||||
* @param[out] id storage for the identity id
|
||||
* @return false on error, true otherwise
|
||||
*/
|
||||
virtual bool identityFromBase64( const std::string& base64String,
|
||||
RsGxsId& id ) = 0;
|
||||
|
||||
/**
|
||||
* @brief Get identities summaries list.
|
||||
* @jsonapi{development}
|
||||
* @param[out] ids list where to store the identities
|
||||
* @return false if something failed, true otherwhise
|
||||
*/
|
||||
virtual bool getIdentitiesSummaries(std::list<RsGroupMetaData>& ids) = 0;
|
||||
|
||||
/**
|
||||
* @brief Get identities information (name, avatar...).
|
||||
* Blocking API.
|
||||
* @jsonapi{development}
|
||||
* @param[in] ids ids of the channels of which to get the informations
|
||||
* @param[out] idsInfo storage for the identities informations
|
||||
* @return false if something failed, true otherwhise
|
||||
*/
|
||||
virtual bool getIdentitiesInfo(
|
||||
const std::set<RsGxsId>& ids,
|
||||
std::vector<RsGxsIdGroup>& idsInfo ) = 0;
|
||||
|
||||
/**
|
||||
* @brief Check if an identity is contact
|
||||
* @jsonapi{development}
|
||||
* @param[in] id Id of the identity
|
||||
* @return true if it is a conctact, false otherwise
|
||||
*/
|
||||
virtual bool isARegularContact(const RsGxsId& id) = 0;
|
||||
|
||||
/**
|
||||
* @brief Set/unset identity as contact
|
||||
* @param[in] id Id of the identity
|
||||
* @param[in] isContact true to set, false to unset
|
||||
* @return false on error, true otherwise
|
||||
*/
|
||||
virtual bool setAsRegularContact(const RsGxsId& id, bool isContact) = 0;
|
||||
|
||||
/**
|
||||
* @brief Toggle automatic flagging signed by friends identity as contact
|
||||
* @jsonapi{development}
|
||||
* @param[in] enabled true to enable, false to disable
|
||||
*/
|
||||
virtual void setAutoAddFriendIdsAsContact(bool enabled) = 0;
|
||||
|
||||
/**
|
||||
* @brief Check if automatic signed by friend identity contact flagging is
|
||||
* enabled
|
||||
* @jsonapi{development}
|
||||
* @return true if enabled, false otherwise
|
||||
*/
|
||||
virtual bool autoAddFriendIdsAsContact() = 0;
|
||||
|
||||
/**
|
||||
* @brief Get number of days after which delete a banned identities
|
||||
* @jsonapi{development}
|
||||
* @return number of days
|
||||
*/
|
||||
virtual uint32_t deleteBannedNodesThreshold() = 0;
|
||||
|
||||
/**
|
||||
* @brief Set number of days after which delete a banned identities
|
||||
* @jsonapi{development}
|
||||
* @param[in] days number of days
|
||||
*/
|
||||
virtual void setDeleteBannedNodesThreshold(uint32_t days) = 0;
|
||||
|
||||
|
||||
RS_DEPRECATED
|
||||
virtual bool getGroupSerializedData(
|
||||
const uint32_t& token,
|
||||
std::map<RsGxsId,std::string>& serialized_groups ) = 0;
|
||||
|
||||
RS_DEPRECATED
|
||||
virtual bool parseRecognTag(
|
||||
const RsGxsId &id, const std::string& nickname,
|
||||
const std::string& tag, RsRecognTagDetails& details) = 0;
|
||||
|
||||
RS_DEPRECATED
|
||||
virtual bool getRecognTagRequest(
|
||||
const RsGxsId& id, const std::string& comment, uint16_t tag_class,
|
||||
uint16_t tag_type, std::string& tag) = 0;
|
||||
|
||||
RS_DEPRECATED
|
||||
virtual uint32_t nbRegularContacts() =0;
|
||||
virtual void setAutoAddFriendIdsAsContact(bool b) =0;
|
||||
virtual bool autoAddFriendIdsAsContact() =0;
|
||||
|
||||
RS_DEPRECATED_FOR(identityToBase64)
|
||||
virtual bool serialiseIdentityToMemory( const RsGxsId& id,
|
||||
std::string& radix_string ) = 0;
|
||||
RS_DEPRECATED_FOR(identityFromBase64)
|
||||
virtual bool deserialiseIdentityFromMemory( const std::string& radix_string,
|
||||
RsGxsId* id = nullptr ) = 0;
|
||||
|
||||
/*!
|
||||
* \brief overallReputationLevel
|
||||
* Returns the overall reputation level of the supplied identity. See rsreputations.h
|
||||
* \param id
|
||||
* \return
|
||||
*/
|
||||
virtual rstime_t getLastUsageTS(const RsGxsId &id) =0;
|
||||
/// Fills up list of all own ids. Returns false if ids are not yet loaded.
|
||||
RS_DEPRECATED_FOR("getOwnSignedIds getOwnPseudonimousIds")
|
||||
virtual bool getOwnIds( std::list<RsGxsId> &ownIds,
|
||||
bool only_signed_ids = false ) = 0;
|
||||
|
||||
// Specific RsIdentity Functions....
|
||||
/* Specific Service Data */
|
||||
/* We expose these initially for testing / GUI purposes.
|
||||
*/
|
||||
RS_DEPRECATED
|
||||
virtual bool createIdentity(uint32_t& token, RsIdentityParameters ¶ms) = 0;
|
||||
|
||||
virtual bool getGroupData(const uint32_t &token, std::vector<RsGxsIdGroup> &groups) = 0;
|
||||
virtual bool getGroupSerializedData(const uint32_t &token, std::map<RsGxsId,std::string>& serialized_groups)=0;
|
||||
//virtual bool getMsgData(const uint32_t &token, std::vector<RsGxsIdOpinion> &opinions) = 0;
|
||||
RS_DEPRECATED_FOR(RsReputations)
|
||||
virtual bool submitOpinion(uint32_t& token, const RsGxsId &id,
|
||||
bool absOpinion, int score) = 0;
|
||||
|
||||
RS_DEPRECATED
|
||||
virtual bool updateIdentity(uint32_t& token, RsGxsIdGroup &group) = 0;
|
||||
|
||||
RS_DEPRECATED
|
||||
virtual bool deleteIdentity(uint32_t& token, RsGxsIdGroup &group) = 0;
|
||||
|
||||
RS_DEPRECATED_FOR("getIdentitiesSummaries getIdentitiesInfo")
|
||||
virtual bool getGroupData( const uint32_t& token,
|
||||
std::vector<RsGxsIdGroup>& groups) = 0;
|
||||
};
|
||||
|
||||
#endif // RETROSHARE_IDENTITY_GUI_INTERFACE_H
|
||||
|
@ -25,10 +25,12 @@
|
||||
#include <inttypes.h>
|
||||
#include <string>
|
||||
#include <list>
|
||||
#include <functional>
|
||||
|
||||
#include "retroshare/rstokenservice.h"
|
||||
#include "retroshare/rsgxsifacehelper.h"
|
||||
#include "retroshare/rsgxscommon.h"
|
||||
#include "serialiser/rsserializable.h"
|
||||
|
||||
/* The Main Interface Class - for information about your Posted */
|
||||
class RsPosted;
|
||||
@ -42,6 +44,7 @@ class RsPostedGroup
|
||||
|
||||
RsGroupMetaData mMeta;
|
||||
std::string mDescription;
|
||||
|
||||
};
|
||||
|
||||
|
||||
@ -52,7 +55,7 @@ class RsPostedGroup
|
||||
#define RSPOSTED_PERIOD_YEAR 1
|
||||
#define RSPOSTED_PERIOD_MONTH 2
|
||||
#define RSPOSTED_PERIOD_WEEK 3
|
||||
#define RSPOSTED_PERIOD_DAY 4
|
||||
#define RSPOSTED_PERIOD_DAY 4
|
||||
#define RSPOSTED_PERIOD_HOUR 5
|
||||
|
||||
#define RSPOSTED_VIEWMODE_LATEST 1
|
||||
@ -87,8 +90,8 @@ virtual bool getPostData(const uint32_t &token, std::vector<RsPostedPost> &posts
|
||||
/* From RsGxsCommentService */
|
||||
//virtual bool getCommentData(const uint32_t &token, std::vector<RsGxsComment> &comments) = 0;
|
||||
//virtual bool getRelatedComments(const uint32_t &token, std::vector<RsGxsComment> &comments) = 0;
|
||||
//virtual bool createComment(uint32_t &token, RsGxsComment &comment) = 0;
|
||||
//virtual bool createVote(uint32_t &token, RsGxsVote &vote) = 0;
|
||||
//virtual bool createNewComment(uint32_t &token, RsGxsComment &comment) = 0;
|
||||
//virtual bool createNewVote(uint32_t &token, RsGxsVote &vote) = 0;
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
virtual void setMessageReadStatus(uint32_t& token, const RsGxsGrpMsgIdPair& msgId, bool read) = 0;
|
||||
@ -102,7 +105,6 @@ virtual bool updateGroup(uint32_t &token, RsPostedGroup &group) = 0;
|
||||
};
|
||||
|
||||
|
||||
|
||||
class RsPostedPost
|
||||
{
|
||||
public:
|
||||
@ -137,6 +139,24 @@ class RsPostedPost
|
||||
double mHotScore;
|
||||
double mTopScore;
|
||||
double mNewScore;
|
||||
|
||||
RsGxsImage mImage;
|
||||
|
||||
/// @see RsSerializable
|
||||
/*virtual void serial_process( RsGenericSerializer::SerializeJob j,
|
||||
RsGenericSerializer::SerializeContext& ctx )
|
||||
{
|
||||
RS_SERIAL_PROCESS(mImage);
|
||||
RS_SERIAL_PROCESS(mMeta);
|
||||
RS_SERIAL_PROCESS(mLink);
|
||||
RS_SERIAL_PROCESS(mHaveVoted);
|
||||
RS_SERIAL_PROCESS(mUpVotes);
|
||||
RS_SERIAL_PROCESS(mDownVotes);
|
||||
RS_SERIAL_PROCESS(mComments);
|
||||
RS_SERIAL_PROCESS(mHotScore);
|
||||
RS_SERIAL_PROCESS(mTopScore);
|
||||
RS_SERIAL_PROCESS(mNewScore);
|
||||
}*/
|
||||
};
|
||||
|
||||
|
||||
|
@ -3,7 +3,8 @@
|
||||
* *
|
||||
* libretroshare: retroshare core library *
|
||||
* *
|
||||
* Copyright 2015 by Cyril Soler <retroshare.team@gmail.com> *
|
||||
* Copyright (C) 2015 Cyril Soler <retroshare.team@gmail.com> *
|
||||
* Copyright (C) 2018 Gioacchino Mazzurco <gio@altermundi.net> *
|
||||
* *
|
||||
* This program is free software: you can redistribute it and/or modify *
|
||||
* it under the terms of the GNU Lesser General Public License as *
|
||||
@ -19,74 +20,225 @@
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>. *
|
||||
* *
|
||||
*******************************************************************************/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "retroshare/rsids.h"
|
||||
#include "retroshare/rsgxsifacetypes.h"
|
||||
#include "serialiser/rsserializable.h"
|
||||
|
||||
class RsReputations;
|
||||
|
||||
/**
|
||||
* Pointer to global instance of RsReputations service implementation
|
||||
* @jsonapi{development}
|
||||
*/
|
||||
extern RsReputations* rsReputations;
|
||||
|
||||
|
||||
constexpr float RS_REPUTATION_THRESHOLD_DEFAULT = 1.0f;
|
||||
|
||||
enum struct RsOpinion : uint8_t
|
||||
{
|
||||
NEGATIVE = 0,
|
||||
NEUTRAL = 1,
|
||||
POSITIVE = 2
|
||||
};
|
||||
|
||||
enum struct RsReputationLevel : uint8_t
|
||||
{
|
||||
/// local opinion is negative
|
||||
LOCALLY_NEGATIVE = 0x00,
|
||||
|
||||
/// local opinion is neutral and friends are positive in average
|
||||
REMOTELY_NEGATIVE = 0x01,
|
||||
|
||||
/// no reputation information
|
||||
NEUTRAL = 0x02,
|
||||
|
||||
/// local opinion is neutral and friends are positive in average
|
||||
REMOTELY_POSITIVE = 0x03,
|
||||
|
||||
/// local opinion is positive
|
||||
LOCALLY_POSITIVE = 0x04,
|
||||
|
||||
/// missing info
|
||||
UNKNOWN = 0x05
|
||||
};
|
||||
|
||||
struct RsReputationInfo : RsSerializable
|
||||
{
|
||||
RsReputationInfo() :
|
||||
mOwnOpinion(RsOpinion::NEUTRAL), mFriendsPositiveVotes(0),
|
||||
mFriendsNegativeVotes(0),
|
||||
mFriendAverageScore(RS_REPUTATION_THRESHOLD_DEFAULT),
|
||||
mOverallReputationLevel(RsReputationLevel::NEUTRAL) {}
|
||||
virtual ~RsReputationInfo() {}
|
||||
|
||||
RsOpinion mOwnOpinion;
|
||||
|
||||
uint32_t mFriendsPositiveVotes;
|
||||
uint32_t mFriendsNegativeVotes;
|
||||
|
||||
float mFriendAverageScore;
|
||||
|
||||
/// this should help clients in taking decisions
|
||||
RsReputationLevel mOverallReputationLevel;
|
||||
|
||||
/// @see RsSerializable
|
||||
void serial_process( RsGenericSerializer::SerializeJob j,
|
||||
RsGenericSerializer::SerializeContext& ctx ) override
|
||||
{
|
||||
RS_SERIAL_PROCESS(mOwnOpinion);
|
||||
RS_SERIAL_PROCESS(mFriendsPositiveVotes);
|
||||
RS_SERIAL_PROCESS(mFriendsNegativeVotes);
|
||||
RS_SERIAL_PROCESS(mFriendAverageScore);
|
||||
RS_SERIAL_PROCESS(mOverallReputationLevel);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
class RsReputations
|
||||
{
|
||||
public:
|
||||
static const float REPUTATION_THRESHOLD_ANTI_SPAM;
|
||||
static const float REPUTATION_THRESHOLD_DEFAULT;
|
||||
|
||||
// This is the interface file for the reputation system
|
||||
//
|
||||
enum Opinion { OPINION_NEGATIVE = 0, OPINION_NEUTRAL = 1, OPINION_POSITIVE = 2 } ;
|
||||
virtual ~RsReputations() {}
|
||||
|
||||
enum ReputationLevel { REPUTATION_LOCALLY_NEGATIVE = 0x00, // local opinion is positive
|
||||
REPUTATION_REMOTELY_NEGATIVE = 0x01, // local opinion is neutral and friends are positive in average
|
||||
REPUTATION_NEUTRAL = 0x02, // no reputation information ;
|
||||
REPUTATION_REMOTELY_POSITIVE = 0x03, // local opinion is neutral and friends are negative in average
|
||||
REPUTATION_LOCALLY_POSITIVE = 0x04, // local opinion is negative
|
||||
REPUTATION_UNKNOWN = 0x05 // missing info
|
||||
};
|
||||
/**
|
||||
* @brief Set own opinion about the given identity
|
||||
* @jsonapi{development}
|
||||
* @param[in] id Id of the identity
|
||||
* @param[in] op Own opinion
|
||||
* @return false on error, true otherwise
|
||||
*/
|
||||
virtual bool setOwnOpinion(const RsGxsId& id, RsOpinion op) = 0;
|
||||
|
||||
struct ReputationInfo
|
||||
{
|
||||
ReputationInfo() : mOwnOpinion(OPINION_NEUTRAL),mFriendsPositiveVotes(0),mFriendsNegativeVotes(0), mFriendAverageScore(REPUTATION_THRESHOLD_DEFAULT),mOverallReputationLevel(REPUTATION_NEUTRAL){}
|
||||
|
||||
RsReputations::Opinion mOwnOpinion ;
|
||||
/**
|
||||
* @brief Get own opition about the given identity
|
||||
* @jsonapi{development}
|
||||
* @param[in] id Id of the identity
|
||||
* @param[out] op Own opinion
|
||||
* @return false on error, true otherwise
|
||||
*/
|
||||
virtual bool getOwnOpinion(const RsGxsId& id, RsOpinion& op) = 0;
|
||||
|
||||
uint32_t mFriendsPositiveVotes ;
|
||||
uint32_t mFriendsNegativeVotes ;
|
||||
/**
|
||||
* @brief Get reputation data of given identity
|
||||
* @jsonapi{development}
|
||||
* @param[in] id Id of the identity
|
||||
* @param[in] ownerNode Optiona PGP id of the signed identity, accept a null
|
||||
* (all zero/noninitialized) PGP id
|
||||
* @param[out] info storage for the information
|
||||
* @param[in] stamp if true, timestamo the information
|
||||
* @return false on error, true otherwise
|
||||
*/
|
||||
virtual bool getReputationInfo(
|
||||
const RsGxsId& id, const RsPgpId& ownerNode, RsReputationInfo& info,
|
||||
bool stamp = true ) = 0;
|
||||
|
||||
float mFriendAverageScore ;
|
||||
/**
|
||||
* @brief Get overall reputation level of given identity
|
||||
* @jsonapi{development}
|
||||
* @param[in] id Id of the identity
|
||||
* @return the calculated reputation level based on available information
|
||||
*/
|
||||
virtual RsReputationLevel overallReputationLevel(const RsGxsId& id) = 0;
|
||||
|
||||
RsReputations::ReputationLevel mOverallReputationLevel; // this should help clients in taking decisions
|
||||
};
|
||||
/**
|
||||
* @brief Enable giving automatic positive opinion when flagging as contact
|
||||
* @jsonapi{development}
|
||||
* @param[in] b true to enable, false to disable
|
||||
*/
|
||||
virtual void setAutoPositiveOpinionForContacts(bool b) = 0;
|
||||
|
||||
virtual bool setOwnOpinion(const RsGxsId& key_id, const Opinion& op) =0;
|
||||
virtual bool getOwnOpinion(const RsGxsId& key_id, Opinion& op) =0;
|
||||
virtual bool getReputationInfo(const RsGxsId& id, const RsPgpId &ownerNode, ReputationInfo& info,bool stamp=true) =0;
|
||||
/**
|
||||
* @brief check if giving automatic positive opinion when flagging as
|
||||
* contact is enbaled
|
||||
* @jsonapi{development}
|
||||
* @return true if enabled, false otherwise
|
||||
*/
|
||||
virtual bool autoPositiveOpinionForContacts() = 0;
|
||||
|
||||
// This returns the reputation level and also the flags of the identity service for that id. This is useful in order to get these flags without relying on the async method of p3Identity
|
||||
/**
|
||||
* @brief Set threshold on remote reputation to consider it remotely
|
||||
* negative
|
||||
* @jsonapi{development}
|
||||
* @param[in] thresh Threshold value
|
||||
*/
|
||||
virtual void setThresholdForRemotelyNegativeReputation(uint32_t thresh) = 0;
|
||||
|
||||
virtual ReputationLevel overallReputationLevel(const RsGxsId& id,uint32_t *identity_flags=NULL)=0;
|
||||
/**
|
||||
* * @brief Get threshold on remote reputation to consider it remotely
|
||||
* negative
|
||||
* @jsonapi{development}
|
||||
* @return Threshold value
|
||||
*/
|
||||
virtual uint32_t thresholdForRemotelyNegativeReputation() = 0;
|
||||
|
||||
// parameters
|
||||
/**
|
||||
* @brief Set threshold on remote reputation to consider it remotely
|
||||
* positive
|
||||
* @jsonapi{development}
|
||||
* @param[in] thresh Threshold value
|
||||
*/
|
||||
virtual void setThresholdForRemotelyPositiveReputation(uint32_t thresh) = 0;
|
||||
|
||||
virtual void setNodeAutoPositiveOpinionForContacts(bool b) =0;
|
||||
virtual bool nodeAutoPositiveOpinionForContacts() =0;
|
||||
/**
|
||||
* @brief Get threshold on remote reputation to consider it remotely
|
||||
* negative
|
||||
* @jsonapi{development}
|
||||
* @return Threshold value
|
||||
*/
|
||||
virtual uint32_t thresholdForRemotelyPositiveReputation() = 0;
|
||||
|
||||
virtual uint32_t thresholdForRemotelyNegativeReputation()=0;
|
||||
virtual uint32_t thresholdForRemotelyPositiveReputation()=0;
|
||||
virtual void setThresholdForRemotelyNegativeReputation(uint32_t thresh)=0;
|
||||
virtual void setThresholdForRemotelyPositiveReputation(uint32_t thresh)=0;
|
||||
/**
|
||||
* @brief Get number of days to wait before deleting a banned identity from
|
||||
* local storage
|
||||
* @jsonapi{development}
|
||||
* @return number of days to wait, 0 means never delete
|
||||
*/
|
||||
virtual uint32_t rememberBannedIdThreshold() = 0;
|
||||
|
||||
virtual void setRememberDeletedNodesThreshold(uint32_t days) =0;
|
||||
virtual uint32_t rememberDeletedNodesThreshold() =0;
|
||||
/**
|
||||
* @brief Set number of days to wait before deleting a banned identity from
|
||||
* local storage
|
||||
* @jsonapi{development}
|
||||
* @param[in] days number of days to wait, 0 means never delete
|
||||
*/
|
||||
virtual void setRememberBannedIdThreshold(uint32_t days) = 0;
|
||||
|
||||
// This one is a proxy designed to allow fast checking of a GXS id.
|
||||
// it basically returns true if assessment is not ASSESSMENT_OK
|
||||
|
||||
virtual bool isIdentityBanned(const RsGxsId& id) =0;
|
||||
/**
|
||||
* @brief This method allow fast checking if a GXS identity is banned.
|
||||
* @jsonapi{development}
|
||||
* @param[in] id Id of the identity to check
|
||||
* @return true if identity is banned, false otherwise
|
||||
*/
|
||||
virtual bool isIdentityBanned(const RsGxsId& id) = 0;
|
||||
|
||||
virtual bool isNodeBanned(const RsPgpId& id) =0;
|
||||
virtual void banNode(const RsPgpId& id,bool b) =0;
|
||||
/**
|
||||
* @brief Check if automatic banning of all identities signed by the given
|
||||
* node is enabled
|
||||
* @jsonapi{development}
|
||||
* @param[in] id PGP id of the node
|
||||
* @return true if enabled, false otherwise
|
||||
*/
|
||||
virtual bool isNodeBanned(const RsPgpId& id) = 0;
|
||||
|
||||
/**
|
||||
* @brief Enable automatic banning of all identities signed by the given
|
||||
* node
|
||||
* @jsonapi{development}
|
||||
* @param[in] id PGP id of the node
|
||||
* @param[in] b true to enable, false to disable
|
||||
*/
|
||||
virtual void banNode(const RsPgpId& id, bool b) = 0;
|
||||
|
||||
|
||||
/**
|
||||
* @deprecated
|
||||
* This returns the reputation level and also the flags of the identity
|
||||
* service for that id. This is useful in order to get these flags without
|
||||
* relying on the async method of p3Identity
|
||||
*/
|
||||
RS_DEPRECATED
|
||||
virtual RsReputationLevel overallReputationLevel(
|
||||
const RsGxsId& id, uint32_t* identity_flags ) = 0;
|
||||
};
|
||||
|
||||
// To access reputations from anywhere
|
||||
//
|
||||
extern RsReputations *rsReputations ;
|
||||
|
@ -100,7 +100,7 @@ class RsGxsReputationSetItem: public RsReputationItem
|
||||
public:
|
||||
RsGxsReputationSetItem() :RsReputationItem(RS_PKT_SUBTYPE_GXS_REPUTATION_SET_ITEM)
|
||||
{
|
||||
mOwnOpinion = RsReputations::OPINION_NEUTRAL ;
|
||||
mOwnOpinion = static_cast<uint32_t>(RsOpinion::NEUTRAL);
|
||||
mOwnOpinionTS = 0;
|
||||
mIdentityFlags = 0;
|
||||
mLastUsedTS = 0;
|
||||
|
@ -22,15 +22,29 @@
|
||||
#include "rsitems/rsposteditems.h"
|
||||
#include "serialiser/rstypeserializer.h"
|
||||
|
||||
|
||||
|
||||
void RsGxsPostedPostItem::serial_process(RsGenericSerializer::SerializeJob j,RsGenericSerializer::SerializeContext& ctx)
|
||||
{
|
||||
RsTypeSerializer::serial_process(j,ctx,TLV_TYPE_STR_LINK,mPost.mLink,"mPost.mLink") ;
|
||||
RsTypeSerializer::serial_process(j,ctx,TLV_TYPE_STR_MSG ,mPost.mNotes,"mPost.mNotes") ;
|
||||
|
||||
// Do not serialize mImage member if it is empty (keeps compatibility of new posts without image toward older RS)
|
||||
// and do not expect to deserialize mImage member if the data block has been consummed entirely (keeps compatibility
|
||||
// of new RS with older posts.
|
||||
|
||||
if(j == RsGenericSerializer::DESERIALIZE && ctx.mOffset == ctx.mSize)
|
||||
return ;
|
||||
|
||||
if((j == RsGenericSerializer::SIZE_ESTIMATE || j == RsGenericSerializer::SERIALIZE) && mImage.empty())
|
||||
return ;
|
||||
|
||||
RsTypeSerializer::serial_process<RsTlvItem>(j,ctx,mImage,"mImage") ;
|
||||
}
|
||||
|
||||
void RsGxsPostedGroupItem::serial_process(RsGenericSerializer::SerializeJob j,RsGenericSerializer::SerializeContext& ctx)
|
||||
{
|
||||
RsTypeSerializer::serial_process(j,ctx,TLV_TYPE_STR_DESCR ,mGroup.mDescription,"mGroup.mDescription") ;
|
||||
RsTypeSerializer::serial_process(j,ctx,TLV_TYPE_STR_DESCR ,mGroup.mDescription,"mGroup.mDescription") ;
|
||||
}
|
||||
|
||||
RsItem *RsGxsPostedSerialiser::create_item(uint16_t service_id,uint8_t item_subtype) const
|
||||
@ -47,12 +61,54 @@ RsItem *RsGxsPostedSerialiser::create_item(uint16_t service_id,uint8_t item_subt
|
||||
}
|
||||
}
|
||||
|
||||
bool RsGxsPostedPostItem::fromPostedPost(RsPostedPost &post, bool moveImage)
|
||||
{
|
||||
clear();
|
||||
|
||||
mPost = post;
|
||||
meta = post.mMeta;
|
||||
|
||||
if (moveImage)
|
||||
{
|
||||
mImage.binData.bin_data = post.mImage.mData;
|
||||
mImage.binData.bin_len = post.mImage.mSize;
|
||||
post.mImage.shallowClear();
|
||||
}
|
||||
else
|
||||
{
|
||||
mImage.binData.setBinData(post.mImage.mData, post.mImage.mSize);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool RsGxsPostedPostItem::toPostedPost(RsPostedPost &post, bool moveImage)
|
||||
{
|
||||
post = mPost;
|
||||
post.mMeta = meta;
|
||||
|
||||
if (moveImage)
|
||||
{
|
||||
post.mImage.take((uint8_t *) mImage.binData.bin_data, mImage.binData.bin_len);
|
||||
// mImage doesn't have a ShallowClear at the moment!
|
||||
mImage.binData.TlvShallowClear();
|
||||
}
|
||||
else
|
||||
{
|
||||
post.mImage.copy((uint8_t *) mImage.binData.bin_data, mImage.binData.bin_len);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void RsGxsPostedPostItem::clear()
|
||||
{
|
||||
mPost.mLink.clear();
|
||||
mPost.mNotes.clear();
|
||||
mImage.TlvClear();
|
||||
}
|
||||
void RsGxsPostedGroupItem::clear()
|
||||
{
|
||||
mGroup.mDescription.clear();
|
||||
}
|
||||
|
||||
|
@ -25,6 +25,7 @@
|
||||
#include "rsitems/rsserviceids.h"
|
||||
#include "rsitems/rsgxscommentitems.h"
|
||||
#include "rsitems/rsgxsitems.h"
|
||||
#include "serialiser/rstlvimage.h"
|
||||
|
||||
#include "retroshare/rsposted.h"
|
||||
|
||||
@ -38,9 +39,12 @@ public:
|
||||
virtual ~RsGxsPostedGroupItem() {}
|
||||
|
||||
void clear();
|
||||
|
||||
virtual void serial_process(RsGenericSerializer::SerializeJob j,RsGenericSerializer::SerializeContext& ctx);
|
||||
|
||||
|
||||
RsPostedGroup mGroup;
|
||||
|
||||
|
||||
};
|
||||
|
||||
class RsGxsPostedPostItem : public RsGxsMsgItem
|
||||
@ -51,8 +55,14 @@ public:
|
||||
|
||||
void clear();
|
||||
virtual void serial_process(RsGenericSerializer::SerializeJob j,RsGenericSerializer::SerializeContext& ctx);
|
||||
|
||||
// Slightly unusual structure.
|
||||
// use conversion functions to transform:
|
||||
bool fromPostedPost(RsPostedPost &post, bool moveImage);
|
||||
bool toPostedPost(RsPostedPost &post, bool moveImage);
|
||||
|
||||
RsPostedPost mPost;
|
||||
RsTlvImage mImage;
|
||||
};
|
||||
|
||||
class RsGxsPostedSerialiser : public RsGxsCommentSerialiser
|
||||
|
@ -37,6 +37,8 @@ struct RsSerializable
|
||||
*/
|
||||
virtual void serial_process(RsGenericSerializer::SerializeJob j,
|
||||
RsGenericSerializer::SerializeContext& ctx) = 0;
|
||||
|
||||
virtual ~RsSerializable() = default;
|
||||
};
|
||||
|
||||
/** @def RS_SERIAL_PROCESS(I)
|
||||
|
@ -33,18 +33,19 @@
|
||||
|
||||
class RsTlvImage: public RsTlvItem
|
||||
{
|
||||
public:
|
||||
RsTlvImage();
|
||||
RsTlvImage(const RsTlvImage& );
|
||||
virtual ~RsTlvImage() { return; }
|
||||
virtual uint32_t TlvSize() const;
|
||||
virtual void TlvClear();
|
||||
virtual bool SetTlv(void *data, uint32_t size, uint32_t *offset) const;
|
||||
virtual bool GetTlv(void *data, uint32_t size, uint32_t *offset);
|
||||
public:
|
||||
RsTlvImage();
|
||||
RsTlvImage(const RsTlvImage& );
|
||||
virtual ~RsTlvImage() { return; }
|
||||
virtual uint32_t TlvSize() const;
|
||||
virtual void TlvClear();
|
||||
virtual bool SetTlv(void *data, uint32_t size, uint32_t *offset) const;
|
||||
virtual bool GetTlv(void *data, uint32_t size, uint32_t *offset);
|
||||
|
||||
virtual std::ostream &print(std::ostream &out, uint16_t indent) const;
|
||||
bool empty() const { return binData.bin_len == 0 ; }
|
||||
virtual std::ostream &print(std::ostream &out, uint16_t indent) const;
|
||||
|
||||
uint32_t image_type; // Mandatory:
|
||||
uint32_t image_type; // Mandatory:
|
||||
RsTlvBinaryData binData; // Mandatory: serialised file info
|
||||
};
|
||||
|
||||
|
@ -1089,7 +1089,7 @@ bool p3GxsChannels::createChannel(RsGxsChannelGroup& channel)
|
||||
bool p3GxsChannels::createComment(RsGxsComment& comment)
|
||||
{
|
||||
uint32_t token;
|
||||
if(!createComment(token, comment))
|
||||
if(!createNewComment(token, comment))
|
||||
{
|
||||
std::cerr << __PRETTY_FUNCTION__ << "Error! Failed creating comment."
|
||||
<< std::endl;
|
||||
@ -1116,7 +1116,7 @@ bool p3GxsChannels::createComment(RsGxsComment& comment)
|
||||
bool p3GxsChannels::createVote(RsGxsVote& vote)
|
||||
{
|
||||
uint32_t token;
|
||||
if(!createVote(token, vote))
|
||||
if(!createNewVote(token, vote))
|
||||
{
|
||||
std::cerr << __PRETTY_FUNCTION__ << "Error! Failed creating vote."
|
||||
<< std::endl;
|
||||
@ -1795,7 +1795,7 @@ bool p3GxsChannels::generateComment(uint32_t &token, const RsGxsGroupId &grpId,
|
||||
}
|
||||
#endif
|
||||
|
||||
createComment(token, msg);
|
||||
createNewComment(token, msg);
|
||||
|
||||
return true;
|
||||
}
|
||||
@ -1846,7 +1846,7 @@ bool p3GxsChannels::generateVote(uint32_t &token, const RsGxsGroupId &grpId, con
|
||||
vote.mVoteType = GXS_VOTE_DOWN;
|
||||
}
|
||||
|
||||
createVote(token, vote);
|
||||
createNewVote(token, vote);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -132,30 +132,29 @@ virtual bool getChannelDownloadDirectory(const RsGxsGroupId &groupId, std::strin
|
||||
const RsGxsGroupId& grpId ) override;
|
||||
|
||||
/* Comment service - Provide RsGxsCommentService - redirect to p3GxsCommentService */
|
||||
virtual bool getCommentData(uint32_t token, std::vector<RsGxsComment> &msgs)
|
||||
virtual bool getCommentData(uint32_t token, std::vector<RsGxsComment> &msgs) override
|
||||
{ return mCommentService->getGxsCommentData(token, msgs); }
|
||||
|
||||
virtual bool getRelatedComments( uint32_t token,
|
||||
std::vector<RsGxsComment> &msgs )
|
||||
std::vector<RsGxsComment> &msgs ) override
|
||||
{ return mCommentService->getGxsRelatedComments(token, msgs); }
|
||||
|
||||
virtual bool createComment(uint32_t &token, RsGxsComment &msg)
|
||||
virtual bool createNewComment(uint32_t &token, RsGxsComment &msg) override
|
||||
{
|
||||
return mCommentService->createGxsComment(token, msg);
|
||||
}
|
||||
|
||||
virtual bool createVote(uint32_t &token, RsGxsVote &msg)
|
||||
virtual bool createNewVote(uint32_t &token, RsGxsVote &msg) override
|
||||
{
|
||||
return mCommentService->createGxsVote(token, msg);
|
||||
}
|
||||
|
||||
virtual bool acknowledgeComment(uint32_t token, std::pair<RsGxsGroupId, RsGxsMessageId>& msgId)
|
||||
virtual bool acknowledgeComment(uint32_t token, std::pair<RsGxsGroupId, RsGxsMessageId>& msgId) override
|
||||
{
|
||||
return acknowledgeMsg(token, msgId);
|
||||
}
|
||||
|
||||
|
||||
virtual bool acknowledgeVote(uint32_t token, std::pair<RsGxsGroupId, RsGxsMessageId>& msgId)
|
||||
virtual bool acknowledgeVote(uint32_t token, std::pair<RsGxsGroupId, RsGxsMessageId>& msgId) override
|
||||
{
|
||||
if (mCommentService->acknowledgeVote(token, msgId))
|
||||
{
|
||||
|
@ -153,7 +153,118 @@ RsServiceInfo p3GxsCircles::getServiceInfo()
|
||||
GXS_CIRCLES_MIN_MINOR_VERSION);
|
||||
}
|
||||
|
||||
bool p3GxsCircles::createCircle(RsGxsCircleGroup& cData)
|
||||
{
|
||||
uint32_t token;
|
||||
createGroup(token, cData);
|
||||
|
||||
if(waitToken(token) != RsTokenService::COMPLETE)
|
||||
{
|
||||
std::cerr << __PRETTY_FUNCTION__ << "Error! GXS operation failed."
|
||||
<< std::endl;
|
||||
return false;
|
||||
}
|
||||
|
||||
if(!RsGenExchange::getPublishedGroupMeta(token, cData.mMeta))
|
||||
{
|
||||
std::cerr << __PRETTY_FUNCTION__ << "Error! Failure getting created"
|
||||
<< " group data." << std::endl;
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool p3GxsCircles::editCircle(RsGxsCircleGroup& cData)
|
||||
{
|
||||
uint32_t token;
|
||||
updateGroup(token, cData);
|
||||
|
||||
if(waitToken(token) != RsTokenService::COMPLETE)
|
||||
{
|
||||
std::cerr << __PRETTY_FUNCTION__ << "Error! GXS operation failed."
|
||||
<< std::endl;
|
||||
return false;
|
||||
}
|
||||
|
||||
if(!RsGenExchange::getPublishedGroupMeta(token, cData.mMeta))
|
||||
{
|
||||
std::cerr << __PRETTY_FUNCTION__ << "Error! Failure getting updated"
|
||||
<< " group data." << std::endl;
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool p3GxsCircles::getCirclesSummaries(std::list<RsGroupMetaData>& circles)
|
||||
{
|
||||
uint32_t token;
|
||||
RsTokReqOptions opts;
|
||||
opts.mReqType = GXS_REQUEST_TYPE_GROUP_META;
|
||||
if( !requestGroupInfo(token, opts)
|
||||
|| waitToken(token) != RsTokenService::COMPLETE ) return false;
|
||||
return getGroupSummary(token, circles);
|
||||
}
|
||||
|
||||
bool p3GxsCircles::getCirclesInfo( const std::list<RsGxsGroupId>& circlesIds,
|
||||
std::vector<RsGxsCircleGroup>& circlesInfo )
|
||||
{
|
||||
uint32_t token;
|
||||
RsTokReqOptions opts;
|
||||
opts.mReqType = GXS_REQUEST_TYPE_GROUP_DATA;
|
||||
if( !requestGroupInfo(token, opts, circlesIds)
|
||||
|| waitToken(token) != RsTokenService::COMPLETE ) return false;
|
||||
return getGroupData(token, circlesInfo);
|
||||
}
|
||||
|
||||
bool p3GxsCircles::getCircleRequests( const RsGxsGroupId& circleId,
|
||||
std::vector<RsGxsCircleMsg>& requests )
|
||||
{
|
||||
uint32_t token;
|
||||
std::list<RsGxsGroupId> grpIds { circleId };
|
||||
RsTokReqOptions opts;
|
||||
opts.mReqType = GXS_REQUEST_TYPE_MSG_DATA;
|
||||
|
||||
if( !requestMsgInfo(token, opts, grpIds) ||
|
||||
waitToken(token) != RsTokenService::COMPLETE ) return false;
|
||||
|
||||
return getMsgData(token, requests);
|
||||
}
|
||||
|
||||
bool p3GxsCircles::inviteIdsToCircle( const std::set<RsGxsId>& identities,
|
||||
const RsGxsCircleId& circleId )
|
||||
{
|
||||
const std::list<RsGxsGroupId> circlesIds{ RsGxsGroupId(circleId) };
|
||||
std::vector<RsGxsCircleGroup> circlesInfo;
|
||||
|
||||
if(!getCirclesInfo(circlesIds, circlesInfo))
|
||||
{
|
||||
std::cerr << __PRETTY_FUNCTION__ << "Error! Failure getting group data."
|
||||
<< std::endl;
|
||||
return false;
|
||||
}
|
||||
|
||||
if(circlesInfo.empty())
|
||||
{
|
||||
std::cerr << __PRETTY_FUNCTION__ << "Error! Circle: "
|
||||
<< circleId.toStdString() << " not found!" << std::endl;
|
||||
return false;
|
||||
}
|
||||
|
||||
RsGxsCircleGroup& circleGrp = circlesInfo[0];
|
||||
|
||||
if(!(circleGrp.mMeta.mSubscribeFlags & GXS_SERV::GROUP_SUBSCRIBE_ADMIN))
|
||||
{
|
||||
std::cerr << __PRETTY_FUNCTION__ << "Error! Attempt to edit non-own "
|
||||
<< "circle: " << circleId.toStdString() << std::endl;
|
||||
return false;
|
||||
}
|
||||
|
||||
circleGrp.mInvitedMembers.insert(identities.begin(), identities.end());
|
||||
|
||||
return editCircle(circleGrp);
|
||||
}
|
||||
|
||||
uint32_t p3GxsCircles::circleAuthenPolicy()
|
||||
{
|
||||
@ -320,32 +431,6 @@ bool p3GxsCircles:: getCircleDetails(const RsGxsCircleId &id, RsGxsCircleDetails
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
bool p3GxsCircles:: getCirclePersonalIdList(std::list<RsGxsCircleId> &circleIds)
|
||||
{
|
||||
#ifdef DEBUG_CIRCLES
|
||||
std::cerr << "p3GxsCircles::getCircleIdList()";
|
||||
std::cerr << std::endl;
|
||||
#endif // DEBUG_CIRCLES
|
||||
|
||||
RsStackMutex stack(mCircleMtx); /********** STACK LOCKED MTX ******/
|
||||
if (circleIds.empty())
|
||||
{
|
||||
circleIds = mCirclePersonalIdList;
|
||||
}
|
||||
else
|
||||
{
|
||||
std::list<RsGxsCircleId>::const_iterator it;
|
||||
for(it = mCirclePersonalIdList.begin(); it != mCirclePersonalIdList.begin(); ++it)
|
||||
{
|
||||
circleIds.push_back(*it);
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
bool p3GxsCircles:: getCircleExternalIdList(std::list<RsGxsCircleId> &circleIds)
|
||||
{
|
||||
#ifdef DEBUG_CIRCLES
|
||||
|
@ -179,9 +179,30 @@ virtual RsServiceInfo getServiceInfo();
|
||||
|
||||
/*********** External Interface ***************/
|
||||
|
||||
/// @see RsGxsCircles
|
||||
bool createCircle(RsGxsCircleGroup& cData) override;
|
||||
|
||||
/// @see RsGxsCircles
|
||||
bool editCircle(RsGxsCircleGroup& cData) override;
|
||||
|
||||
/// @see RsGxsCircles
|
||||
bool getCirclesSummaries(std::list<RsGroupMetaData>& circles) override;
|
||||
|
||||
/// @see RsGxsCircles
|
||||
bool getCirclesInfo(
|
||||
const std::list<RsGxsGroupId>& circlesIds,
|
||||
std::vector<RsGxsCircleGroup>& circlesInfo ) override;
|
||||
|
||||
/// @see RsGxsCircles
|
||||
bool getCircleRequests( const RsGxsGroupId& circleId,
|
||||
std::vector<RsGxsCircleMsg>& requests ) override;
|
||||
|
||||
/// @see RsGxsCircles
|
||||
bool inviteIdsToCircle( const std::set<RsGxsId>& identities,
|
||||
const RsGxsCircleId& circleId ) override;
|
||||
|
||||
virtual bool getCircleDetails(const RsGxsCircleId &id, RsGxsCircleDetails &details);
|
||||
virtual bool getCircleExternalIdList(std::list<RsGxsCircleId> &circleIds);
|
||||
virtual bool getCirclePersonalIdList(std::list<RsGxsCircleId> &circleIds);
|
||||
|
||||
virtual bool isLoaded(const RsGxsCircleId &circleId);
|
||||
virtual bool loadCircle(const RsGxsCircleId &circleId);
|
||||
@ -257,6 +278,8 @@ virtual RsServiceInfo getServiceInfo();
|
||||
// put a circle id into the external or personal circle id list
|
||||
// this function locks the mutex
|
||||
// if the id is already in the list, it will not be added again
|
||||
// G10h4ck: this is terrible, an std::set instead of a list should be used
|
||||
// to guarantee uniqueness
|
||||
void addCircleIdToList(const RsGxsCircleId& circleId, uint32_t circleType);
|
||||
|
||||
RsMutex mCircleMtx; /* Locked Below Here */
|
||||
|
@ -236,7 +236,7 @@ int p3GxsReputation::tick()
|
||||
return 0;
|
||||
}
|
||||
|
||||
void p3GxsReputation::setNodeAutoPositiveOpinionForContacts(bool b)
|
||||
void p3GxsReputation::setAutoPositiveOpinionForContacts(bool b)
|
||||
{
|
||||
RsStackMutex stack(mReputationMtx); /****** LOCKED MUTEX *******/
|
||||
|
||||
@ -249,13 +249,13 @@ void p3GxsReputation::setNodeAutoPositiveOpinionForContacts(bool b)
|
||||
IndicateConfigChanged() ;
|
||||
}
|
||||
}
|
||||
bool p3GxsReputation::nodeAutoPositiveOpinionForContacts()
|
||||
bool p3GxsReputation::autoPositiveOpinionForContacts()
|
||||
{
|
||||
RsStackMutex stack(mReputationMtx); /****** LOCKED MUTEX *******/
|
||||
return mAutoSetPositiveOptionToContacts ;
|
||||
}
|
||||
|
||||
void p3GxsReputation::setRememberDeletedNodesThreshold(uint32_t days)
|
||||
void p3GxsReputation::setRememberBannedIdThreshold(uint32_t days)
|
||||
{
|
||||
RsStackMutex stack(mReputationMtx); /****** LOCKED MUTEX *******/
|
||||
|
||||
@ -265,7 +265,7 @@ void p3GxsReputation::setRememberDeletedNodesThreshold(uint32_t days)
|
||||
IndicateConfigChanged();
|
||||
}
|
||||
}
|
||||
uint32_t p3GxsReputation::rememberDeletedNodesThreshold()
|
||||
uint32_t p3GxsReputation::rememberBannedIdThreshold()
|
||||
{
|
||||
RsStackMutex stack(mReputationMtx); /****** LOCKED MUTEX *******/
|
||||
|
||||
@ -382,7 +382,10 @@ void p3GxsReputation::cleanup()
|
||||
{
|
||||
bool should_delete = false ;
|
||||
|
||||
if(it->second.mOwnOpinion == RsReputations::OPINION_NEGATIVE && mMaxPreventReloadBannedIds != 0 && it->second.mOwnOpinionTs + mMaxPreventReloadBannedIds < now)
|
||||
if( it->second.mOwnOpinion ==
|
||||
static_cast<int32_t>(RsOpinion::NEGATIVE) &&
|
||||
mMaxPreventReloadBannedIds != 0 &&
|
||||
it->second.mOwnOpinionTs + mMaxPreventReloadBannedIds < now )
|
||||
{
|
||||
#ifdef DEBUG_REPUTATION
|
||||
std::cerr << " ID " << it->first << ": own is negative for more than " << mMaxPreventReloadBannedIds/86400 << " days. Reseting it!" << std::endl;
|
||||
@ -392,7 +395,10 @@ void p3GxsReputation::cleanup()
|
||||
|
||||
// Delete slots with basically no information
|
||||
|
||||
if(it->second.mOpinions.empty() && it->second.mOwnOpinion == RsReputations::OPINION_NEUTRAL && (it->second.mOwnerNode.isNull()))
|
||||
if( it->second.mOpinions.empty() &&
|
||||
it->second.mOwnOpinion ==
|
||||
static_cast<int32_t>(RsOpinion::NEUTRAL) &&
|
||||
it->second.mOwnerNode.isNull() )
|
||||
{
|
||||
#ifdef DEBUG_REPUTATION
|
||||
std::cerr << " ID " << it->first << ": own is neutral and no opinions from friends => remove entry" << std::endl;
|
||||
@ -461,23 +467,20 @@ void p3GxsReputation::cleanup()
|
||||
RsStackMutex stack(mReputationMtx); /****** LOCKED MUTEX *******/
|
||||
|
||||
for(std::map<RsGxsId,Reputation>::iterator it(mReputations.begin());it!=mReputations.end();++it)
|
||||
if(it->second.mOwnOpinion == RsReputations::OPINION_NEUTRAL)
|
||||
if( it->second.mOwnOpinion ==
|
||||
static_cast<int32_t>(RsOpinion::NEUTRAL) )
|
||||
should_set_to_positive_candidates.push_back(it->first) ;
|
||||
}
|
||||
|
||||
for(std::list<RsGxsId>::const_iterator it(should_set_to_positive_candidates.begin());it!=should_set_to_positive_candidates.end();++it)
|
||||
if(rsIdentity->isARegularContact(*it))
|
||||
setOwnOpinion(*it,RsReputations::OPINION_POSITIVE) ;
|
||||
setOwnOpinion(*it, RsOpinion::POSITIVE);
|
||||
}
|
||||
}
|
||||
|
||||
const float RsReputations::REPUTATION_THRESHOLD_ANTI_SPAM = 1.4f ;
|
||||
const float RsReputations::REPUTATION_THRESHOLD_DEFAULT = 1.0f ;
|
||||
|
||||
|
||||
static RsReputations::Opinion safe_convert_uint32t_to_opinion(uint32_t op)
|
||||
static RsOpinion safe_convert_uint32t_to_opinion(uint32_t op)
|
||||
{
|
||||
return RsReputations::Opinion(std::min((uint32_t)op,UPPER_LIMIT)) ;
|
||||
return RsOpinion(std::min( static_cast<uint32_t>(op), UPPER_LIMIT ));
|
||||
}
|
||||
/***** Implementation ******/
|
||||
|
||||
@ -631,13 +634,14 @@ bool p3GxsReputation::SendReputations(RsGxsReputationRequestItem *request)
|
||||
return true;
|
||||
}
|
||||
|
||||
void p3GxsReputation::locked_updateOpinion(const RsPeerId& from,const RsGxsId& about,RsReputations::Opinion op)
|
||||
void p3GxsReputation::locked_updateOpinion(
|
||||
const RsPeerId& from, const RsGxsId& about, RsOpinion op )
|
||||
{
|
||||
/* find matching Reputation */
|
||||
std::map<RsGxsId, Reputation>::iterator rit = mReputations.find(about);
|
||||
|
||||
RsReputations::Opinion new_opinion = safe_convert_uint32t_to_opinion(op);
|
||||
RsReputations::Opinion old_opinion = RsReputations::OPINION_NEUTRAL ; // default if not set
|
||||
RsOpinion new_opinion = op;
|
||||
RsOpinion old_opinion = RsOpinion::NEUTRAL ; // default if not set
|
||||
|
||||
bool updated = false ;
|
||||
|
||||
@ -658,9 +662,9 @@ void p3GxsReputation::locked_updateOpinion(const RsPeerId& from,const RsGxsId& a
|
||||
std::cerr << " no preview record"<< std::endl;
|
||||
#endif
|
||||
|
||||
if(new_opinion != RsReputations::OPINION_NEUTRAL)
|
||||
if(new_opinion != RsOpinion::NEUTRAL)
|
||||
{
|
||||
mReputations[about] = Reputation(about);
|
||||
mReputations[about] = Reputation();
|
||||
rit = mReputations.find(about);
|
||||
}
|
||||
else
|
||||
@ -674,11 +678,11 @@ void p3GxsReputation::locked_updateOpinion(const RsPeerId& from,const RsGxsId& a
|
||||
|
||||
Reputation& reputation = rit->second;
|
||||
|
||||
std::map<RsPeerId,RsReputations::Opinion>::iterator it2 = reputation.mOpinions.find(from) ;
|
||||
std::map<RsPeerId,RsOpinion>::iterator it2 = reputation.mOpinions.find(from) ;
|
||||
|
||||
if(it2 == reputation.mOpinions.end())
|
||||
{
|
||||
if(new_opinion != RsReputations::OPINION_NEUTRAL)
|
||||
if(new_opinion != RsOpinion::NEUTRAL)
|
||||
{
|
||||
reputation.mOpinions[from] = new_opinion; // filters potentially tweaked reputation score sent by friend
|
||||
updated = true ;
|
||||
@ -688,7 +692,7 @@ void p3GxsReputation::locked_updateOpinion(const RsPeerId& from,const RsGxsId& a
|
||||
{
|
||||
old_opinion = it2->second ;
|
||||
|
||||
if(new_opinion == RsReputations::OPINION_NEUTRAL)
|
||||
if(new_opinion == RsOpinion::NEUTRAL)
|
||||
{
|
||||
reputation.mOpinions.erase(it2) ; // don't store when the opinion is neutral
|
||||
updated = true ;
|
||||
@ -700,7 +704,8 @@ void p3GxsReputation::locked_updateOpinion(const RsPeerId& from,const RsGxsId& a
|
||||
}
|
||||
}
|
||||
|
||||
if(reputation.mOpinions.empty() && reputation.mOwnOpinion == RsReputations::OPINION_NEUTRAL)
|
||||
if( reputation.mOpinions.empty() &&
|
||||
reputation.mOwnOpinion == static_cast<int32_t>(RsOpinion::NEUTRAL) )
|
||||
{
|
||||
mReputations.erase(rit) ;
|
||||
#ifdef DEBUG_REPUTATION
|
||||
@ -766,9 +771,10 @@ bool p3GxsReputation::updateLatestUpdate(RsPeerId peerid,rstime_t latest_update)
|
||||
* Opinion
|
||||
****/
|
||||
|
||||
RsReputations::ReputationLevel p3GxsReputation::overallReputationLevel(const RsGxsId& id,uint32_t *identity_flags)
|
||||
RsReputationLevel p3GxsReputation::overallReputationLevel(
|
||||
const RsGxsId& id, uint32_t* identity_flags )
|
||||
{
|
||||
ReputationInfo info ;
|
||||
RsReputationInfo info ;
|
||||
getReputationInfo(id,RsPgpId(),info) ;
|
||||
|
||||
RsPgpId owner_id ;
|
||||
@ -805,12 +811,14 @@ bool p3GxsReputation::getIdentityFlagsAndOwnerId(const RsGxsId& gxsid, uint32_t&
|
||||
return true ;
|
||||
}
|
||||
|
||||
bool p3GxsReputation::getReputationInfo(const RsGxsId& gxsid, const RsPgpId& ownerNode, RsReputations::ReputationInfo& info, bool stamp)
|
||||
bool p3GxsReputation::getReputationInfo(
|
||||
const RsGxsId& gxsid, const RsPgpId& ownerNode, RsReputationInfo& info,
|
||||
bool stamp )
|
||||
{
|
||||
if(gxsid.isNull())
|
||||
return false ;
|
||||
|
||||
rstime_t now = time(NULL) ;
|
||||
rstime_t now = time(nullptr);
|
||||
|
||||
RsStackMutex stack(mReputationMtx); /****** LOCKED MUTEX *******/
|
||||
|
||||
@ -822,8 +830,8 @@ bool p3GxsReputation::getReputationInfo(const RsGxsId& gxsid, const RsPgpId& own
|
||||
|
||||
if(it == mReputations.end())
|
||||
{
|
||||
info.mOwnOpinion = RsReputations::OPINION_NEUTRAL ;
|
||||
info.mFriendAverageScore = REPUTATION_THRESHOLD_DEFAULT ;
|
||||
info.mOwnOpinion = RsOpinion::NEUTRAL ;
|
||||
info.mFriendAverageScore = RS_REPUTATION_THRESHOLD_DEFAULT ;
|
||||
info.mFriendsNegativeVotes = 0 ;
|
||||
info.mFriendsPositiveVotes = 0 ;
|
||||
|
||||
@ -833,7 +841,9 @@ bool p3GxsReputation::getReputationInfo(const RsGxsId& gxsid, const RsPgpId& own
|
||||
{
|
||||
Reputation& rep(it->second) ;
|
||||
|
||||
info.mOwnOpinion = RsReputations::Opinion(rep.mOwnOpinion) ;
|
||||
info.mOwnOpinion =
|
||||
safe_convert_uint32t_to_opinion(
|
||||
static_cast<uint32_t>(rep.mOwnOpinion) );
|
||||
info.mFriendAverageScore = rep.mFriendAverage ;
|
||||
info.mFriendsNegativeVotes = rep.mFriendsNegative ;
|
||||
info.mFriendsPositiveVotes = rep.mFriendsPositive ;
|
||||
@ -853,18 +863,18 @@ bool p3GxsReputation::getReputationInfo(const RsGxsId& gxsid, const RsPgpId& own
|
||||
|
||||
// 0 - check for own opinion. If positive or negative, it decides on the result
|
||||
|
||||
if(info.mOwnOpinion == RsReputations::OPINION_NEGATIVE)
|
||||
if(info.mOwnOpinion == RsOpinion::NEGATIVE)
|
||||
{
|
||||
// own opinion is always read in priority
|
||||
|
||||
info.mOverallReputationLevel = RsReputations::REPUTATION_LOCALLY_NEGATIVE ;
|
||||
info.mOverallReputationLevel = RsReputationLevel::LOCALLY_NEGATIVE;
|
||||
return true ;
|
||||
}
|
||||
if(info.mOwnOpinion == RsReputations::OPINION_POSITIVE)
|
||||
if(info.mOwnOpinion == RsOpinion::POSITIVE)
|
||||
{
|
||||
// own opinion is always read in priority
|
||||
|
||||
info.mOverallReputationLevel = RsReputations::REPUTATION_LOCALLY_POSITIVE ;
|
||||
info.mOverallReputationLevel = RsReputationLevel::LOCALLY_POSITIVE;
|
||||
return true ;
|
||||
}
|
||||
|
||||
@ -889,7 +899,7 @@ bool p3GxsReputation::getReputationInfo(const RsGxsId& gxsid, const RsPgpId& own
|
||||
#ifdef DEBUG_REPUTATION2
|
||||
std::cerr << "p3GxsReputations: identity " << gxsid << " is banned because owner node ID " << owner_id << " is banned (found in banned nodes list)." << std::endl;
|
||||
#endif
|
||||
info.mOverallReputationLevel = RsReputations::REPUTATION_LOCALLY_NEGATIVE ;
|
||||
info.mOverallReputationLevel = RsReputationLevel::LOCALLY_NEGATIVE;
|
||||
return true ;
|
||||
}
|
||||
// also check the proxy
|
||||
@ -899,17 +909,17 @@ bool p3GxsReputation::getReputationInfo(const RsGxsId& gxsid, const RsPgpId& own
|
||||
#ifdef DEBUG_REPUTATION2
|
||||
std::cerr << "p3GxsReputations: identity " << gxsid << " is banned because owner node ID " << owner_id << " is banned (found in proxy)." << std::endl;
|
||||
#endif
|
||||
info.mOverallReputationLevel = RsReputations::REPUTATION_LOCALLY_NEGATIVE ;
|
||||
info.mOverallReputationLevel = RsReputationLevel::LOCALLY_NEGATIVE;
|
||||
return true;
|
||||
}
|
||||
// 2 - now, our own opinion is neutral, which means we rely on what our friends tell
|
||||
|
||||
if(info.mFriendsPositiveVotes >= info.mFriendsNegativeVotes + mMinVotesForRemotelyPositive)
|
||||
info.mOverallReputationLevel = RsReputations::REPUTATION_REMOTELY_POSITIVE ;
|
||||
info.mOverallReputationLevel = RsReputationLevel::REMOTELY_POSITIVE;
|
||||
else if(info.mFriendsPositiveVotes + mMinVotesForRemotelyNegative <= info.mFriendsNegativeVotes)
|
||||
info.mOverallReputationLevel = RsReputations::REPUTATION_REMOTELY_NEGATIVE ;
|
||||
info.mOverallReputationLevel = RsReputationLevel::REMOTELY_NEGATIVE;
|
||||
else
|
||||
info.mOverallReputationLevel = RsReputations::REPUTATION_NEUTRAL ;
|
||||
info.mOverallReputationLevel = RsReputationLevel::NEUTRAL;
|
||||
|
||||
#ifdef DEBUG_REPUTATION2
|
||||
std::cerr << " information present. OwnOp = " << info.mOwnOpinion << ", owner node=" << owner_id << ", overall score=" << info.mAssessment << std::endl;
|
||||
@ -969,16 +979,20 @@ void p3GxsReputation::banNode(const RsPgpId& id,bool b)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
RsReputationLevel p3GxsReputation::overallReputationLevel(const RsGxsId& id)
|
||||
{ return overallReputationLevel(id, nullptr); }
|
||||
|
||||
bool p3GxsReputation::isNodeBanned(const RsPgpId& id)
|
||||
{
|
||||
RsStackMutex stack(mReputationMtx); /****** LOCKED MUTEX *******/
|
||||
RsStackMutex stack(mReputationMtx); /****** LOCKED MUTEX *******/
|
||||
|
||||
return mBannedPgpIds.find(id) != mBannedPgpIds.end();
|
||||
}
|
||||
|
||||
bool p3GxsReputation::isIdentityBanned(const RsGxsId &id)
|
||||
{
|
||||
RsReputations::ReputationInfo info ;
|
||||
RsReputationInfo info;
|
||||
|
||||
if(!getReputationInfo(id,RsPgpId(),info))
|
||||
return false ;
|
||||
@ -986,10 +1000,11 @@ bool p3GxsReputation::isIdentityBanned(const RsGxsId &id)
|
||||
#ifdef DEBUG_REPUTATION
|
||||
std::cerr << "isIdentityBanned(): returning " << (info.mOverallReputationLevel == RsReputations::REPUTATION_LOCALLY_NEGATIVE) << " for GXS id " << id << std::endl;
|
||||
#endif
|
||||
return info.mOverallReputationLevel == RsReputations::REPUTATION_LOCALLY_NEGATIVE ;
|
||||
return info.mOverallReputationLevel == RsReputationLevel::LOCALLY_NEGATIVE;
|
||||
}
|
||||
|
||||
bool p3GxsReputation::getOwnOpinion(const RsGxsId& gxsid, RsReputations::Opinion& opinion)
|
||||
bool p3GxsReputation::getOwnOpinion(
|
||||
const RsGxsId& gxsid, RsOpinion& opinion )
|
||||
{
|
||||
#ifdef DEBUG_REPUTATION
|
||||
std::cerr << "setOwnOpinion(): for GXS id " << gxsid << " to " << opinion << std::endl;
|
||||
@ -1000,19 +1015,21 @@ bool p3GxsReputation::getOwnOpinion(const RsGxsId& gxsid, RsReputations::Opinion
|
||||
return false ;
|
||||
}
|
||||
|
||||
RsStackMutex stack(mReputationMtx); /****** LOCKED MUTEX *******/
|
||||
RS_STACK_MUTEX(mReputationMtx);
|
||||
|
||||
std::map<RsGxsId, Reputation>::iterator rit = mReputations.find(gxsid);
|
||||
|
||||
if(rit != mReputations.end())
|
||||
opinion = RsReputations::Opinion(rit->second.mOwnOpinion) ;
|
||||
else
|
||||
opinion = RsReputations::OPINION_NEUTRAL ;
|
||||
if(rit != mReputations.end())
|
||||
opinion = safe_convert_uint32t_to_opinion(
|
||||
static_cast<uint32_t>(rit->second.mOwnOpinion) );
|
||||
else
|
||||
opinion = RsOpinion::NEUTRAL;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool p3GxsReputation::setOwnOpinion(const RsGxsId& gxsid, const RsReputations::Opinion& opinion)
|
||||
bool p3GxsReputation::setOwnOpinion(
|
||||
const RsGxsId& gxsid, RsOpinion opinion )
|
||||
{
|
||||
#ifdef DEBUG_REPUTATION
|
||||
std::cerr << "setOwnOpinion(): for GXS id " << gxsid << " to " << opinion << std::endl;
|
||||
@ -1022,8 +1039,8 @@ bool p3GxsReputation::setOwnOpinion(const RsGxsId& gxsid, const RsReputations::O
|
||||
std::cerr << " ID " << gxsid << " is rejected. Look for a bug in calling method." << std::endl;
|
||||
return false ;
|
||||
}
|
||||
|
||||
RsStackMutex stack(mReputationMtx); /****** LOCKED MUTEX *******/
|
||||
|
||||
RS_STACK_MUTEX(mReputationMtx);
|
||||
|
||||
std::map<RsGxsId, Reputation>::iterator rit;
|
||||
|
||||
@ -1033,7 +1050,7 @@ bool p3GxsReputation::setOwnOpinion(const RsGxsId& gxsid, const RsReputations::O
|
||||
if (rit == mReputations.end())
|
||||
{
|
||||
#warning csoler 2017-01-05: We should set the owner node id here.
|
||||
mReputations[gxsid] = Reputation(gxsid);
|
||||
mReputations[gxsid] = Reputation();
|
||||
rit = mReputations.find(gxsid);
|
||||
}
|
||||
|
||||
@ -1041,7 +1058,7 @@ bool p3GxsReputation::setOwnOpinion(const RsGxsId& gxsid, const RsReputations::O
|
||||
Reputation &reputation = rit->second;
|
||||
if (reputation.mOwnOpinionTs != 0)
|
||||
{
|
||||
if (reputation.mOwnOpinion == opinion)
|
||||
if (reputation.mOwnOpinion == static_cast<int32_t>(opinion))
|
||||
{
|
||||
// if opinion is accurate, don't update.
|
||||
return false;
|
||||
@ -1060,8 +1077,8 @@ bool p3GxsReputation::setOwnOpinion(const RsGxsId& gxsid, const RsReputations::O
|
||||
}
|
||||
}
|
||||
|
||||
rstime_t now = time(NULL);
|
||||
reputation.mOwnOpinion = opinion;
|
||||
rstime_t now = time(nullptr);
|
||||
reputation.mOwnOpinion = static_cast<int32_t>(opinion);
|
||||
reputation.mOwnOpinionTs = now;
|
||||
reputation.updateReputation();
|
||||
|
||||
@ -1126,7 +1143,7 @@ bool p3GxsReputation::saveList(bool& cleanup, std::list<RsItem*> &savelist)
|
||||
item->mOwnerNodeId = rit->second.mOwnerNode;
|
||||
item->mLastUsedTS = rit->second.mLastUsedTS;
|
||||
|
||||
std::map<RsPeerId, RsReputations::Opinion>::iterator oit;
|
||||
std::map<RsPeerId, RsOpinion>::iterator oit;
|
||||
for(oit = rit->second.mOpinions.begin(); oit != rit->second.mOpinions.end(); ++oit)
|
||||
{
|
||||
// should be already limited.
|
||||
@ -1492,15 +1509,16 @@ void Reputation::updateReputation()
|
||||
// accounts for all friends. Neutral opinions count for 1-1=0
|
||||
// because the average is performed over only accessible peers (not the total number) we need to shift to 1
|
||||
|
||||
for(std::map<RsPeerId,RsReputations::Opinion>::const_iterator it(mOpinions.begin());it!=mOpinions.end();++it)
|
||||
for( std::map<RsPeerId,RsOpinion>::const_iterator it(mOpinions.begin());
|
||||
it != mOpinions.end(); ++it )
|
||||
{
|
||||
if( it->second == RsReputations::OPINION_NEGATIVE)
|
||||
if( it->second == RsOpinion::NEGATIVE)
|
||||
++mFriendsNegative ;
|
||||
|
||||
if( it->second == RsReputations::OPINION_POSITIVE)
|
||||
if( it->second == RsOpinion::POSITIVE)
|
||||
++mFriendsPositive ;
|
||||
|
||||
friend_total += it->second - 1 ;
|
||||
friend_total += static_cast<int>(it->second) - 1;
|
||||
}
|
||||
|
||||
if(mOpinions.empty()) // includes the case of no friends!
|
||||
@ -1554,11 +1572,10 @@ void Reputation::updateReputation()
|
||||
}
|
||||
|
||||
// now compute a bias for PGP-signed ids.
|
||||
|
||||
if(mOwnOpinion == RsReputations::OPINION_NEUTRAL)
|
||||
mReputationScore = mFriendAverage ;
|
||||
else
|
||||
mReputationScore = (float)mOwnOpinion ;
|
||||
|
||||
if(mOwnOpinion == static_cast<int32_t>(RsOpinion::NEUTRAL))
|
||||
mReputationScore = mFriendAverage;
|
||||
else mReputationScore = static_cast<float>(mOwnOpinion);
|
||||
}
|
||||
|
||||
void p3GxsReputation::debug_print()
|
||||
@ -1567,19 +1584,22 @@ void p3GxsReputation::debug_print()
|
||||
std::cerr << " GXS ID data: " << std::endl;
|
||||
std::cerr << std::dec ;
|
||||
|
||||
std::map<RsGxsId,Reputation> rep_copy;
|
||||
std::map<RsGxsId,Reputation> rep_copy;
|
||||
|
||||
{
|
||||
RsStackMutex stack(mReputationMtx); /****** LOCKED MUTEX *******/
|
||||
rep_copy = mReputations ;
|
||||
}
|
||||
rstime_t now = time(NULL) ;
|
||||
{
|
||||
RS_STACK_MUTEX(mReputationMtx);
|
||||
rep_copy = mReputations;
|
||||
}
|
||||
|
||||
for(std::map<RsGxsId,Reputation>::const_iterator it(rep_copy.begin());it!=rep_copy.end();++it)
|
||||
rstime_t now = time(nullptr);
|
||||
|
||||
|
||||
for( std::map<RsGxsId,Reputation>::const_iterator it(rep_copy.begin());
|
||||
it != rep_copy.end(); ++it )
|
||||
{
|
||||
RsReputations::ReputationInfo info ;
|
||||
getReputationInfo(it->first,RsPgpId(),info,false) ;
|
||||
uint32_t lev = info.mOverallReputationLevel;
|
||||
RsReputationInfo info;
|
||||
getReputationInfo(it->first, RsPgpId(), info, false);
|
||||
uint32_t lev = static_cast<uint32_t>(info.mOverallReputationLevel);
|
||||
|
||||
std::cerr << " " << it->first << ": own: " << it->second.mOwnOpinion
|
||||
<< ", PGP id=" << it->second.mOwnerNode
|
||||
@ -1596,7 +1616,7 @@ std::map<RsGxsId,Reputation> rep_copy;
|
||||
#endif
|
||||
}
|
||||
|
||||
RsStackMutex stack(mReputationMtx); /****** LOCKED MUTEX *******/
|
||||
RS_STACK_MUTEX(mReputationMtx);
|
||||
std::cerr << " Banned RS nodes by ID: " << std::endl;
|
||||
|
||||
for(std::map<RsPgpId,BannedNodeInfo>::const_iterator it(mBannedPgpIds.begin());it!=mBannedPgpIds.end();++it)
|
||||
|
@ -64,15 +64,17 @@ struct BannedNodeInfo
|
||||
class Reputation
|
||||
{
|
||||
public:
|
||||
Reputation()
|
||||
:mOwnOpinion(RsReputations::OPINION_NEUTRAL), mOwnOpinionTs(0),mFriendAverage(1.0f), mReputationScore(RsReputations::OPINION_NEUTRAL),mIdentityFlags(0){ }
|
||||
|
||||
Reputation(const RsGxsId& /*about*/)
|
||||
:mOwnOpinion(RsReputations::OPINION_NEUTRAL), mOwnOpinionTs(0),mFriendAverage(1.0f), mReputationScore(RsReputations::OPINION_NEUTRAL),mIdentityFlags(0){ }
|
||||
Reputation() :
|
||||
mOwnOpinion(static_cast<int32_t>(RsOpinion::NEUTRAL)), mOwnOpinionTs(0),
|
||||
mFriendAverage(1.0f),
|
||||
/* G10h4ck: TODO shouln't this be initialized with
|
||||
* RsReputation::NEUTRAL or UNKOWN? */
|
||||
mReputationScore(static_cast<float>(RsOpinion::NEUTRAL)),
|
||||
mIdentityFlags(0) {}
|
||||
|
||||
void updateReputation();
|
||||
|
||||
std::map<RsPeerId, RsReputations::Opinion> mOpinions;
|
||||
std::map<RsPeerId, RsOpinion> mOpinions;
|
||||
int32_t mOwnOpinion;
|
||||
rstime_t mOwnOpinionTs;
|
||||
|
||||
@ -91,11 +93,6 @@ public:
|
||||
|
||||
|
||||
//!The p3GxsReputation service.
|
||||
/**
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
class p3GxsReputation: public p3Service, public p3Config, public RsGixsReputation, public RsReputations /* , public pqiMonitor */
|
||||
{
|
||||
public:
|
||||
@ -103,20 +100,26 @@ public:
|
||||
virtual RsServiceInfo getServiceInfo();
|
||||
|
||||
/***** Interface for RsReputations *****/
|
||||
virtual bool setOwnOpinion(const RsGxsId& key_id, const Opinion& op) ;
|
||||
virtual bool getOwnOpinion(const RsGxsId& key_id, Opinion& op) ;
|
||||
virtual bool getReputationInfo(const RsGxsId& id, const RsPgpId &ownerNode, ReputationInfo& info,bool stamp=true) ;
|
||||
virtual bool setOwnOpinion(const RsGxsId& key_id, RsOpinion op);
|
||||
virtual bool getOwnOpinion(const RsGxsId& key_id, RsOpinion& op) ;
|
||||
virtual bool getReputationInfo(
|
||||
const RsGxsId& id, const RsPgpId& ownerNode, RsReputationInfo& info,
|
||||
bool stamp = true );
|
||||
virtual bool isIdentityBanned(const RsGxsId& id) ;
|
||||
|
||||
virtual bool isNodeBanned(const RsPgpId& id);
|
||||
virtual void banNode(const RsPgpId& id,bool b) ;
|
||||
virtual ReputationLevel overallReputationLevel(const RsGxsId& id,uint32_t *identity_flags=NULL);
|
||||
|
||||
virtual void setNodeAutoPositiveOpinionForContacts(bool b) ;
|
||||
virtual bool nodeAutoPositiveOpinionForContacts() ;
|
||||
RsReputationLevel overallReputationLevel(const RsGxsId& id) override;
|
||||
|
||||
virtual void setRememberDeletedNodesThreshold(uint32_t days) ;
|
||||
virtual uint32_t rememberDeletedNodesThreshold() ;
|
||||
virtual RsReputationLevel overallReputationLevel(
|
||||
const RsGxsId& id, uint32_t* identity_flags );
|
||||
|
||||
virtual void setAutoPositiveOpinionForContacts(bool b) ;
|
||||
virtual bool autoPositiveOpinionForContacts() ;
|
||||
|
||||
virtual void setRememberBannedIdThreshold(uint32_t days) ;
|
||||
virtual uint32_t rememberBannedIdThreshold() ;
|
||||
|
||||
uint32_t thresholdForRemotelyNegativeReputation();
|
||||
uint32_t thresholdForRemotelyPositiveReputation();
|
||||
@ -149,7 +152,8 @@ private:
|
||||
void updateBannedNodesProxy();
|
||||
|
||||
// internal update of data. Takes care of cleaning empty boxes.
|
||||
void locked_updateOpinion(const RsPeerId &from, const RsGxsId &about, RsReputations::Opinion op);
|
||||
void locked_updateOpinion(
|
||||
const RsPeerId& from, const RsGxsId& about, RsOpinion op);
|
||||
bool loadReputationSet(RsGxsReputationSetItem *item, const std::set<RsPeerId> &peerSet);
|
||||
#ifdef TO_REMOVE
|
||||
bool loadReputationSet_deprecated3(RsGxsReputationSetItem_deprecated3 *item, const std::set<RsPeerId> &peerSet);
|
||||
|
@ -21,6 +21,7 @@
|
||||
* *
|
||||
*******************************************************************************/
|
||||
#include <unistd.h>
|
||||
#include <algorithm>
|
||||
|
||||
#include "services/p3idservice.h"
|
||||
#include "pgp/pgpauxutils.h"
|
||||
@ -207,6 +208,32 @@ void p3IdService::setNes(RsNetworkExchangeService *nes)
|
||||
mNes = nes;
|
||||
}
|
||||
|
||||
bool p3IdService::getIdentitiesInfo(
|
||||
const std::set<RsGxsId>& ids, std::vector<RsGxsIdGroup>& idsInfo )
|
||||
{
|
||||
uint32_t token;
|
||||
|
||||
RsTokReqOptions opts;
|
||||
opts.mReqType = GXS_REQUEST_TYPE_GROUP_DATA;
|
||||
|
||||
std::list<RsGxsGroupId> idsList;
|
||||
for (auto&& id : ids) idsList.push_back(RsGxsGroupId(id));
|
||||
|
||||
if( !requestGroupInfo(token, opts, idsList)
|
||||
|| waitToken(token) != RsTokenService::COMPLETE ) return false;
|
||||
return getGroupData(token, idsInfo);
|
||||
}
|
||||
|
||||
bool p3IdService::getIdentitiesSummaries(std::list<RsGroupMetaData>& ids)
|
||||
{
|
||||
uint32_t token;
|
||||
RsTokReqOptions opts;
|
||||
opts.mReqType = GXS_REQUEST_TYPE_GROUP_META;
|
||||
if( !requestGroupInfo(token, opts)
|
||||
|| waitToken(token) != RsTokenService::COMPLETE ) return false;
|
||||
return getGroupSummary(token, ids);
|
||||
}
|
||||
|
||||
uint32_t p3IdService::idAuthenPolicy()
|
||||
{
|
||||
uint32_t policy = 0;
|
||||
@ -687,11 +714,12 @@ bool p3IdService::getIdDetails(const RsGxsId &id, RsIdentityDetails &details)
|
||||
// This step is needed, because p3GxsReputation does not know all identities, and might not have any data for
|
||||
// the ones in the contact list. So we change them on demand.
|
||||
|
||||
if(is_a_contact && rsReputations->nodeAutoPositiveOpinionForContacts())
|
||||
if(is_a_contact && rsReputations->autoPositiveOpinionForContacts())
|
||||
{
|
||||
RsReputations::Opinion op ;
|
||||
if(rsReputations->getOwnOpinion(id,op) && op == RsReputations::OPINION_NEUTRAL)
|
||||
rsReputations->setOwnOpinion(id,RsReputations::OPINION_POSITIVE) ;
|
||||
RsOpinion op;
|
||||
if( rsReputations->getOwnOpinion(id,op) &&
|
||||
op == RsOpinion::NEUTRAL )
|
||||
rsReputations->setOwnOpinion(id, RsOpinion::POSITIVE);
|
||||
}
|
||||
|
||||
std::map<RsGxsId,keyTSInfo>::const_iterator it = mKeysTS.find(id) ;
|
||||
@ -727,6 +755,46 @@ bool p3IdService::isOwnId(const RsGxsId& id)
|
||||
|
||||
return std::find(mOwnIds.begin(),mOwnIds.end(),id) != mOwnIds.end() ;
|
||||
}
|
||||
|
||||
|
||||
bool p3IdService::getOwnSignedIds(std::vector<RsGxsId> ids)
|
||||
{
|
||||
ids.clear();
|
||||
|
||||
std::chrono::seconds maxWait(5);
|
||||
auto timeout = std::chrono::steady_clock::now() + maxWait;
|
||||
while( !ownIdsAreLoaded() && std::chrono::steady_clock::now() < timeout )
|
||||
std::this_thread::sleep_for(std::chrono::milliseconds(100));
|
||||
|
||||
if(ownIdsAreLoaded())
|
||||
{
|
||||
RS_STACK_MUTEX(mIdMtx);
|
||||
ids.reserve(mOwnSignedIds.size());
|
||||
ids.insert(ids.end(), mOwnSignedIds.begin(), mOwnSignedIds.end());
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool p3IdService::getOwnPseudonimousIds(std::vector<RsGxsId> ids)
|
||||
{
|
||||
ids.clear();
|
||||
std::vector<RsGxsId> signedV;
|
||||
|
||||
// this implicitely ensure ids are already loaded ;)
|
||||
if(!getOwnSignedIds(signedV)) return false;
|
||||
std::set<RsGxsId> signedS(signedV.begin(), signedV.end());
|
||||
|
||||
{
|
||||
RS_STACK_MUTEX(mIdMtx);
|
||||
std::copy_if(mOwnIds.begin(), mOwnIds.end(), ids.end(),
|
||||
[&](const RsGxsId& id) {return !signedS.count(id);});
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool p3IdService::getOwnIds(std::list<RsGxsId> &ownIds,bool signed_only)
|
||||
{
|
||||
RsStackMutex stack(mIdMtx); /********** STACK LOCKED MTX ******/
|
||||
@ -742,6 +810,11 @@ bool p3IdService::getOwnIds(std::list<RsGxsId> &ownIds,bool signed_only)
|
||||
return true ;
|
||||
}
|
||||
|
||||
|
||||
bool p3IdService::identityToBase64( const RsGxsId& id,
|
||||
std::string& base64String )
|
||||
{ return serialiseIdentityToMemory(id, base64String); }
|
||||
|
||||
bool p3IdService::serialiseIdentityToMemory( const RsGxsId& id,
|
||||
std::string& radix_string )
|
||||
{
|
||||
@ -803,6 +876,10 @@ void p3IdService::handle_get_serialized_grp(uint32_t token)
|
||||
mSerialisedIdentities[RsGxsId(id)] = s ;
|
||||
}
|
||||
|
||||
bool p3IdService::identityFromBase64(
|
||||
const std::string& base64String, RsGxsId& id )
|
||||
{ return deserialiseIdentityFromMemory(base64String, &id); }
|
||||
|
||||
bool p3IdService::deserialiseIdentityFromMemory(const std::string& radix_string,
|
||||
RsGxsId* id /* = nullptr */)
|
||||
{
|
||||
@ -826,6 +903,47 @@ bool p3IdService::deserialiseIdentityFromMemory(const std::string& radix_string,
|
||||
return true;
|
||||
}
|
||||
|
||||
bool p3IdService::createIdentity(
|
||||
RsGxsId& id,
|
||||
const std::string& name, const RsGxsImage& avatar,
|
||||
bool pseudonimous, const std::string& pgpPassword)
|
||||
{
|
||||
if(!pgpPassword.empty())
|
||||
std::cerr<< __PRETTY_FUNCTION__ << " Warning! PGP Password handling "
|
||||
<< "not implemented yet!" << std::endl;
|
||||
|
||||
RsIdentityParameters params;
|
||||
params.isPgpLinked = !pseudonimous;
|
||||
params.nickname = name;
|
||||
params.mImage = avatar;
|
||||
|
||||
uint32_t token;
|
||||
if(!createIdentity(token, params))
|
||||
{
|
||||
std::cerr << __PRETTY_FUNCTION__ << " Error! Failed creating group."
|
||||
<< std::endl;
|
||||
return false;
|
||||
}
|
||||
|
||||
if(waitToken(token) != RsTokenService::COMPLETE)
|
||||
{
|
||||
std::cerr << __PRETTY_FUNCTION__ << " Error! GXS operation failed."
|
||||
<< std::endl;
|
||||
return false;
|
||||
}
|
||||
|
||||
RsGroupMetaData meta;
|
||||
if(!RsGenExchange::getPublishedGroupMeta(token, meta))
|
||||
{
|
||||
std::cerr << __PRETTY_FUNCTION__ << "Error! Failure getting updated "
|
||||
<< " group data." << std::endl;
|
||||
return false;
|
||||
}
|
||||
|
||||
id = RsGxsId(meta.mGroupId);
|
||||
return true;
|
||||
}
|
||||
|
||||
bool p3IdService::createIdentity(uint32_t& token, RsIdentityParameters ¶ms)
|
||||
{
|
||||
|
||||
@ -863,6 +981,26 @@ bool p3IdService::createIdentity(uint32_t& token, RsIdentityParameters ¶ms)
|
||||
return true;
|
||||
}
|
||||
|
||||
bool p3IdService::updateIdentity(RsGxsIdGroup& identityData)
|
||||
{
|
||||
uint32_t token;
|
||||
if(!updateGroup(token, identityData))
|
||||
{
|
||||
std::cerr << __PRETTY_FUNCTION__ << "Error! Failed updating group."
|
||||
<< std::endl;
|
||||
return false;
|
||||
}
|
||||
|
||||
if(waitToken(token) != RsTokenService::COMPLETE)
|
||||
{
|
||||
std::cerr << __PRETTY_FUNCTION__ << "Error! GXS operation failed."
|
||||
<< std::endl;
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool p3IdService::updateIdentity(uint32_t& token, RsGxsIdGroup &group)
|
||||
{
|
||||
#ifdef DEBUG_IDS
|
||||
@ -876,6 +1014,27 @@ bool p3IdService::updateIdentity(uint32_t& token, RsGxsIdGroup &group)
|
||||
return false;
|
||||
}
|
||||
|
||||
bool p3IdService::deleteIdentity(RsGxsId& id)
|
||||
{
|
||||
uint32_t token;
|
||||
RsGxsGroupId grouId = RsGxsGroupId(id);
|
||||
if(!deleteGroup(token, grouId))
|
||||
{
|
||||
std::cerr << __PRETTY_FUNCTION__ << "Error! Failed deleting group."
|
||||
<< std::endl;
|
||||
return false;
|
||||
}
|
||||
|
||||
if(waitToken(token) != RsTokenService::COMPLETE)
|
||||
{
|
||||
std::cerr << __PRETTY_FUNCTION__ << "Error! GXS operation failed."
|
||||
<< std::endl;
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool p3IdService::deleteIdentity(uint32_t& token, RsGxsIdGroup &group)
|
||||
{
|
||||
#ifdef DEBUG_IDS
|
||||
@ -883,7 +1042,7 @@ bool p3IdService::deleteIdentity(uint32_t& token, RsGxsIdGroup &group)
|
||||
std::cerr << std::endl;
|
||||
#endif
|
||||
|
||||
deleteGroup(token, group);
|
||||
deleteGroup(token, group.mMeta.mGroupId);
|
||||
|
||||
return false;
|
||||
}
|
||||
@ -1012,10 +1171,10 @@ bool p3IdService::requestKey(const RsGxsId &id, const std::list<RsPeerId>& peers
|
||||
std::cerr << "p3IdService::requesting key " << id <<std::endl;
|
||||
#endif
|
||||
|
||||
RsReputations::ReputationInfo info ;
|
||||
RsReputationInfo info;
|
||||
rsReputations->getReputationInfo(id,RsPgpId(),info) ;
|
||||
|
||||
if(info.mOverallReputationLevel == RsReputations::REPUTATION_LOCALLY_NEGATIVE)
|
||||
if( info.mOverallReputationLevel == RsReputationLevel::LOCALLY_NEGATIVE )
|
||||
{
|
||||
std::cerr << "(II) not requesting Key " << id << " because it has been banned." << std::endl;
|
||||
|
||||
@ -1796,16 +1955,16 @@ bool p3IdService::updateGroup(uint32_t& token, RsGxsIdGroup &group)
|
||||
return true;
|
||||
}
|
||||
|
||||
bool p3IdService::deleteGroup(uint32_t& token, RsGxsIdGroup &group)
|
||||
bool p3IdService::deleteGroup(uint32_t& token, RsGxsGroupId& groupId)
|
||||
{
|
||||
RsGxsId id(group.mMeta.mGroupId);
|
||||
RsGxsId id(groupId);
|
||||
|
||||
#ifdef DEBUG_IDS
|
||||
std::cerr << "p3IdService::deleteGroup() Deleting RsGxsId: " << id;
|
||||
std::cerr << std::endl;
|
||||
#endif
|
||||
|
||||
RsGenExchange::deleteGroup(token,group.mMeta.mGroupId);
|
||||
RsGenExchange::deleteGroup(token, groupId);
|
||||
|
||||
// if its in the cache - clear it.
|
||||
{
|
||||
|
@ -215,9 +215,8 @@ struct SerialisedIdentityStruct
|
||||
rstime_t mLastUsageTS;
|
||||
};
|
||||
|
||||
// Not sure exactly what should be inherited here?
|
||||
// Chris - please correct as necessary.
|
||||
|
||||
// We cache all identities, and provide alternative (instantaneous)
|
||||
// functions to extract info, rather than the horrible Token system.
|
||||
class p3IdService: public RsGxsIdExchange, public RsIdentity, public GxsTokenQueue, public RsTickEvent, public p3Config
|
||||
{
|
||||
public:
|
||||
@ -239,6 +238,13 @@ public:
|
||||
|
||||
/* Data Specific Interface */
|
||||
|
||||
/// @see RsIdentity
|
||||
bool getIdentitiesInfo(const std::set<RsGxsId>& ids,
|
||||
std::vector<RsGxsIdGroup>& idsInfo ) override;
|
||||
|
||||
/// @see RsIdentity
|
||||
bool getIdentitiesSummaries(std::list<RsGroupMetaData>& ids) override;
|
||||
|
||||
// These are exposed via RsIdentity.
|
||||
virtual bool getGroupData(const uint32_t &token, std::vector<RsGxsIdGroup> &groups);
|
||||
virtual bool getGroupSerializedData(const uint32_t &token, std::map<RsGxsId,std::string>& serialized_groups);
|
||||
@ -248,7 +254,7 @@ public:
|
||||
// These are local - and not exposed via RsIdentity.
|
||||
virtual bool createGroup(uint32_t& token, RsGxsIdGroup &group);
|
||||
virtual bool updateGroup(uint32_t& token, RsGxsIdGroup &group);
|
||||
virtual bool deleteGroup(uint32_t& token, RsGxsIdGroup &group);
|
||||
virtual bool deleteGroup(uint32_t& token, RsGxsGroupId& group);
|
||||
//virtual bool createMsg(uint32_t& token, RsGxsIdOpinion &opinion);
|
||||
|
||||
/**************** RsIdentity External Interface.
|
||||
@ -263,12 +269,28 @@ public:
|
||||
//virtual bool getNickname(const RsGxsId &id, std::string &nickname);
|
||||
virtual bool getIdDetails(const RsGxsId &id, RsIdentityDetails &details);
|
||||
|
||||
//
|
||||
RS_DEPRECATED_FOR(RsReputations)
|
||||
virtual bool submitOpinion(uint32_t& token, const RsGxsId &id,
|
||||
bool absOpinion, int score);
|
||||
|
||||
/// @see RsIdentity
|
||||
virtual bool createIdentity(
|
||||
RsGxsId& id,
|
||||
const std::string& name, const RsGxsImage& avatar = RsGxsImage(),
|
||||
bool pseudonimous = true, const std::string& pgpPassword = "" ) override;
|
||||
|
||||
virtual bool createIdentity(uint32_t& token, RsIdentityParameters ¶ms);
|
||||
|
||||
/// @see RsIdentity
|
||||
bool updateIdentity(RsGxsIdGroup& identityData) override;
|
||||
|
||||
RS_DEPRECATED
|
||||
virtual bool updateIdentity(uint32_t& token, RsGxsIdGroup &group);
|
||||
|
||||
/// @see RsIdentity
|
||||
bool deleteIdentity(RsGxsId& id) override;
|
||||
|
||||
RS_DEPRECATED
|
||||
virtual bool deleteIdentity(uint32_t& token, RsGxsIdGroup &group);
|
||||
|
||||
virtual void setDeleteBannedNodesThreshold(uint32_t days) ;
|
||||
@ -289,6 +311,12 @@ public:
|
||||
|
||||
/**************** RsGixs Implementation ***************/
|
||||
|
||||
/// @see RsIdentity
|
||||
bool getOwnSignedIds(std::vector<RsGxsId> ids) override;
|
||||
|
||||
/// @see RsIdentity
|
||||
bool getOwnPseudonimousIds(std::vector<RsGxsId> ids) override;
|
||||
|
||||
virtual bool getOwnIds(std::list<RsGxsId> &ownIds, bool signed_only = false);
|
||||
|
||||
//virtual bool getPublicKey(const RsGxsId &id, RsTlvSecurityKey &key) ;
|
||||
@ -350,6 +378,15 @@ public:
|
||||
const RsIdentityUsage &use_info );
|
||||
virtual bool requestPrivateKey(const RsGxsId &id);
|
||||
|
||||
|
||||
/// @see RsIdentity
|
||||
bool identityToBase64( const RsGxsId& id,
|
||||
std::string& base64String ) override;
|
||||
|
||||
/// @see RsIdentity
|
||||
bool identityFromBase64( const std::string& base64String,
|
||||
RsGxsId& id ) override;
|
||||
|
||||
virtual bool serialiseIdentityToMemory(const RsGxsId& id,
|
||||
std::string& radix_string);
|
||||
virtual bool deserialiseIdentityFromMemory(const std::string& radix_string,
|
||||
@ -599,7 +636,9 @@ private:
|
||||
rstime_t mLastKeyCleaningTime ;
|
||||
rstime_t mLastConfigUpdate ;
|
||||
|
||||
bool mOwnIdsLoaded ;
|
||||
bool mOwnIdsLoaded;
|
||||
bool ownIdsAreLoaded() { RS_STACK_MUTEX(mIdMtx); return mOwnIdsLoaded; }
|
||||
|
||||
bool mAutoAddFriendsIdentitiesAsContacts;
|
||||
uint32_t mMaxKeepKeysBanned ;
|
||||
};
|
||||
|
@ -187,8 +187,7 @@ void p3PhotoService::groupsChanged(std::list<RsGxsGroupId>& grpIds)
|
||||
}
|
||||
|
||||
|
||||
void p3PhotoService::msgsChanged(
|
||||
std::map<RsGxsGroupId, std::vector<RsGxsMessageId> >& msgs)
|
||||
void p3PhotoService::msgsChanged(GxsMsgIdResult& msgs)
|
||||
{
|
||||
RsStackMutex stack(mPhotoMutex);
|
||||
|
||||
|
@ -56,8 +56,7 @@ public:
|
||||
void groupsChanged(std::list<RsGxsGroupId>& grpIds);
|
||||
|
||||
|
||||
void msgsChanged(std::map<RsGxsGroupId,
|
||||
std::vector<RsGxsMessageId> >& msgs);
|
||||
void msgsChanged(GxsMsgIdResult& msgs);
|
||||
|
||||
RsTokenService* getTokenService();
|
||||
|
||||
|
@ -123,6 +123,7 @@ bool p3Posted::getPostData(const uint32_t &token, std::vector<RsPostedPost> &msg
|
||||
{
|
||||
RsPostedPost msg = postItem->mPost;
|
||||
msg.mMeta = postItem->meta;
|
||||
postItem->toPostedPost(msg, true);
|
||||
msg.calculateScores(now);
|
||||
|
||||
msgs.push_back(msg);
|
||||
@ -291,8 +292,10 @@ bool p3Posted::createPost(uint32_t &token, RsPostedPost &msg)
|
||||
std::cerr << std::endl;
|
||||
|
||||
RsGxsPostedPostItem* msgItem = new RsGxsPostedPostItem();
|
||||
msgItem->mPost = msg;
|
||||
msgItem->meta = msg.mMeta;
|
||||
//msgItem->mPost = msg;
|
||||
//msgItem->meta = msg.mMeta;
|
||||
msgItem->fromPostedPost(msg, true);
|
||||
|
||||
|
||||
RsGenExchange::publishMsg(token, msgItem);
|
||||
return true;
|
||||
|
@ -89,12 +89,12 @@ virtual void setMessageReadStatus(uint32_t& token, const RsGxsGrpMsgIdPair& msgI
|
||||
std::vector<RsGxsComment> &msgs )
|
||||
{ return mCommentService->getGxsRelatedComments(token, msgs); }
|
||||
|
||||
virtual bool createComment(uint32_t &token, RsGxsComment &msg)
|
||||
virtual bool createNewComment(uint32_t &token, RsGxsComment &msg)
|
||||
{
|
||||
return mCommentService->createGxsComment(token, msg);
|
||||
}
|
||||
|
||||
virtual bool createVote(uint32_t &token, RsGxsVote &msg)
|
||||
virtual bool createNewVote(uint32_t &token, RsGxsVote &msg)
|
||||
{
|
||||
return mCommentService->createGxsVote(token, msg);
|
||||
}
|
||||
|
@ -49,8 +49,8 @@ std::string generateRandomServiceId();
|
||||
//TODO : encryption and upload / download rate implementation
|
||||
|
||||
|
||||
// p3FastService(uint16_t type)
|
||||
// :pqiService((((uint32_t) RS_PKT_VERSION_SERVICE) << 24) + (((uint32_t) type) << 8)),
|
||||
// p3FastService(uint16_t type)
|
||||
// :pqiService((RsServiceInfo::RsServiceInfoUIn16ToFullServiceId(type)),
|
||||
|
||||
|
||||
class p3FastService: public pqiService
|
||||
|
@ -28,6 +28,7 @@
|
||||
#include <cstdint>
|
||||
#endif
|
||||
#include <ctime> // Added for comfort of users of this util header
|
||||
#include "util/rsdeprecate.h"
|
||||
|
||||
/**
|
||||
* Safer alternative to time_t.
|
||||
@ -47,7 +48,7 @@ namespace rstime {
|
||||
/*!
|
||||
* \brief This is a cross-system definition of usleep, which accepts any 32 bits number of micro-seconds.
|
||||
*/
|
||||
|
||||
RS_DEPRECATED_FOR("std::this_thread::sleep_for")
|
||||
int rs_usleep(uint32_t micro_seconds);
|
||||
|
||||
/* Use this class to measure and display time duration of a given environment:
|
||||
|
@ -16,9 +16,6 @@
|
||||
# along with this program. If not, see <https://www.gnu.org/licenses/>. #
|
||||
################################################################################
|
||||
|
||||
TEMPLATE = subdirs
|
||||
|
||||
SUBDIRS += \
|
||||
!include("../../retroshare.pri"): error("Could not include file ../../retroshare.pri")
|
||||
|
||||
TEMPLATE = lib
|
||||
@ -28,9 +25,6 @@ DEPENDPATH += $$PWD/../../libretroshare/src/ $$PWD/../../retroshare-gui/src/
|
||||
INCLUDEPATH += $$PWD/../../libretroshare/src/ $$PWD/../../retroshare-gui/src/
|
||||
|
||||
linux-* {
|
||||
# Cyril: Someone can explain to me why I need to put that again here??? Normally this variable should be set by
|
||||
# the include of retroshare.pri, but for some reason it is not!
|
||||
isEmpty(RS_PLUGIN_DIR): RS_PLUGIN_DIR = "$${PREFIX}/lib/retroshare/extensions6"
|
||||
target.path = "$${RS_PLUGIN_DIR}"
|
||||
INSTALLS += target
|
||||
}
|
||||
|
@ -32,7 +32,7 @@ class RsFeedReaderMsg;
|
||||
class p3FeedReaderThread;
|
||||
|
||||
class RsGxsForums;
|
||||
class RsGxsForumGroup;
|
||||
struct RsGxsForumGroup;
|
||||
|
||||
class p3FeedReader : public RsPQIService, public RsFeedReader
|
||||
{
|
||||
|
@ -6,8 +6,8 @@
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>951</width>
|
||||
<height>578</height>
|
||||
<width>600</width>
|
||||
<height>500</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
|
@ -25,7 +25,7 @@
|
||||
#include "ui_DetailsDialog.h"
|
||||
#include <retroshare/rstypes.h>
|
||||
|
||||
class FileChunksInfo ;
|
||||
struct FileChunksInfo ;
|
||||
|
||||
class DetailsDialog : public QDialog
|
||||
{
|
||||
|
@ -27,8 +27,8 @@
|
||||
#include "RsAutoUpdatePage.h"
|
||||
#include <retroshare/rstypes.h>
|
||||
|
||||
class FileChunksInfo ;
|
||||
class FileInfo ;
|
||||
struct FileChunksInfo ;
|
||||
struct FileInfo ;
|
||||
|
||||
class FileTransferInfoWidget : public RsAutoUpdatePage
|
||||
{
|
||||
|
@ -18,6 +18,33 @@
|
||||
* *
|
||||
*******************************************************************************/
|
||||
|
||||
#include "TransfersDialog.h"
|
||||
|
||||
#include "gui/notifyqt.h"
|
||||
#include "gui/RetroShareLink.h"
|
||||
#include "gui/common/FilesDefs.h"
|
||||
#include "gui/common/RsCollection.h"
|
||||
#include "gui/common/RSTreeView.h"
|
||||
#include "gui/common/RsUrlHandler.h"
|
||||
#include "gui/FileTransfer/DetailsDialog.h"
|
||||
#include "gui/FileTransfer/DLListDelegate.h"
|
||||
#include "gui/FileTransfer/FileTransferInfoWidget.h"
|
||||
#include "gui/FileTransfer/SearchDialog.h"
|
||||
#include "gui/FileTransfer/SharedFilesDialog.h"
|
||||
#include "gui/FileTransfer/TransferUserNotify.h"
|
||||
#include "gui/FileTransfer/ULListDelegate.h"
|
||||
#include "gui/FileTransfer/xprogressbar.h"
|
||||
#include "gui/settings/rsharesettings.h"
|
||||
#include "util/misc.h"
|
||||
#include "util/QtVersion.h"
|
||||
#include "util/RsFile.h"
|
||||
|
||||
#include "retroshare/rsdisc.h"
|
||||
#include "retroshare/rsfiles.h"
|
||||
#include "retroshare/rspeers.h"
|
||||
#include "retroshare/rsplugin.h"
|
||||
#include "retroshare/rsturtle.h"
|
||||
|
||||
#include <QDateTime>
|
||||
#include <QDir>
|
||||
#include <QFileDialog>
|
||||
@ -29,38 +56,10 @@
|
||||
#include <QShortcut>
|
||||
#include <QStandardItemModel>
|
||||
|
||||
#include <gui/common/FilesDefs.h>
|
||||
#include <gui/common/RsCollection.h>
|
||||
#include <gui/common/RsUrlHandler.h>
|
||||
#include <gui/common/RSTreeView.h>
|
||||
|
||||
#include <algorithm>
|
||||
#include <limits>
|
||||
#include <math.h>
|
||||
|
||||
#include "TransfersDialog.h"
|
||||
#include <gui/RetroShareLink.h>
|
||||
#include "DetailsDialog.h"
|
||||
#include "DLListDelegate.h"
|
||||
#include "ULListDelegate.h"
|
||||
#include "FileTransferInfoWidget.h"
|
||||
#include <gui/FileTransfer/SearchDialog.h>
|
||||
#include <gui/FileTransfer/SharedFilesDialog.h>
|
||||
#include "xprogressbar.h"
|
||||
#include <gui/settings/rsharesettings.h>
|
||||
#include "util/misc.h"
|
||||
#include <gui/common/RsCollection.h>
|
||||
#include "TransferUserNotify.h"
|
||||
#include "util/QtVersion.h"
|
||||
#include "util/RsFile.h"
|
||||
|
||||
#include <retroshare/rsfiles.h>
|
||||
#include <retroshare/rspeers.h>
|
||||
#include <retroshare/rsdisc.h>
|
||||
#include <retroshare/rsplugin.h>
|
||||
|
||||
#include <retroshare/rsturtle.h>
|
||||
|
||||
/* Images for context menu icons */
|
||||
#define IMAGE_INFO ":/images/fileinfo.png"
|
||||
#define IMAGE_CANCEL ":/images/delete.png"
|
||||
@ -142,7 +141,7 @@ public:
|
||||
#endif
|
||||
return mDownloads[entry].peers.size();
|
||||
}
|
||||
int columnCount(const QModelIndex &parent = QModelIndex()) const
|
||||
int columnCount(const QModelIndex &/*parent*/ = QModelIndex()) const
|
||||
{
|
||||
return COLUMN_COUNT ;
|
||||
}
|
||||
@ -250,7 +249,7 @@ public:
|
||||
return createIndex(entry,child.column(),parent_ref) ;
|
||||
}
|
||||
|
||||
QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const
|
||||
QVariant headerData(int section, Qt::Orientation /*orientation*/, int role = Qt::DisplayRole) const
|
||||
{
|
||||
if(role != Qt::DisplayRole)
|
||||
return QVariant();
|
||||
@ -279,7 +278,7 @@ public:
|
||||
if(!index.isValid())
|
||||
return QVariant();
|
||||
|
||||
int coln = index.column() ;
|
||||
//int coln = index.column() ;
|
||||
|
||||
switch(role)
|
||||
{
|
||||
@ -1007,6 +1006,7 @@ TransfersDialog::TransfersDialog(QWidget *parent)
|
||||
connect(collViewAct,SIGNAL(triggered()),this,SLOT(collView()));
|
||||
collOpenAct = new QAction(QIcon(IMAGE_COLLOPEN), tr( "Download from collection file..." ), this );
|
||||
connect(collOpenAct, SIGNAL(triggered()), this, SLOT(collOpen()));
|
||||
connect(NotifyQt::getInstance(), SIGNAL(downloadComplete(QString)), this, SLOT(collAutoOpen(QString)));
|
||||
|
||||
/** Setup the actions for the download header context menu */
|
||||
showDLSizeAct= new QAction(tr("Size"),this);
|
||||
@ -2823,6 +2823,35 @@ void TransfersDialog::collOpen()
|
||||
}
|
||||
}
|
||||
|
||||
void TransfersDialog::collAutoOpen(const QString &fileHash)
|
||||
{
|
||||
if (Settings->valueFromGroup("Transfer","AutoDLColl").toBool())
|
||||
{
|
||||
RsFileHash hash = RsFileHash(fileHash.toStdString());
|
||||
FileInfo info;
|
||||
if (rsFiles->FileDetails(hash, RS_FILE_HINTS_DOWNLOAD, info)) {
|
||||
|
||||
/* make path for downloaded files */
|
||||
if (info.downloadStatus == FT_STATE_COMPLETE) {
|
||||
std::string path;
|
||||
path = info.path + "/" + info.fname;
|
||||
|
||||
/* open file with a suitable application */
|
||||
QFileInfo qinfo;
|
||||
qinfo.setFile(QString::fromUtf8(path.c_str()));
|
||||
if (qinfo.exists()) {
|
||||
if (qinfo.absoluteFilePath().endsWith(RsCollection::ExtensionString)) {
|
||||
RsCollection collection;
|
||||
if (collection.load(qinfo.absoluteFilePath(), false)) {
|
||||
collection.autoDownloadFiles();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void TransfersDialog::setShowDLSizeColumn (bool show) { ui.downloadList->setColumnHidden(COLUMN_SIZE, !show); }
|
||||
void TransfersDialog::setShowDLCompleteColumn (bool show) { ui.downloadList->setColumnHidden(COLUMN_COMPLETED, !show); }
|
||||
void TransfersDialog::setShowDLDLSpeedColumn (bool show) { ui.downloadList->setColumnHidden(COLUMN_DLSPEED, !show); }
|
||||
|
@ -144,6 +144,7 @@ private slots:
|
||||
void collModif();
|
||||
void collView();
|
||||
void collOpen();
|
||||
void collAutoOpen(const QString& fileHash);
|
||||
|
||||
void setShowDLSizeColumn(bool show);
|
||||
void setShowDLCompleteColumn(bool show);
|
||||
|
@ -6,8 +6,8 @@
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>978</width>
|
||||
<height>826</height>
|
||||
<width>633</width>
|
||||
<height>506</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
|
@ -69,19 +69,19 @@ HelpDialog::HelpDialog(QWidget *parent) :
|
||||
QFile licenseFile(QLatin1String(":/help/licence.html"));
|
||||
if (licenseFile.open(QIODevice::ReadOnly | QIODevice::Text)) {
|
||||
QTextStream in(&licenseFile);
|
||||
ui->license->setText(in.readAll());
|
||||
ui->license->setHtml(in.readAll());
|
||||
}
|
||||
|
||||
QFile authorsFile(QLatin1String(":/help/authors.html"));
|
||||
if (authorsFile.open(QIODevice::ReadOnly | QIODevice::Text)) {
|
||||
QTextStream in(&authorsFile);
|
||||
ui->authors->setText(in.readAll());
|
||||
ui->authors->setHtml(in.readAll());
|
||||
}
|
||||
|
||||
QFile thanksFile(QLatin1String(":/help/thanks.html"));
|
||||
if (thanksFile.open(QIODevice::ReadOnly | QIODevice::Text)) {
|
||||
QTextStream in(&thanksFile);
|
||||
ui->thanks->setText(in.readAll());
|
||||
ui->thanks->setHtml(in.readAll());
|
||||
}
|
||||
|
||||
ui->version->setText(Rshare::retroshareVersion(true));
|
||||
|
@ -142,7 +142,7 @@ p, li { white-space: pre-wrap; }
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="acceptRichText">
|
||||
<bool>false</bool>
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="textInteractionFlags">
|
||||
<set>Qt::TextBrowserInteraction</set>
|
||||
@ -183,7 +183,7 @@ p, li { white-space: pre-wrap; }
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="acceptRichText">
|
||||
<bool>false</bool>
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="textInteractionFlags">
|
||||
<set>Qt::TextBrowserInteraction</set>
|
||||
@ -236,6 +236,9 @@ p, li { white-space: pre-wrap; }
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'MS Shell Dlg 2'; font-size:8pt; font-weight:600;">German: </span><span style=" font-family:'MS Shell Dlg 2'; font-size:8pt;">Jan</span><span style=" font-family:'MS Shell Dlg 2'; font-size:8pt; font-weight:600;"> </span><span style=" font-family:'MS Shell Dlg 2'; font-size:8pt;">Keller</span><span style=" font-family:'MS Shell Dlg 2';"> &lt;</span><span style=" font-family:'MS Shell Dlg 2'; font-size:8pt;">trilarion@users.sourceforge.net</span><span style=" font-family:'MS Shell Dlg 2';">&gt;</span></p>
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'MS Shell Dlg 2'; font-weight:600;">Polish: </span><span style=" font-family:'MS Shell Dlg 2';">Maciej Mrug</span></p></body></html></string>
|
||||
</property>
|
||||
<property name="overwriteMode">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="acceptRichText">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
@ -275,7 +278,7 @@ p, li { white-space: pre-wrap; }
|
||||
<enum>QTextEdit::WidgetWidth</enum>
|
||||
</property>
|
||||
<property name="acceptRichText">
|
||||
<bool>false</bool>
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="textInteractionFlags">
|
||||
<set>Qt::TextBrowserInteraction</set>
|
||||
|
@ -285,7 +285,7 @@ void IdDetailsDialog::insertIdDetails(uint32_t token)
|
||||
|
||||
#endif
|
||||
|
||||
RsReputations::ReputationInfo info ;
|
||||
RsReputationInfo info;
|
||||
rsReputations->getReputationInfo(RsGxsId(data.mMeta.mGroupId),data.mPgpId,info) ;
|
||||
|
||||
#warning (csoler) Do we need to do this? This code is apparently not used.
|
||||
@ -302,23 +302,34 @@ void IdDetailsDialog::insertIdDetails(uint32_t token)
|
||||
ui->label_positive->setText(QString::number(info.mFriendsPositiveVotes));
|
||||
ui->label_negative->setText(QString::number(info.mFriendsNegativeVotes));
|
||||
|
||||
switch(info.mOverallReputationLevel)
|
||||
{
|
||||
case RsReputations::REPUTATION_LOCALLY_POSITIVE: ui->overallOpinion_TF->setText(tr("Positive")) ; break ;
|
||||
case RsReputations::REPUTATION_LOCALLY_NEGATIVE: ui->overallOpinion_TF->setText(tr("Negative (Banned by you)")) ; break ;
|
||||
case RsReputations::REPUTATION_REMOTELY_POSITIVE: ui->overallOpinion_TF->setText(tr("Positive (according to your friends)")) ; break ;
|
||||
case RsReputations::REPUTATION_REMOTELY_NEGATIVE: ui->overallOpinion_TF->setText(tr("Negative (according to your friends)")) ; break ;
|
||||
default:
|
||||
case RsReputations::REPUTATION_NEUTRAL: ui->overallOpinion_TF->setText(tr("Neutral")) ; break ;
|
||||
}
|
||||
|
||||
switch(info.mOwnOpinion)
|
||||
switch(info.mOverallReputationLevel)
|
||||
{
|
||||
case RsReputations::OPINION_NEGATIVE: ui->ownOpinion_CB->setCurrentIndex(0); break ;
|
||||
case RsReputations::OPINION_NEUTRAL : ui->ownOpinion_CB->setCurrentIndex(1); break ;
|
||||
case RsReputations::OPINION_POSITIVE: ui->ownOpinion_CB->setCurrentIndex(2); break ;
|
||||
default:
|
||||
std::cerr << "Unexpected value in own opinion: " << info.mOwnOpinion << std::endl;
|
||||
case RsReputationLevel::LOCALLY_POSITIVE:
|
||||
ui->overallOpinion_TF->setText(tr("Positive")); break;
|
||||
case RsReputationLevel::LOCALLY_NEGATIVE:
|
||||
ui->overallOpinion_TF->setText(tr("Negative (Banned by you)")); break;
|
||||
case RsReputationLevel::REMOTELY_POSITIVE:
|
||||
ui->overallOpinion_TF->setText(
|
||||
tr("Positive (according to your friends)"));
|
||||
break;
|
||||
case RsReputationLevel::REMOTELY_NEGATIVE:
|
||||
ui->overallOpinion_TF->setText(
|
||||
tr("Negative (according to your friends)"));
|
||||
break;
|
||||
case RsReputationLevel::NEUTRAL: // fallthrough
|
||||
default:
|
||||
ui->overallOpinion_TF->setText(tr("Neutral")); break;
|
||||
}
|
||||
|
||||
switch(info.mOwnOpinion)
|
||||
{
|
||||
case RsOpinion::NEGATIVE: ui->ownOpinion_CB->setCurrentIndex(0); break;
|
||||
case RsOpinion::NEUTRAL : ui->ownOpinion_CB->setCurrentIndex(1); break;
|
||||
case RsOpinion::POSITIVE: ui->ownOpinion_CB->setCurrentIndex(2); break;
|
||||
default:
|
||||
std::cerr << "Unexpected value in own opinion: "
|
||||
<< static_cast<uint32_t>(info.mOwnOpinion) << std::endl;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@ -330,19 +341,19 @@ void IdDetailsDialog::modifyReputation()
|
||||
#endif
|
||||
|
||||
RsGxsId id(ui->lineEdit_KeyId->text().toStdString());
|
||||
|
||||
RsReputations::Opinion op ;
|
||||
|
||||
switch(ui->ownOpinion_CB->currentIndex())
|
||||
{
|
||||
case 0: op = RsReputations::OPINION_NEGATIVE ; break ;
|
||||
case 1: op = RsReputations::OPINION_NEUTRAL ; break ;
|
||||
case 2: op = RsReputations::OPINION_POSITIVE ; break ;
|
||||
default:
|
||||
std::cerr << "Wrong value from opinion combobox. Bug??" << std::endl;
|
||||
|
||||
}
|
||||
rsReputations->setOwnOpinion(id,op) ;
|
||||
RsOpinion op;
|
||||
|
||||
switch(ui->ownOpinion_CB->currentIndex())
|
||||
{
|
||||
case 0: op = RsOpinion::NEGATIVE; break;
|
||||
case 1: op = RsOpinion::NEUTRAL ; break;
|
||||
case 2: op = RsOpinion::POSITIVE; break;
|
||||
default:
|
||||
std::cerr << "Wrong value from opinion combobox. Bug??" << std::endl;
|
||||
break;
|
||||
}
|
||||
rsReputations->setOwnOpinion(id,op);
|
||||
|
||||
#ifdef ID_DEBUG
|
||||
std::cerr << "IdDialog::modifyReputation() ID: " << id << " Mod: " << mod;
|
||||
|
@ -344,7 +344,9 @@ IdDialog::IdDialog(QWidget *parent) :
|
||||
ui->idTreeWidget->setColumnWidth(RSID_COL_IDTYPE, 18 * fontWidth);
|
||||
ui->idTreeWidget->setColumnWidth(RSID_COL_VOTES, 2 * fontWidth);
|
||||
|
||||
ui->idTreeWidget->setItemDelegateForColumn(RSID_COL_VOTES,new ReputationItemDelegate(RsReputations::ReputationLevel(0xff))) ;
|
||||
ui->idTreeWidget->setItemDelegateForColumn(
|
||||
RSID_COL_VOTES,
|
||||
new ReputationItemDelegate(RsReputationLevel(0xff)));
|
||||
|
||||
/* Set header resize modes and initial section sizes */
|
||||
QHeaderView * idheader = ui->idTreeWidget->header();
|
||||
@ -1444,8 +1446,9 @@ bool IdDialog::fillIdListItem(const RsGxsIdGroup& data, QTreeWidgetItem *&item,
|
||||
RsIdentityDetails idd ;
|
||||
rsIdentity->getIdDetails(RsGxsId(data.mMeta.mGroupId),idd) ;
|
||||
|
||||
bool isBanned = idd.mReputation.mOverallReputationLevel == RsReputations::REPUTATION_LOCALLY_NEGATIVE;
|
||||
uint32_t item_flags = 0 ;
|
||||
bool isBanned = idd.mReputation.mOverallReputationLevel ==
|
||||
RsReputationLevel::LOCALLY_NEGATIVE;
|
||||
uint32_t item_flags = 0;
|
||||
|
||||
/* do filtering */
|
||||
bool ok = false;
|
||||
@ -1514,8 +1517,12 @@ bool IdDialog::fillIdListItem(const RsGxsIdGroup& data, QTreeWidgetItem *&item,
|
||||
|
||||
item->setData(RSID_COL_KEYID, Qt::UserRole,QVariant(item_flags)) ;
|
||||
item->setTextAlignment(RSID_COL_VOTES, Qt::AlignRight | Qt::AlignVCenter);
|
||||
item->setData(RSID_COL_VOTES,Qt::DecorationRole, idd.mReputation.mOverallReputationLevel);
|
||||
item->setData(RSID_COL_VOTES,SortRole, idd.mReputation.mOverallReputationLevel);
|
||||
item->setData(
|
||||
RSID_COL_VOTES,Qt::DecorationRole,
|
||||
static_cast<uint32_t>(idd.mReputation.mOverallReputationLevel));
|
||||
item->setData(
|
||||
RSID_COL_VOTES,SortRole,
|
||||
static_cast<uint32_t>(idd.mReputation.mOverallReputationLevel));
|
||||
|
||||
if(isOwnId)
|
||||
{
|
||||
@ -1910,7 +1917,7 @@ void IdDialog::insertIdDetails(uint32_t token)
|
||||
|
||||
#endif
|
||||
|
||||
RsReputations::ReputationInfo info ;
|
||||
RsReputationInfo info;
|
||||
rsReputations->getReputationInfo(RsGxsId(data.mMeta.mGroupId),data.mPgpId,info) ;
|
||||
|
||||
QString frep_string ;
|
||||
@ -1925,23 +1932,32 @@ void IdDialog::insertIdDetails(uint32_t token)
|
||||
ui->label_positive->setText(QString::number(info.mFriendsPositiveVotes));
|
||||
ui->label_negative->setText(QString::number(info.mFriendsNegativeVotes));
|
||||
|
||||
switch(info.mOverallReputationLevel)
|
||||
{
|
||||
case RsReputations::REPUTATION_LOCALLY_POSITIVE: ui->overallOpinion_TF->setText(tr("Positive")) ; break ;
|
||||
case RsReputations::REPUTATION_LOCALLY_NEGATIVE: ui->overallOpinion_TF->setText(tr("Negative (Banned by you)")) ; break ;
|
||||
case RsReputations::REPUTATION_REMOTELY_POSITIVE: ui->overallOpinion_TF->setText(tr("Positive (according to your friends)")) ; break ;
|
||||
case RsReputations::REPUTATION_REMOTELY_NEGATIVE: ui->overallOpinion_TF->setText(tr("Negative (according to your friends)")) ; break ;
|
||||
default:
|
||||
case RsReputations::REPUTATION_NEUTRAL: ui->overallOpinion_TF->setText(tr("Neutral")) ; break ;
|
||||
}
|
||||
|
||||
switch(info.mOwnOpinion)
|
||||
switch(info.mOverallReputationLevel)
|
||||
{
|
||||
case RsReputations::OPINION_NEGATIVE: ui->ownOpinion_CB->setCurrentIndex(0); break ;
|
||||
case RsReputations::OPINION_NEUTRAL : ui->ownOpinion_CB->setCurrentIndex(1); break ;
|
||||
case RsReputations::OPINION_POSITIVE: ui->ownOpinion_CB->setCurrentIndex(2); break ;
|
||||
default:
|
||||
std::cerr << "Unexpected value in own opinion: " << info.mOwnOpinion << std::endl;
|
||||
case RsReputationLevel::LOCALLY_POSITIVE:
|
||||
ui->overallOpinion_TF->setText(tr("Positive")); break;
|
||||
case RsReputationLevel::LOCALLY_NEGATIVE:
|
||||
ui->overallOpinion_TF->setText(tr("Negative (Banned by you)")); break;
|
||||
case RsReputationLevel::REMOTELY_POSITIVE:
|
||||
ui->overallOpinion_TF->setText(tr("Positive (according to your friends)"));
|
||||
break;
|
||||
case RsReputationLevel::REMOTELY_NEGATIVE:
|
||||
ui->overallOpinion_TF->setText(tr("Negative (according to your friends)"));
|
||||
break;
|
||||
case RsReputationLevel::NEUTRAL: // fallthrough
|
||||
default:
|
||||
ui->overallOpinion_TF->setText(tr("Neutral")) ; break ;
|
||||
}
|
||||
|
||||
switch(info.mOwnOpinion)
|
||||
{
|
||||
case RsOpinion::NEGATIVE: ui->ownOpinion_CB->setCurrentIndex(0); break;
|
||||
case RsOpinion::NEUTRAL : ui->ownOpinion_CB->setCurrentIndex(1); break;
|
||||
case RsOpinion::POSITIVE: ui->ownOpinion_CB->setCurrentIndex(2); break;
|
||||
default:
|
||||
std::cerr << "Unexpected value in own opinion: "
|
||||
<< static_cast<uint32_t>(info.mOwnOpinion) << std::endl;
|
||||
break;
|
||||
}
|
||||
|
||||
// now fill in usage cases
|
||||
@ -2060,19 +2076,19 @@ void IdDialog::modifyReputation()
|
||||
#endif
|
||||
|
||||
RsGxsId id(ui->lineEdit_KeyId->text().toStdString());
|
||||
|
||||
RsReputations::Opinion op ;
|
||||
|
||||
switch(ui->ownOpinion_CB->currentIndex())
|
||||
{
|
||||
case 0: op = RsReputations::OPINION_NEGATIVE ; break ;
|
||||
case 1: op = RsReputations::OPINION_NEUTRAL ; break ;
|
||||
case 2: op = RsReputations::OPINION_POSITIVE ; break ;
|
||||
default:
|
||||
std::cerr << "Wrong value from opinion combobox. Bug??" << std::endl;
|
||||
|
||||
}
|
||||
rsReputations->setOwnOpinion(id,op) ;
|
||||
RsOpinion op;
|
||||
|
||||
switch(ui->ownOpinion_CB->currentIndex())
|
||||
{
|
||||
case 0: op = RsOpinion::NEGATIVE; break;
|
||||
case 1: op = RsOpinion::NEUTRAL ; break;
|
||||
case 2: op = RsOpinion::POSITIVE; break;
|
||||
default:
|
||||
std::cerr << "Wrong value from opinion combobox. Bug??" << std::endl;
|
||||
break;
|
||||
}
|
||||
rsReputations->setOwnOpinion(id,op);
|
||||
|
||||
#ifdef ID_DEBUG
|
||||
std::cerr << "IdDialog::modifyReputation() ID: " << id << " Mod: " << op;
|
||||
@ -2386,17 +2402,12 @@ void IdDialog::IdListCustomPopupMenu( QPoint )
|
||||
|
||||
switch(det.mReputation.mOwnOpinion)
|
||||
{
|
||||
case RsReputations::OPINION_NEGATIVE: ++n_negative_reputations ;
|
||||
break ;
|
||||
|
||||
case RsReputations::OPINION_POSITIVE: ++n_positive_reputations ;
|
||||
break ;
|
||||
|
||||
case RsReputations::OPINION_NEUTRAL: ++n_neutral_reputations ;
|
||||
break ;
|
||||
case RsOpinion::NEGATIVE: ++n_negative_reputations; break;
|
||||
case RsOpinion::POSITIVE: ++n_positive_reputations; break;
|
||||
case RsOpinion::NEUTRAL: ++n_neutral_reputations; break;
|
||||
}
|
||||
|
||||
++n_selected_items ;
|
||||
++n_selected_items;
|
||||
|
||||
if(rsIdentity->isARegularContact(keyId))
|
||||
++n_is_a_contact ;
|
||||
@ -2674,7 +2685,7 @@ void IdDialog::negativePerson()
|
||||
|
||||
std::string Id = item->text(RSID_COL_KEYID).toStdString();
|
||||
|
||||
rsReputations->setOwnOpinion(RsGxsId(Id),RsReputations::OPINION_NEGATIVE) ;
|
||||
rsReputations->setOwnOpinion(RsGxsId(Id), RsOpinion::NEGATIVE);
|
||||
}
|
||||
|
||||
requestIdDetails();
|
||||
@ -2690,7 +2701,7 @@ void IdDialog::neutralPerson()
|
||||
|
||||
std::string Id = item->text(RSID_COL_KEYID).toStdString();
|
||||
|
||||
rsReputations->setOwnOpinion(RsGxsId(Id),RsReputations::OPINION_NEUTRAL) ;
|
||||
rsReputations->setOwnOpinion(RsGxsId(Id), RsOpinion::NEUTRAL);
|
||||
}
|
||||
|
||||
requestIdDetails();
|
||||
@ -2703,9 +2714,9 @@ void IdDialog::positivePerson()
|
||||
{
|
||||
QTreeWidgetItem *item = *it ;
|
||||
|
||||
std::string Id = item->text(RSID_COL_KEYID).toStdString();
|
||||
std::string Id = item->text(RSID_COL_KEYID).toStdString();
|
||||
|
||||
rsReputations->setOwnOpinion(RsGxsId(Id),RsReputations::OPINION_POSITIVE) ;
|
||||
rsReputations->setOwnOpinion(RsGxsId(Id), RsOpinion::POSITIVE);
|
||||
}
|
||||
|
||||
requestIdDetails();
|
||||
|
@ -108,20 +108,21 @@ MessengerWindow::MessengerWindow(QWidget* parent, Qt::WindowFlags flags)
|
||||
}
|
||||
expandedGroups.clear();
|
||||
|
||||
ui.messagelineEdit->setMinimumWidth(20);
|
||||
|
||||
/* Initialize friend list */
|
||||
QToolButton *button = new QToolButton(this);
|
||||
button->setIcon(QIcon(":/images/user/add_user24.png"));
|
||||
button->setIcon(QIcon(":/icons/png/invite.png"));
|
||||
button->setToolTip(tr("Add a Friend"));
|
||||
connect(button, SIGNAL(clicked()), this, SLOT(addFriend()));
|
||||
ui.friendList->addToolButton(button);
|
||||
button->setIconSize(QSize(27, 27));
|
||||
|
||||
button = new QToolButton(this);
|
||||
button->setIcon(QIcon(":/images/friendsfolder24.png"));
|
||||
button->setIcon(QIcon(":/icons/png/filesharing.png"));
|
||||
button->setToolTip(tr("Share files for your friends"));
|
||||
connect(button, SIGNAL(clicked()), this, SLOT(openShareManager()));
|
||||
ui.friendList->addToolButton(button);
|
||||
ui.friendList->addToolButton(button);
|
||||
button->setIconSize(QSize(27, 27));
|
||||
|
||||
// load settings
|
||||
RsAutoUpdatePage::lockAllEvents();
|
||||
@ -221,6 +222,7 @@ void MessengerWindow::updateOwnStatus(const QString &peer_id, int status)
|
||||
// my status has changed
|
||||
|
||||
ui.statusButton->setText(m_nickName + " (" + StatusDefs::name(status) + ")");
|
||||
ui.statusButton->setIcon(QIcon(StatusDefs::imageIM(status)));
|
||||
|
||||
return;
|
||||
}
|
||||
|
@ -19,7 +19,16 @@
|
||||
</property>
|
||||
<widget class="QWidget" name="centralwidget">
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<property name="margin">
|
||||
<property name="leftMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="spacing">
|
||||
@ -34,7 +43,16 @@
|
||||
</size>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout_5">
|
||||
<property name="margin">
|
||||
<property name="leftMargin">
|
||||
<number>6</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>6</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>6</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>6</number>
|
||||
</property>
|
||||
<item row="0" column="0">
|
||||
@ -70,11 +88,17 @@
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="iconSize">
|
||||
<size>
|
||||
<width>27</width>
|
||||
<height>27</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="popupMode">
|
||||
<enum>QToolButton::InstantPopup</enum>
|
||||
</property>
|
||||
<property name="toolButtonStyle">
|
||||
<enum>Qt::ToolButtonTextOnly</enum>
|
||||
<enum>Qt::ToolButtonTextBesideIcon</enum>
|
||||
</property>
|
||||
<property name="autoRaise">
|
||||
<bool>true</bool>
|
||||
@ -118,7 +142,16 @@
|
||||
<item row="1" column="0">
|
||||
<widget class="QFrame" name="friendListFrame">
|
||||
<layout class="QGridLayout" name="gridLayout_3">
|
||||
<property name="margin">
|
||||
<property name="leftMargin">
|
||||
<number>3</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>3</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>3</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>3</number>
|
||||
</property>
|
||||
<item row="1" column="0">
|
||||
@ -142,7 +175,7 @@
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>258</width>
|
||||
<height>20</height>
|
||||
<height>21</height>
|
||||
</rect>
|
||||
</property>
|
||||
</widget>
|
||||
|
@ -18,13 +18,16 @@
|
||||
* *
|
||||
*******************************************************************************/
|
||||
|
||||
#include <QBuffer>
|
||||
#include <QMessageBox>
|
||||
#include "PostedCreatePostDialog.h"
|
||||
#include "ui_PostedCreatePostDialog.h"
|
||||
|
||||
#include "util/misc.h"
|
||||
#include "util/TokenQueue.h"
|
||||
|
||||
#include "gui/settings/rsharesettings.h"
|
||||
#include <QBuffer>
|
||||
|
||||
#include <iostream>
|
||||
|
||||
@ -37,6 +40,7 @@ PostedCreatePostDialog::PostedCreatePostDialog(TokenQueue* tokenQ, RsPosted *pos
|
||||
Settings->loadWidgetInformation(this);
|
||||
connect(ui->submitButton, SIGNAL(clicked()), this, SLOT(createPost()));
|
||||
connect(ui->buttonBox, SIGNAL(rejected()), this, SLOT(close()));
|
||||
connect(ui->pushButton, SIGNAL(clicked() ), this , SLOT(addPicture()));
|
||||
|
||||
ui->headerFrame->setHeaderImage(QPixmap(":/images/posted_64.png"));
|
||||
ui->headerFrame->setHeaderText(tr("Submit a new Post"));
|
||||
@ -78,6 +82,18 @@ void PostedCreatePostDialog::createPost()
|
||||
post.mMeta.mMsgName = std::string(ui->titleEdit->text().toUtf8());
|
||||
post.mMeta.mAuthorId = authorId;
|
||||
|
||||
QByteArray ba;
|
||||
QBuffer buffer(&ba);
|
||||
|
||||
if(!picture.isNull())
|
||||
{
|
||||
// send posted image
|
||||
|
||||
buffer.open(QIODevice::WriteOnly);
|
||||
picture.save(&buffer, "PNG"); // writes image into ba in PNG format
|
||||
post.mImage.copy((uint8_t *) ba.data(), ba.size());
|
||||
}
|
||||
|
||||
if(ui->titleEdit->text().isEmpty()) {
|
||||
/* error message */
|
||||
QMessageBox::warning(this, "RetroShare", tr("Please add a Title"), QMessageBox::Ok, QMessageBox::Ok);
|
||||
@ -90,3 +106,16 @@ void PostedCreatePostDialog::createPost()
|
||||
|
||||
accept();
|
||||
}
|
||||
|
||||
void PostedCreatePostDialog::addPicture()
|
||||
{
|
||||
QPixmap img = misc::getOpenThumbnailedPicture(this, tr("Load thumbnail picture"), 800, 600);
|
||||
|
||||
if (img.isNull())
|
||||
return;
|
||||
|
||||
picture = img;
|
||||
|
||||
// to show the selected
|
||||
ui->imageLabel->setPixmap(picture);
|
||||
}
|
@ -41,9 +41,13 @@ public:
|
||||
*/
|
||||
explicit PostedCreatePostDialog(TokenQueue* tokenQ, RsPosted* posted, const RsGxsGroupId& grpId, QWidget *parent = 0);
|
||||
~PostedCreatePostDialog();
|
||||
|
||||
QPixmap picture;
|
||||
|
||||
private slots:
|
||||
void createPost();
|
||||
void addPicture();
|
||||
|
||||
|
||||
private:
|
||||
QString mLink;
|
||||
|
@ -7,7 +7,7 @@
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>575</width>
|
||||
<height>371</height>
|
||||
<height>467</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
@ -47,7 +47,7 @@
|
||||
<property name="frameShadow">
|
||||
<enum>QFrame::Raised</enum>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="mainFrameGLayout">
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<item row="0" column="0" colspan="3">
|
||||
<widget class="StyledLabel" name="info_label">
|
||||
<property name="palette">
|
||||
@ -128,75 +128,108 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0" colspan="3">
|
||||
<layout class="QGridLayout" name="titleGLayout">
|
||||
<item row="0" column="1">
|
||||
<widget class="QLineEdit" name="titleEdit"/>
|
||||
</item>
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="titleLabel">
|
||||
<property name="text">
|
||||
<string>Title</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="linkLabel">
|
||||
<property name="text">
|
||||
<string>Link</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QLineEdit" name="linkEdit"/>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="2" column="0" colspan="3">
|
||||
<layout class="QHBoxLayout" name="signedHLayout">
|
||||
<item>
|
||||
<spacer name="signedHSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeType">
|
||||
<enum>QSizePolicy::MinimumExpanding</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>78</width>
|
||||
<height>17</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="signedLabel">
|
||||
<property name="text">
|
||||
<string>Signed by: </string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="GxsIdChooser" name="idChooser"/>
|
||||
</item>
|
||||
</layout>
|
||||
<widget class="QTabWidget" name="tabWidget">
|
||||
<property name="currentIndex">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<widget class="QWidget" name="tab">
|
||||
<attribute name="title">
|
||||
<string>Picture</string>
|
||||
</attribute>
|
||||
<layout class="QGridLayout" name="gridLayout_2">
|
||||
<item row="0" column="1">
|
||||
<spacer name="horizontalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>447</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="0" column="0">
|
||||
<widget class="QPushButton" name="pushButton">
|
||||
<property name="text">
|
||||
<string>Add Picture</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0" colspan="2">
|
||||
<widget class="QGroupBox" name="groupBox">
|
||||
<property name="title">
|
||||
<string>Preview</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout_4">
|
||||
<item row="0" column="1">
|
||||
<widget class="QLabel" name="imageLabel">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>250</width>
|
||||
<height>200</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>800</width>
|
||||
<height>200</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="scaledContents">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="0">
|
||||
<spacer name="horizontalSpacer_2">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="0" column="2">
|
||||
<spacer name="horizontalSpacer_3">
|
||||
<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>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="QWidget" name="tab_2">
|
||||
<attribute name="title">
|
||||
<string>Notes</string>
|
||||
</attribute>
|
||||
<layout class="QGridLayout" name="gridLayout_3">
|
||||
<item row="0" column="0">
|
||||
<widget class="MimeTextEdit" name="notesTextEdit"/>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="0" colspan="3">
|
||||
<layout class="QVBoxLayout" name="notesLayout">
|
||||
<item>
|
||||
<widget class="QLabel" name="notesLabel">
|
||||
<property name="text">
|
||||
<string>Notes</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="MimeTextEdit" name="notesTextEdit"/>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="4" column="0">
|
||||
<item row="3" column="0">
|
||||
<spacer name="buttonHSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
@ -209,14 +242,20 @@
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="4" column="1">
|
||||
<item row="3" column="1">
|
||||
<widget class="QPushButton" name="submitButton">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Submit</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="2">
|
||||
<item row="3" column="2">
|
||||
<widget class="QDialogButtonBox" name="buttonBox">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
|
||||
@ -232,12 +271,51 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0" colspan="3">
|
||||
<layout class="QGridLayout" name="titleGLayout">
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="titleLabel">
|
||||
<property name="text">
|
||||
<string>Title</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QLineEdit" name="titleEdit"/>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="linkLabel">
|
||||
<property name="text">
|
||||
<string>Link</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QLineEdit" name="linkEdit"/>
|
||||
</item>
|
||||
<item row="2" column="1">
|
||||
<widget class="GxsIdChooser" name="idChooser"/>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<widget class="QLabel" name="signedLabel">
|
||||
<property name="text">
|
||||
<string>Post as</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<customwidgets>
|
||||
<customwidget>
|
||||
<class>StyledLabel</class>
|
||||
<extends>QLabel</extends>
|
||||
<header>gui/common/StyledLabel.h</header>
|
||||
</customwidget>
|
||||
<customwidget>
|
||||
<class>HeaderFrame</class>
|
||||
<extends>QFrame</extends>
|
||||
@ -254,11 +332,6 @@
|
||||
<extends>QComboBox</extends>
|
||||
<header>gui/gxs/GxsIdChooser.h</header>
|
||||
</customwidget>
|
||||
<customwidget>
|
||||
<class>StyledLabel</class>
|
||||
<extends>QLabel</extends>
|
||||
<header>gui/common/StyledLabel.h</header>
|
||||
</customwidget>
|
||||
</customwidgets>
|
||||
<resources/>
|
||||
<connections>
|
||||
|
@ -19,11 +19,14 @@
|
||||
*******************************************************************************/
|
||||
|
||||
#include <QDateTime>
|
||||
#include <QMenu>
|
||||
#include <QStyle>
|
||||
|
||||
#include "rshare.h"
|
||||
#include "PostedItem.h"
|
||||
#include "gui/feeds/FeedHolder.h"
|
||||
#include "util/misc.h"
|
||||
|
||||
#include "ui_PostedItem.h"
|
||||
|
||||
#include <retroshare/rsposted.h>
|
||||
@ -46,6 +49,9 @@ PostedItem::PostedItem(FeedHolder *feedHolder, uint32_t feedId, const RsPostedGr
|
||||
GxsFeedItem(feedHolder, feedId, post.mMeta.mGroupId, post.mMeta.mMsgId, isHome, rsPosted, autoUpdate)
|
||||
{
|
||||
setup();
|
||||
|
||||
mMessageId = post.mMeta.mMsgId;
|
||||
|
||||
|
||||
setGroup(group, false);
|
||||
setPost(post);
|
||||
@ -83,7 +89,9 @@ void PostedItem::setup()
|
||||
ui->fromLabel->clear();
|
||||
ui->siteLabel->clear();
|
||||
ui->newCommentLabel->hide();
|
||||
ui->frame_picture->hide();
|
||||
ui->commLabel->hide();
|
||||
ui->frame_notes->hide();
|
||||
|
||||
/* general ones */
|
||||
connect(ui->clearButton, SIGNAL(clicked()), this, SLOT(removeItem()));
|
||||
@ -94,8 +102,17 @@ void PostedItem::setup()
|
||||
connect(ui->commentButton, SIGNAL( clicked()), this, SLOT(loadComments()));
|
||||
connect(ui->voteUpButton, SIGNAL(clicked()), this, SLOT(makeUpVote()));
|
||||
connect(ui->voteDownButton, SIGNAL(clicked()), this, SLOT( makeDownVote()));
|
||||
connect(ui->expandButton, SIGNAL(clicked()), this, SLOT( toggle()));
|
||||
connect(ui->notesButton, SIGNAL(clicked()), this, SLOT( toggleNotes()));
|
||||
|
||||
connect(ui->readButton, SIGNAL(toggled(bool)), this, SLOT(readToggled(bool)));
|
||||
|
||||
QAction *CopyLinkAction = new QAction(QIcon(""),tr("Copy RetroShare Link"), this);
|
||||
connect(CopyLinkAction, SIGNAL(triggered()), this, SLOT(copyMessageLink()));
|
||||
|
||||
QMenu *menu = new QMenu();
|
||||
menu->addAction(CopyLinkAction);
|
||||
ui->shareButton->setMenu(menu);
|
||||
|
||||
ui->clearButton->hide();
|
||||
ui->readAndClearButton->hide();
|
||||
@ -206,7 +223,7 @@ void PostedItem::loadComment(const uint32_t &token)
|
||||
if (comNb == 1) {
|
||||
sComButText = sComButText.append("(1)");
|
||||
} else if (comNb > 1) {
|
||||
sComButText = tr("Comments").append("(%1)").arg(comNb);
|
||||
sComButText = tr("Comments").append(" (%1)").arg(comNb);
|
||||
}
|
||||
ui->commentButton->setText(sComButText);
|
||||
}
|
||||
@ -219,11 +236,29 @@ void PostedItem::fill()
|
||||
}
|
||||
|
||||
mInFill = true;
|
||||
|
||||
if(mPost.mImage.mData != NULL)
|
||||
{
|
||||
QPixmap pixmap;
|
||||
pixmap.loadFromData(mPost.mImage.mData, mPost.mImage.mSize, "PNG");
|
||||
// Wiping data - as its been passed to thumbnail.
|
||||
|
||||
QPixmap sqpixmap = pixmap.scaled(800, 600, Qt::KeepAspectRatio, Qt::SmoothTransformation);
|
||||
ui->pictureLabel->setPixmap(sqpixmap);
|
||||
|
||||
ui->thumbnailLabel->setPixmap(pixmap);
|
||||
}else
|
||||
{
|
||||
ui->expandButton->setDisabled(true);
|
||||
}
|
||||
|
||||
QDateTime qtime;
|
||||
qtime.setTime_t(mPost.mMeta.mPublishTs);
|
||||
QString timestamp = qtime.toString("hh:mm dd-MMM-yyyy");
|
||||
ui->dateLabel->setText(timestamp);
|
||||
QString timestamp2 = misc::timeRelativeToNow(mPost.mMeta.mPublishTs);
|
||||
ui->dateLabel->setText(timestamp2);
|
||||
ui->dateLabel->setToolTip(timestamp);
|
||||
|
||||
ui->fromLabel->setId(mPost.mMeta.mAuthorId);
|
||||
|
||||
// Use QUrl to check/parse our URL
|
||||
@ -256,9 +291,14 @@ void PostedItem::fill()
|
||||
|
||||
QString siteurl = url.scheme() + "://" + url.host();
|
||||
sitestr = QString("<a href=\"%1\" ><span style=\" text-decoration: underline; color:#2255AA;\"> %2 </span></a>").arg(siteurl).arg(siteurl);
|
||||
|
||||
ui->titleLabel->setText(urlstr);
|
||||
}else
|
||||
{
|
||||
ui->titleLabel->setText(messageName());
|
||||
|
||||
}
|
||||
|
||||
ui->titleLabel->setText(urlstr);
|
||||
ui->siteLabel->setText(sitestr);
|
||||
|
||||
//QString score = "Hot" + QString::number(post.mHotScore);
|
||||
@ -272,7 +312,7 @@ void PostedItem::fill()
|
||||
// FIX THIS UP LATER.
|
||||
ui->notes->setText(QString::fromUtf8(mPost.mNotes.c_str()));
|
||||
if(ui->notes->text().isEmpty())
|
||||
ui->frame_notes->hide();
|
||||
ui->notesButton->hide();
|
||||
// differences between Feed or Top of Comment.
|
||||
if (mFeedHolder)
|
||||
{
|
||||
@ -451,3 +491,55 @@ void PostedItem::readAndClearItem()
|
||||
readToggled(false);
|
||||
removeItem();
|
||||
}
|
||||
|
||||
void PostedItem::toggle()
|
||||
{
|
||||
expand(ui->frame_picture->isHidden());
|
||||
}
|
||||
|
||||
void PostedItem::doExpand(bool open)
|
||||
{
|
||||
if (open)
|
||||
{
|
||||
ui->frame_picture->show();
|
||||
ui->expandButton->setIcon(QIcon(QString(":/images/decrease.png")));
|
||||
ui->expandButton->setToolTip(tr("Hide"));
|
||||
}
|
||||
else
|
||||
{
|
||||
ui->frame_picture->hide();
|
||||
ui->expandButton->setIcon(QIcon(QString(":/images/expand.png")));
|
||||
ui->expandButton->setToolTip(tr("Expand"));
|
||||
}
|
||||
|
||||
emit sizeChanged(this);
|
||||
|
||||
}
|
||||
|
||||
void PostedItem::copyMessageLink()
|
||||
{
|
||||
if (groupId().isNull() || mMessageId.isNull()) {
|
||||
return;
|
||||
}
|
||||
|
||||
RetroShareLink link = RetroShareLink::createGxsMessageLink(RetroShareLink::TYPE_POSTED, groupId(), mMessageId, messageName());
|
||||
|
||||
if (link.valid()) {
|
||||
QList<RetroShareLink> urls;
|
||||
urls.push_back(link);
|
||||
RSLinkClipboard::copyLinks(urls);
|
||||
}
|
||||
}
|
||||
|
||||
void PostedItem::toggleNotes()
|
||||
{
|
||||
if (ui->notesButton->isChecked())
|
||||
{
|
||||
ui->frame_notes->show();
|
||||
}
|
||||
else
|
||||
{
|
||||
ui->frame_notes->hide();
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -30,6 +30,7 @@ namespace Ui {
|
||||
class PostedItem;
|
||||
}
|
||||
|
||||
class FeedHolder;
|
||||
class RsPostedPost;
|
||||
|
||||
class PostedItem : public GxsFeedItem
|
||||
@ -50,7 +51,7 @@ public:
|
||||
|
||||
protected:
|
||||
/* FeedItem */
|
||||
virtual void doExpand(bool /*open*/) {}
|
||||
virtual void doExpand(bool open);
|
||||
|
||||
private slots:
|
||||
void loadComments();
|
||||
@ -58,6 +59,9 @@ private slots:
|
||||
void makeDownVote();
|
||||
void readToggled(bool checked);
|
||||
void readAndClearItem();
|
||||
void toggle();
|
||||
void copyMessageLink();
|
||||
void toggleNotes();
|
||||
|
||||
signals:
|
||||
void vote(const RsGxsGrpMsgIdPair& msgId, bool up);
|
||||
@ -83,6 +87,7 @@ private:
|
||||
|
||||
RsPostedGroup mGroup;
|
||||
RsPostedPost mPost;
|
||||
RsGxsMessageId mMessageId;
|
||||
|
||||
/** Qt Designer generated object */
|
||||
Ui::PostedItem *ui;
|
||||
|
@ -6,15 +6,33 @@
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>765</width>
|
||||
<height>230</height>
|
||||
<width>617</width>
|
||||
<height>190</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string notr="true"/>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="PostedItemVLayout">
|
||||
<item>
|
||||
<property name="styleSheet">
|
||||
<string notr="true"/>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout_3">
|
||||
<property name="leftMargin">
|
||||
<number>6</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>6</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="spacing">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item row="0" column="0">
|
||||
<widget class="QFrame" name="mainFrame">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
|
||||
@ -23,7 +41,7 @@
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="autoFillBackground">
|
||||
<bool>true</bool>
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="frameShape">
|
||||
<enum>QFrame::Box</enum>
|
||||
@ -31,44 +49,178 @@
|
||||
<property name="frameShadow">
|
||||
<enum>QFrame::Sunken</enum>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="mainFrameVLayout">
|
||||
<item>
|
||||
<widget class="StyledLabel" name="titleLabel">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Expanding">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
<layout class="QGridLayout" name="gridLayout_2">
|
||||
<property name="leftMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="horizontalSpacing">
|
||||
<number>6</number>
|
||||
</property>
|
||||
<item row="0" column="0" rowspan="2">
|
||||
<widget class="QFrame" name="voteFrame">
|
||||
<property name="styleSheet">
|
||||
<string notr="true"/>
|
||||
</property>
|
||||
<property name="font">
|
||||
<font>
|
||||
<weight>75</weight>
|
||||
<bold>true</bold>
|
||||
</font>
|
||||
<property name="frameShape">
|
||||
<enum>QFrame::NoFrame</enum>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string notr="true">This is a very very very very loooooooooooooooonnnnnnnnnnnnnnnnng title don't you think? Yes it is and should wrap around I hope</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set>
|
||||
</property>
|
||||
<property name="wordWrap">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="openExternalLinks">
|
||||
<bool>true</bool>
|
||||
<property name="frameShadow">
|
||||
<enum>QFrame::Plain</enum>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<property name="spacing">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="leftMargin">
|
||||
<number>3</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>3</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>3</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>3</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QToolButton" name="voteUpButton">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>24</width>
|
||||
<height>24</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Vote up</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="Posted_images.qrc">
|
||||
<normaloff>:/images/up-arrow.png</normaloff>:/images/up-arrow.png</iconset>
|
||||
</property>
|
||||
<property name="iconSize">
|
||||
<size>
|
||||
<width>16</width>
|
||||
<height>16</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="autoRaise">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="StyledLabel" name="scoreLabel">
|
||||
<property name="text">
|
||||
<string>0</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QToolButton" name="voteDownButton">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Vote down</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>\/</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="Posted_images.qrc">
|
||||
<normaloff>:/images/down-arrow.png</normaloff>:/images/down-arrow.png</iconset>
|
||||
</property>
|
||||
<property name="iconSize">
|
||||
<size>
|
||||
<width>16</width>
|
||||
<height>16</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="autoRaise">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="verticalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeType">
|
||||
<enum>QSizePolicy::Expanding</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>5</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="newCommHLayout">
|
||||
<item row="0" column="1" rowspan="2">
|
||||
<layout class="QVBoxLayout" name="verticalLayout_3">
|
||||
<property name="topMargin">
|
||||
<number>0</number>
|
||||
<number>6</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QLabel" name="newCommentLabel">
|
||||
<widget class="QLabel" name="thumbnailLabel">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>100</width>
|
||||
<height>75</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>100</width>
|
||||
<height>75</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="styleSheet">
|
||||
<string notr="true"/>
|
||||
</property>
|
||||
<property name="frameShape">
|
||||
<enum>QFrame::NoFrame</enum>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>New Comment:</string>
|
||||
<string/>
|
||||
</property>
|
||||
<property name="pixmap">
|
||||
<pixmap resource="Posted_images.qrc">:/images/thumb-default.png</pixmap>
|
||||
</property>
|
||||
<property name="scaledContents">
|
||||
<bool>true</bool>
|
||||
@ -76,265 +228,445 @@
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="ElidedLabel" name="commLabel">
|
||||
<property name="text">
|
||||
<string>Comment Value</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="buttonHLayout">
|
||||
<item>
|
||||
<widget class="StyledLabel" name="scoreLabel">
|
||||
<property name="text">
|
||||
<string>0</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QToolButton" name="voteUpButton">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>24</width>
|
||||
<height>24</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Vote up</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="../images.qrc">
|
||||
<normaloff>:/images/vote_up.png</normaloff>:/images/vote_up.png</iconset>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QToolButton" name="voteDownButton">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>24</width>
|
||||
<height>24</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Vote down</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>\/</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="../images.qrc">
|
||||
<normaloff>:/images/vote_down.png</normaloff>:/images/vote_down.png</iconset>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="readButton">
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>24</width>
|
||||
<height>16777215</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="focusPolicy">
|
||||
<enum>Qt::NoFocus</enum>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Toggle Message Read Status</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="../images.qrc">
|
||||
<normaloff>:/images/message-state-unread.png</normaloff>:/images/message-state-unread.png</iconset>
|
||||
</property>
|
||||
<property name="checkable">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="checked">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="flat">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="newLabel">
|
||||
<property name="text">
|
||||
<string>New</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="commentButton">
|
||||
<property name="text">
|
||||
<string>Comments</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="dateLabel">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string notr="true">You eyes only</string>
|
||||
</property>
|
||||
<property name="openExternalLinks">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="fromBoldLabel">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="font">
|
||||
<font>
|
||||
<weight>75</weight>
|
||||
<bold>true</bold>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>By</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="GxsIdLabel" name="fromLabel">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string notr="true">Signed by</string>
|
||||
</property>
|
||||
<property name="openExternalLinks">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="siteBoldLabel">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="font">
|
||||
<font>
|
||||
<weight>75</weight>
|
||||
<bold>true</bold>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Site</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="siteLabel">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string notr="true">Signed by</string>
|
||||
</property>
|
||||
<property name="openExternalLinks">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer">
|
||||
<spacer name="verticalSpacer_2">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>118</width>
|
||||
<height>20</height>
|
||||
<width>50</width>
|
||||
<height>5</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="0" column="2">
|
||||
<layout class="QVBoxLayout" name="verticalLayout_4">
|
||||
<property name="topMargin">
|
||||
<number>6</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QPushButton" name="readAndClearButton">
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>24</width>
|
||||
<height>16777215</height>
|
||||
</size>
|
||||
<widget class="StyledLabel" name="titleLabel">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Expanding">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="focusPolicy">
|
||||
<enum>Qt::NoFocus</enum>
|
||||
<property name="font">
|
||||
<font>
|
||||
<weight>75</weight>
|
||||
<bold>true</bold>
|
||||
</font>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Set as read and remove item</string>
|
||||
<property name="text">
|
||||
<string notr="true">This is a very very very very loooooooooooooooonnnnnnnnnnnnnnnnng title don't you think? Yes it is and should wrap around I hope</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="../images.qrc">
|
||||
<normaloff>:/images/cancel.png</normaloff>:/images/cancel.png</iconset>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set>
|
||||
</property>
|
||||
<property name="wordWrap">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="openExternalLinks">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="clearButton">
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>24</width>
|
||||
<height>16777215</height>
|
||||
</size>
|
||||
<layout class="QHBoxLayout" name="newCommHLayout">
|
||||
<property name="topMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="focusPolicy">
|
||||
<enum>Qt::NoFocus</enum>
|
||||
<item>
|
||||
<widget class="QLabel" name="newCommentLabel">
|
||||
<property name="text">
|
||||
<string>New Comment:</string>
|
||||
</property>
|
||||
<property name="scaledContents">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="ElidedLabel" name="commLabel">
|
||||
<property name="text">
|
||||
<string>Comment Value</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="1" column="2">
|
||||
<layout class="QVBoxLayout" name="verticalLayout_2">
|
||||
<property name="spacing">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="sizeConstraint">
|
||||
<enum>QLayout::SetDefaultConstraint</enum>
|
||||
</property>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
||||
<property name="spacing">
|
||||
<number>3</number>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Remove Item</string>
|
||||
<property name="leftMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="../images.qrc">
|
||||
<normaloff>:/images/close_normal.png</normaloff>:/images/close_normal.png</iconset>
|
||||
<property name="rightMargin">
|
||||
<number>6</number>
|
||||
</property>
|
||||
</widget>
|
||||
<item>
|
||||
<widget class="QLabel" name="fromBoldLabel">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="font">
|
||||
<font>
|
||||
<weight>75</weight>
|
||||
<bold>true</bold>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Posted by</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="GxsIdLabel" name="fromLabel">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Minimum" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string notr="true">Signed by</string>
|
||||
</property>
|
||||
<property name="openExternalLinks">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="dateLabel">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Minimum" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string notr="true">You eyes only</string>
|
||||
</property>
|
||||
<property name="openExternalLinks">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="siteBoldLabel">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Minimum" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="font">
|
||||
<font>
|
||||
<weight>75</weight>
|
||||
<bold>true</bold>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Site</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="siteLabel">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Expanding" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string notr="true">site</string>
|
||||
</property>
|
||||
<property name="openExternalLinks">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer_4">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeType">
|
||||
<enum>QSizePolicy::Expanding</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>70</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="buttonHLayout">
|
||||
<property name="leftMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>3</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QToolButton" name="expandButton">
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="Posted_images.qrc">
|
||||
<normaloff>:/images/expand.png</normaloff>:/images/expand.png</iconset>
|
||||
</property>
|
||||
<property name="autoRaise">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="readButton">
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>24</width>
|
||||
<height>16777215</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="focusPolicy">
|
||||
<enum>Qt::NoFocus</enum>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Toggle Message Read Status</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="../images.qrc">
|
||||
<normaloff>:/images/message-state-unread.png</normaloff>:/images/message-state-unread.png</iconset>
|
||||
</property>
|
||||
<property name="checkable">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="checked">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="flat">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="newLabel">
|
||||
<property name="text">
|
||||
<string>New</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QToolButton" name="commentButton">
|
||||
<property name="text">
|
||||
<string>Comments</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="Posted_images.qrc">
|
||||
<normaloff>:/images/comments.png</normaloff>:/images/comments.png</iconset>
|
||||
</property>
|
||||
<property name="toolButtonStyle">
|
||||
<enum>Qt::ToolButtonTextBesideIcon</enum>
|
||||
</property>
|
||||
<property name="autoRaise">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="shareButton">
|
||||
<property name="text">
|
||||
<string>Share</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="Posted_images.qrc">
|
||||
<normaloff>:/images/share.png</normaloff>:/images/share.png</iconset>
|
||||
</property>
|
||||
<property name="flat">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QToolButton" name="notesButton">
|
||||
<property name="text">
|
||||
<string>Notes</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="Posted_images.qrc">
|
||||
<normaloff>:/images/notes.png</normaloff>:/images/notes.png</iconset>
|
||||
</property>
|
||||
<property name="checkable">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="toolButtonStyle">
|
||||
<enum>Qt::ToolButtonTextBesideIcon</enum>
|
||||
</property>
|
||||
<property name="autoRaise">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>118</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="readAndClearButton">
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>24</width>
|
||||
<height>16777215</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="focusPolicy">
|
||||
<enum>Qt::NoFocus</enum>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Set as read and remove item</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="../images.qrc">
|
||||
<normaloff>:/images/cancel.png</normaloff>:/images/cancel.png</iconset>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="clearButton">
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>24</width>
|
||||
<height>16777215</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="focusPolicy">
|
||||
<enum>Qt::NoFocus</enum>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Remove Item</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="../images.qrc">
|
||||
<normaloff>:/images/close_normal.png</normaloff>:/images/close_normal.png</iconset>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
<zorder>titleLabel</zorder>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QFrame" name="frame_picture">
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>800</width>
|
||||
<height>600</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="frameShape">
|
||||
<enum>QFrame::StyledPanel</enum>
|
||||
</property>
|
||||
<property name="frameShadow">
|
||||
<enum>QFrame::Raised</enum>
|
||||
</property>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||
<item>
|
||||
<spacer name="horizontalSpacer_2">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>257</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="pictureLabel">
|
||||
<property name="text">
|
||||
<string>TextLabel</string>
|
||||
</property>
|
||||
<property name="scaledContents">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer_3">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>257</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<widget class="QFrame" name="frame_notes">
|
||||
<property name="frameShape">
|
||||
<enum>QFrame::NoFrame</enum>
|
||||
<enum>QFrame::Box</enum>
|
||||
</property>
|
||||
<property name="frameShadow">
|
||||
<enum>QFrame::Sunken</enum>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<property name="margin">
|
||||
<number>1</number>
|
||||
<property name="leftMargin">
|
||||
<number>3</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>3</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>3</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>3</number>
|
||||
</property>
|
||||
<property name="spacing">
|
||||
<number>1</number>
|
||||
@ -374,6 +706,7 @@
|
||||
</customwidgets>
|
||||
<resources>
|
||||
<include location="../images.qrc"/>
|
||||
<include location="Posted_images.qrc"/>
|
||||
</resources>
|
||||
<connections/>
|
||||
</ui>
|
||||
|
@ -41,23 +41,19 @@ PostedListWidget::PostedListWidget(const RsGxsGroupId &postedId, QWidget *parent
|
||||
ui->setupUi(this);
|
||||
|
||||
/* Setup UI helper */
|
||||
mStateHelper->addWidget(mTokenTypeAllPosts, ui->hotSortButton);
|
||||
mStateHelper->addWidget(mTokenTypeAllPosts, ui->newSortButton);
|
||||
mStateHelper->addWidget(mTokenTypeAllPosts, ui->topSortButton);
|
||||
mStateHelper->addWidget(mTokenTypeAllPosts, ui->comboBox);
|
||||
|
||||
mStateHelper->addWidget(mTokenTypePosts, ui->hotSortButton);
|
||||
mStateHelper->addWidget(mTokenTypePosts, ui->newSortButton);
|
||||
mStateHelper->addWidget(mTokenTypePosts, ui->topSortButton);
|
||||
mStateHelper->addWidget(mTokenTypePosts, ui->comboBox);
|
||||
|
||||
mStateHelper->addWidget(mTokenTypeGroupData, ui->submitPostButton);
|
||||
mStateHelper->addWidget(mTokenTypeGroupData, ui->subscribeToolButton);
|
||||
|
||||
connect(ui->hotSortButton, SIGNAL(clicked()), this, SLOT(getRankings()));
|
||||
connect(ui->newSortButton, SIGNAL(clicked()), this, SLOT(getRankings()));
|
||||
connect(ui->topSortButton, SIGNAL(clicked()), this, SLOT(getRankings()));
|
||||
connect(ui->nextButton, SIGNAL(clicked()), this, SLOT(showNext()));
|
||||
connect(ui->prevButton, SIGNAL(clicked()), this, SLOT(showPrev()));
|
||||
connect(ui->subscribeToolButton, SIGNAL(subscribe(bool)), this, SLOT(subscribeGroup(bool)));
|
||||
|
||||
connect(ui->comboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(getRankings(int)));
|
||||
|
||||
|
||||
// default sort method.
|
||||
mSortMethod = RsPosted::HotRankType;
|
||||
@ -67,12 +63,14 @@ PostedListWidget::PostedListWidget(const RsGxsGroupId &postedId, QWidget *parent
|
||||
|
||||
mTokenTypeVote = nextTokenType();
|
||||
|
||||
ui->hotSortButton->setChecked(true);
|
||||
|
||||
/* fill in the available OwnIds for signing */
|
||||
ui->idChooser->loadIds(IDCHOOSER_ID_REQUIRED, RsGxsId());
|
||||
|
||||
connect(ui->submitPostButton, SIGNAL(clicked()), this, SLOT(newPost()));
|
||||
|
||||
ui->subscribeToolButton->setToolTip(tr( "<p>Subscribing to the links will gather \
|
||||
available posts from your subscribed friends, and make the \
|
||||
links visible to all other friends.</p><p>Afterwards you can unsubscribe from the context menu of the links list at left.</p>"));
|
||||
|
||||
/* load settings */
|
||||
processSettings(true);
|
||||
@ -183,7 +181,7 @@ void PostedListWidget::updateShowText()
|
||||
ui->showLabel->setText(showText);
|
||||
}
|
||||
|
||||
void PostedListWidget::getRankings()
|
||||
void PostedListWidget::getRankings(int i)
|
||||
{
|
||||
if (groupId().isNull())
|
||||
return;
|
||||
@ -192,23 +190,19 @@ void PostedListWidget::getRankings()
|
||||
std::cerr << std::endl;
|
||||
|
||||
int oldSortMethod = mSortMethod;
|
||||
|
||||
QObject* button = sender();
|
||||
if(button == ui->hotSortButton)
|
||||
|
||||
switch(i)
|
||||
{
|
||||
default:
|
||||
case 0:
|
||||
mSortMethod = RsPosted::HotRankType;
|
||||
}
|
||||
else if(button == ui->topSortButton)
|
||||
{
|
||||
mSortMethod = RsPosted::TopRankType;
|
||||
}
|
||||
else if(button == ui->newSortButton)
|
||||
{
|
||||
break;
|
||||
case 1:
|
||||
mSortMethod = RsPosted::NewRankType;
|
||||
}
|
||||
else
|
||||
{
|
||||
return;
|
||||
break;
|
||||
case 2:
|
||||
mSortMethod = RsPosted::TopRankType;
|
||||
break;
|
||||
}
|
||||
|
||||
if (oldSortMethod != mSortMethod)
|
||||
@ -262,7 +256,7 @@ void PostedListWidget::submitVote(const RsGxsGrpMsgIdPair &msgId, bool up)
|
||||
std::cerr << "AuthorId : " << vote.mMeta.mAuthorId << std::endl;
|
||||
|
||||
uint32_t token;
|
||||
rsPosted->createVote(token, vote);
|
||||
rsPosted->createNewVote(token, vote);
|
||||
mTokenQueue->queueRequest(token, TOKENREQ_MSGINFO, RS_TOKREQ_ANSTYPE_ACK, mTokenTypeVote);
|
||||
}
|
||||
|
||||
@ -298,6 +292,7 @@ void PostedListWidget::insertPostedDetails(const RsPostedGroup &group)
|
||||
{
|
||||
mStateHelper->setWidgetEnabled(ui->submitPostButton, IS_GROUP_SUBSCRIBED(group.mMeta.mSubscribeFlags));
|
||||
ui->subscribeToolButton->setSubscribed(IS_GROUP_SUBSCRIBED(group.mMeta.mSubscribeFlags));
|
||||
ui->subscribeToolButton->setHidden(IS_GROUP_SUBSCRIBED(group.mMeta.mSubscribeFlags)) ;
|
||||
}
|
||||
|
||||
/*********************** **** **** **** ***********************/
|
||||
|
@ -71,7 +71,7 @@ private slots:
|
||||
|
||||
void submitVote(const RsGxsGrpMsgIdPair& msgId, bool up);
|
||||
|
||||
void getRankings();
|
||||
void getRankings(int);
|
||||
|
||||
void subscribeGroup(bool subscribe);
|
||||
|
||||
|
@ -14,62 +14,92 @@
|
||||
<string>Form</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_2">
|
||||
<property name="margin">
|
||||
<property name="spacing">
|
||||
<number>3</number>
|
||||
</property>
|
||||
<property name="leftMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_3">
|
||||
<property name="leftMargin">
|
||||
<number>6</number>
|
||||
<widget class="QFrame" name="headerFrame">
|
||||
<property name="frameShape">
|
||||
<enum>QFrame::Box</enum>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>6</number>
|
||||
<property name="frameShadow">
|
||||
<enum>QFrame::Sunken</enum>
|
||||
</property>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QFrame" name="frame">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
||||
<property name="spacing">
|
||||
<number>6</number>
|
||||
</property>
|
||||
<property name="leftMargin">
|
||||
<number>6</number>
|
||||
<number>4</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>0</number>
|
||||
<number>2</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>6</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>0</number>
|
||||
<number>2</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="SubscribeToolButton" name="subscribeToolButton">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Fixed" vsizetype="Preferred">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="font">
|
||||
<font>
|
||||
<weight>50</weight>
|
||||
<italic>false</italic>
|
||||
<bold>false</bold>
|
||||
</font>
|
||||
</property>
|
||||
<property name="styleSheet">
|
||||
<string notr="true"/>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string notr="true">Subscribe</string>
|
||||
</property>
|
||||
<property name="autoRaise">
|
||||
<bool>true</bool>
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QToolButton" name="submitPostButton">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Submit a new Post</string>
|
||||
<string>Create Post</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="Posted_images.qrc">
|
||||
<normaloff>:/images/posted_24.png</normaloff>:/images/posted_24.png</iconset>
|
||||
</property>
|
||||
<property name="iconSize">
|
||||
<size>
|
||||
<width>24</width>
|
||||
<height>24</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="toolButtonStyle">
|
||||
<enum>Qt::ToolButtonTextBesideIcon</enum>
|
||||
</property>
|
||||
@ -78,6 +108,49 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QComboBox" name="comboBox">
|
||||
<property name="toolTip">
|
||||
<string><html><head/><body><p><span style=" font-family:'-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol'; font-size:14px; color:#24292e; background-color:#ffffff;">Select sorting</span></p></body></html></string>
|
||||
</property>
|
||||
<property name="styleSheet">
|
||||
<string notr="true"/>
|
||||
</property>
|
||||
<property name="iconSize">
|
||||
<size>
|
||||
<width>24</width>
|
||||
<height>24</height>
|
||||
</size>
|
||||
</property>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Hot</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="../icons.qrc">
|
||||
<normaloff>:/icons/png/flame.png</normaloff>:/icons/png/flame.png</iconset>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>New</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="../icons.qrc">
|
||||
<normaloff>:/icons/png/new.png</normaloff>:/icons/png/new.png</iconset>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Top</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="../icons.qrc">
|
||||
<normaloff>:/icons/png/top.png</normaloff>:/icons/png/top.png</iconset>
|
||||
</property>
|
||||
</item>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer_2">
|
||||
<property name="orientation">
|
||||
@ -91,116 +164,6 @@
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="hotSortButton">
|
||||
<property name="toolTip">
|
||||
<string>Hot</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="Posted_images.qrc">
|
||||
<normaloff>:/images/hot_24.png</normaloff>:/images/hot_24.png</iconset>
|
||||
</property>
|
||||
<property name="iconSize">
|
||||
<size>
|
||||
<width>24</width>
|
||||
<height>24</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="checkable">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="autoExclusive">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="newSortButton">
|
||||
<property name="toolTip">
|
||||
<string>New</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="Posted_images.qrc">
|
||||
<normaloff>:/images/new_24.png</normaloff>:/images/new_24.png</iconset>
|
||||
</property>
|
||||
<property name="iconSize">
|
||||
<size>
|
||||
<width>24</width>
|
||||
<height>24</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="checkable">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="autoExclusive">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="topSortButton">
|
||||
<property name="toolTip">
|
||||
<string>Top</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="../images.qrc">
|
||||
<normaloff>:/images/vote_up.png</normaloff>:/images/vote_up.png</iconset>
|
||||
</property>
|
||||
<property name="iconSize">
|
||||
<size>
|
||||
<width>24</width>
|
||||
<height>24</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="checkable">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="checked">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="autoExclusive">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QComboBox" name="periodComboBox">
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Today</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Yesterday</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>This Week</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>This Month</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>This Year</string>
|
||||
</property>
|
||||
</item>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="prevButton">
|
||||
<property name="toolTip">
|
||||
@ -236,19 +199,6 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer_3">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="GxsIdChooser" name="idChooser"/>
|
||||
</item>
|
||||
@ -279,7 +229,16 @@
|
||||
<property name="spacing">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="margin">
|
||||
<property name="leftMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
</layout>
|
||||
@ -289,19 +248,20 @@
|
||||
</layout>
|
||||
</widget>
|
||||
<customwidgets>
|
||||
<customwidget>
|
||||
<class>GxsIdChooser</class>
|
||||
<extends>QComboBox</extends>
|
||||
<header>gui/gxs/GxsIdChooser.h</header>
|
||||
</customwidget>
|
||||
<customwidget>
|
||||
<class>SubscribeToolButton</class>
|
||||
<extends>QToolButton</extends>
|
||||
<header>gui/common/SubscribeToolButton.h</header>
|
||||
</customwidget>
|
||||
<customwidget>
|
||||
<class>GxsIdChooser</class>
|
||||
<extends>QComboBox</extends>
|
||||
<header>gui/gxs/GxsIdChooser.h</header>
|
||||
</customwidget>
|
||||
</customwidgets>
|
||||
<resources>
|
||||
<include location="../images.qrc"/>
|
||||
<include location="../icons.qrc"/>
|
||||
<include location="Posted_images.qrc"/>
|
||||
</resources>
|
||||
<connections/>
|
||||
|
@ -11,5 +11,13 @@
|
||||
<file>images/hot_24.png</file>
|
||||
<file>images/new_24.png</file>
|
||||
<file>images/posted_32_new.png</file>
|
||||
<file>images/expand.png</file>
|
||||
<file>images/decrease.png</file>
|
||||
<file>images/down-arrow.png</file>
|
||||
<file>images/up-arrow.png</file>
|
||||
<file>images/comments.png</file>
|
||||
<file>images/thumb-default.png</file>
|
||||
<file>images/share.png</file>
|
||||
<file>images/notes.png</file>
|
||||
</qresource>
|
||||
</RCC>
|
||||
|
BIN
retroshare-gui/src/gui/Posted/images/comments.png
Normal file
After Width: | Height: | Size: 3.8 KiB |
BIN
retroshare-gui/src/gui/Posted/images/decrease.png
Normal file
After Width: | Height: | Size: 3.2 KiB |
BIN
retroshare-gui/src/gui/Posted/images/down-arrow.png
Normal file
After Width: | Height: | Size: 2.0 KiB |
BIN
retroshare-gui/src/gui/Posted/images/expand.png
Normal file
After Width: | Height: | Size: 3.9 KiB |
BIN
retroshare-gui/src/gui/Posted/images/notes.png
Normal file
After Width: | Height: | Size: 1.7 KiB |
BIN
retroshare-gui/src/gui/Posted/images/share.png
Normal file
After Width: | Height: | Size: 2.7 KiB |
BIN
retroshare-gui/src/gui/Posted/images/thumb-default.png
Normal file
After Width: | Height: | Size: 9.9 KiB |
BIN
retroshare-gui/src/gui/Posted/images/up-arrow.png
Normal file
After Width: | Height: | Size: 1.9 KiB |
@ -40,7 +40,7 @@
|
||||
#define COLUMN_COUNT 6
|
||||
#define RETROSHARE_DIR_MODEL_FILTER_STRING "filtered"
|
||||
|
||||
class DirDetails;
|
||||
struct DirDetails;
|
||||
|
||||
class DirDetailsVector : public DirDetails
|
||||
{
|
||||
|
@ -6,8 +6,8 @@
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>1210</width>
|
||||
<height>334</height>
|
||||
<width>600</width>
|
||||
<height>400</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
|
@ -300,9 +300,17 @@ void ChatLobbyDialog::initParticipantsContextMenu(QMenu *contextMnu, QList<RsGxs
|
||||
{
|
||||
distantChatAct->setEnabled(true);
|
||||
sendMessageAct->setEnabled(true);
|
||||
votePositiveAct->setEnabled(rsReputations->overallReputationLevel(gxsid) != RsReputations::REPUTATION_LOCALLY_POSITIVE);
|
||||
voteNeutralAct->setEnabled((rsReputations->overallReputationLevel(gxsid) == RsReputations::REPUTATION_LOCALLY_POSITIVE) || (rsReputations->overallReputationLevel(gxsid) == RsReputations::REPUTATION_LOCALLY_NEGATIVE) );
|
||||
voteNegativeAct->setEnabled(rsReputations->overallReputationLevel(gxsid) != RsReputations::REPUTATION_LOCALLY_NEGATIVE);
|
||||
votePositiveAct->setEnabled(
|
||||
rsReputations->overallReputationLevel(gxsid) !=
|
||||
RsReputationLevel::LOCALLY_POSITIVE );
|
||||
voteNeutralAct->setEnabled(
|
||||
( rsReputations->overallReputationLevel(gxsid) ==
|
||||
RsReputationLevel::LOCALLY_POSITIVE ) ||
|
||||
( rsReputations->overallReputationLevel(gxsid) ==
|
||||
RsReputationLevel::LOCALLY_NEGATIVE ) );
|
||||
voteNegativeAct->setEnabled(
|
||||
rsReputations->overallReputationLevel(gxsid) !=
|
||||
RsReputationLevel::LOCALLY_NEGATIVE );
|
||||
muteAct->setEnabled(true);
|
||||
muteAct->setChecked(isParticipantMuted(gxsid));
|
||||
}
|
||||
@ -319,16 +327,15 @@ void ChatLobbyDialog::voteParticipant()
|
||||
|
||||
QList<RsGxsId> idList = act->data().value<QList<RsGxsId>>();
|
||||
|
||||
RsReputations::Opinion op = RsReputations::OPINION_NEUTRAL ;
|
||||
if (act == votePositiveAct)
|
||||
op = RsReputations::OPINION_POSITIVE;
|
||||
if (act == voteNegativeAct)
|
||||
op = RsReputations::OPINION_NEGATIVE;
|
||||
RsOpinion op = RsOpinion::NEUTRAL;
|
||||
if (act == votePositiveAct) op = RsOpinion::POSITIVE;
|
||||
if (act == voteNegativeAct) op = RsOpinion::NEGATIVE;
|
||||
|
||||
for (QList<RsGxsId>::iterator item = idList.begin(); item != idList.end(); ++item)
|
||||
{
|
||||
rsReputations->setOwnOpinion(*item, op);
|
||||
std::cerr << "Giving opinion to GXS id " << *item << " to " << op << std::endl;
|
||||
std::cerr << "Giving opinion to GXS id " << *item << " to "
|
||||
<< static_cast<uint32_t>(op) << std::endl;
|
||||
}
|
||||
|
||||
updateParticipantsList();
|
||||
|
@ -81,7 +81,7 @@
|
||||
</attribute>
|
||||
<column>
|
||||
<property name="text">
|
||||
<string>Trusted nodes</string>
|
||||
<string>Friends</string>
|
||||
</property>
|
||||
<property name="textAlignment">
|
||||
<set>AlignCenter</set>
|
||||
|
@ -21,7 +21,7 @@
|
||||
#ifndef _GROUPDEFS_H
|
||||
#define _GROUPDEFS_H
|
||||
|
||||
class RsGroupInfo;
|
||||
struct RsGroupInfo;
|
||||
|
||||
class GroupDefs
|
||||
{
|
||||
|