mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-05-04 23:25:32 -04:00
addednew flag for anonymous search. Merged the two browsable flags in one single flag.
This commit is contained in:
parent
5b9ef04358
commit
e8e054eeae
14 changed files with 99 additions and 128 deletions
|
@ -338,7 +338,7 @@ bool p3FileDatabase::loadList(std::list<RsItem *>& load)
|
|||
/* for each item, check it exists ....
|
||||
* - remove any that are dead (or flag?)
|
||||
*/
|
||||
static const FileStorageFlags PERMISSION_MASK = DIR_FLAGS_BROWSABLE_OTHERS | DIR_FLAGS_NETWORK_WIDE_OTHERS | DIR_FLAGS_BROWSABLE_GROUPS | DIR_FLAGS_NETWORK_WIDE_GROUPS ;
|
||||
static const FileStorageFlags PERMISSION_MASK = DIR_FLAGS_PERMISSIONS_MASK;
|
||||
|
||||
#ifdef DEBUG_FILE_HIERARCHY
|
||||
P3FILELISTS_DEBUG() << "Load list" << std::endl;
|
||||
|
@ -388,7 +388,6 @@ bool p3FileDatabase::loadList(std::list<RsItem *>& load)
|
|||
info.virtualname = fi->file.name;
|
||||
info.shareflags = FileStorageFlags(fi->flags) ;
|
||||
info.shareflags &= PERMISSION_MASK ;
|
||||
info.shareflags &= ~DIR_FLAGS_NETWORK_WIDE_GROUPS ; // disabling this flag for know, for consistency reasons
|
||||
|
||||
for(std::set<RsNodeGroupId>::const_iterator itt(fi->parent_groups.ids.begin());itt!=fi->parent_groups.ids.end();++itt)
|
||||
info.parent_groups.push_back(*itt) ;
|
||||
|
|
|
@ -1611,7 +1611,7 @@ bool ftController::FileDetails(const RsFileHash &hash, FileInfo &info)
|
|||
info.queue_position = it->second->mQueuePosition ;
|
||||
|
||||
if(it->second->mFlags & RS_FILE_REQ_ANONYMOUS_ROUTING)
|
||||
info.storage_permission_flags |= DIR_FLAGS_NETWORK_WIDE_OTHERS ; // file being downloaded anonymously are always anonymously available.
|
||||
info.storage_permission_flags |= DIR_FLAGS_ANONYMOUS_DOWNLOAD ; // file being downloaded anonymously are always anonymously available.
|
||||
|
||||
/* get list of sources from transferModule */
|
||||
std::list<RsPeerId> peerIds;
|
||||
|
|
|
@ -350,9 +350,10 @@ bool ftExtraList::search(const RsFileHash &hash, FileSearchFlags /*hintflags*
|
|||
|
||||
// Now setup the file storage flags so that the client can know how to handle permissions
|
||||
//
|
||||
info.storage_permission_flags = DIR_FLAGS_BROWSABLE_OTHERS ;
|
||||
#warning make sure this is right
|
||||
info.storage_permission_flags = FileStorageFlags(0) ;//DIR_FLAGS_BROWSABLE_OTHERS ;
|
||||
|
||||
if(info.transfer_info_flags & RS_FILE_REQ_ANONYMOUS_ROUTING) info.storage_permission_flags |= DIR_FLAGS_NETWORK_WIDE_OTHERS ;
|
||||
if(info.transfer_info_flags & RS_FILE_REQ_ANONYMOUS_ROUTING) info.storage_permission_flags |= DIR_FLAGS_ANONYMOUS_DOWNLOAD ;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -644,7 +644,7 @@ int ftServer::RequestDirDetails(void *ref, DirDetails &details, FileSearchFlags
|
|||
{
|
||||
return mFileDatabase->RequestDirDetails(ref,details,flags) ;
|
||||
}
|
||||
uint32_t ftServer::getType(void *ref, FileSearchFlags flags)
|
||||
uint32_t ftServer::getType(void *ref, FileSearchFlags /* flags */)
|
||||
{
|
||||
return mFileDatabase->getType(ref) ;
|
||||
}
|
||||
|
@ -797,7 +797,7 @@ bool ftServer::shareDownloadDirectory(bool share)
|
|||
/* Share */
|
||||
SharedDirInfo inf ;
|
||||
inf.filename = mFtController->getDownloadDirectory();
|
||||
inf.shareflags = DIR_FLAGS_NETWORK_WIDE_OTHERS ;
|
||||
inf.shareflags = DIR_FLAGS_ANONYMOUS_DOWNLOAD ;
|
||||
|
||||
return addSharedDirectory(inf);
|
||||
}
|
||||
|
|
|
@ -155,12 +155,13 @@ const FileStorageFlags DIR_FLAGS_PARENT ( 0x0001 );
|
|||
const FileStorageFlags DIR_FLAGS_DETAILS ( 0x0002 ); // apparently unused
|
||||
const FileStorageFlags DIR_FLAGS_CHILDREN ( 0x0004 ); // apparently unused
|
||||
|
||||
const FileStorageFlags DIR_FLAGS_NETWORK_WIDE_OTHERS ( 0x0080 ); // Flags for directory sharing permissions. The last
|
||||
const FileStorageFlags DIR_FLAGS_BROWSABLE_OTHERS ( 0x0100 ); // one should be the OR of the all four flags.
|
||||
const FileStorageFlags DIR_FLAGS_NETWORK_WIDE_GROUPS ( 0x0200 );
|
||||
const FileStorageFlags DIR_FLAGS_BROWSABLE_GROUPS ( 0x0400 );
|
||||
const FileStorageFlags DIR_FLAGS_PERMISSIONS_MASK ( DIR_FLAGS_NETWORK_WIDE_OTHERS | DIR_FLAGS_BROWSABLE_OTHERS
|
||||
| DIR_FLAGS_NETWORK_WIDE_GROUPS | DIR_FLAGS_BROWSABLE_GROUPS );
|
||||
const FileStorageFlags DIR_FLAGS_ANONYMOUS_DOWNLOAD ( 0x0080 ); // Flags for directory sharing permissions. The last
|
||||
//const FileStorageFlags DIR_FLAGS_BROWSABLE_OTHERS ( 0x0100 ); // one should be the OR of the all four flags.
|
||||
//const FileStorageFlags DIR_FLAGS_NETWORK_WIDE_GROUPS ( 0x0200 );
|
||||
const FileStorageFlags DIR_FLAGS_BROWSABLE ( 0x0400 );
|
||||
const FileStorageFlags DIR_FLAGS_ANONYMOUS_SEARCH ( 0x0800 );
|
||||
const FileStorageFlags DIR_FLAGS_PERMISSIONS_MASK ( DIR_FLAGS_ANONYMOUS_DOWNLOAD | /*DIR_FLAGS_BROWSABLE_OTHERS
|
||||
DIR_FLAGS_NETWORK_WIDE_GROUPS*/ DIR_FLAGS_BROWSABLE | DIR_FLAGS_ANONYMOUS_SEARCH);
|
||||
|
||||
const FileStorageFlags DIR_FLAGS_LOCAL ( 0x1000 );
|
||||
const FileStorageFlags DIR_FLAGS_REMOTE ( 0x2000 );
|
||||
|
|
|
@ -1359,7 +1359,7 @@ FileSearchFlags p3Peers::computePeerPermissionFlags(const RsPeerId& peer_ssl_id,
|
|||
// very simple algorithm.
|
||||
//
|
||||
|
||||
bool found = false ;
|
||||
bool found = directory_parent_groups.empty() ; // by default, empty list means browsable by everyone.
|
||||
RsPgpId pgp_id = getGPGId(peer_ssl_id) ;
|
||||
|
||||
for(std::list<RsNodeGroupId>::const_iterator it(directory_parent_groups.begin());it!=directory_parent_groups.end() && !found;++it)
|
||||
|
@ -1378,8 +1378,8 @@ FileSearchFlags p3Peers::computePeerPermissionFlags(const RsPeerId& peer_ssl_id,
|
|||
// found = true ;
|
||||
}
|
||||
|
||||
bool network_wide = (share_flags & DIR_FLAGS_NETWORK_WIDE_OTHERS) ;//|| ( (share_flags & DIR_FLAGS_NETWORK_WIDE_GROUPS) && found) ;
|
||||
bool browsable = (share_flags & DIR_FLAGS_BROWSABLE_OTHERS) || ( (share_flags & DIR_FLAGS_BROWSABLE_GROUPS) && found) ;
|
||||
bool network_wide = (share_flags & DIR_FLAGS_ANONYMOUS_DOWNLOAD) ;//|| ( (share_flags & DIR_FLAGS_NETWORK_WIDE_GROUPS) && found) ;
|
||||
bool browsable = (share_flags & DIR_FLAGS_BROWSABLE) && found ;
|
||||
|
||||
FileSearchFlags final_flags ;
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue