aboutsummaryrefslogtreecommitdiff
path: root/roomserver/internal/input/input_events.go
diff options
context:
space:
mode:
Diffstat (limited to 'roomserver/internal/input/input_events.go')
-rw-r--r--roomserver/internal/input/input_events.go18
1 files changed, 18 insertions, 0 deletions
diff --git a/roomserver/internal/input/input_events.go b/roomserver/internal/input/input_events.go
index 93f6cc01..88049ddf 100644
--- a/roomserver/internal/input/input_events.go
+++ b/roomserver/internal/input/input_events.go
@@ -448,6 +448,24 @@ func (r *Inputer) processRoomEvent(
return nil
}
+ // TODO: Revist this to ensure we don't replace a current state mxid_mapping with an older one.
+ if event.Version() == gomatrixserverlib.RoomVersionPseudoIDs && event.Type() == spec.MRoomMember {
+ mapping := gomatrixserverlib.MemberContent{}
+ if err = json.Unmarshal(event.Content(), &mapping); err != nil {
+ return err
+ }
+ if mapping.MXIDMapping != nil {
+ storeUserID, userErr := spec.NewUserID(mapping.MXIDMapping.UserID, true)
+ if userErr != nil {
+ return userErr
+ }
+ err = r.RSAPI.StoreUserRoomPublicKey(ctx, mapping.MXIDMapping.UserRoomKey, *storeUserID, *validRoomID)
+ if err != nil {
+ return fmt.Errorf("failed storing user room public key: %w", err)
+ }
+ }
+ }
+
switch input.Kind {
case api.KindNew:
if err = r.updateLatestEvents(