remove bookmark after a room is destroyed

This commit is contained in:
Christoph Scholz 2018-12-27 14:27:37 +01:00
parent 835c89328d
commit 77b42ba9ca
1 changed files with 10 additions and 3 deletions

View File

@ -1853,9 +1853,16 @@ public class XmppConnectionService extends Service {
if (conversation.getMode() == Conversation.MODE_MULTI) { if (conversation.getMode() == Conversation.MODE_MULTI) {
if (conversation.getAccount().getStatus() == Account.State.ONLINE) { if (conversation.getAccount().getStatus() == Account.State.ONLINE) {
Bookmark bookmark = conversation.getBookmark(); Bookmark bookmark = conversation.getBookmark();
if (maySyncronizeWithBookmarks && bookmark != null && bookmark.autojoin() && synchronizeWithBookmarks()) { if (maySyncronizeWithBookmarks && bookmark != null && synchronizeWithBookmarks()) {
bookmark.setAutojoin(false); if (conversation.getMucOptions().getError() == MucOptions.Error.DESTROYED) {
pushBookmarks(bookmark.getAccount()); 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); leaveMuc(conversation);