Public Access
IRC: join after NickServ login, keyed auto-join, SASL fallback
- With NickServ, auto-join waits for the logged-in reply (900) or 2 s
at most, so registered-only IRC channels let us in
- A failed SASL login falls back to NickServ (its own password, or the
SASL account and password)
- IDENTIFY names the account explicitly, and once logged in on a
fallback nick, REGAIN takes ours back from a stale session
- Auto-join entries take keys ("#private key, #public"); keys from
/join are reused when rejoining; keyed channels go first in JOIN
- Serial irc dump: whole Buffers, and which login is configured
(never the secrets)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01EhqxQ49eCju4CzKYNjZzwT
This commit is contained in:
@@ -2,6 +2,7 @@
|
||||
|
||||
#include <cstdint>
|
||||
#include <deque>
|
||||
#include <map>
|
||||
#include <set>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
@@ -53,6 +54,12 @@ class IrcSession {
|
||||
|
||||
explicit IrcSession(const IrcConfig& config);
|
||||
|
||||
// Joins wait this long for NickServ to confirm a login before going ahead anyway.
|
||||
static constexpr uint32_t kNickservWaitMs = 2000;
|
||||
|
||||
// Uptime in ms, called regularly: releases joins held back for NickServ.
|
||||
void tick(uint32_t nowMs);
|
||||
|
||||
void connected(int64_t utc);
|
||||
void disconnected(int64_t utc, const std::string& reason);
|
||||
void receive(const std::string& raw, int64_t utc);
|
||||
@@ -83,6 +90,7 @@ class IrcSession {
|
||||
bool mentionsMe(const std::string& text) const;
|
||||
void onPrivmsg(const IrcMessage& m, int64_t utc, bool notice);
|
||||
void onWelcome(const IrcMessage& m, int64_t utc);
|
||||
void joinChannels();
|
||||
void command(int buffer, const std::string& text, int64_t utc);
|
||||
void say(int buffer, const std::string& text, int64_t utc, bool action);
|
||||
|
||||
@@ -94,6 +102,11 @@ class IrcSession {
|
||||
int viewing_ = -1;
|
||||
std::set<std::string> namesRequested_;
|
||||
std::vector<std::string> rejoin_; // IRC channels to join again after a reconnect
|
||||
std::map<std::string, std::string> keys_; // lower-case IRC channel -> key, from config and /join
|
||||
bool joinsHeld_ = false; // waiting for NickServ before joining
|
||||
bool saslFailed_ = false;
|
||||
uint32_t heldSinceMs_ = 0;
|
||||
uint32_t nowMs_ = 0;
|
||||
IrcEffects effects_;
|
||||
uint32_t revision_ = 0;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user