a very very WIP first cut of peeking via MSC2753.

doesn't yet compile or work.
needs to actually add the peeking block into the sync response.
checking in now before it gets any bigger, and to gather any initial feedback on the vague shape of it.
This commit is contained in:
Matthew Hodgson 2020-08-30 17:46:15 +03:00
parent abd16ff4a0
commit b9342d9ee2
15 changed files with 616 additions and 13 deletions

View file

@ -507,3 +507,27 @@ type SendToDeviceEvent struct {
DeviceID string
SentByToken *StreamingToken
}
// For tracking peeking devices
type PeekingDevice struct {
ID string
UserID string
}
type PeekingDeviceSet map[PeekingDevice]bool
func (s PeekingDeviceSet) add(d PeekingDevice) {
s[d] = true
}
func (s PeekingDeviceSet) remove(d PeekingDevice) {
delete(s, d)
}
func (s PeekingDeviceSet) values() (vals []PeekingDevice) {
for d := range s {
vals = append(vals, d)
}
return
}