Skip to content
Snippets Groups Projects
Commit 6ce953fe authored by echicken's avatar echicken :chicken:
Browse files

Added QWK list/download to the Gopher service.

Added section headers to the main directory listing; the
meaning of each directory entry was unclear. (These use
the non-standard but commonly-used item type 'i'.)
Should satisfy issue #67.
https://gitlab.synchro.net/sbbs/sbbs/-/issues/67
This one's for all you folks who have QWK bulletins on your
systems and want people to be able to read them via Gopher.
parent 1bb78194
No related branches found
No related tags found
No related merge requests found
...@@ -50,6 +50,13 @@ function send_file(fname) ...@@ -50,6 +50,13 @@ function send_file(fname)
writeln(strip_ctrl(txt[l])); writeln(strip_ctrl(txt[l]));
} }
function getQwkBulletins() {
var dir = system.text_dir + 'qwk';
if (!file_isdir(dir)) return [];
var bulletins = directory(backslash(dir) + '*');
return bulletins;
}
var msgbase=null; var msgbase=null;
if(!login("guest")) if(!login("guest"))
...@@ -81,19 +88,41 @@ if(gopher_plus) ...@@ -81,19 +88,41 @@ if(gopher_plus)
if(request=="" || request=='/') { /* "root" */ if(request=="" || request=='/') { /* "root" */
for(g in msg_area.grp_list) if (msg_area.grp_list.length) {
writeln(prefix writeln(prefix + 'iMessage Groups\t\tfake\t1');
+ "1" + msg_area.grp_list[g].description for(g in msg_area.grp_list) {
+ "\tgrp:" + msg_area.grp_list[g].name.toLowerCase() writeln(
+ "\t" + system.host_name prefix
+ "\t" + GOPHER_PORT); + "1" + msg_area.grp_list[g].description
for(l in file_area.lib_list) + "\tgrp:" + msg_area.grp_list[g].name.toLowerCase()
writeln(format("1%s\tlib:%s\t%s\t%u" + "\t" + system.host_name
,file_area.lib_list[l].description + "\t" + GOPHER_PORT
,file_area.lib_list[l].name.toLowerCase() );
,system.host_name }
,GOPHER_PORT writeln(prefix + 'i \t\tfake\t1');
}
if (file_area.lib_list.length) {
writeln(prefix + 'iFile Libraries\t\tfake\t1');
for(l in file_area.lib_list) {
writeln(format("1%s\tlib:%s\t%s\t%u"
,file_area.lib_list[l].description
,file_area.lib_list[l].name.toLowerCase()
,system.host_name
,GOPHER_PORT
)); ));
}
writeln(prefix + 'i \t\tfake\t1');
}
var qwkBulletins = getQwkBulletins();
if (qwkBulletins.length) {
writeln(prefix + 'iQWK Bulletins\t\tfake\t1');
qwkBulletins.forEach(function (e) {
var f = file_getname(e);
writeln(prefix + '0' + f + '\tqwkbulletin:' + f + '\t' + system.host_name + '\t' + GOPHER_PORT);
});
writeln(prefix + 'i \t\tfake\t1');
}
writeln(prefix + 'iSystem Information\t\tfake\t1');
writeln(prefix writeln(prefix
+ "0Node List\tnodelist" + "0Node List\tnodelist"
+"\t" + system.host_name +"\t" + system.host_name
...@@ -309,6 +338,12 @@ switch(field[0]) { ...@@ -309,6 +338,12 @@ switch(field[0]) {
} }
} }
break; break;
case "qwkbulletin":
if (field.length == 2) {
var fname = backslash(system.text_dir + 'qwk') + field[1];
if (file_exists(fname)) client.socket.sendfile(fname);
}
break;
} }
writeln("."); writeln(".");
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment