diff options
author | Tulir Asokan <tulir@maunium.net> | 2018-05-10 20:56:46 +0300 |
---|---|---|
committer | Tulir Asokan <tulir@maunium.net> | 2018-05-10 21:22:01 +0300 |
commit | 66b17967eba2a92952f76db3eed28324136eaa30 (patch) | |
tree | 2660dbba1fdf7af1a79a45768c095ab0f4c14b79 /matrix | |
parent | 706f4c44048e59bf914877f6f8bf17ad9915a65c (diff) |
Update dependencies
Diffstat (limited to 'matrix')
-rw-r--r-- | matrix/sync.go | 42 | ||||
-rw-r--r-- | matrix/sync_test.go | 1 |
2 files changed, 24 insertions, 19 deletions
diff --git a/matrix/sync.go b/matrix/sync.go index 9488705..6ec31d4 100644 --- a/matrix/sync.go +++ b/matrix/sync.go @@ -148,32 +148,36 @@ func (s *GomuksSyncer) OnFailedSync(res *gomatrix.RespSync, err error) (time.Dur // GetFilterJSON returns a filter with a timeline limit of 50. func (s *GomuksSyncer) GetFilterJSON(userID string) json.RawMessage { - return json.RawMessage(`{ - "room": { - "include_leave": false, - "state": { - "types": [ + filter := &gomatrix.Filter{ + Room: gomatrix.RoomFilter{ + IncludeLeave: false, + State: gomatrix.FilterPart{ + Types: []string{ "m.room.member", "m.room.name", "m.room.topic", "m.room.canonical_alias", - "m.room.aliases" - ] + "m.room.aliases", + }, }, - "timeline": { - "types": ["m.room.message"], - "limit": 50 + Timeline: gomatrix.FilterPart{ + Types: []string{"m.room.message"}, + Limit: 50, }, - "ephemeral": { - "types": ["m.typing"] + Ephemeral: gomatrix.FilterPart{ + Types: []string{"m.typing"}, }, - "account_data": { - "types": ["m.tag"] - } + AccountData: gomatrix.FilterPart{ + Types: []string{"m.tag"}, + }, + }, + AccountData: gomatrix.FilterPart{ + Types: []string{"m.push_rules"}, }, - "account_data": { - "types": ["m.push_rules"] + Presence: gomatrix.FilterPart{ + Types: []string{}, }, - "presence": {"types": []} - }`) + } + rawFilter, _ := json.Marshal(&filter) + return rawFilter } diff --git a/matrix/sync_test.go b/matrix/sync_test.go index 56f62f9..49bbcb0 100644 --- a/matrix/sync_test.go +++ b/matrix/sync_test.go @@ -56,6 +56,7 @@ func TestGomuksSyncer_ProcessResponse(t *testing.T) { syncer := matrix.NewGomuksSyncer(mss) syncer.OnEventType("m.room.member", ml.receive) syncer.OnEventType("m.room.message", ml.receive) + syncer.GetFilterJSON("@tulir:maunium.net") joinEvt := &gomatrix.Event{ ID: "!join:maunium.net", |