2006-02-25 jrandom

* Made the Syndie permalinks in the thread view point to the blog view
    * Disabled TCP again (since the live net seems to be doing well w/out it)
    * Fix the message time on inbound SSU establishment (thanks zzz!)
    * Don't be so aggressive with parallel tunnel creation when a tunnel pool
      just starts up
This commit is contained in:
jrandom
2006-02-25 20:41:51 +00:00
committed by zzz
parent 7b2a435aad
commit 62b7cf64da
10 changed files with 95 additions and 44 deletions

View File

@ -34,7 +34,9 @@ public class BlogRenderer extends HTMLRenderer {
}
public void receiveHeaderEnd() {
_preBodyBuffer.append("<div class=\"syndieBlogPost\"><hr style=\"display: none\" />\n");
_preBodyBuffer.append("<div class=\"syndieBlogPost\" id=\"");
_preBodyBuffer.append(_entry.getURI().getKeyHash().toBase64()).append('/').append(_entry.getURI().getEntryId());
_preBodyBuffer.append("\"><hr style=\"display: none\" />\n");
_preBodyBuffer.append("<div class=\"syndieBlogPostHeader\">\n");
_preBodyBuffer.append("<div class=\"syndieBlogPostSubject\">");
String subject = (String)_headers.get(HEADER_SUBJECT);
@ -160,12 +162,24 @@ public class BlogRenderer extends HTMLRenderer {
protected String getEntryURL(boolean showImages) {
return getEntryURL(_entry, _blog, showImages);
}
static String getEntryURL(EntryContainer entry, BlogInfo blog, boolean showImages) {
static String getEntryURL(EntryContainer entry, BlogInfo blog, boolean showImages) {
if (entry == null) return "unknown";
return "blog.jsp?"
+ ViewBlogServlet.PARAM_BLOG + "=" + (blog != null ? blog.getKey().calculateHash().toBase64() : "") + "&amp;"
+ ViewBlogServlet.PARAM_ENTRY + "="
+ Base64.encode(entry.getURI().getKeyHash().getData()) + '/' + entry.getURI().getEntryId();
return getEntryURL(entry.getURI(), blog, null, showImages);
}
static String getEntryURL(BlogURI entry, BlogInfo blog, BlogURI comment, boolean showImages) {
if (entry == null) return "unknown";
if (comment == null) {
return "blog.jsp?"
+ ViewBlogServlet.PARAM_BLOG + "=" + (blog != null ? blog.getKey().calculateHash().toBase64() : "") + "&amp;"
+ ViewBlogServlet.PARAM_ENTRY + "="
+ Base64.encode(entry.getKeyHash().getData()) + '/' + entry.getEntryId();
} else {
return "blog.jsp?"
+ ViewBlogServlet.PARAM_BLOG + "=" + (blog != null ? blog.getKey().calculateHash().toBase64() : "") + "&amp;"
+ ViewBlogServlet.PARAM_ENTRY + "="
+ Base64.encode(entry.getKeyHash().getData()) + '/' + entry.getEntryId()
+ '#' + Base64.encode(comment.getKeyHash().getData()) + '/' + comment.getEntryId();
}
}
protected String getAttachmentURLBase() {
@ -218,4 +232,4 @@ public class BlogRenderer extends HTMLRenderer {
buf.append(ViewBlogServlet.PARAM_OFFSET).append('=').append(pageNum*numPerPage).append("&amp;");
return buf.toString();
}
}
}

View File

@ -122,36 +122,52 @@ public class ThreadedHTMLRenderer extends HTMLRenderer {
public static String getViewPostLink(String uri, ThreadNode node, User user, boolean isPermalink,
String offset, String tags, String author, boolean authorOnly) {
StringBuffer buf = new StringBuffer(64);
buf.append(uri);
if (node.getChildCount() > 0) {
buf.append('?').append(PARAM_VISIBLE).append('=');
ThreadNode child = node.getChild(0);
buf.append(child.getEntry().getKeyHash().toBase64()).append('/');
buf.append(child.getEntry().getEntryId()).append('&');
if (isPermalink) {
// link to the blog view of the original poster
BlogURI rootBlog = null;
ThreadNode parent = node;
while (parent != null) {
if (parent.getParent() != null) {
parent = parent.getParent();
} else {
rootBlog = parent.getEntry();
break;
}
}
BlogInfo root = BlogManager.instance().getArchive().getBlogInfo(rootBlog.getKeyHash());
return BlogRenderer.getEntryURL(parent.getEntry(), root, node.getEntry(), true);
} else {
buf.append('?').append(PARAM_VISIBLE).append('=');
StringBuffer buf = new StringBuffer(64);
buf.append(uri);
if (node.getChildCount() > 0) {
buf.append('?').append(PARAM_VISIBLE).append('=');
ThreadNode child = node.getChild(0);
buf.append(child.getEntry().getKeyHash().toBase64()).append('/');
buf.append(child.getEntry().getEntryId()).append('&');
} else {
buf.append('?').append(PARAM_VISIBLE).append('=');
buf.append(node.getEntry().getKeyHash().toBase64()).append('/');
buf.append(node.getEntry().getEntryId()).append('&');
}
buf.append(PARAM_VIEW_POST).append('=');
buf.append(node.getEntry().getKeyHash().toBase64()).append('/');
buf.append(node.getEntry().getEntryId()).append('&');
if (!isPermalink) {
if (!empty(offset))
buf.append(PARAM_OFFSET).append('=').append(offset).append('&');
if (!empty(tags))
buf.append(PARAM_TAGS).append('=').append(tags).append('&');
}
if (authorOnly && !empty(author)) {
buf.append(PARAM_AUTHOR).append('=').append(author).append('&');
buf.append(PARAM_THREAD_AUTHOR).append("=true&");
} else if (!isPermalink && !empty(author))
buf.append(PARAM_AUTHOR).append('=').append(author).append('&');
return buf.toString();
}
buf.append(PARAM_VIEW_POST).append('=');
buf.append(node.getEntry().getKeyHash().toBase64()).append('/');
buf.append(node.getEntry().getEntryId()).append('&');
if (!isPermalink) {
if (!empty(offset))
buf.append(PARAM_OFFSET).append('=').append(offset).append('&');
if (!empty(tags))
buf.append(PARAM_TAGS).append('=').append(tags).append('&');
}
if (authorOnly && !empty(author)) {
buf.append(PARAM_AUTHOR).append('=').append(author).append('&');
buf.append(PARAM_THREAD_AUTHOR).append("=true&");
} else if (!isPermalink && !empty(author))
buf.append(PARAM_AUTHOR).append('=').append(author).append('&');
return buf.toString();
}
public static String getViewPostLink(String uri, BlogURI post, User user, boolean isPermalink,
@ -272,8 +288,7 @@ public class ThreadedHTMLRenderer extends HTMLRenderer {
out.write("\n<a href=\"");
out.write(getViewPostLink(baseURI, node, user, true, offset, requestTags, filteredAuthor, authorOnly));
out.write("\" title=\"Select a shareable link directly to this post\">permalink</a>\n");
out.write("\" title=\"Select a link directly to this post within the blog\">permalink</a>\n");
if (true || (!inlineReply) ) {
String refuseReply = (String)_headers.get(HEADER_REFUSE_REPLIES);