mirror of
https://github.com/hoernschen/dendrite.git
synced 2025-07-31 13:22:46 +00:00
Implement new RoomVersionImpl API (#3062)
As outlined in https://github.com/matrix-org/gomatrixserverlib/pull/368 The main change Dendrite side is that `RoomVersion` no longer has any methods on it. Instead, you need to bounce via `gmsl.GetRoomVersion`. It's very interesting to see where exactly Dendrite cares about this. For some places it's creating events (fine) but others are way more specific. Those areas will need to migrate to GMSL at some point.
This commit is contained in:
parent
71eeccf34a
commit
1647213fac
25 changed files with 144 additions and 65 deletions
|
@ -28,39 +28,32 @@ func DefaultRoomVersion() gomatrixserverlib.RoomVersion {
|
|||
|
||||
// RoomVersions returns a map of all known room versions to this
|
||||
// server.
|
||||
func RoomVersions() map[gomatrixserverlib.RoomVersion]gomatrixserverlib.RoomVersionDescription {
|
||||
func RoomVersions() map[gomatrixserverlib.RoomVersion]gomatrixserverlib.RoomVersionImpl {
|
||||
return gomatrixserverlib.RoomVersions()
|
||||
}
|
||||
|
||||
// SupportedRoomVersions returns a map of descriptions for room
|
||||
// versions that are supported by this homeserver.
|
||||
func SupportedRoomVersions() map[gomatrixserverlib.RoomVersion]gomatrixserverlib.RoomVersionDescription {
|
||||
return gomatrixserverlib.SupportedRoomVersions()
|
||||
func SupportedRoomVersions() map[gomatrixserverlib.RoomVersion]gomatrixserverlib.RoomVersionImpl {
|
||||
return gomatrixserverlib.RoomVersions()
|
||||
}
|
||||
|
||||
// RoomVersion returns information about a specific room version.
|
||||
// An UnknownVersionError is returned if the version is not known
|
||||
// to the server.
|
||||
func RoomVersion(version gomatrixserverlib.RoomVersion) (gomatrixserverlib.RoomVersionDescription, error) {
|
||||
func RoomVersion(version gomatrixserverlib.RoomVersion) (gomatrixserverlib.RoomVersionImpl, error) {
|
||||
if version, ok := gomatrixserverlib.RoomVersions()[version]; ok {
|
||||
return version, nil
|
||||
}
|
||||
return gomatrixserverlib.RoomVersionDescription{}, UnknownVersionError{version}
|
||||
return gomatrixserverlib.RoomVersionImpl{}, UnknownVersionError{version}
|
||||
}
|
||||
|
||||
// SupportedRoomVersion returns information about a specific room
|
||||
// version. An UnknownVersionError is returned if the version is not
|
||||
// known to the server, or an UnsupportedVersionError is returned if
|
||||
// the version is known but specifically marked as unsupported.
|
||||
func SupportedRoomVersion(version gomatrixserverlib.RoomVersion) (gomatrixserverlib.RoomVersionDescription, error) {
|
||||
result, err := RoomVersion(version)
|
||||
if err != nil {
|
||||
return gomatrixserverlib.RoomVersionDescription{}, err
|
||||
}
|
||||
if !result.Supported {
|
||||
return gomatrixserverlib.RoomVersionDescription{}, UnsupportedVersionError{version}
|
||||
}
|
||||
return result, nil
|
||||
func SupportedRoomVersion(version gomatrixserverlib.RoomVersion) (gomatrixserverlib.RoomVersionImpl, error) {
|
||||
return RoomVersion(version)
|
||||
}
|
||||
|
||||
// UnknownVersionError is caused when the room version is not known.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue