From 3d4920f73fd7dfe54be31ee4093431cc2538c68c Mon Sep 17 00:00:00 2001 From: drbob Date: Sat, 6 Dec 2008 00:30:56 +0000 Subject: [PATCH] Gui modifications to support authenticated forums. git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@868 b45a01b8-16f6-495d-af2f-9b41ad6348cc --- retroshare-gui/src/gui/ForumsDialog.cpp | 33 +++++++++++++++---- retroshare-gui/src/gui/forums/CreateForum.cpp | 2 +- .../src/gui/forums/CreateForumMsg.cpp | 17 ++++++++++ retroshare-gui/src/rsiface/rsforums.h | 2 ++ 4 files changed, 46 insertions(+), 8 deletions(-) diff --git a/retroshare-gui/src/gui/ForumsDialog.cpp b/retroshare-gui/src/gui/ForumsDialog.cpp index e7fc9c15d..5f344da90 100644 --- a/retroshare-gui/src/gui/ForumsDialog.cpp +++ b/retroshare-gui/src/gui/ForumsDialog.cpp @@ -295,7 +295,7 @@ void ForumsDialog::insertForums() for(it = forumList.begin(); it != forumList.end(); it++) { /* sort it into Publish (Own), Subscribed, Popular and Other */ - uint32_t flags = it->forumFlags; + uint32_t flags = it->subscribeFlags; if (flags & RS_DISTRIB_ADMIN) { @@ -310,7 +310,13 @@ void ForumsDialog::insertForums() QTreeWidgetItem *item = new QTreeWidgetItem((QTreeWidget*)0); - item -> setText(0, QString::fromStdWString(it->forumName)); + QString name = QString::fromStdWString(it->forumName); + if (it->forumFlags & RS_DISTRIB_AUTHEN_REQ) + { + name += " (AUTHD)"; + } + item -> setText(0, name); + /* (1) Popularity */ { std::ostringstream out; @@ -344,7 +350,13 @@ void ForumsDialog::insertForums() QTreeWidgetItem *item = new QTreeWidgetItem((QTreeWidget*)0); - item -> setText(0, QString::fromStdWString(it->forumName)); + QString name = QString::fromStdWString(it->forumName); + if (it->forumFlags & RS_DISTRIB_AUTHEN_REQ) + { + name += " (AUTHD)"; + } + item -> setText(0, name); + /* (1) Popularity */ { std::ostringstream out; @@ -391,7 +403,7 @@ void ForumsDialog::insertForums() for(it = forumList.begin(); it != forumList.end(); it++) { /* ignore the ones we've done already */ - uint32_t flags = it->forumFlags; + uint32_t flags = it->subscribeFlags; if (flags & RS_DISTRIB_ADMIN) { @@ -412,7 +424,13 @@ void ForumsDialog::insertForums() QTreeWidgetItem *item = new QTreeWidgetItem((QTreeWidget*)0); - item -> setText(0, QString::fromStdWString(it->forumName)); + QString name = QString::fromStdWString(it->forumName); + if (it->forumFlags & RS_DISTRIB_AUTHEN_REQ) + { + name += " (AUTHD)"; + } + item -> setText(0, name); + /* (1) Popularity */ { std::ostringstream out; @@ -577,7 +595,7 @@ void ForumsDialog::insertThreads() rsForums->getForumMessage(fId,tit->msgId,msginfo) ; item->setText(1, QString::fromStdWString(tit->title)); - item->setText(2, QString::fromStdString(msginfo.srcId)); + item->setText(2, QString::fromStdString(rsPeers->getPeerName(msginfo.srcId))); item->setText(3, "signed"); item->setText(4, QString::fromStdString(tit->parentId)); item->setText(5, QString::fromStdString(tit->msgId)); @@ -629,7 +647,8 @@ void ForumsDialog::insertThreads() rsForums->getForumMessage(fId,mit->msgId,msginfo) ; child->setText(1, QString::fromStdWString(mit->title)); - child->setText(2, QString::fromStdString(msginfo.srcId)); + //child->setText(2, QString::fromStdString(msginfo.srcId)); + child->setText(2, QString::fromStdString(rsPeers->getPeerName(msginfo.srcId))); child->setText(3, "signed"); child->setText(4, QString::fromStdString(mit->parentId)); child->setText(5, QString::fromStdString(mit->msgId)); diff --git a/retroshare-gui/src/gui/forums/CreateForum.cpp b/retroshare-gui/src/gui/forums/CreateForum.cpp index 855789cc3..346b8552a 100644 --- a/retroshare-gui/src/gui/forums/CreateForum.cpp +++ b/retroshare-gui/src/gui/forums/CreateForum.cpp @@ -63,7 +63,7 @@ void CreateForum::newForum() ui.typeEncrypted->setEnabled(false); ui.msgAnon->setChecked(true); - ui.msgAuth->setEnabled(false); + //ui.msgAuth->setEnabled(false); } else { diff --git a/retroshare-gui/src/gui/forums/CreateForumMsg.cpp b/retroshare-gui/src/gui/forums/CreateForumMsg.cpp index acfef6004..c212689ec 100644 --- a/retroshare-gui/src/gui/forums/CreateForumMsg.cpp +++ b/retroshare-gui/src/gui/forums/CreateForumMsg.cpp @@ -65,6 +65,18 @@ void CreateForumMsg::newMsg() ui.forumName->setText(name); ui.forumSubject->setText(subj); + + if (fi.forumFlags & RS_DISTRIB_AUTHEN_REQ) + { + ui.signBox->setChecked(true); + //ui.signBox->setEnabled(false); + // For Testing. + ui.signBox->setEnabled(true); + } + else + { + ui.signBox->setEnabled(true); + } } ui.forumMessage->setText(""); @@ -86,6 +98,11 @@ void CreateForumMsg::createMsg() msgInfo.title = name.toStdWString(); msgInfo.msg = desc.toStdWString(); + if (ui.signBox->isChecked()) + { + msgInfo.msgflags = RS_DISTRIB_AUTHEN_REQ; + } + if ((msgInfo.msg == L"") && (msgInfo.title == L"")) return; /* do nothing */ diff --git a/retroshare-gui/src/rsiface/rsforums.h b/retroshare-gui/src/rsiface/rsforums.h index 751f76d31..a5402f482 100644 --- a/retroshare-gui/src/rsiface/rsforums.h +++ b/retroshare-gui/src/rsiface/rsforums.h @@ -43,6 +43,8 @@ class ForumInfo std::wstring forumDesc; uint32_t forumFlags; + uint32_t subscribeFlags; + uint32_t pop; time_t lastPost;