Author: bback
Date: 2006-02-11 19:22:16 +0000 (Sat, 11 Feb 2006)
New Revision: 8017

Modified:
   trunk/apps/frost-0.7/bin/config/frost.ini
   trunk/apps/frost-0.7/source/frost/Core.java
   trunk/apps/frost-0.7/source/frost/FileAccess.java
   trunk/apps/frost-0.7/source/frost/MainFrame.java
   trunk/apps/frost-0.7/source/frost/SettingsClass.java
   trunk/apps/frost-0.7/source/frost/Startup.java
   trunk/apps/frost-0.7/source/frost/boards/BoardsManager.java
   trunk/apps/frost-0.7/source/frost/boards/TofTree.java
   trunk/apps/frost-0.7/source/frost/fcp/FcpConnection.java
   trunk/apps/frost-0.7/source/frost/fcp/FcpInsert.java
   trunk/apps/frost-0.7/source/frost/fcp/FcpRequest.java
   trunk/apps/frost-0.7/source/frost/fileTransfer/FileTransferManager.java
   trunk/apps/frost-0.7/source/frost/fileTransfer/Index.java
   trunk/apps/frost-0.7/source/frost/fileTransfer/download/DownloadModel.java
   
trunk/apps/frost-0.7/source/frost/fileTransfer/download/DownloadModelXmlDAO.java
   trunk/apps/frost-0.7/source/frost/fileTransfer/download/DownloadPanel.java
   
trunk/apps/frost-0.7/source/frost/fileTransfer/download/DownloadStatusPanel.java
   
trunk/apps/frost-0.7/source/frost/fileTransfer/download/DownloadTableFormat.java
   trunk/apps/frost-0.7/source/frost/fileTransfer/download/DownloadThread.java
   trunk/apps/frost-0.7/source/frost/fileTransfer/download/DownloadTicker.java
   
trunk/apps/frost-0.7/source/frost/fileTransfer/download/DownloadTickerListener.java
   
trunk/apps/frost-0.7/source/frost/fileTransfer/download/FrostDownloadItem.java
   trunk/apps/frost-0.7/source/frost/fileTransfer/search/FrostSearchItem.java
   trunk/apps/frost-0.7/source/frost/fileTransfer/search/SearchThread.java
   trunk/apps/frost-0.7/source/frost/fileTransfer/upload/FrostUploadItem.java
   trunk/apps/frost-0.7/source/frost/fileTransfer/upload/UploadModel.java
   trunk/apps/frost-0.7/source/frost/fileTransfer/upload/UploadModelXmlDAO.java
   trunk/apps/frost-0.7/source/frost/fileTransfer/upload/UploadPanel.java
   trunk/apps/frost-0.7/source/frost/fileTransfer/upload/UploadTableFormat.java
   trunk/apps/frost-0.7/source/frost/fileTransfer/upload/UploadThread.java
   trunk/apps/frost-0.7/source/frost/fileTransfer/upload/UploadTicker.java
   trunk/apps/frost-0.7/source/frost/gui/AboutBox.java
   trunk/apps/frost-0.7/source/frost/gui/MessageFrame.java
   trunk/apps/frost-0.7/source/frost/messages/FrostIndex.java
   trunk/apps/frost-0.7/source/frost/messages/SharedFileObject.java
   trunk/apps/frost-0.7/source/frost/storage/DAOFactory.java
   trunk/apps/frost-0.7/source/frost/storage/HsqldbDAOFactory.java
   trunk/apps/frost-0.7/source/frost/storage/XmlDAOFactory.java
   trunk/apps/frost-0.7/source/frost/threads/MessageDownloadThread.java
   trunk/apps/frost-0.7/source/frost/threads/MessageUploadThread.java
   trunk/apps/frost-0.7/source/frost/threads/RunningBoardUpdateThreads.java
   trunk/apps/frost-0.7/source/frost/threads/UpdateIdThread.java
Log:
changes to get uploads and downloads running, and more

Modified: trunk/apps/frost-0.7/bin/config/frost.ini
===================================================================
--- trunk/apps/frost-0.7/bin/config/frost.ini   2006-02-11 18:54:59 UTC (rev 
8016)
+++ trunk/apps/frost-0.7/bin/config/frost.ini   2006-02-11 19:22:16 UTC (rev 
8017)
@@ -62,7 +62,7 @@
 maxAge=5
 maxKeys=500000
 maxMessageDisplay=15
-maxMessageDownload=0
+maxMessageDownload=5
 maxSearchResults=10000
 messageBase=news
 messageBodyAA=false

Modified: trunk/apps/frost-0.7/source/frost/Core.java
===================================================================
--- trunk/apps/frost-0.7/source/frost/Core.java 2006-02-11 18:54:59 UTC (rev 
8016)
+++ trunk/apps/frost-0.7/source/frost/Core.java 2006-02-11 19:22:16 UTC (rev 
8017)
@@ -39,7 +39,6 @@
 import frost.gui.objects.*;
 import frost.identities.*;
 import frost.messages.*;
-import frost.messaging.*;
 import frost.storage.*;
 import frost.threads.*;
 import frost.threads.maintenance.*;
@@ -57,7 +56,7 @@

        private static Logger logger = Logger.getLogger(Core.class.getName());

-       static Hashtable myBatches = new Hashtable();
+//     static Hashtable myBatches = new Hashtable();

        private static Core instance = new Core();
        private static Locale locale = null;
@@ -115,7 +114,6 @@
        private MainFrame mainFrame;
        private BoardsManager boardsManager;
        private FileTransferManager fileTransferManager;
-       private MessagingManager messagingManager;

        private FrostIdentities identities;
        private String keypool;
@@ -329,60 +327,60 @@
                return writeOK;
        }

