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
18 lines
1.0 KiB
Markdown
18 lines
1.0 KiB
Markdown
# 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.
|