Ken Johnson 486dff6b95 Write-to-existing and Pack tests against real base copies
- test_write_existing: append to 291-msg JAM base, 27-msg netmail
  dir, and a Hudson base seeded on-demand by copying 50 messages
  from the JAM source (no binary samples committed).
- test_pack: no-op Pack preserves JAM count + fields; purge-Pack
  drops 5 deleted JAM messages; Hudson seed+mark-deleted+Pack
  drops 7 of 50 and survivors stay readable.
- Source trees at ~/fidonet/msg/jam + ~/fidonet/msg/netmail are
  never touched; all writes go to /tmp scratch copies.
2026-04-15 08:46:42 -07:00

message_api

A unified Free Pascal library for reading and writing classic BBS message bases.

Wraps proven message-format handlers from Allfix behind one polymorphic API (TMessageBase) so BBS software, mail tossers, message editors, and utilities can target a single interface regardless of the underlying format on disk.

Supported formats

Format Files Backend unit
Hudson MSGINFO/IDX/HDR/TXT/TOIDX.BBS ma.fmt.hudson.pas
JAM *.JHR *.JDT *.JDX *.JLR ma.fmt.jam.pas
Squish *.SQD *.SQI *.SQL ma.fmt.squish.pas
FTS-1 MSG numbered *.MSG per directory ma.fmt.msg.pas
FTN PKT *.pkt (Type-2 / 2+ / 2.2) ma.fmt.pkt.pas
PCBoard *.MSG + *.IDX ma.fmt.pcboard.pas
EzyCom MH#####.BBS / MT#####.BBS ma.fmt.ezycom.pas
GoldBase MSGINFO/IDX/HDR/TXT/TOIDX.DAT ma.fmt.goldbase.pas
Wildcat 4 WC SDK databases ma.fmt.wildcat.pas

Features

  • One TMessageBase abstract class — read, write, pack, reindex through the same methods regardless of format.
  • Layered locking: in-process TRTLCriticalSection + cross-process advisory lock (fpflock on Unix, LockFileEx on Windows, .LCK sentinel fallback)
    • the existing fmShareDenyWrite / fmShareDenyNone share modes.
  • Event hooks for logging, progress, and status reporting.
  • TPacketBatch worker pool for tossers that need to process many .pkt files concurrently while serialising writes per destination base.
  • Path / filename auto-derivation per format from a base directory plus optional area tag.

Building

Native Linux:

fpc -Fusrc -Fusrc/formats examples/example_read.pas

Lazarus package:

lazbuild message_api.lpk

The repo includes a fpc.cfg template mirroring the Allfix multi-target build (i386-go32v2, i386-win32, i386-linux, i386-os2).

Layout

src/                ma.api, ma.types, ma.events, ma.lock, ma.paths, ma.batch
src/formats/        ma.fmt.<format>.pas — one per supported format
docs/               architecture, locking semantics, format notes
tests/              FPCUnit tests, sample data
examples/           small CLI programs that double as smoke tests

Unit-name convention follows the Fimail style: ma.<category>.<name>.pas (ma = message_api). All units use {$mode objfpc}{$H+}.

Status

Early development. APIs may move until 1.0. Format backends are ports of the working Allfix code so behaviour matches what Allfix produces today.

Description
Unified Free Pascal library for reading/writing classic BBS message bases: Hudson, JAM, Squish, FTS-1 *.MSG, PCBoard, EzyCom, GoldBase, Wildcat 4.
Readme 1.2 MiB
Languages
Pascal 99.5%
Shell 0.5%