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 PRIV_GRP_OFFSET 16
#define GRP_OPTIONS_OFFSET 24 #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_IDENTITY = 0x00000010; // identity
static const uint32_t INDEX_AUTHEN_PUBLISH = 0x00000020; // publish key 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, mGroupFlags);
ok &= setRawUInt32(data, tlvsize, &offset, mPublishTs); ok &= setRawUInt32(data, tlvsize, &offset, mPublishTs);
ok &= setRawUInt32(data, tlvsize, &offset, mCircleType); 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 &= mAuthorId.serialise(data, tlvsize, offset);
ok &= SetTlvString(data, tlvsize, &offset, 0, mServiceString); ok &= SetTlvString(data, tlvsize, &offset, 0, mServiceString);
ok &= mCircleId.serialise(data, tlvsize, offset); 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, &mGroupFlags);
ok &= getRawUInt32(data, pktsize, &offset, &mPublishTs); ok &= getRawUInt32(data, pktsize, &offset, &mPublishTs);
ok &= getRawUInt32(data, pktsize, &offset, &mCircleType); 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 &= mAuthorId.deserialise(data, pktsize, offset);
ok &= GetTlvString(data, pktsize, &offset, 0, mServiceString); ok &= GetTlvString(data, pktsize, &offset, 0, mServiceString);
ok &= mCircleId.deserialise(data, pktsize, offset); 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_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_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_ADMIN(subscribeFlags) (subscribeFlags & GXS_SERV::GROUP_SUBSCRIBE_ADMIN)
#define IS_GROUP_PUBLISHER(subscribeFlags) (subscribeFlags & GXS_SERV::GROUP_SUBSCRIBE_PUBLISH) #define IS_GROUP_PUBLISHER(subscribeFlags) (subscribeFlags & GXS_SERV::GROUP_SUBSCRIBE_PUBLISH)
#define IS_GROUP_SUBSCRIBED(subscribeFlags) (subscribeFlags & GXS_SERV::GROUP_SUBSCRIBE_SUBSCRIBED) #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.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(); initMode();
} }
@ -592,15 +596,15 @@ uint32_t GxsGroupDialog::getGroupSignFlags()
} }
// Author Signature. // Author Signature.
if (ui.personal_pgp->isChecked()) { if (ui.personal_pgp->isChecked())
signFlags |= GXS_SERV::FLAG_AUTHOR_AUTHENTICATION_GPG; 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; 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; signFlags |= GXS_SERV::FLAG_AUTHOR_AUTHENTICATION_IFNOPUBSIGN;
} else { // shouldn't allow this one.
signFlags |= GXS_SERV::FLAG_AUTHOR_AUTHENTICATION_NONE;
}
return signFlags; return signFlags;
} }
@ -616,16 +620,14 @@ void GxsGroupDialog::setGroupSignFlags(uint32_t signFlags)
ui.publish_open->setChecked(true); 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); 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); 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); 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 */ /* guess at comments */
if ((signFlags & GXS_SERV::FLAG_GROUP_SIGN_PUBLISH_THREADHEAD) && if ((signFlags & GXS_SERV::FLAG_GROUP_SIGN_PUBLISH_THREADHEAD) &&

View File

@ -733,12 +733,16 @@ void GxsForumThreadWidget::insertGroupData()
const RsGxsForumGroup& group = tw->mForumGroup; const RsGxsForumGroup& group = tw->mForumGroup;
tw->mSubscribeFlags = group.mMeta.mSubscribeFlags; tw->mSubscribeFlags = group.mMeta.mSubscribeFlags;
tw->mSignFlags = group.mMeta.mSignFlags;
tw->ui->forumName->setText(QString::fromUtf8(group.mMeta.mGroupName.c_str())); 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("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("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("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("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->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)); tw->ui->subscribeToolButton->setSubscribed(IS_GROUP_SUBSCRIBED(tw->mSubscribeFlags));
@ -1800,6 +1804,7 @@ bool GxsForumThreadWidget::filterItem(QTreeWidgetItem *item, const QString &text
void GxsForumThreadWidget::requestGroupData() void GxsForumThreadWidget::requestGroupData()
{ {
mSubscribeFlags = 0; mSubscribeFlags = 0;
mSignFlags = 0;
mForumDescription.clear(); mForumDescription.clear();
mTokenQueue->cancelActiveRequestTokens(mTokenTypeGroupData); mTokenQueue->cancelActiveRequestTokens(mTokenTypeGroupData);

View File

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

View File

@ -178,8 +178,9 @@ void GxsForumsDialog::groupInfoToGroupItemInfo(const RsGroupMetaData &groupInfo,
groupItemInfo.description = descriptionIt.value(); groupItemInfo.description = descriptionIt.value();
} }
if (IS_GROUP_ADMIN(groupInfo.mSubscribeFlags)) { if (IS_GROUP_ADMIN(groupInfo.mSubscribeFlags))
groupItemInfo.icon = QIcon(":images/konv_message2.png"); 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/konversation16.png</file>
<file>images/konversation128.png</file> <file>images/konversation128.png</file>
<file>images/konv_message2.png</file> <file>images/konv_message2.png</file>
<file>images/konv_message3.png</file>
<file>images/konv_message64.png</file> <file>images/konv_message64.png</file>
<file>images/konversation64.png</file> <file>images/konversation64.png</file>
<file>images/forums_new.png</file> <file>images/forums_new.png</file>

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB