prevent simultaneous imap conn

This commit is contained in:
Clément DOUIN
2021-04-04 00:17:27 +02:00
parent 2850ae01fd
commit 9f7173a572
4 changed files with 36 additions and 23 deletions
+1 -1
View File
@@ -17,10 +17,10 @@ pub fn imap_subcmds<'a>() -> Vec<App<'a, 'a>> {
pub fn imap_matches(matches: &ArgMatches) -> Result<bool> {
let config = Config::new_from_file()?;
let account = config.find_account_by_name(matches.value_of("account"))?;
let mut imap_conn = ImapConnector::new(&account)?;
let mbox = matches.value_of("mailbox").unwrap();
if let Some(_) = matches.subcommand_matches("idle") {
let mut imap_conn = ImapConnector::new(&account)?;
imap_conn.idle(&config, &mbox)?;
imap_conn.logout();
return Ok(true);