Skip to content
Snippets Groups Projects
Commit 140dfdfa authored by Rob Swindell's avatar Rob Swindell :speech_balloon:
Browse files

Add FIND command that anyone can use to find msg and file areas

To locate all message or file areas that contain a specific word in their name
or description type: ;find word

Also, only display transfer-area commands when the current node action is/was
NODE_XFER.
parent 899b58e0
No related branches found
No related tags found
1 merge request!463MRC mods by Codefenix (2024-10-20)
...@@ -59,6 +59,7 @@ function str_cmds(str) ...@@ -59,6 +59,7 @@ function str_cmds(str)
if(str=="HELP") if(str=="HELP")
write("\r\nAvailable STR commands (prefix with a semi-colon)\r\n\r\n"); write("\r\nAvailable STR commands (prefix with a semi-colon)\r\n\r\n");
var node_action = bbs.node_action;
if(bbs.compare_ars("SYSOP")) { if(bbs.compare_ars("SYSOP")) {
// Change node action to "sysop activities" // Change node action to "sysop activities"
bbs.node_action=NODE_SYSP; bbs.node_action=NODE_SYSP;
...@@ -444,12 +445,22 @@ function str_cmds(str) ...@@ -444,12 +445,22 @@ function str_cmds(str)
return; return;
} }
if(str=="HELP") {
writeln("LOAD [filespec]");
writeln("\tLoads the text.dat from the specified filespec.");
}
if(word=="LOAD") {
str=str.substr(4);
bbs.load_text(get_filename(str));
return;
}
if(str=="HELP") { if(str=="HELP") {
writeln("DIR [path]"); writeln("DIR [path]");
writeln("\tDisplays a full directory of specified path or the current file area if"); writeln("\tDisplays a full directory of specified path or the current file area if");
writeln("\tnot specified"); writeln("\tnot specified");
} }
if(str=="DIR") { if(str=="DIR" && node_action == NODE_XFER) {
// Dir of current lib: // Dir of current lib:
if(bbs.check_syspass()) { if(bbs.check_syspass()) {
var files=0; var files=0;
...@@ -458,7 +469,7 @@ function str_cmds(str) ...@@ -458,7 +469,7 @@ function str_cmds(str)
str=file_area.lib_list[bbs.curlib].dir_list[bbs.curdir].path; str=file_area.lib_list[bbs.curlib].dir_list[bbs.curdir].path;
write("\r\nDirectory of: "+str+"\r\n\r\n"); write("\r\nDirectory of: "+str+"\r\n\r\n");
a=directory(str+"*",GLOB_NOSORT); a=directory(str+"*",GLOB_NOSORT);
for(i=0; i<a.length; i++) { for(i=0; i<a.length && !console.aborted; i++) {
j=file_date(a[i]); j=file_date(a[i]);
if(system.settings & SYS_EURODATE) if(system.settings & SYS_EURODATE)
write(strftime("%d/%m/%Y %I:%M %p ",j).toUpperCase()); write(strftime("%d/%m/%Y %I:%M %p ",j).toUpperCase());
...@@ -484,6 +495,7 @@ function str_cmds(str) ...@@ -484,6 +495,7 @@ function str_cmds(str)
} }
return; return;
} }
if(word=="DIR") { if(word=="DIR") {
if(bbs.check_syspass()) { if(bbs.check_syspass()) {
var files=0; var files=0;
...@@ -494,7 +506,7 @@ function str_cmds(str) ...@@ -494,7 +506,7 @@ function str_cmds(str)
str=backslash(str); str=backslash(str);
write("\r\nDirectory of: "+str+"\r\n\r\n"); write("\r\nDirectory of: "+str+"\r\n\r\n");
a=directory(str+"*",GLOB_NOSORT); a=directory(str+"*",GLOB_NOSORT);
for(i=0; i<a.length; i++) { for(i=0; i<a.length && !console.aborted; i++) {
j=file_date(a[i]); j=file_date(a[i]);
write(system.datestr(j)+" "); write(system.datestr(j)+" ");
write(strftime("%I:%M %p ",j).toUpperCase()); write(strftime("%I:%M %p ",j).toUpperCase());
...@@ -519,15 +531,8 @@ function str_cmds(str) ...@@ -519,15 +531,8 @@ function str_cmds(str)
return; return;
} }
if(str=="HELP") {
writeln("LOAD [filespec]"); if(node_action == NODE_XFER) {
writeln("\tLoads the text.dat from the specified filespec.");
}
if(word=="LOAD") {
str=str.substr(4);
bbs.load_text(get_filename(str));
return;
}
if(str=="HELP") { if(str=="HELP") {
writeln("UPLOAD [areaspec]"); writeln("UPLOAD [areaspec]");
...@@ -692,6 +697,7 @@ function str_cmds(str) ...@@ -692,6 +697,7 @@ function str_cmds(str)
printf(bbs.text(text.NFilesListed),k); printf(bbs.text(text.NFilesListed),k);
return; return;
} }
}
if(str=="HELP") { if(str=="HELP") {
writeln("GET [path]"); writeln("GET [path]");
...@@ -847,6 +853,47 @@ function str_cmds(str) ...@@ -847,6 +853,47 @@ function str_cmds(str)
} }
} }
} }
if(str=="HELP") {
writeln("FIND [word]");
writeln("\tFind a message area or file area.");
}
if(word == "FIND" && node_action == NODE_MAIN) {
str = get_arg(str.substr(4).trim(), "Find").toLowerCase();
if(!str)
return;
print("Searching for message areas with '" + str + "'");
for(var g = 0; g < msg_area.grp_list.length; g++) {
var grp = msg_area.grp_list[g];
for(var s = 0; s < grp.sub_list.length; s++) {
var sub = grp.sub_list[s];
if(sub.name.toLowerCase().indexOf(str) >= 0
|| sub.description.toLowerCase().indexOf(str) >= 0) {
writeln(format("\1n[\1h%u\1n] %-15s [\1h%2u\1n] %s"
,g + 1, grp.name
,s + 1, sub.description));
}
}
}
}
if(word == "FIND" && node_action == NODE_XFER) {
str = get_arg(str.substr(4).trim(), "Find").toLowerCase();
if(!str)
return;
print("Searching for file areas with '" + str + "'");
for(var g = 0; g < file_area.lib_list.length; g++) {
var lib = file_area.lib_list[g];
for(var s = 0; s < lib.dir_list.length; s++) {
var dir = lib.dir_list[s];
if(dir.name.toLowerCase().indexOf(str) >= 0
|| dir.description.toLowerCase().indexOf(str) >= 0) {
writeln(format("\1n[\1h%u\1n] %-15s [\1h%2u\1n] %s"
,g + 1, lib.name
,s + 1, dir.description));
}
}
}
}
} }
//### Generic routine to ask user for parameter if one wasn't specified ### //### Generic routine to ask user for parameter if one wasn't specified ###
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment