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 ### Added
- Config file - Config file
- `ephemeral` config option
- `data_dir` config option - `data_dir` config option
- `ephemeral` config option
- `offline` config option
- `euph.rooms.<name>.autojoin` config option - `euph.rooms.<name>.autojoin` config option
- `euph.rooms.<name>.username` config option - `euph.rooms.<name>.username` config option
- `euph.rooms.<name>.force_username` config option - `euph.rooms.<name>.force_username` config option

View file

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

View file

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