From 9c87532d529eb234009e10509c8e53b634233ba1 Mon Sep 17 00:00:00 2001 From: Tulir Asokan Date: Sun, 5 Mar 2023 19:29:28 +0200 Subject: [PATCH] Update state cache after manaul bridging --- commands.go | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/commands.go b/commands.go index 753d2cb..cd719d2 100644 --- a/commands.go +++ b/commands.go @@ -756,9 +756,18 @@ func fnBridge(ce *WrappedCommandEvent) { portal.updateRoomTopic() portal.updateSpace() portal.UpdateBridgeInfo() + state, err := portal.MainIntent().State(portal.MXID) + if err != nil { + ce.ZLog.Error().Err(err).Msg("Failed to update state cache for room") + } + encryptionEvent, isEncrypted := state[event.StateEncryption][""] + portal.Encrypted = isEncrypted && encryptionEvent.Content.AsEncryption().Algorithm == id.AlgorithmMegolmV1 portal.Update() ce.Reply("Room successfully bridged") - ce.ZLog.Info().Str("channel_id", portal.Key.ChannelID).Msg("Manual bridging complete") + ce.ZLog.Info(). + Str("channel_id", portal.Key.ChannelID). + Bool("encrypted", portal.Encrypted). + Msg("Manual bridging complete") } var cmdUnbridge = &commands.FullHandler{