mirror of
https://github.com/chatmail/core.git
synced 2026-04-27 02:16:29 +03:00
Allow sender timestamp to be in the future
This can happen due to unsynchronized clocks or when "smeared" timestamp is used as the sender sends multiple messages without delay.
This commit is contained in:
@@ -5,6 +5,7 @@
|
||||
### API-Changes
|
||||
|
||||
### Changes
|
||||
- allow sender timestamp to be in the future, but not too much
|
||||
|
||||
### Fixes
|
||||
- `dc_search_msgs()` returns unaccepted requests #3694
|
||||
|
||||
@@ -173,10 +173,13 @@ pub(crate) async fn receive_imf_inner(
|
||||
.await?;
|
||||
|
||||
let rcvd_timestamp = smeared_time(context).await;
|
||||
|
||||
// Sender timestamp is allowed to be a bit in the future due to
|
||||
// unsynchronized clocks, but not too much.
|
||||
let sent_timestamp = mime_parser
|
||||
.get_header(HeaderDef::Date)
|
||||
.and_then(|value| mailparse::dateparse(value).ok())
|
||||
.map_or(rcvd_timestamp, |value| min(value, rcvd_timestamp));
|
||||
.map_or(rcvd_timestamp, |value| min(value, rcvd_timestamp + 60));
|
||||
|
||||
// Add parts
|
||||
let received_msg = add_parts(
|
||||
|
||||
Reference in New Issue
Block a user