Skip to content
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

MSC2545: Image Packs (Emoticons & Stickers) #2545

Open
wants to merge 36 commits into
base: old_master
Choose a base branch
from
Open
Changes from 6 commits
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
bc55ff6
add emotes proposal
Sorunome May 15, 2020
0f4bd5e
add more stuffs
Sorunome May 15, 2020
2d191f6
fix naming thingy
Sorunome May 15, 2020
fa3a8be
fix typo
Sorunome May 15, 2020
96f2864
outline room emote packs and emote rooms
Sorunome May 20, 2020
81ccecb
remove comma
Sorunome May 20, 2020
dc43e79
address things
Sorunome May 20, 2020
4435d75
update emotes msc
Sorunome Jun 20, 2020
79aae8a
update
Sorunome Jun 20, 2020
4fea69b
Fix typos and grammar mistakes
Sorunome Jun 24, 2020
0e382e0
m.emote --> m.emoticon, update dedupe and pack priority
Sorunome Sep 1, 2020
72b2174
update stuff
Sorunome Sep 24, 2020
2e2987b
add a paragraph over emojis and stuff
Sorunome Sep 30, 2020
e8c2e34
Re-word proposal to sound more firm, address lots of suggestions
Sorunome Oct 25, 2020
b41c091
specify that emotes can be animated
Sorunome Oct 25, 2020
4f6d147
update msc to also include stickers and thelike
Sorunome Mar 25, 2021
5351cb3
update a few things
Sorunome Mar 25, 2021
12c8fa8
add a few more words on slugs
Sorunome Mar 25, 2021
e8d910f
Update proposals/2545-emotes.md
Sorunome Mar 26, 2021
a879bcd
license --> attribution
Sorunome Jul 4, 2021
580a836
Update proposals/2545-emotes.md
Sorunome Jul 18, 2021
43f20ad
Merge branch 'soru/emotes' of github.com:Sorunome/matrix-doc into sor…
Sorunome Jul 18, 2021
739b4c0
Update with "looking further" section and slightly update comparison
Sorunome Jul 18, 2021
51bcec2
add a sentance to suggest image packs from spaces
Sorunome Jul 24, 2021
71a3c55
soru bamboozled herself!
Sorunome Jul 24, 2021
a7a4a36
Fix small wording and ensure that emotes from canonical spaces are to…
Sorunome Sep 16, 2021
be7d0df
Update spelling mistakes and wording, only suggest deduplication meth…
Sorunome Oct 28, 2022
b5ca351
fix some typos
anoadragon453 Sep 19, 2023
3517a16
Make reference to spec/client naming disparity timeless
anoadragon453 Aug 15, 2024
5d62d52
Require `alt` and `title` attributes for emotes
anoadragon453 Aug 15, 2024
e5b9c2c
Link `m.sticker` spec; small wording changes
anoadragon453 Aug 15, 2024
44c5ed3
Prevent clients from rendering emotes behind non-MXC uri schemes
anoadragon453 Aug 15, 2024
ea50cc7
Clarify client requirements around emote resolution
anoadragon453 Aug 15, 2024
3c2e29c
Add a new proposal intro
anoadragon453 Aug 15, 2024
c429552
Recommend default of 32px for emote height
anoadragon453 Aug 28, 2024
d4e9cd2
Specify image formats are equivalent to m.image
anoadragon453 Aug 29, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
125 changes: 125 additions & 0 deletions proposals/2545-emotes.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,125 @@
# MSC2545: Emotes
Sorunome marked this conversation as resolved.
Show resolved Hide resolved
Sorunome marked this conversation as resolved.
Show resolved Hide resolved
Sorunome marked this conversation as resolved.
Show resolved Hide resolved

Emotes.....emotes!

# Proposal
Emotes have at least a shortcode and an mxc uri. They are sent as `<img>` tags currently already in
the spec, as such existing clients *should* be able to render them (support for this is sadly poor,
even within riot flavours). Such an `<img>` tag of a shortcode `:emote:` and an mxc uri `mxc://example.org/emote`
could look as follows:

```html
<img src="mxc://example.org/emote" alt=":emote:" title=":emote:" height="32" />
```

Both the `alt` and the `title` attributes are specified as they serve different purposes: `alt` is
displayed if e.g. the emote does not load. `title` is displayed e.g. on mouse hover over the emote.
Sorunome marked this conversation as resolved.
Show resolved Hide resolved
The height is just a height that looks good on most devices with the normal, default font size.
No width is displayed as to not weirdly squish non-square emotes.
Sorunome marked this conversation as resolved.
Show resolved Hide resolved

## Emote sources
In order to be able to send emotes the client needs to have a list of shortcodes and their corresponding
mxc uris. For this there are two different emote sources:

### User emotes
User emotes are per-user emotes that are defined in the users respective account data. The type for that
Sorunome marked this conversation as resolved.
Show resolved Hide resolved
is `im.ponies.user_emotes` (`m.emotes`). The content is as following:
Sorunome marked this conversation as resolved.
Show resolved Hide resolved

