forked from I2P_Developers/i2p.i2p
Console: Partial string case-insensitive match for netdb family search
This commit is contained in:
@@ -209,6 +209,9 @@ class NetDbRenderer {
|
||||
}
|
||||
}
|
||||
}
|
||||
String familyArg = family; // save for error message
|
||||
if (family != null)
|
||||
family = family.toLowerCase(Locale.US);
|
||||
int toSkip = pageSize * page;
|
||||
int skipped = 0;
|
||||
int written = 0;
|
||||
@@ -219,7 +222,6 @@ class NetDbRenderer {
|
||||
if ((routerPrefix != null && key.toBase64().startsWith(routerPrefix)) ||
|
||||
(version != null && version.equals(ri.getVersion())) ||
|
||||
(country != null && country.equals(_context.commSystem().getCountry(key))) ||
|
||||
(family != null && family.equals(ri.getOption("family"))) ||
|
||||
// 'O' will catch PO and XO also
|
||||
(caps != null && hasCap(ri, caps)) ||
|
||||
(tr != null && ri.getTargetAddress(tr) != null) ||
|
||||
@@ -237,6 +239,22 @@ class NetDbRenderer {
|
||||
if (sybil != null)
|
||||
sybils.add(key);
|
||||
notFound = false;
|
||||
} else if (family != null) {
|
||||
String rifam = ri.getOption("family");
|
||||
if (rifam != null && rifam.toLowerCase(Locale.US).contains(family)) {
|
||||
if (skipped < toSkip) {
|
||||
skipped++;
|
||||
continue;
|
||||
}
|
||||
if (written++ >= pageSize) {
|
||||
morePages = true;
|
||||
break outerloop;
|
||||
}
|
||||
renderRouterInfo(buf, ri, false, true);
|
||||
if (sybil != null)
|
||||
sybils.add(key);
|
||||
notFound = false;
|
||||
}
|
||||
} else if (ip != null) {
|
||||
for (RouterAddress ra : ri.getAddresses()) {
|
||||
if (ipMode == 0) {
|
||||
@@ -381,8 +399,8 @@ class NetDbRenderer {
|
||||
buf.append(_t("Version")).append(' ').append(version).append(' ');
|
||||
if (country != null)
|
||||
buf.append(_t("Country")).append(' ').append(country).append(' ');
|
||||
if (family != null)
|
||||
buf.append(_t("Family")).append(' ').append(family).append(' ');
|
||||
if (familyArg != null)
|
||||
buf.append(_t("Family")).append(' ').append(familyArg).append(' ');
|
||||
if (ipArg != null)
|
||||
buf.append("IP ").append(ipArg).append(' ');
|
||||
if (ipv6 != null)
|
||||
|
Reference in New Issue
Block a user