53 lines
1.5 KiB
Markdown
53 lines
1.5 KiB
Markdown
# Tasks for IRC
|
|
|
|
### Useful info
|
|
|
|
You can try connect IRC server with
|
|
|
|
```bash
|
|
nc localhost <port>
|
|
```
|
|
---
|
|
|
|
### User
|
|
|
|
Represents a connected IRC client.
|
|
|
|
| Attribute | Type | Description |
|
|
|-----------------|----------|------------------------------------------------|
|
|
| `fd` | `int` | TCP s-ocket file descriptor |
|
|
| `nick` | `string` | IRC nickname |
|
|
| `username` | `string` | Username |
|
|
| `realname` | `string` | Real name |
|
|
| `buffer` | `string` | Incoming data buffer, accumulates until `\r\n` |
|
|
| `authenticated` | `bool` | `true` after correct `PASS` |
|
|
| `registered` | `bool` | `true` after `NICK` + `USER` received |
|
|
|
|
**Registration flow:** `PASS` → authenticated → `NICK` + `USER` → registered → client ready
|
|
|
|
---
|
|
|
|
### First stage
|
|
|
|
- Server starts
|
|
- It accepts two params, ./ircserv <port> <password>
|
|
- The server accepts one user, user can send messages and we can see from server
|
|
- Only 1 poll()
|
|
|
|
### Second stage
|
|
|
|
- Server can handle multiple clients simultaneously
|
|
|
|
### Third stage
|
|
|
|
- Client has nickname and username
|
|
- Client needs password for authenticate
|
|
- Client can be regular user or operator (admin)
|
|
|
|
### Fourth stage
|
|
|
|
- Client can create/connect to channels
|
|
- Client can send message inside channel (only people inside this channel can read)
|
|
|
|
*It will continue...*
|