Commits (3)
...@@ -228,8 +228,7 @@ bool sbbs_t::removefile(smb_t* smb, file_t* f) ...@@ -228,8 +228,7 @@ bool sbbs_t::removefile(smb_t* smb, file_t* f)
int result; int result;
if((result = smb_removefile(smb ,f)) == SMB_SUCCESS) { if((result = smb_removefile(smb ,f)) == SMB_SUCCESS) {
SAFEPRINTF4(str,"%s removed %s from %s %s" SAFEPRINTF3(str,"removed %s from %s %s"
,useron.alias
,f->name ,f->name
,cfg.lib[cfg.dir[smb->dirnum]->lib]->sname,cfg.dir[smb->dirnum]->sname); ,cfg.lib[cfg.dir[smb->dirnum]->lib]->sname,cfg.dir[smb->dirnum]->sname);
logline("U-",str); logline("U-",str);
...@@ -252,7 +251,7 @@ bool sbbs_t::movefile(smb_t* smb, file_t* f, int newdir) ...@@ -252,7 +251,7 @@ bool sbbs_t::movefile(smb_t* smb, file_t* f, int newdir)
if(!addfile(&cfg, newdir, f, f->extdesc, /* client: */NULL)) if(!addfile(&cfg, newdir, f, f->extdesc, /* client: */NULL))
return false; return false;
if(!removefile(smb, &orgfile)) if(!removefile(smb, &orgfile)) // Use ::removefile() here instead?
return false; return false;
bprintf(text[MovedFile],f->name bprintf(text[MovedFile],f->name
,cfg.lib[cfg.dir[newdir]->lib]->sname,cfg.dir[newdir]->sname); ,cfg.lib[cfg.dir[newdir]->lib]->sname,cfg.dir[newdir]->sname);
...@@ -308,12 +307,13 @@ bool sbbs_t::editfiledesc(file_t* f) ...@@ -308,12 +307,13 @@ bool sbbs_t::editfiledesc(file_t* f)
{ {
// Description // Description
bputs(text[EditDescription]); bputs(text[EditDescription]);
char fdesc[LEN_FDESC + 1]; char fdesc[LEN_FDESC + 1] = "";
SAFECOPY(fdesc, f->desc); if(f->desc != NULL)
SAFECOPY(fdesc, f->desc);
getstr(fdesc, sizeof(fdesc)-1, K_LINE|K_EDIT|K_AUTODEL|K_TRIM); getstr(fdesc, sizeof(fdesc)-1, K_LINE|K_EDIT|K_AUTODEL|K_TRIM);
if(msgabort(true)) if(msgabort(true))
return false; return false;
if(strcmp(fdesc, f->desc) == 0) if(f->desc != NULL && strcmp(fdesc, f->desc) == 0)
return true; return true;
smb_new_hfield_str(f, SMB_FILEDESC, fdesc); smb_new_hfield_str(f, SMB_FILEDESC, fdesc);
return updatefile(&cfg, f); return updatefile(&cfg, f);
......
...@@ -460,7 +460,7 @@ bool updatefile(scfg_t* cfg, file_t* file) ...@@ -460,7 +460,7 @@ bool updatefile(scfg_t* cfg, file_t* file)
if(smb_open_dir(cfg, &smb, file->dir) != SMB_SUCCESS) if(smb_open_dir(cfg, &smb, file->dir) != SMB_SUCCESS)
return false; return false;
int result = smb_updatemsg(&smb, file) == SMB_SUCCESS; int result = smb_updatemsg(&smb, file);
smb_close(&smb); smb_close(&smb);
return result == SMB_SUCCESS; return result == SMB_SUCCESS;
} }
......
...@@ -844,39 +844,36 @@ int sbbs_t::listfileinfo(uint dirnum, const char *filespec, long mode) ...@@ -844,39 +844,36 @@ int sbbs_t::listfileinfo(uint dirnum, const char *filespec, long mode)
editfileinfo(f); editfileinfo(f);
break; break;
case 'F': /* delete file only */ case 'F': /* delete file only */
SAFEPRINTF2(str,"%s%s",dirpath,f->name); getfilepath(&cfg, f, path);
if(!fexistcase(str)) if(!fexistcase(path))
bprintf(text[FileDoesNotExist],str); bprintf(text[FileDoesNotExist], path);
else { else {
if(!noyes(text[DeleteFileQ])) { if(!noyes(text[DeleteFileQ])) {
if(remove(str)) if(remove(path) != 0) {
bprintf(text[CouldntRemoveFile],str); bprintf(text[CouldntRemoveFile], path);
else { errormsg(WHERE, ERR_REMOVE, path);
SAFEPRINTF(tmp, "deleted %s", str); } else
logline(nulstr, tmp); lprintf(LOG_NOTICE, "deleted %s", path);
}
} }
} }
break; break;
case 'R': /* remove file from database */ case 'R': /* remove file from database */
if(noyes(text[RemoveFileQ])) if(noyes(text[RemoveFileQ]))
break; break;
if(removefile(&smb, f)) { if(!removefile(&smb, f)) {
getfilepath(&cfg, f, path); errormsg(WHERE, ERR_REMOVE, f->name);
if(fexistcase(path)) { break;
if(dir_op(dirnum)) { }
if(!noyes(text[DeleteFileQ])) { getfilepath(&cfg, f, path);
if(remove(path) != 0) if(fexistcase(path)) {
errormsg(WHERE, ERR_REMOVE, path); if(dir_op(dirnum) && noyes(text[DeleteFileQ]))
else { break;
SAFEPRINTF(tmp, "deleted %s", path); if(remove(path) != 0) {
logline(nulstr,path); bprintf(text[CouldntRemoveFile], path);
} errormsg(WHERE, ERR_REMOVE, path);
} break;
}
else if(remove(path)) /* always remove if not sysop */
bprintf(text[CouldntRemoveFile],path);
} }
lprintf(LOG_NOTICE, "deleted %s", path);
} }
if(dir_op(dirnum) || useron.exempt&FLAG('R')) { if(dir_op(dirnum) || useron.exempt&FLAG('R')) {
i=cfg.lib[cfg.dir[f->dir]->lib]->offline_dir; i=cfg.lib[cfg.dir[f->dir]->lib]->offline_dir;
......