From 014c63f0e78b39bcdb763ade086611695fe58949 Mon Sep 17 00:00:00 2001 From: Tulir Asokan Date: Sat, 1 Mar 2025 21:43:09 +0200 Subject: [PATCH] hicli/sync: ignore m.unavailable withheld events from own devices --- pkg/hicli/sync.go | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/pkg/hicli/sync.go b/pkg/hicli/sync.go index 3821776..074d7e0 100644 --- a/pkg/hicli/sync.go +++ b/pkg/hicli/sync.go @@ -82,7 +82,12 @@ func (h *HiClient) preProcessSyncResponse(ctx context.Context, resp *mautrix.Res case *event.EncryptedEventContent: h.Crypto.HandleEncryptedEvent(ctx, evt) case *event.RoomKeyWithheldEventContent: - h.Crypto.HandleRoomKeyWithheld(ctx, content) + // TODO move this check to mautrix-go? + if evt.Sender == h.Account.UserID && content.Code == event.RoomKeyWithheldUnavailable { + log.Debug().Any("withheld_content", content).Msg("Ignoring m.unavailable megolm session withheld event") + } else { + h.Crypto.HandleRoomKeyWithheld(ctx, content) + } default: postponedToDevices = append(postponedToDevices, evt) }