# TechIRCd IRCv3 Features

## ✅ Implemented IRCv3 Features

### Core Capability Negotiation
- **CAP LS** - List available capabilities
- **CAP LIST** - List enabled capabilities  
- **CAP REQ** - Request capabilities
- **CAP ACK/NAK** - Acknowledge/reject capability requests
- **CAP END** - End capability negotiation

### Supported Capabilities

#### IRCv3.1 Base
- ✅ **sasl** - SASL authentication (PLAIN mechanism)
- ✅ **multi-prefix** - Multiple channel prefixes (~@%+)
- ✅ **away-notify** - Away state change notifications
- ✅ **account-notify** - Account login/logout notifications 
- ✅ **extended-join** - JOIN with account and real name

#### IRCv3.2 Extensions  
- ✅ **server-time** - Timestamp tags on messages
- ✅ **userhost-in-names** - Full hostmasks in NAMES
- ✅ **monitor-notify** - MONITOR command for presence
- ✅ **account-tag** - Account tags on messages
- ✅ **message-tags** - IRCv3 message tag framework

#### IRCv3.3 Features
- ✅ **echo-message** - Echo sent messages back to sender
- ✅ **chghost** - Host change notifications
- ✅ **invite-notify** - Channel invite notifications
- ✅ **batch** - Message batching support

## 🚀 Usage Examples

### Basic Capability Negotiation
```
Client: CAP LS 302
Server: :server CAP * LS :account-notify away-notify extended-join multi-prefix sasl server-time userhost-in-names account-tag message-tags echo-message batch chghost invite-notify monitor-notify

Client: CAP REQ :server-time message-tags sasl
Server: :server CAP * ACK :server-time message-tags sasl

Client: CAP END
```

### SASL Authentication
```
Client: CAP REQ :sasl
Server: :server CAP * ACK :sasl
Client: AUTHENTICATE PLAIN
Server: AUTHENTICATE +
Client: AUTHENTICATE dXNlcm5hbWU6cGFzc3dvcmQ=
Server: :server 903 * :SASL authentication successful
Client: CAP END
```

### Server-Time Tags
```
@time=2025-08-28T17:01:49.123Z :nick!user@host PRIVMSG #channel :Hello!
```

### Account Tags
```
@account=alice;time=2025-08-28T17:01:49.123Z :alice!user@host PRIVMSG #channel :Hello!
```

### Extended JOIN
```
:nick!user@host JOIN #channel alice :Real Name
```

### MONITOR Command
```
Client: MONITOR + alice,bob,charlie
Server: :server 730 nick :alice,bob
Server: :server 731 nick :charlie

Client: MONITOR L
Server: :server 732 nick :alice,bob,charlie
Server: :server 733 nick :End of MONITOR list
```

## 🔧 Configuration

IRCv3 features are automatically available when clients request them through CAP negotiation. No special server configuration required.

### SASL Accounts
Currently supports simple username/password authentication. Edit the `authenticateUser()` function in `commands.go` to integrate with your authentication system.

## 🎯 Advanced Features

### Message Tags
TechIRCd automatically adds appropriate tags based on client capabilities:
- `time` - Server timestamp (if server-time enabled)
- `account` - User account name (if logged in and account-tag enabled)

### Multi-Prefix Support
Shows all user channel modes: `~@%+nick` for Owner/Op/Halfop/Voice

### Echo Message
When enabled, clients receive copies of their own messages, useful for multi-device synchronization.

## 🔮 Future IRCv3 Extensions

Planned for future releases:
- **draft/chathistory** - Message history replay
- **draft/resume** - Connection state resumption  
- **labeled-response** - Request/response correlation
- **standard-replies** - Standardized error responses

## 💡 Client Compatibility

TechIRCd's IRCv3 implementation is compatible with:
- **HexChat** - Full feature support
- **IRCCloud** - Full feature support  
- **Textual** - Full feature support
- **WeeChat** - Full feature support
- **KiwiIRC** - Full feature support
- **IRCv3-compliant bots** - Full API support

Legacy IRC clients without IRCv3 support continue to work normally without any IRCv3 features.
