remove autojoin setting

This commit is contained in:
Daniel Gultsch 2024-04-08 15:32:52 +02:00
parent ecf0e23144
commit b752508adb
No known key found for this signature in database
GPG key ID: F43D18AD2A0982C2
5 changed files with 27 additions and 40 deletions

View file

@ -1267,7 +1267,7 @@ public class XmppConnectionService extends Service {
Log.e(Config.LOGTAG, "unable to initialize security provider", throwable);
}
Resolver.init(this);
updateMemorizingTrustmanager();
updateMemorizingTrustManager();
final int maxMemory = (int) (Runtime.getRuntime().maxMemory() / 1024);
final int cacheSize = maxMemory / 8;
this.mBitmapCache = new LruCache<String, Bitmap>(cacheSize) {
@ -2010,14 +2010,13 @@ public class XmppConnectionService extends Service {
return true;
}
public void processBookmarksInitial(Account account, Map<Jid, Bookmark> bookmarks, final boolean pep) {
public void processBookmarksInitial(final Account account, final Map<Jid, Bookmark> bookmarks, final boolean pep) {
final Set<Jid> previousBookmarks = account.getBookmarkedJids();
final boolean synchronizeWithBookmarks = synchronizeWithBookmarks();
for (Bookmark bookmark : bookmarks.values()) {
for (final Bookmark bookmark : bookmarks.values()) {
previousBookmarks.remove(bookmark.getJid().asBareJid());
processModifiedBookmark(bookmark, pep, synchronizeWithBookmarks);
processModifiedBookmark(bookmark, pep);
}
if (pep && synchronizeWithBookmarks) {
if (pep) {
Log.d(Config.LOGTAG, account.getJid().asBareJid() + ": " + previousBookmarks.size() + " bookmarks have been removed");
for (Jid jid : previousBookmarks) {
processDeletedBookmark(account, jid);
@ -2034,7 +2033,7 @@ public class XmppConnectionService extends Service {
}
}
private void processModifiedBookmark(Bookmark bookmark, final boolean pep, final boolean synchronizeWithBookmarks) {
private void processModifiedBookmark(final Bookmark bookmark, final boolean pep) {
final Account account = bookmark.getAccount();
Conversation conversation = find(bookmark);
if (conversation != null) {
@ -2042,7 +2041,7 @@ public class XmppConnectionService extends Service {
return;
}
bookmark.setConversation(conversation);
if (pep && synchronizeWithBookmarks && !bookmark.autojoin()) {
if (pep && !bookmark.autojoin()) {
Log.d(Config.LOGTAG, account.getJid().asBareJid() + ": archiving conference (" + conversation.getJid() + ") after receiving pep");
archiveConversation(conversation, false);
} else {
@ -2056,15 +2055,14 @@ public class XmppConnectionService extends Service {
}
}
}
} else if (synchronizeWithBookmarks && bookmark.autojoin()) {
} else if (bookmark.autojoin()) {
conversation = findOrCreateConversation(account, bookmark.getFullJid(), true, true, false);
bookmark.setConversation(conversation);
}
}
public void processModifiedBookmark(Bookmark bookmark) {
final boolean synchronizeWithBookmarks = synchronizeWithBookmarks();
processModifiedBookmark(bookmark, true, synchronizeWithBookmarks);
public void processModifiedBookmark(final Bookmark bookmark) {
processModifiedBookmark(bookmark, true);
}
public void createBookmark(final Account account, final Bookmark bookmark) {
@ -2531,7 +2529,7 @@ public class XmppConnectionService extends Service {
if (conversation.getMode() == Conversation.MODE_MULTI) {
if (conversation.getAccount().getStatus() == Account.State.ONLINE) {
final Bookmark bookmark = conversation.getBookmark();
if (maySynchronizeWithBookmarks && bookmark != null && synchronizeWithBookmarks()) {
if (maySynchronizeWithBookmarks && bookmark != null) {
if (conversation.getMucOptions().getError() == MucOptions.Error.DESTROYED) {
Account account = bookmark.getAccount();
bookmark.setConversation(null);
@ -3290,14 +3288,12 @@ public class XmppConnectionService extends Service {
Log.d(Config.LOGTAG, account.getJid().asBareJid() + ": fetching members for " + conversation.getName());
}
public void providePasswordForMuc(Conversation conversation, String password) {
public void providePasswordForMuc(final Conversation conversation, final String password) {
if (conversation.getMode() == Conversation.MODE_MULTI) {
conversation.getMucOptions().setPassword(password);
if (conversation.getBookmark() != null) {
final Bookmark bookmark = conversation.getBookmark();
if (synchronizeWithBookmarks()) {
bookmark.setAutojoin(true);
}
bookmark.setAutojoin(true);
createBookmark(conversation.getAccount(), bookmark);
}
updateConversation(conversation);
@ -4453,10 +4449,6 @@ public class XmppConnectionService extends Service {
return getBooleanPreference("chat_states", R.bool.chat_states);
}
private boolean synchronizeWithBookmarks() {
return getBooleanPreference("autojoin", R.bool.autojoin);
}
public boolean useTorToConnect() {
return QuickConversationsService.isConversations() && getBooleanPreference("use_tor", R.bool.use_tor);
}
@ -4732,15 +4724,15 @@ public class XmppConnectionService extends Service {
this.mMemorizingTrustManager = trustManager;
}
public void updateMemorizingTrustmanager() {
final MemorizingTrustManager tm;
final boolean dontTrustSystemCAs = getBooleanPreference("dont_trust_system_cas", R.bool.dont_trust_system_cas);
if (dontTrustSystemCAs) {
tm = new MemorizingTrustManager(getApplicationContext(), null);
public void updateMemorizingTrustManager() {
final MemorizingTrustManager trustManager;
final var appSettings = new AppSettings(this);
if (appSettings.isTrustSystemCAStore()) {
trustManager = new MemorizingTrustManager(getApplicationContext());
} else {
tm = new MemorizingTrustManager(getApplicationContext());
trustManager = new MemorizingTrustManager(getApplicationContext(), null);
}
setMemorizingTrustManager(tm);
setMemorizingTrustManager(trustManager);
}
public LruCache<String, Bitmap> getBitmapCache() {
@ -5153,7 +5145,7 @@ public class XmppConnectionService extends Service {
return templates;
}
public void saveConversationAsBookmark(Conversation conversation, String name) {
public void saveConversationAsBookmark(final Conversation conversation, final String name) {
final Account account = conversation.getAccount();
final Bookmark bookmark = new Bookmark(account, conversation.getJid().asBareJid());
final String nick = conversation.getJid().getResource();
@ -5163,7 +5155,7 @@ public class XmppConnectionService extends Service {
if (!TextUtils.isEmpty(name)) {
bookmark.setBookmarkName(name);
}
bookmark.setAutojoin(getPreferences().getBoolean("autojoin", getResources().getBoolean(R.bool.autojoin)));
bookmark.setAutojoin(true);
createBookmark(account, bookmark);
bookmark.setConversation(conversation);
}

View file

@ -275,7 +275,6 @@ public class ChannelDiscoveryActivity extends XmppActivity implements MenuItem.O
public void joinChannelSearchResult(final String selectedAccount, final Room result) {
final Jid jid = Jid.ofEscaped(selectedAccount);
final boolean syncAutoJoin = getBooleanPreference("autojoin", R.bool.autojoin);
final Account account = xmppConnectionService.findAccountByJid(jid);
final Conversation conversation =
xmppConnectionService.findOrCreateConversation(
@ -283,10 +282,10 @@ public class ChannelDiscoveryActivity extends XmppActivity implements MenuItem.O
final var existingBookmark = conversation.getBookmark();
if (existingBookmark == null) {
final var bookmark = new Bookmark(account, conversation.getJid().asBareJid());
bookmark.setAutojoin(syncAutoJoin);
bookmark.setAutojoin(true);
xmppConnectionService.createBookmark(account, bookmark);
} else {
if (!existingBookmark.autojoin() && syncAutoJoin) {
if (!existingBookmark.autojoin()) {
existingBookmark.setAutojoin(true);
xmppConnectionService.createBookmark(account, existingBookmark);
}

View file

@ -462,7 +462,7 @@ public class StartConversationActivity extends XmppActivity implements XmppConne
}
Conversation conversation = xmppConnectionService.findOrCreateConversation(bookmark.getAccount(), jid, true, true, true);
bookmark.setConversation(conversation);
if (!bookmark.autojoin() && getPreferences().getBoolean("autojoin", getResources().getBoolean(R.bool.autojoin))) {
if (!bookmark.autojoin()) {
bookmark.setAutojoin(true);
xmppConnectionService.createBookmark(bookmark.getAccount(), bookmark);
}
@ -1150,7 +1150,7 @@ public class StartConversationActivity extends XmppActivity implements XmppConne
openConversationsForBookmark(bookmark);
} else {
bookmark = new Bookmark(account, conferenceJid.asBareJid());
bookmark.setAutojoin(getBooleanPreference("autojoin", R.bool.autojoin));
bookmark.setAutojoin(true);
final String nick = conferenceJid.getResource();
if (nick != null && !nick.isEmpty() && !nick.equals(MucOptions.defaultNick(account))) {
bookmark.setNick(nick);

View file

@ -67,7 +67,7 @@ public class SecuritySettingsFragment extends XmppPreferenceFragment {
OmemoSetting.load(requireContext());
}
case AppSettings.TRUST_SYSTEM_CA_STORE -> {
requireService().updateMemorizingTrustmanager();
requireService().updateMemorizingTrustManager();
reconnectAccounts();
}
case AppSettings.REQUIRE_CHANNEL_BINDING -> {}

View file

@ -12,7 +12,6 @@
<bool name="last_activity">false</bool>
<bool name="vibrate_on_notification">true</bool>
<bool name="led">true</bool>
<bool name="enable_quiet_hours">false</bool>
<string name="notification_ringtone">content://settings/system/notification_sound</string>
<string name="incoming_call_ringtone">content://settings/system/ringtone</string>
<integer name="grace_period">144</integer>
@ -23,7 +22,6 @@
<bool name="show_dynamic_tags">false</bool>
<bool name="btbv">true</bool>
<integer name="automatic_message_deletion">0</integer>
<bool name="dont_trust_system_cas">false</bool>
<bool name="trust_system_ca_store">true</bool>
<bool name="allow_message_correction">true</bool>
<bool name="use_tor">false</bool>
@ -31,7 +29,6 @@
<bool name="display_enter_key">false</bool>
<bool name="manually_change_presence">false</bool>
<bool name="away_when_screen_off">false</bool>
<bool name="autojoin">true</bool>
<bool name="enable_foreground_service">true</bool>
<bool name="send_crash_reports">true</bool>
<bool name="validate_hostname">false</bool>
@ -40,7 +37,6 @@
<bool name="show_combined_search_options">false</bool>
<bool name="scroll_to_bottom">true</bool>
<string name="omemo_setting_default">default_on</string>
<string name="default_font_size">small</string>
<bool name="use_share_location_plugin">false</bool>
<bool name="start_searching">false</bool>
<string name="video_compression">360</string>