Add sender_key to ClientEvent (#3110)

This commit is contained in:
Till 2023-06-13 12:50:22 +02:00 committed by GitHub
parent 77d9e4e93d
commit 82b73a4906
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -37,6 +37,7 @@ type ClientEvent struct {
OriginServerTS spec.Timestamp `json:"origin_server_ts,omitempty"` // OriginServerTS is omitted on receipt events
RoomID string `json:"room_id,omitempty"` // RoomID is omitted on /sync responses
Sender string `json:"sender,omitempty"` // Sender is omitted on receipt events
SenderKey spec.SenderID `json:"sender_key,omitempty"` // The SenderKey for events in pseudo ID rooms
StateKey *string `json:"state_key,omitempty"`
Type string `json:"type"`
Unsigned spec.RawJSON `json:"unsigned,omitempty"`
@ -84,6 +85,9 @@ func ToClientEvent(se gomatrixserverlib.PDU, format ClientEventFormat, sender sp
if format == FormatAll {
ce.RoomID = se.RoomID()
}
if se.Version() == gomatrixserverlib.RoomVersionPseudoIDs {
ce.SenderKey = se.SenderID()
}
return ce
}