From be9cae8ce704ec5f197e3a710bbbcd6995d2559e Mon Sep 17 00:00:00 2001 From: Daniel Gultsch Date: Fri, 23 Feb 2024 12:22:37 +0100 Subject: [PATCH 1/2] add XEP for 'Message Displayed Synchronization' --- inbox/xep-mds.xml | 218 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 218 insertions(+) create mode 100644 inbox/xep-mds.xml diff --git a/inbox/xep-mds.xml b/inbox/xep-mds.xml new file mode 100644 index 00000000..f760769f --- /dev/null +++ b/inbox/xep-mds.xml @@ -0,0 +1,218 @@ + + +%ents; +]> + + +
+ Message Displayed Synchronization + This specification allows multiple clients of the same user to synchronize the displayed state of their chats. + &LEGALNOTICE; + xxxx + ProtoXEP + Standards Track + Standards + Council + + XMPP Core + XEP-0001 + Etc. + + + + mds + + Daniel + Gultsch + daniel@gultsch.de + daniel@gultsch.de + + + 0.0.1 + 2024-02-21 + dg +

First draft.

+
+
+ +

In multi-device environments marking a chat as displayed on one device should mark that chat as displayed on all devices. Historically carbon copies (&xep0280;) of the <displayed/> element of Chat Markers (&xep0333;) have been used to achieve this effect. However this approach has a couple of downsides that this specification is trying eliminate:

+
    +
  • The contact has to request Chat Markers by tagging a message with <markable/>.
  • +
  • Chat Markers let the contact know that a device has displayed the message. This might not always be advisable when synchronization across multiple devices of the same user is the desired outcome.
  • +
  • When used in large group chats Chat Markers can create a lot of unwanted traffic.
  • +
+

This specification isolates the task of multi-device synchronization from providing information to the contact, while borrowing some of the semantics of Chat Markers such as displayed refering to all messages up to this point.

+
+ +
    +
  • Basic functionality should not depend on server features that go beyond what is commonly implemented at the time of writing this specification.
  • +
  • Rely on server-injected <stanza-id/> (see &xep0359;) to provide unique and stable IDs. While this is commonly done as part of &xep0313; it does not technically depend on the message being archived.
  • +
  • Define the interaction with &xep0333;.
  • +
  • Provide optional methods for traffic optimizations on supporting servers.
  • +
  • Make no assertions on what constitutes an open or archived chat. This specification allows clients to state that they have displayed messages in a certain chat up to a certain point. It does not indicate that a chat is open or in case of group chats joined.
  • +
+
+ +
+ +
Displayed
+
+ Colloquially this is also known as read. However since a common implementation of read is: "shown on screen, in full, in the context of the chat", and this gives no indication on whether the user has actually read a message, displayed was chosen as a more accurate terminology. A message might also be manually acknowledged by the user, for example via a mark as read action in a notification. Implementations are also possible, for example in smart home devices or infotainment systems, where the message is read aloud by a Text-to-Speech system, but never actually displayed. It is up to the implementors discretion to determine what the best approximation of the user has had a reasonable chance to mentally process the message is. +
+
+
+
+ + +

Clients use items in a private PEP (&xep0163;) node called 'urn:xmpp:mds:displayed:0' to synchronize and persist the displayed state (See &xep0223;). The item ID corresponds to the JID of the respective chat. For normal, 1:1 chats this SHOULD be the bare JID of the contact, for group chats this SHOULD be the bare JID of the room and for private messages in group chats the full JID of the participant.

+

The item contains a single <displayed/> element qualified by the 'xrn:xmpp:mds:displayed:0' namespace. The <displayed/> element MUST contain an attribute called 'stanza-id' that corresponds to the stanza-id (&xep0359;) of the most recent, displayed message, in that particular chat.

+
+ +

Only messages received by the user (meaning sent by third parties such as a contact, a participant in a group chat, etc) SHOULD be flagged as 'displayed'. However since 'displayed' means all messages up to this point and the stanza-id of a message sent by the user indicates a valid point in the chat history, sent messages MAY be flagged as well.

