mirror of
https://mau.dev/mautrix/go.git
synced 2026-03-14 22:35:52 +01:00
Allow *User object to fill bridge states manually
This commit is contained in:
parent
1cc8ce5ca5
commit
82f817eff6
1 changed files with 9 additions and 0 deletions
|
|
@ -78,11 +78,20 @@ type BridgeStateFiller interface {
|
|||
GetRemoteName() string
|
||||
}
|
||||
|
||||
type CustomBridgeStateFiller interface {
|
||||
BridgeStateFiller
|
||||
FillBridgeState(BridgeState) BridgeState
|
||||
}
|
||||
|
||||
func (pong BridgeState) Fill(user BridgeStateFiller) BridgeState {
|
||||
if user != nil {
|
||||
pong.UserID = user.GetMXID()
|
||||
pong.RemoteID = user.GetRemoteID()
|
||||
pong.RemoteName = user.GetRemoteName()
|
||||
|
||||
if custom, ok := user.(CustomBridgeStateFiller); ok {
|
||||
pong = custom.FillBridgeState(pong)
|
||||
}
|
||||
}
|
||||
|
||||
pong.Timestamp = jsontime.UnixNow()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue