aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTulir Asokan <tulir@maunium.net>2019-04-07 23:21:48 +0300
committerTulir Asokan <tulir@maunium.net>2019-04-07 23:21:48 +0300
commitd0c0af811e89e0020aa95080c589724885a71a3e (patch)
treebacbdfc542ae57cab483eb3a0ea96c9650b05367
parente5db799fa30c5e3c7290d7ead07c84ada11087ac (diff)
Fix syncing preferences from account data
-rw-r--r--matrix/matrix.go10
1 files changed, 8 insertions, 2 deletions
diff --git a/matrix/matrix.go b/matrix/matrix.go
index f19fa24..b9816f2 100644
--- a/matrix/matrix.go
+++ b/matrix/matrix.go
@@ -262,9 +262,15 @@ func (c *Container) Start() {
}
func (c *Container) HandlePreferences(source EventSource, evt *mautrix.Event) {
+ if source&EventSourceAccountData == 0 {
+ return
+ }
orig := c.config.Preferences
- rt, _ := json.Marshal(&evt.Content)
- json.Unmarshal(rt, &c.config.Preferences)
+ err := json.Unmarshal(evt.Content.VeryRaw, &c.config.Preferences)
+ if err != nil {
+ debug.Print("Failed to parse updated preferences:", err)
+ return
+ }
debug.Print("Updated preferences:", orig, "->", c.config.Preferences)
c.ui.HandleNewPreferences()
}