+

Flagging a chat as displayed up to this point happens by publishing a PEP item with an id corresponding to the JID of the chat and a <displayed/> payload element into the 'urn:xmpp:mds:displayed:0' node.

+

For group chats the stanza-id attribute of the <displayed/> element refers to the stanza-id injected by the room. For all other chats the stanza-id attribute refers to the stanza-id injected by the user’s server (the server hosting the user account).

+

The client MUST include appropriate publish-options in the publication, including, but not limited to, setting the access model to whitelist and the max-items to max.

+ + + + + + + + + + + http://jabber.org/protocol/pubsub#publish-options + + + true + + + max + + + never + + + whitelist + + + + + +]]> + +]]> +
+ +

A client interested in synchronizing the displayed state with other clients SHOULD include the 'urn:xmpp:mds:displayed:0+notify' feature in its &xep0115;, as per &xep0163; rules.

+
+ +

Upon bind and initial presence a client retrieves all items in the 'urn:xmpp:mds:displayed:0' node to learn what changes to the displayed state have occured while the client was offline.

+ + + + + +]]> + + + + + + + + + + + + +]]> +
+ +

A &xep0333; displayed marker refers to the message id set by the sender of the message whereas the displayed element defined in this specification refers to the stanza-id injected by the user’s server.

+

In the likely scenario that a client wishes to share the displayed state with their own devices and the sender of the message, a client SHOULD sent a &xep0333; displayed marker and ensure that the 'urn:xmpp:mds:displayed:0' node gets updated.

+ +

A &xep0060; item publication is a fairly verbose operation for something that is expected to happen rather frequently. Therfore this specification defines an optional way to combine the PEP node item update and the Chat Marker in one simple message.

+
+ +

Server assisted displayed node updates are an optional feature a user’s server can provide. To signal support the server announces an &xep0115; feature of 'urn:xmpp:mds:server-assist:0' on the account.

+ + + +]]> + + + + + +]]> +
+ +

To update the displayed item in the 'urn:xmpp:mds:displayed:0' PEP node more efficiently a client MAY send a message with the 'to' attribute set to the item id (which is equivalent to the JID of the contact) and with a <displayed/> element qualified by the 'urn:xmpp:mds:displayed:0' namespace. The server MUST strip the <displayed/> element from the message and continue to process it normally. The server MUST publish a PEP item on the 'urn:xmpp:mds:displayed:0' node where the item id is taken from the 'to' attribute and the payload is the <displayed/> element. A client MUST NOT include the <displayed/> element qualified by the 'urn:xmpp:mds:displayed:0' namespace if the message would otherwise be empty. A client that wishes to update the device synchronized displayed state but not inform the sender of the message via Chat Markers SHOULD use the regular PubSub publication process.

+ + Hi. How are you? + + + +]]> + + + + +]]> + + + + + + + + + +]]> +
+
+
+ +
    +
  • The displayed state only moves forward. Receiving a displayed state with a stanza-id that references a message older than the current local representation is considered redundant and MUST be ignored.
  • +
  • Displayed states with a stanza-id not found in the respective chat MUST be ignored.
  • +
  • Receiving an outgoing message (for example via &xep0280; or &xep0313;) SHOULD NOT mark the chat as displayed. Outgoing messages are neutral towards the overall displayed state of a given chat. For example if the displayed up to state references the most recent incoming message and this message is only followed by outgoing messages the overall state of that chat SHOULD be considered displayed.
  • +
  • A client receiving an outgoing message MAY NOT update the displayed node item with that stanza-id. However clients SHOULD be able to handle displayed states that use stanza-ids that refer to outgoing messages and simply consider the chat as displayed up to that point.
  • +
  • While Chat Markers (&xep0333;), in 1:1 chats, MAY be sent to a full JID, a client combining both <displayed/> elements in a single message MUST address that message to the bare JID, as the server will use the verbatim 'to' attribute as the item ID.
  • +
