From 77b42ba9cafa404d711e0b9d8b6f55a333b7a11a Mon Sep 17 00:00:00 2001 From: Christoph Scholz Date: Thu, 27 Dec 2018 14:27:37 +0100 Subject: [PATCH] remove bookmark after a room is destroyed --- .../services/XmppConnectionService.java | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/src/main/java/eu/siacs/conversations/services/XmppConnectionService.java b/src/main/java/eu/siacs/conversations/services/XmppConnectionService.java index 48044766a..9eab960ae 100644 --- a/src/main/java/eu/siacs/conversations/services/XmppConnectionService.java +++ b/src/main/java/eu/siacs/conversations/services/XmppConnectionService.java @@ -1853,9 +1853,16 @@ public class XmppConnectionService extends Service { if (conversation.getMode() == Conversation.MODE_MULTI) { if (conversation.getAccount().getStatus() == Account.State.ONLINE) { Bookmark bookmark = conversation.getBookmark(); - if (maySyncronizeWithBookmarks && bookmark != null && bookmark.autojoin() && synchronizeWithBookmarks()) { - bookmark.setAutojoin(false); - pushBookmarks(bookmark.getAccount()); + if (maySyncronizeWithBookmarks && bookmark != null && synchronizeWithBookmarks()) { + if (conversation.getMucOptions().getError() == MucOptions.Error.DESTROYED) { + Account account = bookmark.getAccount(); + bookmark.setConversation(null); + account.getBookmarks().remove(bookmark); + pushBookmarks(account); + } else if (bookmark.autojoin()) { + bookmark.setAutojoin(false); + pushBookmarks(bookmark.getAccount()); + } } } leaveMuc(conversation);