add mailbox attributes (#134)

This commit is contained in:
Clément DOUIN
2021-05-04 23:11:01 +02:00
parent 435932a501
commit dcbbe01c94
4 changed files with 107 additions and 28 deletions
+4 -8
View File
@@ -7,7 +7,6 @@ use std::{collections::HashSet, iter::FromIterator, net::TcpStream};
use crate::{
config::model::{Account, Config},
flag::model::Flag,
mbox::model::{Mbox, Mboxes},
msg::model::Msg,
};
@@ -167,16 +166,13 @@ impl<'ic> ImapConnector<'ic> {
}
}
pub fn list_mboxes(&mut self) -> Result<Mboxes> {
let mboxes = self
pub fn list_mboxes(&mut self) -> Result<imap::types::ZeroCopy<Vec<imap::types::Name>>> {
let names = self
.sess
.list(Some(""), Some("*"))
.chain_err(|| "Cannot list mailboxes")?
.iter()
.map(Mbox::from_name)
.collect::<Vec<_>>();
.chain_err(|| "Cannot list mailboxes")?;
Ok(Mboxes(mboxes))
Ok(names)
}
pub fn list_msgs(