aboutsummaryrefslogtreecommitdiff
path: root/src/mail/user.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/mail/user.rs')
-rw-r--r--src/mail/user.rs11
1 files changed, 10 insertions, 1 deletions
diff --git a/src/mail/user.rs b/src/mail/user.rs
index e80931f..fd858d3 100644
--- a/src/mail/user.rs
+++ b/src/mail/user.rs
@@ -71,7 +71,10 @@ impl User {
/// Opens an existing mailbox given its IMAP name.
pub async fn open_mailbox(&self, name: &str) -> Result<Option<Arc<Mailbox>>> {
let (mut list, ct) = self.load_mailbox_list().await?;
- eprintln!("List of mailboxes: {:?}", &list.0);
+ eprintln!("List of mailboxes:");
+ for ent in list.0.iter() {
+ eprintln!(" - {:?}", ent);
+ }
if let Some((uidvalidity, Some(mbid))) = list.get_mailbox(name) {
let mb_opt = self.open_mailbox_by_id(mbid, uidvalidity).await?;
@@ -88,6 +91,12 @@ impl User {
}
}
+ /// Check whether mailbox exists
+ pub async fn has_mailbox(&self, name: &str) -> Result<bool> {
+ let (list, _ct) = self.load_mailbox_list().await?;
+ Ok(list.has_mailbox(name))
+ }
+
/// Creates a new mailbox in the user's IMAP namespace.
pub async fn create_mailbox(&self, name: &str) -> Result<()> {
if name.ends_with(MAILBOX_HIERARCHY_DELIMITER) {