Skip to content

Commit 37af19a

Browse files
committed
bridgev2/portal: allow remote events to have post handlers
1 parent 1b7a78b commit 37af19a

File tree

2 files changed

+9
-0
lines changed

2 files changed

+9
-0
lines changed

bridgev2/networkinterface.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -884,6 +884,11 @@ type RemotePreHandler interface {
884884
PreHandle(ctx context.Context, portal *Portal)
885885
}
886886

887+
type RemotePostHandler interface {
888+
RemoteEvent
889+
PostHandle(ctx context.Context, portal *Portal)
890+
}
891+
887892
type RemoteChatInfoChange interface {
888893
RemoteEvent
889894
GetChatInfoChange(ctx context.Context) (*ChatInfoChange, error)

bridgev2/portal.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1594,6 +1594,10 @@ func (portal *Portal) handleRemoteEvent(ctx context.Context, source *UserLogin,
15941594
default:
15951595
log.Warn().Msg("Got remote event with unknown type")
15961596
}
1597+
postHandler, ok := evt.(RemotePostHandler)
1598+
if ok {
1599+
postHandler.PostHandle(ctx, portal)
1600+
}
15971601
}
15981602

15991603
func (portal *Portal) getIntentAndUserMXIDFor(ctx context.Context, sender EventSender, source *UserLogin, otherLogins []*UserLogin, evtType RemoteEventType) (intent MatrixAPI, extraUserID id.UserID) {

0 commit comments

Comments
 (0)