M1 step 5: IRC App

- Chat: header (Buffer n/N, unread elsewhere, topic or connection
  state), wrapped hh:mm <nick> lines (own in accent, Mentions green,
  info grey), input line; Tab cycles Buffers, Fn+Up/Down scrolls back,
  Enter sends, Back leaves while the IRC Service keeps running
- /settings: server form (host, port, TLS, self-signed pinning, nick,
  SASL, NickServ, auto-join); Save & reconnect restarts the session
- Opening the App starts the IRC Service; viewing a Buffer clears its
  unread count; IrcSession gains a revision counter for redraws

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:14:59 +02:00
co-authored by Claude Opus 5.5
parent 74a341418e
commit 076baa77d1
8 changed files with 397 additions and 3 deletions
+3
View File
@@ -62,11 +62,13 @@ int IrcSession::bufferFor(const std::string& name, IrcBuffer::Type type) {
if (i >= 0) return i;
if (bufferCount() >= kMaxBuffers) return 0; // full: fall back to the server Buffer
buffers_.push_back({name, type, {}, 0, false, false, ""});
revision_++;
return bufferCount() - 1;
}
void IrcSession::setViewing(int buffer) {
viewing_ = buffer;
revision_++;
if (buffer >= 0 && buffer < bufferCount()) {
buffers_[buffer].unread = 0;
buffers_[buffer].mentioned = false;
@@ -87,6 +89,7 @@ bool IrcSession::mentionsMe(const std::string& text) const {
void IrcSession::add(int b, IrcLine::Kind kind, const std::string& nick, const std::string& text, int64_t utc,
bool mention) {
IrcBuffer& buf = buffers_[b];
revision_++;
IrcLine line{utc, kind, nick, text};
buf.lines.push_back(line);
if (buf.lines.size() > kLinesPerBuffer) buf.lines.pop_front();
+3
View File
@@ -68,6 +68,8 @@ class IrcSession {
int bufferCount() const { return static_cast<int>(buffers_.size()); }
const IrcBuffer& buffer(int i) const { return buffers_[i]; }
int totalUnread() const;
// Changes whenever a Buffer gains a line or changes, so a view knows when to redraw.
uint32_t revision() const { return revision_; }
IrcEffects takeEffects();
@@ -93,6 +95,7 @@ class IrcSession {
std::set<std::string> namesRequested_;
std::vector<std::string> rejoin_; // IRC channels to join again after a reconnect
IrcEffects effects_;
uint32_t revision_ = 0;
};
} // namespace roro