An IRC listener user gets their own TOPIC, MODE and KICK twice #143

Closed
opened 2026-10-20 16:51:33 +02:00 by clawbot · 0 comments
Collaborator

SetTopic, KickUser and BroadcastMode in internal/service/service.go fan the TOPIC, KICK and MODE message out to every channel member, the issuer included. The IRC listener's handleTopic, handleKick and applyChannelModes (internal/ircserver/commands.go) also write an echo to the issuer's connection. The relay (internal/ircserver/relay.go) drops a user's own PRIVMSG, NOTICE, JOIN, PART, NICK and QUIT, but deliverTopicChange, deliverKickMsg and deliverMode have no such check, so the issuer gets the line twice.

Seen on eceb5f2 with alice and carl on #dup over the IRC listener. alice sends TOPIC #dup :new topic and receives

:alice!alice@localhost TOPIC #dup :new topic
:alice!alice@* TOPIC #dup :new topic

MODE #dup +m gives her two MODE lines and KICK #dup carl :bye two KICK lines, the relayed copy sometimes before the echo. carl receives each once. An IRC client shows every topic change, mode change and kick its user makes twice.

README.md (MODE, "On the IRC listener") describes the double delivery for MODE: "echoed to the operator's connection and also sent to every channel member, the operator included".

Fix: in relay.go, skip a TOPIC, KICK or MODE whose from is the connection's own nick, with the one own-nick check the other five already use. The direct echo stays, since it carries the real hostmask and arrives in order. A change made from another client of the same session then reaches the IRC connection no more than a PRIVMSG from that client does today. The README MODE sentence changes to say the operator gets one line.

Definition of done

  1. An IRC listener user who sets a topic, changes a channel mode or kicks gets exactly one TOPIC, MODE or KICK line; the other members still get theirs once.
  2. Tests in internal/ircserver that count the lines for each of the three.
  3. README.md MODE no longer describes a second copy.
  4. One reviewed PR against next.

Model: fable-5-1

`SetTopic`, `KickUser` and `BroadcastMode` in `internal/service/service.go` fan the TOPIC, KICK and MODE message out to every channel member, the issuer included. The IRC listener's `handleTopic`, `handleKick` and `applyChannelModes` (`internal/ircserver/commands.go`) also write an echo to the issuer's connection. The relay (`internal/ircserver/relay.go`) drops a user's own PRIVMSG, NOTICE, JOIN, PART, NICK and QUIT, but `deliverTopicChange`, `deliverKickMsg` and `deliverMode` have no such check, so the issuer gets the line twice. Seen on `eceb5f2` with `alice` and `carl` on `#dup` over the IRC listener. alice sends `TOPIC #dup :new topic` and receives ``` :alice!alice@localhost TOPIC #dup :new topic :alice!alice@* TOPIC #dup :new topic ``` `MODE #dup +m` gives her two MODE lines and `KICK #dup carl :bye` two KICK lines, the relayed copy sometimes before the echo. carl receives each once. An IRC client shows every topic change, mode change and kick its user makes twice. `README.md` (MODE, "On the IRC listener") describes the double delivery for MODE: "echoed to the operator's connection and also sent to every channel member, the operator included". Fix: in `relay.go`, skip a TOPIC, KICK or MODE whose `from` is the connection's own nick, with the one own-nick check the other five already use. The direct echo stays, since it carries the real hostmask and arrives in order. A change made from another client of the same session then reaches the IRC connection no more than a PRIVMSG from that client does today. The README MODE sentence changes to say the operator gets one line. ## Definition of done 1. An IRC listener user who sets a topic, changes a channel mode or kicks gets exactly one TOPIC, MODE or KICK line; the other members still get theirs once. 2. Tests in `internal/ircserver` that count the lines for each of the three. 3. `README.md` MODE no longer describes a second copy. 4. One reviewed PR against `next`. Model: fable-5-1
clawbot self-assigned this 2026-10-20 16:51:33 +02:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: sneak/neoirc#143