From 255eea6a4c82d2ca786f87a216f24f61a9c837c0 Mon Sep 17 00:00:00 2001 From: Christian Pauly Date: Sun, 21 Jul 2019 07:16:09 +0200 Subject: [PATCH] [Store] Add exceptRoomID to loadContacts --- lib/src/Store.dart | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/lib/src/Store.dart b/lib/src/Store.dart index d8f69c2..e6ca444 100644 --- a/lib/src/Store.dart +++ b/lib/src/Store.dart @@ -436,11 +436,12 @@ class Store { return User.fromJson(res[0], room); } - /// Loads all Users in the database to provide a contact list. - Future> loadContacts() async { + /// Loads all Users in the database to provide a contact list + /// except users who are in the Room with the ID [exceptRoomID]. + Future> loadContacts({String exceptRoomID = ""}) async { List> res = await db.rawQuery( - "SELECT * FROM Users WHERE matrix_id!=? GROUP BY matrix_id ORDER BY displayname", - [client.userID]); + "SELECT * FROM Users WHERE matrix_id!=? AND chat_id!=? GROUP BY matrix_id ORDER BY displayname", + [client.userID, exceptRoomID]); List userList = []; for (int i = 0; i < res.length; i++) userList.add(User.fromJson(res[i], Room(id: "", client: client)));