feat: implement IRC numerics batch 2 — connection registration, channel ops, user queries
Add comprehensive IRC numeric reply support: Connection registration (001-005): - 002 RPL_YOURHOST, 003 RPL_CREATED, 004 RPL_MYINFO, 005 RPL_ISUPPORT - All sent automatically during session creation after RPL_WELCOME Server statistics (251-255): - RPL_LUSERCLIENT, RPL_LUSEROP, RPL_LUSERCHANNELS, RPL_LUSERME - Sent during connection registration and via LUSERS command Channel operations: - MODE command: query channel modes (324 RPL_CHANNELMODEIS, 329 RPL_CREATIONTIME) - MODE command: query user modes (221 RPL_UMODEIS) - NAMES command: query channel member list (353/366) - LIST command: list all channels (322 RPL_LIST, 323 end of list) User queries: - WHOIS command: 311/312/318/319 numerics - WHO command: 352 RPL_WHOREPLY, 315 RPL_ENDOFWHO Database additions: - GetChannelCount, ListAllChannelsWithCounts - GetChannelCreatedAt, GetSessionCreatedAt Also adds StartTime to Globals for RPL_CREATED and updates README with comprehensive documentation of all new commands and numerics. closes #52
This commit is contained in:
156
README.md
156
README.md
@@ -764,21 +764,98 @@ not pollute the message queue.
|
||||
|
||||
**IRC reference:** RFC 1459 §4.6.2, §4.6.3
|
||||
|
||||
#### MODE — Set/Query Modes (Planned)
|
||||
#### MODE — Query Modes
|
||||
|
||||
Set channel or user modes.
|
||||
Query channel or user modes. Returns the current mode string and, for
|
||||
channels, the creation timestamp.
|
||||
|
||||
**C2S:**
|
||||
```json
|
||||
{"command": "MODE", "to": "#general", "params": ["+m"]}
|
||||
{"command": "MODE", "to": "#general", "params": ["+o", "alice"]}
|
||||
{"command": "MODE", "to": "#general"}
|
||||
{"command": "MODE", "to": "alice"}
|
||||
```
|
||||
|
||||
**Status:** Not yet implemented. See [Channel Modes](#channel-modes) for the
|
||||
planned mode set.
|
||||
**S2C (via message queue):**
|
||||
|
||||
For channels, the server sends RPL_CHANNELMODEIS (324) and
|
||||
RPL_CREATIONTIME (329):
|
||||
```json
|
||||
{"command": "324", "to": "alice", "params": ["#general", "+n"]}
|
||||
{"command": "329", "to": "alice", "params": ["#general", "1709251200"]}
|
||||
```
|
||||
|
||||
For users, the server sends RPL_UMODEIS (221):
|
||||
```json
|
||||
{"command": "221", "to": "alice", "body": ["+"]}
|
||||
```
|
||||
|
||||
**Note:** Mode changes (setting/unsetting modes) are not yet implemented.
|
||||
Currently only query is supported.
|
||||
|
||||
**IRC reference:** RFC 1459 §4.2.3
|
||||
|
||||
#### NAMES — Channel Member List
|
||||
|
||||
Request the member list for a channel. Returns RPL_NAMREPLY (353) and
|
||||
RPL_ENDOFNAMES (366).
|
||||
|
||||
**C2S:**
|
||||
```json
|
||||
{"command": "NAMES", "to": "#general"}
|
||||
```
|
||||
|
||||
**IRC reference:** RFC 1459 §4.2.5
|
||||
|
||||
#### LIST — List Channels
|
||||
|
||||
Request a list of all channels with member counts. Returns RPL_LIST (322)
|
||||
for each channel followed by RPL_LISTEND (323).
|
||||
|
||||
**C2S:**
|
||||
```json
|
||||
{"command": "LIST"}
|
||||
```
|
||||
|
||||
**IRC reference:** RFC 1459 §4.2.6
|
||||
|
||||
#### WHOIS — User Information
|
||||
|
||||
Query information about a user. Returns RPL_WHOISUSER (311),
|
||||
RPL_WHOISSERVER (312), RPL_WHOISCHANNELS (319), and RPL_ENDOFWHOIS (318).
|
||||
|
||||
**C2S:**
|
||||
```json
|
||||
{"command": "WHOIS", "to": "alice"}
|
||||
```
|
||||
|
||||
**IRC reference:** RFC 1459 §4.5.2
|
||||
|
||||
#### WHO — Channel User List
|
||||
|
||||
Query users in a channel. Returns RPL_WHOREPLY (352) for each user followed
|
||||
by RPL_ENDOFWHO (315).
|
||||
|
||||
**C2S:**
|
||||
```json
|
||||
{"command": "WHO", "to": "#general"}
|
||||
```
|
||||
|
||||
**IRC reference:** RFC 1459 §4.5.1
|
||||
|
||||
#### LUSERS — Server Statistics
|
||||
|
||||
Request server user/channel statistics. Returns RPL_LUSERCLIENT (251),
|
||||
RPL_LUSEROP (252), RPL_LUSERCHANNELS (254), and RPL_LUSERME (255).
|
||||
|
||||
**C2S:**
|
||||
```json
|
||||
{"command": "LUSERS"}
|
||||
```
|
||||
|
||||
LUSERS replies are also sent automatically during connection registration.
|
||||
|
||||
**IRC reference:** RFC 1459 §4.3.2
|
||||
|
||||
#### KICK — Kick User (Planned)
|
||||
|
||||
Remove a user from a channel.
|
||||
@@ -828,12 +905,27 @@ the server to the client (never C2S) and use 3-digit string codes in the
|
||||
| Code | Name | When Sent | Example |
|
||||
|------|----------------------|-----------|---------|
|
||||
| `001` | RPL_WELCOME | After session creation | `{"command":"001","to":"alice","body":["Welcome to the network, alice"]}` |
|
||||
| `002` | RPL_YOURHOST | After session creation | `{"command":"002","to":"alice","body":["Your host is neoirc-server, running version 0.1"]}` |
|
||||
| `002` | RPL_YOURHOST | After session creation | `{"command":"002","to":"alice","body":["Your host is neoirc, running version 0.1"]}` |
|
||||
| `003` | RPL_CREATED | After session creation | `{"command":"003","to":"alice","body":["This server was created 2026-02-10"]}` |
|
||||
| `004` | RPL_MYINFO | After session creation | `{"command":"004","to":"alice","params":["neoirc-server","0.1","","imnst"]}` |
|
||||
| `004` | RPL_MYINFO | After session creation | `{"command":"004","to":"alice","params":["neoirc","0.1","","imnst"]}` |
|
||||
| `005` | RPL_ISUPPORT | After session creation | `{"command":"005","to":"alice","params":["CHANTYPES=#","NICKLEN=32","NETWORK=neoirc"],"body":["are supported by this server"]}` |
|
||||
| `221` | RPL_UMODEIS | In response to user MODE query | `{"command":"221","to":"alice","body":["+"]}` |
|
||||
| `251` | RPL_LUSERCLIENT | On connect or LUSERS command | `{"command":"251","to":"alice","body":["There are 5 users and 0 invisible on 1 servers"]}` |
|
||||
| `252` | RPL_LUSEROP | On connect or LUSERS command | `{"command":"252","to":"alice","params":["0"],"body":["operator(s) online"]}` |
|
||||
| `254` | RPL_LUSERCHANNELS | On connect or LUSERS command | `{"command":"254","to":"alice","params":["3"],"body":["channels formed"]}` |
|
||||
| `255` | RPL_LUSERME | On connect or LUSERS command | `{"command":"255","to":"alice","body":["I have 5 clients and 1 servers"]}` |
|
||||
| `311` | RPL_WHOISUSER | In response to WHOIS | `{"command":"311","to":"alice","params":["bob","bob","neoirc","*"],"body":["bob"]}` |
|
||||
| `312` | RPL_WHOISSERVER | In response to WHOIS | `{"command":"312","to":"alice","params":["bob","neoirc"],"body":["neoirc server"]}` |
|
||||
| `315` | RPL_ENDOFWHO | End of WHO response | `{"command":"315","to":"alice","params":["#general"],"body":["End of /WHO list"]}` |
|
||||
| `318` | RPL_ENDOFWHOIS | End of WHOIS response | `{"command":"318","to":"alice","params":["bob"],"body":["End of /WHOIS list"]}` |
|
||||
| `319` | RPL_WHOISCHANNELS | In response to WHOIS | `{"command":"319","to":"alice","params":["bob"],"body":["#general #dev"]}` |
|
||||
| `322` | RPL_LIST | In response to LIST | `{"command":"322","to":"alice","params":["#general","5"],"body":["General discussion"]}` |
|
||||
| `323` | RPL_LISTEND | End of LIST response | `{"command":"323","to":"alice","body":["End of /LIST"]}` |
|
||||
| `324` | RPL_CHANNELMODEIS | In response to channel MODE query | `{"command":"324","to":"alice","params":["#general","+n"]}` |
|
||||
| `329` | RPL_CREATIONTIME | After channel MODE query | `{"command":"329","to":"alice","params":["#general","1709251200"]}` |
|
||||
| `331` | RPL_NOTOPIC | Channel has no topic (on JOIN) | `{"command":"331","to":"alice","params":["#general"],"body":["No topic is set"]}` |
|
||||
| `332` | RPL_TOPIC | On JOIN or TOPIC query | `{"command":"332","to":"alice","params":["#general"],"body":["Welcome!"]}` |
|
||||
| `352` | RPL_WHOREPLY | In response to WHO | `{"command":"352","to":"alice","params":["#general","bob","neoirc","neoirc","bob","H"],"body":["0 bob"]}` |
|
||||
| `353` | RPL_NAMREPLY | On JOIN or NAMES query | `{"command":"353","to":"alice","params":["=","#general"],"body":["@op1 alice bob +voiced1"]}` |
|
||||
| `366` | RPL_ENDOFNAMES | End of NAMES response | `{"command":"366","to":"alice","params":["#general"],"body":["End of /NAMES list"]}` |
|
||||
| `372` | RPL_MOTD | MOTD line | `{"command":"372","to":"alice","body":["Welcome to the server"]}` |
|
||||
@@ -841,8 +933,11 @@ the server to the client (never C2S) and use 3-digit string codes in the
|
||||
| `376` | RPL_ENDOFMOTD | End of MOTD | `{"command":"376","to":"alice","body":["End of /MOTD command"]}` |
|
||||
| `401` | ERR_NOSUCHNICK | DM to nonexistent nick | `{"command":"401","to":"alice","params":["bob"],"body":["No such nick/channel"]}` |
|
||||
| `403` | ERR_NOSUCHCHANNEL | Action on nonexistent channel | `{"command":"403","to":"alice","params":["#nope"],"body":["No such channel"]}` |
|
||||
| `421` | ERR_UNKNOWNCOMMAND | Unrecognized command | `{"command":"421","to":"alice","params":["FOO"],"body":["Unknown command"]}` |
|
||||
| `432` | ERR_ERRONEUSNICKNAME | Invalid nick format | `{"command":"432","to":"alice","params":["bad nick!"],"body":["Erroneous nickname"]}` |
|
||||
| `433` | ERR_NICKNAMEINUSE | NICK to taken nick | `{"command":"433","to":"*","params":["alice"],"body":["Nickname is already in use"]}` |
|
||||
| `442` | ERR_NOTONCHANNEL | Action on unjoined channel | `{"command":"442","to":"alice","params":["#general"],"body":["You're not on that channel"]}` |
|
||||
| `461` | ERR_NEEDMOREPARAMS | Missing required fields | `{"command":"461","to":"alice","params":["JOIN"],"body":["Not enough parameters"]}` |
|
||||
| `482` | ERR_CHANOPRIVSNEEDED | Non-op tries op action | `{"command":"482","to":"alice","params":["#general"],"body":["You're not channel operator"]}` |
|
||||
|
||||
**Note:** Numeric replies are now implemented. All IRC command responses
|
||||
@@ -1061,6 +1156,12 @@ reference with all required and optional fields.
|
||||
| `PART` | `to` | `body` | 200 OK |
|
||||
| `NICK` | `body` | | 200 OK |
|
||||
| `TOPIC` | `to`, `body` | | 200 OK |
|
||||
| `MODE` | `to` | | 200 OK |
|
||||
| `NAMES` | `to` | | 200 OK |
|
||||
| `LIST` | | | 200 OK |
|
||||
| `WHOIS` | `to` or `body` | | 200 OK |
|
||||
| `WHO` | `to` | | 200 OK |
|
||||
| `LUSERS` | | | 200 OK |
|
||||
| `QUIT` | | `body` | 200 OK |
|
||||
| `PING` | | | 200 OK |
|
||||
|
||||
@@ -1095,10 +1196,29 @@ auth tokens (401), and server errors (500).
|
||||
| Numeric | Name | When |
|
||||
|---------|------|------|
|
||||
| 001 | RPL_WELCOME | Sent on session creation/login |
|
||||
| 002 | RPL_YOURHOST | Sent on session creation/login |
|
||||
| 003 | RPL_CREATED | Sent on session creation/login |
|
||||
| 004 | RPL_MYINFO | Sent on session creation/login |
|
||||
| 005 | RPL_ISUPPORT | Sent on session creation/login |
|
||||
| 221 | RPL_UMODEIS | In response to user MODE query |
|
||||
| 251 | RPL_LUSERCLIENT | On connect or LUSERS command |
|
||||
| 252 | RPL_LUSEROP | On connect or LUSERS command |
|
||||
| 254 | RPL_LUSERCHANNELS | On connect or LUSERS command |
|
||||
| 255 | RPL_LUSERME | On connect or LUSERS command |
|
||||
| 311 | RPL_WHOISUSER | WHOIS user info |
|
||||
| 312 | RPL_WHOISSERVER | WHOIS server info |
|
||||
| 315 | RPL_ENDOFWHO | End of WHO list |
|
||||
| 318 | RPL_ENDOFWHOIS | End of WHOIS list |
|
||||
| 319 | RPL_WHOISCHANNELS | WHOIS channels list |
|
||||
| 322 | RPL_LIST | Channel in LIST response |
|
||||
| 323 | RPL_LISTEND | End of LIST |
|
||||
| 324 | RPL_CHANNELMODEIS | Channel mode query response |
|
||||
| 329 | RPL_CREATIONTIME | Channel creation timestamp |
|
||||
| 331 | RPL_NOTOPIC | Channel has no topic (on JOIN) |
|
||||
| 332 | RPL_TOPIC | Channel topic (on JOIN, TOPIC set) |
|
||||
| 353 | RPL_NAMREPLY | Channel member list (on JOIN) |
|
||||
| 366 | RPL_ENDOFNAMES | End of NAMES list (on JOIN) |
|
||||
| 352 | RPL_WHOREPLY | User in WHO response |
|
||||
| 353 | RPL_NAMREPLY | Channel member list (on JOIN, NAMES) |
|
||||
| 366 | RPL_ENDOFNAMES | End of NAMES list |
|
||||
| 375 | RPL_MOTDSTART | Start of MOTD |
|
||||
| 372 | RPL_MOTD | MOTD line |
|
||||
| 376 | RPL_ENDOFMOTD | End of MOTD |
|
||||
@@ -2104,10 +2224,18 @@ GET /api/v1/challenge
|
||||
- [ ] **Message rotation** — enforce `MAX_HISTORY` per channel
|
||||
- [ ] **Channel modes** — enforce `+i`, `+m`, `+s`, `+t`, `+n`
|
||||
- [ ] **User channel modes** — `+o` (operator), `+v` (voice)
|
||||
- [ ] **MODE command** — set/query channel and user modes
|
||||
- [x] **MODE command** — query channel and user modes (set not yet implemented)
|
||||
- [x] **NAMES command** — query channel member list
|
||||
- [x] **LIST command** — list all channels with member counts
|
||||
- [x] **WHOIS command** — query user information and channel membership
|
||||
- [x] **WHO command** — query channel user list
|
||||
- [x] **LUSERS command** — query server statistics
|
||||
- [x] **Connection registration numerics** — 001-005 sent on session creation
|
||||
- [x] **LUSERS numerics** — 251/252/254/255 sent on connect and via /LUSERS
|
||||
- [ ] **KICK command** — remove users from channels
|
||||
- [ ] **Numeric replies** — send IRC numeric codes via the message queue
|
||||
(001 welcome, 353 NAMES, 332 TOPIC, etc.)
|
||||
- [x] **Numeric replies** — send IRC numeric codes via the message queue
|
||||
(001-005 welcome, 251-255 LUSERS, 311-319 WHOIS, 322-329 LIST/MODE,
|
||||
331-332 TOPIC, 352-353 WHO/NAMES, 366, 372-376 MOTD, 401-461 errors)
|
||||
- [ ] **Max message size enforcement** — reject oversized messages
|
||||
- [ ] **NOTICE command** — distinct from PRIVMSG (no auto-reply flag)
|
||||
- [ ] **Multi-client sessions** — add client to existing session
|
||||
@@ -2127,7 +2255,7 @@ GET /api/v1/challenge
|
||||
- [ ] **Push notifications** — optional webhook/push for mobile clients
|
||||
when messages arrive during disconnect
|
||||
- [ ] **Message search** — full-text search over channel history
|
||||
- [ ] **User info command** — WHOIS-equivalent for querying user metadata
|
||||
- [x] **User info command** — WHOIS for querying user info and channels
|
||||
- [ ] **Connection flood protection** — per-IP connection limits as a
|
||||
complement to hashcash
|
||||
- [ ] **Invite system** — `INVITE` command for `+i` channels
|
||||
|
||||
Reference in New Issue
Block a user