feat: channel key support for +k channels
Add channel_keys dict to NetworkConfig for storing per-channel keys. Keys are used in KICK rejoin, passed via AUTOJOIN +#channel key syntax, supported in ADDNETWORK channel_keys= parameter, and propagated through REHASH. Extract rehash() as reusable async function for SIGHUP reuse. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -124,6 +124,28 @@ tls = true
|
||||
cfg = load(_write_config(config))
|
||||
assert cfg.networks["test"].port == 6697
|
||||
|
||||
def test_channel_keys_parsed(self):
|
||||
config = """\
|
||||
[bouncer]
|
||||
password = "x"
|
||||
|
||||
[proxy]
|
||||
|
||||
[networks.test]
|
||||
host = "irc.example.com"
|
||||
channels = ["#secret", "#public"]
|
||||
channel_keys = { "#secret" = "hunter2" }
|
||||
"""
|
||||
cfg = load(_write_config(config))
|
||||
net = cfg.networks["test"]
|
||||
assert net.channel_keys == {"#secret": "hunter2"}
|
||||
assert "#secret" in net.channels
|
||||
|
||||
def test_channel_keys_default_empty(self):
|
||||
cfg = load(_write_config(MINIMAL_CONFIG))
|
||||
net = cfg.networks["test"]
|
||||
assert net.channel_keys == {}
|
||||
|
||||
def test_operational_defaults(self):
|
||||
"""Ensure all operational values have sane defaults."""
|
||||
cfg = load(_write_config(MINIMAL_CONFIG))
|
||||
|
||||
Reference in New Issue
Block a user