Skip to content

Commit 6da6bd9

Browse files
committed
inline function
squash
1 parent 84fd32a commit 6da6bd9

File tree

1 file changed

+13
-21
lines changed

1 file changed

+13
-21
lines changed

src/message.rs

Lines changed: 13 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1816,19 +1816,28 @@ pub async fn delete_msgs_ex(
18161816
}
18171817
}
18181818
res?;
1819-
let (info_msg_ids, mut info_msg_rfc724): (Vec<_>, Vec<_>) =
1820-
deleted_info_msgs.into_iter().unzip();
1819+
let (info_msg_ids, info_msg_rfc724): (Vec<_>, Vec<_>) = deleted_info_msgs.into_iter().unzip();
18211820

18221821
if delete_for_all {
18231822
ensure!(
18241823
modified_chat_ids.len() == 1,
18251824
"Can delete only from same chat."
18261825
);
18271826
if let Some(chat_id) = modified_chat_ids.iter().next() {
1828-
info_msg_rfc724.extend(deleted_rfc724_mid);
1829-
send_delete_request(context, chat_id, &info_msg_rfc724).await?;
1827+
deleted_rfc724_mid.extend(info_msg_rfc724);
1828+
let mut msg = Message::new_text("🚮".to_owned());
1829+
// We don't want to send deletion requests in chats w/o encryption:
1830+
// - These are usually chats with non-DC clients who won't respect deletion requests
1831+
// anyway and display a weird trash bin message instead.
1832+
// - Deletion of world-visible unencrypted messages seems not very useful.
1833+
msg.param.set_int(Param::GuaranteeE2ee, 1);
1834+
msg.param
1835+
.set(Param::DeleteRequestFor, deleted_rfc724_mid.join(" "));
1836+
msg.hidden = true;
1837+
send_msg(context, *chat_id, &mut msg).await?;
18301838
}
18311839
} else {
1840+
deleted_rfc724_mid.extend(info_msg_rfc724);
18321841
context
18331842
.add_sync_item(SyncData::DeleteMessages {
18341843
msgs: deleted_rfc724_mid,
@@ -1853,23 +1862,6 @@ pub async fn delete_msgs_ex(
18531862
Ok(())
18541863
}
18551864

1856-
async fn send_delete_request(
1857-
context: &Context,
1858-
chat_id: &ChatId,
1859-
deleted_rfc724_mid: &[String],
1860-
) -> Result<MsgId> {
1861-
let mut msg = Message::new_text("🚮".to_owned());
1862-
// We don't want to send deletion requests in chats w/o encryption:
1863-
// - These are usually chats with non-DC clients who won't respect deletion requests
1864-
// anyway and display a weird trash bin message instead.
1865-
// - Deletion of world-visible unencrypted messages seems not very useful.
1866-
msg.param.set_int(Param::GuaranteeE2ee, 1);
1867-
msg.param
1868-
.set(Param::DeleteRequestFor, deleted_rfc724_mid.join(" "));
1869-
msg.hidden = true;
1870-
send_msg(context, *chat_id, &mut msg).await
1871-
}
1872-
18731865
/// Marks requested messages as seen.
18741866
pub async fn markseen_msgs(context: &Context, msg_ids: Vec<MsgId>) -> Result<()> {
18751867
if msg_ids.is_empty() {

0 commit comments

Comments
 (0)