add idle mode

This commit is contained in:
Clément DOUIN
2021-03-11 17:05:01 +01:00
parent b2f1543bbf
commit 6e9e7cd30e
5 changed files with 152 additions and 84 deletions
+13
View File
@@ -253,6 +253,11 @@ fn run() -> Result<()> {
.arg(mailbox_arg()),
),
)
.subcommand(
SubCommand::with_name("idle")
.about("Starts the idle mode")
.arg(mailbox_arg()),
)
.get_matches();
let account_name = matches.value_of("account");
@@ -525,6 +530,14 @@ fn run() -> Result<()> {
imap_conn.logout();
}
if let Some(matches) = matches.subcommand_matches("idle") {
let config = Config::new_from_file()?;
let account = config.find_account_by_name(account_name)?;
let mut imap_conn = ImapConnector::new(&account)?;
let mbox = matches.value_of("mailbox").unwrap();
imap_conn.idle(&config, &mbox)?;
}
Ok(())
}