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

Updated to read/write xtrn.ini instead of xtrn.cnf, for SBBS v3.20+

Fixes issue #477
parent 37fc072b
Branches
Tags
1 merge request!463MRC mods by Codefenix (2024-10-20)
// $Id: install-binkit.js,v 1.2 2020/03/26 06:18:33 rswindell Exp $
// Installs BinkIT (BinkP FidoNet Mailer) timed events and service // Installs BinkIT (BinkP FidoNet Mailer) timed events and service
// Enables SBBSecho timed events (FIDOIN and FIDOOUT) // Enables SBBSecho timed events (FIDOIN and FIDOOUT)
// Migrated from exec/binkit.js // Migrated from exec/binkit.js
...@@ -10,15 +8,15 @@ ...@@ -10,15 +8,15 @@
function install_binkit() function install_binkit()
{ {
require("sbbsdefs.js", 'EVENT_DISABLED'); require("sbbsdefs.js", 'EVENT_DISABLED');
var cnflib = load({}, "cnflib.js"); var cfglib = load({}, "cfglib.js");
var xtrn_cnf = cnflib.read("xtrn.cnf"); var xtrn_cfg = cfglib.read("xtrn.ini");
if (!xtrn_cnf) if (!xtrn_cfg)
return "Failed to read xtrn.cnf"; return "Failed to read xtrn.ini";
var changed = false; var changed = false;
if (!xtrn_area.event["binkout"]) { if (!xtrn_area.event["binkout"]) {
print("Adding timed event: BINKOUT"); print("Adding timed event: BINKOUT");
xtrn_cnf.event.push( { xtrn_cfg.event.push( {
"code": "BINKOUT", "code": "BINKOUT",
"cmd": "?binkit", "cmd": "?binkit",
"days": 255, "days": 255,
...@@ -35,7 +33,7 @@ function install_binkit() ...@@ -35,7 +33,7 @@ function install_binkit()
if (!xtrn_area.event["binkpoll"]) { if (!xtrn_area.event["binkpoll"]) {
print("Adding timed event: BINKPOLL"); print("Adding timed event: BINKPOLL");
xtrn_cnf.event.push( { xtrn_cfg.event.push( {
"code": "BINKPOLL", "code": "BINKPOLL",
"cmd": "?binkit -p", "cmd": "?binkit -p",
"days": 255, "days": 255,
...@@ -51,18 +49,18 @@ function install_binkit() ...@@ -51,18 +49,18 @@ function install_binkit()
} }
const timed_events = ["FIDOIN", "FIDOOUT", "BINKOUT", "BINKPOLL"]; const timed_events = ["FIDOIN", "FIDOOUT", "BINKOUT", "BINKPOLL"];
for(var i in xtrn_cnf.event) { for(var i in xtrn_cfg.event) {
if(timed_events.indexOf(xtrn_cnf.event[i].code) < 0) if(timed_events.indexOf(xtrn_cfg.event[i].code) < 0)
continue; continue;
if (xtrn_cnf.event[i].settings & EVENT_DISABLED) { if (xtrn_cfg.event[i].settings & EVENT_DISABLED) {
print("Enabling timed event: " + xtrn_cnf.event[i].code); print("Enabling timed event: " + xtrn_cfg.event[i].code);
xtrn_cnf.event[i].settings &= ~EVENT_DISABLED; xtrn_cfg.event[i].settings &= ~EVENT_DISABLED;
changed = true; changed = true;
} }
} }
if (changed && !cnflib.write("xtrn.cnf", undefined, xtrn_cnf)) if (changed && !cfglib.write("xtrn.ini", undefined, xtrn_cfg))
return "Failed to write xtrn.cnf"; return "Failed to write xtrn.ini";
var ini = new File(file_cfgname(system.ctrl_dir, "sbbsecho.ini")); var ini = new File(file_cfgname(system.ctrl_dir, "sbbsecho.ini"));
if (!ini.open(file_exists(ini.name) ? 'r+':'w+')) if (!ini.open(file_exists(ini.name) ? 'r+':'w+'))
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment