Compare commits

..

1 Commits

Author SHA1 Message Date
link2xt
f9add2e1f2 api: expose Message-ID (aka rfc724_mid) in JSON-RPC API 2023-11-22 12:01:20 +00:00
12 changed files with 45 additions and 21 deletions

View File

@@ -1,11 +1,5 @@
# Changelog
## [1.131.7] - 2023-11-24
### Fixes
- Revert "fix: check UIDNEXT with a STATUS command before going IDLE". This fixes mail.163.com which has broken STATUS command.
## [1.131.6] - 2023-11-21
### Fixes
@@ -3269,4 +3263,3 @@ https://github.com/deltachat/deltachat-core-rust/pulls?q=is%3Apr+is%3Aclosed
[1.131.4]: https://github.com/deltachat/deltachat-core-rust/compare/v1.131.3...v1.131.4
[1.131.5]: https://github.com/deltachat/deltachat-core-rust/compare/v1.131.4...v1.131.5
[1.131.6]: https://github.com/deltachat/deltachat-core-rust/compare/v1.131.5...v1.131.6
[1.131.7]: https://github.com/deltachat/deltachat-core-rust/compare/v1.131.6...v1.131.7

10
Cargo.lock generated
View File

@@ -1087,7 +1087,7 @@ dependencies = [
[[package]]
name = "deltachat"
version = "1.131.7"
version = "1.131.6"
dependencies = [
"ansi_term",
"anyhow",
@@ -1165,7 +1165,7 @@ dependencies = [
[[package]]
name = "deltachat-jsonrpc"
version = "1.131.7"
version = "1.131.6"
dependencies = [
"anyhow",
"async-channel 2.1.0",
@@ -1189,7 +1189,7 @@ dependencies = [
[[package]]
name = "deltachat-repl"
version = "1.131.7"
version = "1.131.6"
dependencies = [
"ansi_term",
"anyhow",
@@ -1204,7 +1204,7 @@ dependencies = [
[[package]]
name = "deltachat-rpc-server"
version = "1.131.7"
version = "1.131.6"
dependencies = [
"anyhow",
"deltachat",
@@ -1229,7 +1229,7 @@ dependencies = [
[[package]]
name = "deltachat_ffi"
version = "1.131.7"
version = "1.131.6"
dependencies = [
"anyhow",
"deltachat",

View File

@@ -1,6 +1,6 @@
[package]
name = "deltachat"
version = "1.131.7"
version = "1.131.6"
edition = "2021"
license = "MPL-2.0"
rust-version = "1.70"

View File

@@ -1,6 +1,6 @@
[package]
name = "deltachat_ffi"
version = "1.131.7"
version = "1.131.6"
description = "Deltachat FFI"
edition = "2018"
readme = "README.md"

View File

@@ -1,6 +1,6 @@
[package]
name = "deltachat-jsonrpc"
version = "1.131.7"
version = "1.131.6"
description = "DeltaChat JSON-RPC API"
edition = "2021"
default-run = "deltachat-jsonrpc-server"

View File

@@ -34,6 +34,10 @@ pub struct MessageObject {
quote: Option<MessageQuote>,
parent_id: Option<u32>,
/// Contents of `Message-ID` header.
/// Possibly a fake unique string if incoming message did not have a `Message-ID` header.
message_id: String,
text: String,
has_location: bool,
has_html: bool,
@@ -174,6 +178,8 @@ impl MessageObject {
Some(reactions.into())
};
let message_id = message.rfc724_mid().to_string();
Ok(MessageObject {
id: msg_id.to_u32(),
chat_id: message.get_chat_id().to_u32(),
@@ -233,6 +239,8 @@ impl MessageObject {
download_state,
reactions,
message_id,
})
}
}

View File

@@ -53,5 +53,5 @@
},
"type": "module",
"types": "dist/deltachat.d.ts",
"version": "1.131.7"
"version": "1.131.6"
}

View File

@@ -1,6 +1,6 @@
[package]
name = "deltachat-repl"
version = "1.131.7"
version = "1.131.6"
license = "MPL-2.0"
edition = "2021"

View File

@@ -1,6 +1,6 @@
[package]
name = "deltachat-rpc-server"
version = "1.131.7"
version = "1.131.6"
description = "DeltaChat JSON-RPC server"
edition = "2021"
readme = "README.md"

View File

@@ -56,5 +56,5 @@
"test:mocha": "mocha -r esm node/test/test.js --growl --reporter=spec --bail --exit"
},
"types": "node/dist/index.d.ts",
"version": "1.131.7"
"version": "1.131.6"
}

View File

@@ -1 +1 @@
2023-11-24
2023-11-21

View File

@@ -9,7 +9,7 @@ use super::session::Session;
use super::Imap;
use crate::config::Config;
use crate::context::Context;
use crate::imap::{client::IMAP_TIMEOUT, FolderMeaning};
use crate::imap::{client::IMAP_TIMEOUT, get_uid_next, FolderMeaning};
use crate::log::LogExt;
const IDLE_TIMEOUT: Duration = Duration::from_secs(23 * 60);
@@ -29,6 +29,29 @@ impl Session {
return Ok(self);
}
// Despite checking for unsolicited EXISTS above,
// we may have missed EXISTS if the message was
// received when the folder was not selected.
let status = self
.status(folder, "(UIDNEXT)")
.await
.with_context(|| format!("STATUS (UIDNEXT) error for {folder:?}"))?;
if let Some(uid_next) = status.uid_next {
let expected_uid_next = get_uid_next(context, folder)
.await
.with_context(|| format!("failed to get old UID NEXT for folder {folder}"))?;
if uid_next > expected_uid_next {
info!(
context,
"Skipping IDLE on {folder:?} because UIDNEXT {uid_next}>{expected_uid_next} indicates there are new messages."
);
return Ok(self);
}
} else {
warn!(context, "STATUS {folder} (UIDNEXT) did not return UIDNEXT");
// Go to IDLE anyway if STATUS is broken.
}
if let Ok(()) = idle_interrupt_receiver.try_recv() {
info!(context, "skip idle, got interrupt");
return Ok(self);