Browse Source

melib/imap: impl LIST-EXTENDED

Closes #69
tags/alpha-0.6.2
Manos Pitsidianakis 1 month ago
parent
commit
670675edcc
WARNING! Although there is a key with this ID in the database it does not verify this commit! This commit is SUSPICIOUS. GPG Key ID: 73627C2F690DF710
2 changed files with 10 additions and 3 deletions
  1. +5
    -0
      melib/src/backends/imap.rs
  2. +5
    -3
      melib/src/backends/imap/protocol_parser.rs

+ 5
- 0
melib/src/backends/imap.rs View File

@ -70,6 +70,7 @@ pub static SUPPORTED_CAPABILITIES: &[&str] = &[
"ENABLE",
"IDLE",
"IMAP4REV1",
"LIST-EXTENDED",
"LIST-STATUS",
"LITERAL+",
"LOGIN",
@ -340,6 +341,10 @@ impl MailBackend for ImapType {
let f = &state.uid_store.mailboxes.lock().await[&mailbox_hash];
f.exists.lock().unwrap().clear();
f.unseen.lock().unwrap().clear();
if f.no_select {
yield vec![];
return;
}
};
loop {
let res = fetch_hlpr(&mut state).await.map_err(|err| {

+ 5
- 3
melib/src/backends/imap/protocol_parser.rs View File

@ -416,10 +416,13 @@ pub fn list_mailbox_result(input: &[u8]) -> IResult<&[u8], ImapMailbox> {
let separator: u8 = separator[0];
let mut f = ImapMailbox::default();
f.no_select = false;
f.is_subscribed = false;
f.is_subscribed = path == "INBOX";
for p in properties.split(|&b| b == b' ') {
if p.eq_ignore_ascii_case(b"\\NoSelect") {
if p.eq_ignore_ascii_case(b"\\NoSelect") || p.eq_ignore_ascii_case(b"\\NonExistent")
{
f.no_select = true;
} else if p.eq_ignore_ascii_case(b"\\Subscribed") {
f.is_subscribed = true;
} else if p.eq_ignore_ascii_case(b"\\Sent") {
let _ = f.set_special_usage(SpecialUsageMailbox::Sent);
} else if p.eq_ignore_ascii_case(b"\\Junk") {
@ -428,7 +431,6 @@ pub fn list_mailbox_result(input: &[u8]) -> IResult<&[u8], ImapMailbox> {
let _ = f.set_special_usage(SpecialUsageMailbox::Drafts);
}
}
f.is_subscribed = path == "INBOX";
f.imap_path = path.into();
f.hash = get_path_hash!(&f.imap_path);
f.path = if separator == b'/' {

Loading…
Cancel
Save