use escaped jid for EXTRA_ACCOUNT
This commit is contained in:
parent
304411fc09
commit
aa1e69d277
|
@ -85,7 +85,7 @@ public class ManageAccountActivity extends XmppActivity implements OnAccountUpda
|
|||
String jid = savedInstanceState.getString(STATE_SELECTED_ACCOUNT);
|
||||
if (jid != null) {
|
||||
try {
|
||||
this.selectedAccountJid = Jid.of(jid);
|
||||
this.selectedAccountJid = Jid.ofEscaped(jid);
|
||||
} catch (IllegalArgumentException e) {
|
||||
this.selectedAccountJid = null;
|
||||
}
|
||||
|
@ -111,7 +111,7 @@ public class ManageAccountActivity extends XmppActivity implements OnAccountUpda
|
|||
@Override
|
||||
public void onSaveInstanceState(final Bundle savedInstanceState) {
|
||||
if (selectedAccount != null) {
|
||||
savedInstanceState.putString(STATE_SELECTED_ACCOUNT, selectedAccount.getJid().asBareJid().toString());
|
||||
savedInstanceState.putString(STATE_SELECTED_ACCOUNT, selectedAccount.getJid().asBareJid().toEscapedString());
|
||||
}
|
||||
super.onSaveInstanceState(savedInstanceState);
|
||||
}
|
||||
|
@ -286,7 +286,7 @@ public class ManageAccountActivity extends XmppActivity implements OnAccountUpda
|
|||
private void publishAvatar(Account account) {
|
||||
Intent intent = new Intent(getApplicationContext(),
|
||||
PublishProfilePictureActivity.class);
|
||||
intent.putExtra(EXTRA_ACCOUNT, account.getJid().toString());
|
||||
intent.putExtra(EXTRA_ACCOUNT, account.getJid().asBareJid().toEscapedString());
|
||||
startActivity(intent);
|
||||
}
|
||||
|
||||
|
|
|
@ -222,7 +222,7 @@ public class ChannelDiscoveryService {
|
|||
continue;
|
||||
}
|
||||
for (final String mucService : xmppConnection.getMucServers()) {
|
||||
Jid jid = Jid.of(mucService);
|
||||
Jid jid = Jid.ofEscaped(mucService);
|
||||
if (!localMucServices.containsKey(jid)) {
|
||||
localMucServices.put(jid, account);
|
||||
}
|
||||
|
|
|
@ -35,7 +35,7 @@ public class BlocklistActivity extends AbstractSearchableListItemActivity implem
|
|||
@Override
|
||||
public void onBackendConnected() {
|
||||
for (final Account account : xmppConnectionService.getAccounts()) {
|
||||
if (account.getJid().toString().equals(getIntent().getStringExtra(EXTRA_ACCOUNT))) {
|
||||
if (account.getJid().toEscapedString().equals(getIntent().getStringExtra(EXTRA_ACCOUNT))) {
|
||||
this.account = account;
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -73,7 +73,7 @@ public class ChooseAccountForProfilePictureActivity extends XmppActivity {
|
|||
final Uri uri = startIntent == null ? null : startIntent.getData();
|
||||
if (uri != null) {
|
||||
Intent intent = new Intent(this, PublishProfilePictureActivity.class);
|
||||
intent.putExtra(EXTRA_ACCOUNT, account.getJid().asBareJid().toString());
|
||||
intent.putExtra(EXTRA_ACCOUNT, account.getJid().asBareJid().toEscapedString());
|
||||
intent.setData(uri);
|
||||
intent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION);
|
||||
try {
|
||||
|
|
|
@ -75,7 +75,7 @@ public class ChooseContactActivity extends AbstractSearchableListItemActivity im
|
|||
intent.putExtra(EXTRA_CONVERSATION, conversation.getUuid());
|
||||
intent.putExtra(EXTRA_SELECT_MULTIPLE, true);
|
||||
intent.putExtra(EXTRA_SHOW_ENTER_JID, true);
|
||||
intent.putExtra(EXTRA_ACCOUNT, conversation.getAccount().getJid().asBareJid().toString());
|
||||
intent.putExtra(EXTRA_ACCOUNT, conversation.getAccount().getJid().asBareJid().toEscapedString());
|
||||
return intent;
|
||||
}
|
||||
|
||||
|
@ -321,7 +321,7 @@ public class ChooseContactActivity extends AbstractSearchableListItemActivity im
|
|||
final Intent request = getIntent();
|
||||
final Intent data = new Intent();
|
||||
data.putExtra("contact", contactJid.toString());
|
||||
data.putExtra(EXTRA_ACCOUNT, accountJid.toString());
|
||||
data.putExtra(EXTRA_ACCOUNT, accountJid.toEscapedString());
|
||||
data.putExtra(EXTRA_SELECT_MULTIPLE, false);
|
||||
copy(request, data);
|
||||
setResult(RESULT_OK, data);
|
||||
|
@ -401,7 +401,7 @@ public class ChooseContactActivity extends AbstractSearchableListItemActivity im
|
|||
data.putExtra("contact", item.getJid().toString());
|
||||
String account = request.getStringExtra(EXTRA_ACCOUNT);
|
||||
if (account == null && item instanceof Contact) {
|
||||
account = ((Contact) item).getAccount().getJid().asBareJid().toString();
|
||||
account = ((Contact) item).getAccount().getJid().asBareJid().toEscapedString();
|
||||
}
|
||||
data.putExtra(EXTRA_ACCOUNT, account);
|
||||
data.putExtra(EXTRA_SELECT_MULTIPLE, false);
|
||||
|
|
|
@ -188,11 +188,11 @@ public class ContactDetailsActivity extends OmemoActivity implements OnAccountUp
|
|||
showInactiveOmemo = savedInstanceState != null && savedInstanceState.getBoolean("show_inactive_omemo", false);
|
||||
if (getIntent().getAction().equals(ACTION_VIEW_CONTACT)) {
|
||||
try {
|
||||
this.accountJid = Jid.of(getIntent().getExtras().getString(EXTRA_ACCOUNT));
|
||||
this.accountJid = Jid.ofEscaped(getIntent().getExtras().getString(EXTRA_ACCOUNT));
|
||||
} catch (final IllegalArgumentException ignored) {
|
||||
}
|
||||
try {
|
||||
this.contactJid = Jid.of(getIntent().getExtras().getString("contact"));
|
||||
this.contactJid = Jid.ofEscaped(getIntent().getExtras().getString("contact"));
|
||||
} catch (final IllegalArgumentException ignored) {
|
||||
}
|
||||
}
|
||||
|
|
|
@ -772,7 +772,7 @@ public class ConversationFragment extends XmppFragment implements EditMessage.Ke
|
|||
contacts[i] = targets.get(i).toString();
|
||||
}
|
||||
intent.putExtra("contacts", contacts);
|
||||
intent.putExtra(EXTRA_ACCOUNT, conversation.getAccount().getJid().asBareJid().toString());
|
||||
intent.putExtra(EXTRA_ACCOUNT, conversation.getAccount().getJid().asBareJid().toEscapedString());
|
||||
intent.putExtra("conversation", conversation.getUuid());
|
||||
startActivityForResult(intent, requestCode);
|
||||
return true;
|
||||
|
|
|
@ -121,7 +121,7 @@ public class EditAccountActivity extends OmemoActivity implements OnAccountUpdat
|
|||
public void onClick(final View view) {
|
||||
if (mAccount != null) {
|
||||
final Intent intent = new Intent(getApplicationContext(), PublishProfilePictureActivity.class);
|
||||
intent.putExtra(EXTRA_ACCOUNT, mAccount.getJid().asBareJid().toString());
|
||||
intent.putExtra(EXTRA_ACCOUNT, mAccount.getJid().asBareJid().toEscapedString());
|
||||
startActivity(intent);
|
||||
}
|
||||
}
|
||||
|
@ -445,7 +445,7 @@ public class EditAccountActivity extends OmemoActivity implements OnAccountUpdat
|
|||
intent.putExtra(EXTRA_ACCOUNT, mAccount.getJid().asBareJid().toEscapedString());
|
||||
} else {
|
||||
intent = new Intent(getApplicationContext(), PublishProfilePictureActivity.class);
|
||||
intent.putExtra(EXTRA_ACCOUNT, mAccount.getJid().asBareJid().toString());
|
||||
intent.putExtra(EXTRA_ACCOUNT, mAccount.getJid().asBareJid().toEscapedString());
|
||||
intent.putExtra("setup", true);
|
||||
}
|
||||
if (wasFirstAccount) {
|
||||
|
@ -693,7 +693,7 @@ public class EditAccountActivity extends OmemoActivity implements OnAccountUpdat
|
|||
recreate();
|
||||
} else if (intent != null) {
|
||||
try {
|
||||
this.jidToEdit = Jid.of(intent.getStringExtra("jid"));
|
||||
this.jidToEdit = Jid.ofEscaped(intent.getStringExtra("jid"));
|
||||
} catch (final IllegalArgumentException | NullPointerException ignored) {
|
||||
this.jidToEdit = null;
|
||||
}
|
||||
|
@ -754,7 +754,7 @@ public class EditAccountActivity extends OmemoActivity implements OnAccountUpdat
|
|||
@Override
|
||||
public void onSaveInstanceState(final Bundle savedInstanceState) {
|
||||
if (mAccount != null) {
|
||||
savedInstanceState.putString("account", mAccount.getJid().asBareJid().toString());
|
||||
savedInstanceState.putString("account", mAccount.getJid().asBareJid().toEscapedString());
|
||||
savedInstanceState.putBoolean("initMode", mInitMode);
|
||||
savedInstanceState.putBoolean("showMoreTable", binding.serverInfoMore.getVisibility() == View.VISIBLE);
|
||||
}
|
||||
|
@ -765,7 +765,7 @@ public class EditAccountActivity extends OmemoActivity implements OnAccountUpdat
|
|||
boolean init = true;
|
||||
if (mSavedInstanceAccount != null) {
|
||||
try {
|
||||
this.mAccount = xmppConnectionService.findAccountByJid(Jid.of(mSavedInstanceAccount));
|
||||
this.mAccount = xmppConnectionService.findAccountByJid(Jid.ofEscaped(mSavedInstanceAccount));
|
||||
this.mInitMode = mSavedInstanceInit;
|
||||
init = false;
|
||||
} catch (IllegalArgumentException e) {
|
||||
|
@ -833,7 +833,7 @@ public class EditAccountActivity extends OmemoActivity implements OnAccountUpdat
|
|||
break;
|
||||
case R.id.action_show_block_list:
|
||||
final Intent showBlocklistIntent = new Intent(this, BlocklistActivity.class);
|
||||
showBlocklistIntent.putExtra(EXTRA_ACCOUNT, mAccount.getJid().toString());
|
||||
showBlocklistIntent.putExtra(EXTRA_ACCOUNT, mAccount.getJid().toEscapedString());
|
||||
startActivity(showBlocklistIntent);
|
||||
break;
|
||||
case R.id.action_server_info_show_more:
|
||||
|
@ -882,7 +882,7 @@ public class EditAccountActivity extends OmemoActivity implements OnAccountUpdat
|
|||
|
||||
private void gotoChangePassword(String newPassword) {
|
||||
final Intent changePasswordIntent = new Intent(this, ChangePasswordActivity.class);
|
||||
changePasswordIntent.putExtra(EXTRA_ACCOUNT, mAccount.getJid().toString());
|
||||
changePasswordIntent.putExtra(EXTRA_ACCOUNT, mAccount.getJid().toEscapedString());
|
||||
if (newPassword != null) {
|
||||
changePasswordIntent.putExtra("password", newPassword);
|
||||
}
|
||||
|
|
|
@ -165,7 +165,7 @@ public class ShareWithActivity extends XmppActivity implements XmppConnectionSer
|
|||
final Conversation conversation;
|
||||
Account account;
|
||||
try {
|
||||
account = xmppConnectionService.findAccountByJid(Jid.of(share.account));
|
||||
account = xmppConnectionService.findAccountByJid(Jid.ofEscaped(share.account));
|
||||
} catch (final IllegalArgumentException e) {
|
||||
account = null;
|
||||
}
|
||||
|
|
|
@ -1000,7 +1000,7 @@ public class StartConversationActivity extends XmppActivity implements XmppConne
|
|||
intent.putExtra(ChooseContactActivity.EXTRA_SHOW_ENTER_JID, false);
|
||||
intent.putExtra(ChooseContactActivity.EXTRA_SELECT_MULTIPLE, true);
|
||||
intent.putExtra(ChooseContactActivity.EXTRA_GROUP_CHAT_NAME, name.trim());
|
||||
intent.putExtra(ChooseContactActivity.EXTRA_ACCOUNT, account.getJid().asBareJid().toString());
|
||||
intent.putExtra(ChooseContactActivity.EXTRA_ACCOUNT, account.getJid().asBareJid().toEscapedString());
|
||||
intent.putExtra(ChooseContactActivity.EXTRA_TITLE_RES_ID, R.string.choose_participants);
|
||||
startActivityForResult(intent, REQUEST_CREATE_CONFERENCE);
|
||||
}
|
||||
|
|
|
@ -522,8 +522,8 @@ public abstract class XmppActivity extends ActionBarActivity {
|
|||
public void switchToContactDetails(Contact contact, String messageFingerprint) {
|
||||
Intent intent = new Intent(this, ContactDetailsActivity.class);
|
||||
intent.setAction(ContactDetailsActivity.ACTION_VIEW_CONTACT);
|
||||
intent.putExtra(EXTRA_ACCOUNT, contact.getAccount().getJid().asBareJid().toString());
|
||||
intent.putExtra("contact", contact.getJid().toString());
|
||||
intent.putExtra(EXTRA_ACCOUNT, contact.getAccount().getJid().asBareJid().toEscapedString());
|
||||
intent.putExtra("contact", contact.getJid().toEscapedString());
|
||||
intent.putExtra("fingerprint", messageFingerprint);
|
||||
startActivity(intent);
|
||||
}
|
||||
|
@ -538,7 +538,7 @@ public abstract class XmppActivity extends ActionBarActivity {
|
|||
|
||||
public void switchToAccount(Account account, boolean init, String fingerprint) {
|
||||
Intent intent = new Intent(this, EditAccountActivity.class);
|
||||
intent.putExtra("jid", account.getJid().asBareJid().toString());
|
||||
intent.putExtra("jid", account.getJid().asBareJid().toEscapedString());
|
||||
intent.putExtra("init", init);
|
||||
if (init) {
|
||||
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK | Intent.FLAG_ACTIVITY_NO_ANIMATION);
|
||||
|
|
Loading…
Reference in a new issue