Move function

This commit is contained in:
Hocuri
2026-04-21 16:02:38 +02:00
parent 38d57ebb30
commit d75c3231b9

View File

@@ -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<Vec<MsgId>> {
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<Vec<MsgId>> {
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.