aboutsummaryrefslogtreecommitdiff
path: root/matrix
diff options
context:
space:
mode:
authorTulir Asokan <tulir@maunium.net>2020-04-16 20:16:44 +0300
committerTulir Asokan <tulir@maunium.net>2020-04-19 15:01:16 +0300
commitac1b0540a2f5979346277271ec733d19a0b25228 (patch)
tree6e4bb009668413c38400edcee4fd0876d8bf4db6 /matrix
parentbb5f9156c9949a13685eda328b5fe6ce94229f30 (diff)
Update Encrypted boolean when receiving m.room.encryption event
Diffstat (limited to 'matrix')
-rw-r--r--matrix/rooms/room.go8
1 files changed, 6 insertions, 2 deletions
diff --git a/matrix/rooms/room.go b/matrix/rooms/room.go
index 0c28a9d..50ec28f 100644
--- a/matrix/rooms/room.go
+++ b/matrix/rooms/room.go
@@ -414,6 +414,10 @@ func (room *Room) UpdateState(evt *event.Event) {
room.updateMemberState(evt)
case event.StateTopic:
room.topicCache = evt.Content.Topic
+ case event.StateEncryption:
+ if evt.Content.Algorithm == "m.megolm.v1.aes-sha2" {
+ room.Encrypted = true
+ }
}
if evt.Type != event.StateMember {
@@ -458,8 +462,8 @@ func (room *Room) GetStateEvent(eventType event.Type, stateKey string) *event.Ev
room.lock.RLock()
defer room.lock.RUnlock()
stateEventMap, _ := room.state[eventType]
- event, _ := stateEventMap[stateKey]
- return event
+ evt, _ := stateEventMap[stateKey]
+ return evt
}
// getStateEvents returns the state events for the given type.