Add 'offline' config option to turn off autojoin

This commit is contained in:
Joscha 2022-08-27 17:01:39 +02:00
parent 04581f9158
commit 73a0971c34
3 changed files with 9 additions and 4 deletions

View file

@ -16,8 +16,9 @@ Procedure when bumping the version number:
### Added
- Config file
- `ephemeral` config option
- `data_dir` config option
- `ephemeral` config option
- `offline` config option
- `euph.rooms.<name>.autojoin` config option
- `euph.rooms.<name>.username` config option
- `euph.rooms.<name>.force_username` config option

View file

@ -26,6 +26,8 @@ pub struct Config {
pub data_dir: Option<PathBuf>,
#[serde(default)]
pub ephemeral: bool,
#[serde(default)]
pub offline: bool,
pub euph: Euph,
}

View file

@ -67,9 +67,11 @@ impl Rooms {
euph_rooms: HashMap::new(),
};
for (name, config) in &config.euph.rooms {
if config.autojoin {
result.get_or_insert_room(name.clone()).connect();
if !config.offline {
for (name, config) in &config.euph.rooms {
if config.autojoin {
result.get_or_insert_room(name.clone()).connect();
}
}
}