0
0
Fork 0
mirror of https://github.com/matrix-org/dendrite synced 2024-12-15 03:13:44 +01:00

Update gomatrixserverlib

This commit is contained in:
Mark Haines 2017-05-22 18:11:02 +01:00
parent d63a1ddc7c
commit e756b3b0eb
2 changed files with 15 additions and 1 deletions

2
vendor/manifest vendored
View file

@ -98,7 +98,7 @@
{ {
"importpath": "github.com/matrix-org/gomatrixserverlib", "importpath": "github.com/matrix-org/gomatrixserverlib",
"repository": "https://github.com/matrix-org/gomatrixserverlib", "repository": "https://github.com/matrix-org/gomatrixserverlib",
"revision": "8e7504f3b62366e621525c962314f53c045512e3", "revision": "785a53c41170526aa7a91a1fc534afac6ce01a9b",
"branch": "master" "branch": "master"
}, },
{ {

View file

@ -119,6 +119,10 @@ func (eb *EventBuilder) Build(eventID string, now time.Time, origin ServerName,
EventID string `json:"event_id"` EventID string `json:"event_id"`
OriginServerTS Timestamp `json:"origin_server_ts"` OriginServerTS Timestamp `json:"origin_server_ts"`
Origin ServerName `json:"origin"` Origin ServerName `json:"origin"`
// This key is either absent or an empty list.
// If it is absent then the pointer is nil and omitempty removes it.
// Otherwise it points to an empty list and omitempty keeps it.
PrevState *[]EventReference `json:"prev_state,omitempty"`
} }
event.EventBuilder = *eb event.EventBuilder = *eb
if event.PrevEvents == nil { if event.PrevEvents == nil {
@ -131,6 +135,16 @@ func (eb *EventBuilder) Build(eventID string, now time.Time, origin ServerName,
event.Origin = origin event.Origin = origin
event.EventID = eventID event.EventID = eventID
if event.StateKey != nil {
// In early versions of the matrix protocol state events
// had a "prev_state" key that listed the state events with
// the same type and state key that this event replaced.
// This was later dropped from the protocol.
// Synapse ignores the contents of the key but still expects
// the key to be present in state events.
event.PrevState = &emptyEventReferenceList
}
// TODO: Check size limits. // TODO: Check size limits.
var eventJSON []byte var eventJSON []byte