Prevent groups from being stored in the user database

This only affects top-level map entries. Groups that are contacts of the
client user are still persisted.
This commit is contained in:
Kai S. K. Engelbart 2020-06-26 16:37:00 +02:00
parent 66eddab143
commit 0dda75cb09

View File

@ -73,7 +73,7 @@ public abstract class LocalDB {
* @since Envoy Client v0.1-beta
*/
public void synchronize() {
user.getContacts().stream().filter(u -> !users.containsKey(u.getName())).forEach(u -> users.put(u.getName(), u));
user.getContacts().stream().filter(u -> u instanceof User && !users.containsKey(u.getName())).forEach(u -> users.put(u.getName(), u));
users.put(user.getName(), user);
// Synchronize user status data
@ -82,7 +82,7 @@ public abstract class LocalDB {
getChat(contact.getID()).ifPresent(chat -> { ((User) chat.getRecipient()).setStatus(((User) contact).getStatus()); });
// Create missing chats
users.values().stream().filter(u -> !u.equals(user) && getChat(u.getID()).isEmpty()).map(Chat::new).forEach(chats::add);
user.getContacts().stream().filter(u -> !u.equals(user) && getChat(u.getID()).isEmpty()).map(Chat::new).forEach(chats::add);
}
/**