# qtmonitor — Synchronet BBS Monitor

Cross-platform monitor and control panel for Synchronet BBS systems,
built with Qt6 (Widgets + MQTT). Connects to Synchronet's built-in
`broker.js` MQTT broker via TLS-PSK.

## Features

- Real-time log viewing for all servers (Telnet, Mail, FTP, Web, Services)
- Node status monitoring with verbose descriptions
- Connected client tracking
- Failed login attempt tracking
- Server state and statistics in status bar
- Server control (recycle, pause, resume, clear login attempts)
- Node control (lock, down, interrupt, rerun, send message)
- Force timed events and network callouts
- Dockable/tabbed layout with drag-and-drop rearrangement
- Dark/light theme toggle
- Persistent settings and window layout
- TLS certificate error prompting

## Requirements

- CMake 3.22+
- C++17 compiler
- Linux and other Unix systems: Qt6 development packages from the operating
  system (Core, Gui, Widgets, Network, WebSockets, and Mqtt)
- Windows and macOS: vcpkg with `VCPKG_ROOT` set; the supplied presets install
  the required Qt modules from `vcpkg.json`

## Build

Linux and other Unix systems use the Qt packages supplied by the operating
system:

```sh
cd src/sbbs3/qtmonitor
cmake -S . -B build
cmake --build build
```

On Windows or macOS, first clone and bootstrap
[vcpkg](https://github.com/microsoft/vcpkg), then set `VCPKG_ROOT` to that
checkout. Configure, build, and test with the matching preset:

```sh
# Windows
cmake --preset windows-vcpkg
cmake --build --preset windows-vcpkg
ctest --preset windows-vcpkg

# macOS
cmake --preset macos-vcpkg
cmake --build --preset macos-vcpkg
ctest --preset macos-vcpkg
```

The first vcpkg build may compile Qt. Set `VCPKG_BINARY_SOURCES` to a shared
binary cache to reuse compiled packages across machines and CI jobs.

## Usage

```
qtmonitor -m BROKER_HOST --psk-id ALIAS --psk-key PASSWORD -P SYSPASS
```

| Option | Description |
|--------|-------------|
| `-m HOST` | MQTT broker hostname |
| `-p PORT` | MQTT broker port (defaults to 8883) |
| `-i ID` | BBS system ID for topic prefix (auto-detected if omitted) |
| `-u USER` | MQTT username (not needed for TLS-PSK) |
| `-P PASS` | MQTT password (system password for broker.js) |
| `--psk-id ID` | TLS-PSK identity (sysop alias, lowercased) |
| `--psk-key KEY` | TLS-PSK key (sysop BBS password, lowercased) |

Settings are saved after first use. Subsequent runs need no arguments.

On FreeBSD and Linux, qtmonitor stores these settings in
`~/.config/Synchronet/qtmonitor.conf`. Window geometry and dock layout are
written when qtmonitor closes cleanly.

## Broker Setup

qtmonitor connects to Synchronet's `broker.js`, which provides an
MQTT 5.0 broker with TLS-PSK authentication on port 8883.

Currently, `broker.js` must be run via jsexec:

```sh
jsexec broker.js
```

Configure the BBS MQTT connection in scfg under
Networks > MQTT. Set Enabled to Yes, Broker Address and Port to match
broker.js, and TLS Mode to SBBS.

## Keyboard Shortcuts

| Key | Action |
|-----|--------|
| Ctrl+, | Settings |
| Ctrl+Q | Quit |
| Ctrl+Shift+R | Reset layout |
| Alt+1..9 | Toggle dock panes |

## License

BSD 2-Clause. See LICENSE.
