renamed omemo:// to aesgcm://

This commit is contained in:
Daniel Gultsch 2017-02-07 20:07:57 +01:00
parent 71ad18beb9
commit 24fab162e2
4 changed files with 12 additions and 10 deletions

View File

@ -9,7 +9,7 @@ import java.net.URL;
import eu.siacs.conversations.Config;
import eu.siacs.conversations.crypto.axolotl.FingerprintStatus;
import eu.siacs.conversations.crypto.axolotl.XmppAxolotlSession;
import eu.siacs.conversations.http.AesGcmURLStreamHandler;
import eu.siacs.conversations.utils.CryptoHelper;
import eu.siacs.conversations.utils.GeoHelper;
import eu.siacs.conversations.utils.MimeUtils;
@ -660,7 +660,7 @@ public class Message extends AbstractEntity {
String ref = url.getRef();
final String protocol = url.getProtocol();
final boolean encrypted = ref != null && ref.matches("([A-Fa-f0-9]{2}){48}");
if ("omemo".equalsIgnoreCase(protocol) && encrypted) {
if (AesGcmURLStreamHandler.PROTOCOL_NAME.equalsIgnoreCase(protocol) && encrypted) {
return Decision.MUST;
}
if (!url.getProtocol().equalsIgnoreCase("http") && !url.getProtocol().equalsIgnoreCase("https")) {

View File

@ -6,9 +6,12 @@ import java.net.URLConnection;
import java.net.URLStreamHandler;
public class OmemoURLStreamHandler extends URLStreamHandler {
public class AesGcmURLStreamHandler extends URLStreamHandler {
public static final String PROTOCOL_NAME = "aesgcm";
@Override
protected URLConnection openConnection(URL url) throws IOException {
return new URL("https"+url.toString().substring(5)).openConnection();
return new URL("https"+url.toString().substring(url.getProtocol().length())).openConnection();
}
}

View File

@ -3,11 +3,11 @@ package eu.siacs.conversations.http;
import java.net.URLStreamHandler;
import java.net.URLStreamHandlerFactory;
public class OmemoURLStreamHandlerFactory implements URLStreamHandlerFactory {
public class AesGcmURLStreamHandlerFactory implements URLStreamHandlerFactory {
@Override
public URLStreamHandler createURLStreamHandler(String protocol) {
if ("omemo".equals(protocol)) {
return new OmemoURLStreamHandler();
if (AesGcmURLStreamHandler.PROTOCOL_NAME.equals(protocol)) {
return new AesGcmURLStreamHandler();
} else {
return null;
}

View File

@ -65,7 +65,6 @@ import java.util.ListIterator;
import java.util.Locale;
import java.util.Map;
import java.util.concurrent.CopyOnWriteArrayList;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.atomic.AtomicLong;
import de.duenndns.ssl.MemorizingTrustManager;
@ -96,7 +95,7 @@ import eu.siacs.conversations.generator.IqGenerator;
import eu.siacs.conversations.generator.MessageGenerator;
import eu.siacs.conversations.generator.PresenceGenerator;
import eu.siacs.conversations.http.HttpConnectionManager;
import eu.siacs.conversations.http.OmemoURLStreamHandlerFactory;
import eu.siacs.conversations.http.AesGcmURLStreamHandlerFactory;
import eu.siacs.conversations.parser.AbstractParser;
import eu.siacs.conversations.parser.IqParser;
import eu.siacs.conversations.parser.MessageParser;
@ -145,7 +144,7 @@ import me.leolin.shortcutbadger.ShortcutBadger;
public class XmppConnectionService extends Service {
static {
URL.setURLStreamHandlerFactory(new OmemoURLStreamHandlerFactory());
URL.setURLStreamHandlerFactory(new AesGcmURLStreamHandlerFactory());
}
public static final String ACTION_REPLY_TO_CONVERSATION = "reply_to_conversations";