Add/fix sticker bridging in both directions

* Matrix stickers are sent as images
* WhatsApp stickers were missing the incoming event handler

Fixes #124
Fixes #127
Closes #126
Closes #129

Co-authored-by: rafaeltheraven <rafael.dulfer@gmail.com>
This commit is contained in:
Tulir Asokan
2019-12-31 20:17:03 +02:00
parent 4bdbe67c94
commit e056459ab4
5 changed files with 24 additions and 7 deletions

View File

@ -946,7 +946,10 @@ func (portal *Portal) HandleMediaMessage(source *User, download func() ([]byte,
}
data, err := download()
if err != nil {
if err == whatsapp.ErrNoURLPresent {
portal.log.Debugln("No URL present error for media message %s, ignoring...", info.Id)
return
} else if err != nil {
portal.log.Errorfln("Failed to download media for %s: %v", info.Id, err)
resp, err := portal.MainIntent().SendNotice(portal.MXID, "Failed to bridge media")
if err != nil {
@ -1234,6 +1237,9 @@ func (portal *Portal) HandleMatrixMessage(sender *User, evt *mautrix.Event) {
sender = portal.bridge.Relaybot
}
}
if evt.Type == mautrix.EventSticker {
evt.Content.MsgType = mautrix.MsgImage
}
var err error
switch evt.Content.MsgType {
case mautrix.MsgText, mautrix.MsgEmote: