mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-05-02 06:06:10 -04: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
7 changed files with 33 additions and 16 deletions
|
@ -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);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue