use escaped form of jid where approriate

This commit is contained in:
Daniel Gultsch 2018-03-11 14:14:56 +01:00
parent 4bb45996c5
commit c1135ad592
4 changed files with 8 additions and 8 deletions

View File

@ -618,7 +618,7 @@ public class Account extends AbstractEntity {
public String getShareableUri() {
List<XmppUri.Fingerprint> 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 {
@ -628,7 +628,7 @@ public class Account extends AbstractEntity {
public String getShareableLink() {
List<XmppUri.Fingerprint> fingerprints = this.getFingerprints();
String uri = "https://conversations.im/i/"+this.getJid().asBareJid().toString();
String uri = "https://conversations.im/i/"+this.getJid().asBareJid().toEscapedString();
if (fingerprints.size() > 0) {
return XmppUri.getFingerprintUri(uri,fingerprints,'&');
} else {

View File

@ -329,7 +329,7 @@ public class ConferenceDetailsActivity extends XmppActivity implements OnConvers
protected String getShareableUri(boolean http) {
if (mConversation != null) {
if (http) {
return "https://conversations.im/j/"+ mConversation.getJid().asBareJid();
return "https://conversations.im/j/"+ mConversation.getJid().asBareJid().toEscapedString();
} else {
return "xmpp:"+mConversation.getJid().asBareJid()+"?join";
}

View File

@ -167,7 +167,7 @@ public class ContactDetailsActivity extends OmemoActivity implements OnAccountUp
protected String getShareableUri(boolean http) {
final String prefix = http ? "https://conversations.im/i/" : "xmpp:";
if (contact != null) {
return prefix+contact.getJid().asBareJid().toString();
return prefix+contact.getJid().asBareJid().toEscapedString();
} else {
return "";
}

View File

@ -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());
}