Add elapsed times to message filtering events

This commit is contained in:
mdecimus
2024-08-23 17:09:26 +02:00
parent dcc31e8b3e
commit e4cd866be4
11 changed files with 113 additions and 48 deletions

View File

@@ -42,10 +42,14 @@ impl JMAP {
path: Vec<&str>,
body: Option<Vec<u8>>,
) -> trc::Result<HttpResponse> {
let script = match (
path.get(1)
.and_then(|name| self.core.sieve.scripts.get(*name))
.cloned(),
let (script, script_id) = match (
path.get(1).and_then(|name| {
self.core
.sieve
.scripts
.get(*name)
.map(|s| (s.clone(), name.to_string()))
}),
req.method(),
) {
(Some(script), &Method::POST) => script,
@@ -94,7 +98,7 @@ impl JMAP {
}
// Run script
let result = match self.smtp.run_script(script, params, 0).await {
let result = match self.smtp.run_script(script_id, script, params, 0).await {
ScriptResult::Accept { modifications } => Response::Accept { modifications },
ScriptResult::Replace {
message,