mirror of
https://github.com/youwen5/iamb.git
synced 2025-08-04 11:38:28 -07:00
Indicate when you're editing a message (#75)
This commit is contained in:
parent
cc1d2f3bf8
commit
4935899aed
3 changed files with 52 additions and 27 deletions
14
src/base.rs
14
src/base.rs
|
@ -103,7 +103,9 @@ pub enum VerifyAction {
|
|||
#[derive(Clone, Debug, Eq, PartialEq)]
|
||||
pub enum MessageAction {
|
||||
/// Cance the current reply or edit.
|
||||
Cancel,
|
||||
///
|
||||
/// The [bool] argument indicates whether to skip confirmation for clearing the message bar.
|
||||
Cancel(bool),
|
||||
|
||||
/// Download an attachment to the given path.
|
||||
///
|
||||
|
@ -446,8 +448,12 @@ impl RoomInfo {
|
|||
}
|
||||
}
|
||||
|
||||
pub fn get_message_key(&self, event_id: &EventId) -> Option<&MessageKey> {
|
||||
self.keys.get(event_id)?.to_message_key()
|
||||
}
|
||||
|
||||
pub fn get_event(&self, event_id: &EventId) -> Option<&Message> {
|
||||
self.messages.get(self.keys.get(event_id)?.to_message_key()?)
|
||||
self.messages.get(self.get_message_key(event_id)?)
|
||||
}
|
||||
|
||||
pub fn insert_reaction(&mut self, react: ReactionEvent) {
|
||||
|
@ -489,10 +495,10 @@ impl RoomInfo {
|
|||
|
||||
match &mut msg.event {
|
||||
MessageEvent::Original(orig) => {
|
||||
orig.content = *new_content;
|
||||
orig.content.msgtype = new_content.msgtype;
|
||||
},
|
||||
MessageEvent::Local(_, content) => {
|
||||
*content = new_content;
|
||||
content.msgtype = new_content.msgtype;
|
||||
},
|
||||
MessageEvent::Redacted(_) |
|
||||
MessageEvent::EncryptedOriginal(_) |
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue