@@ -5,6 +5,175 @@ All notable changes to RustIRC will be documented in this file.
55The format is based on [ Keep a Changelog] ( https://keepachangelog.com/en/1.0.0/ ) ,
66and this project adheres to [ Semantic Versioning] ( https://semver.org/spec/v2.0.0.html ) .
77
8+ ## [ 0.4.0] - 2026-03-07 (Scripting, Plugins, DCC & IRCv3)
9+
10+ ### Summary
11+ Major feature release implementing Phases 4-6 of the RustIRC development plan. This release transforms the project from a GUI-focused IRC client into a fully extensible platform with production-ready Lua scripting, a plugin system with built-in plugins, DCC protocol support, IRCv3 batch/chathistory extensions, flood protection, proxy support (SOCKS5/HTTP CONNECT), and comprehensive integration tests. Test count increased from 144 to 266.
12+
13+ ### Added
14+
15+ #### Phase 4: Scripting, Plugins & Configuration
16+
17+ ##### Config File I/O (` crates/rustirc-core/src/config.rs ` )
18+ - ** TOML Persistence** : ` Config::from_file() ` , ` Config::save() ` with pretty TOML serialization and automatic parent directory creation
19+ - ** XDG Compliance** : ` Config::default_path() ` using ` dirs::config_dir()/rustirc/config.toml `
20+ - ** First-Run Experience** : ` Config::generate_default_config() ` creates commented default config with example Libera Chat server
21+ - ** Forward Compatibility** : All config structs annotated with ` #[serde(default)] ` for graceful handling of missing fields
22+ - ** New Config Sections** : ` DccConfig ` , ` FloodConfig ` , ` ProxyConfig ` , ` NotificationConfig ` , ` QuietHours ` structs
23+
24+ ##### Lua Scripting Engine (` crates/rustirc-scripting/ ` )
25+ - ** Complete Engine Rewrite** : ` ScriptEngine ` with ` load_script() ` , ` unload_script() ` , ` trigger_event() ` , ` execute_command() ` , ` auto_load_scripts() ` , ` list_scripts() ` -- all sync methods using ` std::sync::RwLock ` to avoid async runtime conflicts
26+ - ** ScriptMessage UserData** (` script_message.rs ` ): Lua-accessible IRC message type with ` get_nick() ` , ` get_channel() ` , ` get_text() ` , ` get_command() ` , ` get_params() ` , ` get_prefix() ` methods
27+ - ** Sandbox Security** (` sandbox.rs ` ): Memory limits, CPU timeout via Lua instruction count hooks (returns ` mlua::VmState::Continue ` ), blocks ` io ` /` debug ` /` loadfile ` /` dofile ` /` require ` , restricts ` os ` to safe subset (` clock ` /` date ` /` difftime ` /` time ` )
28+ - ** IRC API Table** : ` irc.print() ` , ` irc.send_message() ` , ` irc.join() ` , ` irc.part() ` , ` irc.register_handler() ` , ` irc.command() ` , ` irc.get_var() ` , ` irc.set_var() ` registered in Lua global scope
29+ - ** Priority System** : Scripts sorted by priority (highest first) for deterministic event handler execution order
30+ - ** Config Integration** : ` ScriptEngine::from_config(&ScriptingConfig) ` with configurable memory limits, timeout, scripts path
31+
32+ ##### Plugin System (` crates/rustirc-plugins/ ` )
33+ - ** Plugin Manager Rewrite** (` manager.rs ` ): ` PluginManager ` with ` HashMap<String, LoadedPlugin> ` , full lifecycle management (` register_plugin() ` , ` unload_plugin() ` , ` enable_plugin() ` , ` disable_plugin() ` , ` shutdown_all() ` ), auto-initialization on registration via ` PluginContext `
34+ - ** Built-in Logger Plugin** (` builtin/logger.rs ` ): ` LoggerPlugin ` that creates log directories and manages file-based IRC message logging
35+ - ** Built-in Highlight Plugin** (` builtin/highlight.rs ` ): ` HighlightPlugin ` with case-insensitive keyword matching (` check_message() ` ), dynamic word management (` add_word() ` , ` remove_word() ` )
36+ - ** Plugin Loader** (` loader.rs ` ): ` PluginLoader ` with search path discovery and ` default_plugin_dir() ` using ` dirs::data_dir()/rustirc/plugins `
37+
38+ ##### Integration Wiring (` src/main.rs ` )
39+ - ** Real Config Loading** : Replaced no-op ` load_config() ` with ` Config::from_file() ` / ` Config::load_or_default() `
40+ - ** Script Engine Init** : ` init_scripting() ` creates ` ScriptEngine ` from config and calls ` auto_load_scripts() `
41+ - ** Plugin Manager Init** : ` init_plugins() ` creates ` PluginManager ` and registers built-in ` LoggerPlugin ` and ` HighlightPlugin `
42+
43+ #### Phase 5: Advanced Features
44+
45+ ##### DCC Protocol (` crates/rustirc-core/src/dcc/ ` )
46+ - ** DCC Manager** (` mod.rs ` ): Central session tracker with async session lifecycle, event channel (` DccEvent ` ), auto-incrementing session IDs
47+ - ** DCC Request Parsing** : ` parse_dcc_request(peer_nick, ctcp_data) ` supporting CHAT, SEND, RESUME, ACCEPT with IP long-format conversion
48+ - ** DCC Chat** (` chat.rs ` ): Direct client-to-client messaging over TCP
49+ - ** DCC Transfer** (` transfer.rs ` ): File send/receive with ` TransferProgress ` tracking (bytes_transferred, speed_bps, percentage), cancel support
50+ - ** Session Types** : ` DccSession::Chat ` , ` DccSession::Send ` , ` DccSession::Receive ` with direction tracking (Incoming/Outgoing)
51+ - ** Security** : File size limits via ` DccConfig::max_file_size ` , disabled-by-config check on all operations
52+ - ** IP Conversion** : ` ip_to_long(&IpAddr) -> u64 ` and ` parse_ip_long(&str) -> DccResult<IpAddr> ` for DCC protocol encoding
53+
54+ ##### IRCv3 Extensions
55+
56+ ###### Batch Message Handler (` crates/rustirc-core/src/batch.rs ` )
57+ - ** BatchManager** : Tracks open/completed batches with ` handle_batch_start() ` , ` handle_batch_end() ` , ` add_message() `
58+ - ** Nested Batches** : Parent reference tracking via batch tags on BATCH commands
59+ - ** Batch Types** : ` Netjoin ` , ` Netsplit ` , ` ChatHistory ` , ` LabeledResponse ` , ` Custom(String) ` with ` parse() ` and ` as_str() ` methods
60+ - ** Message Routing** : ` message_is_batched() ` checks if a message belongs to any open batch
61+
62+ ###### CHATHISTORY Support (` crates/rustirc-core/src/chathistory.rs ` )
63+ - ** ChatHistoryManager** : Request queue with FIFO correlation, builds protocol messages for BEFORE, AFTER, BETWEEN, AROUND, LATEST commands
64+ - ** MessageReference** : ` MsgId(String) ` and ` Timestamp(String) ` variants with ` parse() ` and ` to_param() ` methods
65+ - ** Request Lifecycle** : ` request_history() ` returns ` (u64, Message) ` for correlation, ` handle_response() ` pops FIFO queue
66+
67+ ###### Message Tag Helpers (` crates/rustirc-protocol/src/message.rs ` )
68+ - ** Tag Access Methods** : ` get_tag() ` , ` has_tag() ` , ` get_time() ` , ` get_msgid() ` , ` get_batch() ` , ` get_label() ` on ` Message `
69+
70+ ##### Flood Protection (` crates/rustirc-core/src/flood.rs ` )
71+ - ** Token Bucket Algorithm** : ` FloodProtector ` with configurable ` max_tokens ` (burst capacity), ` refill_rate ` (tokens/sec), bounded message queue
72+ - ** API** : ` try_send() ` (consume token), ` enqueue() ` (queue message), ` drain_ready() ` (send queued messages), ` next_send_time() ` (calculate wait)
73+ - ** Config Integration** : ` FloodProtector::from_config(&FloodConfig) ` with enable/disable toggle
74+
75+ ##### Proxy Support (` crates/rustirc-core/src/proxy/ ` )
76+ - ** SOCKS5 Proxy** (` socks5.rs ` ): Via ` tokio-socks ` crate with optional username/password authentication
77+ - ** HTTP CONNECT Proxy** (` http.rs ` ): Manual implementation with basic authentication header support
78+ - ** ProxyConnector Trait** : ` async fn connect() ` trait with ` from_config() ` factory dispatching to Socks5 or HttpConnect
79+ - ** ProxyConfig** : ` proxy_type ` (None/Socks5/HttpConnect), ` address ` , ` port ` , ` username ` , ` password ` fields
80+
81+ ##### GUI Enhancements
82+
83+ ###### Notification Rules Engine (` crates/rustirc-gui/src/notifications.rs ` )
84+ - ** NotificationRules** : Configurable highlight words, nick mention detection, channel/user filters
85+ - ** QuietHours** : Time-based notification suppression with weekend override
86+ - ** Notification History** : Timestamped ` NotificationEntry ` log with ` NotificationType ` classification
87+
88+ ###### Search Engine (` crates/rustirc-gui/src/search.rs ` )
89+ - ** SearchEngine** : Full-text message search with ` SearchQuery ` (text, channel filter, user filter, date range, case sensitivity)
90+ - ** SearchState** : UI state management for search panel integration
91+
92+ ###### URL Preview (` crates/rustirc-gui/src/widgets/url_preview.rs ` )
93+ - ** URL Detection** : Regex-based URL extraction from messages using ` OnceLock<Regex> ` (MSRV 1.75 compatible)
94+ - ** URL Info** : Extracted URL metadata with display text and original URL
95+
96+ ###### Settings Persistence (` crates/rustirc-gui/src/state.rs ` )
97+ - ** AppSettings Serialization** : Added ` serde::Serialize ` /` Deserialize ` derives with ` #[serde(default)] `
98+ - ** Persistence Methods** : ` AppSettings::settings_path() ` , ` save() ` , ` load() ` for XDG-compliant settings storage
99+
100+ #### Phase 6: Testing & Integration
101+
102+ ##### Integration Test Suite (` tests/ ` )
103+ - ** ` tests/config_test.rs ` ** (6 tests): Config save/load roundtrip, parent directory creation, forward compatibility, default path validation, default config generation, all-sections persistence
104+ - ** ` tests/scripting_test.rs ` ** (7 tests): Engine creation from config, event handler firing, command execution, sandbox blocking dangerous operations, variable persistence across scripts, priority ordering, ScriptMessage method access
105+ - ** ` tests/plugin_test.rs ` ** (7 tests): Plugin registration and listing, enable/disable toggle, unload lifecycle, built-in highlight plugin word matching, built-in logger plugin initialization, shutdown_all cleanup, plugin info retrieval
106+ - ** ` tests/ircv3_test.rs ` ** (6 tests): Batch lifecycle (start/add/end), message tag helpers, CHATHISTORY request building, MessageReference parsing, flood protection burst limiting, flood protection queue management
107+ - ** ` tests/dcc_test.rs ` ** (7 tests): DCC manager creation, SEND request parsing, CHAT request parsing, RESUME request parsing, IP long-format conversion, disabled config behavior, invalid request handling
108+
109+ ### Changed
110+ - ** Config structs** : All config structs now derive ` Default ` and use ` #[serde(default)] ` for forward compatibility
111+ - ** ScriptEngine** : Switched from ` tokio::sync::RwLock ` to ` std::sync::RwLock ` to prevent "Cannot start runtime from within runtime" panics
112+ - ** BatchType** : Renamed ` from_str() ` to ` parse() ` to avoid confusion with ` FromStr ` trait (clippy lint)
113+ - ** Root Cargo.toml** : Added ` rustirc-protocol ` to binary dependencies for integration test access
114+
115+ ### Dependencies
116+ - Added ` dirs = "6.0" ` (XDG-compliant config/data paths)
117+ - Added ` notify-rust = "4" ` (Linux D-Bus notifications)
118+ - Added ` tokio-socks = "0.5" ` (SOCKS5 proxy support)
119+ - Added ` chrono = "0.4" ` (notification quiet hours)
120+
121+ ### Quality
122+ - ** Test Count** : 144 -> 266 (84% increase)
123+ - ** Unit Tests** : 233 across all workspace crates
124+ - ** Integration Tests** : 33 across 5 test files
125+ - ** Clippy** : Zero warnings with ` -D warnings `
126+ - ** Build** : Zero compilation errors
127+
128+ ### New Files (27)
129+ | File | Purpose |
130+ | ------| ---------|
131+ | ` crates/rustirc-scripting/src/script_message.rs ` | ScriptMessage UserData for Lua |
132+ | ` crates/rustirc-plugins/src/builtin/mod.rs ` | Built-in plugin module |
133+ | ` crates/rustirc-plugins/src/builtin/logger.rs ` | Logger plugin |
134+ | ` crates/rustirc-plugins/src/builtin/highlight.rs ` | Highlight plugin |
135+ | ` crates/rustirc-core/src/dcc/mod.rs ` | DCC manager and protocol |
136+ | ` crates/rustirc-core/src/dcc/chat.rs ` | DCC chat sessions |
137+ | ` crates/rustirc-core/src/dcc/transfer.rs ` | DCC file transfers |
138+ | ` crates/rustirc-core/src/batch.rs ` | IRCv3 batch handler |
139+ | ` crates/rustirc-core/src/chathistory.rs ` | IRCv3 CHATHISTORY |
140+ | ` crates/rustirc-core/src/flood.rs ` | Flood protection |
141+ | ` crates/rustirc-core/src/proxy/mod.rs ` | Proxy connector trait |
142+ | ` crates/rustirc-core/src/proxy/socks5.rs ` | SOCKS5 proxy |
143+ | ` crates/rustirc-core/src/proxy/http.rs ` | HTTP CONNECT proxy |
144+ | ` crates/rustirc-gui/src/notifications.rs ` | Notification rules engine |
145+ | ` crates/rustirc-gui/src/search.rs ` | Full-text search engine |
146+ | ` crates/rustirc-gui/src/widgets/url_preview.rs ` | URL detection/preview |
147+ | ` tests/config_test.rs ` | Config integration tests |
148+ | ` tests/scripting_test.rs ` | Scripting integration tests |
149+ | ` tests/plugin_test.rs ` | Plugin integration tests |
150+ | ` tests/ircv3_test.rs ` | IRCv3 integration tests |
151+ | ` tests/dcc_test.rs ` | DCC integration tests |
152+
153+ ### Modified Files (19)
154+ | File | Changes |
155+ | ------| ---------|
156+ | ` Cargo.toml ` | Version bump, added deps (dirs, notify-rust, tokio-socks), added rustirc-protocol dep |
157+ | ` crates/rustirc-core/Cargo.toml ` | Added dirs, tokio-socks deps |
158+ | ` crates/rustirc-gui/Cargo.toml ` | Added toml, dirs, notify-rust, chrono deps |
159+ | ` crates/rustirc-plugins/Cargo.toml ` | Added dirs, tracing deps |
160+ | ` crates/rustirc-core/src/config.rs ` | Config I/O methods, new config structs, serde(default) |
161+ | ` crates/rustirc-core/src/lib.rs ` | Added batch, chathistory, dcc, flood, proxy modules |
162+ | ` crates/rustirc-gui/src/lib.rs ` | Added notifications, search modules |
163+ | ` crates/rustirc-gui/src/state.rs ` | AppSettings Serialize/Deserialize, persistence methods |
164+ | ` crates/rustirc-gui/src/widgets/mod.rs ` | Added url_preview module |
165+ | ` crates/rustirc-plugins/src/lib.rs ` | Added builtin module |
166+ | ` crates/rustirc-plugins/src/loader.rs ` | Real plugin discovery implementation |
167+ | ` crates/rustirc-plugins/src/manager.rs ` | Full lifecycle management rewrite |
168+ | ` crates/rustirc-protocol/src/message.rs ` | Tag helper methods (get_tag, has_tag, etc.) |
169+ | ` crates/rustirc-scripting/src/api.rs ` | Real ScriptApi implementations |
170+ | ` crates/rustirc-scripting/src/engine.rs ` | Full ScriptEngine rewrite |
171+ | ` crates/rustirc-scripting/src/lib.rs ` | Added script_message module |
172+ | ` crates/rustirc-scripting/src/sandbox.rs ` | Full sandbox implementation |
173+ | ` src/main.rs ` | Real config loading, scripting/plugin initialization |
174+
175+ ---
176+
8177## [ 0.3.9] - 2026-01-10 (iced 0.14.0 Migration & CI Improvements)
9178
10179### Summary
@@ -76,12 +245,12 @@ Complete GUI framework upgrade from iced 0.13.1 to iced 0.14.0 with 82+ breaking
76245
77246## [ Unreleased]
78247
79- ### Planned for Next Release (Phase 5: Advanced Features)
80- - DCC support for file transfers and direct chats
81- - Enhanced IRCv3 features (message-tags, server-time, batch )
82- - Proxy support (SOCKS5, HTTP )
83- - Native desktop notifications
84- - Advanced channel management features
248+ ### Planned for Next Release
249+ - Python scripting engine (PyO3)
250+ - Dynamic plugin loading (libloading )
251+ - Performance optimization (async script execution, ring buffers )
252+ - Fuzzing tests for protocol parser
253+ - First-run welcome experience in GUI/TUI
85254
86255## [ 0.3.8] - 2025-08-26 (Material Design 3 Integration + Dependency Updates)
87256
0 commit comments