aboutsummaryrefslogtreecommitdiff
path: root/src/imap/flags.rs
diff options
context:
space:
mode:
authorQuentin Dufour <quentin@deuxfleurs.fr>2024-05-29 10:14:51 +0200
committerQuentin Dufour <quentin@deuxfleurs.fr>2024-05-29 10:14:51 +0200
commitb9ce5886033677f6c65a4b873e17574fdb8df31d (patch)
tree9ed1d721361027d7d6fef0ecad65d7e1b74a7ddb /src/imap/flags.rs
parent0dcf69f180f5a7b71b6ad2ac67e4cdd81e5154f1 (diff)
parent5954de6efbb040b8b47daf0c7663a60f3db1da6e (diff)
downloadaerogramme-b9ce5886033677f6c65a4b873e17574fdb8df31d.tar.gz
aerogramme-b9ce5886033677f6c65a4b873e17574fdb8df31d.zip
Merge branch 'caldav'
Diffstat (limited to 'src/imap/flags.rs')
-rw-r--r--src/imap/flags.rs30
1 files changed, 0 insertions, 30 deletions
diff --git a/src/imap/flags.rs b/src/imap/flags.rs
deleted file mode 100644
index 0f6ec64..0000000
--- a/src/imap/flags.rs
+++ /dev/null
@@ -1,30 +0,0 @@
-use imap_codec::imap_types::core::Atom;
-use imap_codec::imap_types::flag::{Flag, FlagFetch};
-
-pub fn from_str(f: &str) -> Option<FlagFetch<'static>> {
- match f.chars().next() {
- Some('\\') => match f {
- "\\Seen" => Some(FlagFetch::Flag(Flag::Seen)),
- "\\Answered" => Some(FlagFetch::Flag(Flag::Answered)),
- "\\Flagged" => Some(FlagFetch::Flag(Flag::Flagged)),
- "\\Deleted" => Some(FlagFetch::Flag(Flag::Deleted)),
- "\\Draft" => Some(FlagFetch::Flag(Flag::Draft)),
- "\\Recent" => Some(FlagFetch::Recent),
- _ => match Atom::try_from(f.strip_prefix('\\').unwrap().to_string()) {
- Err(_) => {
- tracing::error!(flag=%f, "Unable to encode flag as IMAP atom");
- None
- }
- Ok(a) => Some(FlagFetch::Flag(Flag::system(a))),
- },
- },
- Some(_) => match Atom::try_from(f.to_string()) {
- Err(_) => {
- tracing::error!(flag=%f, "Unable to encode flag as IMAP atom");
- None
- }
- Ok(a) => Some(FlagFetch::Flag(Flag::keyword(a))),
- },
- None => None,
- }
-}