mirror of
https://github.com/hoernschen/dendrite.git
synced 2025-07-31 21:32:46 +00:00
Use PDU in even more places (#3074)
- No longer rely on *Event returning from NewEventFrom... functions Requires https://github.com/matrix-org/gomatrixserverlib/pull/377
This commit is contained in:
parent
9b98e5a102
commit
6284790f98
22 changed files with 28 additions and 44 deletions
|
@ -100,7 +100,7 @@ func IsServerCurrentlyInRoom(ctx context.Context, db storage.Database, serverNam
|
|||
func IsInvitePending(
|
||||
ctx context.Context, db storage.Database,
|
||||
roomID, userID string,
|
||||
) (bool, string, string, *gomatrixserverlib.Event, error) {
|
||||
) (bool, string, string, gomatrixserverlib.PDU, error) {
|
||||
// Look up the room NID for the supplied room ID.
|
||||
info, err := db.RoomInfo(ctx, roomID)
|
||||
if err != nil {
|
||||
|
|
|
@ -856,7 +856,7 @@ func (t *missingStateReq) lookupEvent(ctx context.Context, roomVersion gomatrixs
|
|||
return events[0].PDU, nil
|
||||
}
|
||||
}
|
||||
var event *gomatrixserverlib.Event
|
||||
var event gomatrixserverlib.PDU
|
||||
found := false
|
||||
for _, serverName := range t.servers {
|
||||
reqctx, cancel := context.WithTimeout(ctx, time.Second*30)
|
||||
|
|
|
@ -473,7 +473,7 @@ func (r *Upgrader) sendInitialEvents(ctx context.Context, evTime time.Time, user
|
|||
if i > 0 {
|
||||
builder.PrevEvents = []gomatrixserverlib.EventReference{builtEvents[i-1].EventReference()}
|
||||
}
|
||||
var event *gomatrixserverlib.Event
|
||||
var event gomatrixserverlib.PDU
|
||||
event, err = builder.AddAuthEventsAndBuild(userDomain, &authEvents, evTime, newVersion, r.Cfg.Matrix.KeyID, r.Cfg.Matrix.PrivateKey)
|
||||
if err != nil {
|
||||
return fmt.Errorf("failed to build new %q event: %w", builder.Type, err)
|
||||
|
|
|
@ -26,12 +26,12 @@ import (
|
|||
|
||||
// used to implement RoomserverInternalAPIEventDB to test getAuthChain
|
||||
type getEventDB struct {
|
||||
eventMap map[string]*gomatrixserverlib.Event
|
||||
eventMap map[string]gomatrixserverlib.PDU
|
||||
}
|
||||
|
||||
func createEventDB() *getEventDB {
|
||||
return &getEventDB{
|
||||
eventMap: make(map[string]*gomatrixserverlib.Event),
|
||||
eventMap: make(map[string]gomatrixserverlib.PDU),
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue