mirror of
https://github.com/chatmail/core.git
synced 2026-09-22 13:01:21 +03:00
feat: add "pinned messages" API
This commit is contained in:
@@ -461,6 +461,7 @@ pub struct Message {
|
||||
pub(crate) in_reply_to: Option<String>,
|
||||
pub(crate) is_dc_message: MessengerMessage,
|
||||
pub(crate) original_msg_id: MsgId,
|
||||
pub(crate) pinned: bool,
|
||||
pub(crate) mime_modified: bool,
|
||||
pub(crate) chat_visibility: ChatVisibility,
|
||||
pub(crate) chat_blocked: Blocked,
|
||||
@@ -530,6 +531,7 @@ impl Message {
|
||||
m.error AS error,
|
||||
m.msgrmsg AS msgrmsg,
|
||||
m.starred AS original_msg_id,
|
||||
m.pinned AS pinned,
|
||||
m.mime_modified AS mime_modified,
|
||||
m.txt AS txt,
|
||||
m.subject AS subject,
|
||||
@@ -588,6 +590,7 @@ impl Message {
|
||||
.filter(|error| !error.is_empty()),
|
||||
is_dc_message: row.get("msgrmsg")?,
|
||||
original_msg_id: row.get("original_msg_id")?,
|
||||
pinned: row.get("pinned")?,
|
||||
mime_modified: row.get("mime_modified")?,
|
||||
text,
|
||||
additional_text: String::new(),
|
||||
@@ -1080,6 +1083,8 @@ impl Message {
|
||||
| SystemMessage::IrohNodeAddr
|
||||
| SystemMessage::CallAccepted
|
||||
| SystemMessage::CallEnded
|
||||
| SystemMessage::MessagePinned // UI should scroll to pinned message on tapping
|
||||
| SystemMessage::MessageUnpinned // UI should scroll to unpinned message on tapping
|
||||
| SystemMessage::Unknown => Ok(None),
|
||||
}
|
||||
}
|
||||
@@ -1346,6 +1351,11 @@ impl Message {
|
||||
Ok(res)
|
||||
}
|
||||
|
||||
/// Returns true if the message is pinned.
|
||||
pub fn is_pinned(&self) -> bool {
|
||||
self.pinned
|
||||
}
|
||||
|
||||
/// Force the message to be sent in plain text.
|
||||
pub(crate) fn force_plaintext(&mut self) {
|
||||
self.param.set_int(Param::ForcePlaintext, 1);
|
||||
|
||||
Reference in New Issue
Block a user