Open a channel only when the server accepts the join (closes #197) #198

Merged
clawbot merged 1 commits from issue-197-refused-join into next 2026-10-27 05:09:01 +01:00
Collaborator

Closes #197.

When the server refuses a JOIN, POST /api/v1/messages answers HTTP 200 with {"status": "error"} and sends the error numeric to the message queue. Both clients opened the channel anyway.

  • neoirc-cli: JoinChannel in internal/cli/api now returns an error unless the response status is joined. cmdJoin already stops on an error, so its buffer and target stay as they were. An error reads better than a second return value: no caller changes.
  • Web client: joinChannel opens no tab unless the status is joined. The rejoin of saved channels when a fresh session starts gets the same check, since it opened tabs the same way.

The error numeric still shows in the web client's Server tab and the neoirc-cli status buffer.

How item 1 was checked: a headless browser drove the web client of this branch and of next, each built into a local neoircd. It sent /join for an open channel, a bad channel name and an invite-only channel, then logged in fresh with the invite-only channel saved. On next each refused join added a tab; on this branch none did, the active tab stayed put, and the Server tab showed the error numerics.

Disclosures:

  • Judgement call: the saved-channel rejoin in onLogin is fixed too. The issue names only joinChannel, but its definition of done covers any refused join from the web client.
  • Judgement call: on a refused join neoirc-cli also prints "Join failed: the server refused the join" in its status buffer, through its existing error path.

Model: opus-5-5

Closes https://git.eeqj.de/sneak/neoirc/issues/197. When the server refuses a `JOIN`, `POST /api/v1/messages` answers HTTP 200 with `{"status": "error"}` and sends the error numeric to the message queue. Both clients opened the channel anyway. - `neoirc-cli`: `JoinChannel` in `internal/cli/api` now returns an error unless the response status is `joined`. `cmdJoin` already stops on an error, so its buffer and target stay as they were. An error reads better than a second return value: no caller changes. - Web client: `joinChannel` opens no tab unless the status is `joined`. The rejoin of saved channels when a fresh session starts gets the same check, since it opened tabs the same way. The error numeric still shows in the web client's Server tab and the `neoirc-cli` status buffer. How item 1 was checked: a headless browser drove the web client of this branch and of `next`, each built into a local `neoircd`. It sent `/join` for an open channel, a bad channel name and an invite-only channel, then logged in fresh with the invite-only channel saved. On `next` each refused join added a tab; on this branch none did, the active tab stayed put, and the Server tab showed the error numerics. Disclosures: - Judgement call: the saved-channel rejoin in `onLogin` is fixed too. The issue names only `joinChannel`, but its definition of done covers any refused join from the web client. - Judgement call: on a refused join `neoirc-cli` also prints "Join failed: the server refused the join" in its status buffer, through its existing error path. Model: opus-5-5
clawbot added the needs-review label 2026-10-27 04:47:34 +01:00
clawbot self-assigned this 2026-10-27 04:47:34 +01:00
clawbot added 1 commit 2026-10-27 04:47:34 +01:00
When the server refuses a JOIN, POST /api/v1/messages answers 200
with status "error" and sends the error numeric to the queue. Both
clients opened the channel anyway.

JoinChannel in internal/cli/api now returns an error unless the
status is "joined". cmdJoin then keeps its buffer and target and
prints its usual "Join failed" line. The web client opens no tab for
a refused join, whether it came from /join or from the saved
channels a fresh session joins again.

Model: opus-5-5
Author
Collaborator

PASS: a refused join now leaves both clients as they were while the error numeric still shows, and the new internal/cli test fails without the fix.

Judgement call: as README.md documents, the server also refuses a member's own repeat JOIN once the channel is +i, +k or full, so neither client switches to that channel on /join any more; I read this as the rule #197 asks for, not a defect.

Model: opus-5-5

PASS: a refused join now leaves both clients as they were while the error numeric still shows, and the new `internal/cli` test fails without the fix. Judgement call: as `README.md` documents, the server also refuses a member's own repeat `JOIN` once the channel is `+i`, `+k` or full, so neither client switches to that channel on `/join` any more; I read this as the rule https://git.eeqj.de/sneak/neoirc/issues/197 asks for, not a defect. Model: opus-5-5
clawbot merged commit 229c89e1f8 into next 2026-10-27 05:09:01 +01:00
clawbot deleted branch issue-197-refused-join 2026-10-27 05:09:01 +01:00
Sign in to join this conversation.