mirror of
https://mau.dev/mautrix/go.git
synced 2026-03-14 14:25:53 +01:00
bridgev2/space: let network connector customize personal filtering space
This commit is contained in:
parent
7b33248d3d
commit
4913b123f1
2 changed files with 10 additions and 0 deletions
|
|
@ -18,6 +18,7 @@ import (
|
|||
"go.mau.fi/util/ptr"
|
||||
"go.mau.fi/util/random"
|
||||
|
||||
"maunium.net/go/mautrix"
|
||||
"maunium.net/go/mautrix/bridgev2/database"
|
||||
"maunium.net/go/mautrix/bridgev2/networkid"
|
||||
"maunium.net/go/mautrix/event"
|
||||
|
|
@ -294,6 +295,11 @@ type PortalBridgeInfoFillingNetwork interface {
|
|||
FillPortalBridgeInfo(portal *Portal, content *event.BridgeEventContent)
|
||||
}
|
||||
|
||||
type PersonalFilteringCustomizingNetworkAPI interface {
|
||||
NetworkAPI
|
||||
CustomizePersonalFilteringSpace(req *mautrix.ReqCreateRoom)
|
||||
}
|
||||
|
||||
// ConfigValidatingNetwork is an optional interface that network connectors can implement to validate config fields
|
||||
// before the bridge is started.
|
||||
//
|
||||
|
|
|
|||
|
|
@ -172,6 +172,10 @@ func (ul *UserLogin) GetSpaceRoom(ctx context.Context) (id.RoomID, error) {
|
|||
// TODO remove this after initial_members is supported in hungryserv
|
||||
req.BeeperAutoJoinInvites = true
|
||||
}
|
||||
pfc, ok := ul.Client.(PersonalFilteringCustomizingNetworkAPI)
|
||||
if ok {
|
||||
pfc.CustomizePersonalFilteringSpace(req)
|
||||
}
|
||||
ul.SpaceRoom, err = ul.Bridge.Bot.CreateRoom(ctx, req)
|
||||
if err != nil {
|
||||
return "", fmt.Errorf("failed to create space room: %w", err)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue