aboutsummaryrefslogtreecommitdiff
path: root/clientapi/producers
diff options
context:
space:
mode:
authorNeil Alexander <neilalexander@users.noreply.github.com>2020-03-17 11:01:25 +0000
committerGitHub <noreply@github.com>2020-03-17 11:01:25 +0000
commitaebf347a79102597a359dcd59bb45593c8352780 (patch)
treed331c90109878611c0954276dc7a521415c43b9c /clientapi/producers
parent9f74a8798e26d9482f1964ff79a28acfe61d6dd1 (diff)
Implement gomatrixserverlib.HeaderedEvent in roomserver Kafka output (#914)
* Use Event.Headered * Use HeaderedEvent in roomserver kafka output * Fix syncserver-integration-tests * Update producers to roomserver inputs * Update gomatrixserverlib * Update gomatrixserverlib * Update gomatrixserverlib * Update gomatrixserverlib * Update gomatrixserverlib * Update gomatrixserverlib
Diffstat (limited to 'clientapi/producers')
-rw-r--r--clientapi/producers/roomserver.go18
1 files changed, 14 insertions, 4 deletions
diff --git a/clientapi/producers/roomserver.go b/clientapi/producers/roomserver.go
index e50561a7..0fe2d556 100644
--- a/clientapi/producers/roomserver.go
+++ b/clientapi/producers/roomserver.go
@@ -40,9 +40,11 @@ func (c *RoomserverProducer) SendEvents(
) (string, error) {
ires := make([]api.InputRoomEvent, len(events))
for i, event := range events {
+ roomVersion := gomatrixserverlib.RoomVersionV1
+
ires[i] = api.InputRoomEvent{
Kind: api.KindNew,
- Event: event,
+ Event: event.Headered(roomVersion),
AuthEventIDs: event.AuthEventIDs(),
SendAsServer: string(sendAsServer),
TransactionID: txnID,
@@ -61,11 +63,14 @@ func (c *RoomserverProducer) SendEventWithState(
return err
}
+ // TODO: Room version here
+ roomVersion := gomatrixserverlib.RoomVersionV1
+
ires := make([]api.InputRoomEvent, len(outliers)+1)
for i, outlier := range outliers {
ires[i] = api.InputRoomEvent{
Kind: api.KindOutlier,
- Event: outlier,
+ Event: outlier.Headered(roomVersion),
AuthEventIDs: outlier.AuthEventIDs(),
}
}
@@ -77,7 +82,7 @@ func (c *RoomserverProducer) SendEventWithState(
ires[len(outliers)] = api.InputRoomEvent{
Kind: api.KindNew,
- Event: event,
+ Event: event.Headered(roomVersion),
AuthEventIDs: event.AuthEventIDs(),
HasState: true,
StateEventIDs: stateEventIDs,
@@ -104,8 +109,13 @@ func (c *RoomserverProducer) SendInputRoomEvents(
func (c *RoomserverProducer) SendInvite(
ctx context.Context, inviteEvent gomatrixserverlib.Event,
) error {
+ // TODO: Room version here
+ roomVersion := gomatrixserverlib.RoomVersionV1
+
request := api.InputRoomEventsRequest{
- InputInviteEvents: []api.InputInviteEvent{{Event: inviteEvent}},
+ InputInviteEvents: []api.InputInviteEvent{{
+ Event: inviteEvent.Headered(roomVersion),
+ }},
}
var response api.InputRoomEventsResponse
return c.InputAPI.InputRoomEvents(ctx, &request, &response)