From 4ebf11e3ba7ee3e8d2761879053650c76718fcfd Mon Sep 17 00:00:00 2001 From: David Florness Date: Sun, 30 May 2021 16:02:51 -0400 Subject: [PATCH] echo: create filter limited to room when room ID is provided --- echo/cmd.go | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/echo/cmd.go b/echo/cmd.go index e74ab4e..a408aa8 100644 --- a/echo/cmd.go +++ b/echo/cmd.go @@ -55,5 +55,23 @@ func echo(roomID *id.RoomID) error { source) }) + if roomID != nil { + // same as + // https://github.com/tulir/mautrix-go/blob/v0.9.12/sync.go#L233 + // but filtered to room + res, err := client.CreateFilter(&mautrix.Filter{ + Room: mautrix.RoomFilter{ + Timeline: mautrix.FilterPart{ + Limit: 50, + Rooms: []id.RoomID{*roomID}, + }, + }, + }) + if err != nil { + return err + } + client.Store.SaveFilterID(client.UserID, res.FilterID) + } + return client.Sync() } -- 2.38.4