diff options
author | Christian Schneppe <christian@pix-art.de> | 2018-04-02 22:53:01 +0200 |
---|---|---|
committer | Christian Schneppe <christian@pix-art.de> | 2018-04-02 23:09:05 +0200 |
commit | 621217973065960e3347262f507d7c3b39326464 (patch) | |
tree | eba1fdd5ca5da1e7e5a41c8a4466749e04332f98 /src/main/java/de/pixart/messenger/ui/ContactDetailsActivity.java | |
parent | 95521e80c1c029b02eddf5799cd23d0268ae4a1c (diff) |
migrate to xmpp-addr
Diffstat (limited to 'src/main/java/de/pixart/messenger/ui/ContactDetailsActivity.java')
-rw-r--r-- | src/main/java/de/pixart/messenger/ui/ContactDetailsActivity.java | 21 |
1 files changed, 10 insertions, 11 deletions
diff --git a/src/main/java/de/pixart/messenger/ui/ContactDetailsActivity.java b/src/main/java/de/pixart/messenger/ui/ContactDetailsActivity.java index 635c5c7d6..18a3e8adc 100644 --- a/src/main/java/de/pixart/messenger/ui/ContactDetailsActivity.java +++ b/src/main/java/de/pixart/messenger/ui/ContactDetailsActivity.java @@ -51,8 +51,7 @@ import de.pixart.messenger.utils.XmppUri; import de.pixart.messenger.xmpp.OnKeyStatusUpdated; import de.pixart.messenger.xmpp.OnUpdateBlocklist; import de.pixart.messenger.xmpp.XmppConnection; -import de.pixart.messenger.xmpp.jid.InvalidJidException; -import de.pixart.messenger.xmpp.jid.Jid; +import rocks.xmpp.addr.Jid; public class ContactDetailsActivity extends OmemoActivity implements OnAccountUpdate, OnRosterUpdate, OnUpdateBlocklist, OnKeyStatusUpdated { public static final String ACTION_VIEW_CONTACT = "view_contact"; @@ -232,7 +231,7 @@ public class ContactDetailsActivity extends OmemoActivity implements OnAccountUp protected String getShareableUri(boolean http) { final String prefix = http ? Config.inviteUserURL : "xmpp:"; if (contact != null) { - return prefix + contact.getJid().toBareJid().toString(); + return prefix + contact.getJid().asBareJid().toString(); } else { return ""; } @@ -244,12 +243,12 @@ 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.fromString(getIntent().getExtras().getString(EXTRA_ACCOUNT)); - } catch (final InvalidJidException ignored) { + this.accountJid = Jid.of(getIntent().getExtras().getString(EXTRA_ACCOUNT)); + } catch (final IllegalArgumentException ignored) { } try { - this.contactJid = Jid.fromString(getIntent().getExtras().getString("contact")); - } catch (final InvalidJidException ignored) { + this.contactJid = Jid.of(getIntent().getExtras().getString("contact")); + } catch (final IllegalArgumentException ignored) { } } this.messageFingerprint = getIntent().getStringExtra("fingerprint"); @@ -390,7 +389,7 @@ public class ContactDetailsActivity extends OmemoActivity implements OnAccountUp invalidateOptionsMenu(); setTitle(contact.getDisplayName()); - if (contact.getServer().toString().toLowerCase().equals(accountJid.getDomainpart().toLowerCase())) { + if (contact.getServer().toString().toLowerCase().equals(accountJid.getDomain().toLowerCase())) { binding.contactDisplayName.setText(contact.getDisplayName()); } else { binding.contactDisplayName.setText(contact.getDisplayJid()); @@ -518,9 +517,9 @@ public class ContactDetailsActivity extends OmemoActivity implements OnAccountUp } String account; if (Config.DOMAIN_LOCK != null) { - account = contact.getAccount().getJid().getLocalpart(); + account = contact.getAccount().getJid().getLocal(); } else { - account = contact.getAccount().getJid().toBareJid().toString(); + account = contact.getAccount().getJid().asBareJid().toString(); } binding.detailsAccount.setText(getString(R.string.using_account, account)); binding.detailsContactBadge.setImageBitmap(avatarService().get(contact, getPixel(Config.AVATAR_SIZE))); @@ -679,7 +678,7 @@ public class ContactDetailsActivity extends OmemoActivity implements OnAccountUp @Override protected void processFingerprintVerification(XmppUri uri) { - if (contact != null && contact.getJid().toBareJid().equals(uri.getJid()) && uri.hasFingerprints()) { + if (contact != null && contact.getJid().asBareJid().equals(uri.getJid()) && uri.hasFingerprints()) { if (xmppConnectionService.verifyFingerprints(contact, uri.getFingerprints())) { Toast.makeText(this, R.string.verified_fingerprints, Toast.LENGTH_SHORT).show(); } |