added GUI support for non anon forums. Changed serialisation of GxsGroupMetaData so that mSignFlags is serialised in place of mAuthenFlag, which is not used anyway

This commit is contained in:
csoler 2015-10-24 00:22:55 -04:00
parent a6851b63dc
commit febd348d24
9 changed files with 34 additions and 20 deletions

View File

@ -49,7 +49,9 @@
#define PRIV_GRP_OFFSET 16
#define GRP_OPTIONS_OFFSET 24
/** authentication key indices. Used to store them in a map **/
// Authentication key indices. Used to store them in a map
// these where originally flags, but used as indexes. Still, we need
// to keep their old values to ensure backward compatibility.
static const uint32_t INDEX_AUTHEN_IDENTITY = 0x00000010; // identity
static const uint32_t INDEX_AUTHEN_PUBLISH = 0x00000020; // publish key

View File

@ -122,7 +122,7 @@ bool RsGxsGrpMetaData::serialise(void *data, uint32_t &pktsize)
ok &= setRawUInt32(data, tlvsize, &offset, mGroupFlags);
ok &= setRawUInt32(data, tlvsize, &offset, mPublishTs);
ok &= setRawUInt32(data, tlvsize, &offset, mCircleType);
ok &= setRawUInt32(data, tlvsize, &offset, mAuthenFlags);
ok &= setRawUInt32(data, tlvsize, &offset, mSignFlags);
ok &= mAuthorId.serialise(data, tlvsize, offset);
ok &= SetTlvString(data, tlvsize, &offset, 0, mServiceString);
ok &= mCircleId.serialise(data, tlvsize, offset);
@ -153,7 +153,7 @@ bool RsGxsGrpMetaData::deserialise(void *data, uint32_t &pktsize)
ok &= getRawUInt32(data, pktsize, &offset, &mGroupFlags);
ok &= getRawUInt32(data, pktsize, &offset, &mPublishTs);
ok &= getRawUInt32(data, pktsize, &offset, &mCircleType);
ok &= getRawUInt32(data, pktsize, &offset, &mAuthenFlags);
ok &= getRawUInt32(data, pktsize, &offset, &mSignFlags);
ok &= mAuthorId.deserialise(data, pktsize, offset);
ok &= GetTlvString(data, pktsize, &offset, 0, mServiceString);
ok &= mCircleId.deserialise(data, pktsize, offset);

View File

@ -102,6 +102,8 @@ namespace GXS_SERV {
#define IS_MSG_NEW(status) (status & GXS_SERV::GXS_MSG_STATUS_GUI_NEW)
#define IS_MSG_UNREAD(status) (status & GXS_SERV::GXS_MSG_STATUS_GUI_UNREAD)
#define IS_GROUP_PGP_AUTHED(signFlags) (signFlags & GXS_SERV::FLAG_AUTHOR_AUTHENTICATION_GPG)
#define IS_GROUP_ADMIN(subscribeFlags) (subscribeFlags & GXS_SERV::GROUP_SUBSCRIBE_ADMIN)
#define IS_GROUP_PUBLISHER(subscribeFlags) (subscribeFlags & GXS_SERV::GROUP_SUBSCRIBE_PUBLISH)
#define IS_GROUP_SUBSCRIBED(subscribeFlags) (subscribeFlags & GXS_SERV::GROUP_SUBSCRIBE_SUBSCRIBED)

View File

@ -129,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();
}
@ -592,15 +596,15 @@ uint32_t GxsGroupDialog::getGroupSignFlags()
}
// Author Signature.
if (ui.personal_pgp->isChecked()) {
if (ui.personal_pgp->isChecked())
signFlags |= GXS_SERV::FLAG_AUTHOR_AUTHENTICATION_GPG;
} else if (ui.personal_required->isChecked()) {
if (ui.personal_required->isChecked())
signFlags |= GXS_SERV::FLAG_AUTHOR_AUTHENTICATION_REQUIRED;
} else if (ui.personal_ifnopub->isChecked()) {
if (ui.personal_ifnopub->isChecked())
signFlags |= GXS_SERV::FLAG_AUTHOR_AUTHENTICATION_IFNOPUBSIGN;
} else { // shouldn't allow this one.
signFlags |= GXS_SERV::FLAG_AUTHOR_AUTHENTICATION_NONE;
}
return signFlags;
}
@ -616,17 +620,15 @@ void GxsGroupDialog::setGroupSignFlags(uint32_t signFlags)
ui.publish_open->setChecked(true);
}
if (signFlags & GXS_SERV::FLAG_AUTHOR_AUTHENTICATION_GPG) {
if (signFlags & GXS_SERV::FLAG_AUTHOR_AUTHENTICATION_GPG)
ui.personal_pgp->setChecked(true);
} else if (signFlags & GXS_SERV::FLAG_AUTHOR_AUTHENTICATION_REQUIRED) {
if (signFlags & GXS_SERV::FLAG_AUTHOR_AUTHENTICATION_REQUIRED)
ui.personal_required->setChecked(true);
} else if (signFlags & GXS_SERV::FLAG_AUTHOR_AUTHENTICATION_IFNOPUBSIGN) {
if (signFlags & GXS_SERV::FLAG_AUTHOR_AUTHENTICATION_IFNOPUBSIGN)
ui.personal_ifnopub->setChecked(true);
} else if (signFlags & GXS_SERV::FLAG_AUTHOR_AUTHENTICATION_NONE) {
// Its the same... but not quite.
//ui.personal_noifpub->setChecked();
}
/* guess at comments */
if ((signFlags & GXS_SERV::FLAG_GROUP_SIGN_PUBLISH_THREADHEAD) &&
(signFlags & GXS_SERV::FLAG_AUTHOR_AUTHENTICATION_IFNOPUBSIGN))

View File

@ -733,12 +733,16 @@ 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 anon_allowed_str = (IS_GROUP_PGP_AUTHED(tw->mSignFlags))?tr("No"):tr("Yes") ;
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);
tw->mForumDescription += QString("<b>%1: \t</b>%2<br/>").arg(tr("Anonymous post allowed")).arg(anon_allowed_str);
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));
@ -1800,6 +1804,7 @@ bool GxsForumThreadWidget::filterItem(QTreeWidgetItem *item, const QString &text
void GxsForumThreadWidget::requestGroupData()
{
mSubscribeFlags = 0;
mSignFlags = 0;
mForumDescription.clear();
mTokenQueue->cancelActiveRequestTokens(mTokenTypeGroupData);

View File

@ -147,6 +147,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))
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