• exec/load/max_msgs_waitin

    From Rob Swindell (on Debian L@VERT to Git commit to main/sbbs/m on Sat Nov 21 11:03:00 2026
    https://gitlab.synchro.net/main/sbbs/-/commit/211112f3a0994136d40bc3d9
    Added Files:
    exec/load/max_msgs_waiting_upgrade.js exec/tests/user/mailbox_full/child.inc limit.js skipif
    Modified Files:
    ctrl/sbbs.ini text.dat docs/v322_new.md exec/load/text.js exec/tests/system/rtypes.js exec/update.js src/sbbs3/bulkmail.cpp src/sbbs3/ctrl/MailCfgDlgUnit.cpp MailCfgDlgUnit.dfm MailCfgDlgUnit.h src/sbbs3/email.cpp getmail.c getmail.h js_system.cpp js_user.cpp mailsrvr.cpp mailsrvr.h sbbs.h sbbs_ini.c sbbsdefs.h src/sbbs3/scfg/scfgindex.h scfgmsg.c scfgsrvr.c src/sbbs3/scfgdefs.h scfglib1.c scfgsave.c text.h text_defaults.c text_id.c writemsg.cpp
    Log Message:
    Max Messages Waiting applies to terminal e-mail and bulk mail

    The limit on the messages waiting in a user's Inbox was a mail server
    setting (MaxMsgsWaiting in the [Mail] section of sbbs.ini) and only the
    SMTP server enforced it, so a local sender could fill an Inbox without
    limit. The setting is a sysop's guard against a flooded Inbox, so it now applies wherever a user's mail is delivered at that user's request.

    One function decides: user_mailbox_full() in getmail.c (not userdat.c,
    which addfiles, makeuser, scfg and gtkchat link without getmail.c). A
    mailbox is full with more than the limit of undeleted messages addressed
    to the user in the mail base, spam included, exactly as the SMTP server
    counted them; 0 is no limit, and users with the W exemption are not
    limited. It returns a reason code (one reason today) so that another
    kind of "full" can be added without changing the callers, and it never
    refuses mail whose sender is the system itself, which the caller states.

    Who calls it:
    - SMTP (mailsrvr.cpp): as before, "450 Mailbox full" and the same log
    line, but the check now follows the forwarding decision. A user whose
    mail is only forwarded to a netmail address is no longer refused (no
    local copy is stored), and with Allow Forwarding to NetMail set to
    Both a full Inbox means the message is accepted and forwarded with no
    local copy (logged).
    - Terminal e-mail (sbbs_t::email) and forwarding a message to a local
    user (sbbs_t::forwardmsg): the sender is told at once with the new
    MailboxFull text and nothing is stored.
    - Bulk mail (sbbs_t::bulkmailhdr): a full recipient is skipped and the
    sender is told; the rest are still mailed. Under Both a full recipient
    gets the forwarded copy only. bulkmailhdr() now reports whether it
    stored a message, so a skipped recipient (or one whose record cannot
    be read, which was counted before) no longer raises the reference
    count of the message text.

    Not checked, by decision: FidoNet netmail (SBBSecho), QWK network mail
    and reply packets, system notices (notify(), delivery-failure notices), MsgBase.save_msg() from scripts, and moving a message back to the Inbox.
    There is no exception by recipient: mail to the sysop or to the new user validation user is refused like anyone's unless that account has the W exemption. The one exception is a new user's first message to the
    validation user (no feedback and no e-mail sent yet), which is always delivered: refusing it would make newuser.cpp remove the new account
    for not leaving feedback.

    The setting moves to msgs.ini ([mail] max_msgs_waiting, default 100),
    beside the mailbox quota, because the terminal server, jsexec and
    SBBSecho load msgs.ini but not the mail server's section of sbbs.ini. It
    is edited in SCFG under Message Options (Maximum Messages Waiting) and
    no longer under Servers, Mail Server. While msgs.ini has no such key the configuration loader reads the old MaxMsgsWaiting from this host's
    sbbs.ini, so the limit is unchanged for a system that has not run
    "jsexec update" yet; update.js (max_msgs_waiting_upgrade.js) copies a non-default old value into msgs.ini once, as does setting the value in
    SCFG. Saving anything else in SCFG does not store it: the program
    saving may not see the sbbs.ini the mail server reads (SCFG on Windows
    reads the plain sbbs.ini, not a host's own file), and would replace a
    host's limit with the wrong one. The limit is now one value for every
    host that shares the configuration. sbbs.ini is left as it is: its key
    is no longer written, and is read only as that fallback.
    mail_startup_t keeps its (now unused) max_msgs_waiting member so that
    the struct's layout is unchanged; the field is removed from the Mail
    Server dialog of the Windows Control Panel (sbbsctrl, Borland: edited
    by hand, not built here). scfg_t gains two members, so everything that
    uses it is rebuilt together.

    Scripts: system.max_msgs_waiting (read-only) and User.mailbox_full()
    (0 when new mail is accepted, 1 for too many messages waiting).

    Tested by script (exec/tests/user/mailbox_full, a scratch configuration
    with its own users and mail base): under, at and over the limit, limit
    0, the W exemption, a system sender, spam counted and deleted messages
    not, the old sbbs.ini key used as it is before the update, and the
    update carrying a changed value once and writing nothing for the
    default. The SMTP, terminal and bulk mail paths need a live server or
    session and were read and compiled only. Built with GCC only.

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