Skip to content

import: mod-tools batch (4 plugins, etc_NewPasswords v3.1.x adapt)#3

Merged
Aybook merged 1 commit into
masterfrom
import/mod-tools
May 6, 2026
Merged

import: mod-tools batch (4 plugins, etc_NewPasswords v3.1.x adapt)#3
Aybook merged 1 commit into
masterfrom
import/mod-tools

Conversation

@Aybook
Copy link
Copy Markdown
Contributor

@Aybook Aybook commented May 6, 2026

Second import batch. Four mod / admin-tool plugins, each in its own subfolder per the layout that landed in #2.

Plugins in this PR

Plugin Upstream Function Notes
`cmd_mainclear` v0.02 (german) Clears main chat by broadcasting blank lines Tiny
`cmd_pm2offliners` v0.8 (multi3) Send PM to offline users with delivery confirmation on next login Lang en/de/sv. Upstream issues #29, #30, #41 are not fixed here (import-first discipline)
`etc_levelcheck` v0.1 (english) Reports caller's user level via PM Debug/admin one-liner
`etc_NewPasswords` v0.4 (multi3) Auto-generates a new password for ineligible users on next login, disconnects them with the new password Lang en/de/sv. v3.1.x compat adapt below.

etc_NewPasswords v3.1.x adapt

The upstream pattern - `util.loadtable("cfg/user.tbl") + util.savearray()` - is incompatible with the AES-256-GCM encrypted `user.tbl` introduced in luadch-ng v3.1.x (Phase 7f). Direct read returns nil (Lua source parser sees ciphertext); direct write would destroy the encrypted file with plaintext.

Switched both touch-points to the proper hub API:

  • Password change path (`onLogin` listener): `target:setpassword(new_pw)` instead of mutating `user_tbl[k].password` and writing the file back. `setpassword` validates against `_regex.reguser.password`, mutates the in-memory profile, and calls `cfg.saveusers()` which encrypts on disk.
  • Enumeration path (`onStart`): `hub.getregusers()` instead of `util.loadtable("cfg/user.tbl")`. Returns the live in-memory `_regusers` array, no file I/O.
  • Dropped now-unused `hub_reloadusers` and `util_savearray` table-lookups; `user_db` constant removed.

Compat note is documented in the file's provenance header so future maintainers know why this script diverges from the upstream version.

Audit

  • Lua 5.4 patterns checked across the batch: zero hits.
  • BOMs at file head: stripped where upstream shipped them.
  • No `os.execute` / `io.popen` / `debug.*` / `module(...)` etc.

Test plan

Out of scope (deferred)

Imports four mod / admin-tool plugins from upstream luadch/scripts.
Each plugin in its own subdirectory with the hub-mirror layout
(scripts/<plugin>/<plugin>.lua + lang/ + data/ where applicable).

- cmd_mainclear (v0.02 german): clears main chat by sending blank
  lines.
- cmd_pm2offliners (v0.8 multi3): send PM to offline users; receives
  delivery confirmation when they next log in. Lang en/de/sv. Three
  upstream open issues touch this script (#29 delivery bug, #30
  minlevel/oplevel settings, #41 settings location); deliberately not
  fixed in this PR per the import-first discipline.
- etc_levelcheck (v0.1 english): reports caller's user level via PM.
  Tiny debug/admin tool.
- etc_NewPasswords (v0.4 multi3): generates new auto-password on
  next login for ineligible users; disconnects them with the new
  password in the kick message. Lang en/de/sv.

  v3.1.x adapt (this fork): the upstream mutated registered-user
  passwords by util.loadtable("cfg/user.tbl") + util.savearray() +
  hub.reloadusers(), which is incompatible with the AES-256-GCM
  encrypted user.tbl introduced in luadch-ng v3.1.x (Phase 7f).
  Switched to the user-object API: target:setpassword(new_pw) for the
  password change path; hub.getregusers() for the onStart enumeration.
  Both go through cfg.saveusers() and the encrypted-save path
  transparently. The compat note is documented in the file's
  provenance header.

Same audit pass as the chat & messaging batch (PR #1): zero hits for
the Lua-5.4-incompatible patterns, BOMs stripped where upstream
shipped them.

Smoke harness against luadch-ng/luadch v3.1.1: 10 / 10 PASS with
both the chat & messaging batch and this batch dropped into the
install tree, including the "no script errors in log" gate. The
etc_NewPasswords onStart runs against the live regusers table, so
the v3.1.x adapt is exercised by the boot path.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant