mirror of
https://mau.dev/mautrix/go.git
synced 2026-03-14 14:25:53 +01:00
bridgev2/matrixinterface: add GetEvent interface for linkedin reply (#406)
Co-authored-by: Tulir Asokan <tulir@maunium.net>
This commit is contained in:
parent
19f3b2179c
commit
c18d2e2565
2 changed files with 22 additions and 0 deletions
|
|
@ -674,3 +674,23 @@ func (as *ASIntent) MuteRoom(ctx context.Context, roomID id.RoomID, until time.T
|
|||
})
|
||||
}
|
||||
}
|
||||
|
||||
func (as *ASIntent) GetEvent(ctx context.Context, roomID id.RoomID, eventID id.EventID) (*event.Event, error) {
|
||||
evt, err := as.Matrix.Client.GetEvent(ctx, roomID, eventID)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
err = evt.Content.ParseRaw(evt.Type)
|
||||
if err != nil {
|
||||
zerolog.Ctx(ctx).Err(err).Stringer("room_id", roomID).Stringer("event_id", eventID).Msg("failed to parse event content")
|
||||
}
|
||||
|
||||
if evt.Type == event.EventEncrypted {
|
||||
if as.Connector.Config.Encryption.DeleteKeys.RatchetOnDecrypt {
|
||||
return nil, errors.New("can't decrypt the event")
|
||||
}
|
||||
return as.Matrix.Crypto.Decrypt(ctx, evt)
|
||||
}
|
||||
|
||||
return evt, nil
|
||||
}
|
||||
|
|
|
|||
|
|
@ -176,6 +176,8 @@ type MatrixAPI interface {
|
|||
|
||||
TagRoom(ctx context.Context, roomID id.RoomID, tag event.RoomTag, isTagged bool) error
|
||||
MuteRoom(ctx context.Context, roomID id.RoomID, until time.Time) error
|
||||
|
||||
GetEvent(ctx context.Context, roomID id.RoomID, eventID id.EventID) (*event.Event, error)
|
||||
}
|
||||
|
||||
type StreamOrderReadingMatrixAPI interface {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue