From b3bb4e653130ca51916fb12616a76f6594d01b3b Mon Sep 17 00:00:00 2001 From: Christian Pauly Date: Wed, 12 Jun 2019 13:22:16 +0200 Subject: [PATCH] Add removing of forgotten rooms --- lib/src/Room.dart | 1 + lib/src/Store.dart | 5 +++++ 2 files changed, 6 insertions(+) diff --git a/lib/src/Room.dart b/lib/src/Room.dart index 7f65e3a..1f1bf68 100644 --- a/lib/src/Room.dart +++ b/lib/src/Room.dart @@ -233,6 +233,7 @@ class Room { /// Call the Matrix API to forget this room if you already left it. Future forget() async { + client.store.forgetRoom(id); dynamic res = await client.connection .jsonRequest(type: "POST", action: "/client/r0/rooms/${id}/forget"); if (res is ErrorResponse) client.connection.onError.add(res); diff --git a/lib/src/Store.dart b/lib/src/Store.dart index 0e6055c..ed114f9 100644 --- a/lib/src/Store.dart +++ b/lib/src/Store.dart @@ -576,6 +576,11 @@ class Store { return directChats; } + Future forgetRoom(String roomID) async { + await db.rawDelete("DELETE FROM Rooms WHERE id=?", [roomID]); + return; + } + /// The database sheme for the Client class. static final String ClientsScheme = 'CREATE TABLE IF NOT EXISTS Clients(' + 'client TEXT PRIMARY KEY, ' +