X-Git-Url: https://git.pterodactylus.net/?a=blobdiff_plain;f=src%2Fmain%2Fjava%2Fde%2Ftodesbaum%2Fjsite%2Fapplication%2FWebOfTrustInterface.java;h=ea5c6b362177d6172a9a4ac69f35e79024e2bc4e;hb=45b3a5b235b1174b399fba6198ea2e946b274dc9;hp=d1fd31d4f17d7319a937518b741164a082cad8d9;hpb=8b9cdbbb17878232fb2400a48e154823b7a306bf;p=jSite.git diff --git a/src/main/java/de/todesbaum/jsite/application/WebOfTrustInterface.java b/src/main/java/de/todesbaum/jsite/application/WebOfTrustInterface.java index d1fd31d..ea5c6b3 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 // @@ -186,9 +205,9 @@ public class WebOfTrustInterface implements Runnable { int identityCounter = -1; while (message.get("Replies.Identity" + ++identityCounter) != null) { String id = message.get("Replies.Identity" + identityCounter); - String nickname = message.get("Replies.Nickname " + identityCounter); - String requestUri = message.get("Replies.RequestURI" + identityCounter); - String insertUri = message.get("Replies.InsertURI" + identityCounter); + String nickname = message.get("Replies.Nickname" + identityCounter); + String requestUri = shortenUri(message.get("Replies.RequestURI" + identityCounter)); + String insertUri = shortenUri(message.get("Replies.InsertURI" + identityCounter)); DefaultOwnIdentity ownIdentity = new DefaultOwnIdentity(id, nickname, requestUri, insertUri); logger.log(Level.FINE, String.format("Parsed Own Identity %s.", ownIdentity)); ownIdentities.add(ownIdentity);