Documentation ¶
Overview ¶
Package rooms contains a representation for Matrix rooms and utilities to parse state events.
Index ¶
- type Member
- type Room
- func (room *Room) AddUnread(eventID id.EventID, counted, highlight bool)
- func (room *Room) GetCanonicalAlias() id.RoomAlias
- func (room *Room) GetMember(userID id.UserID) *Member
- func (room *Room) GetMemberCount() int
- func (room *Room) GetMemberList() []id.UserID
- func (room *Room) GetMembers() map[id.UserID]*Member
- func (room *Room) GetOwnDisplayname() string
- func (room *Room) GetStateEvent(eventType event.Type, stateKey string) *event.Event
- func (room *Room) GetTitle() string
- func (room *Room) GetTopic() string
- func (room *Room) HasNewMessages() bool
- func (room *Room) Highlighted() bool
- func (room *Room) IsReplaced() bool
- func (room *Room) Load()
- func (room *Room) Loaded() bool
- func (room *Room) MarkRead(eventID id.EventID) bool
- func (room *Room) ReplacedBy() id.RoomID
- func (room *Room) Save()
- func (room *Room) SetPostLoad(fn func())
- func (room *Room) SetPostUnload(fn func())
- func (room *Room) SetPreLoad(fn func() bool)
- func (room *Room) SetPreUnload(fn func() bool)
- func (room *Room) Tags() []RoomTag
- func (room *Room) Touch()
- func (room *Room) Unload() bool
- func (room *Room) UnreadCount() int
- func (room *Room) UpdateState(evt *event.Event)
- func (room *Room) UpdateSummary(summary mautrix.LazyLoadSummary)
- type RoomCache
- func (cache *RoomCache) DisableUnloading()
- func (cache *RoomCache) EnableUnloading()
- func (cache *RoomCache) FindSharedRooms(userID id.UserID) (shared []id.RoomID)
- func (cache *RoomCache) ForceClean()
- func (cache *RoomCache) Get(roomID id.RoomID) *Room
- func (cache *RoomCache) GetOrCreate(roomID id.RoomID) *Room
- func (cache *RoomCache) IsEncrypted(roomID id.RoomID) bool
- func (cache *RoomCache) Load(roomID id.RoomID) *Room
- func (cache *RoomCache) LoadList() error
- func (cache *RoomCache) Put(room *Room)
- func (cache *RoomCache) SaveList() error
- func (cache *RoomCache) SaveLoadedRooms()
- func (cache *RoomCache) Touch(roomID id.RoomID)
- func (cache *RoomCache) TouchNode(node *Room)
- func (cache *RoomCache) Unload(node *Room)
- type RoomNameSource
- type RoomTag
- type UnreadMessage
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Member ¶
type Member struct { event.MemberEventContent // The user who sent the membership event Sender id.UserID `json:"-"` }
type Room ¶
type Room struct { // The room ID. ID id.RoomID // Whether or not the user has left the room. HasLeft bool // Whether or not the room is encrypted. Encrypted bool // The first batch of events that has been fetched for this room. // Used for fetching additional history. PrevBatch string // The last_batch field from the most recent sync. Used for fetching member lists. LastPrevBatch string // The MXID of the user whose session this room was created for. SessionUserID id.UserID SessionMember *Member // The number of unread messages that were notified about. UnreadMessages []UnreadMessage // Whether or not this room is marked as a direct chat. IsDirect bool // List of tags given to this room. RawTags []RoomTag // Timestamp of previously received actual message. LastReceivedMessage time.Time // The lazy loading summary for this room. Summary mautrix.LazyLoadSummary // Whether or not the members for this room have been fetched from the server. MembersFetched bool // The name of the room. Calculated from the state event name, // canonical_alias or alias or the member cache. NameCache string // The canonical alias of the room. Directly fetched from the m.room.canonical_alias state event. CanonicalAliasCache id.RoomAlias // contains filtered or unexported fields }
Room represents a single Matrix room.
func (*Room) GetCanonicalAlias ¶
func (*Room) GetMember ¶
GetMember returns the member with the given MXID. If the member doesn't exist, nil is returned.
func (*Room) GetMemberCount ¶
func (*Room) GetMemberList ¶
func (*Room) GetMembers ¶
GetMembers returns the members in this room.
The members are returned from the cache. If the cache is empty, it is updated first.
func (*Room) GetOwnDisplayname ¶
GetSessionOwner returns the ID of the user whose session this room was created for.
func (*Room) GetStateEvent ¶
GetStateEvent returns the state event for the given type/state_key combo, or nil.
func (*Room) GetTitle ¶
GetTitle returns the display name of the room.
The display name is returned from the cache. If the cache is empty, it is updated first.
func (*Room) HasNewMessages ¶
func (*Room) Highlighted ¶
func (*Room) IsReplaced ¶
func (*Room) ReplacedBy ¶
func (*Room) SetPostLoad ¶
func (room *Room) SetPostLoad(fn func())
func (*Room) SetPostUnload ¶
func (room *Room) SetPostUnload(fn func())
func (*Room) SetPreLoad ¶
func (*Room) SetPreUnload ¶
func (*Room) UnreadCount ¶
func (*Room) UpdateState ¶
UpdateState updates the room's current state with the given Event. This will clobber events based on the type/state_key combination.
func (*Room) UpdateSummary ¶
func (room *Room) UpdateSummary(summary mautrix.LazyLoadSummary)
type RoomCache ¶
type RoomCache struct { sync.Mutex Map map[id.RoomID]*Room // contains filtered or unexported fields }
RoomCache contains room state info in a hashmap and linked list.
func NewRoomCache ¶
func (*RoomCache) DisableUnloading ¶
func (cache *RoomCache) DisableUnloading()
func (*RoomCache) EnableUnloading ¶
func (cache *RoomCache) EnableUnloading()
func (*RoomCache) FindSharedRooms ¶
func (*RoomCache) ForceClean ¶
func (cache *RoomCache) ForceClean()
func (*RoomCache) SaveLoadedRooms ¶
func (cache *RoomCache) SaveLoadedRooms()
type RoomNameSource ¶
type RoomNameSource int
const ( UnknownRoomName RoomNameSource = iota MemberRoomName CanonicalAliasRoomName ExplicitRoomName )