Commit e98d58a8cc
Unregistered key
Layout: unified · split
src/message/mod.rs +21 −1
| @@ -342,6 +342,23 @@ impl MessageEvent { | |||
| 342 | } | 342 | } |
| 343 | } | 343 | } |
| 344 | 344 | ||
| 345 | pub fn content(&self) -> Option<&RoomMessageEventContent> { | ||
| 346 | match self { | ||
| 347 | MessageEvent::EncryptedOriginal(_) => None, | ||
| 348 | MessageEvent::Original(ev) => Some(&ev.content), | ||
| 349 | MessageEvent::EncryptedRedacted(_) => None, | ||
| 350 | MessageEvent::Redacted(_) => None, | ||
| 351 | MessageEvent::Local(_, content) => Some(content), | ||
| 352 | } | ||
| 353 | } | ||
| 354 | |||
| 355 | pub fn is_emote(&self) -> bool { | ||
| 356 | matches!( | ||
| 357 | self.content(), | ||
| 358 | Some(RoomMessageEventContent { msgtype: MessageType::Emote(_), .. }) | ||
| 359 | ) | ||
| 360 | } | ||
| 361 | |||
| 345 | pub fn body(&self) -> Cow<'_, str> { | 362 | pub fn body(&self) -> Cow<'_, str> { |
| 346 | match self { | 363 | match self { |
| 347 | MessageEvent::EncryptedOriginal(_) => "[Unable to decrypt message]".into(), | 364 | MessageEvent::EncryptedOriginal(_) => "[Unable to decrypt message]".into(), |
| @@ -771,7 +788,10 @@ impl Message { | |||
| 771 | settings: &ApplicationSettings, | 788 | settings: &ApplicationSettings, |
| 772 | ) -> Option<Span> { | 789 | ) -> Option<Span> { |
| 773 | if let Some(prev) = prev { | 790 | if let Some(prev) = prev { |
| 774 | if self.sender == prev.sender && self.timestamp.same_day(&prev.timestamp) { | 791 | if self.sender == prev.sender && |
| 792 | self.timestamp.same_day(&prev.timestamp) && | ||
| 793 | !self.event.is_emote() | ||
| 794 | { | ||
| 775 | return None; | 795 | return None; |
| 776 | } | 796 | } |
| 777 | } | 797 | } |