mirror of
https://github.com/hoernschen/dendrite.git
synced 2025-07-30 04:52:46 +00:00
Use PDU interface (#3070)
We only use it in a few places currently, enough to get things to compile and run. We should be using it in much more places. Similarly, in some places we cast []PDU back to []*Event, we need to not do that. Likewise, in some places we cast PDU to *Event, we need to not do that. For now though, hopefully this is a start.
This commit is contained in:
parent
c6457cd4e5
commit
6171310307
23 changed files with 96 additions and 77 deletions
|
@ -658,7 +658,7 @@ func (d *Database) IsEventRejected(ctx context.Context, roomNID types.RoomNID, e
|
|||
}
|
||||
|
||||
// GetOrCreateRoomInfo gets or creates a new RoomInfo, which is only safe to use with functions only needing a roomVersion or roomNID.
|
||||
func (d *Database) GetOrCreateRoomInfo(ctx context.Context, event *gomatrixserverlib.Event) (roomInfo *types.RoomInfo, err error) {
|
||||
func (d *Database) GetOrCreateRoomInfo(ctx context.Context, event gomatrixserverlib.PDU) (roomInfo *types.RoomInfo, err error) {
|
||||
// Get the default room version. If the client doesn't supply a room_version
|
||||
// then we will use our configured default to create the room.
|
||||
// https://matrix.org/docs/spec/client_server/r0.6.0#post-matrix-client-r0-createroom
|
||||
|
@ -725,7 +725,7 @@ func (d *Database) GetOrCreateEventStateKeyNID(ctx context.Context, eventStateKe
|
|||
}
|
||||
|
||||
func (d *EventDatabase) StoreEvent(
|
||||
ctx context.Context, event *gomatrixserverlib.Event,
|
||||
ctx context.Context, event gomatrixserverlib.PDU,
|
||||
roomInfo *types.RoomInfo, eventTypeNID types.EventTypeNID, eventStateKeyNID types.EventStateKeyNID,
|
||||
authEventNIDs []types.EventNID, isRejected bool,
|
||||
) (types.EventNID, types.StateAtEvent, error) {
|
||||
|
@ -909,7 +909,7 @@ func (d *EventDatabase) assignStateKeyNID(
|
|||
return eventStateKeyNID, err
|
||||
}
|
||||
|
||||
func extractRoomVersionFromCreateEvent(event *gomatrixserverlib.Event) (
|
||||
func extractRoomVersionFromCreateEvent(event gomatrixserverlib.PDU) (
|
||||
gomatrixserverlib.RoomVersion, error,
|
||||
) {
|
||||
var err error
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue