MCPcopy Create free account
hub / github.com/daodst/chat / StreamEventsToEvents

Method StreamEventsToEvents

syncapi/storage/shared/syncserver.go:296–314  ·  view source on GitHub ↗
(device *userapi.Device, in []types.StreamEvent)

Source from the content-addressed store, hash-verified

294}
295
296func (d *Database) StreamEventsToEvents(device *userapi.Device, in []types.StreamEvent) []*gomatrixserverlib.HeaderedEvent {
297 out := make([]*gomatrixserverlib.HeaderedEvent, len(in))
298 for i := 0; i < len(in); i++ {
299 out[i] = in[i].HeaderedEvent
300 if device != nil && in[i].TransactionID != nil {
301 if device.UserID == in[i].Sender() && device.SessionID == in[i].TransactionID.SessionID {
302 err := out[i].SetUnsignedField(
303 "transaction_id", in[i].TransactionID.TransactionID,
304 )
305 if err != nil {
306 logrus.WithFields(logrus.Fields{
307 "event_id": out[i].EventID(),
308 }).WithError(err).Warnf("Failed to add transaction ID to event")
309 }
310 }
311 }
312 }
313 return out
314}
315
316// handleBackwardExtremities adds this event as a backwards extremity if and only if we do not have all of
317// the events listed in the event's 'prev_events'. This function also updates the backwards extremities table

Callers 3

EventsMethod · 0.95
GetStateDeltasMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected