feat: relay OwnCast /me messages as IRC CTCP ACTION with bold attribution

When an OwnCast user sends "/me claps", the bridge now relays it as a
proper CTCP ACTION so IRC clients render it natively. The username is
bolded with mIRC \x02 for visual attribution.

Made-with: Cursor
This commit is contained in:
cottongin
2026-03-12 17:14:17 -04:00
parent e2fbd52009
commit 1af9bd1def
3 changed files with 63 additions and 6 deletions

View File

@@ -0,0 +1,17 @@
# OwnCast `/me` to IRC CTCP ACTION
## Task
Detect when OwnCast users type `/me does something` and relay the message to IRC as a proper CTCP ACTION so IRC clients render it natively as an action, with bold attribution on the username.
## Changes Made
- **`src/router.rs`**: Extracted `format_owncast_to_irc()` function. When the body starts with `/me `, strips the prefix and wraps the outbound string as `\x01ACTION {prefix} \x02{username}\x02 {action_body}\x01`. Added 5 unit tests covering: action formatting, multi-word actions, normal passthrough, bare `/me` without space, and `/me` mid-message.
- **`src/irc_task.rs`**: Updated outbound handler to detect strings starting with `\x01` and send them as raw `Command::PRIVMSG` (preserving the CTCP wrapper) instead of using `send_privmsg` which would double-escape.
## Result
- OwnCast user sends: `/me claps`
- IRC clients see: `* bridge-bot [OC] **viewer42** claps` (bold username via mIRC formatting)
- Normal messages are unaffected.
## Follow-up
- None identified. All 60 tests pass.