opt out handling of the autojoin flag. fixes #1666
This commit is contained in:
parent
d1fc90f981
commit
1e7647e385
|
@ -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) {
|
||||
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);
|
||||
}
|
||||
|
|
|
@ -468,7 +468,7 @@ public class ConferenceDetailsActivity extends XmppActivity implements OnConvers
|
|||
bookmark.setNick(mConversation.getJid().getResourcepart());
|
||||
}
|
||||
bookmark.setBookmarkName(mConversation.getMucOptions().getSubject());
|
||||
bookmark.setAutojoin(true);
|
||||
bookmark.setAutojoin(getPreferences().getBoolean("autojoin",true));
|
||||
account.getBookmarks().add(bookmark);
|
||||
xmppConnectionService.pushBookmarks(account);
|
||||
mConversation.setBookmark(bookmark);
|
||||
|
|
|
@ -286,7 +286,7 @@ public class StartConversationActivity extends XmppActivity implements OnRosterU
|
|||
if (!conversation.getMucOptions().online()) {
|
||||
xmppConnectionService.joinMuc(conversation);
|
||||
}
|
||||
if (!bookmark.autojoin()) {
|
||||
if (!bookmark.autojoin() && getPreferences().getBoolean("autojoin", true)) {
|
||||
bookmark.setAutojoin(true);
|
||||
xmppConnectionService.pushBookmarks(bookmark.getAccount());
|
||||
}
|
||||
|
|
|
@ -331,6 +331,8 @@
|
|||
<string name="pref_expert_options_other">Other</string>
|
||||
<string name="pref_conference_name">Conference name</string>
|
||||
<string name="pref_conference_name_summary">Use room’s subject instead of JID to identify conferences</string>
|
||||
<string name="pref_autojoin">Automatically join conferences</string>
|
||||
<string name="pref_autojoin_summary">Respect the autojoin flag in conference bookmarks</string>
|
||||
<string name="toast_message_otr_fingerprint">OTR fingerprint copied to clipboard!</string>
|
||||
<string name="toast_message_omemo_fingerprint">OMEMO fingerprint copied to clipboard!</string>
|
||||
<string name="conference_banned">You are banned from this conference</string>
|
||||
|
|
|
@ -186,6 +186,12 @@
|
|||
android:title="@string/pref_xa_on_silent_mode"/>
|
||||
</PreferenceCategory>
|
||||
<PreferenceCategory android:title="@string/pref_expert_options_other">
|
||||
<CheckBoxPreference
|
||||
android:key="autojoin"
|
||||
android:defaultValue="true"
|
||||
android:title="@string/pref_autojoin"
|
||||
android:summary="@string/pref_autojoin_summary"
|
||||
/>
|
||||
<CheckBoxPreference
|
||||
android:defaultValue="false"
|
||||
android:key="indicate_received"
|
||||
|
|
Loading…
Reference in a new issue