aboutsummaryrefslogtreecommitdiff
path: root/federationapi/consumers
diff options
context:
space:
mode:
authordevonh <devon.dmytro@gmail.com>2023-09-15 14:39:06 +0000
committerGitHub <noreply@github.com>2023-09-15 14:39:06 +0000
commit8245b24100b0afaa046bb3fe52f0994f906c8ab1 (patch)
treef8d65fd4c27e208e5829f5ca0f66d79c639fabdb /federationapi/consumers
parent058081e68e4e23400645c6206cedddba8a31507e (diff)
Update gmsl to use new validated RoomID on PDUs (#3200)
GMSL returns a `spec.RoomID` when calling `PDU.RoomID()`
Diffstat (limited to 'federationapi/consumers')
-rw-r--r--federationapi/consumers/roomserver.go16
1 files changed, 6 insertions, 10 deletions
diff --git a/federationapi/consumers/roomserver.go b/federationapi/consumers/roomserver.go
index 6c058032..f1dcb117 100644
--- a/federationapi/consumers/roomserver.go
+++ b/federationapi/consumers/roomserver.go
@@ -176,7 +176,7 @@ func (s *OutputRoomEventConsumer) processMessage(ore api.OutputNewRoomEvent, rew
// Finally, work out if there are any more events missing.
if len(missingEventIDs) > 0 {
eventsReq := &api.QueryEventsByIDRequest{
- RoomID: ore.Event.RoomID(),
+ RoomID: ore.Event.RoomID().String(),
EventIDs: missingEventIDs,
}
eventsRes := &api.QueryEventsByIDResponse{}
@@ -205,7 +205,7 @@ func (s *OutputRoomEventConsumer) processMessage(ore api.OutputNewRoomEvent, rew
// talking to the roomserver
oldJoinedHosts, err := s.db.UpdateRoom(
s.ctx,
- ore.Event.RoomID(),
+ ore.Event.RoomID().String(),
addsJoinedHosts,
ore.RemovesStateEventIDs,
rewritesState, // if we're re-writing state, nuke all joined hosts before adding
@@ -218,7 +218,7 @@ func (s *OutputRoomEventConsumer) processMessage(ore api.OutputNewRoomEvent, rew
if s.cfg.Matrix.Presence.EnableOutbound && len(addsJoinedHosts) > 0 && ore.Event.Type() == spec.MRoomMember && ore.Event.StateKey() != nil {
membership, _ := ore.Event.Membership()
if membership == spec.Join {
- s.sendPresence(ore.Event.RoomID(), addsJoinedHosts)
+ s.sendPresence(ore.Event.RoomID().String(), addsJoinedHosts)
}
}
@@ -376,7 +376,7 @@ func (s *OutputRoomEventConsumer) joinedHostsAtEvent(
}
// handle peeking hosts
- inboundPeeks, err := s.db.GetInboundPeeks(s.ctx, ore.Event.PDU.RoomID())
+ inboundPeeks, err := s.db.GetInboundPeeks(s.ctx, ore.Event.PDU.RoomID().String())
if err != nil {
return nil, err
}
@@ -409,12 +409,8 @@ func JoinedHostsFromEvents(ctx context.Context, evs []gomatrixserverlib.PDU, rsA
if membership != spec.Join {
continue
}
- validRoomID, err := spec.NewRoomID(ev.RoomID())
- if err != nil {
- return nil, err
- }
var domain spec.ServerName
- userID, err := rsAPI.QueryUserIDForSender(ctx, *validRoomID, spec.SenderID(*ev.StateKey()))
+ userID, err := rsAPI.QueryUserIDForSender(ctx, ev.RoomID(), spec.SenderID(*ev.StateKey()))
if err != nil {
if errors.As(err, new(base64.CorruptInputError)) {
// Fallback to using the "old" way of getting the user domain, avoids
@@ -510,7 +506,7 @@ func (s *OutputRoomEventConsumer) lookupStateEvents(
// At this point the missing events are neither the event itself nor are
// they present in our local database. Our only option is to fetch them
// from the roomserver using the query API.
- eventReq := api.QueryEventsByIDRequest{EventIDs: missing, RoomID: event.RoomID()}
+ eventReq := api.QueryEventsByIDRequest{EventIDs: missing, RoomID: event.RoomID().String()}
var eventResp api.QueryEventsByIDResponse
if err := s.rsAPI.QueryEventsByID(s.ctx, &eventReq, &eventResp); err != nil {
return nil, err