Merge pull request #164 from csoler/v0.6-SignedForums2

V0.6 signed forums2
This commit is contained in:
Cyril Soler 2015-10-28 10:01:26 -04:00
commit 5beb85215c
36 changed files with 1345 additions and 793 deletions

View file

@ -113,10 +113,16 @@ void IdEditDialog::changeAvatar()
}
}
void IdEditDialog::setupNewId(bool pseudo)
void IdEditDialog::setupNewId(bool pseudo,bool enable_anon)
{
setWindowTitle(tr("New identity"));
if(pseudo && !enable_anon)
{
std::cerr << "IdEditDialog::setupNewId: Error. Cannot init with pseudo-anonymous id when anon ids are disabled." << std::endl;
pseudo = false ;
}
mIsNew = true;
mGroupId.clear();
@ -139,7 +145,11 @@ void IdEditDialog::setupNewId(bool pseudo)
ui->frame_Tags->setHidden(true);
ui->radioButton_GpgId->setEnabled(true);
ui->radioButton_Pseudo->setEnabled(true);
if(enable_anon)
ui->radioButton_Pseudo->setEnabled(true);
else
ui->radioButton_Pseudo->setEnabled(false);
setAvatar(QPixmap());

View file

@ -45,7 +45,7 @@ public:
IdEditDialog(QWidget *parent = 0);
~IdEditDialog();
void setupNewId(bool pseudo);
void setupNewId(bool pseudo, bool enable_anon = true);
void setupExistingId(const RsGxsGroupId &keyId);
void enforceNoAnonIds() ;

View file

@ -37,18 +37,24 @@
#include <iostream>
// Control of Publish Signatures.
#define RSGXS_GROUP_SIGN_PUBLISH_MASK 0x000000ff
#define RSGXS_GROUP_SIGN_PUBLISH_ENCRYPTED 0x00000001
#define RSGXS_GROUP_SIGN_PUBLISH_ALLSIGNED 0x00000002
#define RSGXS_GROUP_SIGN_PUBLISH_THREADHEAD 0x00000004
#define RSGXS_GROUP_SIGN_PUBLISH_NONEREQ 0x00000008
//
// These are now defined in rsgxsflags.h
//
// #define FLAG_GROUP_SIGN_PUBLISH_MASK 0x000000ff
// #define FLAG_GROUP_SIGN_PUBLISH_ENCRYPTED 0x00000001
// #define FLAG_GROUP_SIGN_PUBLISH_ALLSIGNED 0x00000002
// #define FLAG_GROUP_SIGN_PUBLISH_THREADHEAD 0x00000004
// #define FLAG_GROUP_SIGN_PUBLISH_NONEREQ 0x00000008
// Author Signature.
#define RSGXS_GROUP_SIGN_AUTHOR_MASK 0x0000ff00
#define RSGXS_GROUP_SIGN_AUTHOR_GPG 0x00000100
#define RSGXS_GROUP_SIGN_AUTHOR_REQUIRED 0x00000200
#define RSGXS_GROUP_SIGN_AUTHOR_IFNOPUBSIGN 0x00000400
#define RSGXS_GROUP_SIGN_AUTHOR_NONE 0x00000800
// // Author Signature.
//
// These are now defined in rsgxsflags.h
//
// #define FLAG_AUTHOR_AUTHENTICATION_MASK 0x0000ff00
// #define FLAG_AUTHOR_AUTHENTICATION_NONE 0x00000000
// #define FLAG_AUTHOR_AUTHENTICATION_GPG 0x00000100
// #define FLAG_AUTHOR_AUTHENTICATION_REQUIRED 0x00000200
// #define FLAG_AUTHOR_AUTHENTICATION_IFNOPUBSIGN 0x00000400
#define GXSGROUP_NEWGROUPID 1
#define GXSGROUP_LOADGROUP 2
@ -123,6 +129,10 @@ void GxsGroupDialog::init()
ui.groupDesc->setPlaceholderText(tr("Set a descriptive description here"));
ui.personal_ifnopub->hide() ;
ui.personal_required->hide() ;
ui.personal_required->setChecked(true) ; // this is always true
initMode();
}
@ -288,7 +298,10 @@ void GxsGroupDialog::setupDefaults()
ui.comments_no->setChecked(true);
ui.comments_no_3->setChecked(true);
}
}
}
ui.antispam_keepTrackOfPosts->setChecked((bool)(mDefaultsFlags & GXS_GROUP_DEFAULTS_ANTISPAM_TRACK));
ui.antispam_favorSignedIds->setChecked((bool)(mDefaultsFlags & GXS_GROUP_DEFAULTS_ANTISPAM_FAVOR_PGP));
#ifndef RS_USE_CIRCLES
ui.typeGroup->setEnabled(false);
ui.typeLocal->setEnabled(false);
@ -576,54 +589,55 @@ uint32_t GxsGroupDialog::getGroupSignFlags()
/* grab from the ui options -> */
uint32_t signFlags = 0;
if (ui.publish_encrypt->isChecked()) {
signFlags |= RSGXS_GROUP_SIGN_PUBLISH_ENCRYPTED;
signFlags |= GXS_SERV::FLAG_GROUP_SIGN_PUBLISH_ENCRYPTED;
} else if (ui.publish_required->isChecked()) {
signFlags |= RSGXS_GROUP_SIGN_PUBLISH_ALLSIGNED;
signFlags |= GXS_SERV::FLAG_GROUP_SIGN_PUBLISH_ALLSIGNED;
} else if (ui.publish_threads->isChecked()) {
signFlags |= RSGXS_GROUP_SIGN_PUBLISH_THREADHEAD;
signFlags |= GXS_SERV::FLAG_GROUP_SIGN_PUBLISH_THREADHEAD;
} else { // publish_open (default).
signFlags |= RSGXS_GROUP_SIGN_PUBLISH_NONEREQ;
signFlags |= GXS_SERV::FLAG_GROUP_SIGN_PUBLISH_NONEREQ;
}
if (ui.personal_required->isChecked())
signFlags |= GXS_SERV::FLAG_AUTHOR_AUTHENTICATION_REQUIRED;
if (ui.personal_ifnopub->isChecked())
signFlags |= GXS_SERV::FLAG_AUTHOR_AUTHENTICATION_IFNOPUBSIGN;
// Author Signature.
if (ui.personal_pgp->isChecked()) {
signFlags |= RSGXS_GROUP_SIGN_AUTHOR_GPG;
} else if (ui.personal_required->isChecked()) {
signFlags |= RSGXS_GROUP_SIGN_AUTHOR_REQUIRED;
} else if (ui.personal_ifnopub->isChecked()) {
signFlags |= RSGXS_GROUP_SIGN_AUTHOR_IFNOPUBSIGN;
} else { // shouldn't allow this one.
signFlags |= RSGXS_GROUP_SIGN_AUTHOR_NONE;
}
if (ui.antispam_favorSignedIds->isChecked())
signFlags |= GXS_SERV::FLAG_AUTHOR_AUTHENTICATION_GPG;
if (ui.antispam_keepTrackOfPosts->isChecked())
signFlags |= GXS_SERV::FLAG_AUTHOR_AUTHENTICATION_TRACK_MESSAGES;
return signFlags;
}
void GxsGroupDialog::setGroupSignFlags(uint32_t signFlags)
{
if (signFlags & RSGXS_GROUP_SIGN_PUBLISH_ENCRYPTED) {
if (signFlags & GXS_SERV::FLAG_GROUP_SIGN_PUBLISH_ENCRYPTED) {
ui.publish_encrypt->setChecked(true);
} else if (signFlags & RSGXS_GROUP_SIGN_PUBLISH_ALLSIGNED) {
} else if (signFlags & GXS_SERV::FLAG_GROUP_SIGN_PUBLISH_ALLSIGNED) {
ui.publish_required->setChecked(true);
} else if (signFlags & RSGXS_GROUP_SIGN_PUBLISH_THREADHEAD) {
} else if (signFlags & GXS_SERV::FLAG_GROUP_SIGN_PUBLISH_THREADHEAD) {
ui.publish_threads->setChecked(true);
} else if (signFlags & RSGXS_GROUP_SIGN_PUBLISH_NONEREQ) {
} else if (signFlags & GXS_SERV::FLAG_GROUP_SIGN_PUBLISH_NONEREQ) {
ui.publish_open->setChecked(true);
}
if (signFlags & RSGXS_GROUP_SIGN_AUTHOR_GPG) {
ui.personal_pgp->setChecked(true);
} else if (signFlags & RSGXS_GROUP_SIGN_AUTHOR_REQUIRED) {
if (signFlags & GXS_SERV::FLAG_AUTHOR_AUTHENTICATION_REQUIRED)
ui.personal_required->setChecked(true);
} else if (signFlags & RSGXS_GROUP_SIGN_AUTHOR_IFNOPUBSIGN) {
if (signFlags & GXS_SERV::FLAG_AUTHOR_AUTHENTICATION_IFNOPUBSIGN)
ui.personal_ifnopub->setChecked(true);
} else if (signFlags & RSGXS_GROUP_SIGN_AUTHOR_NONE) {
// Its the same... but not quite.
//ui.personal_noifpub->setChecked();
}
ui.antispam_keepTrackOfPosts->setChecked((bool)(signFlags & GXS_SERV::FLAG_AUTHOR_AUTHENTICATION_TRACK_MESSAGES) );
ui.antispam_favorSignedIds ->setChecked((bool)(signFlags & GXS_SERV::FLAG_AUTHOR_AUTHENTICATION_GPG) );
/* guess at comments */
if ((signFlags & RSGXS_GROUP_SIGN_PUBLISH_THREADHEAD) &&
(signFlags & RSGXS_GROUP_SIGN_AUTHOR_IFNOPUBSIGN))
if ((signFlags & GXS_SERV::FLAG_GROUP_SIGN_PUBLISH_THREADHEAD) &&
(signFlags & GXS_SERV::FLAG_AUTHOR_AUTHENTICATION_IFNOPUBSIGN))
{
ui.comments_allowed->setChecked(true);
ui.comments_allowed_3->setChecked(true);

View file

@ -63,14 +63,14 @@ public:
#define GXS_GROUP_FLAGS_SHAREKEYS 0x00000020
#define GXS_GROUP_FLAGS_PERSONALSIGN 0x00000040
#define GXS_GROUP_FLAGS_COMMENTS 0x00000080
#define GXS_GROUP_FLAGS_EXTRA 0x00000100
#define GXS_GROUP_FLAGS_ANTI_SPAM 0x00000200
/*** Default flags are used to determine privacy of group, signatures required ***
*** whether publish or id and whether comments are allowed or not ***/
#define GXS_GROUP_DEFAULTS_DISTRIB_MASK 0x0000000f
#define GXS_GROUP_DEFAULTS_PUBLISH_MASK 0x000000f0
#define GXS_GROUP_DEFAULTS_DISTRIB_MASK 0x0000000f
#define GXS_GROUP_DEFAULTS_PUBLISH_MASK 0x000000f0
#define GXS_GROUP_DEFAULTS_PERSONAL_MASK 0x00000f00
#define GXS_GROUP_DEFAULTS_COMMENTS_MASK 0x0000f000
@ -78,18 +78,21 @@ public:
#define GXS_GROUP_DEFAULTS_DISTRIB_GROUP 0x00000002
#define GXS_GROUP_DEFAULTS_DISTRIB_LOCAL 0x00000004
#define GXS_GROUP_DEFAULTS_PUBLISH_OPEN 0x00000010
#define GXS_GROUP_DEFAULTS_PUBLISH_OPEN 0x00000010
#define GXS_GROUP_DEFAULTS_PUBLISH_THREADS 0x00000020
#define GXS_GROUP_DEFAULTS_PUBLISH_REQUIRED 0x00000040
#define GXS_GROUP_DEFAULTS_PUBLISH_ENCRYPTED 0x00000080
#define GXS_GROUP_DEFAULTS_PERSONAL_PGP 0x00000100
#define GXS_GROUP_DEFAULTS_PERSONAL_PGP 0x00000100
#define GXS_GROUP_DEFAULTS_PERSONAL_REQUIRED 0x00000200
#define GXS_GROUP_DEFAULTS_PERSONAL_IFNOPUB 0x00000400
#define GXS_GROUP_DEFAULTS_COMMENTS_YES 0x00001000
#define GXS_GROUP_DEFAULTS_COMMENTS_YES 0x00001000
#define GXS_GROUP_DEFAULTS_COMMENTS_NO 0x00002000
#define GXS_GROUP_DEFAULTS_ANTISPAM_FAVOR_PGP 0x00100000
#define GXS_GROUP_DEFAULTS_ANTISPAM_TRACK 0x00200000
/*!
* The aim of this dialog is to be convenient to encapsulate group
* creation code for several GXS services such forums, channels

View file

@ -6,32 +6,23 @@
<rect>
<x>0</x>
<y>0</y>
<width>685</width>
<height>517</height>
<width>928</width>
<height>914</height>
</rect>
</property>
<property name="windowTitle">
<string notr="true">Create New</string>
</property>
<layout class="QGridLayout" name="gridLayout_5">
<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>
<property name="verticalSpacing">
<number>0</number>
</property>
<property name="margin">
<number>0</number>
</property>
<item row="0" column="0">
<widget class="HeaderFrame" name="headerFrame"/>
</item>
@ -44,20 +35,98 @@
<enum>QFrame::Raised</enum>
</property>
<property name="currentIndex">
<number>1</number>
<number>0</number>
</property>
<widget class="QWidget" name="createmode">
<layout class="QGridLayout" name="gridLayout">
<property name="leftMargin">
<number>9</number>
</property>
<property name="horizontalSpacing">
<number>6</number>
</property>
<property name="verticalSpacing">
<number>0</number>
</property>
<item row="0" column="0">
<layout class="QVBoxLayout" name="verticalLayout_2">
<item>
<widget class="QDockWidget" name="contactsdockWidget">
<property name="enabled">
<bool>true</bool>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="maximumSize">
<size>
<width>300</width>
<height>524287</height>
</size>
</property>
<property name="sizeIncrement">
<size>
<width>220</width>
<height>0</height>
</size>
</property>
<property name="baseSize">
<size>
<width>0</width>
<height>0</height>
</size>
</property>
<property name="toolTip">
<string>check peers you would like to share private publish key with</string>
</property>
<property name="floating">
<bool>false</bool>
</property>
<property name="features">
<set>QDockWidget::NoDockWidgetFeatures</set>
</property>
<property name="windowTitle">
<string>Share Key With</string>
</property>
<widget class="QWidget" name="dockWidgetContents">
<layout class="QGridLayout" name="_2">
<property name="margin">
<number>0</number>
</property>
<property name="spacing">
<number>0</number>
</property>
<item row="0" column="0">
<widget class="FriendSelectionWidget" name="keyShareList" native="true">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Expanding">
<horstretch>0</horstretch>
<verstretch>4</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>20</width>
<height>0</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>300</width>
<height>16777215</height>
</size>
</property>
<property name="sizeIncrement">
<size>
<width>220</width>
<height>0</height>
</size>
</property>
<property name="baseSize">
<size>
<width>200</width>
<height>0</height>
</size>
</property>
</widget>
</item>
</layout>
</widget>
</widget>
</item>
<item>
<widget class="QGroupBox" name="groupBoxLogo">
<property name="title">
<string/>
@ -66,16 +135,7 @@
<property name="spacing">
<number>0</number>
</property>
<property name="leftMargin">
<number>4</number>
</property>
<property name="topMargin">
<number>4</number>
</property>
<property name="rightMargin">
<number>4</number>
</property>
<property name="bottomMargin">
<property name="margin">
<number>4</number>
</property>
<item>
@ -139,16 +199,7 @@
<property name="spacing">
<number>9</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">
<property name="margin">
<number>3</number>
</property>
<item>
@ -205,191 +256,19 @@
</layout>
</widget>
</item>
<item row="3" column="0">
<widget class="QGroupBox" name="publishGroupBox">
<item>
<widget class="QGroupBox" name="groupBox">
<property name="title">
<string>Publish Signatures</string>
<string>Description</string>
</property>
<layout class="QHBoxLayout" name="horizontalLayout_4">
<property name="spacing">
<number>6</number>
</property>
<property name="leftMargin">
<number>9</number>
</property>
<property name="topMargin">
<number>4</number>
</property>
<property name="rightMargin">
<number>9</number>
</property>
<property name="bottomMargin">
<number>4</number>
</property>
<layout class="QVBoxLayout">
<item>
<widget class="QRadioButton" name="publish_open">
<property name="text">
<string>Open</string>
</property>
</widget>
</item>
<item>
<widget class="QRadioButton" name="publish_threads">
<property name="text">
<string>New Thread</string>
</property>
</widget>
</item>
<item>
<widget class="QRadioButton" name="publish_required">
<property name="text">
<string>Required</string>
</property>
</widget>
</item>
<item>
<widget class="QRadioButton" name="publish_encrypt">
<property name="text">
<string>Encrypted Msgs</string>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_7">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
<widget class="MimeTextEdit" name="groupDesc"/>
</item>
</layout>
</widget>
</item>
<item row="4" column="0">
<widget class="QGroupBox" name="personalGroupBox">
<property name="title">
<string>Personal Signatures</string>
</property>
<layout class="QHBoxLayout" name="horizontalLayout_6">
<property name="spacing">
<number>6</number>
</property>
<property name="leftMargin">
<number>9</number>
</property>
<property name="topMargin">
<number>4</number>
</property>
<property name="rightMargin">
<number>9</number>
</property>
<property name="bottomMargin">
<number>4</number>
</property>
<item>
<widget class="QRadioButton" name="personal_pgp">
<property name="text">
<string>PGP Required</string>
</property>
</widget>
</item>
<item>
<widget class="QRadioButton" name="personal_required">
<property name="text">
<string>Signature Required</string>
</property>
</widget>
</item>
<item>
<widget class="QRadioButton" name="personal_ifnopub">
<property name="text">
<string>If No Publish Signature</string>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_6">
<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>
<item row="5" column="0">
<widget class="QGroupBox" name="commentGroupBox">
<property name="title">
<string>Comments</string>
</property>
<layout class="QHBoxLayout" name="horizontalLayout_5">
<property name="spacing">
<number>6</number>
</property>
<property name="leftMargin">
<number>9</number>
</property>
<property name="topMargin">
<number>4</number>
</property>
<property name="rightMargin">
<number>9</number>
</property>
<property name="bottomMargin">
<number>4</number>
</property>
<item>
<widget class="QRadioButton" name="comments_allowed">
<property name="text">
<string>Allow Comments</string>
</property>
</widget>
</item>
<item>
<widget class="QRadioButton" name="comments_no">
<property name="text">
<string>No Comments</string>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_5">
<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>
<item row="6" column="0" colspan="2">
<widget class="QFrame" name="extraFrame">
<property name="frameShape">
<enum>QFrame::StyledPanel</enum>
</property>
<property name="frameShadow">
<enum>QFrame::Raised</enum>
</property>
</widget>
</item>
<item row="2" column="0">
<item>
<widget class="QGroupBox" name="distribGroupBox">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
@ -490,112 +369,230 @@
</layout>
</widget>
</item>
<item row="1" column="0">
<widget class="QGroupBox" name="groupBox">
<item>
<widget class="QGroupBox" name="publishGroupBox">
<property name="title">
<string>Description</string>
<string>Publish Signatures</string>
</property>
<layout class="QVBoxLayout">
<layout class="QHBoxLayout" name="horizontalLayout_4">
<property name="spacing">
<number>6</number>
</property>
<property name="leftMargin">
<number>9</number>
</property>
<property name="topMargin">
<number>4</number>
</property>
<property name="rightMargin">
<number>9</number>
</property>
<property name="bottomMargin">
<number>4</number>
</property>
<item>
<widget class="MimeTextEdit" name="groupDesc"/>
<widget class="QRadioButton" name="publish_open">
<property name="text">
<string>Open</string>
</property>
</widget>
</item>
<item>
<widget class="QRadioButton" name="publish_threads">
<property name="text">
<string>New Thread</string>
</property>
</widget>
</item>
<item>
<widget class="QRadioButton" name="publish_required">
<property name="text">
<string>Required</string>
</property>
</widget>
</item>
<item>
<widget class="QRadioButton" name="publish_encrypt">
<property name="text">
<string>Encrypted Msgs</string>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_7">
<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>
<item row="0" column="1" rowspan="6">
<widget class="QDockWidget" name="contactsdockWidget">
<property name="enabled">
<bool>true</bool>
<item>
<widget class="QGroupBox" name="personalGroupBox">
<property name="title">
<string>Personal Signatures</string>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
<layout class="QHBoxLayout" name="horizontalLayout_9">
<item>
<widget class="QRadioButton" name="personal_pgp">
<property name="text">
<string>PGP Required</string>
</property>
</widget>
</item>
<item>
<widget class="QRadioButton" name="personal_required">
<property name="text">
<string>Signature Required</string>
</property>
</widget>
</item>
<item>
<widget class="QRadioButton" name="personal_ifnopub">
<property name="text">
<string>If No Publish Signature</string>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_6">
<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>
<item>
<widget class="QGroupBox" name="commentGroupBox">
<property name="title">
<string>Comments</string>
</property>
<property name="maximumSize">
<size>
<width>300</width>
<height>524287</height>
</size>
<layout class="QHBoxLayout" name="horizontalLayout_5">
<property name="spacing">
<number>6</number>
</property>
<property name="leftMargin">
<number>9</number>
</property>
<property name="topMargin">
<number>4</number>
</property>
<property name="rightMargin">
<number>9</number>
</property>
<property name="bottomMargin">
<number>4</number>
</property>
<item>
<widget class="QRadioButton" name="comments_allowed">
<property name="text">
<string>Allow Comments</string>
</property>
</widget>
</item>
<item>
<widget class="QRadioButton" name="comments_no">
<property name="text">
<string>No Comments</string>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_5">
<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>
<item>
<widget class="QGroupBox" name="spamProtection_GB">
<property name="title">
<string>Spam-protection</string>
</property>
<property name="sizeIncrement">
<size>
<width>220</width>
<height>0</height>
</size>
<layout class="QHBoxLayout" name="horizontalLayout_6">
<property name="spacing">
<number>6</number>
</property>
<property name="leftMargin">
<number>9</number>
</property>
<property name="topMargin">
<number>4</number>
</property>
<property name="rightMargin">
<number>9</number>
</property>
<property name="bottomMargin">
<number>4</number>
</property>
<item>
<widget class="QCheckBox" name="antispam_favorSignedIds">
<property name="toolTip">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;This makes the media increase the reputation threshold to 0.4 for anonymous ids, while keeping it to 0.0 for PGP-linked ids. Therefore, anonymous ids can still post, if their local reputation score is above that threshold.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="text">
<string>Favor PGP-signed ids</string>
</property>
</widget>
</item>
<item>
<widget class="QRadioButton" name="antispam_keepTrackOfPosts">
<property name="toolTip">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p align=&quot;justify&quot;&gt;This feature allows Retroshare to locally keep a record of who forwarded each message to you, for the last 10 days. Although useless if alone (and already available whatsoever) this information can be used by a group of collaborative friends to easily locate the source of spams. To be used with care, since it significantly decreases the anonymity of message posts.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="text">
<string>Keep track of posts</string>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_8">
<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>
<item>
<widget class="QFrame" name="extraFrame">
<property name="frameShape">
<enum>QFrame::StyledPanel</enum>
</property>
<property name="baseSize">
<size>
<width>0</width>
<height>0</height>
</size>
<property name="frameShadow">
<enum>QFrame::Raised</enum>
</property>
<property name="toolTip">
<string>check peers you would like to share private publish key with</string>
</property>
<property name="floating">
<bool>false</bool>
</property>
<property name="features">
<set>QDockWidget::NoDockWidgetFeatures</set>
</property>
<property name="windowTitle">
<string>Share Key With</string>
</property>
<widget class="QWidget" name="dockWidgetContents">
<layout class="QGridLayout" name="_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="spacing">
<number>0</number>
</property>
<item row="0" column="0">
<widget class="FriendSelectionWidget" name="keyShareList" native="true">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Expanding">
<horstretch>0</horstretch>
<verstretch>4</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>20</width>
<height>0</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>300</width>
<height>16777215</height>
</size>
</property>
<property name="sizeIncrement">
<size>
<width>220</width>
<height>0</height>
</size>
</property>
<property name="baseSize">
<size>
<width>200</width>
<height>0</height>
</size>
</property>
</widget>
</item>
</layout>
</widget>
</widget>
</item>
</layout>
@ -620,16 +617,7 @@
<string/>
</property>
<layout class="QGridLayout" name="gridLayout_2">
<property name="leftMargin">
<number>6</number>
</property>
<property name="topMargin">
<number>6</number>
</property>
<property name="rightMargin">
<number>6</number>
</property>
<property name="bottomMargin">
<property name="margin">
<number>6</number>
</property>
<item row="0" column="1">
@ -726,16 +714,7 @@
<property name="spacing">
<number>6</number>
</property>
<property name="leftMargin">
<number>6</number>
</property>
<property name="topMargin">
<number>6</number>
</property>
<property name="rightMargin">
<number>6</number>
</property>
<property name="bottomMargin">
<property name="margin">
<number>6</number>
</property>
<item>

View file

@ -27,6 +27,7 @@
#include "gui/Identity/IdEditDialog.h"
#include <QSortFilterProxyModel>
#include <QStandardItemModel>
#include <algorithm>
#include <retroshare/rspeers.h>
@ -140,7 +141,6 @@ static void loadPrivateIdsCallback(GxsIdDetailsType type, const RsIdentityDetail
switch (type) {
case GXS_ID_DETAILS_TYPE_EMPTY:
case GXS_ID_DETAILS_TYPE_FAILED:
// icons = ;
break;
case GXS_ID_DETAILS_TYPE_LOADING:
@ -160,11 +160,39 @@ static void loadPrivateIdsCallback(GxsIdDetailsType type, const RsIdentityDetail
chooser->setItemData(index, (type == GXS_ID_DETAILS_TYPE_DONE) ? TYPE_FOUND_ID : TYPE_UNKNOWN_ID, ROLE_TYPE);
chooser->setItemIcon(index, icons.empty() ? QIcon() : icons[0]);
std::cerr << "ID=" << details.mId << ", chooser->flags()=" << chooser->flags() << ", pgpLinked=" << details.mPgpLinked ;
if((chooser->flags() & IDCHOOSER_NON_ANONYMOUS) && !(details.mPgpLinked))
{
std::cerr << " - disabling ID - entry = " << index << std::endl;
chooser->setEntryEnabled(index,false) ;
}
std::cerr << std::endl;
chooser->model()->sort(0);
chooser->blockSignals(false) ;
}
void GxsIdChooser::setEntryEnabled(int indx,bool enabled)
{
bool disable = !enabled ;
QSortFilterProxyModel* model = qobject_cast<QSortFilterProxyModel*>(QComboBox::model());
//QStandardItem* item = model->item(index);
QModelIndex ii = model->index(indx,0);
// visually disable by greying out - works only if combobox has been painted already and palette returns the wanted color
//model->setFlags(ii,disable ? (model->flags(ii) & ~(Qt::ItemIsSelectable|Qt::ItemIsEnabled)) : (Qt::ItemIsSelectable|Qt::ItemIsEnabled));
uint32_t v = enabled?(1|32):(0);
// clear item data in order to use default color
//model->setData(ii,disable ? (QComboBox::palette().color(QPalette::Disabled, QPalette::Text)) : QVariant(), Qt::TextColorRole);
model->setData(ii,QVariant(v),Qt::UserRole-1) ;
}
void GxsIdChooser::loadPrivateIds()
{
if (mFirstLoad) {
@ -223,6 +251,8 @@ void GxsIdChooser::loadPrivateIds()
addItem(QIcon(":/images/identity/identity_create_32.png"), str, id);
setItemData(count() - 1, QString("%1_%2").arg(TYPE_CREATE_ID).arg(str), ROLE_SORT);
setItemData(count() - 1, TYPE_CREATE_ID, ROLE_TYPE);
}
setDefaultItem();
emit idsLoaded();
@ -305,7 +335,7 @@ void GxsIdChooser::indexActivated(int index)
int type = itemData(index, ROLE_TYPE).toInt();
if (type == TYPE_CREATE_ID) {
IdEditDialog dlg(this);
dlg.setupNewId(false);
dlg.setupNewId(false, !(mFlags & IDCHOOSER_NON_ANONYMOUS));
if (dlg.exec() == QDialog::Accepted) {
setDefaultId(RsGxsId(dlg.groupId()));
}

View file

@ -37,6 +37,7 @@ class RsGxsUpdateBroadcastBase;
#define IDCHOOSER_ID_REQUIRED 0x0001
#define IDCHOOSER_ANON_DEFAULT 0x0002
#define IDCHOOSER_NO_CREATE 0x0004
#define IDCHOOSER_NON_ANONYMOUS 0x0008
class GxsIdChooser : public QComboBox
{
@ -48,6 +49,7 @@ public:
virtual ~GxsIdChooser();
void setFlags(uint32_t flags) ;
uint32_t flags() const { return mFlags ; }
enum ChosenId_Ret {None, KnowId, UnKnowId, NoId} ;
void loadIds(uint32_t chooserFlags, const RsGxsId &defId);
@ -56,6 +58,7 @@ public:
bool setChosenId(const RsGxsId &gxsId);
ChosenId_Ret getChosenId(RsGxsId &gxsId);
void setEntryEnabled(int index, bool enabled);
signals:
// emitted after first load of own ids
void idsLoaded();
@ -71,13 +74,13 @@ private slots:
private:
void loadPrivateIds();
void setDefaultItem();
void setDefaultItem();
uint32_t mFlags;
RsGxsId mDefaultId;
bool mFirstLoad;
RsGxsUpdateBroadcastBase *mBase;
RsGxsUpdateBroadcastBase *mBase;
};
#endif

View file

@ -121,7 +121,12 @@ void CreateGxsForumMsg::newMsg()
mForumMetaLoaded = false;
/* fill in the available OwnIds for signing */
ui.idChooser->loadIds(IDCHOOSER_ID_REQUIRED, RsGxsId());
std::cerr << "Initing ID chooser. Sign flags = " << std::hex << mForumMeta.mSignFlags << std::dec << std::endl;
if(mForumMeta.mSignFlags & GXS_SERV::FLAG_AUTHOR_AUTHENTICATION_GPG)
ui.idChooser->loadIds(IDCHOOSER_ID_REQUIRED | IDCHOOSER_NON_ANONYMOUS, RsGxsId());
else
ui.idChooser->loadIds(IDCHOOSER_ID_REQUIRED, RsGxsId());
if (mForumId.isNull()) {
mStateHelper->setActive(CREATEGXSFORUMMSG_FORUMINFO, false);
@ -203,6 +208,13 @@ void CreateGxsForumMsg::loadFormInformation()
std::cerr << "CreateGxsForumMsg::loadMsgInformation() Data Available!";
std::cerr << std::endl;
std::cerr << "CreateGxsForumMsg::loadMsgInformation() using signFlags=" << std::hex << mForumMeta.mSignFlags << std::dec << std::endl;
if(mForumMeta.mSignFlags & GXS_SERV::FLAG_AUTHOR_AUTHENTICATION_GPG)
ui.idChooser->setFlags(IDCHOOSER_ID_REQUIRED | IDCHOOSER_NON_ANONYMOUS) ;
else
ui.idChooser->setFlags(IDCHOOSER_ID_REQUIRED) ;
QString name = QString::fromUtf8(mForumMeta.mGroupName.c_str());
QString subj;
if (!mParentId.isNull())

View file

@ -33,6 +33,7 @@ const uint32_t ForumCreateEnabledFlags = (
GXS_GROUP_FLAGS_DISTRIBUTION |
// GXS_GROUP_FLAGS_PUBLISHSIGN |
GXS_GROUP_FLAGS_SHAREKEYS |
GXS_GROUP_FLAGS_ANTI_SPAM |
// GXS_GROUP_FLAGS_PERSONALSIGN |
// GXS_GROUP_FLAGS_COMMENTS |
0);
@ -46,7 +47,7 @@ const uint32_t ForumCreateDefaultsFlags = ( GXS_GROUP_DEFAULTS_DISTRIB_PUBLIC
//GXS_GROUP_DEFAULTS_PUBLISH_REQUIRED |
//GXS_GROUP_DEFAULTS_PUBLISH_ENCRYPTED |
//GXS_GROUP_DEFAULTS_PERSONAL_GPG |
//GXS_GROUP_DEFAULTS_PERSONAL_PGP |
GXS_GROUP_DEFAULTS_PERSONAL_REQUIRED |
//GXS_GROUP_DEFAULTS_PERSONAL_IFNOPUB |

View file

@ -41,6 +41,7 @@
#include "util/QtVersion.h"
#include <retroshare/rsgxsforums.h>
#include <retroshare/rsgrouter.h>
#include <retroshare/rsreputations.h>
#include <retroshare/rspeers.h>
// These should be in retroshare/ folder.
@ -547,6 +548,17 @@ void GxsForumThreadWidget::changedThread()
mThreadId = RsGxsMessageId(item->data(COLUMN_THREAD_DATA, ROLE_THREAD_MSGID).toString().toStdString());
}
// Show info about who passed on this message.
if(mForumGroup.mMeta.mSignFlags & GXS_SERV::FLAG_AUTHOR_AUTHENTICATION_TRACK_MESSAGES)
{
RsPeerId providerId ;
std::string msgId = item->data(COLUMN_THREAD_DATA, ROLE_THREAD_MSGID).toString().toStdString();
RsGxsMessageId mid(msgId) ;
if(rsGRouter->getTrackingInfo(mid,providerId) && !providerId.isNull() )
item->setToolTip(COLUMN_THREAD_TITLE,tr("This message was obtained from %1").arg(QString::fromUtf8(rsPeers->getPeerName(providerId).c_str())));
}
if (mFillThread) {
return;
}
@ -744,12 +756,26 @@ void GxsForumThreadWidget::insertGroupData()
const RsGxsForumGroup& group = tw->mForumGroup;
tw->mSubscribeFlags = group.mMeta.mSubscribeFlags;
tw->mSignFlags = group.mMeta.mSignFlags;
tw->ui->forumName->setText(QString::fromUtf8(group.mMeta.mGroupName.c_str()));
QString anti_spam_features1 ;
if(IS_GROUP_PGP_AUTHED(tw->mSignFlags)) anti_spam_features1 = tr("Anonymous IDs reputation threshold set to 0.4");
QString anti_spam_features2 ;
if(IS_GROUP_MESSAGE_TRACKING(tw->mSignFlags)) anti_spam_features2 = tr("Message routing info kept for 10 days");
tw->mForumDescription = QString("<b>%1: \t</b>%2<br/>").arg(tr("Forum name"), QString::fromUtf8( group.mMeta.mGroupName.c_str()));
tw->mForumDescription += QString("<b>%1: \t</b>%2<br/>").arg(tr("Subscribers")).arg(group.mMeta.mPop);
tw->mForumDescription += QString("<b>%1: \t</b>%2<br/>").arg(tr("Posts (at neighbor nodes)")).arg(group.mMeta.mVisibleMsgCount);
tw->mForumDescription += QString("<b>%1: \t</b>%2<br/>").arg(tr("Author"), author);
if(!anti_spam_features1.isNull())
tw->mForumDescription += QString("<b>%1: \t</b>%2<br/>").arg(tr("Anti-spam")).arg(anti_spam_features1);
if(!anti_spam_features2.isNull())
tw->mForumDescription += QString("<b>%1: \t</b>%2<br/>").arg(tr("Anti-spam")).arg(anti_spam_features2);
tw->mForumDescription += QString("<b>%1: </b><br/><br/>%2").arg(tr("Description"), QString::fromUtf8(group.mDescription.c_str()));
tw->ui->subscribeToolButton->setSubscribed(IS_GROUP_SUBSCRIBED(tw->mSubscribeFlags));
@ -936,6 +962,7 @@ QTreeWidgetItem *GxsForumThreadWidget::convertMsgToThreadWidget(const RsGxsForum
// Set later with GxsIdRSTreeWidgetItem::setId
item->setData(COLUMN_THREAD_DATA, ROLE_THREAD_AUTHOR, QString::fromStdString(msg.mMeta.mAuthorId.toStdString()));
//#TODO
#if 0
text = QString::fromUtf8(authorName.c_str());
@ -1863,6 +1890,7 @@ bool GxsForumThreadWidget::filterItem(QTreeWidgetItem *item, const QString &text
void GxsForumThreadWidget::requestGroupData()
{
mSubscribeFlags = 0;
mSignFlags = 0;
mForumDescription.clear();
mTokenQueue->cancelActiveRequestTokens(mTokenTypeGroupData);

View file

@ -149,6 +149,7 @@ private:
RsGxsForumGroup mForumGroup;
QString mForumDescription;
int mSubscribeFlags;
int mSignFlags;
bool mInProcessSettings;
bool mInMsgAsReadUnread;
int mLastViewType;

View file

@ -178,8 +178,9 @@ void GxsForumsDialog::groupInfoToGroupItemInfo(const RsGroupMetaData &groupInfo,
groupItemInfo.description = descriptionIt.value();
}
if (IS_GROUP_ADMIN(groupInfo.mSubscribeFlags)) {
groupItemInfo.icon = QIcon(":images/konv_message2.png");
}
if (IS_GROUP_ADMIN(groupInfo.mSubscribeFlags))
groupItemInfo.icon = QIcon(":images/konv_message2.png");
else if ((IS_GROUP_PGP_AUTHED(groupInfo.mSignFlags)) || (IS_GROUP_MESSAGE_TRACKING(groupInfo.mSignFlags)) )
groupItemInfo.icon = QIcon(":images/konv_message3.png");
}

View file

@ -316,6 +316,7 @@
<file>images/konversation16.png</file>
<file>images/konversation128.png</file>
<file>images/konv_message2.png</file>
<file>images/konv_message3.png</file>
<file>images/konv_message64.png</file>
<file>images/konversation64.png</file>
<file>images/forums_new.png</file>

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB