Change bridge info protocol ID and add resend_bridge_info config option
This commit is contained in:
@@ -45,6 +45,7 @@ type BridgeConfig struct {
|
||||
|
||||
SyncWithCustomPuppets bool `yaml:"sync_with_custom_puppets"`
|
||||
SyncDirectChatList bool `yaml:"sync_direct_chat_list"`
|
||||
ResendBridgeInfo bool `yaml:"resend_bridge_info"`
|
||||
FederateRooms bool `yaml:"federate_rooms"`
|
||||
|
||||
DoublePuppetServerMap map[string]string `yaml:"double_puppet_server_map"`
|
||||
@@ -65,6 +66,10 @@ type BridgeConfig struct {
|
||||
channelnameTemplate *template.Template `yaml:"-"`
|
||||
}
|
||||
|
||||
func (bc *BridgeConfig) GetResendBridgeInfo() bool {
|
||||
return bc.ResendBridgeInfo
|
||||
}
|
||||
|
||||
func (bc *BridgeConfig) EnableMessageStatusEvents() bool {
|
||||
return bc.MessageStatusEvents
|
||||
}
|
||||
|
||||
@@ -35,6 +35,7 @@ func DoUpgrade(helper *up.Helper) {
|
||||
helper.Copy(up.Bool, "bridge", "restricted_rooms")
|
||||
helper.Copy(up.Bool, "bridge", "sync_with_custom_puppets")
|
||||
helper.Copy(up.Bool, "bridge", "sync_direct_chat_list")
|
||||
helper.Copy(up.Bool, "bridge", "resend_bridge_info")
|
||||
helper.Copy(up.Bool, "bridge", "federate_rooms")
|
||||
helper.Copy(up.Map, "bridge", "double_puppet_server_map")
|
||||
helper.Copy(up.Bool, "bridge", "double_puppet_allow_discovery")
|
||||
|
||||
@@ -95,6 +95,9 @@ bridge:
|
||||
# Note that updating the m.direct event is not atomic (except with mautrix-asmux)
|
||||
# and is therefore prone to race conditions.
|
||||
sync_direct_chat_list: false
|
||||
# Set this to true to tell the bridge to re-send m.bridge events to all rooms on the next run.
|
||||
# This field will automatically be changed back to false after it, except if the config file is not writable.
|
||||
resend_bridge_info: false
|
||||
# Whether or not created rooms should have federation enabled.
|
||||
# If false, created portal rooms will never be federated.
|
||||
federate_rooms: true
|
||||
|
||||
2
go.mod
2
go.mod
@@ -11,7 +11,7 @@ require (
|
||||
github.com/skip2/go-qrcode v0.0.0-20200617195104-da1b6568686e
|
||||
github.com/yuin/goldmark v1.4.12
|
||||
maunium.net/go/maulogger/v2 v2.3.2
|
||||
maunium.net/go/mautrix v0.11.1-0.20220627081123-442224f153d1
|
||||
maunium.net/go/mautrix v0.11.1-0.20220627084514-69fba8124313
|
||||
)
|
||||
|
||||
require (
|
||||
|
||||
4
go.sum
4
go.sum
@@ -58,5 +58,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.20220627081123-442224f153d1 h1:K6mjbN60uri8C68PNAzF+Ej70ecDzuonsWqgztKVrM8=
|
||||
maunium.net/go/mautrix v0.11.1-0.20220627081123-442224f153d1/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=
|
||||
|
||||
11
portal.go
11
portal.go
@@ -165,6 +165,15 @@ func (br *DiscordBridge) GetAllPortals() []*Portal {
|
||||
return br.dbPortalsToPortals(br.DB.Portal.GetAll())
|
||||
}
|
||||
|
||||
func (br *DiscordBridge) 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 *DiscordBridge) GetDMPortalsWith(otherUserID string) []*Portal {
|
||||
return br.dbPortalsToPortals(br.DB.Portal.FindPrivateChatsWith(otherUserID))
|
||||
}
|
||||
@@ -233,7 +242,7 @@ func (portal *Portal) getBridgeInfo() (string, event.BridgeEventContent) {
|
||||
BridgeBot: portal.bridge.Bot.UserID,
|
||||
Creator: portal.MainIntent().UserID,
|
||||
Protocol: event.BridgeInfoSection{
|
||||
ID: "discord",
|
||||
ID: "discordgo",
|
||||
DisplayName: "Discord",
|
||||
AvatarURL: portal.bridge.Config.AppService.Bot.ParsedAvatar.CUString(),
|
||||
ExternalURL: "https://discord.com/",
|
||||
|
||||
Reference in New Issue
Block a user