handle app links with @ in them

This commit is contained in:
Daniel Gultsch 2016-05-30 13:06:42 +02:00
parent 272cffe797
commit be0fc59314
1 changed files with 12 additions and 3 deletions

View File

@ -35,9 +35,18 @@ public class XmppUri {
String scheme = uri.getScheme(); String scheme = uri.getScheme();
String host = uri.getHost(); String host = uri.getHost();
List<String> segments = uri.getPathSegments(); List<String> segments = uri.getPathSegments();
if ("https".equalsIgnoreCase(scheme) && "conversations.im".equalsIgnoreCase(host) && segments.size() >= 3) { if ("https".equalsIgnoreCase(scheme) && "conversations.im".equalsIgnoreCase(host)) {
// sample : https://conversations.im/i/foo/bar.com if (segments.size() >= 2 && segments.get(1).contains("@")) {
jid = segments.get(1)+"@"+segments.get(2); // 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)) { } else if ("xmpp".equalsIgnoreCase(scheme)) {
// sample: xmpp:foo@bar.com // sample: xmpp:foo@bar.com
muc = "join".equalsIgnoreCase(uri.getQuery()); muc = "join".equalsIgnoreCase(uri.getQuery());