diff options
author | Daniel Gultsch <daniel@gultsch.de> | 2016-05-30 13:06:42 +0200 |
---|---|---|
committer | Daniel Gultsch <daniel@gultsch.de> | 2016-05-30 13:06:42 +0200 |
commit | be0fc59314cc9dd2fb34059333b9d6a6269653b3 (patch) | |
tree | b33e8f84460e960eeed8fbf61773daf79c208a71 /src/main/java/eu/siacs/conversations | |
parent | 272cffe797f5955a1a1720016b1dab08a31e4103 (diff) |
handle app links with @ in them
Diffstat (limited to 'src/main/java/eu/siacs/conversations')
-rw-r--r-- | src/main/java/eu/siacs/conversations/utils/XmppUri.java | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/src/main/java/eu/siacs/conversations/utils/XmppUri.java b/src/main/java/eu/siacs/conversations/utils/XmppUri.java index 3c0136abb..7a56d38f7 100644 --- a/src/main/java/eu/siacs/conversations/utils/XmppUri.java +++ b/src/main/java/eu/siacs/conversations/utils/XmppUri.java @@ -35,9 +35,18 @@ public class XmppUri { String scheme = uri.getScheme(); String host = uri.getHost(); List<String> segments = uri.getPathSegments(); - if ("https".equalsIgnoreCase(scheme) && "conversations.im".equalsIgnoreCase(host) && segments.size() >= 3) { - // sample : https://conversations.im/i/foo/bar.com - jid = segments.get(1)+"@"+segments.get(2); + if ("https".equalsIgnoreCase(scheme) && "conversations.im".equalsIgnoreCase(host)) { + if (segments.size() >= 2 && segments.get(1).contains("@")) { + // sample : https://conversations.im/i/foo@bar.com + try { + jid = Jid.fromString(segments.get(1)).toString(); + } catch (Exception e) { + jid = null; + } + } else if (segments.size() >= 3) { + // sample : https://conversations.im/i/foo/bar.com + jid = segments.get(1) + "@" + segments.get(2); + } } else if ("xmpp".equalsIgnoreCase(scheme)) { // sample: xmpp:foo@bar.com muc = "join".equalsIgnoreCase(uri.getQuery()); |