Re: Help using gettext.js
By: vela025 to Digital Man on Sun Oct 20 2024 12:55 pm
>
> I thought I was doing so well! but there's now an odd issue occurring when
> swapping from one terminal type to another.
>
> Scenario 1: Log in a Mode 7 terminal everything's fine, Next login using an
> ANSI terminal, message summary screen overlays some text over avatar, Log
> out, Log in again using ANSI terminal everything is fine.
"next login" as the same user or a different user? Is either user a "guest" account (have the 'G' restriction)?
> Scenario 2: Login to Mode 7 after having previously used ANSI terminal and
> some prompts are not using the BBC "language.ini" customisation (but some
> are, and some are, but ignoring the colour codes). The main menu is shifted
> after the first row, log out, log back in using Mode 7 and everything is
> fine.
console.term_supports() is the function used to normally determine what the user's console's terminal type/capabilties are (compare the return values with the USER_* bit definitions for terminal types/caps in sbbsdefs.js). You're doing something unique/different using a language file to control terminal type. I'm not surprised it's a challenge.
> I've put screenshots here:
>
http://beebs.ddns.net/BeeBS/My_Albums/Pages/Synchronet.html which probably
> make more sense.
I looked at it, but doesn't tell me any specific cause.
> Previously before I added the terminal type selection at logon when the user
> used to have to change the terminal settings manually (using D from the main
> menu) this also required the user to log out and back in for all settings
> to take effect. Is there a command that will "refresh" the settings to
> ensure they're all being used?
Which "settings" are you referring to? A current client/user's terminal type is normally detected during initial connection/answer and then can be overridden by a user's terminal settings once they login. Most users's use auto-terminal type detection, so they can automatically switch between CP437/ANSI, UTF-8/ANSI and PETSCII clients without having to reconfigure anything. You're doing something unique and different with your BBS.
> This is the terminal selection script I've cobbled together:
>
> switch (userChoice) {
> case "4":
> user.lang = "ascii";
> user.settings &= ~(USER_AUTOTERM | USER_ANSI | USER_RIP |
> USER_WIP | USER_HTML | USER_PETSCII | USER_UTF8);
> user.settings &= ~USER_NO_EXASCII;
> user.screen_columns = 40;
> user.screen_rows = 25;
> break;
I would think an "ascii" terminal would want no extended ASCII (IBM CP437) characters, so that USER_NO_EXASCII flag should be set (not cleared).
I'm not clear why you're assuming an "ascii" terminal is only 40 columns wide and 25 lines long. That seems wrong.
> case "7":
> user.lang = "bbcmicro";
> user.settings &= ~(USER_AUTOTERM | USER_ANSI | USER_RIP |
> USER_WIP | USER_HTML | USER_PETSCII | USER_UTF8);
> user.settings &= ~USER_NO_EXASCII;
> user.screen_columns = 40;
> user.screen_rows = 25;
> break;
> case "8":
> user.lang = "ansi";
> user.settings &= ~(USER_AUTOTERM | USER_RIP | USER_WIP |
> USER_HTML | USER_PETSCII | USER_UTF8);
> user.settings &= ~USER_NO_EXASCII;
> user.settings |= USER_ANSI;
> user.screen_columns = 80;
> user.screen_rows = 25;
> break;
Why assume that ANSI terminals are 80x25? Why assume ANSI terminals are using CP437 (IBM extended ASCII) and not UTF-8? Why is "ansi" a different language than "ascii"?
You don't need to bother clearing/worrying about USER_HTML or USER_WIP flags. Those flags are deprecated and unused.
> default:
> user.lang = "ascii";
> user.settings &= ~(USER_AUTOTERM | USER_ANSI | USER_RIP |
> USER_WIP | USER_HTML | USER_PETSCII | USER_UTF8);
> user.settings &= ~USER_NO_EXASCII;
> user.screen_columns = 40;
> user.screen_rows = 25;
> break;
> }
If JS, you can just put "default:" on the line before the "case" statement you want to be the default. You don't need to copy/past blocks of code if the default is the same as another case.
Anyway, you can call console.term_supports() and log/check the return value (e.g. in hexadecimal) against the terminal-related bits you just set in user.settings. This will reflect the current flags used internally in SBBS to determine the user's terminal type.
--
digital man (rob)
Synchronet/BBS Terminology Definition #22:
DOCSIS = Data Over Cable Service Interface Specification
Norco, CA WX: 84.3øF, 20.0% humidity, 4 mph WSW wind, 0.00 inches rain/24hrs
---
þ Synchronet þ Vertrauen þ Home of Synchronet þ [vert/cvs/bbs].synchro.net