Move GMSL client types to Dendrite (#3045)

GMSL is intended for Federation only. Sister PR to
https://github.com/matrix-org/gomatrixserverlib/pull/357
This commit is contained in:
kegsay 2023-04-04 18:16:53 +01:00 committed by GitHub
parent 985298cfc4
commit 3691423626
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
58 changed files with 692 additions and 234 deletions

View file

@ -25,6 +25,7 @@ import (
"github.com/matrix-org/dendrite/syncapi/notifier"
"github.com/matrix-org/dendrite/syncapi/storage"
"github.com/matrix-org/dendrite/syncapi/synctypes"
"github.com/matrix-org/dendrite/syncapi/types"
)
@ -65,7 +66,7 @@ func (p *PresenceStreamProvider) IncrementalSync(
from, to types.StreamPosition,
) types.StreamPosition {
// We pull out a larger number than the filter asks for, since we're filtering out events later
presences, err := snapshot.PresenceAfter(ctx, from, gomatrixserverlib.EventFilter{Limit: 1000})
presences, err := snapshot.PresenceAfter(ctx, from, synctypes.EventFilter{Limit: 1000})
if err != nil {
req.Log.WithError(err).Error("p.DB.PresenceAfter failed")
return from
@ -130,7 +131,7 @@ func (p *PresenceStreamProvider) IncrementalSync(
return from
}
req.Response.Presence.Events = append(req.Response.Presence.Events, gomatrixserverlib.ClientEvent{
req.Response.Presence.Events = append(req.Response.Presence.Events, synctypes.ClientEvent{
Content: content,
Sender: presence.UserID,
Type: gomatrixserverlib.MPresence,
@ -202,7 +203,7 @@ func joinedRooms(res *types.Response, userID string) []string {
return roomIDs
}
func membershipEventPresent(events []gomatrixserverlib.ClientEvent, userID string) bool {
func membershipEventPresent(events []synctypes.ClientEvent, userID string) bool {
for _, ev := range events {
// it's enough to know that we have our member event here, don't need to check membership content
// as it's implied by being in the respective section of the sync response.