Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions crates/tiny/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@ servers:
realname: yourname
nicks: [tiny_user]

# Whether to auto-connect to this server on startup. Default is true.
# autoconnect: false

# Server alias to show in the tab line.
# alias: OFTC

Expand Down
11 changes: 11 additions & 0 deletions crates/tiny/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,10 @@ pub(crate) struct Server<P> {
#[serde(default)]
pub(crate) pass: Option<P>,

/// Whether to auto-connect to the server
#[serde(default = "default_true")]
pub(crate) autoconnect: bool,

/// User name to be used in connection registration
/// If it is not specified, the first nick will be used instead
#[serde(default)]
Expand All @@ -84,6 +88,10 @@ pub(crate) struct Server<P> {
pub(crate) sasl_auth: Option<SASLAuth<P>>,
}

fn default_true() -> bool {
true
}

/// Similar to `Server`, but used when connecting via the `/connect` command.
#[derive(Clone, Deserialize)]
pub(crate) struct Defaults {
Expand Down Expand Up @@ -324,6 +332,7 @@ impl Config<PassOrCmd> {
port,
tls,
pass,
autoconnect,
user,
realname,
nicks,
Expand Down Expand Up @@ -369,6 +378,7 @@ impl Config<PassOrCmd> {
port,
tls,
pass,
autoconnect,
user,
realname,
nicks,
Expand Down Expand Up @@ -490,6 +500,7 @@ mod tests {
port: 123,
tls: false,
pass: None,
autoconnect: true,
user: None,
realname: "".to_owned(),
nicks: vec!["".to_owned()],
Expand Down
4 changes: 4 additions & 0 deletions crates/tiny/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,10 @@ fn run(
let mut clients: Vec<Client> = Vec::with_capacity(servers.len());

for server in servers.iter().cloned() {
if server.autoconnect == false {
continue;
}

tui.new_server_tab(&server.addr, server.alias);

let tls = server.tls;
Expand Down
Loading