Normalize variation selectors in emojis in both directions

Remove for WhatsApp, add for Matrix
This commit is contained in:
Tulir Asokan 2022-03-18 01:12:23 +02:00
parent 61409ce2bc
commit 3a6c314878
3 changed files with 6 additions and 4 deletions

2
go.mod
View file

@ -17,7 +17,7 @@ require (
gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b
maunium.net/go/mauflag v1.0.0
maunium.net/go/maulogger/v2 v2.3.2
maunium.net/go/mautrix v0.10.12
maunium.net/go/mautrix v0.10.13-0.20220317230932-15d85fe4d3cc
)
require (

4
go.sum
View file

@ -197,5 +197,5 @@ maunium.net/go/mauflag v1.0.0 h1:YiaRc0tEI3toYtJMRIfjP+jklH45uDHtT80nUamyD4M=
maunium.net/go/mauflag v1.0.0/go.mod h1:nLivPOpTpHnpzEh8jEdSL9UqO9+/KBJFmNRlwKfkPeA=
maunium.net/go/maulogger/v2 v2.3.2 h1:1XmIYmMd3PoQfp9J+PaHhpt80zpfmMqaShzUTC7FwY0=
maunium.net/go/maulogger/v2 v2.3.2/go.mod h1:TYWy7wKwz/tIXTpsx8G3mZseIRiC5DoMxSZazOHy68A=
maunium.net/go/mautrix v0.10.12 h1:GqmsksKyKrTqmLb2B6yGOawoFLPTJ3A3NtXrygAvKM8=
maunium.net/go/mautrix v0.10.12/go.mod h1:xTq6+uMCAXtQwfqjUrYd8O10oIyymbzZm02CYOMt4ek=
maunium.net/go/mautrix v0.10.13-0.20220317230932-15d85fe4d3cc h1:7NNOnyCL03RWifzCko6QhVzn+gqS8DKRRtqCVBIKj7g=
maunium.net/go/mautrix v0.10.13-0.20220317230932-15d85fe4d3cc/go.mod h1:WqW8mruBue+1YrL/f04Ni/4R5yfLcgO8BQhUJzl7sps=

View file

@ -50,6 +50,7 @@ import (
"maunium.net/go/mautrix/id"
"maunium.net/go/mautrix/util"
"maunium.net/go/mautrix/util/ffmpeg"
"maunium.net/go/mautrix/util/variationselector"
"go.mau.fi/whatsmeow"
waProto "go.mau.fi/whatsmeow/binary/proto"
@ -1461,7 +1462,7 @@ func (portal *Portal) HandleMessageReaction(intent *appservice.IntentAPI, user *
content.RelatesTo = event.RelatesTo{
Type: event.RelAnnotation,
EventID: target.MXID,
Key: reaction.GetText(),
Key: variationselector.Add(reaction.GetText()),
}
if intent.IsCustomPuppet {
content.DoublePuppet = doublePuppetValue
@ -2789,6 +2790,7 @@ func (portal *Portal) sendReactionToWhatsApp(sender *User, id types.MessageID, t
if !portal.IsPrivateChat() {
messageKeyParticipant = proto.String(target.Sender.ToNonAD().String())
}
key = variationselector.Remove(key)
return sender.Client.SendMessage(portal.Key.JID, id, &waProto.Message{
ReactionMessage: &waProto.ReactionMessage{
Key: &waProto.MessageKey{