diff --git a/apps/susidns/src/java/src/i2p/susi/dns/AddressbookBean.java b/apps/susidns/src/java/src/i2p/susi/dns/AddressbookBean.java index e287fcb4e..0636c5c63 100644 --- a/apps/susidns/src/java/src/i2p/susi/dns/AddressbookBean.java +++ b/apps/susidns/src/java/src/i2p/susi/dns/AddressbookBean.java @@ -19,7 +19,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * - * $Revision: 1.7 $ + * $Revision: 1.1 $ */ package i2p.susi.dns; @@ -99,7 +99,6 @@ public class AddressbookBean return ConfigBean.addressbookPrefix + filename; } private Object[] entries; - public Object[] getEntries() { return entries; @@ -130,10 +129,59 @@ public class AddressbookBean public void setSerial(String serial) { this.serial = serial; } + /** Load addressbook and apply filter, returning messages about this. */ + public String getLoadBookMessages() + { + // Config and addressbook now loaded here, hence not needed in getMessages() + loadConfig(); + addressbook = new Properties(); + + String message = ""; + + try { + addressbook.load( new FileInputStream( getFileName() ) ); + LinkedList list = new LinkedList(); + Enumeration e = addressbook.keys(); + while( e.hasMoreElements() ) { + String name = (String)e.nextElement(); + String destination = addressbook.getProperty( name ); + if( filter != null && filter.length() > 0 ) { + if( filter.compareTo( "0-9" ) == 0 ) { + char first = name.charAt(0); + if( first < '0' || first > '9' ) + continue; + } + else if( ! name.toLowerCase().startsWith( filter.toLowerCase() ) ) { + continue; + } + } + if( search != null && search.length() > 0 ) { + if( name.indexOf( search ) == -1 ) { + continue; + } + } + list.addLast( new AddressBean( name, destination ) ); + } + // Format a message about filtered addressbook size, and the number of displayed entries + message = "Filtered list contains " + list.size() + " entries"; + if (list.size() > 300) message += ", displaying the first 300."; else message += "."; + + Object array[] = list.toArray(); + Arrays.sort( array, sorter ); + entries = array; + } + catch (Exception e) { + Debug.debug( e.getClass().getName() + ": " + e.getMessage() ); + } + + if( message.length() > 0 ) + message = "

" + message + "

"; + return message; + } + /** Perform actions, returning messages about this. */ public String getMessages() { - loadConfig(); - + // Loading config and addressbook moved into getLoadBookMessages() String message = ""; if( action != null ) { @@ -175,42 +223,7 @@ public class AddressbookBean } action = null; - - addressbook = new Properties(); - try { - addressbook.load( new FileInputStream( getFileName() ) ); - LinkedList list = new LinkedList(); - Enumeration e = addressbook.keys(); - while( e.hasMoreElements() ) { - String name = (String)e.nextElement(); - String destination = addressbook.getProperty( name ); - if( filter != null && filter.length() > 0 ) { - if( filter.compareTo( "0-9" ) == 0 ) { - char first = name.charAt(0); - if( first < '0' || first > '9' ) - continue; - } - else if( ! name.toLowerCase().startsWith( filter.toLowerCase() ) ) { - continue; - } - } - if( search != null && search.length() > 0 ) { - if( name.indexOf( search ) == -1 ) { - continue; - } - } - list.addLast( new AddressBean( name, destination ) ); - } - - Object array[] = list.toArray(); - Arrays.sort( array, sorter ); - entries = array; - } - catch (Exception e) { - Debug.debug( e.getClass().getName() + ": " + e.getMessage() ); - } - if( message.length() > 0 ) message = "

" + message + "

"; return message; @@ -234,6 +247,10 @@ public class AddressbookBean { return getBook().compareToIgnoreCase( "router" ) == 0; } + public boolean isPublished() + { + return getBook().compareToIgnoreCase( "published" ) == 0; + } public void setFilter(String filter) { if( filter != null && ( filter.length() == 0 || filter.compareToIgnoreCase( "none" ) == 0 ) ) { filter = null; diff --git a/apps/susidns/src/jsp/addressbook.jsp b/apps/susidns/src/jsp/addressbook.jsp index 8c715842b..eec222aee 100644 --- a/apps/susidns/src/jsp/addressbook.jsp +++ b/apps/susidns/src/jsp/addressbook.jsp @@ -20,7 +20,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * - * $Revision: 1.1 $ + * $Revision: 1.2 $ */ %> <%@ page contentType="text/html"%> @@ -60,6 +60,8 @@
${book.messages}
+${book.loadBookMessages} +

Filter: a b @@ -115,16 +117,17 @@ - + - + + - +
  Name Destination
${addr.name} - @@ -136,7 +139,7 @@

- +

diff --git a/history.txt b/history.txt index ec3b61d80..0dc7fe00e 100644 --- a/history.txt +++ b/history.txt @@ -1,4 +1,9 @@ -$Id: history.txt,v 1.505 2006-08-03 17:34:25 jrandom Exp $ +$Id: history.txt,v 1.506 2006-08-21 00:55:34 complication Exp $ + +2006-09-03 Complication + * Limit form size in SusiDNS to avoid exceeding a POST size limit on postback + * Print messages about addressbook size to give better overview + * Enable delete function in published addressbook 2006-08-21 Complication * Fix error reporting discrepancy (thanks for helping notice, yojoe!) diff --git a/router/java/src/net/i2p/router/RouterVersion.java b/router/java/src/net/i2p/router/RouterVersion.java index 9f859bf52..e908d4058 100644 --- a/router/java/src/net/i2p/router/RouterVersion.java +++ b/router/java/src/net/i2p/router/RouterVersion.java @@ -15,9 +15,9 @@ import net.i2p.CoreVersion; * */ public class RouterVersion { - public final static String ID = "$Revision: 1.445 $ $Date: 2006-08-03 17:34:26 $"; + public final static String ID = "$Revision: 1.446 $ $Date: 2006-08-21 00:55:34 $"; public final static String VERSION = "0.6.1.24"; - public final static long BUILD = 4; + public final static long BUILD = 5; public static void main(String args[]) { System.out.println("I2P Router version: " + VERSION + "-" + BUILD); System.out.println("Router ID: " + RouterVersion.ID);