From b31a7e44650d35648d42e5e17fd75d69f213542b Mon Sep 17 00:00:00 2001 From: =?utf8?q?David=20=E2=80=98Bombe=E2=80=99=20Roden?= Date: Thu, 20 Sep 2012 15:07:37 +0200 Subject: [PATCH] Add method to shorten URIs. --- .../jsite/application/WebOfTrustInterface.java | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) 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 // -- 2.7.4