M1 step 4a: IRC protocol core (host-tested)

lib/irc: IrcMessage parse/serialize, base64, ReconnectPolicy
(5 s .. 5 min), IrcConfig (validated, persisted) and IrcSession:
registration with SASL PLAIN or NickServ, nick fallback, PING, Buffers
capped at 50 lines with unread counts, Mentions, CTCP ACTION/VERSION,
topics, /names on request only, others' join/part/quit hidden, user
commands, and rejoining after a pause. No networking: the session
returns lines to send, Log entries and Notifications.

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-02 15:03:21 +02:00
co-authored by Claude Opus 5.5
parent d3948ccc3a
commit 311eb38723
11 changed files with 1142 additions and 0 deletions
+23
View File
@@ -0,0 +1,23 @@
#pragma once
#include <initializer_list>
#include <string>
#include <vector>
namespace roro {
// One IRC protocol line: [@tags] [:prefix] COMMAND params... [:trailing] (tags are ignored).
struct IrcMessage {
std::string prefix;
std::string command;
std::vector<std::string> params;
std::string nick() const { return prefix.substr(0, prefix.find('!')); }
std::string param(size_t i) const { return i < params.size() ? params[i] : ""; }
static IrcMessage parse(const std::string& line);
// Builds a line; the last parameter gets a ':' when it needs one.
static std::string serialize(const std::string& command, std::initializer_list<std::string> params);
};
} // namespace roro