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",
"repository": "https://github.com/matrix-org/gomatrixserverlib",
"revision": "8e7504f3b62366e621525c962314f53c045512e3",
"revision": "785a53c41170526aa7a91a1fc534afac6ce01a9b",
"branch": "master"
},
{

View File

@ -119,6 +119,10 @@ func (eb *EventBuilder) Build(eventID string, now time.Time, origin ServerName,
EventID string `json:"event_id"`
OriginServerTS Timestamp `json:"origin_server_ts"`
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
if event.PrevEvents == nil {
@ -131,6 +135,16 @@ func (eb *EventBuilder) Build(eventID string, now time.Time, origin ServerName,
event.Origin = origin
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.
var eventJSON []byte