# SCAR Chat - Development Progress

## Project Overview
Cross-platform C++20 chat client with text messaging, video streaming, and screen sharing.

---

## Feature Implementation Status

### 🔧 Foundation (Dependencies: None)
- [x] **CMake Build System** - Multi-target build configuration ✅
- [x] **Directory Structure** - Organized client/server/shared architecture ✅
- [x] **Third-party Integration** - Argon2, JWT-CPP, nlohmann/json via FetchContent ✅
- [x] **Protocol Types** - Message format definitions and enums ✅

### 🔐 Authentication & Security (Dependencies: Foundation)
- [x] **Argon2 Wrapper** - Password hashing with salt generation ✅
- [x] **JWT Implementation** - Token generation and validation ✅
- [x] **Database Schema** - SQLite3 user table with USERNAME, PASSWORD, SALT, TOKEN, STATUS, ROLE, EMAIL, LAST_LOGIN, AVATAR_PIC ✅
- [x] **Database Operations** - User CRUD, credential verification ✅
- [x] **SSL Configuration** - Certificate/key loading and validation ✅

### 🖥️ Server Core (Dependencies: Authentication & Security)
- [x] **Boost.ASIO Server** - SSL-enabled async TCP server ✅
- [x] **Session Management** - Per-connection session handling ✅
- [x] **Command-line Arguments** - --db, --cert, --key options ✅
- [x] **Config Management** - JSON + hardcoded defaults failover ✅
- [x] **Authentication Handler** - Plain-text login → salt → argon2 verification ✅
- [x] **Database Initialization** - Auto-create scarchat.db if missing ✅

### 💬 Messaging System (Dependencies: Server Core)
- [x] **Message Protocol** - Text message format and routing ✅
- [x] **User List Broadcasting** - Online status updates (basic) ✅
- [x] **Message Persistence** - Chat history storage in client ✅
- [x] **Message Routing** - Server-side message dispatch to recipients ✅

### 🎥 Media Capture (Dependencies: Foundation)
- [~] **Pipewire Camera Integration** - Linux camera feed capture (stub created)
- [~] **X11/Wayland Screen Capture** - ffmpeg + libav integration (stub created)
- [~] **Hyprland Screen Capture** - xdg-desktop-portal-hyprland + DBus (stub created)
- [~] **Windows Screen Capture** - ffmpeg-based capture (stub created)
- [~] **DBus Portal Integration** - Screen share permissions (stub created)

### 📡 Media Streaming (Dependencies: Media Capture, Server Core)
- [ ] **Video Stream Protocol** - Real-time media packet format
- [ ] **Stream Server Handler** - Server-side stream routing
- [ ] **Bandwidth Management** - Adaptive quality/compression

### 🎨 Qt6 Client UI (Dependencies: Foundation)
- [x] **Main Window** - Discord-like dark theme layout with status bar ✅
- [x] **Login Dialog** - Username/password input, server config ✅
- [x] **User List Widget** - Online users with SC avatar placeholder ✅
- [x] **Chat Pane Widget** - Message display, input, typing indicators ✅
- [x] **Video Grid Widget** - Multi-stream grid layout (256 streams) ✅
- [x] **Status Bar** - Connection status, user count, clock ✅

### 🔌 Client Networking (Dependencies: Qt6 Client UI, Authentication)
- [x] **Boost.ASIO Client** - SSL connection to server ✅
- [x] **Config Persistence** - $XDG_CONFIG_HOME/scarchat/client.json for username, server, port, JWT ✅
- [x] **Auto-reconnect** - Exponential backoff reconnection ✅

### 🗄️ Database Management (Dependencies: Database Operations, Authentication)
- [x] **DBManager CLI Tool** - User administration command-line utility ✅
- [x] **User Creation** - adduser command with Argon2 hashing ✅
- [x] **User Deletion** - deleteuser command ✅
- [x] **Password Modification** - modifypass command with new salt ✅
- [x] **Avatar Management** - modifyavatar command (binary blob) ✅
- [x] **Email/Role Updates** - modifyemail, modifyrole commands ✅
- [x] **User Queries** - fetch, search, list commands ✅
- [x] **Database Location** - Auto-detection (local, install, home) ✅
- [x] **JWT Storage** - Secure token persistence ✅

### 🎬 Client Media Display (Dependencies: Client Networking, Media Streaming)
- [x] **Video Decoder** - Grid widget ready for streams ✅
- [x] **Grid Layout Manager** - Dynamic grid resizing (basic done) ✅
- [ ] **Stream Quality Selection** - User-adjustable quality settings

### 📦 Packaging (Dependencies: All core features complete)
- [x] **WiX Installer** - "Scar Chat.msi" Windows installer template ✅
- [ ] **Linux Binary Packaging** - scarchat and scarchat-server installation
- [ ] **Android APK** - Qt for Android build configuration

---

## Build Status
- [ ] Linux Debug Build (Ready to test - dependencies need installation)
- [ ] Linux Release Build (Ready to test - dependencies need installation)
- [ ] Windows Debug Build (Ready to test - dependencies need installation)
- [ ] Windows Release Build (Ready to test - dependencies need installation)
- [ ] Android Build (CMake configured, needs Qt for Android)

---

## Testing Status
- [ ] Unit Tests - Authentication (Framework ready, tests TBD)
- [ ] Unit Tests - Database (Framework ready, tests TBD)
- [ ] Unit Tests - Message Protocol (Framework ready, tests TBD)
- [ ] Integration Tests - Client-Server Communication (Manual testing possible)
- [ ] Integration Tests - Media Streaming (Awaiting media implementation)

---

## Current Phase: **Core Implementation Complete - Media Capture Next**

**Implementation Summary:**
- ✅ Complete server with SSL, authentication, database, messaging
- ✅ Complete Qt6 client with dark theme, chat, user list, status bar
- ✅ Networking with reconnect backoff and JWT sessions
- ✅ Windows installer template
- 🔄 Media capture stubs (Pipewire/FFmpeg/Portal integration needed)
- 🔄 Video streaming protocol (message types defined, handler needed)

**Next Steps:**
1. Install dependencies and test build on Linux/Windows
2. Generate SSL certificates for testing
3. Implement Pipewire camera capture
4. Implement screen capture backends (X11/Wayland/Windows)
5. Add video stream message types and server routing
6. Test end-to-end video streaming

**Last Updated:** 2025-12-07
