Author: toad
Date: 2007-11-19 23:28:54 +0000 (Mon, 19 Nov 2007)
New Revision: 15871

Modified:
   trunk/freenet/src/freenet/clients/http/bookmark/BookmarkManager.java
Log:
Revert: this isn't possible with regexes

Modified: trunk/freenet/src/freenet/clients/http/bookmark/BookmarkManager.java
===================================================================
--- trunk/freenet/src/freenet/clients/http/bookmark/BookmarkManager.java        
2007-11-19 23:26:59 UTC (rev 15870)
+++ trunk/freenet/src/freenet/clients/http/bookmark/BookmarkManager.java        
2007-11-19 23:28:54 UTC (rev 15871)
@@ -89,7 +89,7 @@
        }

        public class BookmarkCallback implements StringArrCallback {
-               private final Pattern pattern = 
Pattern.compile("/(.*/)([^/]*)(=\\|?=?)([A-Z]{3}@.*).*");
+               private final Pattern pattern = 
Pattern.compile("/(.*/)([^/]*)=([A-Z]{3}@.*).*");

                public String[] get() {
                        synchronized (BookmarkManager.this) {
@@ -104,13 +104,18 @@
                                try {
                                        Matcher matcher = 
pattern.matcher(newVals[i]);
                                        // FIXME: remove
-                                       if (matcher.matches() && 
matcher.groupCount() == 4) {
+                                       if (matcher.matches() && 
matcher.groupCount() == 3) {

+                                               boolean hasAnActiveLink = false;
                                                makeParents(matcher.group(1));
-                                               key = new 
FreenetURI(matcher.group(4));
+                                               key = new 
FreenetURI(matcher.group(3));
                                                String title = matcher.group(2);
-                                               String middlebit = 
matcher.group(3);
-                                               boolean hasAnActiveLink = 
"=|=".equals(middlebit);
+                                               if(title.endsWith("=|")) {
+                                                       title = 
title.substring(0, title.length()-2);
+                                                       hasAnActiveLink = true;
+                                               } else if(title.endsWith("=")) {
+                                                       title = 
title.substring(0, title.length()-1);
+                                               }
                                                addBookmark(matcher.group(1), 
new BookmarkItem(key,
                                                                title, 
hasAnActiveLink, node.alerts), false);



Reply via email to