From: David ‘Bombe’ Roden Date: Thu, 20 Sep 2012 13:07:37 +0000 (+0200) Subject: Add method to shorten URIs. X-Git-Tag: 0.11^2~10^2~11 X-Git-Url: https://git.pterodactylus.net/?p=jSite.git;a=commitdiff_plain;h=b31a7e44650d35648d42e5e17fd75d69f213542b Add method to shorten URIs. --- diff --git a/src/main/java/de/todesbaum/jsite/application/WebOfTrustInterface.java b/src/main/java/de/todesbaum/jsite/application/WebOfTrustInterface.java index d1fd31d..d37e211 100644 --- a/src/main/java/de/todesbaum/jsite/application/WebOfTrustInterface.java +++ b/src/main/java/de/todesbaum/jsite/application/WebOfTrustInterface.java @@ -122,6 +122,25 @@ public class WebOfTrustInterface implements Runnable { } } + /** + * Returns the essential parts of an URI, consisting of only the + * private/public key, decryption key, and the flags. + * + * @param uri + * The URI to shorten + * @return The shortened URI + */ + private static String shortenUri(String uri) { + String shortenedUri = uri; + if (shortenedUri.charAt(3) == '@') { + shortenedUri = shortenedUri.substring(4); + } + if (shortenedUri.indexOf('/') > -1) { + shortenedUri = shortenedUri.substring(0, shortenedUri.indexOf('/')); + } + return shortenedUri; + } + // // RUNNABLE METHODS //