From 7924aa8bfe8f0fbcd557bb8bb3a9d3ebeab2220a Mon Sep 17 00:00:00 2001 From: Manos Pitsidianakis Date: Mon, 28 Nov 2022 16:56:37 +0200 Subject: [PATCH] melib/jmap: fix compilation --- melib/src/backends/jmap.rs | 69 +++++++++++++++-------------- melib/src/backends/jmap/protocol.rs | 7 --- 2 files changed, 35 insertions(+), 41 deletions(-) diff --git a/melib/src/backends/jmap.rs b/melib/src/backends/jmap.rs index 4b03e404..238e2651 100644 --- a/melib/src/backends/jmap.rs +++ b/melib/src/backends/jmap.rs @@ -93,9 +93,9 @@ use mailbox::*; #[derive(Debug, Default)] pub struct EnvelopeCache { bytes: Option, - headers: Option, - body: Option, - flags: Option, + // headers: Option, + // body: Option, + // flags: Option, } #[derive(Debug, Clone)] @@ -153,34 +153,6 @@ impl JmapServerConf { } } -macro_rules! get_conf_val { - ($s:ident[$var:literal]) => { - $s.extra.get($var).ok_or_else(|| { - MeliError::new(format!( - "Configuration error ({}): JMAP connection requires the field `{}` set", - $s.name.as_str(), - $var - )) - }) - }; - ($s:ident[$var:literal], $default:expr) => { - $s.extra - .get($var) - .map(|v| { - <_>::from_str(v).map_err(|e| { - MeliError::new(format!( - "Configuration error ({}): Invalid value for field `{}`: {}\n{}", - $s.name.as_str(), - $var, - v, - e - )) - }) - }) - .unwrap_or_else(|| Ok($default)) - }; -} - #[derive(Debug)] pub struct Store { pub account_name: Arc, @@ -587,7 +559,7 @@ impl MailBackend for JmapType { _new_path: String, ) -> ResultFuture { Err(MeliError::new( - "Renaming mailbox is currently unimplemented for jmap backend.", + "Renaming mailbox is currently unimplemented for the JMAP backend.", )) } @@ -596,7 +568,36 @@ impl MailBackend for JmapType { _path: String, ) -> ResultFuture<(MailboxHash, HashMap)> { Err(MeliError::new( - "Creating mailbox is currently unimplemented for jmap backend.", + "Creating mailbox is currently unimplemented for the JMAP backend.", + )) + } + + fn delete_mailbox( + &mut self, + _mailbox_hash: MailboxHash, + ) -> ResultFuture> { + Err(MeliError::new( + "Deleting a mailbox is currently unimplemented for the JMAP backend.", + )) + } + + fn set_mailbox_subscription( + &mut self, + _mailbox_hash: MailboxHash, + _val: bool, + ) -> ResultFuture<()> { + Err(MeliError::new( + "Setting mailbox subscription is currently unimplemented for the JMAP backend.", + )) + } + + fn set_mailbox_permissions( + &mut self, + _mailbox_hash: MailboxHash, + _val: MailboxPermissions, + ) -> ResultFuture<()> { + Err(MeliError::new( + "Setting mailbox permissions is currently unimplemented for the JMAP backend.", )) } @@ -865,7 +866,7 @@ impl MailBackend for JmapType { _mailbox_hash: MailboxHash, ) -> ResultFuture<()> { Err(MeliError::new( - "Deleting messages is currently unimplemented for jmap backend.", + "Deleting messages is currently unimplemented for the JMAP backend.", )) } } diff --git a/melib/src/backends/jmap/protocol.rs b/melib/src/backends/jmap/protocol.rs index 7eb7e640..0e4db8c1 100644 --- a/melib/src/backends/jmap/protocol.rs +++ b/melib/src/backends/jmap/protocol.rs @@ -77,13 +77,6 @@ impl Request { } } -#[derive(Deserialize, Debug)] -#[serde(rename_all = "camelCase")] -pub struct JsonResponse<'a> { - #[serde(borrow)] - method_responses: Vec>, -} - pub async fn get_mailboxes(conn: &JmapConnection) -> Result> { let seq = get_request_no!(conn.request_no); let api_url = conn.session.lock().unwrap().api_url.clone();