From 3ca10b8fa95f606024ed43c9d2cd254adfff51f1 Mon Sep 17 00:00:00 2001 From: Daniel Gultsch Date: Mon, 18 May 2020 09:35:35 +0200 Subject: [PATCH] show escaped jids when it comes to account selection --- .../java/eu/siacs/conversations/ui/BlocklistActivity.java | 2 +- .../eu/siacs/conversations/ui/ChannelDiscoveryActivity.java | 2 +- .../java/eu/siacs/conversations/ui/ChooseContactActivity.java | 4 ++-- src/main/java/eu/siacs/conversations/ui/EnterJidDialog.java | 4 ++-- .../eu/siacs/conversations/ui/StartConversationActivity.java | 4 ++-- src/main/java/eu/siacs/conversations/utils/AccountUtils.java | 4 ++-- 6 files changed, 10 insertions(+), 10 deletions(-) diff --git a/src/main/java/eu/siacs/conversations/ui/BlocklistActivity.java b/src/main/java/eu/siacs/conversations/ui/BlocklistActivity.java index 6e85c58f2..f0aef4741 100644 --- a/src/main/java/eu/siacs/conversations/ui/BlocklistActivity.java +++ b/src/main/java/eu/siacs/conversations/ui/BlocklistActivity.java @@ -79,7 +79,7 @@ public class BlocklistActivity extends AbstractSearchableListItemActivity implem getString(R.string.block_jabber_id), getString(R.string.block), null, - account.getJid().asBareJid().toString(), + account.getJid().asBareJid().toEscapedString(), true, false ); diff --git a/src/main/java/eu/siacs/conversations/ui/ChannelDiscoveryActivity.java b/src/main/java/eu/siacs/conversations/ui/ChannelDiscoveryActivity.java index ec80152eb..c0b97759d 100644 --- a/src/main/java/eu/siacs/conversations/ui/ChannelDiscoveryActivity.java +++ b/src/main/java/eu/siacs/conversations/ui/ChannelDiscoveryActivity.java @@ -263,7 +263,7 @@ public class ChannelDiscoveryActivity extends XmppActivity implements MenuItem.O } public void joinChannelSearchResult(String selectedAccount, Room result) { - final Jid jid = Config.DOMAIN_LOCK == null ? Jid.of(selectedAccount) : Jid.of(selectedAccount, Config.DOMAIN_LOCK, null); + final Jid jid = Config.DOMAIN_LOCK == null ? Jid.ofEscaped(selectedAccount) : Jid.ofEscaped(selectedAccount, Config.DOMAIN_LOCK, null); final boolean syncAutoJoin = getBooleanPreference("autojoin", R.bool.autojoin); final Account account = xmppConnectionService.findAccountByJid(jid); final Conversation conversation = xmppConnectionService.findOrCreateConversation(account, result.getRoom(), true, true, true); diff --git a/src/main/java/eu/siacs/conversations/ui/ChooseContactActivity.java b/src/main/java/eu/siacs/conversations/ui/ChooseContactActivity.java index cec1d8ca7..afda66709 100644 --- a/src/main/java/eu/siacs/conversations/ui/ChooseContactActivity.java +++ b/src/main/java/eu/siacs/conversations/ui/ChooseContactActivity.java @@ -361,9 +361,9 @@ public class ChooseContactActivity extends AbstractSearchableListItemActivity im for (Account account : xmppConnectionService.getAccounts()) { if (account.getStatus() != Account.State.DISABLED) { if (Config.DOMAIN_LOCK != null) { - this.mActivatedAccounts.add(account.getJid().getLocal()); + this.mActivatedAccounts.add(account.getJid().getEscapedLocal()); } else { - this.mActivatedAccounts.add(account.getJid().asBareJid().toString()); + this.mActivatedAccounts.add(account.getJid().asBareJid().toEscapedString()); } } } diff --git a/src/main/java/eu/siacs/conversations/ui/EnterJidDialog.java b/src/main/java/eu/siacs/conversations/ui/EnterJidDialog.java index fef479e37..83d6d4a0c 100644 --- a/src/main/java/eu/siacs/conversations/ui/EnterJidDialog.java +++ b/src/main/java/eu/siacs/conversations/ui/EnterJidDialog.java @@ -146,9 +146,9 @@ public class EnterJidDialog extends DialogFragment implements OnBackendConnected } try { if (Config.DOMAIN_LOCK != null) { - accountJid = Jid.of((String) binding.account.getSelectedItem(), Config.DOMAIN_LOCK, null); + accountJid = Jid.ofEscaped((String) binding.account.getSelectedItem(), Config.DOMAIN_LOCK, null); } else { - accountJid = Jid.of((String) binding.account.getSelectedItem()); + accountJid = Jid.ofEscaped((String) binding.account.getSelectedItem()); } } catch (final IllegalArgumentException e) { return; diff --git a/src/main/java/eu/siacs/conversations/ui/StartConversationActivity.java b/src/main/java/eu/siacs/conversations/ui/StartConversationActivity.java index 8e46786e2..57cc492e0 100644 --- a/src/main/java/eu/siacs/conversations/ui/StartConversationActivity.java +++ b/src/main/java/eu/siacs/conversations/ui/StartConversationActivity.java @@ -577,9 +577,9 @@ public class StartConversationActivity extends XmppActivity implements XmppConne Jid jid; try { if (Config.DOMAIN_LOCK != null) { - jid = Jid.of((String) spinner.getSelectedItem(), Config.DOMAIN_LOCK, null); + jid = Jid.ofEscaped((String) spinner.getSelectedItem(), Config.DOMAIN_LOCK, null); } else { - jid = Jid.of((String) spinner.getSelectedItem()); + jid = Jid.ofEscaped((String) spinner.getSelectedItem()); } } catch (final IllegalArgumentException e) { return null; diff --git a/src/main/java/eu/siacs/conversations/utils/AccountUtils.java b/src/main/java/eu/siacs/conversations/utils/AccountUtils.java index 475682bec..09b65f694 100644 --- a/src/main/java/eu/siacs/conversations/utils/AccountUtils.java +++ b/src/main/java/eu/siacs/conversations/utils/AccountUtils.java @@ -39,9 +39,9 @@ public class AccountUtils { for (Account account : service.getAccounts()) { if (account.getStatus() != Account.State.DISABLED) { if (Config.DOMAIN_LOCK != null) { - accounts.add(account.getJid().getLocal()); + accounts.add(account.getJid().toEscapedString()); } else { - accounts.add(account.getJid().asBareJid().toString()); + accounts.add(account.getJid().asBareJid().toEscapedString()); } } }