mirror of
https://github.com/RetroShare/RetroShare.git
synced 2024-10-01 02:35:48 -04:00
don't allow user to add same file twice to createchanmsg instance
git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@3700 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
parent
fb6de2aaf4
commit
7b5c611d80
@ -301,11 +301,30 @@ void CreateChannelMsg::addAttachment(const std::string &path)
|
||||
/* add widget in for new destination */
|
||||
uint32_t flags = SFI_TYPE_CHANNEL | SFI_STATE_EXTRA;
|
||||
|
||||
|
||||
// check attachment if hash exists already
|
||||
std::list<SubFileItem* >::iterator it;
|
||||
|
||||
for(it= mAttachments.begin(); it != mAttachments.end(); it++){
|
||||
|
||||
if((*it)->FilePath() == path){
|
||||
QMessageBox::warning(this, tr("RetroShare"),
|
||||
tr("File already Added and Hashed"),
|
||||
QMessageBox::Ok, QMessageBox::Ok);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// channels creates copy of file into channels directory and shares this
|
||||
|
||||
FileInfo fInfo;
|
||||
rsChannels->channelExtraFileHash(path, mChannelId, fInfo);
|
||||
|
||||
|
||||
|
||||
|
||||
// file is not innitial
|
||||
SubFileItem *file = new SubFileItem(fInfo.hash, fInfo.fname, fInfo.path, fInfo.size,
|
||||
flags, mChannelId); // destroyed when fileFrame (this subfileitem) is destroyed
|
||||
|
Loading…
Reference in New Issue
Block a user