Files
chat/pkg/irc/commands.go
user 3851909a96
All checks were successful
check / check (push) Successful in 1m4s
feat: implement Tier 1 channel modes (+o/+v/+m/+t), KICK, NOTICE
Implement core IRC channel functionality:

1. Channel member flags: is_operator and is_voiced columns in
   channel_members table (proper boolean columns per sneak's
   instruction, not text string modes).

2. MODE +o/+v/-o/-v: Grant/revoke operator and voice status.
   Permission-checked (only +o can grant). NAMES replies show
   @nick for operators and +nick for voiced users.

3. MODE +m (moderated): Only +o and +v users can send PRIVMSG
   or NOTICE to moderated channels. Others get ERR_CANNOTSENDTOCHAN.

4. MODE +t (topic lock): Only +o can change topic when active.
   Default ON for new channels (standard IRC behavior). Others
   get ERR_CHANOPRIVSNEEDED.

5. KICK command: Operator-only, removes user from channel,
   broadcasts to all members including kicked user.

6. NOTICE differentiation: No RPL_AWAY auto-reply, skips hashcash
   validation on +H channels per RFC 2812.

Additional improvements:
- Channel creator auto-gets +o on first JOIN
- ISUPPORT now advertises PREFIX=(ov)@+ and CHANMODES=,,H,mnst
- MODE query shows accurate +nt/+m/+H mode string
- Fixed pre-existing unparam lint issue in fanOutSilent

Includes 22 new tests covering all requirements.

closes #85
2026-03-22 03:23:18 -07:00

26 lines
496 B
Go

package irc
// IRC command names (RFC 1459 / RFC 2812).
const (
CmdAway = "AWAY"
CmdJoin = "JOIN"
CmdKick = "KICK"
CmdList = "LIST"
CmdLusers = "LUSERS"
CmdMode = "MODE"
CmdMotd = "MOTD"
CmdNames = "NAMES"
CmdNick = "NICK"
CmdNotice = "NOTICE"
CmdOper = "OPER"
CmdPass = "PASS"
CmdPart = "PART"
CmdPing = "PING"
CmdPong = "PONG"
CmdPrivmsg = "PRIVMSG"
CmdQuit = "QUIT"
CmdTopic = "TOPIC"
CmdWho = "WHO"
CmdWhois = "WHOIS"
)