}
}
+ /**
+ * 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
//
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);