Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions bridgev2/matrix/connector.go
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,7 @@ func (br *Connector) Init(bridge *bridgev2.Bridge) {
br.EventProcessor.On(event.BeeperSendState, br.handleRoomEvent)
br.EventProcessor.On(event.StateRoomAvatar, br.handleRoomEvent)
br.EventProcessor.On(event.StateTopic, br.handleRoomEvent)
br.EventProcessor.On(event.StatePinnedEvents, br.handleRoomEvent)
br.EventProcessor.On(event.StateTombstone, br.handleRoomEvent)
br.EventProcessor.On(event.StateBeeperDisappearingTimer, br.handleRoomEvent)
br.EventProcessor.On(event.BeeperDeleteChat, br.handleRoomEvent)
Expand Down
10 changes: 10 additions & 0 deletions bridgev2/networkinterface.go
Original file line number Diff line number Diff line change
Expand Up @@ -710,6 +710,15 @@ type DisappearTimerChangingNetworkAPI interface {
HandleMatrixDisappearingTimer(ctx context.Context, msg *MatrixDisappearingTimer) (bool, error)
}

// PinHandlingNetworkAPI is an optional interface that network connectors can implement to handle pinned events changes.
type PinHandlingNetworkAPI interface {
NetworkAPI
// HandleMatrixPinChange is called when the pinned events in a portal room are changed.
// The new pinned event IDs are in Content.Pinned, and the previous ones are in PrevContent.Pinned.
// The connector should diff them to determine which messages were pinned or unpinned.
HandleMatrixPinChange(ctx context.Context, msg *MatrixPinChange) (bool, error)
}

// DeleteChatHandlingNetworkAPI is an optional interface that network connectors
// can implement to delete a chat from the remote network.
type DeleteChatHandlingNetworkAPI interface {
Expand Down Expand Up @@ -1412,6 +1421,7 @@ type MatrixRoomMeta[ContentType any] struct {
type MatrixRoomName = MatrixRoomMeta[*event.RoomNameEventContent]
type MatrixRoomAvatar = MatrixRoomMeta[*event.RoomAvatarEventContent]
type MatrixRoomTopic = MatrixRoomMeta[*event.TopicEventContent]
type MatrixPinChange = MatrixRoomMeta[*event.PinnedEventsEventContent]
type MatrixDisappearingTimer = MatrixRoomMeta[*event.BeeperDisappearingTimer]

type MatrixReadReceipt struct {
Expand Down
2 changes: 2 additions & 0 deletions bridgev2/portal.go
Original file line number Diff line number Diff line change
Expand Up @@ -830,6 +830,8 @@ func (portal *Portal) handleMatrixEvent(ctx context.Context, sender *User, evt *
return handleMatrixRoomMeta(portal, ctx, login, origSender, evt, isStateRequest, RoomTopicHandlingNetworkAPI.HandleMatrixRoomTopic)
case event.StateRoomAvatar:
return handleMatrixRoomMeta(portal, ctx, login, origSender, evt, isStateRequest, RoomAvatarHandlingNetworkAPI.HandleMatrixRoomAvatar)
case event.StatePinnedEvents:
return handleMatrixRoomMeta(portal, ctx, login, origSender, evt, isStateRequest, PinHandlingNetworkAPI.HandleMatrixPinChange)
case event.StateBeeperDisappearingTimer:
return handleMatrixRoomMeta(portal, ctx, login, origSender, evt, isStateRequest, DisappearTimerChangingNetworkAPI.HandleMatrixDisappearingTimer)
case event.StateEncryption:
Expand Down