mirror of
https://mau.dev/mautrix/go.git
synced 2026-03-14 14:25:53 +01:00
bridgev2: pass back event ID and stream order in send results
This commit is contained in:
parent
aa53cbc528
commit
1779c72316
2 changed files with 17 additions and 2 deletions
|
|
@ -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](
|
||||
|
|
|
|||
|
|
@ -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 {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue