aboutsummaryrefslogtreecommitdiff
path: root/src/imap/command/authenticated.rs
diff options
context:
space:
mode:
authorAlex Auvolat <alex@adnab.me>2022-07-13 15:39:52 +0200
committerAlex Auvolat <alex@adnab.me>2022-07-13 15:39:52 +0200
commit3b256de3dc1347bf449905de714ac5486935264a (patch)
tree55fbeb68d510ed62f02566870a62907d1e37520d /src/imap/command/authenticated.rs
parent956a92377ea46e730f9fe5dcfee8b49be65e78ec (diff)
downloadaerogramme-3b256de3dc1347bf449905de714ac5486935264a.tar.gz
aerogramme-3b256de3dc1347bf449905de714ac5486935264a.zip
Remove OK [UNSEEN x] responses to SELECT and EXAMINE, and fix STATUS UNSEEN
Diffstat (limited to 'src/imap/command/authenticated.rs')
-rw-r--r--src/imap/command/authenticated.rs9
1 files changed, 6 insertions, 3 deletions
diff --git a/src/imap/command/authenticated.rs b/src/imap/command/authenticated.rs
index 5cf8cf9..dc8b5a8 100644
--- a/src/imap/command/authenticated.rs
+++ b/src/imap/command/authenticated.rs
@@ -218,9 +218,7 @@ impl<'a> AuthenticatedContext<'a> {
for attr in attributes.iter() {
ret_attrs.push(match attr {
StatusAttribute::Messages => StatusAttributeValue::Messages(view.exists()?),
- StatusAttribute::Unseen => {
- StatusAttributeValue::Unseen(view.unseen().map(|x| x.get()).unwrap_or(0))
- }
+ StatusAttribute::Unseen => StatusAttributeValue::Unseen(view.unseen_count() as u32),
StatusAttribute::Recent => StatusAttributeValue::Recent(view.recent()?),
StatusAttribute::UidNext => StatusAttributeValue::UidNext(view.uidnext()),
StatusAttribute::UidValidity => {
@@ -287,6 +285,11 @@ impl<'a> AuthenticatedContext<'a> {
S: A142 OK [READ-WRITE] SELECT completed
--- a mailbox with no unseen message -> no unseen entry
+ NOTES:
+ RFC3501 (imap4rev1) says if there is no OK [UNSEEN] response, client must make no assumption,
+ it is therefore correct to not return it even if there are unseen messages
+ RFC9051 (imap4rev2) says that OK [UNSEEN] responses are deprecated after SELECT and EXAMINE
+ For Aerogramme, we just don't send the OK [UNSEEN], it's correct to do in both specifications.
20 select "INBOX.achats"
* FLAGS (\Answered \Flagged \Deleted \Seen \Draft $Forwarded JUNK $label1)