dc_receive_imf: rename timer into ephemeral_timer

This commit is contained in:
Alexander Krotov
2020-07-13 01:15:51 +03:00
parent 1e84e81e7d
commit 0da21aa9f6

View File

@@ -622,7 +622,7 @@ async fn add_parts(
} }
// Extract ephemeral timer from the message. // Extract ephemeral timer from the message.
let mut timer = if let Some(value) = mime_parser.get(HeaderDef::EphemeralTimer) { let mut ephemeral_timer = if let Some(value) = mime_parser.get(HeaderDef::EphemeralTimer) {
match value.parse::<EphemeralTimer>() { match value.parse::<EphemeralTimer>() {
Ok(timer) => timer, Ok(timer) => timer,
Err(err) => { Err(err) => {
@@ -649,14 +649,17 @@ async fn add_parts(
if !*hidden if !*hidden
&& !location_kml_is && !location_kml_is
&& !is_mdn && !is_mdn
&& (*chat_id).get_ephemeral_timer(context).await? != timer && (*chat_id).get_ephemeral_timer(context).await? != ephemeral_timer
{ {
match (*chat_id).inner_set_ephemeral_timer(context, timer).await { match (*chat_id)
.inner_set_ephemeral_timer(context, ephemeral_timer)
.await
{
Ok(()) => { Ok(()) => {
if mime_parser.is_system_message == SystemMessage::EphemeralTimerChanged { if mime_parser.is_system_message == SystemMessage::EphemeralTimerChanged {
set_better_msg( set_better_msg(
mime_parser, mime_parser,
stock_ephemeral_timer_changed(context, timer, from_id).await, stock_ephemeral_timer_changed(context, ephemeral_timer, from_id).await,
); );
// Do not delete the system message itself. // Do not delete the system message itself.
@@ -665,12 +668,12 @@ async fn add_parts(
// to 1 week, and then changed to 1 hour: after 1 // to 1 week, and then changed to 1 hour: after 1
// hour, only the message about the change to 1 // hour, only the message about the change to 1
// week is left. // week is left.
timer = EphemeralTimer::Disabled; ephemeral_timer = EphemeralTimer::Disabled;
} else { } else {
chat::add_info_msg( chat::add_info_msg(
context, context,
*chat_id, *chat_id,
stock_ephemeral_timer_changed(context, timer, from_id).await, stock_ephemeral_timer_changed(context, ephemeral_timer, from_id).await,
) )
.await; .await;
} }
@@ -791,7 +794,7 @@ async fn add_parts(
mime_in_reply_to, mime_in_reply_to,
mime_references, mime_references,
part.error, part.error,
timer ephemeral_timer
])?; ])?;
drop(stmt); drop(stmt);