Repository navigation
fix(send): @-mention with whitespace = broadcast not DM (closes #141) - #253
Conversation
continuum-b741's QA finding 2026-04-27: `airc msg "@bob looks good"` parsed @bob as DM target and rejected the multi-word remainder (or in post-#234 sent rest as DM). Users want IRC-style in-channel @-mentions for emphasis without forcing them to add filler text before the @name. ## Fix After collecting leading @-tokens into _peer_csv, check for internal whitespace. Peer names are [a-z0-9-] — whitespace inside the parsed target means it's not a peer name. Treat as broadcast intent: put the @-prefix back in the message body, set peer_name=all. airc msg "@bob looks good" → broadcast: '@bob looks good' airc msg @bob "looks good" → DM to bob: 'looks good' (unchanged) airc msg @bob → empty-body error w/ recovery hint (#147) Verification: tabs 19/0; manual exercise of all 3 cases.
There was a problem hiding this comment.
Pull request overview
Adjusts airc msg/airc send DM-target parsing so that a quoted @... token containing whitespace is treated as an in-channel @-mention (broadcast) rather than a DM target, addressing #141.
Changes:
- Adds a whitespace check on the parsed
@target list to reinterpret it as broadcast intent. - Reconstructs the message body by re-attaching the
@prefix when broadcasting. - Updates the “empty body after leading @-tokens” usage guidance to reflect the new rule.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| # #141: if the parsed @-target contains whitespace, it's not a peer | ||
| # name (peer names are [a-z0-9-]); user clearly wanted an in-channel | ||
| # @-mention via something like `airc msg "@bob looks good"`. Treat | ||
| # as broadcast and put the @-prefix back in the message body. | ||
| case "$_peer_csv" in | ||
| *[[:space:]]*) | ||
| msg="@${_peer_csv}" | ||
| if [ -n "$*" ]; then | ||
| msg="${msg} $*" | ||
| fi | ||
| peer_name="all" | ||
| ;; |
There was a problem hiding this comment.
The whitespace-in-$_peer_csv heuristic can accidentally convert an intended DM into a broadcast. Example: airc msg @alice "@bob looks good" currently parses the quoted message as another @-target (because it starts with @), then hits the whitespace branch and broadcasts @alice,bob looks good to everyone. This is a privacy/leak risk. Consider handling this earlier during the while loop: if an @... token contains internal whitespace, stop collecting DM targets and treat that token (with its leading @) as the start of the message body instead of folding it into $_peer_csv.
| # name (peer names are [a-z0-9-]); user clearly wanted an in-channel | ||
| # @-mention via something like `airc msg "@bob looks good"`. Treat | ||
| # as broadcast and put the @-prefix back in the message body. |
There was a problem hiding this comment.
The comment says peer names are [a-z0-9-], but _validate_peer_name enforces [a-z0-9-]+ and also rejects names starting with - (airc:360-372). Please update this comment to match the actual peer-name rules to avoid misleading future changes.
| # name (peer names are [a-z0-9-]); user clearly wanted an in-channel | |
| # @-mention via something like `airc msg "@bob looks good"`. Treat | |
| # as broadcast and put the @-prefix back in the message body. | |
| # name (peer names match [a-z0-9-]+ and cannot start with '-'); | |
| # user clearly wanted an in-channel @-mention via something like | |
| # `airc msg "@bob looks good"`. Treat as broadcast and put the | |
| # @-prefix back in the message body. |
| # #141: if the parsed @-target contains whitespace, it's not a peer | ||
| # name (peer names are [a-z0-9-]); user clearly wanted an in-channel | ||
| # @-mention via something like `airc msg "@bob looks good"`. Treat | ||
| # as broadcast and put the @-prefix back in the message body. | ||
| case "$_peer_csv" in |
There was a problem hiding this comment.
This change introduces new parsing behavior for quoted @-mentions (whitespace inside an @... token). There are integration tests for airc msg/send in test/integration.sh, but none appear to cover the #141 case; adding a scenario for airc msg "@bob looks good" (broadcast) and airc msg @alice "@bob looks good" (should remain a DM) would help prevent regressions.
Whitespace inside the parsed @-target = not a peer name = user wants in-channel @-mention. Treat as broadcast.