+
+ +
    +
  • When publishing displayed states via &xep0060; the client MUST use publish-options to set the access model on the node to whitelist. To ensure the server supports publish-options the client MUST first check for the "http://jabber.org/protocol/pubsub#publish-options" feature.
  • +
  • Servers that support the server assist feature MUST strip the <displayed/> element in the "urn:xmpp:mds:displayed:0" namespace from the message to avoid the stanza-id being leaked to the recipient of that message.
  • +
  • Clients MUST NOT put the <displayed/> into a message to trigger server-assited displayed synchronization unless the server announces the "urn:xmpp:mds:server-assist:0" feature.
  • +
  • This specification provides a convenient process to synchronize a user’s own devices and informing the third party in one, single message. However letting the third party know is not always desirable, for example when the user has generally opted out of transmitting the displayed status or when a non-contact initiated a chat. In those cases the client MUST use the &xep0060; method instead of server-assist.
  • +
+
+ +

REQUIRED.

+
+ +

REQUIRED.

+
+ +

REQUIRED for protocol specifications.

+
+
From 6b2c521af924ad1deda42481e4ae455d85c2a8aa Mon Sep 17 00:00:00 2001 From: Daniel Gultsch Date: Tue, 27 Feb 2024 14:38:33 +0100 Subject: [PATCH 2/2] XEP-xxxx (MDS) use stanza-id element instead of attr --- inbox/xep-mds.xml | 31 ++++++++++++++++++++++--------- 1 file changed, 22 insertions(+), 9 deletions(-) diff --git a/inbox/xep-mds.xml b/inbox/xep-mds.xml index f760769f..e44894a1 100644 --- a/inbox/xep-mds.xml +++ b/inbox/xep-mds.xml @@ -66,20 +66,23 @@

Clients use items in a private PEP (&xep0163;) node called 'urn:xmpp:mds:displayed:0' to synchronize and persist the displayed state (See &xep0223;). The item ID corresponds to the JID of the respective chat. For normal, 1:1 chats this SHOULD be the bare JID of the contact, for group chats this SHOULD be the bare JID of the room and for private messages in group chats the full JID of the participant.

-

The item contains a single <displayed/> element qualified by the 'xrn:xmpp:mds:displayed:0' namespace. The <displayed/> element MUST contain an attribute called 'stanza-id' that corresponds to the stanza-id (&xep0359;) of the most recent, displayed message, in that particular chat.

+

The item contains a single <displayed/> element qualified by the 'xrn:xmpp:mds:displayed:0' namespace. The <displayed/> element MUST contain exactly one &xep0359; <stanza-id/> element that corresponds to the stanza-id of the most recent, displayed message, in that particular chat.

Only messages received by the user (meaning sent by third parties such as a contact, a participant in a group chat, etc) SHOULD be flagged as 'displayed'. However since 'displayed' means all messages up to this point and the stanza-id of a message sent by the user indicates a valid point in the chat history, sent messages MAY be flagged as well.

Flagging a chat as displayed up to this point happens by publishing a PEP item with an id corresponding to the JID of the chat and a <displayed/> payload element into the 'urn:xmpp:mds:displayed:0' node.

-

For group chats the stanza-id attribute of the <displayed/> element refers to the stanza-id injected by the room. For all other chats the stanza-id attribute refers to the stanza-id injected by the user’s server (the server hosting the user account).

+

For group chats the <stanza-id/> child of the <displayed/> element refers to the stanza-id injected by the room. For all other chats the stanza-id child refers to the stanza-id injected by the user’s server (the server hosting the user account).

The client MUST include appropriate publish-options in the publication, including, but not limited to, setting the access model to whitelist and the max-items to max.

- + + + @@ -127,12 +130,18 @@ - + + + + + @@ -172,7 +181,9 @@ - + + + ]]> - + + +