Bridge custom emoji reactions as :custom:

Official web app doesn't support them yet either, this is probably
better than the raw UUID
This commit is contained in:
Tulir Asokan 2024-02-29 15:49:36 +02:00
parent 6d7bfc1ba8
commit 4998d4a34b
4 changed files with 580 additions and 128 deletions

File diff suppressed because it is too large Load diff

Binary file not shown.

View file

@ -55,11 +55,42 @@ enum EmojiType {
CRYING_FACE = 10; CRYING_FACE = 10;
POUTING_FACE = 11; POUTING_FACE = 11;
RED_HEART = 12; RED_HEART = 12;
EMOTIFY = 13;
}
message CustomEmojiData {
message Inner {
optional string unknownString = 100;
message ImageData {
string mimeType = 1;
string uri = 2;
optional int32 unknownInt3 = 3;
optional string unknownString5 = 5;
}
message WrappedImageData {
message ImageData {
int32 unknownInt1 = 1;
string mimeType = 2;
string uri = 3;
int32 width = 5;
int32 height = 6;
optional int32 unknownInt7 = 7;
}
ImageData data = 1;
}
ImageData first = 101;
WrappedImageData second = 102;
}
string uuid = 1;
optional int32 unknownInt4 = 4;
Inner innerData = 100;
} }
message ReactionData { message ReactionData {
string unicode = 1; string unicode = 1;
EmojiType type = 2; EmojiType type = 2;
CustomEmojiData customEmoji = 101;
} }
message EmojiMeta { message EmojiMeta {

View file

@ -798,8 +798,13 @@ func (portal *Portal) syncReactions(ctx context.Context, source *User, message *
remove[reaction.Sender] = reaction remove[reaction.Sender] = reaction
} }
for _, reaction := range reactions { for _, reaction := range reactions {
emoji := reaction.GetData().GetUnicode() var emoji string
if emoji == "" { switch reaction.GetData().GetType() {
case gmproto.EmojiType_EMOTIFY:
emoji = ":custom:"
case gmproto.EmojiType_CUSTOM:
emoji = reaction.GetData().GetUnicode()
default:
emoji = reaction.GetData().GetType().Unicode() emoji = reaction.GetData().GetType().Unicode()
if emoji == "" { if emoji == "" {
continue continue