forked from I2P_Developers/i2p.i2p
propagate from branch 'i2p.i2p.zzz.test2' (head a002e8957b5bf3a44149203d6842ef4b35107aa7)
to branch 'i2p.i2p' (head 0f6e2b3b8643fe7797e8727329345c1ed4cf741b)
This commit is contained in:
@ -18,15 +18,15 @@ import java.util.TreeMap;
|
||||
import net.i2p.data.DataHelper;
|
||||
import net.i2p.data.Hash;
|
||||
import net.i2p.router.RouterContext;
|
||||
import net.i2p.router.Shitlist;
|
||||
import net.i2p.router.Banlist;
|
||||
|
||||
/**
|
||||
* Moved from Shitlist.java
|
||||
* Moved from Banlist.java
|
||||
*/
|
||||
public class ShitlistRenderer {
|
||||
public class BanlistRenderer {
|
||||
private final RouterContext _context;
|
||||
|
||||
public ShitlistRenderer(RouterContext context) {
|
||||
public BanlistRenderer(RouterContext context) {
|
||||
_context = context;
|
||||
}
|
||||
|
||||
@ -40,9 +40,9 @@ public class ShitlistRenderer {
|
||||
StringBuilder buf = new StringBuilder(1024);
|
||||
// move to the jsp
|
||||
//buf.append("<h2>Banned Peers</h2>");
|
||||
Map<Hash, Shitlist.Entry> entries = new TreeMap(new HashComparator());
|
||||
Map<Hash, Banlist.Entry> entries = new TreeMap(new HashComparator());
|
||||
|
||||
entries.putAll(_context.shitlist().getEntries());
|
||||
entries.putAll(_context.banlist().getEntries());
|
||||
if (entries.isEmpty()) {
|
||||
buf.append("<i>").append(_("none")).append("</i>");
|
||||
out.write(buf.toString());
|
||||
@ -51,9 +51,9 @@ public class ShitlistRenderer {
|
||||
|
||||
buf.append("<ul>");
|
||||
|
||||
for (Map.Entry<Hash, Shitlist.Entry> e : entries.entrySet()) {
|
||||
for (Map.Entry<Hash, Banlist.Entry> e : entries.entrySet()) {
|
||||
Hash key = e.getKey();
|
||||
Shitlist.Entry entry = e.getValue();
|
||||
Banlist.Entry entry = e.getValue();
|
||||
long expires = entry.expireOn-_context.clock().now();
|
||||
if (expires <= 0)
|
||||
continue;
|
@ -20,7 +20,7 @@ public class ConfigPeerHandler extends FormHandler {
|
||||
} else if (_action.equals(_("Ban peer until restart"))) {
|
||||
Hash h = getHash();
|
||||
if (h != null) {
|
||||
_context.shitlist().shitlistRouterForever(h, _("Manually banned via {0}"), "<a href=\"configpeer\">configpeer</a>");
|
||||
_context.banlist().banlistRouterForever(h, _("Manually banned via {0}"), "<a href=\"configpeer\">configpeer</a>");
|
||||
addFormNotice(_("Peer") + " " + _peer + " " + _("banned until restart") );
|
||||
return;
|
||||
}
|
||||
@ -28,8 +28,8 @@ public class ConfigPeerHandler extends FormHandler {
|
||||
} else if (_action.equals(_("Unban peer"))) {
|
||||
Hash h = getHash();
|
||||
if (h != null) {
|
||||
if (_context.shitlist().isShitlisted(h)) {
|
||||
_context.shitlist().unshitlistRouter(h);
|
||||
if (_context.banlist().isBanlisted(h)) {
|
||||
_context.banlist().unbanlistRouter(h);
|
||||
addFormNotice(_("Peer") + " " + _peer + " " + _("unbanned") );
|
||||
} else
|
||||
addFormNotice(_("Peer") + " " + _peer + " " + _("is not currently banned") );
|
||||
|
@ -168,7 +168,7 @@ class ProfileOrganizerRenderer {
|
||||
}
|
||||
buf.append("</td><td align=\"right\">").append(num(prof.getIntegrationValue()));
|
||||
buf.append("</td><td align=\"center\">");
|
||||
if (_context.shitlist().isShitlisted(peer)) buf.append(_("Banned"));
|
||||
if (_context.banlist().isBanlisted(peer)) buf.append(_("Banned"));
|
||||
if (prof.getIsFailing()) buf.append(' ').append(_("Failing"));
|
||||
if (_context.commSystem().wasUnreachable(peer)) buf.append(' ').append(_("Unreachable"));
|
||||
Rate failed = prof.getTunnelHistory().getFailedRate().getRate(30*60*1000);
|
||||
|
@ -46,7 +46,7 @@ public class ProfilesHelper extends HelperBase {
|
||||
renderNavBar();
|
||||
} catch (IOException ioe) {}
|
||||
if (_full == 3)
|
||||
getShitlistSummary();
|
||||
getBanlistSummary();
|
||||
else
|
||||
getProfileSummary();
|
||||
return "";
|
||||
@ -64,9 +64,9 @@ public class ProfilesHelper extends HelperBase {
|
||||
}
|
||||
|
||||
/** @return empty string, writes directly to _out */
|
||||
public String getShitlistSummary() {
|
||||
public String getBanlistSummary() {
|
||||
try {
|
||||
ShitlistRenderer rend = new ShitlistRenderer(_context);
|
||||
BanlistRenderer rend = new BanlistRenderer(_context);
|
||||
rend.renderStatusHTML(_out);
|
||||
} catch (IOException ioe) {
|
||||
ioe.printStackTrace();
|
||||
|
@ -284,11 +284,11 @@ public class SummaryHelper extends HelperBase {
|
||||
*
|
||||
*/
|
||||
/********
|
||||
public int getShitlistedPeers() {
|
||||
public int getBanlistedPeers() {
|
||||
if (_context == null)
|
||||
return 0;
|
||||
else
|
||||
return _context.shitlist().getRouterCount();
|
||||
return _context.banlist().getRouterCount();
|
||||
}
|
||||
********/
|
||||
|
||||
|
Reference in New Issue
Block a user