From 621ab2770ac03e805d619b7cc62a9f8a271d1b3c Mon Sep 17 00:00:00 2001 From: Michael Zhang Date: Mon, 22 Feb 2021 22:42:13 -0600 Subject: [PATCH] fuckkk --- docs/src/intro.md | 3 +++ imap/src/parser/mod.rs | 14 ++++++++++++++ imap/src/parser/rfc3501.pest | 3 ++- 3 files changed, 19 insertions(+), 1 deletion(-) diff --git a/docs/src/intro.md b/docs/src/intro.md index 17f0ec1..94140c2 100644 --- a/docs/src/intro.md +++ b/docs/src/intro.md @@ -2,3 +2,6 @@ Panorama is a personal information manager. +[Click here for API docs][1] + +[1]: https://iptq.github.io/panorama/api/panorama/ diff --git a/imap/src/parser/mod.rs b/imap/src/parser/mod.rs index c017c1e..876c987 100644 --- a/imap/src/parser/mod.rs +++ b/imap/src/parser/mod.rs @@ -207,6 +207,20 @@ fn build_mailbox_data(pair: Pair) -> MailboxData { } fn build_mailbox_list(pair: Pair) -> (Vec, Option, String) { + if !matches!(pair.as_rule(), Rule::mailbox_list) { + unreachable!("{:#?}", pair); + } + + let mut pairs = pair.into_inner(); + let mut pair = pairs.next().unwrap(); + + // let mut flags = Vec::new(); + if let Rule::mailbox_list_flags = pair.as_rule() { + let pairs = pair.into_inner(); + for pair in pairs { + } + } + // debug!("pair: {:#?}", pair); todo!() } diff --git a/imap/src/parser/rfc3501.pest b/imap/src/parser/rfc3501.pest index 0db4591..88880a9 100644 --- a/imap/src/parser/rfc3501.pest +++ b/imap/src/parser/rfc3501.pest @@ -69,7 +69,8 @@ mailbox_data_exists = { number ~ sp ~ ^"EXISTS" } mailbox_data_flags = { ^"FLAGS" ~ sp ~ flag_list } mailbox_data_recent = { number ~ sp ~ ^"RECENT" } mailbox_data_list = { ^"LIST" ~ sp ~ mailbox_list } -mailbox_list = { "(" ~ mbx_list_flags* ~ ")" ~ sp ~ mailbox_list_string ~ sp ~ mailbox } +mailbox_list = { mailbox_list_flags ~ sp ~ mailbox_list_string ~ sp ~ mailbox } +mailbox_list_flags = { "(" ~ mbx_list_flags* ~ ")" } mailbox_list_string = { dquote ~ quoted_char ~ dquote | nil } mbx_list_flags = { (mbx_list_oflag ~ sp)* ~ mbx_list_sflag ~ (sp ~ mbx_list_oflag)* | mbx_list_oflag ~ (sp ~ mbx_list_oflag)* } mbx_list_oflag = { "\\NoInferiors" | flag_extension }