2005-02-06 Sugadude
* Added a filter to the addressbook to remove entries that dont end in ".i2p" (thanks Sugadude!)
This commit is contained in:
@ -243,4 +243,27 @@ public class AddressBook {
|
|||||||
public void write() {
|
public void write() {
|
||||||
this.write(new File(this.location));
|
this.write(new File(this.location));
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
/**
|
||||||
|
* Filter out bad addresses in this addressbook, and write them to log.
|
||||||
|
* Returns the number of addresses removed.
|
||||||
|
*
|
||||||
|
* @author Sugadude
|
||||||
|
*/
|
||||||
|
public int filter(Log log) {
|
||||||
|
Iterator iter = this.addresses.keySet().iterator();
|
||||||
|
int removed = 0;
|
||||||
|
while(iter.hasNext()) {
|
||||||
|
String aKey = (String) iter.next();
|
||||||
|
if(!aKey.endsWith(".i2p")) {
|
||||||
|
iter.remove();
|
||||||
|
removed++;
|
||||||
|
if(log != null)
|
||||||
|
log.append("Invalid address " + aKey + " filtered out.");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if(removed > 0)
|
||||||
|
this.modified = true;
|
||||||
|
return removed;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@ -64,6 +64,7 @@ public class Daemon {
|
|||||||
while (iter.hasNext()) {
|
while (iter.hasNext()) {
|
||||||
master.merge((AddressBook) iter.next(), log);
|
master.merge((AddressBook) iter.next(), log);
|
||||||
}
|
}
|
||||||
|
master.filter(log); /** @author Sugadude */
|
||||||
master.write(new File(routerLocation));
|
master.write(new File(routerLocation));
|
||||||
master.write(published);
|
master.write(published);
|
||||||
subscriptions.write();
|
subscriptions.write();
|
||||||
@ -168,4 +169,4 @@ public class Daemon {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,4 +1,7 @@
|
|||||||
$Id: history.txt,v 1.136 2005/01/26 23:48:41 smeghead Exp $
|
$Id: history.txt,v 1.137 2005/02/03 08:39:47 smeghead Exp $
|
||||||
|
|
||||||
|
2005-02-06 Sugadude
|
||||||
|
* Added a filter to the addressbook to remove entries that dont end in ".i2p"
|
||||||
|
|
||||||
2005-02-03 smeghead
|
2005-02-03 smeghead
|
||||||
* Added Ant buildfile in apps/fortuna for creating a custom Fortuna PRNG jar
|
* Added Ant buildfile in apps/fortuna for creating a custom Fortuna PRNG jar
|
||||||
|
Reference in New Issue
Block a user