Update SieveScript to DRAFT-14.
parent
c8d672057e
commit
5c7fd055ec
|
@ -10,7 +10,7 @@ _jmap-client_ is a **JSON Meta Application Protocol (JMAP) library** written in
|
||||||
- JMAP Core ([RFC 8620](https://datatracker.ietf.org/doc/html/rfc8620))
|
- JMAP Core ([RFC 8620](https://datatracker.ietf.org/doc/html/rfc8620))
|
||||||
- JMAP for Mail ([RFC 8621](https://datatracker.ietf.org/doc/html/rfc8621))
|
- JMAP for Mail ([RFC 8621](https://datatracker.ietf.org/doc/html/rfc8621))
|
||||||
- JMAP over WebSocket ([RFC 8887](https://datatracker.ietf.org/doc/html/rfc8887)).
|
- JMAP over WebSocket ([RFC 8887](https://datatracker.ietf.org/doc/html/rfc8887)).
|
||||||
- JMAP for Sieve Scripts ([DRAFT-SIEVE-12](https://www.ietf.org/archive/id/draft-ietf-jmap-sieve-12.html)).
|
- JMAP for Sieve Scripts ([DRAFT-SIEVE-14](https://www.ietf.org/archive/id/draft-ietf-jmap-sieve-14.html)).
|
||||||
|
|
||||||
Features:
|
Features:
|
||||||
|
|
||||||
|
|
|
@ -110,6 +110,8 @@ pub struct WebSocketCapabilities {
|
||||||
|
|
||||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||||
pub struct SieveCapabilities {
|
pub struct SieveCapabilities {
|
||||||
|
#[serde(rename = "implementation")]
|
||||||
|
implementation: Option<String>,
|
||||||
#[serde(rename = "maxSizeScriptName")]
|
#[serde(rename = "maxSizeScriptName")]
|
||||||
max_script_name: Option<usize>,
|
max_script_name: Option<usize>,
|
||||||
#[serde(rename = "maxSizeScript")]
|
#[serde(rename = "maxSizeScript")]
|
||||||
|
|
|
@ -430,7 +430,10 @@ impl Display for SetErrorType {
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn from_timestamp(timestamp: i64) -> DateTime<Utc> {
|
pub fn from_timestamp(timestamp: i64) -> DateTime<Utc> {
|
||||||
DateTime::<Utc>::from_utc(NaiveDateTime::from_timestamp(timestamp, 0), Utc)
|
DateTime::<Utc>::from_utc(
|
||||||
|
NaiveDateTime::from_timestamp_opt(timestamp, 0).unwrap_or_default(),
|
||||||
|
Utc,
|
||||||
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn string_not_set(string: &Option<String>) -> bool {
|
pub fn string_not_set(string: &Option<String>) -> bool {
|
||||||
|
|
|
@ -96,8 +96,6 @@ impl EventParser {
|
||||||
id,
|
id,
|
||||||
..
|
..
|
||||||
}) => {
|
}) => {
|
||||||
#[cfg(feature = "debug")]
|
|
||||||
use std::iter::FromIterator;
|
|
||||||
#[cfg(feature = "debug")]
|
#[cfg(feature = "debug")]
|
||||||
return Some(Ok(Changes {
|
return Some(Ok(Changes {
|
||||||
id: if !id.is_empty() {
|
id: if !id.is_empty() {
|
||||||
|
|
|
@ -112,7 +112,7 @@ impl Client {
|
||||||
request
|
request
|
||||||
.set_sieve_script()
|
.set_sieve_script()
|
||||||
.arguments()
|
.arguments()
|
||||||
.on_success_deactivate_scripts();
|
.on_success_deactivate_script(true);
|
||||||
request
|
request
|
||||||
.send_single::<SieveScriptSetResponse>()
|
.send_single::<SieveScriptSetResponse>()
|
||||||
.await?
|
.await?
|
||||||
|
|
|
@ -52,7 +52,10 @@ pub struct SieveScript<State = Get> {
|
||||||
pub struct SetArguments {
|
pub struct SetArguments {
|
||||||
#[serde(rename = "onSuccessActivateScript")]
|
#[serde(rename = "onSuccessActivateScript")]
|
||||||
#[serde(skip_serializing_if = "Option::is_none")]
|
#[serde(skip_serializing_if = "Option::is_none")]
|
||||||
on_success_activate_script: Option<Option<String>>,
|
on_success_activate_script: Option<String>,
|
||||||
|
#[serde(rename = "onSuccessDeactivateScript")]
|
||||||
|
#[serde(skip_serializing_if = "Option::is_none")]
|
||||||
|
on_success_deactivate_script: Option<bool>,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Eq, Hash, Copy)]
|
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Eq, Hash, Copy)]
|
||||||
|
|
|
@ -46,17 +46,17 @@ impl SetObject for SieveScript<Set> {
|
||||||
|
|
||||||
impl SetArguments {
|
impl SetArguments {
|
||||||
pub fn on_success_activate_script(&mut self, id: impl Into<String>) -> &mut Self {
|
pub fn on_success_activate_script(&mut self, id: impl Into<String>) -> &mut Self {
|
||||||
self.on_success_activate_script = Some(Some(format!("#{}", id.into())));
|
self.on_success_activate_script = Some(format!("#{}", id.into()));
|
||||||
self
|
self
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn on_success_activate_script_id(&mut self, id: impl Into<String>) -> &mut Self {
|
pub fn on_success_activate_script_id(&mut self, id: impl Into<String>) -> &mut Self {
|
||||||
self.on_success_activate_script = Some(Some(id.into()));
|
self.on_success_activate_script = Some(id.into());
|
||||||
self
|
self
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn on_success_deactivate_scripts(&mut self) -> &mut Self {
|
pub fn on_success_deactivate_script(&mut self, value: bool) -> &mut Self {
|
||||||
self.on_success_activate_script = Some(None);
|
self.on_success_deactivate_script = Some(value);
|
||||||
self
|
self
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue