diff --git a/apps/syndie/java/src/net/i2p/syndie/data/ArchiveIndex.java b/apps/syndie/java/src/net/i2p/syndie/data/ArchiveIndex.java index 10b45c96e..96a5de7cb 100644 --- a/apps/syndie/java/src/net/i2p/syndie/data/ArchiveIndex.java +++ b/apps/syndie/java/src/net/i2p/syndie/data/ArchiveIndex.java @@ -117,6 +117,20 @@ public class ArchiveIndex { } return tags; } + public int getBlogEntryCount(Hash blog) { + Set uris = new HashSet(64); + for (int i = 0; i < _blogs.size(); i++) { + BlogSummary summary = (BlogSummary)_blogs.get(i); + if (summary.blog.equals(blog)) { + uris.addAll(summary.entries); + //for (int j = 0; j < summary.entries.size(); j++) { + // EntrySummary entry = (EntrySummary)summary.entries.get(j); + // uris.add(entry.entry); + //} + } + } + return uris.size(); + } /** how many 'new' blogs are listed */ public int getNewestBlogCount() { return _newestBlogs.size(); } @@ -379,6 +393,14 @@ public class ArchiveIndex { size = kb; entry = uri; } + public int hashCode() { + return entry.hashCode(); + } + public boolean equals(Object obj) { + if ( (obj instanceof EntrySummary) && (((EntrySummary)obj).entry.equals(entry)) ) + return true; + return false; + } } /** export the index into an archive.txt */ diff --git a/apps/syndie/java/src/net/i2p/syndie/web/ArchiveViewerBean.java b/apps/syndie/java/src/net/i2p/syndie/web/ArchiveViewerBean.java index 895e7442b..4b47fa7ac 100644 --- a/apps/syndie/java/src/net/i2p/syndie/web/ArchiveViewerBean.java +++ b/apps/syndie/java/src/net/i2p/syndie/web/ArchiveViewerBean.java @@ -118,11 +118,21 @@ public class ArchiveViewerBean { for (int i = 0; i < index.getNewestBlogCount(); i++) { Hash cur = index.getNewestBlog(i); + String knownName = user.getPetNameDB().getNameByLocation(cur.toBase64()); + PetName pn = null; + if (knownName != null) { + pn = user.getPetNameDB().get(knownName); + knownName = pn.getName(); + } + if ( (pn != null) && (pn.isMember("Ignore")) ) + continue; String blog = Base64.encode(cur.getData()); out.write("\n"); } - List allTags = new ArrayList(); + ////List allTags = new ArrayList(); // perhaps sort this by name (even though it isnt unique...) Set blogs = index.getUniqueBlogs(); for (Iterator iter = blogs.iterator(); iter.hasNext(); ) { Hash cur = (Hash)iter.next(); + String knownName = user.getPetNameDB().getNameByLocation(cur.toBase64()); + PetName pn = null; + if (knownName != null) { + pn = user.getPetNameDB().get(knownName); + knownName = pn.getName(); + } + if ( (pn != null) && (pn.isMember("Ignore")) ) + continue; + String blog = Base64.encode(cur.getData()); out.write("\n"); + if (info != null) { + int howMany = index.getBlogEntryCount(info.getKey().calculateHash()); + if (howMany == 1) + out.write(" [1 post]"); + else + out.write(" [" + howMany + " posts]"); + } + out.write("\n"); + /* List tags = index.getBlogTags(cur); for (int j = 0; j < tags.size(); j++) { String tag = (String)tags.get(j); @@ -190,7 +219,9 @@ public class ArchiveViewerBean { out.write(tag); out.write(""\n"); } + */ } + /* for (int i = 0; i < allTags.size(); i++) { String tag = (String)allTags.get(i); out.write("\n"); newBlogs++; @@ -502,6 +524,8 @@ public class RemoteArchiveBean { List entries = new ArrayList(); for (Iterator iter = remoteBlogs.iterator(); iter.hasNext(); ) { Hash blog = (Hash)iter.next(); + if (ignoreBlog(user, blog)) + continue; buf.setLength(0); int shownEntries = 0; buf.append("\n"); diff --git a/apps/syndie/jsp/addresses.jsp b/apps/syndie/jsp/addresses.jsp index 9ada773bc..08d1d918d 100644 --- a/apps/syndie/jsp/addresses.jsp +++ b/apps/syndie/jsp/addresses.jsp @@ -28,6 +28,8 @@ if (!user.getAuthenticated()) { cur.setIsPublic(null != request.getParameter("isPublic")); cur.setLocation(request.getParameter("location")); cur.setGroups(request.getParameter("groups")); + names.remove(oldPetname); + names.set(cur.getName(), cur); names.store(user.getAddressbookLocation()); %>Address updated<% }