Skip to content

Commit

Permalink
Allow *User object to fill bridge states manually
Browse files Browse the repository at this point in the history
  • Loading branch information
tulir committed Jul 14, 2023
1 parent 1cc8ce5 commit 82f817e
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions bridge/status/bridgestate.go
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down

0 comments on commit 82f817e

Please sign in to comment.