• docs/v322_new.md exec/loa

    From Rob Swindell (on Windows@VERT to Git commit to main/sbbs/m on Sun Oct 25 13:37:00 2026
    https://gitlab.synchro.net/main/sbbs/-/commit/3109381166a8f58a85d97ab2
    Modified Files:
    docs/v322_new.md exec/load/ircd/core.js src/sbbs3/js_console.cpp js_internal.cpp js_socket.cpp js_socket.h sbbs.h
    Log Message:
    js: report asynchronous connect failures and keep callbacks alive

    Socket.connect() with a callback ran the resolve and connect on a thread
    and sent the result over a socket pair that the callback engine never
    read: it set is_connected the moment the thread started and invoked the callback regardless. A refused connect, or a hostname that did not
    resolve (that path sent nothing at all), reached the callback looking
    connected with no peer address. The IRC daemon then sent its server
    handshake into dead links to unreachable hubs and, since outbound
    connects are serialized, delayed its reconnect to a reachable one.

    The thread now reports {error, gai} on every path and the engine reads it before the callback, setting is_connected, error and error_str. The
    socket is not marked connected while the connect is pending.

    Every stored event callback (js.setTimeout/setInterval/setImmediate/ addEventListener, Socket.on/once/connect, console.on/once) was a bare JSFunction* with no GC root, and JS_ValueToFunction() returns the shared function behind a closure, dropping its scope. A callback that captured
    a variable crashed in the interpreter when invoked. Store and root the
    function object that was passed, and call it with JS_CallFunctionValue().

    Windows select() was given a negative timeval when no timer was pending
    and empty descriptor sets when only timers were pending, so connect-only scripts exited with "Timeout with no event" and timer-only scripts with
    "poll() returned with error 22". Pass NULL for an infinite wait and sleep
    when there is nothing to select on.

    All three date from the callback engine's introduction in 1928973941 (2021-04-02) and 06ec7d4148 (2021-04-13). The ircd's connect-failure
    notice now includes the error text.

    Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
  • From Rob Swindell (on Windows@VERT to Git commit to main/sbbs/m on Sat Oct 31 15:29:00 2026
    https://gitlab.synchro.net/main/sbbs/-/commit/e79b7e95b76d02e5eb516ef0
    Modified Files:
    docs/v322_new.md exec/load/dorkit.js src/sbbs3/exec.cpp xtrn/gttrivia/gttrivia.js
    Log Message:
    Scope a script's js.auto_terminate/terminate_on_disconnect change to itself

    sbbs_t::js_callback is one struct per node, shared by every script that js_execfile() runs during the session. dorkit.js (since 5a4e103ff3d, and terminate_on_disconnect since fc82a6d9116) clears both flags at load and
    only sets them again in its own disconnect-timeout path, so after a normal
    exit from a dorkit door (e.g. LORD) every later script on the node ran with
    the disconnect abort and the recycle abort disabled.

    Seen on vert: a caller played LORD, then Good Time Trivia, then dropped the connection. The node stayed "in use" for 20+ hours, its thread rereading
    the trivia question files in a loop, ignoring the disconnect; only the JavaScriptTimeLimit counter would eventually have ended it.

    - js_execfile() saves the two flags before executing a script and restores
    them afterward, so a script's change can't leak into the next one.
    - dorkit.js restores the caller's values via js.on_exit() as well.
    - gttrivia.js: console.getkeys() returns a number (not a string) on abort
    or when the caller is offline; doMainMenu() converted that to "0" and
    fell through to its ACTION_PLAY default forever. Treat a non-string or
    empty result, or an offline caller, as Quit.

    Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
  • From Rob Swindell (on Debian L@VERT to Git commit to main/sbbs/m on Wed Nov 11 22:14:00 2026
    https://gitlab.synchro.net/main/sbbs/-/commit/1a255ae94520c1632ef0acd7
    Modified Files:
    docs/v322_new.md exec/load/msgutils.js
    Log Message:
    msgutils.js: getMessageThreads(sub, max) reads the newest max messages

    With a non-zero max, getMessageThreads() looked up every number from
    last_msg - max to last_msg. get_msg_header() returns null for a missing
    or deleted number, and the loop then threw "TypeError: header is null".
    When it didn't throw, it stored each header under header.num, which is not
    a header property, so every header landed under the key "undefined" and
    only the last one survived: a limit of 100 returned one message. On
    sparsely numbered subs the number window also held fewer than max
    messages.

    Take the newest max index records that are neither deleted nor votes,
    and read those headers by offset. Callers that pass no limit (ecReader by default) still read every header with get_all_msg_headers().

    Part of #1340.

    Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
  • From Rob Swindell (on Windows@VERT to Git commit to main/sbbs/m on Sat Nov 14 17:08:00 2026
    https://gitlab.synchro.net/main/sbbs/-/commit/4e0745220bebd5438c87dd71
    Modified Files:
    docs/v322_new.md exec/load/menubar.js src/sbbs3/js_console.cpp putmsg.cpp terminal.cpp terminal.h
    Log Message:
    @BARATTR: optional second attribute, for a lightbar's command key

    @BARATTR:<attr>:<key-attr>@ names, after the selected-item attribute, a foreground color for the command key of each lightbar item, so that a
    menu whose items are whole words in one color (which makes the entire
    word, first letter included, one selectable and clickable region) can
    still show which letter is the key. @BARATTR::<key-attr>@ sets the key
    color alone.

    As with the selected-item attribute, the Terminal Server only records
    the value, exposed to JavaScript as console.bar_hot_attr; menubar.js
    does the drawing. It redisplays each unselected item with the first
    occurrence of its command in the key color, over the item's own
    background, when the menu is first displayed and whenever an item is deselected. A selected item is drawn entirely in the selected-item
    attribute. Only single-character commands are colored.

    Also: US spelling in two menubar.js comments.

    Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
  • From Rob Swindell (on Windows@VERT to Git commit to main/sbbs/m on Sat Nov 14 20:05:00 2026
    https://gitlab.synchro.net/main/sbbs/-/commit/0a130d7a0dd0706247f2e9d4
    Modified Files:
    docs/v322_new.md exec/load/menubar.js exec/tests/atcodes/lightbars.js src/sbbs3/js_console.cpp putmsg.cpp terminal.cpp terminal.h
    Log Message:
    @BARDEFAULT:cmd@: let a display file name its first-highlighted item

    A lightbar menu always started on the first item in file order unless
    the script displaying it passed a command to MenuBar(), so a sysop
    editing only the menu file had no say in it.

    The new code displays nothing and is reported to scripts as the
    read-only console.bar_default (an empty string when the file has none).
    It takes the same C-escapes as @BAR:cmd@ and is forgotten with the
    other lightbar state when the hot-spots are cleared.

    load/menubar.js uses it only when the script gave MenuBar() no starting
    item: the user's last selection and an explicit argument (including
    false, for no highlight) still take precedence, and a command matching
    no item leaves the first one highlighted.

    Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
  • From Rob Swindell (on Windows@VERT to Git commit to main/sbbs/m on Sat Nov 14 22:39:00 2026
    https://gitlab.synchro.net/main/sbbs/-/commit/511a76aaddef0ab84fd6a0e3
    Modified Files:
    docs/v322_new.md exec/load/select_item.js exec/xtrn_sec.js
    Log Message:
    select_item.js: lightbar navigation of a menu file's @BAR items

    When the menu file displayed in place of a list (the 'menu' option, e.g.
    the xtrn_sec, xtrn<n>, text_sec and text<n> menus) has lightbar items
    (@BAR codes), the arrow, Home and End keys now move the bar among them
    and Enter chooses the highlighted one, via load/menubar.js. An item
    returns what the user could type instead: an item number, the quit key
    or one of the caller's command keys. Typed numbers and keys, and so
    mouse clicks, are read at the prompt as before.

    The bar starts on the item for the caller's default (opts.current), else
    on the one the file names with @BARDEFAULT, else on its first item.

    xtrn_sec.js passes the section or program last chosen as that default,
    so the bar returns to it when a menu is redisplayed. Enter at a section
    menu file with lightbar items enters the highlighted section; without
    them it still quits.

    Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
  • From Rob Swindell (on Windows@VERT to Git commit to main/sbbs/m on Sat Nov 14 23:31:00 2026
    https://gitlab.synchro.net/main/sbbs/-/commit/8d732cb540b7879d7c976f0e
    Modified Files:
    docs/v322_new.md exec/load/select_item.js shell_lib.js exec/text_sec.js uselect.js xtrn_sec.js
    Log Message:
    Find in the select_item.js lists: search by name with boolean terms

    A caller of select_item() that passes the new 'search' option (a
    function returning the text of an item) gets a Find command (issue
    #1345):

    - '/' or 'F' prompts, on the prompt's line, for a boolean search
    expression (see bool_search()), using the SearchStringPrompt text and
    defaulting to the previous search; '?' displays the textsrch help menu
    and a syntax error is reported with InvalidSearchExpression, each
    followed by the prompt again.
    - 'N' and 'P' repeat the search forward and backward, once there has
    been one.
    - Each moves the selected item to the next (or previous) match, wrapping
    around and changing page as needed; FindStringNotFound is displayed
    when nothing matches.

    The keys are named above the prompt: "/=Find" and, after a search,
    "/=Find, Next, Prev", following the "more" indicator or, when the list
    isn't paged, on the prompt's leading blank line. Those are gettext()
    strings (keys find_hint and find_next_hint) displayed as mnemonics, the
    command keys in the normal attribute and the rest in dark gray. A key
    that is one of the caller's own command keys is left out.

    Find is not offered in a list without a selected item (no_default), for
    a menu file displayed in place of a list, or when bool_search() isn't available.

    What is searched:
    - area selection lists (shell_lib.js): description, name and, for
    sub-boards and directories, internal code
    - uselect.js: the item name
    - text_sec.js: section name; file description and filename
    - xtrn_sec.js: section or program name and internal code

    Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
  • From Rob Swindell (on Windows@VERT to Git commit to main/sbbs/m on Sat Nov 14 23:56:00 2026
    https://gitlab.synchro.net/main/sbbs/-/commit/d24c7188639f42e1bb3e8769
    Modified Files:
    docs/v322_new.md exec/load/select_item.js
    Log Message:
    select_item.js: name the Find keys in the prompt; N and P page the list

    Changes to the Find command of the select_item() lists (issue #1345):

    - The keys are named in the list's own prompt rather than on a line
    above it: "Find, " and, once there has been a search, "Next, Prev, "
    are inserted ahead of the prompt's first command key (e.g. "Which,
    Find, Quit, or [3]: "), and a prompt of the form "Which or Quit: "
    becomes "Which, Find, or Quit: ". They are displayed as part of the
    prompt's mnemonics, so 'F', 'N' and 'P' are its highlighted keys.
    The gettext() strings (find_hint, find_slash_hint, find_next_hint)
    use the @Find@, @Next@ and @Previous@ text.
    - 'F' is the key named ('/' remains an alias, and is the one named only
    where 'F' is the caller's own command key).
    - 'N' and 'P' repeat a search only when one has been made in the list as
    currently displayed. Otherwise, and in lists without Find, they page
    the list as PgDn and PgUp do, unless they are the caller's own keys.
    The previous expression is still the default of the next search.

    Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
  • From Rob Swindell (on Windows@VERT to Git commit to main/sbbs/m on Sun Nov 15 15:13:00 2026
    https://gitlab.synchro.net/main/sbbs/-/commit/bdb36a0dea4ec77f44dd01bc
    Modified Files:
    docs/v322_new.md exec/load/menubar.js select_item.js
    Log Message:
    select_item.js, menubar.js: Backspace, Left and Right arrow keys

    In the lists of select_item.js (area selection, uselect.js, text_sec.js, xtrn_sec.js, scancfg.js), Backspace now leaves the list as the quit key
    does. In a single-column list so does the Left arrow key, and the Right
    arrow key chooses the default item, as Enter does. In a multi-column
    list those two keys still move between the columns. A key that's one of
    the caller's own command keys is still returned to the caller.

    MenuBar.move() now returns whether there was an item to move to, and MenuBar.handle() uses that for the Left and Right arrow keys of a menu
    whose items are all in one column: Right returns the current item's
    command (as Enter does) and Left is returned unchanged, which
    select_item.js takes as the quit key for a menu file displayed in place
    of one of its lists.

    Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>