aboutsummaryrefslogtreecommitdiff
path: root/federationapi/routing
diff options
context:
space:
mode:
Diffstat (limited to 'federationapi/routing')
-rw-r--r--federationapi/routing/backfill.go4
-rw-r--r--federationapi/routing/events.go2
-rw-r--r--federationapi/routing/invite.go6
-rw-r--r--federationapi/routing/join.go6
-rw-r--r--federationapi/routing/leave.go4
-rw-r--r--federationapi/routing/missingevents.go4
-rw-r--r--federationapi/routing/send.go46
-rw-r--r--federationapi/routing/send_test.go22
-rw-r--r--federationapi/routing/state.go2
-rw-r--r--federationapi/routing/threepid.go12
10 files changed, 54 insertions, 54 deletions
diff --git a/federationapi/routing/backfill.go b/federationapi/routing/backfill.go
index ea77c947..717289a2 100644
--- a/federationapi/routing/backfill.go
+++ b/federationapi/routing/backfill.go
@@ -93,9 +93,9 @@ func Backfill(
}
// Filter any event that's not from the requested room out.
- evs := make([]gomatrixserverlib.Event, 0)
+ evs := make([]*gomatrixserverlib.Event, 0)
- var ev gomatrixserverlib.HeaderedEvent
+ var ev *gomatrixserverlib.HeaderedEvent
for _, ev = range res.Events {
if ev.RoomID() == roomID {
evs = append(evs, ev.Event)
diff --git a/federationapi/routing/events.go b/federationapi/routing/events.go
index 6fa28f69..312ef9f8 100644
--- a/federationapi/routing/events.go
+++ b/federationapi/routing/events.go
@@ -98,5 +98,5 @@ func fetchEvent(ctx context.Context, rsAPI api.RoomserverInternalAPI, eventID st
return nil, &util.JSONResponse{Code: http.StatusNotFound, JSON: nil}
}
- return &eventsResponse.Events[0].Event, nil
+ return eventsResponse.Events[0].Event, nil
}
diff --git a/federationapi/routing/invite.go b/federationapi/routing/invite.go
index 16c0441b..54f9e684 100644
--- a/federationapi/routing/invite.go
+++ b/federationapi/routing/invite.go
@@ -97,7 +97,7 @@ func InviteV1(
func processInvite(
ctx context.Context,
isInviteV2 bool,
- event gomatrixserverlib.Event,
+ event *gomatrixserverlib.Event,
roomVer gomatrixserverlib.RoomVersion,
strippedState []gomatrixserverlib.InviteV2StrippedState,
roomID string,
@@ -171,12 +171,12 @@ func processInvite(
if isInviteV2 {
return util.JSONResponse{
Code: http.StatusOK,
- JSON: gomatrixserverlib.RespInviteV2{Event: signedEvent},
+ JSON: gomatrixserverlib.RespInviteV2{Event: &signedEvent},
}
} else {
return util.JSONResponse{
Code: http.StatusOK,
- JSON: gomatrixserverlib.RespInvite{Event: signedEvent},
+ JSON: gomatrixserverlib.RespInvite{Event: &signedEvent},
}
}
default:
diff --git a/federationapi/routing/join.go b/federationapi/routing/join.go
index 12f20536..c8e7e627 100644
--- a/federationapi/routing/join.go
+++ b/federationapi/routing/join.go
@@ -138,7 +138,7 @@ func MakeJoin(
// Check that the join is allowed or not
stateEvents := make([]*gomatrixserverlib.Event, len(queryRes.StateEvents))
for i := range queryRes.StateEvents {
- stateEvents[i] = &queryRes.StateEvents[i].Event
+ stateEvents[i] = queryRes.StateEvents[i].Event
}
provider := gomatrixserverlib.NewAuthEvents(stateEvents)
@@ -291,7 +291,7 @@ func SendJoin(
if err = api.SendEvents(
httpReq.Context(), rsAPI,
api.KindNew,
- []gomatrixserverlib.HeaderedEvent{
+ []*gomatrixserverlib.HeaderedEvent{
event.Headered(stateAndAuthChainResponse.RoomVersion),
},
cfg.Matrix.ServerName,
@@ -319,7 +319,7 @@ func SendJoin(
}
}
-type eventsByDepth []gomatrixserverlib.HeaderedEvent
+type eventsByDepth []*gomatrixserverlib.HeaderedEvent
func (e eventsByDepth) Len() int {
return len(e)
diff --git a/federationapi/routing/leave.go b/federationapi/routing/leave.go
index fb81d931..498532de 100644
--- a/federationapi/routing/leave.go
+++ b/federationapi/routing/leave.go
@@ -98,7 +98,7 @@ func MakeLeave(
// Check that the leave is allowed or not
stateEvents := make([]*gomatrixserverlib.Event, len(queryRes.StateEvents))
for i := range queryRes.StateEvents {
- stateEvents[i] = &queryRes.StateEvents[i].Event
+ stateEvents[i] = queryRes.StateEvents[i].Event
}
provider := gomatrixserverlib.NewAuthEvents(stateEvents)
if err = gomatrixserverlib.Allowed(event.Event, &provider); err != nil {
@@ -257,7 +257,7 @@ func SendLeave(
if err = api.SendEvents(
httpReq.Context(), rsAPI,
api.KindNew,
- []gomatrixserverlib.HeaderedEvent{
+ []*gomatrixserverlib.HeaderedEvent{
event.Headered(verRes.RoomVersion),
},
cfg.Matrix.ServerName,
diff --git a/federationapi/routing/missingevents.go b/federationapi/routing/missingevents.go
index 5118b34e..f79a2d2d 100644
--- a/federationapi/routing/missingevents.go
+++ b/federationapi/routing/missingevents.go
@@ -73,8 +73,8 @@ func GetMissingEvents(
// filterEvents returns only those events with matching roomID
func filterEvents(
- events []gomatrixserverlib.HeaderedEvent, roomID string,
-) []gomatrixserverlib.HeaderedEvent {
+ events []*gomatrixserverlib.HeaderedEvent, roomID string,
+) []*gomatrixserverlib.HeaderedEvent {
ref := events[:0]
for _, ev := range events {
if ev.RoomID() == roomID {
diff --git a/federationapi/routing/send.go b/federationapi/routing/send.go
index 79fbcb3d..104d2e73 100644
--- a/federationapi/routing/send.go
+++ b/federationapi/routing/send.go
@@ -128,7 +128,7 @@ type txnFederationClient interface {
func (t *txnReq) processTransaction(ctx context.Context) (*gomatrixserverlib.RespSend, *util.JSONResponse) {
results := make(map[string]gomatrixserverlib.PDUResult)
- pdus := []gomatrixserverlib.HeaderedEvent{}
+ pdus := []*gomatrixserverlib.HeaderedEvent{}
for _, pdu := range t.PDUs {
var header struct {
RoomID string `json:"room_id"`
@@ -171,7 +171,7 @@ func (t *txnReq) processTransaction(ctx context.Context) (*gomatrixserverlib.Res
}
continue
}
- if err = gomatrixserverlib.VerifyAllEventSignatures(ctx, []gomatrixserverlib.Event{event}, t.keys); err != nil {
+ if err = gomatrixserverlib.VerifyAllEventSignatures(ctx, []*gomatrixserverlib.Event{event}, t.keys); err != nil {
util.GetLogger(ctx).WithError(err).Warnf("Transaction: Couldn't validate signature of event %q", event.EventID())
results[event.EventID()] = gomatrixserverlib.PDUResult{
Error: err.Error(),
@@ -413,7 +413,7 @@ func (t *txnReq) getServers(ctx context.Context, roomID string) []gomatrixserver
return servers
}
-func (t *txnReq) processEvent(ctx context.Context, e gomatrixserverlib.Event) error {
+func (t *txnReq) processEvent(ctx context.Context, e *gomatrixserverlib.Event) error {
logger := util.GetLogger(ctx).WithField("event_id", e.EventID()).WithField("room_id", e.RoomID())
// Work out if the roomserver knows everything it needs to know to auth
@@ -461,7 +461,7 @@ func (t *txnReq) processEvent(ctx context.Context, e gomatrixserverlib.Event) er
context.Background(),
t.rsAPI,
api.KindNew,
- []gomatrixserverlib.HeaderedEvent{
+ []*gomatrixserverlib.HeaderedEvent{
e.Headered(stateResp.RoomVersion),
},
api.DoNotSendToOtherServers,
@@ -470,7 +470,7 @@ func (t *txnReq) processEvent(ctx context.Context, e gomatrixserverlib.Event) er
}
func (t *txnReq) retrieveMissingAuthEvents(
- ctx context.Context, e gomatrixserverlib.Event, stateResp *api.QueryMissingAuthPrevEventsResponse,
+ ctx context.Context, e *gomatrixserverlib.Event, stateResp *api.QueryMissingAuthPrevEventsResponse,
) error {
logger := util.GetLogger(ctx).WithField("event_id", e.EventID()).WithField("room_id", e.RoomID())
@@ -523,10 +523,10 @@ withNextEvent:
return nil
}
-func checkAllowedByState(e gomatrixserverlib.Event, stateEvents []gomatrixserverlib.Event) error {
+func checkAllowedByState(e *gomatrixserverlib.Event, stateEvents []*gomatrixserverlib.Event) error {
authUsingState := gomatrixserverlib.NewAuthEvents(nil)
for i := range stateEvents {
- err := authUsingState.AddEvent(&stateEvents[i])
+ err := authUsingState.AddEvent(stateEvents[i])
if err != nil {
return err
}
@@ -535,7 +535,7 @@ func checkAllowedByState(e gomatrixserverlib.Event, stateEvents []gomatrixserver
}
// nolint:gocyclo
-func (t *txnReq) processEventWithMissingState(ctx context.Context, e gomatrixserverlib.Event, roomVersion gomatrixserverlib.RoomVersion) error {
+func (t *txnReq) processEventWithMissingState(ctx context.Context, e *gomatrixserverlib.Event, roomVersion gomatrixserverlib.RoomVersion) error {
// Do this with a fresh context, so that we keep working even if the
// original request times out. With any luck, by the time the remote
// side retries, we'll have fetched the missing state.
@@ -569,7 +569,7 @@ func (t *txnReq) processEventWithMissingState(ctx context.Context, e gomatrixser
return nil
}
- backwardsExtremity := &newEvents[0]
+ backwardsExtremity := newEvents[0]
newEvents = newEvents[1:]
type respState struct {
@@ -657,7 +657,7 @@ func (t *txnReq) processEventWithMissingState(ctx context.Context, e gomatrixser
// than the backward extremity, into the roomserver without state. This way
// they will automatically fast-forward based on the room state at the
// extremity in the last step.
- headeredNewEvents := make([]gomatrixserverlib.HeaderedEvent, len(newEvents))
+ headeredNewEvents := make([]*gomatrixserverlib.HeaderedEvent, len(newEvents))
for i, newEvent := range newEvents {
headeredNewEvents[i] = newEvent.Headered(roomVersion)
}
@@ -734,9 +734,9 @@ func (t *txnReq) lookupStateAfterEventLocally(ctx context.Context, roomID, event
return nil
}
for i, ev := range res.StateEvents {
- t.haveEvents[ev.EventID()] = &res.StateEvents[i]
+ t.haveEvents[ev.EventID()] = res.StateEvents[i]
}
- var authEvents []gomatrixserverlib.Event
+ var authEvents []*gomatrixserverlib.Event
missingAuthEvents := make(map[string]bool)
for _, ev := range res.StateEvents {
for _, ae := range ev.AuthEventIDs() {
@@ -764,7 +764,7 @@ func (t *txnReq) lookupStateAfterEventLocally(ctx context.Context, roomID, event
}
for i := range queryRes.Events {
evID := queryRes.Events[i].EventID()
- t.haveEvents[evID] = &queryRes.Events[i]
+ t.haveEvents[evID] = queryRes.Events[i]
authEvents = append(authEvents, queryRes.Events[i].Unwrap())
}
@@ -787,8 +787,8 @@ func (t *txnReq) lookupStateBeforeEvent(ctx context.Context, roomVersion gomatri
}
func (t *txnReq) resolveStatesAndCheck(ctx context.Context, roomVersion gomatrixserverlib.RoomVersion, states []*gomatrixserverlib.RespState, backwardsExtremity *gomatrixserverlib.Event) (*gomatrixserverlib.RespState, error) {
- var authEventList []gomatrixserverlib.Event
- var stateEventList []gomatrixserverlib.Event
+ var authEventList []*gomatrixserverlib.Event
+ var stateEventList []*gomatrixserverlib.Event
for _, state := range states {
authEventList = append(authEventList, state.AuthEvents...)
stateEventList = append(stateEventList, state.StateEvents...)
@@ -799,7 +799,7 @@ func (t *txnReq) resolveStatesAndCheck(ctx context.Context, roomVersion gomatrix
}
// apply the current event
retryAllowedState:
- if err = checkAllowedByState(*backwardsExtremity, resolvedStateEvents); err != nil {
+ if err = checkAllowedByState(backwardsExtremity, resolvedStateEvents); err != nil {
switch missing := err.(type) {
case gomatrixserverlib.MissingAuthEventError:
servers := t.getServers(ctx, backwardsExtremity.RoomID())
@@ -836,9 +836,9 @@ retryAllowedState:
// This function recursively calls txnReq.processEvent with the missing events, which will be processed before this function returns.
// This means that we may recursively call this function, as we spider back up prev_events.
// nolint:gocyclo
-func (t *txnReq) getMissingEvents(ctx context.Context, e gomatrixserverlib.Event, roomVersion gomatrixserverlib.RoomVersion) (newEvents []gomatrixserverlib.Event, err error) {
+func (t *txnReq) getMissingEvents(ctx context.Context, e *gomatrixserverlib.Event, roomVersion gomatrixserverlib.RoomVersion) (newEvents []*gomatrixserverlib.Event, err error) {
logger := util.GetLogger(ctx).WithField("event_id", e.EventID()).WithField("room_id", e.RoomID())
- needed := gomatrixserverlib.StateNeededForAuth([]gomatrixserverlib.Event{e})
+ needed := gomatrixserverlib.StateNeededForAuth([]*gomatrixserverlib.Event{e})
// query latest events (our trusted forward extremities)
req := api.QueryLatestEventsAndStateRequest{
RoomID: e.RoomID(),
@@ -979,7 +979,7 @@ func (t *txnReq) lookupMissingStateViaStateIDs(ctx context.Context, roomID, even
}
for i := range queryRes.Events {
evID := queryRes.Events[i].EventID()
- t.haveEvents[evID] = &queryRes.Events[i]
+ t.haveEvents[evID] = queryRes.Events[i]
if missing[evID] {
delete(missing, evID)
}
@@ -1116,10 +1116,10 @@ func (t *txnReq) lookupEvent(ctx context.Context, roomVersion gomatrixserverlib.
if err := t.rsAPI.QueryEventsByID(ctx, &queryReq, &queryRes); err != nil {
util.GetLogger(ctx).Warnf("Failed to query roomserver for missing event %s: %s - falling back to remote", missingEventID, err)
} else if len(queryRes.Events) == 1 {
- return &queryRes.Events[0], nil
+ return queryRes.Events[0], nil
}
}
- var event gomatrixserverlib.Event
+ var event *gomatrixserverlib.Event
found := false
for _, serverName := range servers {
txn, err := t.federation.GetEvent(ctx, serverName, missingEventID)
@@ -1139,11 +1139,11 @@ func (t *txnReq) lookupEvent(ctx context.Context, roomVersion gomatrixserverlib.
util.GetLogger(ctx).WithField("event_id", missingEventID).Warnf("Failed to get missing /event for event ID from %d server(s)", len(servers))
return nil, fmt.Errorf("wasn't able to find event via %d server(s)", len(servers))
}
- if err := gomatrixserverlib.VerifyAllEventSignatures(ctx, []gomatrixserverlib.Event{event}, t.keys); err != nil {
+ if err := gomatrixserverlib.VerifyAllEventSignatures(ctx, []*gomatrixserverlib.Event{event}, t.keys); err != nil {
util.GetLogger(ctx).WithError(err).Warnf("Transaction: Couldn't validate signature of event %q", event.EventID())
return nil, verifySigError{event.EventID(), err}
}
h := event.Headered(roomVersion)
t.newEvents[h.EventID()] = true
- return &h, nil
+ return h, nil
}
diff --git a/federationapi/routing/send_test.go b/federationapi/routing/send_test.go
index 9398fef7..9b9db873 100644
--- a/federationapi/routing/send_test.go
+++ b/federationapi/routing/send_test.go
@@ -33,8 +33,8 @@ var (
[]byte(`{"auth_events":[["$0ok8ynDp7kjc95e3:kaer.morhen",{"sha256":"sWCi6Ckp9rDimQON+MrUlNRkyfZ2tjbPbWfg2NMB18Q"}],["$LEwEu0kxrtu5fOiS:kaer.morhen",{"sha256":"1aKajq6DWHru1R1HJjvdWMEavkJJHGaTmPvfuERUXaA"}]],"content":{"body":"Test Message"},"depth":6,"event_id":"$MYSbs8m4rEbsCWXD:kaer.morhen","hashes":{"sha256":"kgbYM7v4Ud2YaBsjBTolM4ySg6rHcJNYI6nWhMSdFUA"},"origin":"kaer.morhen","origin_server_ts":0,"prev_events":[["$gl2T9l3qm0kUbiIJ:kaer.morhen",{"sha256":"C/rD04h9wGxRdN2G/IBfrgoE1UovzLZ+uskwaKZ37/Q"}]],"room_id":"!roomid:kaer.morhen","sender":"@userid:kaer.morhen","signatures":{"kaer.morhen":{"ed25519:auto":"x0UoKh968jj/F5l1/R7Ew0T6CTKuew3PLNHASNxqck/bkNe8yYQiDHXRr+kZxObeqPZZTpaF1+EI+bLU9W8GDQ"}},"type":"m.room.message"}`),
[]byte(`{"auth_events":[["$0ok8ynDp7kjc95e3:kaer.morhen",{"sha256":"sWCi6Ckp9rDimQON+MrUlNRkyfZ2tjbPbWfg2NMB18Q"}],["$LEwEu0kxrtu5fOiS:kaer.morhen",{"sha256":"1aKajq6DWHru1R1HJjvdWMEavkJJHGaTmPvfuERUXaA"}]],"content":{"body":"Test Message"},"depth":7,"event_id":"$N5x9WJkl9ClPrAEg:kaer.morhen","hashes":{"sha256":"FWM8oz4yquTunRZ67qlW2gzPDzdWfBP6RPHXhK1I/x8"},"origin":"kaer.morhen","origin_server_ts":0,"prev_events":[["$MYSbs8m4rEbsCWXD:kaer.morhen",{"sha256":"fatqgW+SE8mb2wFn3UN+drmluoD4UJ/EcSrL6Ur9q1M"}]],"room_id":"!roomid:kaer.morhen","sender":"@userid:kaer.morhen","signatures":{"kaer.morhen":{"ed25519:auto":"Y+LX/xcyufoXMOIoqQBNOzy6lZfUGB1ffgXIrSugk6obMiyAsiRejHQN/pciZXsHKxMJLYRFAz4zSJoS/LGPAA"}},"type":"m.room.message"}`),
}
- testEvents = []gomatrixserverlib.HeaderedEvent{}
- testStateEvents = make(map[gomatrixserverlib.StateKeyTuple]gomatrixserverlib.HeaderedEvent)
+ testEvents = []*gomatrixserverlib.HeaderedEvent{}
+ testStateEvents = make(map[gomatrixserverlib.StateKeyTuple]*gomatrixserverlib.HeaderedEvent)
)
func init() {
@@ -445,7 +445,7 @@ NextPDU:
}
}
-func fromStateTuples(tuples []gomatrixserverlib.StateKeyTuple, omitTuples []gomatrixserverlib.StateKeyTuple) (result []gomatrixserverlib.HeaderedEvent) {
+func fromStateTuples(tuples []gomatrixserverlib.StateKeyTuple, omitTuples []gomatrixserverlib.StateKeyTuple) (result []*gomatrixserverlib.HeaderedEvent) {
NextTuple:
for _, t := range tuples {
for _, o := range omitTuples {
@@ -461,7 +461,7 @@ NextTuple:
return
}
-func assertInputRoomEvents(t *testing.T, got []api.InputRoomEvent, want []gomatrixserverlib.HeaderedEvent) {
+func assertInputRoomEvents(t *testing.T, got []api.InputRoomEvent, want []*gomatrixserverlib.HeaderedEvent) {
for _, g := range got {
fmt.Println("GOT ", g.Event.EventID())
}
@@ -493,7 +493,7 @@ func TestBasicTransaction(t *testing.T) {
}
txn := mustCreateTransaction(rsAPI, &txnFedClient{}, pdus)
mustProcessTransaction(t, txn, nil)
- assertInputRoomEvents(t, rsAPI.inputRoomEvents, []gomatrixserverlib.HeaderedEvent{testEvents[len(testEvents)-1]})
+ assertInputRoomEvents(t, rsAPI.inputRoomEvents, []*gomatrixserverlib.HeaderedEvent{testEvents[len(testEvents)-1]})
}
// The purpose of this test is to check that if the event received fails auth checks the event is still sent to the roomserver
@@ -514,7 +514,7 @@ func TestTransactionFailAuthChecks(t *testing.T) {
txn := mustCreateTransaction(rsAPI, &txnFedClient{}, pdus)
mustProcessTransaction(t, txn, []string{})
// expect message to be sent to the roomserver
- assertInputRoomEvents(t, rsAPI.inputRoomEvents, []gomatrixserverlib.HeaderedEvent{testEvents[len(testEvents)-1]})
+ assertInputRoomEvents(t, rsAPI.inputRoomEvents, []*gomatrixserverlib.HeaderedEvent{testEvents[len(testEvents)-1]})
}
// The purpose of this test is to make sure that when an event is received for which we do not know the prev_events,
@@ -586,7 +586,7 @@ func TestTransactionFetchMissingPrevEvents(t *testing.T) {
t.Errorf("call to /get_missing_events wrong latest events: got %v want %v", missing.LatestEvents, inputEvent.EventID())
}
return gomatrixserverlib.RespMissingEvents{
- Events: []gomatrixserverlib.Event{
+ Events: []*gomatrixserverlib.Event{
prevEvent.Unwrap(),
},
}, nil
@@ -598,7 +598,7 @@ func TestTransactionFetchMissingPrevEvents(t *testing.T) {
}
txn := mustCreateTransaction(rsAPI, cli, pdus)
mustProcessTransaction(t, txn, nil)
- assertInputRoomEvents(t, rsAPI.inputRoomEvents, []gomatrixserverlib.HeaderedEvent{prevEvent, inputEvent})
+ assertInputRoomEvents(t, rsAPI.inputRoomEvents, []*gomatrixserverlib.HeaderedEvent{prevEvent, inputEvent})
}
// The purpose of this test is to check that when there are missing prev_events and we still haven't been able to fill
@@ -653,7 +653,7 @@ func TestTransactionFetchMissingStateByStateIDs(t *testing.T) {
} else if askingForEvent == eventB.EventID() {
prevEventExists = haveEventB
}
- var stateEvents []gomatrixserverlib.HeaderedEvent
+ var stateEvents []*gomatrixserverlib.HeaderedEvent
if prevEventExists {
stateEvents = fromStateTuples(req.StateToFetch, omitTuples)
}
@@ -771,7 +771,7 @@ func TestTransactionFetchMissingStateByStateIDs(t *testing.T) {
}
// just return event C, not event B so /state_ids logic kicks in as there will STILL be missing prev_events
return gomatrixserverlib.RespMissingEvents{
- Events: []gomatrixserverlib.Event{
+ Events: []*gomatrixserverlib.Event{
eventC.Unwrap(),
},
}, nil
@@ -783,5 +783,5 @@ func TestTransactionFetchMissingStateByStateIDs(t *testing.T) {
}
txn := mustCreateTransaction(rsAPI, cli, pdus)
mustProcessTransaction(t, txn, nil)
- assertInputRoomEvents(t, rsAPI.inputRoomEvents, []gomatrixserverlib.HeaderedEvent{eventB, eventC, eventD})
+ assertInputRoomEvents(t, rsAPI.inputRoomEvents, []*gomatrixserverlib.HeaderedEvent{eventB, eventC, eventD})
}
diff --git a/federationapi/routing/state.go b/federationapi/routing/state.go
index 28dfad84..128df618 100644
--- a/federationapi/routing/state.go
+++ b/federationapi/routing/state.go
@@ -136,7 +136,7 @@ func getState(
}, nil
}
-func getIDsFromEvent(events []gomatrixserverlib.Event) []string {
+func getIDsFromEvent(events []*gomatrixserverlib.Event) []string {
IDs := make([]string, len(events))
for i := range events {
IDs[i] = events[i].EventID()
diff --git a/federationapi/routing/threepid.go b/federationapi/routing/threepid.go
index 4db5273a..ed6af526 100644
--- a/federationapi/routing/threepid.go
+++ b/federationapi/routing/threepid.go
@@ -65,7 +65,7 @@ func CreateInvitesFrom3PIDInvites(
return *reqErr
}
- evs := []gomatrixserverlib.HeaderedEvent{}
+ evs := []*gomatrixserverlib.HeaderedEvent{}
for _, inv := range body.Invites {
verReq := api.QueryRoomVersionForRoomRequest{RoomID: inv.RoomID}
verRes := api.QueryRoomVersionForRoomResponse{}
@@ -84,7 +84,7 @@ func CreateInvitesFrom3PIDInvites(
return jsonerror.InternalServerError()
}
if event != nil {
- evs = append(evs, (*event).Headered(verRes.RoomVersion))
+ evs = append(evs, event.Headered(verRes.RoomVersion))
}
}
@@ -165,7 +165,7 @@ func ExchangeThirdPartyInvite(
// Ask the requesting server to sign the newly created event so we know it
// acknowledged it
- signedEvent, err := federation.SendInvite(httpReq.Context(), request.Origin(), *event)
+ signedEvent, err := federation.SendInvite(httpReq.Context(), request.Origin(), event)
if err != nil {
util.GetLogger(httpReq.Context()).WithError(err).Error("federation.SendInvite failed")
return jsonerror.InternalServerError()
@@ -175,7 +175,7 @@ func ExchangeThirdPartyInvite(
if err = api.SendEvents(
httpReq.Context(), rsAPI,
api.KindNew,
- []gomatrixserverlib.HeaderedEvent{
+ []*gomatrixserverlib.HeaderedEvent{
signedEvent.Event.Headered(verRes.RoomVersion),
},
cfg.Matrix.ServerName,
@@ -297,7 +297,7 @@ func buildMembershipEvent(
authEvents := gomatrixserverlib.NewAuthEvents(nil)
for i := range queryRes.StateEvents {
- err = authEvents.AddEvent(&queryRes.StateEvents[i].Event)
+ err = authEvents.AddEvent(queryRes.StateEvents[i].Event)
if err != nil {
return nil, err
}
@@ -318,7 +318,7 @@ func buildMembershipEvent(
cfg.Matrix.PrivateKey, queryRes.RoomVersion,
)
- return &event, err
+ return event, err
}
// sendToRemoteServer uses federation to send an invite provided by an identity