From d75c3231b9f0f41e77f2c79d28e2badc466d205b Mon Sep 17 00:00:00 2001 From: Hocuri Date: Tue, 21 Apr 2026 16:02:38 +0200 Subject: [PATCH] Move function --- src/chat.rs | 80 ++++++++++++++++++++++++++--------------------------- 1 file changed, 40 insertions(+), 40 deletions(-) diff --git a/src/chat.rs b/src/chat.rs index aadf5456c..857f7c120 100644 --- a/src/chat.rs +++ b/src/chat.rs @@ -3278,46 +3278,6 @@ pub async fn marknoticed_all_chats(context: &Context) -> Result<()> { Ok(()) } -/// TODO -pub(crate) async fn get_msgs_for_resending( - context: &Context, - chat_id: ChatId, - n_msgs: usize, -) -> Result> { - let items = context - .sql - .query_map_vec( - &format!( - " -SELECT id -FROM msgs -WHERE chat_id=? - AND hidden=0 - AND NOT ( -- Exclude info and system messages - param GLOB '*\nS=*' OR param GLOB 'S=*' - OR from_id=? - OR to_id=? - ) - AND viewtype!=? -ORDER BY timestamp DESC, id DESC LIMIT ?" - ), - ( - chat_id, - ContactId::INFO, - ContactId::INFO, - Viewtype::Webxdc, - n_msgs, - ), - |row: &rusqlite::Row| Ok(row.get::<_, MsgId>(0)?), - ) - .await? - .into_iter() - .rev() - .collect(); - - Ok(items) -} - /// Marks all messages in the chat as noticed. /// If the given chat-id is the archive-link, marks all messages in all archived chats as noticed. pub async fn marknoticed_chat(context: &Context, chat_id: ChatId) -> Result<()> { @@ -4071,6 +4031,46 @@ pub(crate) async fn add_contact_to_chat_ex( Ok(true) } +/// TODO +async fn get_msgs_for_resending( + context: &Context, + chat_id: ChatId, + n_msgs: usize, +) -> Result> { + let items = context + .sql + .query_map_vec( + &format!( + " +SELECT id +FROM msgs +WHERE chat_id=? + AND hidden=0 + AND NOT ( -- Exclude info and system messages + param GLOB '*\nS=*' OR param GLOB 'S=*' + OR from_id=? + OR to_id=? + ) + AND viewtype!=? +ORDER BY timestamp DESC, id DESC LIMIT ?" + ), + ( + chat_id, + ContactId::INFO, + ContactId::INFO, + Viewtype::Webxdc, + n_msgs, + ), + |row: &rusqlite::Row| Ok(row.get::<_, MsgId>(0)?), + ) + .await? + .into_iter() + .rev() + .collect(); + + Ok(items) +} + /// Returns true if an avatar should be attached in the given chat. /// /// This function does not check if the avatar is set.