From d54d7b684aa58bc0ae74a55375f3750ca9e7fced Mon Sep 17 00:00:00 2001 From: rswindell <> Date: Fri, 10 Apr 2020 09:05:52 +0000 Subject: [PATCH] Functional equivalent to the maketicket.js that Nelgin provided (except the data is external, in the exec/init-tickit.ini file). --- exec/init-tickit.js | 48 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 48 insertions(+) create mode 100644 exec/init-tickit.js diff --git a/exec/init-tickit.js b/exec/init-tickit.js new file mode 100644 index 0000000000..ff41bd693b --- /dev/null +++ b/exec/init-tickit.js @@ -0,0 +1,48 @@ +// $Id$ +/* + Nigel Reed - nigel@nigelreed.net sysop@endofthelinebbs.com + + This short crappy bit of code will create a tickit.ini file for you. You won't have + edit it by hang any more and it's easy to add a new network or new file areas. + It will parse init-tickit.ini and automatically create /sbbs/ctrl/tickit.ini +*/ + +"use strict"; + +var init_ini = js.exec_dir + "init-ticket.ini"; +var tickit_ini = system.ctrl_dir + "tickit.ini"; + +var ini = []; +var f = new File(init_ini); +if(f.open("r")) { + ini = f.iniGetAllObjects(); + f.close(); +} +file_backup(tickit_ini); +var f = new File(tickit_ini); +if(!f.open("w")) { + alert("Error " + f.error + " opening " + f.name); + exit(1); +} + +for(var code in file_area.dir) { + + var area = file_area.dir[code]; + var ticline; + f.writeln('[' + area.name + "]\nDir=" + code.toUpperCase()); + if (ini[area.name]) { + if(ini[area.name].domain) { + f.writeln('Handler=tickit/nodelist_handler.js'); + ticline = 'HandlerArg={"domain":"' + ini[area.name].domain + '"'; + if (ini[area.name].match) { + ticline += ' ,"match":"' + ini[area.name].match + '"'; + } + ticline += ', "nlmatch":"' + ini[area.name].nlmatch + '"}'; + f.writeln(ticline); + } + if (ini[area.name].forcereplace) + f.writeln('Forcereplace = true'); + } + f.writeln(); +} +f.close(); -- GitLab