Implement room state field

This commit is contained in:
nxshock 2019-08-02 21:46:46 +05:00
parent b7d0ca2b9f
commit e293cd0255
3 changed files with 11 additions and 2 deletions

View File

@ -26,6 +26,7 @@ type Room interface {
Topic() string
Events() []rooms.Event
Visibility() createroom.VisibilityType
State() createroom.Preset
}
type User interface {

View File

@ -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
}

View File

@ -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