bridgev2: pass back event ID and stream order in send results

This commit is contained in:
Nick Mills-Barrett 2025-11-04 16:45:23 +01:00
commit 1779c72316
No known key found for this signature in database
GPG key ID: 31F23F2CF354937B
2 changed files with 17 additions and 2 deletions

View file

@ -1227,7 +1227,7 @@ func (portal *Portal) handleMatrixMessage(ctx context.Context, sender *UserLogin
// Not exactly queued, but not finished either
return EventHandlingResultQueued
}
return EventHandlingResultSuccess
return EventHandlingResultSuccess.WithEventID(message.MXID).WithStreamOrder(resp.StreamOrder)
}
// AddPendingToIgnore adds a transaction ID that should be ignored if encountered as a new message.
@ -1551,7 +1551,7 @@ func (portal *Portal) handleMatrixReaction(ctx context.Context, sender *UserLogi
log.Err(err).Msg("Failed to save reaction to database")
}
portal.sendSuccessStatus(ctx, evt, 0, deterministicID)
return EventHandlingResultSuccess
return EventHandlingResultSuccess.WithEventID(deterministicID)
}
func handleMatrixRoomMeta[APIType any, ContentType any](

View file

@ -163,6 +163,21 @@ type EventHandlingResult struct {
Error error
// Whether the Error should be sent as a MSS event.
SendMSS bool
// EventID from the network
EventID id.EventID
// Stream order from the network
StreamOrder int64
}
func (ehr EventHandlingResult) WithEventID(id id.EventID) EventHandlingResult {
ehr.EventID = id
return ehr
}
func (ehr EventHandlingResult) WithStreamOrder(order int64) EventHandlingResult {
ehr.StreamOrder = order
return ehr
}
func (ehr EventHandlingResult) WithError(err error) EventHandlingResult {