diff --git a/config/bridge.go b/config/bridge.go index 305059e..acefc97 100644 --- a/config/bridge.go +++ b/config/bridge.go @@ -153,6 +153,10 @@ func (bc BridgeConfig) GetManagementRoomTexts() bridgeconfig.ManagementRoomTexts return bc.ManagementRoomText } +func (bc BridgeConfig) GetResendBridgeInfo() bool { + return bc.ResendBridgeInfo +} + func boolToInt(val bool) int { if val { return 1 diff --git a/go.mod b/go.mod index f916001..0e1eaf1 100644 --- a/go.mod +++ b/go.mod @@ -15,7 +15,7 @@ require ( golang.org/x/net v0.0.0-20220513224357-95641704303c google.golang.org/protobuf v1.28.0 maunium.net/go/maulogger/v2 v2.3.2 - maunium.net/go/mautrix v0.11.1-0.20220624154909-41327530d7f9 + maunium.net/go/mautrix v0.11.1-0.20220627084514-69fba8124313 ) require ( diff --git a/go.sum b/go.sum index 892d717..96eb22f 100644 --- a/go.sum +++ b/go.sum @@ -107,5 +107,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.11.1-0.20220624154909-41327530d7f9 h1:HUA1EayJMINIPygutVXl9GhMe/Zw4VhaIzNuh1tjgUs= -maunium.net/go/mautrix v0.11.1-0.20220624154909-41327530d7f9/go.mod h1:CiKpMhAx5QZFHK03jpWb0iKI3sGU8x6+LfsOjDrcO8I= +maunium.net/go/mautrix v0.11.1-0.20220627084514-69fba8124313 h1:pYpj5vc8qsNtA4sSIdAZr//jisD6wqDONzTAB4irIAg= +maunium.net/go/mautrix v0.11.1-0.20220627084514-69fba8124313/go.mod h1:CiKpMhAx5QZFHK03jpWb0iKI3sGU8x6+LfsOjDrcO8I= diff --git a/main.go b/main.go index 8ffc4a9..fe81906 100644 --- a/main.go +++ b/main.go @@ -141,9 +141,6 @@ func (br *WABridge) Start() { go br.Metrics.Start() } - if br.Config.Bridge.ResendBridgeInfo { - go br.ResendBridgeInfo() - } go br.Loop() } @@ -187,25 +184,6 @@ func (br *WABridge) WarnUsersAboutDisconnection() { br.usersLock.Unlock() } -func (br *WABridge) ResendBridgeInfo() { - // FIXME - //if *dontSaveConfig { - // br.Log.Warnln("Not setting resend_bridge_info to false in config due to --no-update flag") - //} else { - // err := config.Mutate(*configPath, func(helper *configupgrade.Helper) { - // helper.Set(configupgrade.Bool, "false", "bridge", "resend_bridge_info") - // }) - // if err != nil { - // br.Log.Errorln("Failed to save config after setting resend_bridge_info to false:", err) - // } - //} - //br.Log.Infoln("Re-sending bridge info state event to all portals") - //for _, portal := range br.GetAllPortals() { - // portal.UpdateBridgeInfo() - //} - //br.Log.Infoln("Finished re-sending bridge info state events") -} - func (br *WABridge) StartUsers() { br.Log.Debugln("Starting users") foundAnySessions := false diff --git a/portal.go b/portal.go index 3c5b4c6..b79f6ab 100644 --- a/portal.go +++ b/portal.go @@ -118,6 +118,15 @@ func (br *WABridge) GetAllPortals() []*Portal { return br.dbPortalsToPortals(br.DB.Portal.GetAll()) } +func (br *WABridge) GetAllIPortals() (iportals []bridge.Portal) { + portals := br.GetAllPortals() + iportals = make([]bridge.Portal, len(portals)) + for i, portal := range portals { + iportals[i] = portal + } + return iportals +} + func (br *WABridge) GetAllPortalsByJID(jid types.JID) []*Portal { return br.dbPortalsToPortals(br.DB.Portal.GetAllByJID(jid)) }