aboutsummaryrefslogtreecommitdiff
path: root/src/mail/user.rs
diff options
context:
space:
mode:
authorAlex Auvolat <alex@adnab.me>2022-07-12 15:59:13 +0200
committerAlex Auvolat <alex@adnab.me>2022-07-12 15:59:13 +0200
commit9b7d999fd52dc3410b97ca831238b084650be1b3 (patch)
tree34b78838be9e13a41f04c17b57ac3a1f5311b3a9 /src/mail/user.rs
parentfc2e25ce76c20a4d2e8316317c7303ae8d78b031 (diff)
downloadaerogramme-9b7d999fd52dc3410b97ca831238b084650be1b3.tar.gz
aerogramme-9b7d999fd52dc3410b97ca831238b084650be1b3.zip
Implement STATUS
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) {