Add method to shorten URIs.
[jSite.git] / src / main / java / de / todesbaum / jsite / application / WebOfTrustInterface.java
index d1fd31d..d37e211 100644 (file)
@@ -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
        //