-    private void loadBatches()
-    {
-        //load the batches
-        File batches = new File("batches");
-        if (batches.exists() && batches.length() > 0) //fix previous version 
bug
-               try {
-                       String allBatches = FileAccess.readFile(batches);
-                       String[] _batches = allBatches.split("_");
-                       //dumb.  will fix later
-        
-                       for (int i = 0; i < _batches.length; i++)
-                {
-                    myBatches.put(_batches[i], _batches[i]);
-                }
-        
-                       logger.info("loaded " + _batches.length + " batches of 
shared files");
-               } catch (Throwable e) {
-                               logger.log(Level.SEVERE, "couldn't load 
batches:", e);
-               }
-    }
+//    private void loadBatches()
+//    {
+//        //load the batches
+//        File batches = new File("batches");
+//        if (batches.exists() && batches.length() > 0) //fix previous version 
bug
+//             try {
+//                     String allBatches = FileAccess.readFile(batches);
+//                     String[] _batches = allBatches.split("_");
+//                     //dumb.  will fix later
+//        
+//                     for (int i = 0; i < _batches.length; i++)
+//                {
+//                    myBatches.put(_batches[i], _batches[i]);
+//                }
+//        
+//                     logger.info("loaded " + _batches.length + " batches of 
shared files");
+//             } catch (Throwable e) {
+//                             logger.log(Level.SEVERE, "couldn't load 
batches:", e);
+//             }
+//    }
+//    
+//     private boolean saveBatches() {
+//             try {
+//                     StringBuffer buf = new StringBuffer();
+//                     synchronized (getMyBatches()) {
+//                             Iterator i = getMyBatches().keySet().iterator();
+//                             while (i.hasNext()) {
+//                                     String current = (String) i.next();
+//                                     if (current.length() > 0) {
+//                                             buf.append(current);
+//                                             if (i.hasNext()) {
+//                                                     buf.append("_");
+//                                             }
+//                                     } else {
+//                                             i.remove(); //make sure no 
empty batches are saved
+//                                     }
+//                             }
+//                     }
+//                     File batches = new File("batches");
+//                     FileAccess.writeFile(buf.toString(), batches);
+//                     return true;
+//             } catch (Throwable t) {
+//                     logger.log(Level.SEVERE, "Exception thrown in 
saveBatches():", t);
+//             }
+//             return false;
+//     }

-       private boolean saveBatches() {
-               try {
-                       StringBuffer buf = new StringBuffer();
-                       synchronized (getMyBatches()) {
-                               Iterator i = getMyBatches().keySet().iterator();
-                               while (i.hasNext()) {
-                                       String current = (String) i.next();
-                                       if (current.length() > 0) {
-                                               buf.append(current);
-                                               if (i.hasNext()) {
-                                                       buf.append("_");
-                                               }
-                                       } else {
-                                               i.remove(); //make sure no 
empty batches are saved
-                                       }
-                               }
-                       }
-                       File batches = new File("batches");
-                       FileAccess.writeFile(buf.toString(), batches);
-                       return true;
-               } catch (Throwable t) {
-                       logger.log(Level.SEVERE, "Exception thrown in 
saveBatches():", t);
-               }
-               return false;
-       }
-    
        public static Crypt getCrypto() {
                return crypto;
        }

-       public static Hashtable getMyBatches() {
-               return myBatches;
-       }
+//     public static Hashtable getMyBatches() {
+//             return myBatches;
+//     }

        /**
         * Tries to send old messages that have not been sent yet
@@ -630,9 +628,9 @@
         // TODO: maybe make this configureable in optionsdialog for the 
paranoic people?
         String title;
         if( frostSettings.getBoolValue("mainframe.showSimpleTitle") == false ) 
{
-            title = "Frost - " + getIdentities().getMyId().getUniqueName();
+            title = "Frost for Freenet 0.7 - " + 
getIdentities().getMyId().getUniqueName();
         } else {
-            title = "Frost";
+            title = "Frost for Freenet 0.7";
         }

         // Display the tray icon (do this before mainframe initializes)
@@ -644,7 +642,6 @@

                // Main frame           
                mainFrame = new MainFrame(frostSettings, title);
-               getMessagingManager().initialize();
                getBoardsManager().initialize();
                getFileTransferManager().initialize();

@@ -654,7 +651,7 @@
         mainFrame.initialize();

                //load vital data
-               loadBatches();
+//             loadBatches();
                loadKnownBoards();

                if (isFreenetOnline()) {
@@ -694,19 +691,11 @@
                return fileTransferManager;
        }

-       private MessagingManager getMessagingManager() {
-               if (messagingManager == null) {
-                       messagingManager = new MessagingManager(frostSettings);
-               }
-               return messagingManager;
-       }
-       
        private BoardsManager getBoardsManager() {
                if (boardsManager == null) {
                        boardsManager = new BoardsManager(frostSettings);
                        boardsManager.setMainFrame(mainFrame);
                        boardsManager.setCore(this);
-                       
boardsManager.setMessageHashes(getMessagingManager().getMessageHashes());
                }
                return boardsManager;
        }
@@ -749,20 +738,18 @@
                StorageManager saver = new StorageManager(frostSettings, this);
                saver.addAutoSavable(this);
                saver.addAutoSavable(getIdentities());
-               saver.addAutoSavable(getMessagingManager().getMessageHashes());
                saver.addAutoSavable(getBoardsManager().getTofTree());
                saver.addAutoSavable(getFileTransferManager());
                saver.addExitSavable(this);
                saver.addExitSavable(getIdentities());
-               saver.addExitSavable(getMessagingManager().getMessageHashes());
                saver.addExitSavable(getBoardsManager().getTofTree());
                saver.addExitSavable(getFileTransferManager());
                saver.addExitSavable(frostSettings);

                // We initialize the task that helps requests of friends (delay 
5min, repeat all 6hrs)
-               if (frostSettings.getBoolValue("helpFriends")) {
-                       timer.schedule(new 
GetFriendsRequestsThread(identities), 5 * 60 * 1000, 6 * 60 * 60 * 1000);
-        }
+//             if (frostSettings.getBoolValue("helpFriends")) {
+//                     timer.schedule(new 
GetFriendsRequestsThread(identities), 5 * 60 * 1000, 6 * 60 * 60 * 1000);
+//        }
        }

        /**
@@ -814,8 +801,8 @@
         */
        public void save() throws StorageException {
                boolean saveOK;
-               saveOK = saveBatches();
-               saveOK &= saveKnownBoards();
+//             saveOK = saveBatches();
+               saveOK = saveKnownBoards();
                if (!saveOK) {
                        throw new StorageException("Error while saving the core 
items.");
                }

Modified: trunk/apps/frost-0.7/source/frost/FileAccess.java
===================================================================
--- trunk/apps/frost-0.7/source/frost/FileAccess.java   2006-02-11 18:54:59 UTC 
(rev 8016)
+++ trunk/apps/frost-0.7/source/frost/FileAccess.java   2006-02-11 19:22:16 UTC 
(rev 8017)
@@ -113,69 +113,69 @@
     /**
      * Writes zip file
      */
-    public static boolean writeZipFile(byte[] content, String entry, File 
file) {
-       if (content == null || content.length == 0) {
-               Exception e = new Exception();
-               e.fillInStackTrace();
-                       logger.log(Level.SEVERE, "Tried to zip an empty file!  
Send this output to a dev"+
-                                                                       " and 
describe what you were doing.", e);
-               return false;
-       }
-        try {
-            ZipOutputStream zos = new ZipOutputStream(new 
FileOutputStream(file));
-            zos.setLevel(9); // maximum compression
-            ZipEntry ze = new ZipEntry(entry);
-            ze.setSize(content.length);
-            zos.putNextEntry(ze);
-            zos.write(content);
-                       zos.flush(); //do this before closeEntry()
-            zos.closeEntry();
-            zos.close();
-            return true;
-        } catch( Throwable e ) {
-                       logger.log(Level.SEVERE, "Exception thrown in 
writeZipFile(byte[] content, String entry, File file)", e);
-            return false;
-        }
-    }
+//    public static boolean writeZipFile(byte[] content, String entry, File 
file) {
+//     if (content == null || content.length == 0) {
+//             Exception e = new Exception();
+//             e.fillInStackTrace();
+//                     logger.log(Level.SEVERE, "Tried to zip an empty file!  
Send this output to a dev"+
+//                                                                     " and 
describe what you were doing.", e);
+//             return false;
+//     }
+//        try {
+//            ZipOutputStream zos = new ZipOutputStream(new 
FileOutputStream(file));
+//            zos.setLevel(9); // maximum compression
+//            ZipEntry ze = new ZipEntry(entry);
+//            ze.setSize(content.length);
+//            zos.putNextEntry(ze);
+//            zos.write(content);
+//                     zos.flush(); //do this before closeEntry()
+//            zos.closeEntry();
+//            zos.close();
+//            return true;
+//        } catch( Throwable e ) {
+//                     logger.log(Level.SEVERE, "Exception thrown in 
writeZipFile(byte[] content, String entry, File file)", e);
+//            return false;
+//        }
+//    }

     /**
      * Reads first zip file entry and returns content in a byte[].
      */
-    public static byte[] readZipFileBinary(File file) {
-               if( !file.isFile() || file.length() == 0 ) {
-                       return null;
-        }
+//    public static byte[] readZipFileBinary(File file) {
+//             if( !file.isFile() || file.length() == 0 ) {
+//                     return null;
+//        }
+//
+//             final int bufferSize = 4096;
+//        ZipInputStream zis = null;
+//             try {
+//            zis = new ZipInputStream(new FileInputStream(file));
+//            ByteArrayOutputStream out = new ByteArrayOutputStream();
+//                     zis.getNextEntry();
+//            
+//                     byte[] zipData = new byte[bufferSize];
+//                     while( true ) {
+//                int len = zis.read(zipData);
+//                if( len < 0 ) {
+//                    break;
+//                }
+//                out.write(zipData, 0, len);
+//                     }
+//            zis.close();
+//                     return out.toByteArray();
+//
+//             } catch( FileNotFoundException e ) {
+//                     logger.log(Level.SEVERE, "Exception thrown in 
readZipFile(String path)", e);
+//             }
+//        catch( IOException e ) {
+//            try { if( zis != null) zis.close(); } catch(Throwable t) { }
+//            logger.log(Level.SEVERE, "Exception thrown in readZipFile(String 
path) \n" + 
+//                                     "Offending file saved as badfile.zip, 
send to a dev for analysis", e);
+//            copyFile(file.getPath(), "badfile.zip");
+//        }
+//             return null;
+//    }

-               final int bufferSize = 4096;
-        ZipInputStream zis = null;
-               try {
-            zis = new ZipInputStream(new FileInputStream(file));
-            ByteArrayOutputStream out = new ByteArrayOutputStream();
-                       zis.getNextEntry();
-            
-                       byte[] zipData = new byte[bufferSize];
-                       while( true ) {
-                int len = zis.read(zipData);
-                if( len < 0 ) {
-                    break;
-                }
-                out.write(zipData, 0, len);
-                       }
-            zis.close();
-                       return out.toByteArray();
-
-               } catch( FileNotFoundException e ) {
-                       logger.log(Level.SEVERE, "Exception thrown in 
readZipFile(String path)", e);
-               }
-        catch( IOException e ) {
-            try { if( zis != null) zis.close(); } catch(Throwable t) { }
-            logger.log(Level.SEVERE, "Exception thrown in readZipFile(String 
path) \n" + 
-                                     "Offending file saved as badfile.zip, 
send to a dev for analysis", e);
-            copyFile(file.getPath(), "badfile.zip");
-        }
-               return null;
-    }
-
     /**
      * Reads file and returns a Vector of lines
      */

Modified: trunk/apps/frost-0.7/source/frost/MainFrame.java
===================================================================
--- trunk/apps/frost-0.7/source/frost/MainFrame.java    2006-02-11 18:54:59 UTC 
(rev 8016)
+++ trunk/apps/frost-0.7/source/frost/MainFrame.java    2006-02-11 19:22:16 UTC 
(rev 8017)
@@ -36,8 +36,6 @@
 import javax.swing.tree.*;

 import frost.boards.*;
-import frost.components.*;
-import frost.components.translate.*;
 import frost.ext.*;
 import frost.fileTransfer.download.*;
 import frost.fileTransfer.search.*;
@@ -1634,11 +1632,11 @@
     //Options Menu
     private JMenu optionsMenu = new JMenu();
     private JMenuItem optionsPreferencesMenuItem = new JMenuItem();
-    private JMenuItem pluginBrowserMenuItem = new JMenuItem();
+//    private JMenuItem pluginBrowserMenuItem = new JMenuItem();

     //Plugin Menu
-    private JMenu pluginMenu = new JMenu();
-    private JMenuItem pluginTranslateMenuItem = new JMenuItem();
+//    private JMenu pluginMenu = new JMenu();
+//    private JMenuItem pluginTranslateMenuItem = new JMenuItem();

     //Popups
     private JButton removeBoardButton = null;
@@ -1990,18 +1988,18 @@
                     tofDisplayKnownBoardsMenuItem_actionPerformed(e);
                 }
             });
-            pluginBrowserMenuItem.addActionListener(new ActionListener() {
-                public void actionPerformed(ActionEvent e) {
-                    BrowserFrame browser = new BrowserFrame(true);
-                    browser.setVisible(true);
-                }
-            });
-            pluginTranslateMenuItem.addActionListener(new ActionListener() {
-                public void actionPerformed(ActionEvent e) {
-                    TranslateFrame translate = new TranslateFrame(true);
-                    translate.setVisible(true);
-                }
-            });
+//            pluginBrowserMenuItem.addActionListener(new ActionListener() {
+//                public void actionPerformed(ActionEvent e) {
+//                    BrowserFrame browser = new BrowserFrame(true);
+//                    browser.setVisible(true);
+//                }
+//            });
+//            pluginTranslateMenuItem.addActionListener(new ActionListener() {
+//                public void actionPerformed(ActionEvent e) {
+//                    TranslateFrame translate = new TranslateFrame(true);
+//                    translate.setVisible(true);
+//                }
+//            });
             languageDefaultMenuItem.addActionListener(new ActionListener() {
                 public void actionPerformed(ActionEvent e) {
                     ResourceBundle bundle = 
ResourceBundle.getBundle("res.LangRes");
@@ -2098,8 +2096,8 @@
             // Options Menu
             optionsMenu.add(optionsPreferencesMenuItem);
             // Plugin Menu
-            pluginMenu.add(pluginBrowserMenuItem);
-            pluginMenu.add(pluginTranslateMenuItem);
+//            pluginMenu.add(pluginBrowserMenuItem);
+//            pluginMenu.add(pluginTranslateMenuItem);
             // Language Menu
             ButtonGroup languageMenuButtonGroup = new ButtonGroup();
             languageDefaultMenuItem.setSelected(true);
@@ -2148,7 +2146,7 @@
             menuBar.add(fileMenu);
             menuBar.add(tofMenu);
             menuBar.add(optionsMenu);
-            menuBar.add(pluginMenu);
+//            menuBar.add(pluginMenu);
             menuBar.add(languageMenu);
             menuBar.add(helpMenu);

@@ -2663,9 +2661,9 @@
         tofDisplayKnownBoards.setText(language.getString("Display known 
boards"));
         optionsMenu.setText(language.getString("Options"));
         optionsPreferencesMenuItem.setText(language.getString("Preferences"));
-        pluginMenu.setText(language.getString("Plugins"));
-        pluginBrowserMenuItem.setText(language.getString("Experimental Freenet 
Browser"));
-        pluginTranslateMenuItem.setText(language.getString("Translate Frost 
into another language"));
+//        pluginMenu.setText(language.getString("Plugins"));
+//        pluginBrowserMenuItem.setText(language.getString("Experimental 
Freenet Browser"));
+//        pluginTranslateMenuItem.setText(language.getString("Translate Frost 
into another language"));
         languageMenu.setText(language.getString("Language"));
         languageDefaultMenuItem.setText(language.getString("Default"));
         languageDutchMenuItem.setText(language.getString("Dutch"));

Modified: trunk/apps/frost-0.7/source/frost/SettingsClass.java
===================================================================
--- trunk/apps/frost-0.7/source/frost/SettingsClass.java        2006-02-11 
18:54:59 UTC (rev 8016)
+++ trunk/apps/frost-0.7/source/frost/SettingsClass.java        2006-02-11 
19:22:16 UTC (rev 8017)
@@ -78,14 +78,6 @@
                if (!readSettingsFile()) {
                        writeSettingsFile();
                }
-               // TODO: remove this, and use default or loaded value
-               // i need to add because i used 'unsent' as name in former
-               // CVS versions. So if you already have this settings: its 
wrong!
-               // we need the '#' to separate internal boards in keypool from 
normal board.
-               // normal board file names are not allowed to contain '#'.
-               // once all users have the '#unsent#' folder configured, this 
can be removed
-               // and you can change the directory location
-               settingsHash.put("unsent.dir", "localdata" + fs + "unsent" + 
fs);
        }

        private String setSystemsFileSeparator(String path) {
@@ -166,6 +158,7 @@
                                                // scan all path config values 
and set correct system file separator
                                                else if (
                                                        key.equals("unsent.dir")
+                                || key.equals("sent.dir")
                                                                || 
key.equals("temp.dir")
                                                                || 
key.equals("keypool.dir")
                                 || key.equals("archive.dir")) {
@@ -553,6 +546,7 @@
                // DIRECTORIES
                defaults.put("keypool.dir", "keypool" + fs);
                defaults.put("unsent.dir", "localdata" + fs + "unsent" + fs);
+        defaults.put("sent.dir", "localdata" + fs + "sent" + fs);
                defaults.put("temp.dir", "localdata" + fs + "temp" + fs);
         defaults.put("archive.dir", "archive" + fs);


Modified: trunk/apps/frost-0.7/source/frost/Startup.java
===================================================================
--- trunk/apps/frost-0.7/source/frost/Startup.java      2006-02-11 18:54:59 UTC 
(rev 8016)
+++ trunk/apps/frost-0.7/source/frost/Startup.java      2006-02-11 19:22:16 UTC 
(rev 8017)
@@ -84,6 +84,12 @@
             unsentDirectory.mkdirs();
         }

+        File sentDirectory = new File(settings.getValue("sent.dir"));
+        if( !sentDirectory.isDirectory() ) {
+            logger.warning("Creating sent directory");
+            sentDirectory.mkdirs();
+        }
+
         File tempDirectory = new File(settings.getValue("temp.dir"));
         if( !tempDirectory.isDirectory() ) {
             logger.warning("Creating temp directory");

Modified: trunk/apps/frost-0.7/source/frost/boards/BoardsManager.java
===================================================================
--- trunk/apps/frost-0.7/source/frost/boards/BoardsManager.java 2006-02-11 
18:54:59 UTC (rev 8016)
+++ trunk/apps/frost-0.7/source/frost/boards/BoardsManager.java 2006-02-11 
19:22:16 UTC (rev 8017)
@@ -5,9 +5,7 @@
 package frost.boards;

 import frost.*;
-import frost.MainFrame;
-import frost.gui.objects.Board;
-import frost.messaging.MessageHashes;
+import frost.gui.objects.*;

 /**
  * @author $Author: kevloral $
@@ -22,19 +20,12 @@

        private SettingsClass settings;
        private Core core;
-       private MessageHashes messageHashes;

-       /**
-        * 
-        */
        public BoardsManager(SettingsClass settings) {
                super();
                this.settings = settings;
        }

-       /**
-        * 
-        */
        public void initialize() {
                TOF.initialize(getTofTreeModel());
                getTofTree().initialize();
@@ -55,7 +46,6 @@
                        tofTree.setSettings(settings);
                        tofTree.setCore(core);
                        tofTree.setMainFrame(mainFrame);
-                       tofTree.setMessageHashes(messageHashes);
                }
                return tofTree;
        }
@@ -87,11 +77,4 @@
        public void setCore(Core core) {
                this.core = core;               
        }
-
-       /**
-        * @param messageHashes
-        */
-       public void setMessageHashes(MessageHashes messageHashes) {
-               this.messageHashes = messageHashes;             
-       }
 }

Modified: trunk/apps/frost-0.7/source/frost/boards/TofTree.java
===================================================================
--- trunk/apps/frost-0.7/source/frost/boards/TofTree.java       2006-02-11 
18:54:59 UTC (rev 8016)
+++ trunk/apps/frost-0.7/source/frost/boards/TofTree.java       2006-02-11 
19:22:16 UTC (rev 8017)
@@ -20,19 +20,17 @@

 import java.awt.*;
 import java.awt.event.*;
-import java.io.File;
-import java.util.Enumeration;
-import java.util.logging.Logger;
+import java.io.*;
+import java.util.*;
+import java.util.logging.*;

 import javax.swing.*;
 import javax.swing.event.*;
 import javax.swing.tree.*;

 import frost.*;
-import frost.gui.NewBoardDialog;
-import frost.gui.model.*;
-import frost.gui.objects.Board;
-import frost.messaging.MessageHashes;
+import frost.gui.*;
+import frost.gui.objects.*;
 import frost.storage.*;
 import frost.threads.*;
 import frost.util.gui.*;
@@ -542,7 +540,6 @@
        private Board clipboard = null;

        private RunningBoardUpdateThreads runningBoardUpdateThreads = null;
-       private MessageHashes messageHashes;

     /**
         * @param root
@@ -604,7 +601,6 @@

                // enable the machine ;)
                runningBoardUpdateThreads = new 
RunningBoardUpdateThreads(mainFrame, core.getIdentities(), settings);
-               runningBoardUpdateThreads.setMessageHashes(messageHashes);
        }

        /**
@@ -1035,8 +1031,7 @@
                boolean threadStarted = false;

                // first download the messages of today
-               if (getRunningBoardUpdateThreads()
-                       .isThreadOfTypeRunning(board, 
BoardUpdateThread.MSG_DNLOAD_TODAY)
+               if (getRunningBoardUpdateThreads().isThreadOfTypeRunning(board, 
BoardUpdateThread.MSG_DNLOAD_TODAY)
                        == false) {
                        
getRunningBoardUpdateThreads().startMessageDownloadToday(
                                board,
@@ -1104,10 +1099,4 @@
                return pasteBoardButton;
        }

-       /**
-        * @param messageHashes
-        */
-       public void setMessageHashes(MessageHashes messageHashes) {
-               this.messageHashes = messageHashes;             
-       }
 }
\ No newline at end of file

Modified: trunk/apps/frost-0.7/source/frost/fcp/FcpConnection.java
===================================================================
--- trunk/apps/frost-0.7/source/frost/fcp/FcpConnection.java    2006-02-11 
18:54:59 UTC (rev 8016)
+++ trunk/apps/frost-0.7/source/frost/fcp/FcpConnection.java    2006-02-11 
19:22:16 UTC (rev 8017)
@@ -23,14 +23,10 @@

 import java.io.*;
 import java.net.*;
-import java.nio.charset.Charset;
+import java.nio.*;
 import java.util.*;
 import java.util.logging.*;

-import java.nio.ByteBuffer;
-
-
-
 import frost.*;

 /**
@@ -455,7 +451,7 @@

                key = FcpDisconnect(key);

-               //srippping slasshes
+               // stripping slashes
                key = StripSlashes(key);
                fcpSock = new Socket(host, port);
                fcpSock.setSoTimeout(TIMEOUT);
@@ -472,7 +468,6 @@
                fcpOut.println("URI=" + key);
                System.out.println("URI="+key);

-
                int dataLength = 0;
                int metadataLength = 0;
                if (data != null) {
@@ -486,7 +481,6 @@
                fcpOut.println("DataLength=" + Integer.toString(dataLength + 
metadataLength + 4));
                System.out.println("DataLength="+ Integer.toString(dataLength + 
metadataLength + 4));

-               
                fcpOut.println("Identifier=put-" + 
Thread.currentThread().getId() );
                System.out.println("Identifier=put-" + 
Thread.currentThread().getId());
                fcpOut.println("Verbosity=0");
@@ -514,7 +508,6 @@
                        //System.out.println( new 
String(metadata,Charset.defaultCharset().toString())   );
                }

-               
                if (data != null) {
                        dOut.write(data);
                        //System.out.println( new 
String(data,Charset.defaultCharset().toString())   );

Modified: trunk/apps/frost-0.7/source/frost/fcp/FcpInsert.java
===================================================================
--- trunk/apps/frost-0.7/source/frost/fcp/FcpInsert.java        2006-02-11 
18:54:59 UTC (rev 8016)
+++ trunk/apps/frost-0.7/source/frost/fcp/FcpInsert.java        2006-02-11 
19:22:16 UTC (rev 8017)
@@ -126,9 +126,9 @@
      * for inserting e.g. the pubkey.txt file set it to null.
      * This method wraps the calls without the uploadItem.
      */
-    public static String[] putFile(String uri, File file, int htl, boolean 
doRedirect) {
-        return putFile(uri, file, null, htl, doRedirect, null);
-    }
+//    public static String[] putFile(String uri, File file, int htl, boolean 
doRedirect) {
+//        return putFile(uri, file, null, htl, doRedirect, null);
+//    }

     public static String[] putFile(String uri, File file, byte[]metadata, int 
htl, boolean doRedirect) {
         return putFile(uri, file, metadata, htl, doRedirect, null);
@@ -158,10 +158,6 @@
             return ERROR;
         }

-        
-
-        
-        
         try {
             FcpConnection connection = FcpFactory.getFcpConnectionInstance();
             if( connection == null ) {
@@ -169,10 +165,11 @@
             }

             byte[] data = FileAccess.readByteArray(file);
-            if ( doRedirect ){
-               System.out.println("REDIRECT requested!");
-            }
-            String output = workaroundPutKeyFromArray(connection, uri, data, 
metadata, htl);
+//            if ( doRedirect ){
+//             System.out.println("REDIRECT requested!");
+//            }
+            String output = connection.putKeyFromArray(uri, data, metadata, 
htl, false);
+//            String output = workaroundPutKeyFromArray(connection, uri, data, 
metadata, htl);

             return result(output);

@@ -201,10 +198,6 @@
             return ERROR;
         }

-        
-
-        
-        
         try {
             FcpConnection connection = FcpFactory.getFcpConnectionInstance();
             if( connection == null ) {
@@ -225,51 +218,46 @@
         }

         return ERROR;
-        
-       
-       
     }

-    
-    
     /**
      * Method calls FcpConnection.putKeyFromArray() and works around a freenet 
bug:
      * sometimes freenet closes the socket without to provide an EndMessage.
      * The output is < 5 characters then. If this is received, the insert is 
restarted.
      * TODO: please remove this workaround when the freenet devs fix the FCP 
insert 
      */
-    private static String workaroundPutKeyFromArray(
-            FcpConnection connection, String key, byte[] data, byte[] 
metadata, int htl) throws IOException {
-
-        int loop = 0;
-        final int maxLoops = 16; // high value for sure, should never happen
-
-        while(true) {
-                       String output = "";
-               try{
-                       output = connection.putKeyFromArray(key, data, 
metadata, htl, false);
-               }catch (FcpToolsException e){
-                       System.out.println("no connection to node");
-               }
-            if( output.length() < 5 ) { // actually the length is 1, but just 
in case...
-                if( loop < maxLoops ) {
-                    logger.warning("Freenet insert failed, maybe a freenet bug 
(output="+output+"). Loop "+loop+". Trying again...");
-                    System.out.println("Freenet insert failed, maybe a freenet 
bug (output="+output+"). Loop "+loop+". Trying again...");
-                    loop++;
-                    Mixed.wait(333);
-                    continue;
-                } else {
-                    logger.severe("Freenet insert failed due to freenet bug, 
tried "+loop+" times (output="+output+").");
-                    System.out.println("Freenet insert failed due to freenet 
bug, tried "+loop+" times (output="+output+").");
-                    return null;
-                }
-            } else {
-                logger.info("Freenet insert ended, loop="+loop+", output from 
fcp insert : "+output);
-                System.out.println("Freenet insert ended, loop="+loop+", 
output from fcp insert : "+output);
-                return output;
-            }
-        }
-    }
+//    private static String workaroundPutKeyFromArray(
+//            FcpConnection connection, String key, byte[] data, byte[] 
metadata, int htl) throws IOException {
+//
+//        int loop = 0;
+//        final int maxLoops = 16; // high value for sure, should never happen
+//
+//        while(true) {
+//                     String output = "";
+//             try{
+//                     output = connection.putKeyFromArray(key, data, 
metadata, htl, false);
+//             }catch (FcpToolsException e){
+//                     System.out.println("no connection to node");
+//             }
+//            if( output.length() < 5 ) { // actually the length is 1, but 
just in case...
+//                if( loop < maxLoops ) {
+//                    logger.warning("Freenet insert failed, maybe a freenet 
bug (output="+output+"). Loop "+loop+". Trying again...");
+//                    System.out.println("Freenet insert failed, maybe a 
freenet bug (output="+output+"). Loop "+loop+". Trying again...");
+//                    loop++;
+//                    Mixed.wait(333);
+//                    continue;
+//                } else {
+//                    logger.severe("Freenet insert failed due to freenet bug, 
tried "+loop+" times (output="+output+").");
+//                    System.out.println("Freenet insert failed due to freenet 
bug, tried "+loop+" times (output="+output+").");
+//                    return null;
+//                }
+//            } else {
+//                logger.info("Freenet insert ended, loop="+loop+", output 
from fcp insert : "+output);
+//                System.out.println("Freenet insert ended, loop="+loop+", 
output from fcp insert : "+output);
+//                return output;
+//            }
+//        }
+//    }

 }


Modified: trunk/apps/frost-0.7/source/frost/fcp/FcpRequest.java
===================================================================
--- trunk/apps/frost-0.7/source/frost/fcp/FcpRequest.java       2006-02-11 
18:54:59 UTC (rev 8016)
+++ trunk/apps/frost-0.7/source/frost/fcp/FcpRequest.java       2006-02-11 
19:22:16 UTC (rev 8017)
@@ -19,14 +19,11 @@
 package frost.fcp;

 import java.io.*;
-import java.util.*;
 import java.util.logging.*;

 import frost.*;
+import frost.fileTransfer.download.*;

-import frost.fileTransfer.download.FrostDownloadItem;
-import frost.threads.getKeyThread;
-
 /**
  * Requests a key from freenet
  */
@@ -38,19 +35,7 @@
        final static boolean DEBUG = true;

        private static Logger logger = 
Logger.getLogger(FcpRequest.class.getName());
-       
-    private static int getActiveThreads(Thread[] threads) {
-        int count = 0;
-        for( int i = 0; i < threads.length; i++ ) {
-            if( threads[i] != null ) {
-                if( threads[i].isAlive() )
-                    count++;
-            }
-        }
-        return count;
-    }

-    
     /**
      * getFile retrieves a file from Freenet. It does detect if this file is a 
redirect, a splitfile or
      * just a simple file. It checks the size for the file and returns false 
if sizes do not match.
@@ -93,9 +78,6 @@
                                   boolean createTempFile, 
                                   FrostDownloadItem dlItem)
     {
-       
-       
-       
         File tempFile = null;
         if( createTempFile ) {
             try {
@@ -109,218 +91,32 @@
         }

         // First we just download the file, not knowing what lies ahead
-       
-        FcpResults results =null;
-        String [] metadataLines=null;
+        FcpResults results = getKey(key, tempFile, htl, fastDownload);

-        if (dlItem!=null && dlItem.getRedirect() !=null) {
-               results = new FcpResults(dlItem.getRedirect().getBytes(), 
dlItem.getKey());
-               logger.info("starting download of an attached redirect");
-               System.out.println("starting download of an attached redirect");
-        } else {  
-               results = getKey(key, tempFile, htl, fastDownload);
-        }
+        if( results != null ) {

-        System.out.println("REDIRECT requested");
-        System.out.println("RESULTS:/n");
-        System.out.println(tempFile.getName());
-        System.out.println(tempFile.length());
+//        System.out.println("RESULTS:");
+//        System.out.println(tempFile.getName());
+//        System.out.println(tempFile.length());

-        
-        if (results !=null) {
-               metadataLines = results.getMetadataAsLines();
-        }
-        
-        //NOT NEEDED IN FCP2!!
-        /*
-        if( results != null &&  
-            ( tempFile.length() > 0 || metadataLines != null ) 
-          )
-        {
-            if( metadataLines != null &&
-                // tempFile.length() <= 65536 &&  --bback: redirect file can 
be greater than 65536!
-                doRedirect )
-            { // File may be a redirect
-                // Check if this file is a redirect and if there is a key to 
the file in the metadata
-                String redirectCHK = getRedirectCHK( metadataLines, key );
-
-                if( redirectCHK != null ) { // File is a redirect
-                    logger.info("Redirecting to " + redirectCHK);
-
-                    results = null;
-                    results = getKey(redirectCHK, tempFile, htl, fastDownload);
-                    if( results == null || tempFile.length() == 0 )
-                    {
-                        // remove temporary file if download failed
-                        tempFile.delete();
-                        return null;
-                    }
-                }
-            }
-            */
-        
-               /*NOT HANDLED HERE ANYMORE FCP2
-            // Check if file is a splitfile.
-             */
-               /*
-            boolean isSplitfile = false;
-            if( metadataLines != null )
-            {
-                String content[] = metadataLines;
-                String algoName = null;
-                for( int i = 0; i < content.length; i++ )
-                {
-                    if( content[i].startsWith("SplitFile.Size") ) 
-                        isSplitfile = true;
-                    if( content[i].startsWith("SplitFile.AlgoName") )
-                    {
-                        algoName = 
content[i].substring(content[i].indexOf("=")+1).trim();                         
-                    }
-                }
-                if( isSplitfile )
-                { // File is a splitfile
-                    boolean success;
-                    if( algoName != null && algoName.equals("OnionFEC_a_1_2") )
-                    {
-                        // save metadata to temp file
-                        FileAccess.writeFile(results.getRawMetadata(), 
tempFile);
-                        
-                        success = getFECSplitFile(target, tempFile, htl, 
dlItem);
-                        // this method handles all working files, no more 
needed here
-                        if( success )
-                        {
-                            return results; // return the metadata
-                        }
-                        return null;
-                    }
-                    else
-                    {  //FIXME: we could probably remove support for non-fec 
splitfiles
-                       //its been years since they were used
-                        success = getSplitFile(key, tempFile, htl, dlItem);
-                    }
-                        
-                    if( success )
-                    {
-                        // If the target file exists, we remove it
-                        if( target.isFile() )
-                            target.delete();
-                        tempFile.renameTo(target);
-                        return results; // return the metadata
-                    }
-                    else
-                    {
-                        // remove temporary file (e.g. redirect file) if 
download failed
-                        tempFile.delete();
-                        return null;
-                    }
-                }
-            }*/
-
-            // download should be successful now
-            //if( size == null || size.longValue() == tempFile.length() )
-            //{
             // If the target file exists, we remove it
-            if( target.isFile() )
+            if( target.isFile() ) {
                 target.delete();
+            }
+            
             boolean wasOK = tempFile.renameTo(target);
-            if( wasOK == false )
-            {
+            if( wasOK == false ) {
                logger.severe("ERROR: Could not move file '" + 
tempFile.getPath() + "' to '" + target.getPath() + "'.\n" +
                                          "Maybe the locations are on different 
filesystems where a move is not allowed.\n" +
                                          "Please try change the location of 
'temp.dir' in the frost.ini file,"+
                               " and copy the file to a save location by 
yourself.");
-               tempFile.delete();
                return null;
-               
+            } else {
+                return results;
             }
-                
-            
-            return results;
-      
-    }
-
-    private static String getRedirectCHK(String[] metadata, String key)
-    {
-/*
-SAMPLE URL:
-------------
-
-SSK at CKesZYUJWn2GMvoif1R4SDbujIgPAgM/fuqid/9//FUQID-1.2.zip
-
-METAFILE FORMAT:
------------------
-Version
-Revision=1
-EndPart
-Document
-Redirect.Target=freenet:CHK at 
OvGKjXgv3CpQ50AhHumTxQ1TQdkOAwI,eMG88L0X0H82rQjM4h1y4g
-Name=index.html
-Info.Format=text/html
-EndPart
-Document
-Redirect.Target=freenet:CHK@~ZzKVquUvXfnbaI5bR12wvu99-4LAwI,~QYjCzYNT6E~kVIbxF7DoA
-Name=activelink.png
-Info.Format=image/png
-EndPart
-Document
-Redirect.Target=freenet:CHK at 
9rz6vjVwOBPn6GhxmSsl5ZUf9SgUAwI,09Tt5bS-bsGWZiNSzLD38A
-Name=FUQID-1.2.zip
-Info.Format=application/zip
-End
-Document
-*/
-        String searchedFilename = null;
-        int pos1 = key.lastIndexOf("/");
-        if( pos1 > -1 )
-        {
-            searchedFilename = key.substring(pos1+1).trim();
-            if( searchedFilename.length() == 0 )
-                searchedFilename = null;
-
         }
-        if( searchedFilename == null )
-            return null; // no filename found in key
-
-        // scan through lines and find the Redirect.Target=(CHK) for Name=(our 
searchedFilename)
-        // and get the CHK of the file
-        final String keywordName = "Name=";
-        final String keywordRedirTarget = "Redirect.Target=";
-        String actualFilename = null;
-        String actualCHK = null;
-        String resultCHK = null;
-        for( int lineno = 0; lineno < metadata.length; lineno++ )
-        {
-            String line = metadata[lineno].trim();
-            if( line.length() == 0 )
-                continue;
-
-            if( line.equals("Document") )
-            {
-                // new file section begins
-                actualFilename = null;
-                actualCHK = null;
-            }
-            else if( line.equals("End") || line.equals("EndPart") )
-            {
-                // we should have actualFilename and actualCHK now, look if 
this is our searched file
-                if( actualCHK != null && actualFilename != null )
-                {
-                    if( actualFilename.equals( searchedFilename ) )
-                    {
-                        resultCHK = actualCHK;
-                        return resultCHK;
-                    }
-                }
-            }
-            else if( line.startsWith(keywordName) )
-            {
-                actualFilename = line.substring( keywordName.length() ).trim();
-            }
-            else if( line.startsWith(keywordRedirTarget) )
-            {
-                actualCHK = line.substring( keywordRedirTarget.length() 
).trim();
-            }
-        }
+        // if we reach here, the download was NOT successful in any way
+        tempFile.delete();
         return null;
     }

@@ -392,10 +188,11 @@
             logger.info("getKey - Success: " + printableKey );
             System.out.println("getKey - Success: " + printableKey );
             return results;
+        } else {
+            target.delete();
+            logger.info("getKey - Failed: " + printableKey );
+            System.out.println("getKey - Failed: " + printableKey );
+            return null;
         }
-        target.delete();
-        logger.info("getKey - Failed: " + printableKey );
-        System.out.println("getKey - Failed: " + printableKey );
-        return null;
     }
 }

Modified: 
trunk/apps/frost-0.7/source/frost/fileTransfer/FileTransferManager.java
===================================================================
--- trunk/apps/frost-0.7/source/frost/fileTransfer/FileTransferManager.java     
2006-02-11 18:54:59 UTC (rev 8016)
+++ trunk/apps/frost-0.7/source/frost/fileTransfer/FileTransferManager.java     
2006-02-11 19:22:16 UTC (rev 8017)
@@ -55,14 +55,6 @@
                //Until the downloads and uploads are fully separated from 
frame1:
                mainFrame.setDownloadModel(getDownloadManager().getModel());
                mainFrame.setUploadPanel(getUploadManager().getPanel());
-               
-               Thread requestsThread =
-                       new GetRequestsThread(
-                               settings.getIntValue("tofDownloadHtl"),
-                               settings.getValue("keypool.dir"),
-                               getUploadManager().getModel(),
-                               identities);
-               requestsThread.start();
        }

        /**

Modified: trunk/apps/frost-0.7/source/frost/fileTransfer/Index.java
===================================================================
--- trunk/apps/frost-0.7/source/frost/fileTransfer/Index.java   2006-02-11 
18:54:59 UTC (rev 8016)
+++ trunk/apps/frost-0.7/source/frost/fileTransfer/Index.java   2006-02-11 
19:22:16 UTC (rev 8017)
@@ -150,10 +150,10 @@

                        SharedFileObject current = (SharedFileObject) i.next();

-            if( current.getSHA1() == null ) {
-                logger.log(Level.WARNING, "Index.add(): keys SHA1 is null: 
"+current.getFilename());
-                continue;
-            }
+//            if( current.getSHA1() == null ) {
+//                logger.log(Level.WARNING, "Index.add(): keys SHA1 is null: 
"+current.getFilename());
+//                continue;
+//            }

                        if (addOnlyFromThisOwner != null &&
                 current.getOwner() != null && 
@@ -173,11 +173,11 @@
                                updateDownloadTable(current);
             }

-                       SharedFileObject old = (SharedFileObject) 
idx.getFilesMap().get(current.getSHA1());
+                       SharedFileObject old = (SharedFileObject) 
idx.getFilesMap().get(current.getKey());

                        if (old == null) {
                 // add new file
-                               idx.getFilesMap().put(current.getSHA1(), 
current);
+                               idx.getFilesMap().put(current.getKey(), 
current);
                        } else {
                 // update existing file
                 old.setDate(current.getDate());
@@ -194,23 +194,23 @@
      * @param idx  FrostIndex to zip
      * @return  length of zipped content
      */
-    private long determineZippedSize(FrostIndex idx) {
-        File tmp = null;
-        try {
-            tmp = File.createTempFile("index_", ".ziptmp", new 
File(MainFrame.frostSettings.getValue("temp.dir")));
-        } catch(Exception ex) {
-            // this should never happen, but for the case ...
-            tmp = new File("index_"+System.currentTimeMillis());
-        }
+//    private long determineZippedSize(FrostIndex idx) {
+//        File tmp = null;
+//        try {
+//            tmp = File.createTempFile("index_", ".ziptmp", new 
File(MainFrame.frostSettings.getValue("temp.dir")));
+//        } catch(Exception ex) {
+//            // this should never happen, but for the case ...
+//            tmp = new File("index_"+System.currentTimeMillis());
+//        }
+//
+//        FileAccess.writeZipFile(XMLTools.getRawXMLDocument(idx), "entry", 
tmp);
+//        
+//        long result = tmp.length();
+//        tmp.delete();
+//        
+//        return result;
+//    }

-        FileAccess.writeZipFile(XMLTools.getRawXMLDocument(idx), "entry", tmp);
-        
-        long result = tmp.length();
-        tmp.delete();
-        
-        return result;
-    }
-
        /**
      * TODO: the Map returned by this method MUST be uploaded, if uploading
      *       is cancelled (Frost shutdown,...) the files to upload are lost!
@@ -223,17 +223,6 @@
         */
        public Map getUploadKeys(Board board) {

-        // TODO: nice-to-have: add files until zip is larger than 30000, don't 
stop at 60
-
-        // limit -> key file could grow above 30.000 bytes which is the appr. 
maximum for KSK uploads!
-        // we first try with 60 and lower by 5 until zipsize is <=30000
-        // (if not all files fit into this index, we send the next list on 
next update)
-        final long MAX_ZIP_SIZE = 30000;
-        final int MAX_FILES_CHANGE_INTERVAL = 5;
-        final int DEFAULT_MAX_FILES = 60; // seems to be a good size to start 
with
-        
-        int currentMaxFiles = DEFAULT_MAX_FILES; 
-        
         String boardFilename = board.getBoardFilename();

                logger.fine("Index.getUploadKeys for board " + boardFilename);
@@ -244,7 +233,7 @@
             return null;
         }

-               File boardFiles = new File(MainFrame.keypool + boardFilename + 
File.separator + "files.xml");
+//             File boardFiles = new File(MainFrame.keypool + boardFilename + 
File.separator + "files.xml");
         File boardNewFiles = new File(MainFrame.keypool + boardFilename + 
File.separator + "new_files.xml");

         Map toUpload = new HashMap();
@@ -252,146 +241,18 @@
         // get new files added by me
         FrostIndex newUploadsIdx = readKeyFile(boardNewFiles);

-        while(true) {
-
-            for(Iterator i = newUploadsIdx.getFilesMap().values().iterator(); 
i.hasNext(); ) {
-                SharedFileObject sfo = (SharedFileObject)i.next();
-                if( toUpload.size() < currentMaxFiles ) {
-                    toUpload.put(sfo.getSHA1(), sfo);
-                } else {
-                    break;
-                }
-            }
-            if( toUpload.size() == 0 ) {
-                break;
-            }
-            // determine final zip file size
-            long len = determineZippedSize(new FrostIndex(toUpload));
-            if( len == 0 ) {
-                logger.severe("FATAL ERROR: determineZippedSize() did not 
create a zip file.");
-                return null;
-            } else if( len > MAX_ZIP_SIZE ) {
-                // zip file too large
-                toUpload.clear();
-                if( currentMaxFiles == 1 ) {
-                    // ERROR, a single file does not fit into the index
-                    logger.severe("FATAL ERROR: a single file does not fit 
into the index file. zipsize="+len);
-                    return null;
-                } else {
-                    currentMaxFiles -= MAX_FILES_CHANGE_INTERVAL; // decrease 
max files
-                    if( currentMaxFiles <= 0 ) {
-                        currentMaxFiles = 1;
-                    }
-                }
-            } else {
-                break;
-            }
-        }
-        
-        // remove those files from newUploadsIdx that we added to toUpload
-        for(Iterator i = toUpload.values().iterator(); i.hasNext(); ) {
+        for(Iterator i = newUploadsIdx.getFilesMap().values().iterator(); 
i.hasNext(); ) {
             SharedFileObject sfo = (SharedFileObject)i.next();
-            newUploadsIdx.getFilesMap().remove(sfo.getSHA1());
+            toUpload.put(sfo.getKey(), sfo);
         }
-
-        // save or delete the newUploadsIdx file
-        if( newUploadsIdx.getFilesMap().size() == 0 ) {
-            // we put all new files into our toUpload
-            if (boardNewFiles.isFile()) {
-                boardNewFiles.delete();
-            }
-        } else {
-            // save remaining files for next run
-            writeKeyFile(newUploadsIdx, boardNewFiles);
-        }

+        // we put all new files into our toUpload
+        if (boardNewFiles.isFile()) {
+            boardNewFiles.delete();
+        }
         // finished to add my new files

-        // now add all of my files that need to be reshared
-        
-        FrostIndex totalIdx = null;
-        boolean reSharing = false;
-        // check if we already lowered MAX_FILES, if yes we are finished (no 
more space)
-        if( currentMaxFiles == DEFAULT_MAX_FILES ) {
-            
-            totalIdx = readKeyFile(boardFiles);
-            
-            String myUniqueName = 
Core.getInstance().getIdentities().getMyId().getUniqueName();
-            int downloadBack = MainFrame.frostSettings.getIntValue("maxAge");
-            logger.info("re-sharing files shared before " + 
DateFun.getDate(downloadBack));
-
-            String minDate = DateFun.getExtendedDate(downloadBack);
-            
-            Map tmpToUpload = new HashMap();
-            ArrayList resharedFilesList = new ArrayList();
-            while(true) {
-
-                tmpToUpload.putAll(toUpload);
-                
-                for(Iterator i = totalIdx.getFilesMap().values().iterator(); 
i.hasNext(); ) {
-                    
-                    SharedFileObject current = (SharedFileObject) i.next();
-
-                    if( tmpToUpload.size() >= currentMaxFiles ) {
-                        break; // index file full
-                    }
-
-                    if( current.getOwner() != null && // not anonymous 
-                        current.getOwner().compareTo(myUniqueName) == 0 && // 
from myself
-                        current.getLastSharedDate() != null && // not from the 
old format
-                        minDate.compareTo(current.getLastSharedDate()) > 0 ) 
// add my file if its been shared too long ago
-                    {
-                        tmpToUpload.put(current.getSHA1(), current); // we 
change the lastShared Date for this later, see below
-                        resharedFilesList.add(current); // we change the 
lastShared Date for this later, see below
-                    }
-                }
-                if( resharedFilesList.size() == 0 ) {
-                    // no files added to reshare, skip zip check, zipsize was 
validated before
-                    break;
-                }
-                // determine final zip file size of tmpToUpload map
-                long len = determineZippedSize(new FrostIndex(tmpToUpload));
-                if( len == 0 ) {
-                    logger.severe("FATAL ERROR: determineZippedSize() did not 
create a zip file.");
-                    return null;
-                } else if( len > MAX_ZIP_SIZE ) {
-                    // zip file too large, reset and restart
-                    tmpToUpload.clear();
-                    resharedFilesList.clear();
-                    
-                    if( currentMaxFiles == 1 ) {
-                        // ERROR, a single file does not fit into the index
-                        logger.severe("FATAL ERROR: a single file does not fit 
into the index file. zipsize="+len);
-                        return null;
-                    } else {
-                        currentMaxFiles -= MAX_FILES_CHANGE_INTERVAL; // 
decrease max files
-                        if( currentMaxFiles <= 0 ) {
-                            currentMaxFiles = 1;
-                        } 
-                        if( currentMaxFiles <= toUpload.size() ) {
-                            break; // toUpload was full enough
-                        }
-                    }
-                } else {
-                    // finished, tmpToUpload is the new final map
-                    toUpload = tmpToUpload;
-                    reSharing = true;
-                    // process date of all added reshared entries
-                    for(Iterator i = resharedFilesList.iterator(); 
i.hasNext(); ) {
-                        SharedFileObject current = (SharedFileObject) i.next();
-                        // if the file has been uploaded too long ago, set it 
to offline again
-                        if (!current.checkDate()) {
-                            // NOTE: This will not remove the CHK from the 
upload table. 
-                            // however, when the other side receives the index 
they will see the file "offline"
-                            current.setDate(null);
-                        }
-                    }
-                    break;
-                }
-            }
-        }
-        
-        // if no own files are to be send, break and don't send only friends 
files
+        // if no own files are to be send, break 
         if( toUpload.size() == 0 ) {
             return null;
         }
@@ -403,51 +264,7 @@
             obj.setLastSharedDate(currentDate);
         }

-        // save the new lastSharedDate/date of MY re-shared files to disk
-        if (reSharing) {
-            writeKeyFile(totalIdx, boardFiles);
-        }
-
-//      NOTE: due to troubles with too large index files we currently do not 
send friends shared files
-//      imho this did'nt help alot anyway        
-
         return toUpload;
-
-        // if there is space in the file, add random files of friends
-        // TODO: we could mark helped files and send some other on next run 
(use e.g. a lastHelpedDate)
-        //       for now we collect all possible files and shuffle them
-//        if( toUpload.size() < MAX_FILES ) {
-//
-//            // collect ALL friends files
-//            ArrayList friendsFiles = new ArrayList();
-//            for(Iterator i = totalIdx.getFilesMap().values().iterator(); 
i.hasNext(); ) {
-//                
-//                SharedFileObject current = (SharedFileObject) i.next();
-//                Identity id = 
Core.getInstance().getIdentities().getIdentity(current.getOwner());
-//                if( id != null && //not anonymous
-//                    myUniqueName.compareTo(current.getOwner()) != 0 && //not 
myself
-//                    MainFrame.frostSettings.getBoolValue("helpFriends") && 
//and helping is enabled
-//                    id.getState() == FrostIdentities.FRIEND ) //and marked 
GOOD 
-//                {
-//                    // add friends files
-//                    friendsFiles.add( current );
-//                }
-//            }
-//            
-//            // shuffle ALL files
-//            Collections.shuffle(friendsFiles);
-//            
-//            // add files until index file is full
-//            for(Iterator i = friendsFiles.iterator(); i.hasNext(); ) {
-//                SharedFileObject current = (SharedFileObject) i.next();
-//                toUpload.put(current.getSHA1(), current);
-//                logger.fine("f"); //f means added file from friend
-//                
-//                if( toUpload.size() >= MAX_FILES ) {
-//                    break;
-//                }
-//            }
-//        }
        }

        /**
@@ -458,26 +275,19 @@
         */
        private void updateDownloadTable(SharedFileObject key) {
                // this really shouldn't happen
-               if (key == null || key.getSHA1() == null) {
-                       logger.warning("null value in 
index.updateDownloadTable");
-                       if (key != null) {
-                               logger.warning("SHA1 null!");
-            } else {
-                               logger.warning("key null!");
-            }
+               if (key == null) {
+                       logger.warning("key=null in index.updateDownloadTable");
                        return;
                }

                for (int i = 0; i < downloadModel.getItemCount(); i++) {
                        FrostDownloadItem dlItem = (FrostDownloadItem) 
downloadModel.getItemAt(i);
-                       if (dlItem.getState() == 
FrostDownloadItem.STATE_REQUESTED
-                               && dlItem.getSHA1() != null
-                               && dlItem.getSHA1().compareTo(key.getSHA1()) == 
0) 
+                       if (dlItem.getKey().compareTo(key.getKey()) == 0) 
             {
-                if( key.getKey() != null && key.getKey().length() > 0 ) {
-                    // never clear an (maybe) existing key
-                    dlItem.setKey(key.getKey());
-                }
+//                if( key.getKey() != null && key.getKey().length() > 0 ) {
+//                    // never clear an (maybe) existing key
+//                    dlItem.setKey(key.getKey());
+//                }
                                dlItem.setFileAge(key.getDate());
                                break;
                        }
@@ -519,7 +329,7 @@
                 // validate the key
                 if( !newKey.isValid() ) {
                     i.remove();
-//                    logger.warning("invalid key found");
+                    logger.warning("invalid key found");
                     continue;
                 }
             }

Modified: 
trunk/apps/frost-0.7/source/frost/fileTransfer/download/DownloadModel.java
===================================================================
--- trunk/apps/frost-0.7/source/frost/fileTransfer/download/DownloadModel.java  
2006-02-11 18:54:59 UTC (rev 8016)
+++ trunk/apps/frost-0.7/source/frost/fileTransfer/download/DownloadModel.java  
2006-02-11 19:22:16 UTC (rev 8017)
@@ -78,12 +78,13 @@
        public synchronized boolean addDownloadItem(FrostDownloadItem 
itemToAdd) {
                for (int x = 0; x < getItemCount(); x++) {
                        FrostDownloadItem item = (FrostDownloadItem) 
getItemAt(x);
-                       if (item.getSHA1() != null
-                               && item.getSHA1().equals(itemToAdd.getSHA1())
-                               && 
item.getSourceBoard().getName().equals(itemToAdd.getSourceBoard().getName())) {
-                               // already in model (compared by SHA1)
-                               return false;
-                       }
+            
+//                     if (item.getSHA1() != null
+//                             && item.getSHA1().equals(itemToAdd.getSHA1())
+//                             && 
item.getSourceBoard().getName().equals(itemToAdd.getSourceBoard().getName())) {
+//                             // already in model (compared by SHA1)
+//                             return false;
+//                     }
                        if (itemToAdd.getKey() != null
                                && item.getKey() != null
                                && item.getKey().equals(itemToAdd.getKey())) {
@@ -113,15 +114,15 @@
        /**
         * Returns true if the model contains an item with the given key.
         */
-       public synchronized boolean containsItemWithKey(String key) {
-               for (int x = 0; x < getItemCount(); x++) {
-                       FrostDownloadItem dlItem = (FrostDownloadItem) 
getItemAt(x);
-                       if (dlItem.getSHA1() != null && 
dlItem.getSHA1().equals(key)) {
-                               return true;
-                       }
-               }
-               return false;
-       }
+//     public synchronized boolean containsItemWithKey(String key) {
+//             for (int x = 0; x < getItemCount(); x++) {
+//                     FrostDownloadItem dlItem = (FrostDownloadItem) 
getItemAt(x);
+//                     if (dlItem.getSHA1() != null && 
dlItem.getSHA1().equals(key)) {
+//                             return true;
+//                     }
+//             }
+//             return false;
+//     }

        /**
         * Removes finished downloads from the download model.

Modified: 
trunk/apps/frost-0.7/source/frost/fileTransfer/download/DownloadModelXmlDAO.java
===================================================================
--- 
trunk/apps/frost-0.7/source/frost/fileTransfer/download/DownloadModelXmlDAO.java
    2006-02-11 18:54:59 UTC (rev 8016)
+++ 
trunk/apps/frost-0.7/source/frost/fileTransfer/download/DownloadModelXmlDAO.java
    2006-02-11 19:22:16 UTC (rev 8017)
@@ -66,13 +66,13 @@
                String owner = XMLTools.getChildElementsTextValue(element, 
"owner");
                String sourceboardname = 
XMLTools.getChildElementsTextValue(element, "sourceboard");
                String enableDownload = element.getAttribute("enableDownload");
-               String SHA1 = XMLTools.getChildElementsTextValue(element, 
"SHA1");
-               String batch = XMLTools.getChildElementsTextValue(element, 
"batch");
-               String redirect = XMLTools.getChildElementsCDATAValue(element, 
"redirect");
+//             String SHA1 = XMLTools.getChildElementsTextValue(element, 
"SHA1");
+//             String batch = XMLTools.getChildElementsTextValue(element, 
"batch");
+//             String redirect = XMLTools.getChildElementsCDATAValue(element, 
"redirect");

                // SHA1 val is not available when adding downloads using textbox
                // one of key or SHA1 must be available
-               if (filename == null || state == null || (key == null && SHA1 
== null)) {
+               if (filename == null || state == null || (key == null )) {
                        logger.warning("Invalid download item found. Removed.");
                        return null;
                }
@@ -117,9 +117,9 @@

                // create FrostDownloadItem
                FrostDownloadItem dlItem = new FrostDownloadItem(filename, 
filesize, fileage, key, retries,
-                                                                               
                                        owner, SHA1, iState, isDownloadEnabled, 
board);
-               dlItem.setBatch(batch);
-               dlItem.setRedirect(redirect);
+                                                                               
                                        owner, iState, isDownloadEnabled, 
board);
+//             dlItem.setBatch(batch);
+//             dlItem.setRedirect(redirect);
                return dlItem;
        }

@@ -175,24 +175,24 @@
                element.appendChild(text);
                itemElement.appendChild(element);
                //SHA1
-               element = doc.createElement("SHA1");
-               text = doc.createTextNode(downloadItem.getSHA1());
-               element.appendChild(text);
-               itemElement.appendChild(element);
+//             element = doc.createElement("SHA1");
+//             text = doc.createTextNode(downloadItem.getSHA1());
+//             element.appendChild(text);
+//             itemElement.appendChild(element);
                //batch - not all elements may have batches
-               if (downloadItem.getBatch() != null) {
-                       element = doc.createElement("batch");
-                       text = doc.createTextNode(downloadItem.getBatch());
-                       element.appendChild(text);
-                       itemElement.appendChild(element);
-               }
+//             if (downloadItem.getBatch() != null) {
+//                     element = doc.createElement("batch");
+//                     text = doc.createTextNode(downloadItem.getBatch());
+//                     element.appendChild(text);
+//                     itemElement.appendChild(element);
+//             }
                //redirect - for redirect files
-               if (downloadItem.getRedirect() != null) {
-                       element = doc.createElement("redirect");
-                       cdata = 
doc.createCDATASection(downloadItem.getRedirect());
-                       element.appendChild(cdata);
-                       itemElement.appendChild(element);
-               }
+//             if (downloadItem.getRedirect() != null) {
+//                     element = doc.createElement("redirect");
+//                     cdata = 
doc.createCDATASection(downloadItem.getRedirect());
+//                     element.appendChild(cdata);
+//                     itemElement.appendChild(element);
+//             }
                //owner
                if (downloadItem.getOwner() != null && 
downloadItem.getOwner().compareToIgnoreCase("anonymous") != 0) {
                        element = doc.createElement("owner");

Modified: 
trunk/apps/frost-0.7/source/frost/fileTransfer/download/DownloadPanel.java
===================================================================
--- trunk/apps/frost-0.7/source/frost/fileTransfer/download/DownloadPanel.java  
2006-02-11 18:54:59 UTC (rev 8016)
+++ trunk/apps/frost-0.7/source/frost/fileTransfer/download/DownloadPanel.java  
2006-02-11 19:22:16 UTC (rev 8017)
@@ -1,7 +1,20 @@
 /*
- * Created on Nov 13, 2003
- *
- */
+  DownloadPanel.java / Frost
+
+  This program is free software; you can redistribute it and/or
+  modify it under the terms of the GNU General Public License as
+  published by the Free Software Foundation; either version 2 of
+  the License, or (at your option) any later version.
+
+  This program is distributed in the hope that it will be useful,
+  but WITHOUT ANY WARRANTY; without even the implied warranty of
+  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+  General Public License for more details.
+
+  You should have received a copy of the GNU General Public License
+  along with this program; if not, write to the Free Software
+  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+*/
 package frost.fileTransfer.download;

 import java.awt.*;

Modified: 
trunk/apps/frost-0.7/source/frost/fileTransfer/download/DownloadStatusPanel.java
===================================================================
--- 
trunk/apps/frost-0.7/source/frost/fileTransfer/download/DownloadStatusPanel.java
    2006-02-11 18:54:59 UTC (rev 8016)
+++ 
trunk/apps/frost-0.7/source/frost/fileTransfer/download/DownloadStatusPanel.java
    2006-02-11 19:22:16 UTC (rev 8017)
@@ -1,7 +1,20 @@
 /*
- * Created on 07-ene-2005
- * 
- */
+  DownloadStatusPanel.java / Frost
+
+  This program is free software; you can redistribute it and/or
+  modify it under the terms of the GNU General Public License as
+  published by the Free Software Foundation; either version 2 of
+  the License, or (at your option) any later version.
+
+  This program is distributed in the hope that it will be useful,
+  but WITHOUT ANY WARRANTY; without even the implied warranty of
+  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+  General Public License for more details.
+
+  You should have received a copy of the GNU General Public License
+  along with this program; if not, write to the Free Software
+  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+*/
 package frost.fileTransfer.download;

 import java.awt.FlowLayout;

Modified: 
trunk/apps/frost-0.7/source/frost/fileTransfer/download/DownloadTableFormat.java
===================================================================
--- 
trunk/apps/frost-0.7/source/frost/fileTransfer/download/DownloadTableFormat.java
    2006-02-11 18:54:59 UTC (rev 8016)
+++ 
trunk/apps/frost-0.7/source/frost/fileTransfer/download/DownloadTableFormat.java
    2006-02-11 19:22:16 UTC (rev 8017)
@@ -1,9 +1,20 @@
 /*
- * Created on May 13, 2004
- *
- * To change the template for this generated file go to
- * Window&gt;Preferences&gt;Java&gt;Code Generation&gt;Code and Comments
- */
+  DownloadTableFormat.java / Frost
+
+  This program is free software; you can redistribute it and/or
+  modify it under the terms of the GNU General Public License as
+  published by the Free Software Foundation; either version 2 of
+  the License, or (at your option) any later version.
+
+  This program is distributed in the hope that it will be useful,
+  but WITHOUT ANY WARRANTY; without even the implied warranty of
+  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+  General Public License for more details.
+
+  You should have received a copy of the GNU General Public License
+  along with this program; if not, write to the Free Software
+  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+*/
 package frost.fileTransfer.download;

 import java.awt.Component;
@@ -434,11 +445,11 @@
                        case FrostDownloadItem.STATE_DONE :
                                return stateDone;

-                       case FrostDownloadItem.STATE_REQUESTING :
-                               return stateRequesting;
-
-                       case FrostDownloadItem.STATE_REQUESTED :
-                               return stateRequested;
+//                     case FrostDownloadItem.STATE_REQUESTING :
+//                             return stateRequesting;
+//
+//                     case FrostDownloadItem.STATE_REQUESTED :
+//                             return stateRequested;

                        case FrostDownloadItem.STATE_DECODING :
                                return stateDecoding;

Modified: 
trunk/apps/frost-0.7/source/frost/fileTransfer/download/DownloadThread.java
===================================================================
--- trunk/apps/frost-0.7/source/frost/fileTransfer/download/DownloadThread.java 
2006-02-11 18:54:59 UTC (rev 8016)
+++ trunk/apps/frost-0.7/source/frost/fileTransfer/download/DownloadThread.java 
2006-02-11 19:22:16 UTC (rev 8017)
@@ -40,8 +40,8 @@
        private String filename;
        private Long size;
        private String key;
-       private String SHA1;
-       private String batch;
+//     private String SHA1;
+//     private String batch;
        private String owner;
        private Board board;

@@ -59,21 +59,22 @@
                        // if we don't have the CHK, means the key was not 
inserted
                        // request it by SHA1
                        if (key == null) {
-                               logger.info("FILEDN: Requesting " + filename);
-                               System.out.println("FILEDN: Requesting " + 
filename);
-                               
downloadItem.setState(FrostDownloadItem.STATE_REQUESTING);
-
-                               //request the file itself
-                               try {
-                                       request();
-                                       logger.info("FILEDN: Uploaded request 
for " + filename);
-                                       System.out.println("FILEDN: Uploaded 
request for " + filename);
-                               } catch (Throwable t) {
-                                       logger.log(Level.SEVERE, "FILEDN: 
Uploading request failed for " + filename, t);
-                                       System.out.println("FILEDN: Uploading 
request failed for " + filename);
-                               }
-                               
downloadItem.setState(FrostDownloadItem.STATE_REQUESTED);
-
+                logger.severe("Key to download is NULL!");
+//                             logger.info("FILEDN: Requesting " + filename);
+//                             System.out.println("FILEDN: Requesting " + 
filename);
+//                             
downloadItem.setState(FrostDownloadItem.STATE_REQUESTING);
+//
+//                             //request the file itself
+//                             try {
+//                                     request();
+//                                     logger.info("FILEDN: Uploaded request 
for " + filename);
+//                                     System.out.println("FILEDN: Uploaded 
request for " + filename);
+//                             } catch (Throwable t) {
+//                                     logger.log(Level.SEVERE, "FILEDN: 
Uploading request failed for " + filename, t);
+//                                     System.out.println("FILEDN: Uploading 
request failed for " + filename);
+//                             }
+//                             
downloadItem.setState(FrostDownloadItem.STATE_REQUESTED);
+//
                                
downloadItem.setLastDownloadStopTimeMillis(System.currentTimeMillis());

                                ticker.threadFinished();
@@ -122,41 +123,41 @@
                                logger.warning("FILEDN: Download of " + 
filename + " failed.");
                                System.out.println("FILEDN: Download of " + 
filename + " failed.");
                                if (inTable == true) {
-                                       // Upload request to request stack
-                                       if 
(settings.getBoolValue("downloadEnableRequesting")
-                                               && downloadItem.getRetries()
-                                                       >= 
settings.getIntValue("downloadRequestAfterTries")
-                                               && board != null
-                                               && board.isFolder() == false
-                                               && this.owner != null) // 
upload requests only if they are NOT manually added
-                                               {
-                                               logger.info("FILEDN: Download 
failed, uploading request for " + filename);
-                                               System.out.println("FILEDN: 
Download failed, uploading request for " + filename);
-                                               
downloadItem.setState(FrostDownloadItem.STATE_REQUESTING);
+//                                     // Upload request to request stack
+//                                     if 
(settings.getBoolValue("downloadEnableRequesting")
+//                                             && downloadItem.getRetries()
+//                                                     >= 
settings.getIntValue("downloadRequestAfterTries")
+//                                             && board != null
+//                                             && board.isFolder() == false
+//                                             && this.owner != null) // 
upload requests only if they are NOT manually added
+//                                     {
+//                                             logger.info("FILEDN: Download 
failed, uploading request for " + filename);
+//                                             System.out.println("FILEDN: 
Download failed, uploading request for " + filename);
+//                                             
downloadItem.setState(FrostDownloadItem.STATE_REQUESTING);
+//
+//                                             // We may not do the request 
here due to the synchronize
+//                                             // -> no lock needed, using 
models
+//                                             // doing it after this , the 
table states Waiting and there are threads running,
+//                                             // so download seems to stall
+//                                             try {
+//                                                     request();
+//                                                     logger.info("FILEDN: 
Uploaded request for " + filename);
+//                                                     
System.out.println("FILEDN: Uploaded request for " + filename);
+//                                             } catch (Throwable t) {
+//                                                     logger.log(
+//                                                             Level.SEVERE,
+//                                                             "FILEDN: 
Uploading request failed for " + filename,
+//                                                             t);
+//                                                     System.out.println(
+//                                                                     
+//                                                                     
"FILEDN: Uploading request failed for " + filename
+//                                                                     );
+//                                             }
+//                                     } else {
+//                                             logger.info("FILEDN: Download 
failed (file is NOT requested).");
+//                                             System.out.println("FILEDN: 
Download failed (file is NOT requested).");
+//                                     }

-                                               // We may not do the request 
here due to the synchronize
-                                               // -> no lock needed, using 
models
-                                               // doing it after this , the 
table states Waiting and there are threads running,
-                                               // so download seems to stall
-                                               try {
-                                                       request();
-                                                       logger.info("FILEDN: 
Uploaded request for " + filename);
-                                                       
System.out.println("FILEDN: Uploaded request for " + filename);
-                                               } catch (Throwable t) {
-                                                       logger.log(
-                                                               Level.SEVERE,
-                                                               "FILEDN: 
Uploading request failed for " + filename,
-                                                               t);
-                                                       System.out.println(
-                                                                       
-                                                                       
"FILEDN: Uploading request failed for " + filename
-                                                                       );
-                                               }
-                                       } else {
-                                               logger.info("FILEDN: Download 
failed (file is NOT requested).");
-                                               System.out.println("FILEDN: 
Download failed (file is NOT requested).");
-                                       }
-
                                        // set new state -> failed or waiting 
for another try
                                        if (downloadItem.getRetries()
                                                > 
settings.getIntValue("downloadMaxRetries")) {
@@ -175,15 +176,15 @@
                        else {
                                // do NOT add manually downloaded files (file 
have no SHA1, no owner, no board)
                                if (board != null
-                                       && board.isFolder() == false
-                                       && this.SHA1 != null
-                                       && 
Core.frostSettings.getBoolValue("shareDownloads")) 
+                                       && board.isFolder() == false)
+//                                     && this.SHA1 != null
+//                                     && 
Core.frostSettings.getBoolValue("shareDownloads")) 
                 {
                                        // Add successful downloaded key to 
database
                                        SharedFileObject newKey = new 
SharedFileObject(key);
                                        newKey.setFilename(filename);
                                        newKey.setSize(newFile.length());
-                                       newKey.setSHA1(SHA1);
+//                                     newKey.setSHA1(SHA1);
                                        newKey.setDate(date);
                     Index index = Index.getInstance();
                     synchronized(index) {
@@ -208,260 +209,260 @@
        }

        // Request a certain file by SHA1
-       private void request() {
-               int messageUploadHtl = settings.getIntValue("tofUploadHtl");
-               boolean requested = false;
+//     private void request() {
+//             int messageUploadHtl = settings.getIntValue("tofUploadHtl");
+//             boolean requested = false;
+//
+//             logger.info("FILEDN: Uploading request for '" + filename + "' 
to board '" + board.getName() + "'");
+//             System.out.println("FILEDN: Uploading request for '" + filename 
+ "' to board '" + board.getName() + "'");
+//        
+//        if( batch == null || owner == null ) {
+//            logger.severe("FILEDN: NO batch or owner, skipping upload of 
request for "+filename);
+//            System.out.println("FILEDN: NO batch or owner, skipping upload 
of request for "+filename);
+//            return;
+//        }
+//
+//             String destination =
+//                     new StringBuffer()
+//                             .append("requests")
+//                             .append(File.separator)
+//                             .append(owner)
+//                             .append("-")
+//                             .append(batch)
+//                             .append("-")
+//                             .append(DateFun.getDate())
+//                             .toString();
+//             File checkDestination = new File(destination);
+//             if (!checkDestination.isDirectory()) {
+//                     checkDestination.mkdirs();
+//        }
+//// TODO: put multiple requests into 1 file; do this above downloadthread
+//             // Check if file was already requested
+//             // ++ check only in req files
+//             File[] files = checkDestination.listFiles(new FilenameFilter() {
+//                     public boolean accept(File dir, String name) {
+//                             if (name.endsWith(".req.sha"))
+//                                     return true;
+//                             return false;
+//                     }
+//             });
+//             for (int i = 0; i < files.length; i++) {
+//                     String content = (FileAccess.readFile(files[i])).trim();
+//                     if (content.equals(SHA1)) {
+//                             requested = true;
+//                             logger.info("FILEDN: File '" + filename + "' 
was already requested");
+//                             System.out.println("FILEDN: File '" + filename 
+ "' was already requested");
+//                             break;
+//                     }
+//             }
+//
+//             if (!requested) {
+//                     String date = DateFun.getDate();
+//
+//                     // Generate file to upload
+//                     File requestFile = null;
+//                     try {
+//                             requestFile = File.createTempFile(
+//                                                     "reqUpload_",
+//                                                     null,
+//                                                     new 
File(settings.getValue("temp.dir")));
+//                     } catch (Exception ex) {
+//                             requestFile = new File(
+//                                                     
settings.getValue("temp.dir")
+//                                                     + 
System.currentTimeMillis()
+//                                                     + ".tmp");
+//                     }
+//                     //TOTHINK: we can also encrypt the request
+//                     FileAccess.writeFile(SHA1, requestFile);
+//                     // Write requested key to disk
+//
+//                     // Search empty slot
+//                     boolean success = false;
+//                     int index = 0;
+//                     int tries = 0;
+//                     boolean error = false;
+//                     File testMe = null;
+//                     while (!success) {
+//                             // Does this index already exist?
+//                             testMe = new File( new StringBuffer()
+//                                                             
.append(destination)
+//                                                             
.append(File.separator)
+//                                                             .append(index)
+//                                                             
.append(".req.sha")
+//                                                             .toString());
+//                             if (testMe.length() > 0) { // already downloaded
+//                                     index++;
+//                                     //if( DEBUG ) 
Core.getOut().println("FILEDN: File exists, increasing index to " + index);
+//                                     continue; // while
+//                             } else {
+//                                     // probably empty, check if other 
threads currently try to insert to this index
+//                                     File lockRequestIndex = new 
File(testMe.getPath() + ".lock");
+//                                     boolean lockFileCreated = false;
+//                                     try {
+//                                             lockFileCreated = 
lockRequestIndex.createNewFile();
+//                                     } catch (IOException ex) {
+//                                             logger.log( Level.SEVERE,
+//                                                     "ERROR: 
requestThread.request(): unexpected IOException, terminating thread ...",
+//                                                     ex);
+//                                             System.out.println(
+//                                                             "ERROR: 
requestThread.request(): unexpected IOException, terminating thread ..."
+//                                                             );
+//                                             return;
+//                                     }
+//
+//                                     if (lockFileCreated == false) {
+//                                             // another thread tries to 
insert using this index, try next
+//                                             index++;
+//                                             logger.fine("FILEDN: Other 
thread tries this index, increasing index to " + index);
+//                                             System.out.println("FILEDN: 
Other thread tries this index, increasing index to " + index);
+//                                             continue; // while
+//                                     } else {
+//                                             // we try this index
+//                                             lockRequestIndex.deleteOnExit();
+//                                     }
+//
+//                                     // try to insert
+//
+//                                     String[] result = new String[2];
+//                                     String upKey =
+//                                             new StringBuffer()
+//                                                     .append("KSK at 
frost/request/")
+//                                                     
.append(settings.getValue("messageBase"))
+//                                                     .append("/")
+//                                                     .append(owner)
+//                                                     .append("-")
+//                                                     .append(batch)
+//                                                     .append("-")
+//                                                     .append(date)
+//                                                     .append("-")
+//                                                     .append(index)
+//                                                     .append(".req.sha")
+//                                                     .toString();
+//                                     logger.fine(upKey);
+//                                     System.out.println(upKey);
+//                                     result = FcpInsert.putFile(upKey, 
requestFile, messageUploadHtl, false);
+//                                     System.out.println("FcpInsert result[0] 
= " + result[0] + " result[1] = " + result[1]);
+//
+//                                     if (result[0] == null || result[1] == 
null) {
+//                                             result[0] = "Error";
+//                                             result[1] = "Error";
+//                                     }
+//
+//                                     if (result[0].equals("Success")) {
+//                                             success = true;
+//                                     } else if 
(result[0].equals("KeyCollision")) {
+//                                             // Check if the collided key is 
perhapes the requested one
+//                                             File compareMe = null;
+//                                             try {
+//                                                     compareMe =
+//                                                             
File.createTempFile(
+//                                                                     
"reqUploadCmpDnload_",
+//                                                                     null,
+//                                                                     new 
File(settings.getValue("temp.dir")));
+//                                             } catch (Exception ex) {
+//                                                     compareMe =
+//                                                             new File(
+//                                                                             
settings.getValue("temp.dir")
+//                                                                             
+ System.currentTimeMillis()
+//                                                                             
+ ".tmp");
+//                                             }
+//                                             compareMe.deleteOnExit();
+//
+//                                             String requestMe = upKey;
+//
+//                                             if 
(FcpRequest.getFile(requestMe, null, compareMe, 25, false) != null) {
+//                                                     File numberOne = 
compareMe;
+//                                                     File numberTwo = 
requestFile;
+//                                                     String contentOne = 
(FileAccess.readFile(numberOne)).trim();
+//                                                     String contentTwo = 
(FileAccess.readFile(numberTwo)).trim();
+//
+//                                                     //if( DEBUG ) 
Core.getOut().println(contentOne);
+//                                                     //if( DEBUG ) 
Core.getOut().println(contentTwo);
+//
+//                                                     if 
(contentOne.equals(contentTwo)) {
+//                                                             
logger.fine("FILEDN: Key Collision and file was already requested");
+//                                                             success = true;
+//                                                     } else {
+//                                                             index++;
+//                                                             logger.fine(
+//                                                                     
"FILEDN: Request Upload collided, increasing index to "
+//                                                                             
+ index);
+//
+//                                                             if 
(settings.getBoolValue(SettingsClass.DISABLE_REQUESTS) == true) {
+//                                                                     // 
uploading is disabled, therefore already existing requests are not
+//                                                                     // 
written to disk, causing key collosions on every request insert.
+//
+//                                                                     // this 
write a .req file to inform others to not try this index again
+//                                                                     // if 
user switches to uploading enabled, this dummy .req files should
+//                                                                     // be 
silently deleted to enable receiving of new requests
+//                                                                     
FileAccess.writeFile(KEYCOLL_INDICATOR, testMe);
+//                                                             }
+//                                                     }
+//                                             } else {
+//                                                     logger.info(
+//                                                             "FILEDN: 
Request upload failed ("
+//                                                                     + tries
+//                                                                     + "), 
retrying index "
+//                                                                     + 
index);
+//                                                     System.out.println(
+//                                                                     
"FILEDN: Request upload failed ("
+//                                                                             
+ tries
+//                                                                             
+ "), retrying index "
+//                                                                             
+ index);
+//
+//                                                     if (tries > 5) {
+//                                                             success = true;
+//                                                             error = true;
+//                                                     }
+//                                                     tries++;
+//                                             }
+//                                             compareMe.delete();
+//                                     }
+//                                     // finally delete the index lock file
+//                                     lockRequestIndex.delete();
+//                             }
+//                     }
+//
+//                     if (!error) {
+//                             requestFile.renameTo(testMe);
+//                             logger.info(
+//                                     
"*********************************************************************\n"
+//                                             + "Request for '"
+//                                             + filename
+//                                             + "' successfully uploaded to 
board '"
+//                                             + board
+//                                             + "'.\n"
+//                                             + 
"*********************************************************************");
+//                             System.out.println(
+//                                             
"*********************************************************************\n"
+//                                                     + "Request for '"
+//                                                     + filename
+//                                                     + "' successfully 
uploaded to board '"
+//                                                     + board
+//                                                     + "'.\n"
+//                                                     + 
"*********************************************************************");
+//                     } else {
+//                             logger.warning(
+//                                     "FILEDN: Error while uploading request 
for '"
+//                                             + filename
+//                                             + "' to board '"
+//                                             + board
+//                                             + "'.");
+//                             
+//                             System.out.println(
+//                                             "FILEDN: Error while uploading 
request for '"
+//                                                     + filename
+//                                                     + "' to board '"
+//                                                     + board
+//                                                     + "'.");
+//                             
+//                             requestFile.delete();
+//                     }
+//                     logger.info("FILEDN: Request Upload Thread finished");
+//                     System.out.println("FILEDN: Request Upload Thread 
finished");
+//             }
+//     }

-               logger.info("FILEDN: Uploading request for '" + filename + "' 
to board '" + board.getName() + "'");
-               System.out.println("FILEDN: Uploading request for '" + filename 
+ "' to board '" + board.getName() + "'");
-        
-        if( batch == null || owner == null ) {
-            logger.severe("FILEDN: NO batch or owner, skipping upload of 
request for "+filename);
-            System.out.println("FILEDN: NO batch or owner, skipping upload of 
request for "+filename);
-            return;
-        }
-
-               String destination =
-                       new StringBuffer()
-                               .append("requests")
-                               .append(File.separator)
-                               .append(owner)
-                               .append("-")
-                               .append(batch)
-                               .append("-")
-                               .append(DateFun.getDate())
-                               .toString();
-               File checkDestination = new File(destination);
-               if (!checkDestination.isDirectory()) {
-                       checkDestination.mkdirs();
-        }
-// TODO: put multiple requests into 1 file; do this above downloadthread
-               // Check if file was already requested
-               // ++ check only in req files
-               File[] files = checkDestination.listFiles(new FilenameFilter() {
-                       public boolean accept(File dir, String name) {
-                               if (name.endsWith(".req.sha"))
-                                       return true;
-                               return false;
-                       }
-               });
-               for (int i = 0; i < files.length; i++) {
-                       String content = (FileAccess.readFile(files[i])).trim();
-                       if (content.equals(SHA1)) {
-                               requested = true;
-                               logger.info("FILEDN: File '" + filename + "' 
was already requested");
-                               System.out.println("FILEDN: File '" + filename 
+ "' was already requested");
-                               break;
-                       }
-               }
-
-               if (!requested) {
-                       String date = DateFun.getDate();
-
-                       // Generate file to upload
-                       File requestFile = null;
-                       try {
-                               requestFile = File.createTempFile(
-                                                       "reqUpload_",
-                                                       null,
-                                                       new 
File(settings.getValue("temp.dir")));
-                       } catch (Exception ex) {
-                               requestFile = new File(
-                                                       
settings.getValue("temp.dir")
-                                                       + 
System.currentTimeMillis()
-                                                       + ".tmp");
-                       }
-                       //TOTHINK: we can also encrypt the request
-                       FileAccess.writeFile(SHA1, requestFile);
-                       // Write requested key to disk
-
-                       // Search empty slot
-                       boolean success = false;
-                       int index = 0;
-                       int tries = 0;
-                       boolean error = false;
-                       File testMe = null;
-                       while (!success) {
-                               // Does this index already exist?
-                               testMe = new File( new StringBuffer()
-                                                               
.append(destination)
-                                                               
.append(File.separator)
-                                                               .append(index)
-                                                               
.append(".req.sha")
-                                                               .toString());
-                               if (testMe.length() > 0) { // already downloaded
-                                       index++;
-                                       //if( DEBUG ) 
Core.getOut().println("FILEDN: File exists, increasing index to " + index);
-                                       continue; // while
-                               } else {
-                                       // probably empty, check if other 
threads currently try to insert to this index
-                                       File lockRequestIndex = new 
File(testMe.getPath() + ".lock");
-                                       boolean lockFileCreated = false;
-                                       try {
-                                               lockFileCreated = 
lockRequestIndex.createNewFile();
-                                       } catch (IOException ex) {
-                                               logger.log( Level.SEVERE,
-                                                       "ERROR: 
requestThread.request(): unexpected IOException, terminating thread ...",
-                                                       ex);
-                                               System.out.println(
-                                                               "ERROR: 
requestThread.request(): unexpected IOException, terminating thread ..."
-                                                               );
-                                               return;
-                                       }
-
-                                       if (lockFileCreated == false) {
-                                               // another thread tries to 
insert using this index, try next
-                                               index++;
-                                               logger.fine("FILEDN: Other 
thread tries this index, increasing index to " + index);
-                                               System.out.println("FILEDN: 
Other thread tries this index, increasing index to " + index);
-                                               continue; // while
-                                       } else {
-                                               // we try this index
-                                               lockRequestIndex.deleteOnExit();
-                                       }
-
-                                       // try to insert
-
-                                       String[] result = new String[2];
-                                       String upKey =
-                                               new StringBuffer()
-                                                       .append("KSK at 
frost/request/")
-                                                       
.append(settings.getValue("messageBase"))
-                                                       .append("/")
-                                                       .append(owner)
-                                                       .append("-")
-                                                       .append(batch)
-                                                       .append("-")
-                                                       .append(date)
-                                                       .append("-")
-                                                       .append(index)
-                                                       .append(".req.sha")
-                                                       .toString();
-                                       logger.fine(upKey);
-                                       System.out.println(upKey);
-                                       result = FcpInsert.putFile(upKey, 
requestFile, messageUploadHtl, false);
-                                       System.out.println("FcpInsert result[0] 
= " + result[0] + " result[1] = " + result[1]);
-
-                                       if (result[0] == null || result[1] == 
null) {
-                                               result[0] = "Error";
-                                               result[1] = "Error";
-                                       }
-
-                                       if (result[0].equals("Success")) {
-                                               success = true;
-                                       } else if 
(result[0].equals("KeyCollision")) {
-                                               // Check if the collided key is 
perhapes the requested one
-                                               File compareMe = null;
-                                               try {
-                                                       compareMe =
-                                                               
File.createTempFile(
-                                                                       
"reqUploadCmpDnload_",
-                                                                       null,
-                                                                       new 
File(settings.getValue("temp.dir")));
-                                               } catch (Exception ex) {
-                                                       compareMe =
-                                                               new File(
-                                                                               
settings.getValue("temp.dir")
-                                                                               
+ System.currentTimeMillis()
-                                                                               
+ ".tmp");
-                                               }
-                                               compareMe.deleteOnExit();
-
-                                               String requestMe = upKey;
-
-                                               if 
(FcpRequest.getFile(requestMe, null, compareMe, 25, false) != null) {
-                                                       File numberOne = 
compareMe;
-                                                       File numberTwo = 
requestFile;
-                                                       String contentOne = 
(FileAccess.readFile(numberOne)).trim();
-                                                       String contentTwo = 
(FileAccess.readFile(numberTwo)).trim();
-
-                                                       //if( DEBUG ) 
Core.getOut().println(contentOne);
-                                                       //if( DEBUG ) 
Core.getOut().println(contentTwo);
-
-                                                       if 
(contentOne.equals(contentTwo)) {
-                                                               
logger.fine("FILEDN: Key Collision and file was already requested");
-                                                               success = true;
-                                                       } else {
-                                                               index++;
-                                                               logger.fine(
-                                                                       
"FILEDN: Request Upload collided, increasing index to "
-                                                                               
+ index);
-
-                                                               if 
(settings.getBoolValue(SettingsClass.DISABLE_REQUESTS) == true) {
-                                                                       // 
uploading is disabled, therefore already existing requests are not
-                                                                       // 
written to disk, causing key collosions on every request insert.
-
-                                                                       // this 
write a .req file to inform others to not try this index again
-                                                                       // if 
user switches to uploading enabled, this dummy .req files should
-                                                                       // be 
silently deleted to enable receiving of new requests
-                                                                       
FileAccess.writeFile(KEYCOLL_INDICATOR, testMe);
-                                                               }
-                                                       }
-                                               } else {
-                                                       logger.info(
-                                                               "FILEDN: 
Request upload failed ("
-                                                                       + tries
-                                                                       + "), 
retrying index "
-                                                                       + 
index);
-                                                       System.out.println(
-                                                                       
"FILEDN: Request upload failed ("
-                                                                               
+ tries
-                                                                               
+ "), retrying index "
-                                                                               
+ index);
-
-                                                       if (tries > 5) {
-                                                               success = true;
-                                                               error = true;
-                                                       }
-                                                       tries++;
-                                               }
-                                               compareMe.delete();
-                                       }
-                                       // finally delete the index lock file
-                                       lockRequestIndex.delete();
-                               }
-                       }
-
-                       if (!error) {
-                               requestFile.renameTo(testMe);
-                               logger.info(
-                                       
"*********************************************************************\n"
-                                               + "Request for '"
-                                               + filename
-                                               + "' successfully uploaded to 
board '"
-                                               + board
-                                               + "'.\n"
-                                               + 
"*********************************************************************");
-                               System.out.println(
-                                               
"*********************************************************************\n"
-                                                       + "Request for '"
-                                                       + filename
-                                                       + "' successfully 
uploaded to board '"
-                                                       + board
-                                                       + "'.\n"
-                                                       + 
"*********************************************************************");
-                       } else {
-                               logger.warning(
-                                       "FILEDN: Error while uploading request 
for '"
-                                               + filename
-                                               + "' to board '"
-                                               + board
-                                               + "'.");
-                               
-                               System.out.println(
-                                               "FILEDN: Error while uploading 
request for '"
-                                                       + filename
-                                                       + "' to board '"
-                                                       + board
-                                                       + "'.");
-                               
-                               requestFile.delete();
-                       }
-                       logger.info("FILEDN: Request Upload Thread finished");
-                       System.out.println("FILEDN: Request Upload Thread 
finished");
-               }
-       }
-
        /**Constructor*/
        public DownloadThread(
                DownloadTicker newTicker,
@@ -474,8 +475,8 @@
                size = item.getFileSize();
                key = item.getKey();
                board = item.getSourceBoard();
-               SHA1 = item.getSHA1();
-               batch = item.getBatch();
+//             SHA1 = item.getSHA1();
+//             batch = item.getBatch();
                if( item.getOwner() != null ) { // owner is null for manually 
added files
                        owner = Mixed.makeFilename(item.getOwner());
                } else {

Modified: 
trunk/apps/frost-0.7/source/frost/fileTransfer/download/DownloadTicker.java
===================================================================
--- trunk/apps/frost-0.7/source/frost/fileTransfer/download/DownloadTicker.java 
2006-02-11 18:54:59 UTC (rev 8016)
+++ trunk/apps/frost-0.7/source/frost/fileTransfer/download/DownloadTicker.java 
2006-02-11 19:22:16 UTC (rev 8017)
@@ -1,9 +1,20 @@
 /*
- * Created on Apr 24, 2004
- *
- * To change the template for this generated file go to
- * Window&gt;Preferences&gt;Java&gt;Code Generation&gt;Code and Comments
- */
+  DownloadTicker.java / Frost
+
+  This program is free software; you can redistribute it and/or
+  modify it under the terms of the GNU General Public License as
+  published by the Free Software Foundation; either version 2 of
+  the License, or (at your option) any later version.
+
+  This program is distributed in the hope that it will be useful,
+  but WITHOUT ANY WARRANTY; without even the implied warranty of
+  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+  General Public License for more details.
+
+  You should have received a copy of the GNU General Public License
+  along with this program; if not, write to the Free Software
+  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+*/
 package frost.fileTransfer.download;

 import java.util.*;
@@ -217,7 +228,7 @@
                                newRequest.start();
                                threadLaunched = true;
                        }else{
-                               //System.out.println("Nothing to download");
+//                             System.out.println("Nothing to download");
                        }

                        if (!threadLaunched) {
@@ -226,8 +237,6 @@
                }
        }

-
-
        /**
         * Chooses next download item to start from download table.
         * @return the next download item to start downloading or null if a 
suitable
@@ -240,24 +249,19 @@
                //System.out.println("Table has " + model.getItemCount() + " 
possible downloads");
                for (int i = 0; i < model.getItemCount(); i++) {
                        FrostDownloadItem dlItem = (FrostDownloadItem) 
model.getItemAt(i);
-                       if ((dlItem.getState() == 
FrostDownloadItem.STATE_WAITING
-                               && (dlItem.getEnableDownload() == null
-                                       || 
dlItem.getEnableDownload().booleanValue()
-                                               == true) //                && 
dlItem.getRetries() <= frame1.frostSettings.getIntValue("downloadMaxRetries")
-                       )
-                               || ((dlItem.getState() == 
FrostDownloadItem.STATE_REQUESTED
-                                       || dlItem.getState() == 
FrostDownloadItem.STATE_REQUESTING)
-                                       && dlItem.getKey() != null
-                                       && (dlItem.getEnableDownload() == null
-                                               || 
dlItem.getEnableDownload().booleanValue() == true))) {
+                       if (dlItem.getState() == FrostDownloadItem.STATE_WAITING
+                               && (dlItem.getEnableDownload() == null || 
dlItem.getEnableDownload().booleanValue()== true)
+// && dlItem.getRetries() <= 
frame1.frostSettings.getIntValue("downloadMaxRetries")                
+            ) {
                                // check if waittime is expired
                                long waittimeMillis = 
settings.getIntValue("downloadWaittime") * 60 * 1000;
                                // min->millisec
-                               if 
(settings.getBoolValue("downloadRestartFailedDownloads")
-                                       && (System.currentTimeMillis() - 
dlItem.getLastDownloadStopTimeMillis())
-                                               > waittimeMillis) {
-                                       waitingItems.add(dlItem);
-                               }
+                if (dlItem.getLastDownloadStopTimeMillis() == 0 || // never 
started
+                    (settings.getBoolValue("downloadRestartFailedDownloads")
+                     && (System.currentTimeMillis() - 
dlItem.getLastDownloadStopTimeMillis()) > waittimeMillis)) 
+                {
+                    waitingItems.add(dlItem);
+                }
                        }               
                }
                if (waitingItems.size() == 0)

Modified: 
trunk/apps/frost-0.7/source/frost/fileTransfer/download/DownloadTickerListener.java
===================================================================
--- 
trunk/apps/frost-0.7/source/frost/fileTransfer/download/DownloadTickerListener.java
 2006-02-11 18:54:59 UTC (rev 8016)
+++ 
trunk/apps/frost-0.7/source/frost/fileTransfer/download/DownloadTickerListener.java
 2006-02-11 19:22:16 UTC (rev 8017)
@@ -1,7 +1,20 @@
 /*
- * Created on 07-ene-2005
- * 
- */
+  DownloadTickerListener.java / Frost
+
+  This program is free software; you can redistribute it and/or
+  modify it under the terms of the GNU General Public License as
+  published by the Free Software Foundation; either version 2 of
+  the License, or (at your option) any later version.
+
+  This program is distributed in the hope that it will be useful,
+  but WITHOUT ANY WARRANTY; without even the implied warranty of
+  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+  General Public License for more details.
+
+  You should have received a copy of the GNU General Public License
+  along with this program; if not, write to the Free Software
+  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+*/
 package frost.fileTransfer.download;

 import java.util.EventListener;

Modified: 
trunk/apps/frost-0.7/source/frost/fileTransfer/download/FrostDownloadItem.java
===================================================================
--- 
trunk/apps/frost-0.7/source/frost/fileTransfer/download/FrostDownloadItem.java  
    2006-02-11 18:54:59 UTC (rev 8016)
+++ 
trunk/apps/frost-0.7/source/frost/fileTransfer/download/FrostDownloadItem.java  
    2006-02-11 19:22:16 UTC (rev 8017)
@@ -1,3 +1,20 @@
+/*
+  FrostDownloadItem.java / Frost
+
+  This program is free software; you can redistribute it and/or
+  modify it under the terms of the GNU General Public License as
+  published by the Free Software Foundation; either version 2 of
+  the License, or (at your option) any later version.
+
+  This program is distributed in the hope that it will be useful,
+  but WITHOUT ANY WARRANTY; without even the implied warranty of
+  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+  General Public License for more details.
+
+  You should have received a copy of the GNU General Public License
+  along with this program; if not, write to the Free Software
+  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+*/
 package frost.fileTransfer.download;

 import frost.fileTransfer.search.FrostSearchItem;
@@ -28,9 +45,9 @@
        public final static int STATE_TRYING = 2;
        public final static int STATE_DONE = 3;
        public final static int STATE_FAILED = 4;
-       public final static int STATE_REQUESTING = 5;
+//     public final static int STATE_REQUESTING = 5;
        public final static int STATE_PROGRESS = 6; // download runs
-       public final static int STATE_REQUESTED = 7;
+//     public final static int STATE_REQUESTED = 7;
        public final static int STATE_DECODING = 8; // decoding runs

        // the fields
@@ -43,15 +60,15 @@
        private Boolean enableDownload = 
                                new Boolean(true);                      
//FIELD_ID_ENABLED
        private String owner = null;                    //FIELD_ID_OWNER
-       private String sha1 = null;                     //FIELD_ID_SHA1
+//     private String sha1 = null;                     //FIELD_ID_SHA1
        private int state = 0;                          //FIELD_ID_STATE
        private int doneBlocks = 0;                     //FIELD_ID_DONE_BLOCKS
        private int requiredBlocks = 0;         //FIELD_ID_REQUIRED_BLOCKS
        private int totalBlocks = 0;                    //FIELD_ID_TOTAL_BLOCKS

-       private String batch = null;
+//     private String batch = null;

-       private String redirect;
+//     private String redirect;

        private long lastDownloadStopTimeMillis = 0;

@@ -67,13 +84,13 @@
                key = searchItem.getKey();
                owner = searchItem.getOwner();
                sourceBoard = searchItem.getBoard();
-               sha1 = searchItem.getSHA1();
-               batch = searchItem.getBatch();
+//             sha1 = searchItem.getSHA1();
+//             batch = searchItem.getBatch();
                retries = 0;

                state = STATE_WAITING;

-               redirect = searchItem.getRedirect();
+//             redirect = searchItem.getRedirect();

        }

@@ -97,7 +114,6 @@
                String key,
                String tries,
                String from,
-               String SHA1,
                int state,
                boolean isDownloadEnabled,
                Board board) {
@@ -114,7 +130,7 @@
                this.key = key;
                this.sourceBoard = board;
                this.state = state;
-               this.sha1 = SHA1;
+//             this.sha1 = SHA1;
                this.enableDownload = Boolean.valueOf(isDownloadEnabled);
                owner = from;
        }
@@ -190,12 +206,12 @@
                retries = newRetries;
                fireFieldChange(FIELD_ID_RETRIES, oldRetries, newRetries);
        }
-       public String getBatch() {
-               return batch;
-       }
-       public void setBatch(String batch) {
-               this.batch = batch;
-       }
+//     public String getBatch() {
+//             return batch;
+//     }
+//     public void setBatch(String batch) {
+//             this.batch = batch;
+//     }

        public Boolean getEnableDownload() {
                return enableDownload;
@@ -227,20 +243,20 @@
                fireFieldChange(FIELD_ID_OWNER, oldOwner, newOwner);
        }

-       public String getSHA1() {
-               return sha1;
-       }
+//     public String getSHA1() {
+//             return sha1;
+//     }
+//
+//     /**
+//      * @param newSha1
+//      */
+//     public void setSHA1(String newSha1) {
+//             String oldSha1 = sha1;
+//             sha1 = newSha1;
+//             fireFieldChange(FIELD_ID_SHA1, oldSha1, newSha1);
+//     }

        /**
-        * @param newSha1
-        */
-       public void setSHA1(String newSha1) {
-               String oldSha1 = sha1;
-               sha1 = newSha1;
-               fireFieldChange(FIELD_ID_SHA1, oldSha1, newSha1);
-       }
-
-       /**
         * @param newFileName
         */
        public void setFileName(String newFileName) {
@@ -252,18 +268,18 @@
        /**
         * @return Returns the redirect.
         */
-       public String getRedirect() {
-               return redirect;
-       }
+//     public String getRedirect() {
+//             return redirect;
+//     }
+//
+//     /**
+//      * @param redirect The redirect to set.
+//      */
+//     public void setRedirect(String redirect) {
+//             this.redirect = redirect;
+//     }

        /**
-        * @param redirect The redirect to set.
-        */
-       public void setRedirect(String redirect) {
-               this.redirect = redirect;
-       }
-
-       /**
         * @return
         */
        public int getDoneBlocks() {

Modified: 
trunk/apps/frost-0.7/source/frost/fileTransfer/search/FrostSearchItem.java
===================================================================
--- trunk/apps/frost-0.7/source/frost/fileTransfer/search/FrostSearchItem.java  
2006-02-11 18:54:59 UTC (rev 8016)
+++ trunk/apps/frost-0.7/source/frost/fileTransfer/search/FrostSearchItem.java  
2006-02-11 19:22:16 UTC (rev 8017)
@@ -61,19 +61,19 @@
        return sfo.getOwner();
     }

-    public String getSHA1() {
-       return sfo.getSHA1();
-    }
-    public String getBatch() {
-       return sfo.getBatch();
-    }
+//    public String getSHA1() {
+//     return sfo.getSHA1();
+//    }
+//    public String getBatch() {
+//     return sfo.getBatch();
+//    }
        /**
         * @return Returns the sfo.
         */
-       public String getRedirect() {
-               if (sfo instanceof RedirectFileObject)
-                       return ((RedirectFileObject)sfo).getRedirect();
-               else return null;
-       }
+//     public String getRedirect() {
+//             if (sfo instanceof RedirectFileObject)
+//                     return ((RedirectFileObject)sfo).getRedirect();
+//             else return null;
+//     }

 }

Modified: 
trunk/apps/frost-0.7/source/frost/fileTransfer/search/SearchThread.java
===================================================================
--- trunk/apps/frost-0.7/source/frost/fileTransfer/search/SearchThread.java     
2006-02-11 18:54:59 UTC (rev 8016)
+++ trunk/apps/frost-0.7/source/frost/fileTransfer/search/SearchThread.java     
2006-02-11 19:22:16 UTC (rev 8017)
@@ -274,11 +274,11 @@
                        Long size = key.getSize();
                        String date = key.getDate();
                        String keyData = key.getKey();
-                       String SHA1 = key.getSHA1();
+//                     String SHA1 = key.getSHA1();

-                       if (SHA1 == null) {
-                               logger.warning("SHA1 null in SearchThread!!! ");
-                       }
+//                     if (SHA1 == null) {
+//                             logger.warning("SHA1 null in SearchThread!!! ");
+//                     }

                        int searchItemState = FrostSearchItem.STATE_NONE;

@@ -287,12 +287,12 @@
                        if (file.exists()) {
                                // file is already downloaded -> light_gray
                                searchItemState = 
FrostSearchItem.STATE_DOWNLOADED;
-                       } else if (downloadModel.containsItemWithKey(SHA1)) {
-                               // this file is in download table -> blue
-                               searchItemState = 
FrostSearchItem.STATE_DOWNLOADING;
-                       } else if (uploadModel.containsItemWithKey(SHA1)) {
-                               // this file is in upload table -> green
-                               searchItemState = 
FrostSearchItem.STATE_UPLOADING;
+//                     } else if (downloadModel.containsItemWithKey(SHA1)) {
+//                             // this file is in download table -> blue
+//                             searchItemState = 
FrostSearchItem.STATE_DOWNLOADING;
+//                     } else if (uploadModel.containsItemWithKey(SHA1)) {
+//                             // this file is in upload table -> green
+//                             searchItemState = 
FrostSearchItem.STATE_UPLOADING;
                        } else if (isOffline(key)) {
                                // this file is offline -> gray
                                searchItemState = FrostSearchItem.STATE_OFFLINE;

Modified: 
trunk/apps/frost-0.7/source/frost/fileTransfer/upload/FrostUploadItem.java
===================================================================
--- trunk/apps/frost-0.7/source/frost/fileTransfer/upload/FrostUploadItem.java  
2006-02-11 18:54:59 UTC (rev 8016)
+++ trunk/apps/frost-0.7/source/frost/fileTransfer/upload/FrostUploadItem.java  
2006-02-11 19:22:16 UTC (rev 8017)
@@ -45,8 +45,8 @@
     public final static int STATE_REQUESTED  = 2;      // a start of uploading 
is requested
     public final static int STATE_UPLOADING  = 3;
     public final static int STATE_PROGRESS   = 4;      // upload runs, shows 
"... kb"
-    public final static int STATE_ENCODING_REQUESTED  = 5; // an encoding of 
file is requested
-    public final static int STATE_ENCODING   = 6;      // the encode is running
+//    public final static int STATE_ENCODING_REQUESTED  = 5; // an encoding of 
file is requested
+//    public final static int STATE_ENCODING   = 6;    // the encode is running
     public final static int STATE_WAITING       = 7;   // waiting until the 
next retry

        //the fields
@@ -184,17 +184,17 @@
     /**
         * @return
         */
-       public String getSHA1() {
-       return sha1;
-    }
+//     public String getSHA1() {
+//     return sha1;
+//    }
     /**
         * @param newSha1
         */
-       public void setSHA1(String newSha1) {
-       String oldSha1 = sha1;
-               sha1 = newSha1;
-               fireFieldChange(FIELD_ID_SHA1, oldSha1, newSha1);
-    }
+//     public void setSHA1(String newSha1) {
+//     String oldSha1 = sha1;
+//             sha1 = newSha1;
+//             fireFieldChange(FIELD_ID_SHA1, oldSha1, newSha1);
+//    }

        /**
         * @return
@@ -241,16 +241,16 @@
        public void setNextState(int v) {
                nextState = v;
        }
-    public String getBatch() {
-       return batch;
-    }
+//    public String getBatch() {
+//     return batch;
+//    }
+//     /**
+//      * @param batch
+//      */
+//     public void setBatch(String batch) {
+//             this.batch = batch;
+//     }
        /**
-        * @param batch
-        */
-       public void setBatch(String batch) {
-               this.batch = batch;
-       }
-       /**
         * @return
         */
        public String getLastUploadDate() {

Modified: trunk/apps/frost-0.7/source/frost/fileTransfer/upload/UploadModel.java
===================================================================
--- trunk/apps/frost-0.7/source/frost/fileTransfer/upload/UploadModel.java      
2006-02-11 18:54:59 UTC (rev 8016)
+++ trunk/apps/frost-0.7/source/frost/fileTransfer/upload/UploadModel.java      
2006-02-11 19:22:16 UTC (rev 8017)
@@ -51,15 +51,15 @@
        /**
         * Returns true if the model contains an item with the given key.
         */
-       public synchronized boolean containsItemWithKey(String key) {
-               for (int x = 0; x < getItemCount(); x++) {
-                       FrostUploadItem ulItem = (FrostUploadItem) getItemAt(x);
-                       if (ulItem.getSHA1() != null && 
ulItem.getSHA1().equals(key)) {
-                               return true;
-                       }
-               }
-               return false;
-       }
+//     public synchronized boolean containsItemWithKey(String key) {
+//             for (int x = 0; x < getItemCount(); x++) {
+//                     FrostUploadItem ulItem = (FrostUploadItem) getItemAt(x);
+//                     if (ulItem.getSHA1() != null && 
ulItem.getSHA1().equals(key)) {
+//                             return true;
+//                     }
+//             }
+//             return false;
+//     }

        /**
         * This method removes from the model the items whose associated files
@@ -96,7 +96,8 @@
                        // start an upload we decide based on the states in 
which we are not allowed
                        if (ulItem.getState() != FrostUploadItem.STATE_UPLOADING
                                && ulItem.getState() != 
FrostUploadItem.STATE_PROGRESS
-                               && ulItem.getState() != 
FrostUploadItem.STATE_ENCODING) {
+//                             && ulItem.getState() != 
FrostUploadItem.STATE_ENCODING
+                ) {
                                ulItem.setRetries(0);
                                ulItem.setLastUploadStopTimeMillis(0);
                                ulItem.setEnabled(Boolean.valueOf(true));
@@ -116,7 +117,8 @@
                        // start an upload we decide based on the states in 
which we are not allowed
                        if (ulItem.getState() != FrostUploadItem.STATE_UPLOADING
                                && ulItem.getState() != 
FrostUploadItem.STATE_PROGRESS
-                               && ulItem.getState() != 
FrostUploadItem.STATE_ENCODING) {
+//                             && ulItem.getState() != 
FrostUploadItem.STATE_ENCODING
+                ) {
                                ulItem.setRetries(0);
                                ulItem.setLastUploadStopTimeMillis(0);
                                ulItem.setEnabled(Boolean.valueOf(true));
@@ -129,17 +131,17 @@
         * This method tells items passed as a parameter to generate their chks 
         * (if their current state allows it)
         */
-       public void generateChkItems(ModelItem[] items) {
-               for (int i = 0; i < items.length; i++) {
-                       FrostUploadItem ulItem = (FrostUploadItem) items[i];
-                       // Since it is difficult to identify the states where 
we are allowed to
-                       // start an upload we decide based on the states in 
which we are not allowed
-                       // start gen chk only if IDLE
-                       if (ulItem.getState() == FrostUploadItem.STATE_IDLE && 
ulItem.getKey() == null) {
-                               
ulItem.setState(FrostUploadItem.STATE_ENCODING_REQUESTED);
-                       }
-               }
-       }
+//     public void generateChkItems(ModelItem[] items) {
+//             for (int i = 0; i < items.length; i++) {
+//                     FrostUploadItem ulItem = (FrostUploadItem) items[i];
+//                     // Since it is difficult to identify the states where 
we are allowed to
+//                     // start an upload we decide based on the states in 
which we are not allowed
+//                     // start gen chk only if IDLE
+//                     if (ulItem.getState() == FrostUploadItem.STATE_IDLE && 
ulItem.getKey() == null) {
+//                             
ulItem.setState(FrostUploadItem.STATE_ENCODING_REQUESTED);
+//                     }
+//             }
+//     }

        /**
         * Saves the upload model to disk.

Modified: 
trunk/apps/frost-0.7/source/frost/fileTransfer/upload/UploadModelXmlDAO.java
===================================================================
--- 
trunk/apps/frost-0.7/source/frost/fileTransfer/upload/UploadModelXmlDAO.java    
    2006-02-11 18:54:59 UTC (rev 8016)
+++ 
trunk/apps/frost-0.7/source/frost/fileTransfer/upload/UploadModelXmlDAO.java    
    2006-02-11 19:22:16 UTC (rev 8017)
@@ -145,10 +145,11 @@
                        if ((iState == FrostUploadItem.STATE_PROGRESS) || 
                                        (iState == 
FrostUploadItem.STATE_UPLOADING)) {
                                iState = FrostUploadItem.STATE_REQUESTED;
-                       } else if ((iState == FrostUploadItem.STATE_ENCODING) 
|| 
-                                               (iState == 
FrostUploadItem.STATE_ENCODING_REQUESTED)) {
+                       } else 
+//                if ((iState == FrostUploadItem.STATE_ENCODING) || 
+//                                             (iState == 
FrostUploadItem.STATE_ENCODING_REQUESTED)) {
                                iState = FrostUploadItem.STATE_IDLE;
-                       }
+//                     }
                }

                if (key != null && key.startsWith("CHK@") == false) {
@@ -180,7 +181,7 @@
                // create FrostUploadItem
                FrostUploadItem ulItem = new FrostUploadItem(filename, 
filepath, uploadFile.length(),
                                                                                
                                board, iState, lastUploadDate, key, SHA1);
-               ulItem.setBatch(batch);
+//             ulItem.setBatch(batch);
                ulItem.setEnabled(new Boolean(uploadEnabled));
                ulItem.setRetries(retriesInt);
                return ulItem;
@@ -279,10 +280,10 @@
                element.appendChild(text);
                itemElement.appendChild(element);
                // batch -all upload elements have it
-               element = document.createElement("batch");
-               text = document.createTextNode(uploadItem.getBatch());
-               element.appendChild(text);
-               itemElement.appendChild(element);
+//             element = document.createElement("batch");
+//             text = document.createTextNode(uploadItem.getBatch());
+//             element.appendChild(text);
+//             itemElement.appendChild(element);
                // key
                if (uploadItem.getKey() != null) {
                        element = document.createElement("key");
@@ -291,12 +292,12 @@
                        itemElement.appendChild(element);
                }
                // sha1
-               if (uploadItem.getSHA1() != null) {
-                       element = document.createElement("SHA1");
-                       cdata = 
document.createCDATASection(uploadItem.getSHA1());
-                       element.appendChild(cdata);
-                       itemElement.appendChild(element);
-               }
+//             if (uploadItem.getSHA1() != null) {
+//                     element = document.createElement("SHA1");
+//                     cdata = 
document.createCDATASection(uploadItem.getSHA1());
+//                     element.appendChild(cdata);
+//                     itemElement.appendChild(element);
+//             }
                // lastUploadDate
                if (uploadItem.getLastUploadDate() != null) {
                        element = document.createElement("lastuploaddate");

Modified: trunk/apps/frost-0.7/source/frost/fileTransfer/upload/UploadPanel.java
===================================================================
--- trunk/apps/frost-0.7/source/frost/fileTransfer/upload/UploadPanel.java      
2006-02-11 18:54:59 UTC (rev 8016)
+++ trunk/apps/frost-0.7/source/frost/fileTransfer/upload/UploadPanel.java      
2006-02-11 19:22:16 UTC (rev 8017)
@@ -37,7 +37,7 @@
                private JMenuItem copyKeysAndNamesItem = new JMenuItem();
                private JMenuItem copyKeysItem = new JMenuItem();
                private JMenuItem copyExtendedInfoItem = new JMenuItem();
-               private JMenuItem generateChkForSelectedFilesItem = new 
JMenuItem();
+//             private JMenuItem generateChkForSelectedFilesItem = new 
JMenuItem();
                private JMenuItem reloadAllFilesItem = new JMenuItem();
                private JMenuItem reloadSelectedFilesItem = new JMenuItem();
                private JMenuItem removeAllFilesItem = new JMenuItem();
@@ -82,7 +82,7 @@
                        removeAllFilesItem.addActionListener(this);
                        reloadSelectedFilesItem.addActionListener(this);
                        reloadAllFilesItem.addActionListener(this);
-                       generateChkForSelectedFilesItem.addActionListener(this);
+//                     generateChkForSelectedFilesItem.addActionListener(this);
                        setPrefixForSelectedFilesItem.addActionListener(this);
                        setPrefixForAllFilesItem.addActionListener(this);
                        
restoreDefaultFilenamesForSelectedFilesItem.addActionListener(this);
@@ -102,8 +102,8 @@
                        copyKeysItem.setText(language.getString("Copy keys 
only"));
                        copyKeysAndNamesItem.setText(language.getString("Copy 
keys with filenames"));
                        copyExtendedInfoItem.setText(language.getString("Copy 
extended info"));
-                       generateChkForSelectedFilesItem.setText(
-                                       language.getString("Start encoding of 
selected files"));
+//                     generateChkForSelectedFilesItem.setText(
+//                                     language.getString("Start encoding of 
selected files"));
                        reloadAllFilesItem.setText(language.getString("Reload 
all files"));
                        
reloadSelectedFilesItem.setText(language.getString("Reload selected files"));
                        removeAllFilesItem.setText(language.getString("Remove 
all files"));
@@ -157,9 +157,9 @@
                        if (e.getSource() == reloadAllFilesItem) {
                                reloadAllFiles();
                        }
-                       if (e.getSource() == generateChkForSelectedFilesItem) {
-                               generateChkForSelectedFiles();
-                       }
+//                     if (e.getSource() == generateChkForSelectedFilesItem) {
+//                             generateChkForSelectedFiles();
+//                     }
                        if (e.getSource() == setPrefixForSelectedFilesItem) {
                                setPrefixForSelectedFiles();
                        }
@@ -216,10 +216,10 @@
                /**
                 * Generate CHK for selected files 
                 */
-               private void generateChkForSelectedFiles() {
-                       ModelItem[] selectedItems = 
modelTable.getSelectedItems();
-                       model.generateChkItems(selectedItems);
-               } 
+//             private void generateChkForSelectedFiles() {
+//                     ModelItem[] selectedItems = 
modelTable.getSelectedItems();
+//                     model.generateChkItems(selectedItems);
+//             } 

                /**
                 * Reload all files
@@ -359,7 +359,7 @@
                        addSeparator();
                        if (selectedItems.length != 0) {
                                // If at least 1 item is selected
-                               add(generateChkForSelectedFilesItem);
+//                             add(generateChkForSelectedFilesItem);
                                add(reloadSelectedFilesItem);
                        }
                        add(reloadAllFilesItem);
@@ -369,26 +369,26 @@
                        //the options that operate on all files (not only 
selected) are removed for now
                        //because making them check whether the file has been 
indexed or not is a pain
                        //feel free to implement ;)
-                       if (!settingsClass.getBoolValue("automaticIndexing")) {
-                               boolean shouldEnable = true;
-                               for (int i = 0; i < selectedItems.length; i++) {
-                                       FrostUploadItem item = 
(FrostUploadItem) selectedItems[i];
-                                       if (item.getSHA1() != null && 
item.getSHA1().length() > 0) {
-                                               shouldEnable = false;
-                                               break;
-                                       }
-                               }
+//                     if (!settingsClass.getBoolValue("automaticIndexing")) {
+//                             boolean shouldEnable = true;
+//                             for (int i = 0; i < selectedItems.length; i++) {
+//                                     FrostUploadItem item = 
(FrostUploadItem) selectedItems[i];
+//                                     if (item.getSHA1() != null && 
item.getSHA1().length() > 0) {
+//                                             shouldEnable = false;
+//                                             break;
+//                                     }
+//                             }
                                if (selectedItems.length != 0) {
                                        // If at least 1 item is selected
                                        add(setPrefixForSelectedFilesItem);
-                                       
setPrefixForSelectedFilesItem.setEnabled(shouldEnable);
+                                       
setPrefixForSelectedFilesItem.setEnabled(true);
                                }
                                //      add(setPrefixForAllFilesItem);
                                //      addSeparator();
                                if (selectedItems.length != 0) {
                                        // If at least 1 item is selected
                                        
add(restoreDefaultFilenamesForSelectedFilesItem);
-                                       
restoreDefaultFilenamesForSelectedFilesItem.setEnabled(shouldEnable);
+                                       
restoreDefaultFilenamesForSelectedFilesItem.setEnabled(true);
                                }
                                //      
add(restoreDefaultFilenamesForAllFilesItem);
                                addSeparator();
@@ -417,9 +417,9 @@
                                                });
                                        }
                                        add(changeDestinationBoardMenu);
-                                       
changeDestinationBoardMenu.setEnabled(shouldEnable);
+                                       
changeDestinationBoardMenu.setEnabled(true);
                                }
-                       } //end of options which are available if automatic 
indexing turned off
+//                     } //end of options which are available if automatic 
indexing turned off
                        addSeparator();
                        add(cancelItem);

@@ -671,9 +671,10 @@
                                        for (int j = 0; j < allFiles.size(); 
j++) {
                                                File newFile = (File) 
allFiles.get(j);
                                                if (newFile.isFile() && 
newFile.length() > 0) {
-                                                       FrostUploadItem ulItem =
-                                                               new 
FrostUploadItem(newFile, board);
+                                                       FrostUploadItem ulItem 
= new FrostUploadItem(newFile, board);
                                                        boolean isAdded = 
model.addUploadItem(ulItem);
+                            // immediately start upload after user added the 
file
+                            ulItem.setState(FrostUploadItem.STATE_REQUESTED);
                                                }
                                        }
                                }

Modified: 
trunk/apps/frost-0.7/source/frost/fileTransfer/upload/UploadTableFormat.java
===================================================================
--- 
trunk/apps/frost-0.7/source/frost/fileTransfer/upload/UploadTableFormat.java    
    2006-02-11 18:54:59 UTC (rev 8016)
+++ 
trunk/apps/frost-0.7/source/frost/fileTransfer/upload/UploadTableFormat.java    
    2006-02-11 19:22:16 UTC (rev 8017)
@@ -51,14 +51,14 @@

                        super.getTableCellRendererComponent(table, value, 
isSelected, hasFocus, row, column);

-                       ModelItem item = modelTable.getItemAt(row); //It may be 
null
-                       if (item != null) {
-                               FrostUploadItem uploadItem = (FrostUploadItem) 
item;
-                               if (uploadItem.getSHA1() != null) {
-                                       Font font = getFont();
-                                       setFont(font.deriveFont(Font.BOLD));
-                               }
-                       }
+//                     ModelItem item = modelTable.getItemAt(row); //It may be 
null
+//                     if (item != null) {
+//                             FrostUploadItem uploadItem = (FrostUploadItem) 
item;
+//                             if (uploadItem.getSHA1() != null) {
+//                                     Font font = getFont();
+//                                     setFont(font.deriveFont(Font.BOLD));
+//                             }
+//                     }
                        return this;
                }
        }
@@ -342,12 +342,12 @@
                        case FrostUploadItem.STATE_PROGRESS :
                                return getUploadProgress(item.getTotalBlocks(), 
item.getDoneBlocks());

-                       case FrostUploadItem.STATE_ENCODING_REQUESTED :
-                               return stateEncodingRequested;
+//                     case FrostUploadItem.STATE_ENCODING_REQUESTED :
+//                             return stateEncodingRequested;
+//
+//                     case FrostUploadItem.STATE_ENCODING :
+//                             return stateEncoding;

-                       case FrostUploadItem.STATE_ENCODING :
-                               return stateEncoding;
-
                        case FrostUploadItem.STATE_IDLE :
                                if (item.getLastUploadDate() == null) {
                                        return stateUploadedNever;

Modified: 
trunk/apps/frost-0.7/source/frost/fileTransfer/upload/UploadThread.java
===================================================================
--- trunk/apps/frost-0.7/source/frost/fileTransfer/upload/UploadThread.java     
2006-02-11 18:54:59 UTC (rev 8016)
+++ trunk/apps/frost-0.7/source/frost/fileTransfer/upload/UploadThread.java     
2006-02-11 19:22:16 UTC (rev 8017)
@@ -42,8 +42,8 @@

        private static Logger logger = 
Logger.getLogger(UploadThread.class.getName());

-    public static final int MODE_GENERATE_SHA1 = 1;
-    public static final int MODE_GENERATE_CHK  = 2;
+//    public static final int MODE_GENERATE_SHA1 = 1;
+//    public static final int MODE_GENERATE_CHK  = 2;
     public static final int MODE_UPLOAD        = 3;

     private int nextState; // the state to set on uploadItem when finished, or 
-1 for default (IDLE)
@@ -52,13 +52,13 @@
     private int htl;
     private Board board;
     private int mode;
-    private static int fileIndex=1;
+//    private static int fileIndex=1;
     private static Random r = new Random();
     //this is gonna be ugly
-    private static String batchId = Core.getMyBatches().values().size() == 0 ?
-                               (new Long(r.nextLong())).toString() :
-                               (String) 
Core.getMyBatches().values().iterator().next();
-    private static final int batchSize = 100; //TODO: get this from options
+//    private static String batchId = Core.getMyBatches().values().size() == 0 
?
+//                             (new Long(r.nextLong())).toString() :
+//                             (String) 
Core.getMyBatches().values().iterator().next();
+//    private static final int batchSize = 100; //TODO: get this from options
     //private static final Object putIt = 
frame1.getMyBatches().put(batchId,batchId);
     //^^ ugly trick to put the initial batch number

@@ -69,21 +69,21 @@
                        case MODE_UPLOAD:
                                ticker.uploadingThreadStarted();
                                break;
-                       case MODE_GENERATE_SHA1:
-                               ticker.generatingThreadStarted();
-                               break;
-                       case MODE_GENERATE_CHK:
-                               ticker.generatingThreadStarted();
-                               break;
+//                     case MODE_GENERATE_SHA1:
+//                             ticker.generatingThreadStarted();
+//                             break;
+//                     case MODE_GENERATE_CHK:
+//                             ticker.generatingThreadStarted();
+//                             break;
                }
-               if (batchId == null) {
-                       Exception er = new Exception();
-                       er.fillInStackTrace();
-                       logger.log(Level.SEVERE, "Exception thrown in run()", 
er);
-               }
-               if (Core.getMyBatches().values().size() == 0) {
-                       Core.getMyBatches().put(batchId, batchId);
-               }
+//             if (batchId == null) {
+//                     Exception er = new Exception();
+//                     er.fillInStackTrace();
+//                     logger.log(Level.SEVERE, "Exception thrown in run()", 
er);
+//             }
+//             if (Core.getMyBatches().values().size() == 0) {
+//                     Core.getMyBatches().put(batchId, batchId);
+//             }
                boolean sign = 
MainFrame.frostSettings.getBoolValue("signUploads");
                try {
                        switch (mode) {
@@ -91,14 +91,14 @@
                                        upload(sign);
                                        ticker.uploadingThreadFinished();
                                        break;
-                               case MODE_GENERATE_SHA1 :
-                                       generateSHA1(sign);
-                                       ticker.generatingThreadFinished();
-                                       break;
-                               case MODE_GENERATE_CHK :
-                                       generateCHK();
-                                       ticker.generatingThreadFinished();
-                                       break;
+//                             case MODE_GENERATE_SHA1 :
+//                                     generateSHA1(sign);
+//                                     ticker.generatingThreadFinished();
+//                                     break;
+//                             case MODE_GENERATE_CHK :
+//                                     generateCHK();
+//                                     ticker.generatingThreadFinished();
+//                                     break;
                        }
                } catch (Exception e) {
                        logger.log(Level.SEVERE, "Exception thrown in run()", 
e);
@@ -106,12 +106,12 @@
                                case MODE_UPLOAD :
                                        ticker.uploadingThreadFinished();
                                        break;
-                               case MODE_GENERATE_SHA1 :
-                                       ticker.generatingThreadFinished();
-                                       break;
-                               case MODE_GENERATE_CHK :
-                                       ticker.generatingThreadFinished();
-                                       break;
+//                             case MODE_GENERATE_SHA1 :
+//                                     ticker.generatingThreadFinished();
+//                                     break;
+//                             case MODE_GENERATE_CHK :
+//                                     ticker.generatingThreadFinished();
+//                                     break;
                        }
                }
        }
@@ -174,8 +174,8 @@
                                current.setOwner(myId.getUniqueName());
                        }
                        current.setFilename(uploadItem.getFileName());
-                       current.setSHA1(uploadItem.getSHA1());
-                       current.setBatch(uploadItem.getBatch());
+//                     current.setSHA1(uploadItem.getSHA1());
+//                     current.setBatch(uploadItem.getBatch());
                        current.setSize(uploadItem.getFileSize().longValue());
                        current.setDate(lastUploadDate);
                        current.setLastSharedDate(lastUploadDate);
@@ -188,74 +188,74 @@
                
uploadItem.setLastUploadStopTimeMillis(System.currentTimeMillis());
        }

-       private void generateSHA1(boolean sign) {
-               if (fileIndex % batchSize == 0) {
-                       Core.getMyBatches().put(batchId, batchId);
-                       while (Core.getMyBatches().contains(batchId)) {
-                               batchId = (new Long(r.nextLong())).toString();
-            }
-                       Core.getMyBatches().put(batchId, batchId);
-               }
+//     private void generateSHA1(boolean sign) {
+//             if (fileIndex % batchSize == 0) {
+//                     Core.getMyBatches().put(batchId, batchId);
+//                     while (Core.getMyBatches().contains(batchId)) {
+//                             batchId = (new Long(r.nextLong())).toString();
+//            }
+//                     Core.getMyBatches().put(batchId, batchId);
+//             }
+//
+//             long now = System.currentTimeMillis();
+//             String SHA1 = Core.getCrypto().digest(file);
+//             logger.fine("digest generated in " + 
(System.currentTimeMillis() - now) + "  " + SHA1);
+//
+//             //create new KeyClass
+//             SharedFileObject newKey = new SharedFileObject();
+//             newKey.setKey(null);
+//             newKey.setDate(null);
+//             newKey.setLastSharedDate(DateFun.getExtendedDate());
+//             newKey.setSHA1(SHA1);
+//             newKey.setFilename(destination);
+//             newKey.setSize(file.length());
+//             newKey.setBatch(batchId);
+//             if (sign) {
+//                     newKey.setOwner(myId.getUniqueName());
+//             }
+//
+//             //update the gui
+//             uploadItem.setSHA1(SHA1);
+//             uploadItem.setKey(null);
+//             uploadItem.setLastUploadDate(null);
+//             uploadItem.setBatch(batchId);
+//             fileIndex++;
+//             //add to index
+//        Index index = Index.getInstance();
+//        synchronized(index) {
+//             index.addMine(newKey, board);
+//             index.add(newKey, board);
+//        }
+//             uploadItem.setState(this.nextState);
+//     }
+//    
+//     private void generateCHK() {
+//             logger.info("CHK generation started for file: " + file);
+//             System.out.println("CHK generation started for file: " + file);
+//             String chkkey = FcpInsert.getCHK(file);
+//             
+//             
+//             //removes freenet:
+//             if (chkkey != null) {
+//                     String prefix = new String("freenet:");
+//                     if (chkkey.startsWith(prefix)) {
+//                             chkkey = chkkey.substring(prefix.length());
+//            }
+//             } else {
+//                     logger.warning("Could not generate CHK key for redirect 
file.");
+//             }
+//
+//             uploadItem.setKey(chkkey);
+//
+//             // test if the GetRequestsThread did set us the nextState 
field...
+//             if (uploadItem.getNextState() > 0) {
+//                     uploadItem.setState(uploadItem.getNextState());
+//                     uploadItem.setNextState(0); // reset nextState
+//             } else {
+//                     uploadItem.setState(this.nextState);
+//             }
+//     }

-               long now = System.currentTimeMillis();
-               String SHA1 = Core.getCrypto().digest(file);
-               logger.fine("digest generated in " + 
(System.currentTimeMillis() - now) + "  " + SHA1);
-
-               //create new KeyClass
-               SharedFileObject newKey = new SharedFileObject();
-               newKey.setKey(null);
-               newKey.setDate(null);
-               newKey.setLastSharedDate(DateFun.getExtendedDate());
-               newKey.setSHA1(SHA1);
-               newKey.setFilename(destination);
-               newKey.setSize(file.length());
-               newKey.setBatch(batchId);
-               if (sign) {
-                       newKey.setOwner(myId.getUniqueName());
-               }
-
-               //update the gui
-               uploadItem.setSHA1(SHA1);
-               uploadItem.setKey(null);
-               uploadItem.setLastUploadDate(null);
-               uploadItem.setBatch(batchId);
-               fileIndex++;
-               //add to index
-        Index index = Index.getInstance();
-        synchronized(index) {
-               index.addMine(newKey, board);
-               index.add(newKey, board);
-        }
-               uploadItem.setState(this.nextState);
-       }
-    
-       private void generateCHK() {
-               logger.info("CHK generation started for file: " + file);
-               System.out.println("CHK generation started for file: " + file);
-               String chkkey = FcpInsert.getCHK(file);
-               
-               
-               //removes freenet:
-               if (chkkey != null) {
-                       String prefix = new String("freenet:");
-                       if (chkkey.startsWith(prefix)) {
-                               chkkey = chkkey.substring(prefix.length());
-            }
-               } else {
-                       logger.warning("Could not generate CHK key for redirect 
file.");
-               }
-
-               uploadItem.setKey(chkkey);
-
-               // test if the GetRequestsThread did set us the nextState 
field...
-               if (uploadItem.getNextState() > 0) {
-                       uploadItem.setState(uploadItem.getNextState());
-                       uploadItem.setNextState(0); // reset nextState
-               } else {
-                       uploadItem.setState(this.nextState);
-               }
-       }
-
     /**Constructor*/
     public UploadThread(UploadTicker newTicker, FrostUploadItem ulItem, 
SettingsClass settings, int mode, LocalIdentity newMyId)
     {

Modified: 
trunk/apps/frost-0.7/source/frost/fileTransfer/upload/UploadTicker.java
===================================================================
--- trunk/apps/frost-0.7/source/frost/fileTransfer/upload/UploadTicker.java     
2006-02-11 18:54:59 UTC (rev 8016)
+++ trunk/apps/frost-0.7/source/frost/fileTransfer/upload/UploadTicker.java     
2006-02-11 19:22:16 UTC (rev 8017)
@@ -30,7 +30,7 @@
        //To be able to increase this value, we have to add support for that. 
Without it,
        //the loops in generateCHK and prepareUpladHashes would process the 
same file
        //several times.
-       private final int MAX_GENERATING_THREADS = 1;
+//     private final int MAX_GENERATING_THREADS = 1;

        private LocalIdentity myID;

@@ -63,7 +63,7 @@
         * threads is the number of threads that are actually running.
         */
        private int allocatedUploadingThreads = 0;
-       private int allocatedGeneratingThreads = 0;
+//     private int allocatedGeneratingThreads = 0;
        private int runningUploadingThreads = 0;
        private int runningGeneratingThreads = 0;

@@ -152,35 +152,35 @@
         * needed (no matter whether the thread was actually used or not).
         * @return true if a new generating thread can start. False otherwise.
         */
-       private boolean allocateGeneratingThread() {
-               synchronized (generatingCountLock) {
-                       if (allocatedGeneratingThreads < 
MAX_GENERATING_THREADS) {
-                               allocatedGeneratingThreads++;
-                               return true;
-                       } 
-               }
-               return false;
-       }
+//     private boolean allocateGeneratingThread() {
+//             synchronized (generatingCountLock) {
+//                     if (allocatedGeneratingThreads < 
MAX_GENERATING_THREADS) {
+//                             allocatedGeneratingThreads++;
+//                             return true;
+//                     } 
+//             }
+//             return false;
+//     }

        /**
         * This method is called from a generating thread to notify the ticker 
that
         * the thread has started (so that it can notify its listeners of the 
fact)
         */
-       void generatingThreadStarted() {
-               runningGeneratingThreads++;
-               fireGeneratingCountChanged();
-       }
+//     void generatingThreadStarted() {
+//             runningGeneratingThreads++;
+//             fireGeneratingCountChanged();
+//     }

        /**
         * This method is usually called from a generating thread to notify the 
ticker that
         * the thread has finished (so that it can notify its listeners of the 
fact). It also
         * releases the thread so that new generating threads can start if 
needed.
         */
-       void generatingThreadFinished() {
-               runningGeneratingThreads--;
-               fireGeneratingCountChanged();
-               releaseGeneratingThread();
-       }
+//     void generatingThreadFinished() {
+//             runningGeneratingThreads--;
+//             fireGeneratingCountChanged();
+//             releaseGeneratingThread();
+//     }

        /**
         * This method is called from an uploading thread to notify the ticker 
that
@@ -216,13 +216,13 @@
        /**
         * This method is used to release a generating thread.
         */
-       private void releaseGeneratingThread() {
-               synchronized (generatingCountLock) {
-                       if (allocatedGeneratingThreads > 0) {
-                               allocatedGeneratingThreads--;
-                       } 
-               }
-       }
+//     private void releaseGeneratingThread() {
+//             synchronized (generatingCountLock) {
+//                     if (allocatedGeneratingThreads > 0) {
+//                             allocatedGeneratingThreads--;
+//                     } 
+//             }
+//     }

        /* (non-Javadoc)
         * @see java.lang.Runnable#run()
@@ -234,8 +234,8 @@
                        // this is executed each second, so this counter counts 
seconds
                        removeNotExistingFilesCounter++;
                        removeNotExistingFiles();
-                       prepareUploadHashes();
-                       generateCHKs();
+//                     prepareUploadHashes();
+//                     generateCHKs();
                        startUploadThread();
                }
        }
@@ -243,49 +243,49 @@
        /**
         * This method generates CHK's for upload table entries
         */
-       private void generateCHKs() {
-               /**  Do not generate CHKs, get SHA1 only! */
-               /**  and generate CHK if requested ... */
+//     private void generateCHKs() {
+//             /**  Do not generate CHKs, get SHA1 only! */
+//             /**  and generate CHK if requested ... */
+//
+//             if (allocateGeneratingThread()) {
+//                     boolean threadLaunched = false;
+//
+//                     for (int i = 0; i < model.getItemCount() && 
!threadLaunched; i++) {
+//                             FrostUploadItem ulItem = (FrostUploadItem) 
model.getItemAt(i);
+//                             if (ulItem.getState() == 
FrostUploadItem.STATE_ENCODING_REQUESTED
+//                                     || (ulItem.getKey() == null
+//                                             && ulItem.getState() == 
FrostUploadItem.STATE_REQUESTED)) {
+//                                     UploadThread newInsert = null;
+//                                     if (ulItem.getState() == 
FrostUploadItem.STATE_REQUESTED) {
+//                                             // set next state for item to 
REQUESTED, default is IDLE
+//                                             // needed to keep the REQUESTED 
state for real uploading
+//                                             newInsert = new UploadThread(
+//                                                             this,
+//                                                             ulItem,
+//                                                             settings,
+//                                                             
UploadThread.MODE_GENERATE_CHK,
+//                                                             
FrostUploadItem.STATE_REQUESTED,
+//                                                             myID);
+//                                     } else {
+//                                             // next state will be IDLE 
(=default)
+//                                             newInsert = new UploadThread(
+//                                                             this,
+//                                                             ulItem,
+//                                                             settings,
+//                                                             
UploadThread.MODE_GENERATE_CHK,
+//                                                             myID);
+//                                     }
+//                                     
ulItem.setState(FrostUploadItem.STATE_ENCODING);
+//                                     newInsert.start();
+//                                     threadLaunched = true;  // start only 1 
thread per loop (=second)
+//                             }
+//                     }
+//                     if (!threadLaunched) {
+//                             releaseGeneratingThread();      
+//                     }
+//             }
+//     }

-               if (allocateGeneratingThread()) {
-                       boolean threadLaunched = false;
-
-                       for (int i = 0; i < model.getItemCount() && 
!threadLaunched; i++) {
-                               FrostUploadItem ulItem = (FrostUploadItem) 
model.getItemAt(i);
-                               if (ulItem.getState() == 
FrostUploadItem.STATE_ENCODING_REQUESTED
-                                       || (ulItem.getKey() == null
-                                               && ulItem.getState() == 
FrostUploadItem.STATE_REQUESTED)) {
-                                       UploadThread newInsert = null;
-                                       if (ulItem.getState() == 
FrostUploadItem.STATE_REQUESTED) {
-                                               // set next state for item to 
REQUESTED, default is IDLE
-                                               // needed to keep the REQUESTED 
state for real uploading
-                                               newInsert = new UploadThread(
-                                                               this,
-                                                               ulItem,
-                                                               settings,
-                                                               
UploadThread.MODE_GENERATE_CHK,
-                                                               
FrostUploadItem.STATE_REQUESTED,
-                                                               myID);
-                                       } else {
-                                               // next state will be IDLE 
(=default)
-                                               newInsert = new UploadThread(
-                                                               this,
-                                                               ulItem,
-                                                               settings,
-                                                               
UploadThread.MODE_GENERATE_CHK,
-                                                               myID);
-                                       }
-                                       
ulItem.setState(FrostUploadItem.STATE_ENCODING);
-                                       newInsert.start();
-                                       threadLaunched = true;  // start only 1 
thread per loop (=second)
-                               }
-                       }
-                       if (!threadLaunched) {
-                               releaseGeneratingThread();      
-                       }
-               }
-       }
-
        private void startUploadThread() {
                if (allocateUploadingThread()) {

@@ -311,11 +311,8 @@
                for (int i = 0; i < model.getItemCount() && foundItem == null; 
i++) {
                        FrostUploadItem ulItem = (FrostUploadItem) 
model.getItemAt(i);
                        if (ulItem.getState() == FrostUploadItem.STATE_REQUESTED
-                               && ulItem.getSHA1() != null
-                               && ulItem.getKey() != null
                                && (ulItem.isEnabled() == null || 
ulItem.isEnabled().booleanValue()))
-                               // file have key after encoding
-                               {
+                       {
                                foundItem = ulItem;
                        }
                }
@@ -349,33 +346,33 @@
                }
        }

-       private void prepareUploadHashes() {
-               // do this only if the automatic index handling is set
-        // TODO: if autoindexing is disabled, no SHA1 is generated and we fail 
to start a thread in nextUploadItem()
-               if (/*settings.getBoolValue("automaticIndexing") && */ 
allocateGeneratingThread()) {
+//     private void prepareUploadHashes() {
+//             // do this only if the automatic index handling is set
+//        // TODO: if autoindexing is disabled, no SHA1 is generated and we 
fail to start a thread in nextUploadItem()
+//             if (/*settings.getBoolValue("automaticIndexing") && */ 
allocateGeneratingThread()) {
+//
+//                     boolean threadLaunched = false;
+//                     
+//                     for (int i = 0; i < model.getItemCount() && 
!threadLaunched; i++) {
+//                             FrostUploadItem ulItem = (FrostUploadItem) 
model.getItemAt(i);
+//                             if (ulItem.getSHA1() == null) {
+//                                     ulItem.setKey("Working...");
+//                                     UploadThread newInsert = new 
UploadThread(
+//                                                     this,
+//                                                     ulItem,
+//                                                     settings,
+//                                                     
UploadThread.MODE_GENERATE_SHA1,
+//                                                     myID);
+//                                     newInsert.start();
+//                                     threadLaunched = true;  // start only 1 
thread per loop (=second)
+//                             }
+//                     }       
+//                     if (!threadLaunched) {
+//                             releaseGeneratingThread();      
+//                     }                       
+//             }
+//     }

-                       boolean threadLaunched = false;
-                       
-                       for (int i = 0; i < model.getItemCount() && 
!threadLaunched; i++) {
-                               FrostUploadItem ulItem = (FrostUploadItem) 
model.getItemAt(i);
-                               if (ulItem.getSHA1() == null) {
-                                       ulItem.setKey("Working...");
-                                       UploadThread newInsert = new 
UploadThread(
-                                                       this,
-                                                       ulItem,
-                                                       settings,
-                                                       
UploadThread.MODE_GENERATE_SHA1,
-                                                       myID);
-                                       newInsert.start();
-                                       threadLaunched = true;  // start only 1 
thread per loop (=second)
-                               }
-                       }       
-                       if (!threadLaunched) {
-                               releaseGeneratingThread();      
-                       }                       
-               }
-       }
-
        private void removeNotExistingFiles() {
                // Check uploadTable every 3 minutes
                if (removeNotExistingFilesCounter >= 180 ) {

Modified: trunk/apps/frost-0.7/source/frost/gui/AboutBox.java
===================================================================
--- trunk/apps/frost-0.7/source/frost/gui/AboutBox.java 2006-02-11 18:54:59 UTC 
(rev 8016)
+++ trunk/apps/frost-0.7/source/frost/gui/AboutBox.java 2006-02-11 19:22:16 UTC 
(rev 8017)
@@ -31,7 +31,7 @@
  */
 public class AboutBox extends JDialogWithDetails {

-       private final static String product = "Frost";
+       private final static String product = "Frost for Freenet 0.7";

        // because a growing amount of users use CVS version:
        private String version = null;

Modified: trunk/apps/frost-0.7/source/frost/gui/MessageFrame.java
===================================================================
--- trunk/apps/frost-0.7/source/frost/gui/MessageFrame.java     2006-02-11 
18:54:59 UTC (rev 8016)
+++ trunk/apps/frost-0.7/source/frost/gui/MessageFrame.java     2006-02-11 
19:22:16 UTC (rev 8017)
@@ -1304,11 +1304,11 @@
             Board boardObj = null;

             SharedFileObject sfo;
-            if (aChosedFile.length() > FcpInsert.smallestChunk) {
-               sfo = new FECRedirectFileObject(aChosedFile,boardObj);
-            } else { 
+//            if (aChosedFile.length() > FcpInsert.smallestChunk) {
+//             sfo = new FECRedirectFileObject(aChosedFile,boardObj);
+//            } else { 
                sfo= new SharedFileObject(aChosedFile, boardObj);
-            }
+//            }
                        if( addAttachedFilesToUploadTable.isSelected() ) {
                                sfo.setOwner(sign.isSelected() ?
                                                                        
Mixed.makeFilename(myId.getUniqueName()) :
@@ -1347,22 +1347,8 @@
             tmpFile = new File("msgframe_tmp_"+System.currentTimeMillis());
         }
         tmpFile.deleteOnExit();
-        if( mo.saveToFile(tmpFile) == true ) {
-            File zipFile = new File(tmpFile.getPath() + ".zipped");
-            zipFile.delete(); // just in case it already exists
-            zipFile.deleteOnExit(); // so that it is deleted when Frost exits
-            FileAccess.writeZipFile(FileAccess.readByteArray(tmpFile), 
"entry", zipFile);
-            long zipLen = zipFile.length();
-            tmpFile.delete();
-            zipFile.delete();
-            if( zipLen > 30000 ) { // 30000 because data+metadata must be 
smaller than 32k
-                JOptionPane.showMessageDialog( this,
-                        "The zipped message is too large ("+zipLen+" bytes, 
"+30000+" allowed)! Remove some text.",
-                        "Message text too large!",
-                        JOptionPane.ERROR_MESSAGE);
-                return;
-            }
-        } else {
+
+        if( mo.saveToFile(tmpFile) != true ) {
             JOptionPane.showMessageDialog( this,
                     "Error verifying the resulting message size.",
                     "Error!",

Modified: trunk/apps/frost-0.7/source/frost/messages/FrostIndex.java
===================================================================
--- trunk/apps/frost-0.7/source/frost/messages/FrostIndex.java  2006-02-11 
18:54:59 UTC (rev 8016)
+++ trunk/apps/frost-0.7/source/frost/messages/FrostIndex.java  2006-02-11 
19:22:16 UTC (rev 8017)
@@ -91,9 +91,9 @@
                while (it.hasNext()) {
                        Element el = (Element)it.next();
                        SharedFileObject file = 
SharedFileObject.getInstance(el);
-                       if (file.getSHA1()!=null) {
-                               filesMap.put(file.getSHA1(),file);
-            }
+//                     if (file.getSHA1()!=null) {
+                               filesMap.put(file.getKey(),file);
+//            }
                }
        }


Modified: trunk/apps/frost-0.7/source/frost/messages/SharedFileObject.java
===================================================================
--- trunk/apps/frost-0.7/source/frost/messages/SharedFileObject.java    
2006-02-11 18:54:59 UTC (rev 8016)
+++ trunk/apps/frost-0.7/source/frost/messages/SharedFileObject.java    
2006-02-11 19:22:16 UTC (rev 8017)
@@ -47,12 +47,12 @@
     String key = null; // Name of this key
     String date = null; // Last access
     String lastSharedDate = null; //date the file was shared last
-    String SHA1 = null;  //SHA1 of the file
+//    String SHA1 = null;  //SHA1 of the file
     String owner = null;  //person that uploaded the file
     Long size = new Long(0); // Filesize
     String filename = new String();
     File file = null; //the file itself
-    String batch = null;
+//    String batch = null;
     Board board;
     boolean exchange;

@@ -129,7 +129,9 @@
     /**Tests if key is valid*/
     public boolean checkKey() {
        if (key == null) return true;
-        if( key.startsWith("CHK@") && key.length() == 58 ) return true;
+//        if( key.startsWith("CHK@") && key.length() == 58 ) return true;
+        if( key.startsWith("CHK@") ) return true;
+        
         //  if (DEBUG) System.out.println("Invalid key in " + filename);
 //        logger.warning("invalid key in " + filename);
         return false;
@@ -154,16 +156,16 @@
         return filename.trim();
     }

-    /** Get SHA1 */
-    public String getSHA1() {
-        return SHA1;
-    }
+//    /** Get SHA1 */
+//    public String getSHA1() {
+//        return SHA1;
+//    }
+//
+//    /** Set SHA1 */
+//    public void setSHA1(String s) {
+//        SHA1 = s;
+//    }

-    /** Set SHA1 */
-    public void setSHA1(String s) {
-        SHA1 = s;
-    }
-
     /** Set owner */
     public void setOwner(String owner_id) {
         owner = owner_id;
@@ -238,14 +240,14 @@
        lastSharedDate=newdate;
     }

-    public String getBatch() {
-       return batch;
-    }
-    
-    public void setBatch(String what) {
-       batch=what;
-       
-    }
+//    public String getBatch() {
+//     return batch;
+//    }
+//    
+//    public void setBatch(String what) {
+//     batch=what;
+//     
+//    }

     /** Constructor*/
     public SharedFileObject(String key)
@@ -267,7 +269,7 @@
      * not be added to any index and won't participate in the request system.
      */
     public SharedFileObject(File file, Board board) {
-       SHA1 = Core.getCrypto().digest(file);
+//     SHA1 = Core.getCrypto().digest(file);
        size = new Long(file.length());
        filename = file.getName();
        date = DateFun.getDate();
@@ -280,21 +282,21 @@


        this.board = board;
-       if (board == null)
-               batch = null;
-       else { //this file will be added to index, assign  a batch
-               Iterator it = Core.getMyBatches().entrySet().iterator();
-               
-               while (it.hasNext()){
-                       String current = (String)it.next();
-                       int size = 
((Integer)Core.getMyBatches().get(current)).intValue();
-                       if (size < Core.frostSettings.getIntValue("batchSize")) 
{
-                               batch=current;
-                               break;
-                       } 
-               }
-               
-       } 
+//     if (board == null)
+//             batch = null;
+//     else { //this file will be added to index, assign  a batch
+//             Iterator it = Core.getMyBatches().entrySet().iterator();
+//             
+//             while (it.hasNext()){
+//                     String current = (String)it.next();
+//                     int size = 
((Integer)Core.getMyBatches().get(current)).intValue();
+//                     if (size < Core.frostSettings.getIntValue("batchSize")) 
{
+//                             batch=current;
+//                             break;
+//                     } 
+//             }
+//             
+//     } 
     }

     public Element getXMLElement(Document doc) {
@@ -311,22 +313,22 @@

         // always add SHA1

-        element = doc.createElement("SHA1");
-        cdata = doc.createCDATASection(getSHA1());
-        element.appendChild(cdata);
-        fileelement.appendChild(element);
+//        element = doc.createElement("SHA1");
+//        cdata = doc.createCDATASection(getSHA1());
+//        element.appendChild(cdata);
+//        fileelement.appendChild(element);

         element = doc.createElement("size");
         Text textnode = doc.createTextNode("" + getSize());
         element.appendChild(textnode);
         fileelement.appendChild(element);

-        if( getBatch() != null ) {
-            element = doc.createElement("batch");
-            textnode = doc.createTextNode(getBatch());
-            element.appendChild(textnode);
-            fileelement.appendChild(element);
-        }
+//        if( getBatch() != null ) {
+//            element = doc.createElement("batch");
+//            textnode = doc.createTextNode(getBatch());
+//            element.appendChild(textnode);
+//            fileelement.appendChild(element);
+//        }

         // f1.write(key.getFilename() + "\r\n" + key.getSize() + "\r\n" + 
key.getDate() + "\r\n" + key.getKey() +
         // "\r\n");
@@ -367,7 +369,7 @@
         // extract the values

         setFilename(XMLTools.getChildElementsCDATAValue(current, "name"));
-        setSHA1(XMLTools.getChildElementsCDATAValue(current, "SHA1"));
+//        setSHA1(XMLTools.getChildElementsCDATAValue(current, "SHA1"));

         setOwner(XMLTools.getChildElementsCDATAValue(current, "owner"));

@@ -375,7 +377,7 @@
         setDate(XMLTools.getChildElementsTextValue(current, "date"));
         setLastSharedDate(XMLTools.getChildElementsTextValue(current, 
"dateShared"));
         setSize(XMLTools.getChildElementsTextValue(current, "size"));
-        setBatch(XMLTools.getChildElementsTextValue(current, "batch"));
+//        setBatch(XMLTools.getChildElementsTextValue(current, "batch"));

         assert filename != null;
         assert size != null;
@@ -424,18 +426,18 @@
        /* (non-Javadoc)
         * @see java.lang.Object#equals(java.lang.Object)
         */
-       public boolean equals(Object obj) {
-               SharedFileObject other = (SharedFileObject) obj;
-               return SHA1.equals(other.getSHA1());
-       }
+//     public boolean equals(Object obj) {
+//             SharedFileObject other = (SharedFileObject) obj;
+//             return SHA1.equals(other.getSHA1());
+//     }
+//
+//     /* (non-Javadoc)
+//      * @see java.lang.Object#hashCode()
+//      */
+//     public int hashCode() {
+//             return SHA1.hashCode();
+//     }

-       /* (non-Javadoc)
-        * @see java.lang.Object#hashCode()
-        */
-       public int hashCode() {
-               return SHA1.hashCode();
-       }
-
        /**
         * factory method
         * @param e the element
@@ -443,13 +445,13 @@
         */
        public static SharedFileObject getInstance(Element e){
                try {
-                       if (e.getAttribute("redirect").length() > 0) { 
-                               return 
RedirectFileObject.getRedirectInstance(e);
-            } else {
+//                     if (e.getAttribute("redirect").length() > 0) { 
+//                             return 
RedirectFileObject.getRedirectInstance(e);
+//            } else {
                                SharedFileObject result = new 
SharedFileObject();
                                result.loadXMLElement(e);
                                return result;
-                       }
+//                     }
                } catch(SAXException ex) {
                        logger.log(Level.SEVERE, "parsing file failed.", ex);
                        return null;

Modified: trunk/apps/frost-0.7/source/frost/storage/DAOFactory.java
===================================================================
--- trunk/apps/frost-0.7/source/frost/storage/DAOFactory.java   2006-02-11 
18:54:59 UTC (rev 8016)
+++ trunk/apps/frost-0.7/source/frost/storage/DAOFactory.java   2006-02-11 
19:22:16 UTC (rev 8017)
@@ -4,11 +4,10 @@
  */
 package frost.storage;

-import frost.SettingsClass;
-import frost.fileTransfer.download.DownloadModelDAO;
-import frost.fileTransfer.upload.UploadModelDAO;
-import frost.identities.IdentitiesDAO;
-import frost.messaging.MessageHashesDAO;
+import frost.*;
+import frost.fileTransfer.download.*;
+import frost.fileTransfer.upload.*;
+import frost.identities.*;

 /**
  * This class implements the Abstract Factory pattern. It is used by the 
business objects
@@ -92,13 +91,6 @@
        public abstract UploadModelDAO getUploadModelDAO();

        /**
-        * This method returns a data access object for the MessageHashes
-        * business object.
-        * @return a MessageHashesDAO for the MessageHashes business object.
-        */
-       public abstract MessageHashesDAO getMessageHashesDAO();
-
-       /**
         * This method initializes the DAOFactory with the given SettingsClass.
         * @param frostSettings
         */

Modified: trunk/apps/frost-0.7/source/frost/storage/HsqldbDAOFactory.java
===================================================================
--- trunk/apps/frost-0.7/source/frost/storage/HsqldbDAOFactory.java     
2006-02-11 18:54:59 UTC (rev 8016)
+++ trunk/apps/frost-0.7/source/frost/storage/HsqldbDAOFactory.java     
2006-02-11 19:22:16 UTC (rev 8017)
@@ -4,11 +4,10 @@
  */
 package frost.storage;

-import frost.SettingsClass;
+import frost.*;
 import frost.fileTransfer.download.*;
 import frost.fileTransfer.upload.*;
 import frost.identities.*;
-import frost.messaging.*;

 /**
  * @author $author$
@@ -45,11 +44,4 @@
        public DownloadModelDAO getDownloadModelDAO() {
                return new DownloadModelHsqldbDAO();
        }
-
-       /* (non-Javadoc)
-        * @see frost.storage.DAOFactory#getMessageHashesDAO()
-        */
-       public MessageHashesDAO getMessageHashesDAO() {
-               return new MessageHashesHsqldbDAO();
-       }
 }

Modified: trunk/apps/frost-0.7/source/frost/storage/XmlDAOFactory.java
===================================================================
--- trunk/apps/frost-0.7/source/frost/storage/XmlDAOFactory.java        
2006-02-11 18:54:59 UTC (rev 8016)
+++ trunk/apps/frost-0.7/source/frost/storage/XmlDAOFactory.java        
2006-02-11 19:22:16 UTC (rev 8017)
@@ -4,11 +4,10 @@
  */
 package frost.storage;

-import frost.SettingsClass;
+import frost.*;
 import frost.fileTransfer.download.*;
 import frost.fileTransfer.upload.*;
 import frost.identities.*;
-import frost.messaging.*;

 /**
  * @author $author$
@@ -45,11 +44,4 @@
        public DownloadModelDAO getDownloadModelDAO() {
                return new DownloadModelXmlDAO(settings);
        }
-
-       /* (non-Javadoc)
-        * @see frost.storage.DAOFactory#getMessageHashesDAO()
-        */
-       public MessageHashesDAO getMessageHashesDAO() {
-               return new MessageHashesXmlDAO();
-       }
 }

Modified: trunk/apps/frost-0.7/source/frost/threads/MessageDownloadThread.java
===================================================================
--- trunk/apps/frost-0.7/source/frost/threads/MessageDownloadThread.java        
2006-02-11 18:54:59 UTC (rev 8016)
+++ trunk/apps/frost-0.7/source/frost/threads/MessageDownloadThread.java        
2006-02-11 19:22:16 UTC (rev 8017)
@@ -26,7 +26,6 @@
 import org.w3c.dom.*;

 import frost.*;
-
 import frost.boards.*;
 import frost.crypt.*;
 import frost.fcp.*;
@@ -34,7 +33,6 @@
 import frost.gui.objects.*;
 import frost.identities.*;
 import frost.messages.*;
-import frost.messaging.*;

 /**
  * Download messages.
@@ -53,7 +51,6 @@
     private boolean flagNew;

        private static Logger logger = 
Logger.getLogger(MessageDownloadThread.class.getName());
-       private MessageHashes messageHashes;

     /**
      * Constants for content of XML files if the message was dropped for some 
reason.
@@ -276,32 +273,19 @@
                 // compute the sha1 checksum of the original msg file
                 // this digest is ONLY used to check for incoming exact 
duplicate files, because
                 // the locally stored message xml file could be changed later 
by Frost
-                String messageId = Core.getCrypto().digest(testMe);
+//                String messageId = Core.getCrypto().digest(testMe);

-                // Does a duplicate message exist?
-                if( messageHashes.contains(messageId) ) {
-                    logger.info(Thread.currentThread().getName()+
-                            ": TOFDN: ****** Duplicate Message : 
"+testMe.getName()+" *****");
-                    System.out.println(Thread.currentThread().getName()+
-                            ": TOFDN: ****** Duplicate Message : 
"+testMe.getName()+" *****");
-                    FileAccess.writeFile(DUPLICATE_MSG, testMe); // this file 
is ignored by the gui
-                    continue;
-                }
-
-                // else message is not a duplicate, continue to process
-               messageHashes.add(messageId);
-
                 // if no metadata, message wasn't signed
                 if (metadata == null) {

-                    byte[] unzippedXml = FileAccess.readZipFileBinary(testMe);
-                    if( unzippedXml == null ) {
-                        logger.log(Level.SEVERE, "TOFDN: Unzip of unsigned xml 
failed");
-                        System.out.println("TOFDN: Unzip of unsigned xml 
failed");
-                        FileAccess.writeFile(BROKEN_MSG, testMe); // this file 
is ignored by the gui
-                        continue;
-                    }
-                    FileAccess.writeFile(unzippedXml, testMe);
+//                    byte[] unzippedXml = 
FileAccess.readZipFileBinary(testMe);
+//                    if( unzippedXml == null ) {
+//                        logger.log(Level.SEVERE, "TOFDN: Unzip of unsigned 
xml failed");
+//                        System.out.println("TOFDN: Unzip of unsigned xml 
failed");
+//                        FileAccess.writeFile(BROKEN_MSG, testMe); // this 
file is ignored by the gui
+//                        continue;
+//                    }
+//                    FileAccess.writeFile(unzippedXml, testMe);

                     try {
                         currentMsg = new VerifyableMessageObject(testMe);
@@ -381,9 +365,9 @@

                     // 2. if yes, decrypt the content
                     byte[] cipherText = FileAccess.readByteArray(testMe);
-                    byte[] zipData = 
Core.getCrypto().decrypt(cipherText,identities.getMyId().getPrivKey());
+                    byte[] msgContent = 
Core.getCrypto().decrypt(cipherText,identities.getMyId().getPrivKey());

-                    if( zipData == null ) {
+                    if( msgContent == null ) {
                         logger.log(Level.SEVERE, "TOFDN: Encrypted message 
from "+encMetaData.getPerson().getUniqueName()+
                                                  " could not be decrypted!");
                         FileAccess.writeFile(DECRYPT_FAILED, testMe); // this 
file is ignored by the gui
@@ -391,7 +375,7 @@
                     }

                     testMe.delete();
-                    FileAccess.writeFile(zipData, testMe);
+                    FileAccess.writeFile(msgContent, testMe);

                     logger.fine("TOFDN: Decrypted an encrypted message for me, 
sender was "+encMetaData.getPerson().getUniqueName());

@@ -400,13 +384,13 @@
                 } //endif encrypted message

                 // unzip
-                byte[] unzippedXml = FileAccess.readZipFileBinary(testMe);
-                if( unzippedXml == null ) {
-                    logger.log(Level.SEVERE, "TOFDN: Unzip of signed xml 
failed");
-                    FileAccess.writeFile(BROKEN_MSG, testMe); // this file is 
ignored by the gui
-                    continue;
-                }
-                FileAccess.writeFile(unzippedXml, testMe);
+//                byte[] unzippedXml = FileAccess.readZipFileBinary(testMe);
+//                if( unzippedXml == null ) {
+//                    logger.log(Level.SEVERE, "TOFDN: Unzip of signed xml 
failed");
+//                    FileAccess.writeFile(BROKEN_MSG, testMe); // this file 
is ignored by the gui
+//                    continue;
+//                }
+//                FileAccess.writeFile(unzippedXml, testMe);

                 // create object
                 try {
@@ -531,11 +515,4 @@
                this.keypool = kpool;
                this.maxMessageDownload = Integer.parseInt(maxmsg);
        }
-
-       /**
-        * @param messageHashes
-        */
-       public void setMessageHashes(MessageHashes messageHashes) {
-               this.messageHashes = messageHashes;             
-       }
 }

Modified: trunk/apps/frost-0.7/source/frost/threads/MessageUploadThread.java
===================================================================
--- trunk/apps/frost-0.7/source/frost/threads/MessageUploadThread.java  
2006-02-11 18:54:59 UTC (rev 8016)
+++ trunk/apps/frost-0.7/source/frost/threads/MessageUploadThread.java  
2006-02-11 19:22:16 UTC (rev 8017)
@@ -60,7 +60,7 @@
     private boolean secure;

     private byte[] signMetadata;
-       private File zipFile;
+    private File uploadFile;

     private Identity encryptForRecipient;

@@ -165,35 +165,35 @@
         * @return true if the remote message with the given key equals the 
         *                      message that is being uploaded. False otherwise.
         */
-       private boolean checkRemoteFile(String key) {
-               try {
-            File remoteFile = new File(messageFile.getPath() + ".coll");
-            remoteFile.delete(); // just in case it already exists
-            remoteFile.deleteOnExit(); // so that it is deleted when Frost 
exits
-
-            FcpRequest.getFile(key, null, remoteFile, messageUploadHtl, false, 
false);
-            if (remoteFile.length() > 0) {
-                if( encryptForRecipient != null ) {
-                    // we compare the local encrypted zipFile with remoteFile
-                    boolean isEqual = FileAccess.compareFiles(zipFile, 
remoteFile);
-                    return isEqual;
-                } else {
-                    // compare contents
-                    byte[] unzippedXml = 
FileAccess.readZipFileBinary(remoteFile);
-                    if(unzippedXml == null) {
-                        return false;
-                    }
-                    FileAccess.writeFile(unzippedXml, remoteFile);
-                    return checkLocalMessage(remoteFile);
-                }
-            } else {
-               return false; // We could not retrieve the remote file. We 
assume they are different.
-            }
-        } catch (Throwable e) {
-            logger.log(Level.WARNING, "Handled exception in checkRemoteFile", 
e);
-            return false;
-        }
-       }
+//     private boolean checkRemoteFile(String key) {
+//             try {
+//            File remoteFile = new File(messageFile.getPath() + ".coll");
+//            remoteFile.delete(); // just in case it already exists
+//            remoteFile.deleteOnExit(); // so that it is deleted when Frost 
exits
+//
+//            FcpRequest.getFile(key, null, remoteFile, messageUploadHtl, 
false, false);
+//            if (remoteFile.length() > 0) {
+//                if( encryptForRecipient != null ) {
+//                    // we compare the local encrypted zipFile with remoteFile
+//                    boolean isEqual = FileAccess.compareFiles(uploadFile, 
remoteFile);
+//                    return isEqual;
+//                } else {
+//                    // compare contents
+//                    byte[] unzippedXml = 
FileAccess.readZipFileBinary(remoteFile);
+//                    if(unzippedXml == null) {
+//                        return false;
+//                    }
+//                    FileAccess.writeFile(unzippedXml, remoteFile);
+//                    return checkLocalMessage(remoteFile);
+//                }
+//            } else {
+//             return false; // We could not retrieve the remote file. We 
assume they are different.
+//            }
+//        } catch (Throwable e) {
+//            logger.log(Level.WARNING, "Handled exception in 
checkRemoteFile", e);
+//            return false;
+//        }
+//     }

        /**
         * This method composes the downloading key for the message, given a
@@ -201,34 +201,34 @@
         * @param index index number to use to compose the key
         * @return they composed key
         */
-       private String composeDownKey(int index) {
-               String key;
-               if (secure) {
-                       key = new StringBuffer()
-                                       .append(publicKey)
-                                       .append("/")
-                                       .append(board.getBoardFilename())
-                                       .append("/")
-                                       .append(message.getDate())
-                                       .append("-")
-                                       .append(index)
-                                       .append(".xml")
-                                       .toString();
-               } else {
-                       key = new StringBuffer()
-                                       .append("KSK at frost/message/")
-                                       
.append(frostSettings.getValue("messageBase"))
-                                       .append("/")
-                                       .append(message.getDate())
-                                       .append("-")
-                                       .append(board.getBoardFilename())
-                                       .append("-")
-                                       .append(index)
-                                       .append(".xml")
-                                       .toString();
-               }
-               return key;
-       }
+//     private String composeDownKey(int index) {
+//             String key;
+//             if (secure) {
+//                     key = new StringBuffer()
+//                                     .append(publicKey)
+//                                     .append("/")
+//                                     .append(board.getBoardFilename())
+//                                     .append("/")
+//                                     .append(message.getDate())
+//                                     .append("-")
+//                                     .append(index)
+//                                     .append(".xml")
+//                                     .toString();
+//             } else {
+//                     key = new StringBuffer()
+//                                     .append("KSK at frost/message/")
+//                                     
.append(frostSettings.getValue("messageBase"))
+//                                     .append("/")
+//                                     .append(message.getDate())
+//                                     .append("-")
+//                                     .append(board.getBoardFilename())
+//                                     .append("-")
+//                                     .append(index)
+//                                     .append(".xml")
+//                                     .toString();
+//             }
+//             return key;
+//     }

        /**
         * This method composes the uploading key for the message, given a
@@ -326,62 +326,47 @@
                }

                // zip the xml file to a temp file
-               zipFile = new File(messageFile.getPath() + ".upltmp");
-               zipFile.delete(); // just in case it already exists
-               zipFile.deleteOnExit(); // so that it is deleted when Frost 
exits
-               FileAccess.writeZipFile(FileAccess.readByteArray(messageFile), 
"entry", zipFile);
+               uploadFile = new File(messageFile.getPath() + ".upltmp");
+        uploadFile.delete(); // just in case it already exists
+        uploadFile.deleteOnExit(); // so that it is deleted when Frost exits

-        if( !zipFile.isFile() || zipFile.length() == 0 ) {
-            logger.severe("Error: zip of message xml file failed, result file 
not existing or empty. Please report to a dev!");
+        FileAccess.copyFile(messageFile.getPath(), uploadFile.getPath());
+        if( !uploadFile.isFile() || uploadFile.length() == 0 ) {
+            logger.severe("Error: Copy of message xml file failed, result file 
not existing or empty. Please report to a dev!");
             return false;
         }

-               // encrypt and sign or just sign the zipped file if necessary
+               // encrypt and sign or just sign the message file if necessary
                String sender = message.getFrom();
                String myId = identities.getMyId().getUniqueName();
                if (sender.equals(myId) // nick same as my identity
                        || sender.equals(Mixed.makeFilename(myId))) // 
serialization may have changed it
                {
-            byte[] zipped = FileAccess.readByteArray(zipFile);
+            byte[] msgFileContent = FileAccess.readByteArray(messageFile);

             if( encryptForRecipient != null ) {
                 // encrypt + sign
                 // first encrypt, then sign

-                byte[] encData = Core.getCrypto().encrypt(zipped, 
encryptForRecipient.getKey());
+                byte[] encData = Core.getCrypto().encrypt(msgFileContent, 
encryptForRecipient.getKey());
                 if( encData == null ) {
                     logger.severe("Error: could not encrypt the message, 
please report to a dev!");
                     return false;
                 }
-                zipFile.delete();
-                FileAccess.writeFile(encData, zipFile); // write encrypted zip 
file
+                FileAccess.writeFile(encData, uploadFile); // write encrypted 
file

                 EncryptMetaData ed = new EncryptMetaData(encData, 
identities.getMyId(), encryptForRecipient.getUniqueName());
                 signMetadata = XMLTools.getRawXMLDocument(ed);

             } else {
                 // sign only
-                       SignMetaData md = new SignMetaData(zipped, 
identities.getMyId());
+                       SignMetaData md = new SignMetaData(msgFileContent, 
identities.getMyId());
                        signMetadata = XMLTools.getRawXMLDocument(md);
             }
                } else if( encryptForRecipient != null ) {
             logger.log(Level.SEVERE, "TOFUP: ALERT - can't encrypt message if 
sender is Anonymous! Will not send message!");
                    return false; // unable to encrypt
         }
-
-        long allLength = zipFile.length();
-        if( signMetadata != null ) {
-            allLength += signMetadata.length;
-        }
-        if( allLength > 32767 ) { // limit in FcpInsert.putFile()
-            String txt = "<html>The data you want to upload is too large 
("+allLength+"), "+32767+" is allowed.<br>"+
-                         "This should never happen, please report this to a 
Frost developer!</html>";
-            JOptionPane.showMessageDialog(parentFrame, txt, "Error: message 
too large", JOptionPane.ERROR_MESSAGE);
-            // TODO: the msg will be NEVER sent, we need an unsent folder in 
gui
-            // but no too large message should reach us, see MessageFrame
-            return false;
-        }
-
                return true;
        }

@@ -403,9 +388,6 @@
                                Level.SEVERE,
                                "ERROR: MessageUploadThread.run(): unexpected 
IOException, terminating thread ...",
                                ex);
-//             } catch (MessageAlreadyUploadedException exception) {
-//                     logger.info("The message had already been uploaded. 
Therefore it will not be uploaded again.");
-//                     messageFile.delete();
                } catch (Throwable t) {
                        logger.log(Level.SEVERE, "Oo. EXCEPTION in 
MessageUploadThread", t);
                }
@@ -467,7 +449,7 @@
                int tries = 0;
                while (tries < maxTries
                        && !result[0].equals("KeyCollision")
-                       && !result[0].equals("Success")) {
+                       && !result[0].equals("PutSuccessful")) {
                        try {
                                result =
                                        FcpInsert.putFile(
@@ -545,12 +527,22 @@
                return success;
        }

-    private String composeMsgFilename(int index) {
-        
+    /**
+     * Composes the complete path + filename of a messagefile in the keypool 
for the given index.
+     */
+    private String composeMsgFilePath(int index) {
         return new 
StringBuffer().append(getDestinationBase()).append(message.getDate())
         
.append("-").append(board.getBoardFilename()).append("-").append(index).append(".xml")
         .toString();
     }
+
+    /**
+     * Composes only the filename of a messagefile in the keypool for the 
given index.
+     */
+    private String composeMsgFileNameWithoutXml(int index) {
+        return new StringBuffer().append(message.getDate()).append("-")
+        .append(board.getBoardFilename()).append("-").append(index).toString();
+    }

     /**
      * Finds the next free index slot, starting at startIndex.
@@ -572,7 +564,7 @@

         while(true) {

-            String testFilename = composeMsgFilename(tryIndex);
+            String testFilename = composeMsgFilePath(tryIndex);

             File testMe = new File(testFilename);
             if (testMe.exists() && testMe.length() > 0) {
@@ -625,7 +617,7 @@
             }

             // probably empty, check if other threads currently try to insert 
to this index
-            File lockRequestIndex = new File(composeMsgFilename(index) + 
".lock");
+            File lockRequestIndex = new File(composeMsgFilePath(index) + 
".lock");
             boolean lockFileCreated = false;
             lockFileCreated = lockRequestIndex.createNewFile();

@@ -643,11 +635,11 @@
             // try to insert message
             String[] result = new String[2];
             String upKey = composeUpKey(index);
-            String downKey = composeDownKey(index);
+//            String downKey = composeDownKey(index);

             try {
                 // signMetadata is null for unsigned upload. Do not do 
redirect (false)
-                result = FcpInsert.putFile(upKey, zipFile, signMetadata, 
messageUploadHtl, false);
+                result = FcpInsert.putFile(upKey, uploadFile, signMetadata, 
messageUploadHtl, false);
             } catch (Throwable t) {
                 logger.log(Level.SEVERE, "TOFUP: Error in 
run()/FcpInsert.putFile", t);
                 System.out.println("TOFUP: Error in run()/FcpInsert.putFile");
@@ -663,16 +655,16 @@
                 success = true;
             } else {
                 if (result[0].equals("KeyCollision")) {
-                    if (checkRemoteFile(downKey)) {
-                        logger.info("TOFUP: Message seems to be already 
uploaded (2)");
-                        System.out.println("TOFUP: Message seems to be already 
uploaded (2)");
-                        success = true;
-//                        throw new MessageAlreadyUploadedException(); // bad 
idea!
-                    } else {
+//                    if (checkRemoteFile(downKey)) {
+//                        logger.info("TOFUP: Message seems to be already 
uploaded (2)");
+//                        System.out.println("TOFUP: Message seems to be 
already uploaded (2)");
+//                        success = true;
+////                        throw new MessageAlreadyUploadedException(); // 
bad idea!
+//                    } else {
                         index++;
                         logger.fine("TOFUP: Upload collided, increasing index 
to " + index);
                         System.out.println("TOFUP: Upload collided, increasing 
index to " + index);
-                    }
+//                    }
                 } else {
                     if (tries > maxTries) {
                         success = true;
@@ -694,10 +686,6 @@
         }

         if (!error) {
-            // we will see the message if received from freenet
-            messageFile.delete();
-            zipFile.delete();
-
             
logger.info("*********************************************************************\n"
                     + "Message successfully uploaded to board '" + 
board.getName() + "'.\n"
                     + 
"*********************************************************************");
@@ -705,6 +693,27 @@
                     + "Message successfully uploaded to board '" + 
board.getName() + "'.\n"
                     + 
"*********************************************************************");
             tryAgain = false;
+            
+            // move message file to sent folder
+            
+            String finalName = composeMsgFileNameWithoutXml(index);
+
+            File sentTarget = new File( frostSettings.getValue("sent.dir") + 
finalName + ".xml" );
+            
+            int counter = 2;
+            while( sentTarget.exists() ) {
+                // paranoia, target file already exists, append an increasing 
number
+                sentTarget = new File( frostSettings.getValue("sent.dir") + 
finalName + "-" + counter + ".xml" );
+                counter++;
+            }
+            
+            boolean wasOk = messageFile.renameTo(sentTarget);
+            if( !wasOk ) {
+                logger.severe("Error: rename of '"+messageFile.getPath()+"' 
into '"+sentTarget.getPath()+"' failed!");
+                messageFile.delete(); // we must delete the file from unsent 
folder to prevent another upload
+            }
+            uploadFile.delete();
+
         } else {
             logger.warning("TOFUP: Error while uploading message.");
             System.out.println("TOFUP: Error while uploading message.");
@@ -719,11 +728,11 @@
                     logger.info("TOFUP: Will try to upload again.");
                     tryAgain = true;
                 } else if (answer == 
MessageUploadFailedDialog.RETRY_NEXT_STARTUP_VALUE) {
-                    zipFile.delete();
+                    uploadFile.delete();
                     logger.info("TOFUP: Will try to upload again on next 
startup.");
                     tryAgain = false;
                 } else if (answer == MessageUploadFailedDialog.DISCARD_VALUE) {
-                    zipFile.delete();
+                    uploadFile.delete();
                     messageFile.delete();
                     logger.warning("TOFUP: Will NOT try to upload message 
again.");
                     tryAgain = false;

Modified: 
trunk/apps/frost-0.7/source/frost/threads/RunningBoardUpdateThreads.java
===================================================================
--- trunk/apps/frost-0.7/source/frost/threads/RunningBoardUpdateThreads.java    
2006-02-11 18:54:59 UTC (rev 8016)
+++ trunk/apps/frost-0.7/source/frost/threads/RunningBoardUpdateThreads.java    
2006-02-11 19:22:16 UTC (rev 8017)
@@ -24,11 +24,9 @@
 import javax.swing.*;

 import frost.*;
-
 import frost.gui.objects.*;
 import frost.identities.*;
 import frost.messages.*;
-import frost.messaging.*;

 /**
  * This class maintains the message download and upload threads.
@@ -53,8 +51,6 @@
     // contains key=board, data=vector of BoardUpdateThread's (multiple of 
kind MSG_UPLOAD)
     Hashtable runningUploadThreads = null;

-       private MessageHashes messageHashes;
-
     /**
      * @param parentFrame
      * @param identities
@@ -94,7 +90,6 @@
                                config.getValue("keypool.dir"),
                                config.getValue("maxMessageDownload"),
                                identities);
-               tofd.setMessageHashes(messageHashes);

                // register listener and this class as listener
                tofd.addBoardUpdateThreadListener(this);
@@ -130,7 +125,6 @@
                                config.getValue("keypool.dir"),
                                config.getValue("maxMessageDownload"),
                                identities);
-               backload.setMessageHashes(messageHashes);

                // register listener and this class as listener
                backload.addBoardUpdateThreadListener(this);
@@ -272,7 +266,8 @@
         public void run() {
             notifyThreadStarted(this);

-            final int downloadBack = 
MainFrame.frostSettings.getIntValue("maxMessageDownload");
+            // +1 for today
+            final int downloadBack = 1 + 
MainFrame.frostSettings.getIntValue("maxMessageDownload");
             // if one gets an exception, do not try backwards further
             try {
                 for (int i=0; i < downloadBack; i++) {
@@ -283,7 +278,6 @@
                         isForToday = false;
                     }
                     UpdateIdThread thread = new 
UpdateIdThread(board,DateFun.getDate(i), newIdentities, isForToday);
-                    thread.setMessageHashes(messageHashes);

                     // directly call run, we want to block
                     thread.run();
@@ -635,13 +629,6 @@
         return false;
     }

-       /**
-        * @param messageHashes
-        */
-       public void setMessageHashes(MessageHashes messageHashes) {
-               this.messageHashes = messageHashes;
-       }
-
 /*
 maybe useable if the counters are set on thread start/end
     int updatingBoards = 0;

Modified: trunk/apps/frost-0.7/source/frost/threads/UpdateIdThread.java
===================================================================
--- trunk/apps/frost-0.7/source/frost/threads/UpdateIdThread.java       
2006-02-11 18:54:59 UTC (rev 8016)
+++ trunk/apps/frost-0.7/source/frost/threads/UpdateIdThread.java       
2006-02-11 19:22:16 UTC (rev 8017)
@@ -23,14 +23,12 @@
 import java.util.logging.*;

 import frost.*;
-
+import frost.crypt.*;
 import frost.fcp.*;
-import frost.fileTransfer.Index;
-import frost.crypt.SignMetaData;
-import frost.gui.objects.Board;
+import frost.fileTransfer.*;
+import frost.gui.objects.*;
 import frost.identities.*;
-import frost.messages.FrostIndex;
-import frost.messaging.MessageHashes;
+import frost.messages.*;

 public class UpdateIdThread extends Thread // extends BoardUpdateThreadObject 
implements BoardUpdateThread
 {
@@ -51,7 +49,6 @@
     private String requestKey;
     private String insertKey;
     private final static String fileSeparator = 
System.getProperty("file.separator");
-       private MessageHashes messageHashes;

     private boolean isForToday = false;
     private FrostIdentities identities;
@@ -93,14 +90,13 @@

         FrostIndex frostIndex = new FrostIndex(files);
         files = null;
-        File uploadIndexFile = new File(keypool + board.getBoardFilename() + 
"_upload.zip");
+        File uploadIndexFile = new File(keypool + board.getBoardFilename() + 
"_upload.tmp");

-        // zip the xml file before upload
-        FileAccess.writeZipFile(XMLTools.getRawXMLDocument(frostIndex), 
"entry", uploadIndexFile);
+        FileAccess.writeFile(XMLTools.getRawXMLDocument(frostIndex), 
uploadIndexFile);
         frostIndex = null;

         if( !uploadIndexFile.isFile() || uploadIndexFile.length() == 0 ) {
-            logger.warning("No index file to upload, save/zip failed.");
+            logger.warning("No index file to upload, save failed.");
             return false; // error
         }

@@ -124,8 +120,7 @@
         boolean success = false;

         try {
-
-            // sign zip file if requested
+            // sign file if requested
             boolean signUpload = 
MainFrame.frostSettings.getBoolValue("signUploads");
             byte[] metadata = null;
             if( signUpload ) {
@@ -150,7 +145,7 @@
                         insertHtl, 
                         false); // doRedirect

-                if( result[0].equals("Success") ) {
+                if( result[0].equals("PutSuccessful") ) {
                     success = true;
                     // my files are already added to totalIdx, we don't need 
to download this index
                     indexSlots.setSlotUsed(index);
@@ -250,31 +245,22 @@
                     index = indexSlots.findNextFreeSlot(index);
                                        failures = 0;

-                                       // check if we have received such file 
before
-                                       String digest = 
Core.getCrypto().digest(target);
-                                       if( messageHashes.contains(digest) ) {
-                                               // we have.  erase and continue
-                                               target.delete();
-                                               continue;
-                                       } else {
-                        // else add it to the set of received files to prevent 
duplicates
-                        messageHashes.add(digest);
-                    }
-
                                        // Add it to the index
                                        try {
                                                // we need to unzip here to 
check if identity IN FILE == identity IN METADATA
-                                               byte[] unzippedXml = 
FileAccess.readZipFileBinary(target);
-                                               if (unzippedXml == null) {
-                                                       logger.warning("Could 
not extract received zip file, skipping.");
-                                                       target.delete();
-                                                       continue;
-                                               }
+//                                             byte[] unzippedXml = 
FileAccess.readZipFileBinary(target);
+//                                             if (unzippedXml == null) {
+//                                                     logger.warning("Could 
not extract received zip file, skipping.");
+//                                                     target.delete();
+//                                                     continue;
+//                                             }
+//
+//                                             File unzippedTarget = new 
File(target.getPath() + "_unzipped");
+//                                             
FileAccess.writeFile(unzippedXml, unzippedTarget);
+//                        unzippedXml = null;
+                         
+                        File unzippedTarget = target;

-                                               File unzippedTarget = new 
File(target.getPath() + "_unzipped");
-                                               
FileAccess.writeFile(unzippedXml, unzippedTarget);
-                        unzippedXml = null;
-
                                                //create the FrostIndex object
                                                FrostIndex receivedIndex = null;
                                                try {
@@ -526,13 +512,6 @@
         }
        }

-       /**
-        * @param messageHashes
-        */
-       public void setMessageHashes(MessageHashes messageHashes) {
-               this.messageHashes = messageHashes;             
-       }
-    
     /**
      * Class provides functionality to track used index slots
      * for upload and download.


Reply via email to