diff options
author | Daniel Gultsch <daniel@gultsch.de> | 2016-02-01 13:54:08 +0100 |
---|---|---|
committer | Daniel Gultsch <daniel@gultsch.de> | 2016-02-01 13:54:08 +0100 |
commit | 1e7647e385a55598843f80fe39fadeda64295f87 (patch) | |
tree | 00e7f688935094958fbdaf109a774068e5511403 /src/main/java/eu/siacs/conversations/services/XmppConnectionService.java | |
parent | d1fc90f9810832d812c3cf5525c9a5ce27619bdd (diff) |
opt out handling of the autojoin flag. fixes #1666
Diffstat (limited to '')
-rw-r--r-- | src/main/java/eu/siacs/conversations/services/XmppConnectionService.java | 13 |
1 files 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 d4fda1b8..99183dff 100644 --- a/src/main/java/eu/siacs/conversations/services/XmppConnectionService.java +++ b/src/main/java/eu/siacs/conversations/services/XmppConnectionService.java @@ -1001,6 +1001,7 @@ public class XmppConnectionService extends Service implements OnPhoneContactsLoa final Element query = packet.query(); final HashMap<Jid, Bookmark> bookmarks = new HashMap<>(); final Element storage = query.findChild("storage", "storage:bookmarks"); + final boolean autojoin = respectAutojoin(); if (storage != null) { for (final Element item : storage.getChildren()) { if (item.getName().equals("conference")) { @@ -1012,7 +1013,7 @@ public class XmppConnectionService extends Service implements OnPhoneContactsLoa Conversation conversation = find(bookmark); if (conversation != null) { conversation.setBookmark(bookmark); - } else if (bookmark.autojoin() && bookmark.getJid() != null) { + } else if (bookmark.autojoin() && bookmark.getJid() != null && autojoin) { conversation = findOrCreateConversation( account, bookmark.getJid(), true); conversation.setBookmark(bookmark); @@ -1330,7 +1331,7 @@ public class XmppConnectionService extends Service implements OnPhoneContactsLoa if (conversation.getMode() == Conversation.MODE_MULTI) { if (conversation.getAccount().getStatus() == Account.State.ONLINE) { Bookmark bookmark = conversation.getBookmark(); - if (bookmark != null && bookmark.autojoin()) { + if (bookmark != null && bookmark.autojoin() && respectAutojoin()) { bookmark.setAutojoin(false); pushBookmarks(bookmark.getAccount()); } @@ -1791,7 +1792,9 @@ public class XmppConnectionService extends Service implements OnPhoneContactsLoa if (conversation.getMode() == Conversation.MODE_MULTI) { conversation.getMucOptions().setPassword(password); if (conversation.getBookmark() != null) { - conversation.getBookmark().setAutojoin(true); + if (respectAutojoin()) { + conversation.getBookmark().setAutojoin(true); + } pushBookmarks(conversation.getAccount()); } databaseBackend.updateConversation(conversation); @@ -2578,6 +2581,10 @@ public class XmppConnectionService extends Service implements OnPhoneContactsLoa return !getPreferences().getBoolean("dont_save_encrypted", false); } + private boolean respectAutojoin() { + return getPreferences().getBoolean("autojoin", true); + } + public boolean indicateReceived() { return getPreferences().getBoolean("indicate_received", false); } |