@@ -1816,19 +1816,28 @@ pub async fn delete_msgs_ex(
1816
1816
}
1817
1817
}
1818
1818
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 ( ) ;
1821
1820
1822
1821
if delete_for_all {
1823
1822
ensure ! (
1824
1823
modified_chat_ids. len( ) == 1 ,
1825
1824
"Can delete only from same chat."
1826
1825
) ;
1827
1826
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 ?;
1830
1838
}
1831
1839
} else {
1840
+ deleted_rfc724_mid. extend ( info_msg_rfc724) ;
1832
1841
context
1833
1842
. add_sync_item ( SyncData :: DeleteMessages {
1834
1843
msgs : deleted_rfc724_mid,
@@ -1853,23 +1862,6 @@ pub async fn delete_msgs_ex(
1853
1862
Ok ( ( ) )
1854
1863
}
1855
1864
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
-
1873
1865
/// Marks requested messages as seen.
1874
1866
pub async fn markseen_msgs ( context : & Context , msg_ids : Vec < MsgId > ) -> Result < ( ) > {
1875
1867
if msg_ids. is_empty ( ) {
0 commit comments