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:
+18
-13
@@ -36,7 +36,8 @@ std::string IrcConfig::validate() const {
|
||||
if (port < 1 || port > 65535) return "Port must be 1 to 65535";
|
||||
if (!validNick(nick)) return "Nick: letters, digits and []\\`_^{|}- only, not starting with a digit";
|
||||
for (auto& c : autojoin)
|
||||
if (c.size() < 2 || (c[0] != '#' && c[0] != '&')) return "IRC channels start with # or &";
|
||||
if (c.channel.size() < 2 || (c.channel[0] != '#' && c.channel[0] != '&'))
|
||||
return "Auto-join: IRC channels start with # or &, each followed by its key if it has one";
|
||||
return "";
|
||||
}
|
||||
|
||||
@@ -56,23 +57,27 @@ std::string IrcConfig::save() {
|
||||
return "";
|
||||
}
|
||||
|
||||
std::vector<std::string> IrcConfig::parseChannels(const std::string& text) {
|
||||
std::vector<std::string> out;
|
||||
std::string current;
|
||||
for (char c : text + " ") {
|
||||
if (c == ' ' || c == ',') {
|
||||
if (!current.empty()) out.push_back(current);
|
||||
current.clear();
|
||||
} else {
|
||||
current += c;
|
||||
}
|
||||
std::vector<IrcChannel> IrcConfig::parseChannels(const std::string& text) {
|
||||
std::vector<IrcChannel> out;
|
||||
std::string word;
|
||||
auto take = [&]() {
|
||||
if (word.empty()) return;
|
||||
bool channel = word[0] == '#' || word[0] == '&';
|
||||
if (!channel && !out.empty() && out.back().key.empty()) out.back().key = word;
|
||||
else out.push_back({word, ""}); // a stray word fails validation as a channel
|
||||
word.clear();
|
||||
};
|
||||
for (char c : text) {
|
||||
if (c == ' ' || c == ',') take();
|
||||
else word += c;
|
||||
}
|
||||
take();
|
||||
return out;
|
||||
}
|
||||
|
||||
std::string IrcConfig::formatChannels(const std::vector<std::string>& channels) {
|
||||
std::string IrcConfig::formatChannels(const std::vector<IrcChannel>& channels) {
|
||||
std::string out;
|
||||
for (auto& c : channels) out += (out.empty() ? "" : " ") + c;
|
||||
for (auto& c : channels) out += (out.empty() ? "" : ", ") + c.channel + (c.key.empty() ? "" : " " + c.key);
|
||||
return out;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user