IRC: edit server settings as a draft, applied under the service lock

The IRC App edited the live config while the IRC task could be reading
it to connect. The App now edits a copy; applyConfig() validates it and
swaps it in under the lock, and the task connects from a snapshot.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01EhqxQ49eCju4CzKYNjZzwT
This commit is contained in:
2026-10-03 18:42:24 +02:00
co-authored by Claude Opus 5.5
parent 4cd6a63498
commit dd16352509
6 changed files with 69 additions and 25 deletions
+15
View File
@@ -22,6 +22,21 @@ class IrcConfig {
std::string nickservPassword; // otherwise IDENTIFY with NickServ, if set
std::vector<std::string> autojoin;
// A copy is a draft the UI can edit freely; copySettingsFrom() applies one.
IrcConfig(const IrcConfig&) = default;
void copySettingsFrom(const IrcConfig& other) {
host = other.host;
port = other.port;
tls = other.tls;
allowSelfSigned = other.allowSelfSigned;
pinnedSha256 = other.pinnedSha256;
nick = other.nick;
saslUser = other.saslUser;
saslPassword = other.saslPassword;
nickservPassword = other.nickservPassword;
autojoin = other.autojoin;
}
void load(const std::string& defaultNick);
std::string save(); // empty on success, otherwise why it was refused
std::string validate() const;