Commits (3)
...@@ -656,7 +656,7 @@ function str_cmds(str) ...@@ -656,7 +656,7 @@ function str_cmds(str)
str=str.replace(/^\s+/,""); str=str.replace(/^\s+/,"");
if(str=="") { if(str=="") {
write("\r\nPath and filename: "); write("\r\nPath and filename: ");
str=console.getstr("",60); str=console.getstr("", 60, K_TRIM);
if(str=="") if(str=="")
return; return;
} }
...@@ -680,7 +680,7 @@ function str_cmds(str) ...@@ -680,7 +680,7 @@ function str_cmds(str)
str=str.replace(/^\s+/,""); str=str.replace(/^\s+/,"");
if(str=="") { if(str=="") {
write("\r\nPath and filename: "); write("\r\nPath and filename: ");
str=console.getstr("",60); str=console.getstr("", 60, K_TRIM);
if(str=="") if(str=="")
return; return;
} }
...@@ -858,7 +858,7 @@ function get_arg(str, parm, history) ...@@ -858,7 +858,7 @@ function get_arg(str, parm, history)
str=str.replace(/^\s+/,""); str=str.replace(/^\s+/,"");
if(str=="") { if(str=="") {
write(format("%s: ", parm)); write(format("%s: ", parm));
str=console.getstr(128, K_MSG, history); str=console.getstr(128, K_MSG | K_TRIM, history);
} }
if(str) { if(str) {
var i = history.indexOf(str); var i = history.indexOf(str);
......
...@@ -4,6 +4,8 @@ require("sbbsdefs.js", 'UFLAG_D'); ...@@ -4,6 +4,8 @@ require("sbbsdefs.js", 'UFLAG_D');
require("text.js", 'TempDirPrompt'); require("text.js", 'TempDirPrompt');
require("file_size.js", 'file_size_str'); require("file_size.js", 'file_size_str');
var options = {};
if(user.security.restrictions & UFLAG_D) { if(user.security.restrictions & UFLAG_D) {
console.putmsg(bbs.text(R_Download)); console.putmsg(bbs.text(R_Download));
exit(); exit();
...@@ -43,6 +45,16 @@ function checkspace() ...@@ -43,6 +45,16 @@ function checkspace()
return true; return true;
} }
function checktemp()
{
if(!directory(system.temp_dir + "*").length) {
writeln("\r\nNo files in temp directory.");
writeln("Use 'E' to extract from file or Create File List with 'N' or 'F' commands.");
return false;
}
return true;
}
var temp_fname = system.temp_dir + system.qwk_id + "." + (user.temp_file_ext || "zip"); var temp_fname = system.temp_dir + system.qwk_id + "." + (user.temp_file_ext || "zip");
var file_fmt = "\x01c\x01h%-*s \x01n\x01c%10lu \x01h\x01w%s"; var file_fmt = "\x01c\x01h%-*s \x01n\x01c%10lu \x01h\x01w%s";
var file = {}; var file = {};
...@@ -59,10 +71,12 @@ while(bbs.online && !console.aborted) { ...@@ -59,10 +71,12 @@ while(bbs.online && !console.aborted) {
bbs.menu("tempxfer"); bbs.menu("tempxfer");
} }
console.putmsg(bbs.text(TempDirPrompt)); console.print(bbs.text(TempDirPrompt));
var keys = "ADEFNILQRVX?"; var keys = "ADEFNILQRVX?";
switch(console.getkeys(keys, K_UPPER)) { switch(console.getkeys(keys, K_UPPER)) {
case 'A': // Add to temp archive case 'A': // Add to temp archive
if(!checktemp())
break;
if(!checkspace()) if(!checkspace())
continue; continue;
var spec = bbs.get_filespec(); var spec = bbs.get_filespec();
...@@ -75,20 +89,40 @@ while(bbs.online && !console.aborted) { ...@@ -75,20 +89,40 @@ while(bbs.online && !console.aborted) {
} }
break; break;
case 'D': // Download temp archive case 'D': // Download temp archive
if(!file_exists(temp_fname)) { if(!checktemp())
console.putmsg(format(bbs.text(TempFileNotCreatedYet), file_getname(temp_fname)));
break; break;
var fpath = temp_fname;
if(options.download_archive_only) {
if(!file_exists(fpath)) {
console.putmsg(format(bbs.text(TempFileNotCreatedYet), file_getname(fpath)));
break;
}
} else {
console.putmsg(bbs.text(Filename));
var fname = console.getstr(file_getname(temp_fname), 64, K_EDIT|K_AUTODEL);
if(!checkfname(fname))
break;
fpath = system.temp_dir + fname;
if(!file_exists(fpath)) {
console.putmsg(format(bbs.text(FileDoesNotExist), fname));
break;
}
} }
if(bbs.send_file(temp_fname, user.download_protocol) && dir_code) if(bbs.send_file(fpath, user.download_protocol) && dir_code)
user.downloaded_file(dir_code, file.name, file_size(temp_fname)); user.downloaded_file(dir_code, file.name, file_size(fpath));
break; break;
case 'I': // Information on extracted file case 'I': // Information on extracted file
if(!checktemp())
break;
console.putmsg(format(bbs.text(TempFileInfo), file.from, file.name)); console.putmsg(format(bbs.text(TempFileInfo), file.from, file.name));
break; break;
case 'L': // List files in temp dir case 'L': // List files in temp dir
if(!checktemp())
break;
var spec = bbs.get_filespec(); var spec = bbs.get_filespec();
if(!checkfname(spec)) if(!checkfname(spec))
break; break;
console.crlf();
var bytes = 0; var bytes = 0;
var files = 0; var files = 0;
var list = directory(system.temp_dir + spec); var list = directory(system.temp_dir + spec);
...@@ -113,12 +147,16 @@ while(bbs.online && !console.aborted) { ...@@ -113,12 +147,16 @@ while(bbs.online && !console.aborted) {
console.aborted = false; console.aborted = false;
break; break;
case 'R': // Remove files from temp dir case 'R': // Remove files from temp dir
if(!checktemp())
break;
var spec = bbs.get_filespec(); var spec = bbs.get_filespec();
if(!checkfname(spec)) if(!checkfname(spec))
break; break;
console.putmsg(format(bbs.text(NFilesRemoved), delfiles(system.temp_dir, spec))); console.putmsg(format(bbs.text(NFilesRemoved), delfiles(system.temp_dir, spec)));
break; break;
case 'V': // View files in temp dir case 'V': // View files in temp dir
if(!checktemp())
break;
var spec = bbs.get_filespec(); var spec = bbs.get_filespec();
if(!checkfname(spec)) if(!checkfname(spec))
break; break;
...@@ -171,6 +209,8 @@ while(bbs.online && !console.aborted) { ...@@ -171,6 +209,8 @@ while(bbs.online && !console.aborted) {
console.putmsg(bbs.text(FileNotFound)); console.putmsg(bbs.text(FileNotFound));
break; break;
case 'X': // Extract from file in temp dir case 'X': // Extract from file in temp dir
if(!checktemp())
break;
if(!checkspace()) if(!checkspace())
continue; continue;
console.putmsg(bbs.text(ExtractFrom)); console.putmsg(bbs.text(ExtractFrom));
......
Synchronet Sysop Transfer Menu Synchronet Sysop Transfer Menu
(All commands are preceeded by a ';') (All commands are preceeded by a ';')
PUT [s] Direct upload file s to any drive or directory (remote) DIR [path] List directory contents of current directory or [path]
GET [s] Direct download file s from any drive or directory (remote) PUT [file] Direct upload [ile to any drive or directory (remote)
GET [file] Direct download file from any drive or directory (remote)
OLD * Remove, Edit, or Move files not downloaded since new-scan date OLD * Remove, Edit, or Move files not downloaded since new-scan date
OLDUL * Remove, Edit, or Move files uploaded before new-scan date OLDUL * Remove, Edit, or Move files uploaded before new-scan date
UPLOAD * Bulk local upload - add files on disk to database UPLOAD * Bulk local upload - add files on disk to database
......