```json
{
"short": {
":emote:": "mxc://example.org/blah",
":other-emote:": "mxc://example.org/other-blah"
}
}
```

The emotes are defined inside of a dict called `short`, meant as the "short and easy" representation
Sorunome marked this conversation as resolved.
Show resolved Hide resolved
of the emotes. Other, additional keys may exist to define more metadata for the emotes. No such
guide exists yet.

### Room emotes
Room emotes are per-room emotes that every user of a specific room can use inside of that room. They
Sorunome marked this conversation as resolved.
Show resolved Hide resolved
are set with a state event of type `im.ponies.room_emotes` (`m.emotes`). The state key denotes a possible
Sorunome marked this conversation as resolved.
Show resolved Hide resolved
pack, whereas the default one would be a blank state key. E.g. a discord bridge could set as state key
Sorunome marked this conversation as resolved.
Show resolved Hide resolved
`de.sorunome.mx-puppet-bridge.discord` and have all the bridged emotes in said state event, keeping
bridged emotes from own, custom ones separate.
Sorunome marked this conversation as resolved.
Show resolved Hide resolved

The content extends that of the user emotes: It uses the `short` key, which is a map of the shortcode
of the emote to its mxc uri. Additionally, an optional `pack` key can be set, which defines meta-information
on the pack. The following attributes are there:
Sorunome marked this conversation as resolved.
Show resolved Hide resolved

- `pack.displayname`: An easy displayname for the pack. Defaults to the room name, if it doesn't exist
Sorunome marked this conversation as resolved.
Show resolved Hide resolved
- `pack.avatar_url`: The mxc uri of an avatar/icon to display for the pack. Defaults to the room name,
Sorunome marked this conversation as resolved.
Show resolved Hide resolved
if it doesn't exist.
- `pack.short`: A short identifier of the pack. Defaults to the normalized state key, and if the state
Sorunome marked this conversation as resolved.
Show resolved Hide resolved
Sorunome marked this conversation as resolved.
Show resolved Hide resolved
key is blank it defaults to "room".

Normalized means here, converting spaces to `-`, taking only alphanumerical characters, `-` and `_`,
and casting it all to lowercase.
Sorunome marked this conversation as resolved.
Show resolved Hide resolved

As such, a content of a room emote pack could look as following:
Sorunome marked this conversation as resolved.
Show resolved Hide resolved
Sorunome marked this conversation as resolved.
Show resolved Hide resolved

```json
{
"short": {
":emote:": "mxc://example.org/blah",
":other-emote:": "mxc://example.org/other-blah"
Sorunome marked this conversation as resolved.
Show resolved Hide resolved
},
"pack": {
"displayname": "Emotes from Discord!",
"avatar_url": "mxc://example.org/discord_guild",
"short": "some_discord_guild"
Sorunome marked this conversation as resolved.
Show resolved Hide resolved
}
}
```

### Emote rooms
While room emotes are specific to a room and are only accessible within that room, emote rooms should
be accessible from everywhere. They do not differentiate themself from room emotes at all, instead you
Sorunome marked this conversation as resolved.
Show resolved Hide resolved
set an event in your account data of type `im.ponies.emote_rooms` (`m.emotes.rooms`) which outlines
which room emote states should be globally accessible for that user. For that, a `room` key contains
Sorunome marked this conversation as resolved.
Show resolved Hide resolved
a map of room id that contains a map of state key that contains an optional pack definition override.
Sorunome marked this conversation as resolved.
Show resolved Hide resolved
As such, the contents of `im.ponies.emote_rooms` could look as follows:
Sorunome marked this conversation as resolved.
Show resolved Hide resolved

```json
{
"rooms": {
"!someroom:example.org": {
"": {},
"de.sorunome.mx-puppet-bridge.discord": {
"name": "Overriden name",
"short": "new_short_name"
Sorunome marked this conversation as resolved.
Show resolved Hide resolved
}
},
"!someotherroom:example.org": {
"": {}
}
}
}
```

Here three emote packs are globally accessible to the user: Two defined in `!someroom:example.org`
(one with blank state key and one with state key `de.sorunome.mx-puppet-bridge.discord`) and one in
`!someotherroom:example.org`.

## Sending
In places where fancy tab-complete with the emote itself is not possible it is suggested that sending
the shortcode will convert to the img tag, e.g. sending `Hey there :wave:` will convert to `Hey there <img-for-wave>`.
Sorunome marked this conversation as resolved.
Show resolved Hide resolved

If there are collisions due to the same emote shortcode being present as both room emote and user emote
a user could specify the emote source by writing e.g. `:room~wave:` or `:user~wave:`. Here the short
pack name is used for room emotes, and "user" for user emotes.
Sorunome marked this conversation as resolved.
Show resolved Hide resolved

# Ideas
- ???

# Current implementations
## Emote rendering (rendering of the `<img>` tag)
- riot-web
- revolution
- nheko
- fluffychat
## Emote sending, using the mentioned events here
- revolution
- fluffychat