mirror of
https://github.com/RetroShare/RetroShare.git
synced 2024-12-24 23:19:29 -05:00
added key restore to forums and fixed restore bug
git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@4023 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
parent
17a57e0509
commit
bbcbc9282e
@ -145,7 +145,7 @@ virtual bool getForumMessage(const std::string &fId, const std::string &mId, For
|
||||
virtual bool setMessageStatus(const std::string& fId,const std::string& mId, const uint32_t status, const uint32_t statusMask) = 0;
|
||||
virtual bool getMessageStatus(const std::string& fId, const std::string& mId, uint32_t& status) = 0;
|
||||
virtual bool ForumMessageSend(ForumMsgInfo &info) = 0;
|
||||
|
||||
virtual bool forumRestoreKeys(const std::string& fId) = 0;
|
||||
virtual bool forumSubscribe(const std::string &fId, bool subscribe) = 0;
|
||||
|
||||
virtual bool getMessageCount(const std::string &fId, unsigned int &newCount, unsigned int &unreadCount) = 0;
|
||||
|
@ -2041,7 +2041,7 @@ bool p3GroupDistrib::backUpKeys(const std::list<RsDistribGrpKey* >& keysToBackUp
|
||||
|
||||
}
|
||||
|
||||
delete store;
|
||||
delete store;
|
||||
|
||||
if(!RsDirUtil::renameFile(filenametmp,filename))
|
||||
{
|
||||
@ -2058,7 +2058,7 @@ bool p3GroupDistrib::backUpKeys(const std::list<RsDistribGrpKey* >& keysToBackUp
|
||||
return ok;
|
||||
}
|
||||
|
||||
bool p3GroupDistrib::restoreGrpKeys(std::string grpId){
|
||||
bool p3GroupDistrib::restoreGrpKeys(const std::string& grpId){
|
||||
|
||||
|
||||
#ifdef DISTRIB_DEBUG
|
||||
@ -2077,6 +2077,7 @@ bool p3GroupDistrib::restoreGrpKeys(std::string grpId){
|
||||
RsItem* item;
|
||||
bool ok = true;
|
||||
bool itemAttempted = false;
|
||||
RsDistribGrpKey* key = NULL;
|
||||
|
||||
RsStackMutex stack(distribMtx);
|
||||
|
||||
@ -2086,7 +2087,7 @@ bool p3GroupDistrib::restoreGrpKeys(std::string grpId){
|
||||
while(NULL != (item = store->GetItem())){
|
||||
|
||||
itemAttempted = true;
|
||||
RsDistribGrpKey* key = dynamic_cast<RsDistribGrpKey* >(item);
|
||||
key = dynamic_cast<RsDistribGrpKey* >(item);
|
||||
|
||||
if(key == NULL){
|
||||
#ifdef DISTRIB_DEBUG
|
||||
@ -2097,20 +2098,14 @@ bool p3GroupDistrib::restoreGrpKeys(std::string grpId){
|
||||
return false;
|
||||
}
|
||||
|
||||
if(key->key.keyFlags & RSTLV_KEY_DISTRIB_ADMIN){
|
||||
|
||||
if(key->key.keyFlags & RSTLV_KEY_DISTRIB_ADMIN)
|
||||
ok &= locked_updateGroupAdminKey(*gi, key);
|
||||
|
||||
}else
|
||||
if((key->key.keyFlags & RSTLV_KEY_DISTRIB_PRIVATE)){
|
||||
|
||||
else if((key->key.keyFlags & RSTLV_KEY_DISTRIB_PRIVATE) ||
|
||||
(key->key.keyFlags & RSTLV_KEY_DISTRIB_PUBLIC))
|
||||
ok &= locked_updateGroupPublishKey(*gi, key);
|
||||
|
||||
}else{
|
||||
|
||||
else
|
||||
ok &= false;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -552,7 +552,7 @@ class p3GroupDistrib: public CacheSource, public CacheStore, public p3Config, pu
|
||||
* @param grpId the grpId id for which backup keys should be restored
|
||||
* @return false if failed and vice versa
|
||||
*/
|
||||
virtual bool restoreGrpKeys(std::string grpId); /// restores a group keys from backup
|
||||
virtual bool restoreGrpKeys(const std::string& grpId); /// restores a group keys from backup
|
||||
|
||||
/**
|
||||
* Allows user to send keys to a list of peers
|
||||
|
@ -431,6 +431,11 @@ bool p3Forums::getMessageStatus(const std::string& fId, const std::string& mId,
|
||||
return false;
|
||||
}
|
||||
|
||||
bool p3Forums::forumRestoreKeys(const std::string& fIds)
|
||||
{
|
||||
return p3GroupDistrib::restoreGrpKeys(fIds);
|
||||
}
|
||||
|
||||
|
||||
std::string p3Forums::createForum(const std::wstring &forumName, const std::wstring &forumDesc, uint32_t forumFlags)
|
||||
{
|
||||
|
@ -58,6 +58,7 @@ virtual bool getForumMessage(const std::string &fId, const std::string &mId, For
|
||||
virtual bool ForumMessageSend(ForumMsgInfo &info);
|
||||
virtual bool setMessageStatus(const std::string& fId, const std::string& mId, const uint32_t status, const uint32_t statusMask);
|
||||
virtual bool getMessageStatus(const std::string& fId, const std::string& mId, uint32_t& status);
|
||||
virtual bool forumRestoreKeys(const std::string& fId);
|
||||
|
||||
virtual bool forumSubscribe(const std::string &fId, bool subscribe);
|
||||
|
||||
|
@ -273,6 +273,8 @@ void ForumsDialog::forumListCustomPopupMenu( QPoint point )
|
||||
action = contextMnu.addAction(QIcon(IMAGE_UNSUBSCRIBE), tr("Unsubscribe to Forum"), this, SLOT(unsubscribeToForum()));
|
||||
action->setEnabled (!mCurrForumId.empty() && m_bIsForumSubscribed);
|
||||
|
||||
|
||||
|
||||
contextMnu.addSeparator();
|
||||
|
||||
contextMnu.addAction(QIcon(IMAGE_NEWFORUM), tr("New Forum"), this, SLOT(newforum()));
|
||||
@ -283,6 +285,13 @@ void ForumsDialog::forumListCustomPopupMenu( QPoint point )
|
||||
action = contextMnu.addAction(QIcon(":/images/settings16.png"), tr("Edit Forum Details"), this, SLOT(editForumDetails()));
|
||||
action->setEnabled (!mCurrForumId.empty () && m_bIsForumAdmin);
|
||||
|
||||
|
||||
QAction *restoreKeysAct = new QAction(QIcon(":/images/settings16.png"), tr("Restore Publish Rights for Forum" ), &contextMnu);
|
||||
connect( restoreKeysAct , SIGNAL( triggered() ), this, SLOT( restoreForumKeys() ) );
|
||||
|
||||
restoreKeysAct->setEnabled(!mCurrForumId.empty() && !m_bIsForumAdmin);
|
||||
contextMnu.addAction( restoreKeysAct);
|
||||
|
||||
contextMnu.addSeparator();
|
||||
|
||||
action = contextMnu.addAction(QIcon(":/images/message-mail-read.png"), tr("Mark all as read"), this, SLOT(markMsgAsReadAll()));
|
||||
@ -326,6 +335,8 @@ void ForumsDialog::threadListCustomPopupMenu( QPoint point )
|
||||
QAction *markMsgAsUnreadChildren = new QAction(QIcon(":/images/message-mail.png"), tr("Mark as unread") + " (" + tr ("with children") + ")", &contextMnu);
|
||||
connect(markMsgAsUnreadChildren , SIGNAL(triggered()), this, SLOT(markMsgAsUnreadChildren()));
|
||||
|
||||
|
||||
|
||||
if (m_bIsForumSubscribed) {
|
||||
QList<QTreeWidgetItem*> Rows;
|
||||
QList<QTreeWidgetItem*> RowsRead;
|
||||
@ -385,6 +396,11 @@ void ForumsDialog::threadListCustomPopupMenu( QPoint point )
|
||||
contextMnu.exec(QCursor::pos());
|
||||
}
|
||||
|
||||
void ForumsDialog::restoreForumKeys(void)
|
||||
{
|
||||
rsForums->forumRestoreKeys(mCurrForumId);
|
||||
}
|
||||
|
||||
void ForumsDialog::togglethreadview()
|
||||
{
|
||||
// save state of button
|
||||
|
@ -43,7 +43,7 @@ private slots:
|
||||
/** Create the context popup menu and it's submenus */
|
||||
void forumListCustomPopupMenu( QPoint point );
|
||||
void threadListCustomPopupMenu( QPoint point );
|
||||
|
||||
void restoreForumKeys();
|
||||
void newforum();
|
||||
|
||||
void changedForum(const QString &id);
|
||||
|
Loading…
Reference in New Issue
Block a user