| author | Stephen Paul Weber
<singpolyma@singpolyma.net> 2026-03-15 19:44:58 UTC |
| committer | Stephen Paul Weber
<singpolyma@singpolyma.net> 2026-03-15 19:51:31 UTC |
| parent | 170a880765c17d5b858066d4e3606e83117a9e0f |
| borogove/ChatMessage.hx | +10 | -0 |
diff --git a/borogove/ChatMessage.hx b/borogove/ChatMessage.hx index 659ca69..67eff35 100644 --- a/borogove/ChatMessage.hx +++ b/borogove/ChatMessage.hx @@ -444,6 +444,16 @@ class ChatMessage { return (!isIncoming() ? from?.asBare()?.asString() : to?.asBare()?.asString()) ?? throw "from or to is null"; } + /** + Is this message the same as or a replacement for some other one? + **/ + public function canReplace(other: ChatMessage) { + return + (other.serverId != null && serverId == other.serverId && serverIdBy == other.serverIdBy) || + (localId == other.localId && + ((!isIncoming() && !other.isIncoming()) || (senderId == other.senderId && versions.length > 0))); + } + /** Is this an incoming message? **/