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

Multi-language support and other niceties

The get_lang_count(), get_lang_list(), and get_lang_desc_list() functions are
more or less ported from load_cfg.c. If we ever need these in any other JS
files, they should be moved to a load-lib.

Re-synchronized this code with sbbs_t::maindflts():
- Don't accept keys for settings we didn't display
- Remove support for Auto-Login by IP address (chopping block feature)
- This is even a tad better as a translated (to another language)
  UserDefaultsHdr string (if/when there is one) would be displayed
  immediately upon a new language file being selected

Fixed a bug where the user online's command shell was used as the default
rather than the selected user's command shell (thisuser).

Fixed a bug where 'None' was hard-coded rather than use the text.dat string.

No longer needs/loads text.js (use the hard-coded string IDs in sbbs v3.20)
for a little speed boost.
parent 27d5fb9a
No related branches found
No related tags found
1 merge request!463MRC mods by Codefenix (2024-10-20)
...@@ -27,16 +27,48 @@ ...@@ -27,16 +27,48 @@
console.clear(); console.clear();
require("sbbsdefs.js", 'BBS_OPT_AUTO_LOGON'); require("sbbsdefs.js", 'BBS_OPT_AUTO_LOGON');
require("userdefs.js", 'USER_SPIN'); require("userdefs.js", 'USER_SPIN');
require("text.js", 'UserDefaultsTerminal');
require("nodedefs.js", 'NODE_DFLT'); require("nodedefs.js", 'NODE_DFLT');
var termdesc = load("termdesc.js"); var termdesc = load("termdesc.js");
function get_lang_count()
{
return directory(system.ctrl_dir + "text.*.ini").length + 1;
}
function get_lang_list()
{
var result = [""];
var list = directory(system.ctrl_dir + "text.*.ini");
const prefix_len = (system.ctrl_dir + "text.").length;
for (var i in list) {
result.push(list[i].slice(prefix_len, -4));
}
return result;
}
function get_lang_desc_list()
{
var result = [bbs.text(bbs.text.LANG, /* default: */true)];
var list = directory(system.ctrl_dir + "text.*.ini");
for (var i in list) {
var f = new File(list[i]);
if (!f.open("r"))
continue;
result.push(f.iniGetValue(null, "LANG", ""));
f.close();
}
return result;
}
function on_or_off(on) function on_or_off(on)
{ {
return bbs.text(on ? On : Off); return bbs.text(on ? bbs.text.On : bbs.text.Off);
} }
function display_menu(thisuser) { function display_menu(thisuser)
{
var keys = 'Q\r';
const curspin = (thisuser.settings & USER_SPIN) ? bbs.text(On) const curspin = (thisuser.settings & USER_SPIN) ? bbs.text(On)
: (thisuser.settings & USER_NOPAUSESPIN) ? bbs.text(Off) : "Pause Prompt " + bbs.text(Only); : (thisuser.settings & USER_NOPAUSESPIN) ? bbs.text(Off) : "Pause Prompt " + bbs.text(Only);
for (var i = 0; i < main_cfg.shell.length; i++) { for (var i = 0; i < main_cfg.shell.length; i++) {
...@@ -45,7 +77,7 @@ function display_menu(thisuser) { ...@@ -45,7 +77,7 @@ function display_menu(thisuser) {
break; break;
} }
} }
var protname = bbs.text(None); var protname = bbs.text(bbs.text.None);
for (var i = 0; i < file_cfg.protocol.length; i++) { for (var i = 0; i < file_cfg.protocol.length; i++) {
if (String(file_cfg.protocol[i].key) === String(thisuser.download_protocol)) { if (String(file_cfg.protocol[i].key) === String(thisuser.download_protocol)) {
protname = file_cfg.protocol[i].name; protname = file_cfg.protocol[i].name;
...@@ -54,76 +86,141 @@ function display_menu(thisuser) { ...@@ -54,76 +86,141 @@ function display_menu(thisuser) {
} }
console.clear(); console.clear();
console.putmsg(format(bbs.text(UserDefaultsHdr),thisuser.alias,thisuser.number)); console.putmsg(format(bbs.text(UserDefaultsHdr),thisuser.alias,thisuser.number));
if (bbs.text(bbs.text.UserDefaultsTerminal).length) {
keys += 'T';
console.add_hotspot('T'); console.add_hotspot('T');
console.putmsg(format(bbs.text(UserDefaultsTerminal) console.putmsg(format(bbs.text(bbs.text.UserDefaultsTerminal)
,termdesc.type(true, thisuser.number == user.number ? undefined : thisuser))); ,termdesc.type(true, thisuser.number == user.number ? undefined : thisuser)));
}
if (bbs.text(bbs.text.UserDefaultsRows).length) {
keys += 'L';
console.add_hotspot('L'); console.add_hotspot('L');
console.putmsg(format(bbs.text(UserDefaultsRows) console.putmsg(format(bbs.text(bbs.text.UserDefaultsRows)
,termdesc.columns(true,user), termdesc.rows(true,user))); ,termdesc.columns(true,user), termdesc.rows(true,user)));
if(main_cfg.shell.length > 1) { }
if (bbs.text(bbs.text.UserDefaultsCommandSet).length
&& main_cfg.shell.length > 1) {
keys += 'K';
console.add_hotspot('K'); console.add_hotspot('K');
console.putmsg(format(bbs.text(UserDefaultsCommandSet), cmdshell)); console.putmsg(format(bbs.text(bbs.text.UserDefaultsCommandSet), cmdshell));
} }
if (bbs.text(bbs.text.UserDefaultsLanguage).length && get_lang_count() > 1) {
keys += 'I';
console.add_hotspot('I');
console.putmsg(format(bbs.text(bbs.text.UserDefaultsLanguage)
,bbs.text(bbs.text.Language), bbs.text(bbs.text.LANG)));
}
if (bbs.text(bbs.text.UserDefaultsXeditor).length
&& Object.getOwnPropertyNames(xtrn_area.editor).length > 0) {
keys += 'E';
console.add_hotspot('E'); console.add_hotspot('E');
console.putmsg(format(bbs.text(UserDefaultsXeditor) console.putmsg(format(bbs.text(bbs.text.UserDefaultsXeditor)
,thisuser.editor ? xtrn_area.editor[thisuser.editor].name:'None')); ,thisuser.editor ? xtrn_area.editor[thisuser.editor].name : bbs.text(bbs.text.None)));
}
if (bbs.text(bbs.text.UserDefaultsArcType).length) {
keys += 'A';
console.add_hotspot('A'); console.add_hotspot('A');
console.putmsg(format(bbs.text(UserDefaultsArcType) console.putmsg(format(bbs.text(bbs.text.UserDefaultsArcType)
,thisuser.temp_file_ext)); ,thisuser.temp_file_ext));
}
if (bbs.text(bbs.text.UserDefaultsMenuMode).length) {
keys += 'X';
console.add_hotspot('X'); console.add_hotspot('X');
console.putmsg(format(bbs.text(UserDefaultsMenuMode) console.putmsg(format(bbs.text(bbs.text.UserDefaultsMenuMode)
,on_or_off(thisuser.settings & USER_EXPERT))); ,on_or_off(thisuser.settings & USER_EXPERT)));
}
if (bbs.text(bbs.text.UserDefaultsPause).length) {
keys += 'P';
console.add_hotspot('P'); console.add_hotspot('P');
console.putmsg(format(bbs.text(UserDefaultsPause) console.putmsg(format(bbs.text(bbs.text.UserDefaultsPause)
,on_or_off(thisuser.settings & USER_PAUSE))); ,on_or_off(thisuser.settings & USER_PAUSE)));
}
if (bbs.text(bbs.text.UserDefaultsHotKey).length) {
keys += 'H';
console.add_hotspot('H'); console.add_hotspot('H');
console.putmsg(format(bbs.text(UserDefaultsHotKey) console.putmsg(format(bbs.text(bbs.text.UserDefaultsHotKey)
,on_or_off(!(thisuser.settings & USER_COLDKEYS)))); ,on_or_off(!(thisuser.settings & USER_COLDKEYS))));
}
if (bbs.text(bbs.text.UserDefaultsCursor).length) {
keys += 'S';
console.add_hotspot('S'); console.add_hotspot('S');
console.putmsg(format(bbs.text(UserDefaultsCursor) console.putmsg(format(bbs.text(bbs.text.UserDefaultsCursor)
,curspin)); ,curspin));
}
if (bbs.text(bbs.text.UserDefaultsCLS).length) {
keys += 'C';
console.add_hotspot('C'); console.add_hotspot('C');
console.putmsg(format(bbs.text(UserDefaultsCLS) console.putmsg(format(bbs.text(bbs.text.UserDefaultsCLS)
,on_or_off(thisuser.settings & USER_CLRSCRN))); ,on_or_off(thisuser.settings & USER_CLRSCRN)));
}
if (bbs.text(bbs.text.UserDefaultsAskNScan).length) {
keys += 'N';
console.add_hotspot('N'); console.add_hotspot('N');
console.putmsg(format(bbs.text(UserDefaultsAskNScan) console.putmsg(format(bbs.text(bbs.text.UserDefaultsAskNScan)
,on_or_off(thisuser.settings & USER_ASK_NSCAN))); ,on_or_off(thisuser.settings & USER_ASK_NSCAN)));
}
if (bbs.text(bbs.text.UserDefaultsAskSScan).length) {
keys += 'Y';
console.add_hotspot('Y'); console.add_hotspot('Y');
console.putmsg(format(bbs.text(UserDefaultsAskSScan) console.putmsg(format(bbs.text(bbs.text.UserDefaultsAskSScan)
,on_or_off(thisuser.settings & USER_ASK_SSCAN))); ,on_or_off(thisuser.settings & USER_ASK_SSCAN)));
}
if (bbs.text(bbs.text.UserDefaultsANFS).length) {
keys += 'F';
console.add_hotspot('F'); console.add_hotspot('F');
console.putmsg(format(bbs.text(UserDefaultsANFS) console.putmsg(format(bbs.text(bbs.text.UserDefaultsANFS)
,on_or_off(thisuser.settings & USER_ANFSCAN))); ,on_or_off(thisuser.settings & USER_ANFSCAN)));
}
if (bbs.text(bbs.text.UserDefaultsRemember).length) {
keys += 'R';
console.add_hotspot('R'); console.add_hotspot('R');
console.putmsg(format(bbs.text(UserDefaultsRemember) console.putmsg(format(bbs.text(bbs.text.UserDefaultsRemember)
,on_or_off(thisuser.settings & USER_CURSUB))); ,on_or_off(thisuser.settings & USER_CURSUB)));
}
if (bbs.text(bbs.text.UserDefaultsBatFlag).length) {
keys += 'B';
console.add_hotspot('B'); console.add_hotspot('B');
console.putmsg(format(bbs.text(UserDefaultsBatFlag) console.putmsg(format(bbs.text(bbs.text.UserDefaultsBatFlag)
,on_or_off(thisuser.settings & USER_BATCHFLAG))); ,on_or_off(thisuser.settings & USER_BATCHFLAG)));
}
if (bbs.text(bbs.text.UserDefaultsNetMail).length
&& (system.settings & SYS_FWDTONET)) {
keys += 'M';
console.add_hotspot('M'); console.add_hotspot('M');
console.putmsg(format(bbs.text(UserDefaultsNetMail) console.putmsg(format(bbs.text(bbs.text.UserDefaultsNetMail)
,on_or_off(thisuser.settings & USER_NETMAIL), thisuser.netmail)); ,on_or_off(thisuser.settings & USER_NETMAIL), thisuser.netmail));
}
if ((bbs.startup_options & BBS_OPT_AUTO_LOGON) if ((bbs.startup_options & BBS_OPT_AUTO_LOGON)
&& (thisuser.security.exemptions & UFLAG_V)) { && (thisuser.security.exemptions & UFLAG_V)) {
console.add_hotspot('I'); console.add_hotspot('I');
console.putmsg(format(bbs.text(UserDefaultsAutoLogon) console.putmsg(format(bbs.text(bbs.text.UserDefaultsAutoLogon)
,on_or_off(thisuser.security.exceptions & UFLAG_V))); ,on_or_off(thisuser.security.exceptions & UFLAG_V)));
} }
if (bbs.text(bbs.text.UserDefaultsQuiet).length
if(thisuser.security.exemptions & UFLAG_Q) { && (thisuser.security.exemptions & UFLAG_Q)) {
keys += 'D';
console.add_hotspot('D'); console.add_hotspot('D');
console.putmsg(format(bbs.text(UserDefaultsQuiet) console.putmsg(format(bbs.text(bbs.text.UserDefaultsQuiet)
,on_or_off(thisuser.settings & USER_QUIET))); ,on_or_off(thisuser.settings & USER_QUIET)));
} }
if (bbs.text(bbs.text.UserDefaultsProtocol).length) {
keys += 'Z';
console.add_hotspot('Z'); console.add_hotspot('Z');
console.putmsg(format(bbs.text(UserDefaultsProtocol) console.putmsg(format(bbs.text(bbs.text.UserDefaultsProtocol)
,protname + ' ' ,protname + ' '
,thisuser.settings & USER_AUTOHANG ? "(Auto-Hangup)" : '')); ,thisuser.settings & USER_AUTOHANG ? "(Auto-Hangup)" : ''));
}
if (bbs.text(bbs.text.UserDefaultsPassword).length
&& (system.settings & SYS_PWEDIT)
&& !(thisuser.security.restrictions & UFLAG_G)) {
keys += 'W';
console.add_hotspot('W'); console.add_hotspot('W');
console.putmsg(bbs.text(UserDefaultsPassword)); console.putmsg(bbs.text(bbs.text.UserDefaultsPassword));
console.putmsg(bbs.text(UserDefaultsWhich)); }
console.putmsg(bbs.text(bbs.text.UserDefaultsWhich));
console.add_hotspot('Q'); console.add_hotspot('Q');
return keys;
} }
var cfglib = load({}, "cfglib.js"); var cfglib = load({}, "cfglib.js");
...@@ -140,21 +237,9 @@ while(bbs.online && !js.terminated) { ...@@ -140,21 +237,9 @@ while(bbs.online && !js.terminated) {
bbs.node_action = NODE_DFLT; bbs.node_action = NODE_DFLT;
bbs.nodesync(); bbs.nodesync();
console.aborted = false; console.aborted = false;
display_menu(thisuser); if (user.number === thisuser.number)
bbs.load_user_text();
var keys = 'ABCFHKLNPQRSTXYZ?\r'; var keys = display_menu(thisuser);
if(thisuser.security.exemptions & UFLAG_Q)
keys += 'D';
if(Object.getOwnPropertyNames(xtrn_area.editor).length > 0)
keys += 'E';
if((bbs.startup_options & BBS_OPT_AUTO_LOGON)
&& (thisuser.security.exemptions & UFLAG_V))
keys += 'I';
if(system.settings & SYS_FWDTONET)
keys += 'M';
if((system.settings & SYS_PWEDIT)
&& !(thisuser.security.restrictions & UFLAG_G))
keys += 'W';
switch(console.getkeys(keys, K_UPPER)) { switch(console.getkeys(keys, K_UPPER)) {
case 'A': case 'A':
...@@ -168,7 +253,7 @@ while(bbs.online && !js.terminated) { ...@@ -168,7 +253,7 @@ while(bbs.online && !js.terminated) {
for (var i = 0; i < archivetypes.length; i++) { for (var i = 0; i < archivetypes.length; i++) {
console.uselect(i console.uselect(i
,bbs.text(ArchiveTypeHeading) ,bbs.text(bbs.text.ArchiveTypeHeading)
,archivetypes[i]); ,archivetypes[i]);
if (archivetypes[i] === thisuser.temp_file_ext) if (archivetypes[i] === thisuser.temp_file_ext)
defaultext = i; defaultext = i;
...@@ -188,7 +273,8 @@ while(bbs.online && !js.terminated) { ...@@ -188,7 +273,8 @@ while(bbs.online && !js.terminated) {
thisuser.settings ^= USER_QUIET; thisuser.settings ^= USER_QUIET;
break; break;
case 'E': case 'E':
if(console.noyes(bbs.text(UseExternalEditorQ))) { if ((!thisuser.editor && console.noyes(bbs.text(bbs.text.UseExternalEditorQ)))
|| (thisuser.editor && !console.yesno(bbs.text(bbs.text.UseExternalEditorQ)))) {
if (console.aborted) if (console.aborted)
break; break;
thisuser.editor = ''; thisuser.editor = '';
...@@ -199,7 +285,7 @@ while(bbs.online && !js.terminated) { ...@@ -199,7 +285,7 @@ while(bbs.online && !js.terminated) {
for (var code in xtrn_area.editor) for (var code in xtrn_area.editor)
editors.push(code); editors.push(code);
for (var i = 0; i < editors.length; i++) { for (var i = 0; i < editors.length; i++) {
console.uselect(i, bbs.text(ExternalEditorHeading) console.uselect(i, bbs.text(bbs.text.ExternalEditorHeading)
,xtrn_area.editor[editors[i]].name ,xtrn_area.editor[editors[i]].name
,xtrn_area.editor[editors[i]].ars); ,xtrn_area.editor[editors[i]].ars);
if (editors[i] === thisuser.editor) if (editors[i] === thisuser.editor)
...@@ -215,32 +301,47 @@ while(bbs.online && !js.terminated) { ...@@ -215,32 +301,47 @@ while(bbs.online && !js.terminated) {
case 'H': case 'H':
thisuser.settings ^= USER_COLDKEYS; thisuser.settings ^= USER_COLDKEYS;
break; break;
case 'I':
thisuser.settings ^= USER_AUTOLOGON;
break;
case 'K': case 'K':
var defaultshell = 0; var defaultshell = 0;
for (var i = 0; i < main_cfg.shell.length; i++) { for (var i = 0; i < main_cfg.shell.length; i++) {
if (!thisuser.compare_ars(main_cfg.shell[i].ars)) if (!thisuser.compare_ars(main_cfg.shell[i].ars))
continue; continue;
console.uselect(i,bbs.text(CommandShellHeading),main_cfg.shell[i].name,main_cfg.shell[i].ars); console.uselect(i,bbs.text(bbs.text.CommandShellHeading),main_cfg.shell[i].name,main_cfg.shell[i].ars);
if(main_cfg.shell[i].code === user.command_shell.toUpperCase()) if (main_cfg.shell[i].code === thisuser.command_shell.toUpperCase())
defaultshell=i; defaultshell=i;
} }
if ((i=console.uselect(defaultshell))>=0) { if ((i=console.uselect(defaultshell))>=0) {
thisuser.command_shell = main_cfg.shell[i].code; thisuser.command_shell = main_cfg.shell[i].code;
} }
break; break;
case 'I': /* Language */
{
var lang = get_lang_list();
var i;
for (i = 0; i < lang.length; ++i) {
if (thisuser.lang == lang[i])
break;
}
if (i >= lang.length)
i = 0;
var desc = get_lang_desc_list();
for (var j = 0; j < desc.length; ++j) {
console.uselect(j, bbs.text(bbs.text.Language), desc[j]);
}
if ((j = console.uselect(i)) >= 0)
thisuser.lang = lang[j];
break;
}
case 'L': case 'L':
console.putmsg(bbs.text(HowManyColumns)); console.putmsg(bbs.text(bbs.text.HowManyColumns));
thisuser.screen_columns = console.getnum(999,0); thisuser.screen_columns = console.getnum(999,0);
console.putmsg(bbs.text(HowManyRows)); console.putmsg(bbs.text(bbs.text.HowManyRows));
thisuser.screen_rows = console.getnum(999,0); thisuser.screen_rows = console.getnum(999,0);
if (user.number === thisuser.number) if (user.number === thisuser.number)
console.getdimensions(); console.getdimensions();
break; break;
case 'M': case 'M':
console.putmsg(bbs.text(EnterNetMailAddress)); console.putmsg(bbs.text(bbs.text.EnterNetMailAddress));
var email = console.getstr(thisuser.netmail, LEN_NETMAIL var email = console.getstr(thisuser.netmail, LEN_NETMAIL
,K_EDIT | K_AUTODEL | K_LINE | K_TRIM) ,K_EDIT | K_AUTODEL | K_LINE | K_TRIM)
if (email === "" || email === null || console.aborted) { if (email === "" || email === null || console.aborted) {
...@@ -250,8 +351,8 @@ while(bbs.online && !js.terminated) { ...@@ -250,8 +351,8 @@ while(bbs.online && !js.terminated) {
if (thisuser.netmail.length > 0 if (thisuser.netmail.length > 0
&& (system.settings & SYS_FWDTONET) && (system.settings & SYS_FWDTONET)
&& bbs.text(ForwardMailQ).length > 0 && bbs.text(bbs.text.ForwardMailQ).length > 0
&& console.yesno(bbs.text(ForwardMailQ))) && console.yesno(bbs.text(bbs.text.ForwardMailQ)))
thisuser.settings |= USER_NETMAIL; thisuser.settings |= USER_NETMAIL;
else else
thisuser.settings &= ~USER_NETMAIL; thisuser.settings &= ~USER_NETMAIL;
...@@ -268,14 +369,14 @@ while(bbs.online && !js.terminated) { ...@@ -268,14 +369,14 @@ while(bbs.online && !js.terminated) {
case 'S': case 'S':
thisuser.settings ^= USER_SPIN; thisuser.settings ^= USER_SPIN;
if (!(thisuser.settings & USER_SPIN)) { if (!(thisuser.settings & USER_SPIN)) {
if(console.yesno(bbs.text(SpinningCursorOnPauseQ))) if (console.yesno(bbs.text(bbs.text.SpinningCursorOnPauseQ)))
thisuser.settings &= ~USER_NOPAUSESPIN; thisuser.settings &= ~USER_NOPAUSESPIN;
else else
thisuser.settings |= USER_NOPAUSESPIN; thisuser.settings |= USER_NOPAUSESPIN;
} }
break; break;
case 'T': case 'T':
if(console.yesno(bbs.text(AutoTerminalQ))) { if (console.yesno(bbs.text(bbs.text.AutoTerminalQ))) {
thisuser.settings |= USER_AUTOTERM; thisuser.settings |= USER_AUTOTERM;
thisuser.settings &= thisuser.settings &=
~(USER_ANSI | USER_RIP | USER_WIP | USER_HTML | USER_PETSCII | USER_UTF8); ~(USER_ANSI | USER_RIP | USER_WIP | USER_HTML | USER_PETSCII | USER_UTF8);
...@@ -285,16 +386,16 @@ while(bbs.online && !js.terminated) { ...@@ -285,16 +386,16 @@ while(bbs.online && !js.terminated) {
if (console.aborted) if (console.aborted)
break; break;
if (!(thisuser.settings & USER_AUTOTERM)) { if (!(thisuser.settings & USER_AUTOTERM)) {
if(!console.noyes(bbs.text(Utf8TerminalQ))) if (!console.noyes(bbs.text(bbs.text.Utf8TerminalQ)))
thisuser.settings |= USER_UTF8; thisuser.settings |= USER_UTF8;
else else
thisuser.settings &= ~USER_UTF8; thisuser.settings &= ~USER_UTF8;
if(console.yesno(bbs.text(AnsiTerminalQ))) { if (console.yesno(bbs.text(bbs.text.AnsiTerminalQ))) {
thisuser.settings |= USER_ANSI; thisuser.settings |= USER_ANSI;
thisuser.settings &= ~USER_PETSCII; thisuser.settings &= ~USER_PETSCII;
} else if (!(thisuser.settings & USER_UTF8)) { } else if (!(thisuser.settings & USER_UTF8)) {
thisuser.settings &= ~(USER_ANSI | USER_COLOR | USER_ICE_COLOR); thisuser.settings &= ~(USER_ANSI | USER_COLOR | USER_ICE_COLOR);
if(!console.noyes(bbs.text(PetTerminalQ))) if (!console.noyes(bbs.text(bbs.text.PetTerminalQ)))
thisuser.settings |= USER_PETSCII|USER_COLOR; thisuser.settings |= USER_PETSCII|USER_COLOR;
else else
thisuser.settings &= ~USER_PETSCII; thisuser.settings &= ~USER_PETSCII;
...@@ -309,9 +410,9 @@ while(bbs.online && !js.terminated) { ...@@ -309,9 +410,9 @@ while(bbs.online && !js.terminated) {
thisuser.settings |= USER_COLOR; thisuser.settings |= USER_COLOR;
thisuser.settings &= ~USER_ICE_COLOR; thisuser.settings &= ~USER_ICE_COLOR;
if ((thisuser.settings & USER_AUTOTERM) if ((thisuser.settings & USER_AUTOTERM)
|| console.yesno(bbs.text(ColorTerminalQ))) { || console.yesno(bbs.text(bbs.text.ColorTerminalQ))) {
if (!(console.status & (CON_BLINK_FONT|CON_HBLINK_FONT)) if (!(console.status & (CON_BLINK_FONT|CON_HBLINK_FONT))
&& !console.noyes(bbs.text(IceColorTerminalQ))) && !console.noyes(bbs.text(bbs.text.IceColorTerminalQ)))
thisuser.settings |= USER_ICE_COLOR; thisuser.settings |= USER_ICE_COLOR;
} else } else
thisuser.settings &= ~USER_COLOR; thisuser.settings &= ~USER_COLOR;
...@@ -319,7 +420,7 @@ while(bbs.online && !js.terminated) { ...@@ -319,7 +420,7 @@ while(bbs.online && !js.terminated) {
if (console.aborted) if (console.aborted)
break; break;
if (term & USER_ANSI) { if (term & USER_ANSI) {
if(bbs.text(MouseTerminalQ) && console.yesno(bbs.text(MouseTerminalQ))) if (bbs.text(bbs.text.MouseTerminalQ) && console.yesno(bbs.text(bbs.text.MouseTerminalQ)))
thisuser.settings |= USER_MOUSE; thisuser.settings |= USER_MOUSE;
else else
thisuser.settings &= ~USER_MOUSE; thisuser.settings &= ~USER_MOUSE;
...@@ -327,31 +428,31 @@ while(bbs.online && !js.terminated) { ...@@ -327,31 +428,31 @@ while(bbs.online && !js.terminated) {
if (console.aborted) if (console.aborted)
break; break;
if (!(term & USER_PETSCII)) { if (!(term & USER_PETSCII)) {
if(!(term & USER_UTF8) && !console.yesno(bbs.text(ExAsciiTerminalQ))) if (!(term & USER_UTF8) && !console.yesno(bbs.text(bbs.text.ExAsciiTerminalQ)))
thisuser.settings |= USER_NO_EXASCII; thisuser.settings |= USER_NO_EXASCII;
else else
thisuser.settings &= ~USER_NO_EXASCII; thisuser.settings &= ~USER_NO_EXASCII;
thisuser.settings &= ~USER_SWAP_DELETE; thisuser.settings &= ~USER_SWAP_DELETE;
while(bbs.text(HitYourBackspaceKey) while(bbs.text(bbs.text.HitYourBackspaceKey)
&& !(thisuser.settings & (USER_PETSCII | USER_SWAP_DELETE)) && !(thisuser.settings & (USER_PETSCII | USER_SWAP_DELETE))
&& bbs.online) { && bbs.online) {
console.putmsg(bbs.text(HitYourBackspaceKey)); console.putmsg(bbs.text(bbs.text.HitYourBackspaceKey));
var key = console.getkey(K_CTRLKEYS); var key = console.getkey(K_CTRLKEYS);
console.putmsg(format(bbs.text(CharacterReceivedFmt), ascii(key), ascii(key))); console.putmsg(format(bbs.text(bbs.text.CharacterReceivedFmt), ascii(key), ascii(key)));
if (key == '\b') if (key == '\b')
break; break;
if (key == '\x7f') { if (key == '\x7f') {
if(bbs.text(SwapDeleteKeyQ) || console.yesno(bbs.text(SwapDeleteKeyQ))) if (bbs.text(bbs.text.SwapDeleteKeyQ) || console.yesno(bbs.text(bbs.text.SwapDeleteKeyQ)))
thisuser.settings |= USER_SWAP_DELETE; thisuser.settings |= USER_SWAP_DELETE;
} }
else if (key == PETSCII_DELETE) { else if (key == PETSCII_DELETE) {
console.autoterm |= USER_PETSCII; console.autoterm |= USER_PETSCII;
thisuser.settings |= USER_PETSCII; thisuser.settings |= USER_PETSCII;
console.putbyte(PETSCII_UPPERLOWER); console.putbyte(PETSCII_UPPERLOWER);
console.putmsg(bbs.text(PetTerminalDetected)); console.putmsg(bbs.text(bbs.text.PetTerminalDetected));
} }
else else
console.putmsg(format(bbs.text(InvalidBackspaceKeyFmt) console.putmsg(format(bbs.text(bbs.text.InvalidBackspaceKeyFmt)
,ascii(key), ascii(key))); ,ascii(key), ascii(key)));
} }
} }
...@@ -359,7 +460,7 @@ while(bbs.online && !js.terminated) { ...@@ -359,7 +460,7 @@ while(bbs.online && !js.terminated) {
break; break;
if (!(thisuser.settings & USER_AUTOTERM) if (!(thisuser.settings & USER_AUTOTERM)
&& (term&(USER_ANSI|USER_NO_EXASCII)) == USER_ANSI) { && (term&(USER_ANSI|USER_NO_EXASCII)) == USER_ANSI) {
if(!console.noyes(bbs.text(RipTerminalQ))) if (!console.noyes(bbs.text(bbs.text.RipTerminalQ)))
thisuser.settings |= USER_RIP; thisuser.settings |= USER_RIP;
else else
thisuser.settings &= ~USER_RIP; thisuser.settings &= ~USER_RIP;
...@@ -368,17 +469,17 @@ while(bbs.online && !js.terminated) { ...@@ -368,17 +469,17 @@ while(bbs.online && !js.terminated) {
break; break;
break; break;
case 'W': case 'W':
if(console.yesno(bbs.text(NewPasswordQ))){ if (console.yesno(bbs.text(bbs.text.NewPasswordQ))){
console.putmsg(bbs.text(CurrentPassword)); console.putmsg(bbs.text(bbs.text.CurrentPassword));
console.status |= CON_R_ECHOX; console.status |= CON_R_ECHOX;
var str = console.getstr(LEN_PASS * 2, K_UPPER); var str = console.getstr(LEN_PASS * 2, K_UPPER);
console.status &= ~(CON_R_ECHOX|CON_L_ECHOX); console.status &= ~(CON_R_ECHOX|CON_L_ECHOX);
bbs.user_sync(); bbs.user_sync();
if (str !== thisuser.security.password) { if (str !== thisuser.security.password) {
console.putmsg(bbs.text(WrongPassword)); console.putmsg(bbs.text(bbs.text.WrongPassword));
break; break;
} }
console.putmsg(format(bbs.text(NewPasswordPromptFmt) console.putmsg(format(bbs.text(bbs.text.NewPasswordPromptFmt)
,system.min_password_length, system.max_password_length)); ,system.min_password_length, system.max_password_length));
str = console.getstr(LEN_PASS, K_UPPER | K_LINE | K_TRIM); str = console.getstr(LEN_PASS, K_UPPER | K_LINE | K_TRIM);
if (!bbs.good_password(str)) { if (!bbs.good_password(str)) {
...@@ -386,27 +487,27 @@ while(bbs.online && !js.terminated) { ...@@ -386,27 +487,27 @@ while(bbs.online && !js.terminated) {
console.pause(); console.pause();
break; break;
} }
console.putmsg(bbs.text(VerifyPassword)); console.putmsg(bbs.text(bbs.text.VerifyPassword));
console.status |= CON_R_ECHOX; console.status |= CON_R_ECHOX;
var pw = console.getstr(LEN_PASS, K_UPPER | K_LINE | K_TRIM); var pw = console.getstr(LEN_PASS, K_UPPER | K_LINE | K_TRIM);
console.status &= ~(CON_R_ECHOX|CON_L_ECHOX); console.status &= ~(CON_R_ECHOX|CON_L_ECHOX);
if (str !== pw) { if (str !== pw) {
console.putmsg(bbs.text(WrongPassword)); console.putmsg(bbs.text(bbs.text.WrongPassword));
break; break;
} }
thisuser.security.password = str; thisuser.security.password = str;
console.putmsg(bbs.text(PasswordChanged)); console.putmsg(bbs.text(bbs.text.PasswordChanged));
log(LOG_NOTICE,'changed password'); log(LOG_NOTICE,'changed password');
} }
if (file_exists(userSigFilename)) { if (file_exists(userSigFilename)) {
if(console.yesno(bbs.text(ViewSignatureQ))) if (console.yesno(bbs.text(bbs.text.ViewSignatureQ)))
console.printfile(userSigFilename); console.printfile(userSigFilename);
} }
if(console.yesno(bbs.text(CreateEditSignatureQ))) if (console.yesno(bbs.text(bbs.text.CreateEditSignatureQ)))
console.editfile(userSigFilename); console.editfile(userSigFilename);
else { else {
if (file_exists(userSigFilename)) { if (file_exists(userSigFilename)) {
if(console.yesno(bbs.text(DeleteSignatureQ))) if (console.yesno(bbs.text(bbs.text.DeleteSignatureQ)))
file_remove(userSigFilename); file_remove(userSigFilename);
} }
} }
...@@ -424,7 +525,7 @@ while(bbs.online && !js.terminated) { ...@@ -424,7 +525,7 @@ while(bbs.online && !js.terminated) {
if (!thisuser.compare_ars(file_cfg.protocol[code].ars) if (!thisuser.compare_ars(file_cfg.protocol[code].ars)
|| file_cfg.protocol[code].dlcmd.length === 0) || file_cfg.protocol[code].dlcmd.length === 0)
continue; continue;
console.putmsg(format(bbs.text(TransferProtLstFmt) console.putmsg(format(bbs.text(bbs.text.TransferProtLstFmt)
,String(file_cfg.protocol[code].key) ,String(file_cfg.protocol[code].key)
,file_cfg.protocol[code].name)); ,file_cfg.protocol[code].name));
...@@ -433,12 +534,12 @@ while(bbs.online && !js.terminated) { ...@@ -433,12 +534,12 @@ while(bbs.online && !js.terminated) {
console.crlf(); console.crlf();
c++; c++;
} }
console.mnemonics(bbs.text(ProtocolOrQuit)); console.mnemonics(bbs.text(bbs.text.ProtocolOrQuit));
var kp = console.getkeys(keylist); var kp = console.getkeys(keylist);
if (kp === 'Q' || console.aborted) if (kp === 'Q' || console.aborted)
break; break;
thisuser.download_protocol = kp; thisuser.download_protocol = kp;
if(console.yesno(bbs.text(HangUpAfterXferQ))) if (console.yesno(bbs.text(bbs.text.HangUpAfterXferQ)))
thisuser.settings |= USER_AUTOHANG; thisuser.settings |= USER_AUTOHANG;
else else
thisuser.settings &= ~USER_AUTOHANG; thisuser.settings &= ~USER_AUTOHANG;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment