aboutsummaryrefslogtreecommitdiff
path: root/src/imap/mailbox_view.rs
diff options
context:
space:
mode:
authorAlex Auvolat <alex@adnab.me>2022-06-29 15:52:09 +0200
committerAlex Auvolat <alex@adnab.me>2022-06-29 15:52:09 +0200
commitd737e33b5ac4a09ada10de70b78b866481d69cba (patch)
tree35570d745b126d5b29d7ebccba1204e0811da735 /src/imap/mailbox_view.rs
parentb95028f89e4db7c3158fab3b71ea56a742daba21 (diff)
downloadaerogramme-d737e33b5ac4a09ada10de70b78b866481d69cba.tar.gz
aerogramme-d737e33b5ac4a09ada10de70b78b866481d69cba.zip
Rename MailIdent to UniqueIdent and use those to identify mailboxes
Diffstat (limited to 'src/imap/mailbox_view.rs')
-rw-r--r--src/imap/mailbox_view.rs9
1 files changed, 7 insertions, 2 deletions
diff --git a/src/imap/mailbox_view.rs b/src/imap/mailbox_view.rs
index ec5580d..d03538f 100644
--- a/src/imap/mailbox_view.rs
+++ b/src/imap/mailbox_view.rs
@@ -8,7 +8,7 @@ use imap_codec::types::flag::Flag;
use imap_codec::types::mailbox::{ListMailbox, Mailbox as MailboxCodec};
use imap_codec::types::response::{Code, Data, Status};
-use crate::mail::mailbox::{Mailbox, Summary};
+use crate::mail::mailbox::Mailbox;
use crate::mail::uidindex::UidIndex;
const DEFAULT_FLAGS: [Flag; 5] = [
@@ -35,6 +35,7 @@ impl MailboxView {
/// Creates a new IMAP view into a mailbox.
/// Generates the necessary IMAP messages so that the client
/// has a satisfactory summary of the current mailbox's state.
+ /// These are the messages that are sent in response to a SELECT command.
pub async fn new(mailbox: Arc<Mailbox>) -> Result<(Self, Vec<Body>)> {
let state = mailbox.current_uid_index().await;
@@ -140,7 +141,11 @@ impl MailboxView {
})
.flatten()
.collect();
- flags.extend_from_slice(&DEFAULT_FLAGS);
+ for f in DEFAULT_FLAGS.iter() {
+ if !flags.contains(f) {
+ flags.push(f.clone());
+ }
+ }
let mut ret = vec![Body::Data(Data::Flags(flags.clone()))];
flags.push(Flag::Permanent);