forked from MirrorHub/mautrix-whatsapp
Re-add support for resend_bridge_info
This commit is contained in:
parent
219265c706
commit
68b0f3d0a4
5 changed files with 16 additions and 25 deletions
|
@ -153,6 +153,10 @@ func (bc BridgeConfig) GetManagementRoomTexts() bridgeconfig.ManagementRoomTexts
|
||||||
return bc.ManagementRoomText
|
return bc.ManagementRoomText
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (bc BridgeConfig) GetResendBridgeInfo() bool {
|
||||||
|
return bc.ResendBridgeInfo
|
||||||
|
}
|
||||||
|
|
||||||
func boolToInt(val bool) int {
|
func boolToInt(val bool) int {
|
||||||
if val {
|
if val {
|
||||||
return 1
|
return 1
|
||||||
|
|
2
go.mod
2
go.mod
|
@ -15,7 +15,7 @@ require (
|
||||||
golang.org/x/net v0.0.0-20220513224357-95641704303c
|
golang.org/x/net v0.0.0-20220513224357-95641704303c
|
||||||
google.golang.org/protobuf v1.28.0
|
google.golang.org/protobuf v1.28.0
|
||||||
maunium.net/go/maulogger/v2 v2.3.2
|
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 (
|
require (
|
||||||
|
|
4
go.sum
4
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/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 h1:1XmIYmMd3PoQfp9J+PaHhpt80zpfmMqaShzUTC7FwY0=
|
||||||
maunium.net/go/maulogger/v2 v2.3.2/go.mod h1:TYWy7wKwz/tIXTpsx8G3mZseIRiC5DoMxSZazOHy68A=
|
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.20220627084514-69fba8124313 h1:pYpj5vc8qsNtA4sSIdAZr//jisD6wqDONzTAB4irIAg=
|
||||||
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/go.mod h1:CiKpMhAx5QZFHK03jpWb0iKI3sGU8x6+LfsOjDrcO8I=
|
||||||
|
|
22
main.go
22
main.go
|
@ -141,9 +141,6 @@ func (br *WABridge) Start() {
|
||||||
go br.Metrics.Start()
|
go br.Metrics.Start()
|
||||||
}
|
}
|
||||||
|
|
||||||
if br.Config.Bridge.ResendBridgeInfo {
|
|
||||||
go br.ResendBridgeInfo()
|
|
||||||
}
|
|
||||||
go br.Loop()
|
go br.Loop()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -187,25 +184,6 @@ func (br *WABridge) WarnUsersAboutDisconnection() {
|
||||||
br.usersLock.Unlock()
|
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() {
|
func (br *WABridge) StartUsers() {
|
||||||
br.Log.Debugln("Starting users")
|
br.Log.Debugln("Starting users")
|
||||||
foundAnySessions := false
|
foundAnySessions := false
|
||||||
|
|
|
@ -118,6 +118,15 @@ func (br *WABridge) GetAllPortals() []*Portal {
|
||||||
return br.dbPortalsToPortals(br.DB.Portal.GetAll())
|
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 {
|
func (br *WABridge) GetAllPortalsByJID(jid types.JID) []*Portal {
|
||||||
return br.dbPortalsToPortals(br.DB.Portal.GetAllByJID(jid))
|
return br.dbPortalsToPortals(br.DB.Portal.GetAllByJID(jid))
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue