docs: update all docs for :last, :search, :mute-joins and MOTD
Some checks failed
CI / build-and-test (macos-latest) (push) Has been cancelled
CI / build-and-test (ubuntu-latest) (push) Has been cancelled
Deploy / test (push) Has been cancelled
Deploy / deploy (push) Has been cancelled

- README: add new commands to COMMAND mode table, MOTD section,
  update Known Limitations (100-msg limit now softened by :last/:search)
- tnt.1: add :last/:search/:mute-joins to man page command table,
  add motd.txt to FILES section
- CHANGELOG: add 2026-04-23 entry
- QUICKREF: rewrite command section, add new commands, add motd.txt to files
- ROADMAP: mark Stage 4 :last/:search/:mute-joins items as completed
- DEPLOYMENT: add MOTD setup section
This commit is contained in:
m1ngsama 2026-04-23 12:38:04 +08:00
parent ed5fc43cbd
commit eead27544c
6 changed files with 86 additions and 15 deletions

View file

@ -82,6 +82,9 @@ Ctrl+C - Exit chat
:nick <name> - Change nickname
:msg <user> <text> - Whisper to user
:w <user> <text> - Short alias for :msg
:last [N] - Show last N messages from history (max 50, default 10)
:search <keyword> - Search full message history (case-insensitive)
:mute-joins - Toggle join/leave system notifications
:help - Show available commands
:clear - Clear command output
:q, :quit, :exit - Disconnect
@ -276,9 +279,24 @@ See [docs/DEPLOYMENT.md](docs/DEPLOYMENT.md) for details.
```
messages.log - Chat history (RFC3339 format)
host_key - SSH host key (auto-generated, 4096-bit RSA)
motd.txt - Message of the Day (optional, shown to users on connect)
tnt.service - systemd service unit
```
### MOTD (Message of the Day)
Place a `motd.txt` file in the state directory to show a welcome message to every user on connect. Users see the MOTD before entering the chat and press any key to continue.
```sh
# Example (assuming default state dir)
cat > motd.txt <<'EOF'
Welcome to the chat server!
Be respectful. No spam.
EOF
```
Delete `motd.txt` to disable the MOTD.
## Documentation
- [Development Guide](https://github.com/m1ngsama/TNT/wiki/Development-Guide) - Complete development manual
@ -300,7 +318,7 @@ tnt.service - systemd service unit
## Known Limitations
- Single chat room (no multi-room support yet)
- Keeps only last 100 messages in memory
- TUI displays at most 100 messages at once; use `:last N` or `:search` to access older history from disk
- Ctrl+W only recognizes ASCII space as word boundary
## Contributing

View file

@ -1,5 +1,15 @@
# Changelog
## 2026-04-23 - Chat UX Commands and MOTD
### Added
- **`:last [N]`** — show last N messages retrieved directly from the log file (150, default 10), bypassing the 100-message in-memory ring buffer limit
- **`:search <keyword>`** — case-insensitive full-text search across the entire message history on disk; returns the most recent 15 matches
- **`:mute-joins`** — per-client toggle to silence join/leave system notifications; title bar shows `[静音]` when active
- **MOTD support** — place `motd.txt` in the state directory; users see it on connect and press any key to enter chat
- **`message_search()`** — new function in `message.c` / `message.h` for log file keyword search with rolling result collection
- Updated in-TUI help screens (English and Chinese) with new commands
## 2026-03-10 - SSH Runtime & Unix Interface Update
### Fixed

View file

@ -89,6 +89,24 @@ Recommended interpretation:
- `TNT_MAX_CONN_RATE_PER_IP`: new connection attempts allowed per IP per 60 seconds
- `TNT_RATE_LIMIT=0`: disables rate-based blocking and auth-failure IP blocking, but not the explicit capacity limits
## MOTD (Message of the Day)
Place a `motd.txt` file in the state directory. TNT displays it to each user on connect; they press any key to enter the chat.
```bash
# Systemd deployment (state dir is /var/lib/tnt)
sudo tee /var/lib/tnt/motd.txt <<'EOF'
Welcome! Be respectful. No spam.
Type :help for available commands.
EOF
sudo chown tnt:tnt /var/lib/tnt/motd.txt
# Remove to disable
sudo rm /var/lib/tnt/motd.txt
```
No restart required — TNT reads the file on each new connection.
## Firewall
```bash

View file

@ -17,21 +17,37 @@ DEBUG
valgrind --leak-check=full ./tnt
make check
COMMANDS (COMMAND mode, prefix with :)
list, users, who show online users
nick <name> change nickname
msg <user> <text> whisper to user
w <user> <text> alias for msg
last [N] last N messages from log (default 10, max 50)
search <keyword> search full history (case-insensitive, 15 results)
mute-joins toggle join/leave notifications
help show all commands
clear clear output
q / quit / exit disconnect
INSERT MODE
/me <action> action message
@username mention (bell + highlight)
STRUCTURE
src/main.c entry, signals
src/ssh_server.c SSH, threads
src/ssh_server.c SSH, threads, commands
src/chat_room.c broadcast
src/message.c persistence
src/tui.c rendering
src/message.c persistence, search
src/tui.c rendering, help
src/utf8.c unicode
LIMITS
64 clients max
100 messages in RAM
64 clients max (configurable)
100 messages in RAM; unlimited on disk
1024 bytes/message
FILES
HACKING dev guide
CHANGELOG.md changes
messages.log chat log
host_key SSH key
messages.log chat log (RFC3339)
host_key SSH key (auto-generated)
motd.txt message of the day (optional)
CHANGELOG.md version history

View file

@ -59,11 +59,11 @@ Goal: keep the interface efficient for terminal users without sacrificing simpli
- keep the current modal editing model, but make its behavior precise and documented
- support resize, cursor movement, command history, and predictable paste behavior
- add useful chat commands with clear semantics:
- `/nick`
- `/me`
- `/last N`
- `/search`
- `/mute-joins`
- `:nick` / `:name` — nickname change with broadcast
- `/me` — action messages
- `:last N` — show last N messages from disk history
- `:search <keyword>` — case-insensitive full-text search
- `:mute-joins` — per-client join/leave notification toggle
- improve discoverability of NORMAL and COMMAND mode actions
- make status lines and help output concise enough for small terminals

9
tnt.1
View file

@ -107,6 +107,9 @@ l l.
:name \fIname\fR Alias for :nick
:msg \fIuser text\fR Send private whisper
:w \fIuser text\fR Short alias for :msg
:last [\fIN\fR] Show last N messages from history (1\-50, default 10)
:search \fIkeyword\fR Case\-insensitive search across full message history
:mute\-joins Toggle join/leave system notifications on/off
:help Show available commands
:clear Clear command output
:q, :quit, :exit Disconnect
@ -167,6 +170,12 @@ Stored in the state directory.
.I host_key
RSA 4096\-bit host key, auto\-generated on first run.
Stored in the state directory with mode 0600.
.TP
.I motd.txt
Optional Message of the Day.
When present in the state directory, its contents are shown to each user
immediately on connect before the chat screen appears.
Delete the file to disable the MOTD.
.SH SYSTEMD
A unit file
.I tnt.service