1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
//! Mark messages read

use crate::coinconfig::CoinConfig;

/// Mark a given message as read or unread
/// # Arguments
/// * `message`: message id
/// * `read`: read or unread
pub fn mark_message_read(message: u32, read: bool) -> anyhow::Result<()> {
    let c = CoinConfig::get_active();
    c.db()?.mark_message_read(message, read)?;
    Ok(())
}

/// Mark all messages as read or unread
/// # Arguments
/// * `read`: read or unread
pub fn mark_all_messages_read(read: bool) -> anyhow::Result<()> {
    let c = CoinConfig::get_active();
    c.db()?.mark_all_messages_read(c.id_account, read)?;
    Ok(())
}