Merge pull request #410 from mautrix/sumner/bri-1327-update-whatsapp-to-use-unsupported

checkpoints: send UNSUPPORTED for broadcast list unsupported
This commit is contained in:
Sumner Evans 2021-12-22 10:40:48 -07:00 committed by GitHub
commit 4e3f64aaa2
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -2212,7 +2212,13 @@ func (portal *Portal) HandleMatrixMessage(sender *User, evt *event.Event) {
if err != nil {
portal.log.Errorfln("Error sending message: %v", err)
portal.sendErrorMessage(err.Error(), true)
portal.bridge.AS.SendErrorMessageSendCheckpoint(evt, appservice.StepRemote, err, true, 0)
status := appservice.StatusPermFailure
if errors.Is(err, whatsmeow.ErrBroadcastListUnsupported) {
status = appservice.StatusUnsupported
}
checkpoint := appservice.NewMessageSendCheckpoint(evt, appservice.StepRemote, status, 0)
checkpoint.Info = err.Error()
go checkpoint.Send(portal.bridge.AS)
} else {
portal.log.Debugfln("Handled Matrix event %s", evt.ID)
portal.bridge.AS.SendMessageSendCheckpoint(evt, appservice.StepRemote, 0)