diff options
author | Quentin Dufour <quentin@deuxfleurs.fr> | 2024-01-03 12:29:19 +0100 |
---|---|---|
committer | Quentin Dufour <quentin@deuxfleurs.fr> | 2024-01-03 12:29:19 +0100 |
commit | 6d37924399dd5d04f5be2506e3e044dd165f6399 (patch) | |
tree | 9d6030ed892dbf2518bf5fea5bd323ce9cfed6e8 /src/imap/capability.rs | |
parent | a059585cb423d527763ef0131773d6620ebcafd5 (diff) | |
download | aerogramme-6d37924399dd5d04f5be2506e3e044dd165f6399.tar.gz aerogramme-6d37924399dd5d04f5be2506e3e044dd165f6399.zip |
rework capability
Diffstat (limited to 'src/imap/capability.rs')
-rw-r--r-- | src/imap/capability.rs | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/src/imap/capability.rs b/src/imap/capability.rs new file mode 100644 index 0000000..b98e8f8 --- /dev/null +++ b/src/imap/capability.rs @@ -0,0 +1,30 @@ +use imap_codec::imap_types::core::NonEmptyVec; +use imap_codec::imap_types::response::Capability; + +#[derive(Debug, Clone)] +pub struct ServerCapability { + r#move: bool, + unselect: bool, +} + +impl Default for ServerCapability { + fn default() -> Self { + Self { + r#move: true, + unselect: true, + } + } +} + +impl ServerCapability { + pub fn to_vec(&self) -> NonEmptyVec<Capability<'static>> { + let mut acc = vec![Capability::Imap4Rev1]; + if self.r#move { + acc.push(Capability::Move); + } + if self.unselect { + acc.push(Capability::try_from("UNSELECT").unwrap()); + } + acc.try_into().unwrap() + } +} |