From db59b15ed94eaebe6932d7bc9eaceadf9bc1a4f3 Mon Sep 17 00:00:00 2001 From: Christian Schneppe Date: Sat, 7 Apr 2018 23:32:24 +0200 Subject: use escaped form of jid where approriate --- src/main/java/de/pixart/messenger/entities/Account.java | 4 ++-- .../java/de/pixart/messenger/ui/ConferenceDetailsActivity.java | 4 ++-- src/main/java/de/pixart/messenger/ui/ContactDetailsActivity.java | 2 +- .../java/de/pixart/messenger/xmpp/stanzas/AbstractStanza.java | 8 ++++---- 4 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/main/java/de/pixart/messenger/entities/Account.java b/src/main/java/de/pixart/messenger/entities/Account.java index 8d750bf5c..222e33b3b 100644 --- a/src/main/java/de/pixart/messenger/entities/Account.java +++ b/src/main/java/de/pixart/messenger/entities/Account.java @@ -653,7 +653,7 @@ public class Account extends AbstractEntity { public String getShareableUri() { List fingerprints = this.getFingerprints(); - String uri = "xmpp:" + this.getJid().asBareJid().toString(); + String uri = "xmpp:" + this.getJid().asBareJid().toEscapedString(); if (fingerprints.size() > 0) { return XmppUri.getFingerprintUri(uri,fingerprints,';'); } else { @@ -662,7 +662,7 @@ public class Account extends AbstractEntity { } public String getShareableLink() { List fingerprints = this.getFingerprints(); - String uri = Config.inviteUserURL+this.getJid().asBareJid().toString(); + String uri = Config.inviteUserURL + this.getJid().asBareJid().toEscapedString(); if (fingerprints.size() > 0) { return XmppUri.getFingerprintUri(uri,fingerprints,'&'); } else { diff --git a/src/main/java/de/pixart/messenger/ui/ConferenceDetailsActivity.java b/src/main/java/de/pixart/messenger/ui/ConferenceDetailsActivity.java index dae489e18..cbcd573b9 100644 --- a/src/main/java/de/pixart/messenger/ui/ConferenceDetailsActivity.java +++ b/src/main/java/de/pixart/messenger/ui/ConferenceDetailsActivity.java @@ -374,9 +374,9 @@ public class ConferenceDetailsActivity extends XmppActivity implements OnConvers protected String getShareableUri(boolean http) { if (mConversation != null) { if (http) { - return Config.inviteMUCURL + mConversation.getJid().asBareJid(); + return Config.inviteMUCURL + mConversation.getJid().asBareJid().toEscapedString(); } else { - return "xmpp:" + mConversation.getJid().asBareJid() + "?join"; + return "xmpp:" + mConversation.getJid().asBareJid().toEscapedString() + "?join"; } } else { return null; diff --git a/src/main/java/de/pixart/messenger/ui/ContactDetailsActivity.java b/src/main/java/de/pixart/messenger/ui/ContactDetailsActivity.java index 4726922bf..ce4dad47e 100644 --- a/src/main/java/de/pixart/messenger/ui/ContactDetailsActivity.java +++ b/src/main/java/de/pixart/messenger/ui/ContactDetailsActivity.java @@ -231,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().asBareJid().toString(); + return prefix + contact.getJid().asBareJid().toEscapedString(); } else { return ""; } diff --git a/src/main/java/de/pixart/messenger/xmpp/stanzas/AbstractStanza.java b/src/main/java/de/pixart/messenger/xmpp/stanzas/AbstractStanza.java index 9e26439c2..58d2a8b68 100644 --- a/src/main/java/de/pixart/messenger/xmpp/stanzas/AbstractStanza.java +++ b/src/main/java/de/pixart/messenger/xmpp/stanzas/AbstractStanza.java @@ -20,26 +20,26 @@ public class AbstractStanza extends Element { public void setTo(final Jid to) { if (to != null) { - setAttribute("to", to.toString()); + setAttribute("to", to.toEscapedString()); } } public void setFrom(final Jid from) { if (from != null) { - setAttribute("from", from.toString()); + setAttribute("from", from.toEscapedString()); } } public boolean fromServer(final Account account) { return getFrom() == null - || getFrom().equals(account.getServer()) + || getFrom().equals(Jid.of(account.getServer())) || getFrom().equals(account.getJid().asBareJid()) || getFrom().equals(account.getJid()); } public boolean toServer(final Account account) { return getTo() == null - || getTo().equals(account.getServer()) + || getTo().equals(Jid.of(account.getServer())) || getTo().equals(account.getJid().asBareJid()) || getTo().equals(account.getJid()); } -- cgit v1.2.3