diff --git a/internal/backend.go b/internal/backend.go index a54651a..1f2ba49 100644 --- a/internal/backend.go +++ b/internal/backend.go @@ -26,6 +26,7 @@ type Room interface { Topic() string Events() []rooms.Event Visibility() createroom.VisibilityType + State() createroom.Preset } type User interface { diff --git a/internal/backends/memory/rooms.go b/internal/backends/memory/rooms.go index 8291e20..1b7f1e1 100644 --- a/internal/backends/memory/rooms.go +++ b/internal/backends/memory/rooms.go @@ -14,6 +14,7 @@ type Room struct { aliasName string name string topic string + state createroom.Preset creator internal.User joined []internal.User @@ -85,3 +86,10 @@ func (room *Room) Creator() internal.User { return room.creator } + +func (room *Room) State() createroom.Preset { + room.mutex.RLock() + defer room.mutex.RUnlock() + + return room.state +} diff --git a/internal/models/createroom/request.go b/internal/models/createroom/request.go index c9e45bd..3115cc6 100644 --- a/internal/models/createroom/request.go +++ b/internal/models/createroom/request.go @@ -16,8 +16,8 @@ type Preset string const ( PrivateChat Preset = "private_chat" - PublicChat = "public_chat" - TrustedPrivateChat = "trusted_private_chat" + PublicChat Preset = "public_chat" + TrustedPrivateChat Preset = "trusted_private_chat" ) // Invite3pid represents third party IDs to invite into the room