mirror of
https://github.com/matrix-org/dendrite.git
synced 2025-12-20 21:33:19 -06:00
Comments
This commit is contained in:
parent
fa74ded4d6
commit
44b25a7f9e
|
|
@ -119,6 +119,11 @@ func (t *EDUServerInputAPI) sendToDeviceEvent(ise *api.InputSendToDeviceEvent) e
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// If the event is targeted locally then we want to expand the wildcard
|
||||||
|
// out into individual device IDs so that we can send them to each respective
|
||||||
|
// device. If the event isn't targeted locally then we can't expand the
|
||||||
|
// wildcard as we don't know about the remote devices, so instead we leave it
|
||||||
|
// as-is, so that the federation sender can send it on with the wildcard intact.
|
||||||
if domain == t.ServerName && ise.DeviceID == "*" {
|
if domain == t.ServerName && ise.DeviceID == "*" {
|
||||||
devs, err := t.DeviceDB.GetDevicesByLocalpart(context.TODO(), localpart)
|
devs, err := t.DeviceDB.GetDevicesByLocalpart(context.TODO(), localpart)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
|
||||||
|
|
@ -109,6 +109,23 @@ type BackwardsExtremities interface {
|
||||||
DeleteBackwardExtremity(ctx context.Context, txn *sql.Tx, roomID, knownEventID string) (err error)
|
DeleteBackwardExtremity(ctx context.Context, txn *sql.Tx, roomID, knownEventID string) (err error)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// SendToDevice tracks send-to-device messages which are sent to individual
|
||||||
|
// clients. Each message gets inserted into this table at the point that we
|
||||||
|
// receive it from the EDU server.
|
||||||
|
//
|
||||||
|
// We're supposed to try and do our best to deliver send-to-device messages
|
||||||
|
// once, but the only way that we can really guarantee that they have been
|
||||||
|
// delivered is if the client successfully requests the next sync as given
|
||||||
|
// in the next_batch. Each time the device syncs, we will request all of the
|
||||||
|
// updates that either haven't been sent yet, along with all updates that we
|
||||||
|
// *have* sent but we haven't confirmed to have been received yet. If it's the
|
||||||
|
// first time we're sending a given update then we update the table to say
|
||||||
|
// what the "since" parameter was when we tried to send it.
|
||||||
|
//
|
||||||
|
// When the client syncs again, if their "since" parameter is *later* than
|
||||||
|
// the recorded one, we drop the entry from the DB as it's "sent". If the
|
||||||
|
// sync parameter isn't later then we will keep including the updates in the
|
||||||
|
// sync response, as the client is seemingly trying to repeat the same /sync.
|
||||||
type SendToDevice interface {
|
type SendToDevice interface {
|
||||||
InsertSendToDeviceMessage(ctx context.Context, txn *sql.Tx, userID, deviceID, content string) (err error)
|
InsertSendToDeviceMessage(ctx context.Context, txn *sql.Tx, userID, deviceID, content string) (err error)
|
||||||
SelectSendToDeviceMessages(ctx context.Context, txn *sql.Tx, userID, deviceID string) (events []types.SendToDeviceEvent, err error)
|
SelectSendToDeviceMessages(ctx context.Context, txn *sql.Tx, userID, deviceID string) (events []types.SendToDeviceEvent, err error)
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue