Public Access
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
24 lines
715 B
C++
24 lines
715 B
C++
#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
|