fix read state in self-chat and stop leaking read-marker into it (#18)
iOS CI / Build and Test SwiftUI App (push) Canceled after 0s
Build Unsigned iOS and macOS Apps / Build Unsigned iOS IPA (push) Canceled after 0s
Build Unsigned iOS and macOS Apps / Build macOS ZIP (push) Canceled after 0s

Self-chat never showed Read: the outgoing message was promoted by
sendDisplayedMarkerIfNeeded, but a later XEP-0184 <received/> receipt
or a LMM correction overwrote .read with .delivered/.sent directly,
bypassing Delivery.merged. Mark self-addressed outgoing messages read
as soon as the server accepts them and merge every weaker status into
the ladder instead of overwriting.

The self-addressed read-marker carried a plaintext <body>, so clients
that do not know our namespace (Conversations, Monal) rendered it as a
"Сообщение прочитано" bubble in the self-chat. Service stanzas now ride
on their payload element only.

Refs #18
This commit is contained in:
wt committed 2026-09-18 12:46:36 +07:00
1 parent 8a2af872d6
commit ade7efea1a
3 files changed
+51 -10

No files matched your search

+4 -3
View File
@@ -829,7 +829,10 @@ final class XMPPService {
message.to = JID(account.normalizedJID)
message.type = .chat
message.id = marker.id
message.body = Self.readMarkerBody
// No <body>: this is a service stanza for the user's own devices only.
// A plaintext body would leak into the self-chat and be rendered as a
// normal message by clients that do not know our read-marker namespace
// (Conversations, Monal), so the marker rides solely on its payload.
addOriginID(marker.id, to: message)
message.addChild(ReadStateSync.payloadElement(marker: marker))
client.context.writer.write(message, writeCompleted: nil)
@@ -851,8 +854,6 @@ final class XMPPService {
client.context.writer.write(message, writeCompleted: nil)
}
private static let readMarkerBody = "Сообщение прочитано"
/// Detects OMEMO 2 (`urn:xmpp:omemo:2`) payloads, which the pinned
/// MartinOMEMO version cannot decrypt (it only speaks the legacy
/// `eu.siacs.conversations.axolotl` namespace).