Skip to content

MSC4144: Per-message profiles #4144

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 14 commits into
base: main
Choose a base branch
from

Conversation

tulir
Copy link
Member

@tulir tulir commented May 10, 2024

Signed-off-by: Tulir Asokan <tulir@beeper.com>
@tulir tulir added proposal A matrix spec change proposal client-server Client-Server API kind:feature MSC for not-core and not-maintenance stuff needs-implementation This MSC does not have a qualifying implementation for the SCT to review. The MSC cannot enter FCP. labels May 10, 2024
@onestacked

This comment was marked as resolved.

Implementing encrypted avatars could cause difficulty for clients that assume
that avatars are always unencrypted mxc URIs.

## Alternatives
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reminds me of MSC3464. This is more general than that MSC, though.

@tulir tulir removed the needs-implementation This MSC does not have a qualifying implementation for the SCT to review. The MSC cannot enter FCP. label Jan 28, 2025
{
"msgtype": "m.text",
"body": "Hello, World!",
"m.per_message_profile": {
Copy link
Contributor

@Half-Shot Half-Shot Jun 13, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wonder if with extensible messages, it would make sense to support the (horrible) format of {name}: {body}. E.g.

{
  "msgtype": "m.text",
  "body": "Hello, World!",
  "m.text": [
      { "body": "<strong>cat</strong>: Hello, world", "mimetype": "text/html" },
      { "body": "cat: Hello, world" }
  ],
  "m.per_message_profile": {
    "id": "meow",
    "displayname": "cat",
    "avatar_url": "mxc://maunium.net/hgXsKqlmRfpKvCZdUoWDkFQo"
  }
}

as currently the fallback for unsupported clients isn't great.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That might cause ptsd from reply fallbacks 😹 Maybe it is the best option though. Needs very strict rules to ensure the fallback can always be safely stripped out. An indicator for whether the fallback is present at all is probably also a good idea.

I don't think extensible events would help at all unless you duplicated the entire message (one copy with a fallback and another without), but duplication is also bad

Perhaps something along the lines of

{
  "msgtype": "m.text",
  "body": "cat: Hello, World!",
  "format": "org.matrix.custom.html",
  "formatted_body": "<strong data-mx-profile-fallback>cat: </strong>Hello, World!",
  "m.per_message_profile": {
    "id": "meow",
    "displayname": "cat",
    "avatar_url": "mxc://maunium.net/hgXsKqlmRfpKvCZdUoWDkFQo",
    "has_fallback": true
  }
}

where if has_fallback is true, body MUST be prefixed with the exact value of displayname, followed by a colon and a space, and formatted_body (if present) MUST have the same prefix inside a strong tag with the data-mx-profile-fallback attribute

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Having the has_fallback flag would make the change fully compatible with all existing per-message profile messages and it would allow removing it in the future like reply fallbacks

The HTML version might have to allow not being the prefix, because otherwise it wouldn't really work with paragraph tags (you'd get a forced linebreak if you did something like <strong data-mx-profile-fallback>cat: </strong><p>message text</p>). A HTML parser should still be able to just drop anything with the data-mx-profile-fallback attribute and it might be reasonably safe to regex too because there won't be any html inside like there were in reply fallbacks

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have added fallbacks as per my example above to the MSC

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
client-server Client-Server API kind:feature MSC for not-core and not-maintenance stuff proposal A matrix spec change proposal
Projects
None yet
Development

Successfully merging this pull request may close these issues.

9 participants