diff options
-rw-r--r-- | matrix/matrix.go | 9 | ||||
-rw-r--r-- | matrix/sync.go | 5 |
2 files changed, 13 insertions, 1 deletions
diff --git a/matrix/matrix.go b/matrix/matrix.go index 7ba6ebb..b72db7d 100644 --- a/matrix/matrix.go +++ b/matrix/matrix.go @@ -17,6 +17,7 @@ package matrix import ( + "encoding/json" "fmt" "strings" "time" @@ -178,6 +179,7 @@ func (c *Container) OnLogin() { syncer.OnEventType("m.room.member", c.HandleMembership) syncer.OnEventType("m.typing", c.HandleTyping) syncer.OnEventType("m.push_rules", c.HandlePushRules) + syncer.OnEventType("m.tag", c.HandleTag) c.client.Syncer = syncer c.UpdateRoomList() @@ -254,6 +256,13 @@ func (c *Container) HandlePushRules(evt *gomatrix.Event) { } } +// HandleTag is the event handler for the m.tag account data event. +func (c *Container) HandleTag(evt *gomatrix.Event) { + debug.Print("Received updated tags") + dat, _ := json.MarshalIndent(&evt.Content, "", " ") + debug.Print(string(dat)) +} + func (c *Container) processOwnMembershipChange(evt *gomatrix.Event) { membership, _ := evt.Content["membership"].(string) prevMembership := "leave" diff --git a/matrix/sync.go b/matrix/sync.go index 3e1a0c7..0169e8e 100644 --- a/matrix/sync.go +++ b/matrix/sync.go @@ -66,6 +66,7 @@ func (s *GomuksSyncer) ProcessResponse(res *gomatrix.RespSync, since string) (er s.processSyncEvents(room, roomData.State.Events, true, false) s.processSyncEvents(room, roomData.Timeline.Events, false, false) s.processSyncEvents(room, roomData.Ephemeral.Events, false, false) + s.processSyncEvents(room, roomData.AccountData.Events, false, false) if len(room.PrevBatch) == 0 { room.PrevBatch = roomData.Timeline.PrevBatch @@ -147,7 +148,9 @@ func (s *GomuksSyncer) GetFilterJSON(userID string) json.RawMessage { "ephemeral": { "types": ["m.typing"] }, - "account_data": {"types": []} + "account_data": { + "types": ["m.tag"] + } }, "account_data": { "types": ["m.push_rules"] |