• R/O
  • SSH
  • HTTPS

cabos:


File Info

Rev. 20
Tamanho 85,850 bytes
Hora 2008-09-27 18:20:45
Autor heavy_baby
Mensagem de Log

move

Content

? .svn
? com/.svn
? com/bitzi/.svn
? com/bitzi/util/.svn
? com/limegroup/.svn
? com/limegroup/gnutella/.svn
? com/limegroup/gnutella/altlocs/.svn
? com/limegroup/gnutella/archive/.svn
? com/limegroup/gnutella/auth/.svn
? com/limegroup/gnutella/bootstrap/.svn
? com/limegroup/gnutella/bootstrap/timeoutsocket.pyc
? com/limegroup/gnutella/browser/.svn
? com/limegroup/gnutella/chat/.svn
? com/limegroup/gnutella/connection/.svn
? com/limegroup/gnutella/dime/.svn
? com/limegroup/gnutella/downloader/.svn
? com/limegroup/gnutella/filters/.svn
? com/limegroup/gnutella/guess/.svn
? com/limegroup/gnutella/handshaking/.svn
? com/limegroup/gnutella/html/.svn
? com/limegroup/gnutella/http/.svn
? com/limegroup/gnutella/io/.svn
? com/limegroup/gnutella/library/.svn
? com/limegroup/gnutella/licenses/.svn
? com/limegroup/gnutella/messages/.svn
? com/limegroup/gnutella/messages/vendor/.svn
? com/limegroup/gnutella/metadata/.svn
? com/limegroup/gnutella/mp3/.svn
? com/limegroup/gnutella/routing/.svn
? com/limegroup/gnutella/search/.svn
? com/limegroup/gnutella/security/.svn
? com/limegroup/gnutella/settings/.svn
? com/limegroup/gnutella/simpp/.svn
? com/limegroup/gnutella/spam/.svn
? com/limegroup/gnutella/statistics/.svn
? com/limegroup/gnutella/tigertree/.svn
? com/limegroup/gnutella/udpconnect/.svn
? com/limegroup/gnutella/updates/.svn
? com/limegroup/gnutella/upelection/.svn
? com/limegroup/gnutella/uploader/.svn
? com/limegroup/gnutella/util/.svn
? com/limegroup/gnutella/version/.svn
? com/limegroup/gnutella/xml/.svn
? native/.svn
? native/linux/.svn
? native/osx/.svn
? native/windows/.svn
? native/windowsfirewall/.svn
Index: com/limegroup/gnutella/ActivityCallback.java
===================================================================
RCS file: /cvs/core/com/limegroup/gnutella/ActivityCallback.java,v
retrieving revision 1.70.28.1
diff -u -r1.70.28.1 ActivityCallback.java
--- com/limegroup/gnutella/ActivityCallback.java	18 Jan 2007 20:57:44 -0000	1.70.28.1
+++ com/limegroup/gnutella/ActivityCallback.java	22 Mar 2008 13:46:16 -0000
@@ -3,10 +3,10 @@
 import java.io.File;
 import java.util.Set;
 
-import com.limegroup.gnutella.browser.MagnetOptions;
-import com.limegroup.gnutella.chat.Chatter;
+//import com.limegroup.gnutella.browser.MagnetOptions;
+//import com.limegroup.gnutella.chat.Chatter;
 import com.limegroup.gnutella.search.HostData;
-import com.limegroup.gnutella.version.UpdateInformation;
+//import com.limegroup.gnutella.version.UpdateInformation;
 
 /**
  *  Callback to notify the GUI of asynchronous backend events.
@@ -76,16 +76,16 @@
     public void removeUpload(Uploader u);    
 
 	/** Add a new incoming chat connection */
-	public void acceptChat(Chatter ctr);
+	//public void acceptChat(Chatter ctr);
 
     /** A new message is available from the given chatter */
-	public void receiveMessage(Chatter chr);
+	//public void receiveMessage(Chatter chr);
 
 	/** The given chatter is no longer available */
-	public void chatUnavailable(Chatter chatter);
+	//public void chatUnavailable(Chatter chatter);
 
 	/** display an error message in the chat gui */
-	public void chatErrorMessage(Chatter chatter, String str);
+	//public void chatErrorMessage(Chatter chatter, String str);
 
     /** display an error message since the browse host failed. 
      *  @param guid The GUID of the browse host.
@@ -125,7 +125,7 @@
 	/**
 	 * Notification that an update became available.
 	 */
-	public void updateAvailable(UpdateInformation info);
+	//public void updateAvailable(UpdateInformation info);
 
 	/**
 	 * Sets the enabled/disabled state of file annotation.
@@ -162,7 +162,7 @@
 	 * @param magnets
 	 * @return true if the callback handles the magnet links
 	 */
-	public boolean handleMagnets(final MagnetOptions[] magnets);
+	//public boolean handleMagnets(final MagnetOptions[] magnets);
 	
 	/**
 	 * Indicates that the firewalled state of this has changed. 
Index: com/limegroup/gnutella/ConnectionDispatcher.java
===================================================================
RCS file: /cvs/core/com/limegroup/gnutella/Attic/ConnectionDispatcher.java,v
retrieving revision 1.3
diff -u -r1.3 ConnectionDispatcher.java
--- com/limegroup/gnutella/ConnectionDispatcher.java	15 May 2006 21:22:52 -0000	1.3
+++ com/limegroup/gnutella/ConnectionDispatcher.java	22 Mar 2008 13:46:21 -0000
@@ -6,8 +6,8 @@
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 
-import com.limegroup.gnutella.browser.ExternalControl;
-import com.limegroup.gnutella.chat.ChatManager;
+//import com.limegroup.gnutella.browser.ExternalControl;
+//import com.limegroup.gnutella.chat.ChatManager;
 import com.limegroup.gnutella.http.HTTPRequestMethod;
 import com.limegroup.gnutella.settings.ConnectionSettings;
 import com.limegroup.gnutella.statistics.HTTPStat;
@@ -125,7 +125,7 @@
             return;
         case CHAT:
             HTTPStat.CHAT_REQUESTS.incrementStat();
-            ChatManager.instance().accept(client);
+            //ChatManager.instance().accept(client);
             return;
         case GIV:
             HTTPStat.GIV_REQUESTS.incrementStat();
@@ -157,7 +157,7 @@
                     break;
                 case MAGNET:
                     HTTPStat.MAGNET_REQUESTS.incrementStat();  
-                    ExternalControl.fireMagnet(client);
+                    //ExternalControl.fireMagnet(client);
                     break;
                 default:
                     IOUtils.close(client);
Index: com/limegroup/gnutella/ConnectionManager.java
===================================================================
RCS file: /cvs/core/com/limegroup/gnutella/ConnectionManager.java,v
retrieving revision 1.325
diff -u -r1.325 ConnectionManager.java
--- com/limegroup/gnutella/ConnectionManager.java	13 Jun 2006 01:43:41 -0000	1.325
+++ com/limegroup/gnutella/ConnectionManager.java	22 Mar 2008 13:46:25 -0000
@@ -115,7 +115,8 @@
     /**
      * The number of connections leaves should maintain to Ultrapeers.
      */
-    public static final int PREFERRED_CONNECTIONS_FOR_LEAF = 3;
+//    public static final int PREFERRED_CONNECTIONS_FOR_LEAF = 3;
+    public static final int PREFERRED_CONNECTIONS_FOR_LEAF = 4;
 
     /**
      * How many connect back requests to send if we have a single connection
Index: com/limegroup/gnutella/DownloadManager.java
===================================================================
RCS file: /cvs/core/com/limegroup/gnutella/DownloadManager.java,v
retrieving revision 1.152
diff -u -r1.152 DownloadManager.java
--- com/limegroup/gnutella/DownloadManager.java	7 Jun 2006 20:32:40 -0000	1.152
+++ com/limegroup/gnutella/DownloadManager.java	22 Mar 2008 13:46:30 -0000
@@ -27,11 +27,11 @@
 import org.apache.commons.logging.LogFactory;
 
 import com.bitzi.util.Base32;
-import com.limegroup.gnutella.browser.MagnetOptions;
+//import com.limegroup.gnutella.browser.MagnetOptions;
 import com.limegroup.gnutella.downloader.CantResumeException;
-import com.limegroup.gnutella.downloader.InNetworkDownloader;
+//import com.limegroup.gnutella.downloader.InNetworkDownloader;
 import com.limegroup.gnutella.downloader.IncompleteFileManager;
-import com.limegroup.gnutella.downloader.MagnetDownloader;
+//import com.limegroup.gnutella.downloader.MagnetDownloader;
 import com.limegroup.gnutella.downloader.ManagedDownloader;
 import com.limegroup.gnutella.downloader.RequeryDownloader;
 import com.limegroup.gnutella.downloader.ResumeDownloader;
@@ -51,7 +51,7 @@
 import com.limegroup.gnutella.settings.ConnectionSettings;
 import com.limegroup.gnutella.settings.DownloadSettings;
 import com.limegroup.gnutella.settings.SharingSettings;
-import com.limegroup.gnutella.settings.UpdateSettings;
+//import com.limegroup.gnutella.settings.UpdateSettings;
 import com.limegroup.gnutella.statistics.DownloadStat;
 import com.limegroup.gnutella.udpconnect.UDPConnection;
 import com.limegroup.gnutella.util.CommonUtils;
@@ -65,9 +65,9 @@
 import com.limegroup.gnutella.util.ProcessingQueue;
 import com.limegroup.gnutella.util.ThreadFactory;
 import com.limegroup.gnutella.util.URLDecoder;
-import com.limegroup.gnutella.version.DownloadInformation;
-import com.limegroup.gnutella.version.UpdateHandler;
-import com.limegroup.gnutella.version.UpdateInformation;
+//import com.limegroup.gnutella.version.DownloadInformation;
+//import com.limegroup.gnutella.version.UpdateHandler;
+//import com.limegroup.gnutella.version.UpdateInformation;
 
 
 /** 
@@ -204,7 +204,7 @@
     protected void initialize(DownloadCallback guiCallback, MessageRouter router,
                               FileManager fileManager) {
         this.callback = guiCallback;
-        this.innetworkCallback = new InNetworkCallback();
+        //this.innetworkCallback = new InNetworkCallback();
         this.router = router;
         this.fileManager = fileManager;
         scheduleWaitingPump();
@@ -259,6 +259,7 @@
     /**
      * Determines if an 'In Network' download exists in either active or waiting.
      */
+    /*
     public synchronized boolean hasInNetworkDownload() {
         if(innetworkCount > 0)
             return true;
@@ -268,11 +269,13 @@
         }
         return false;
     }
+    */
     
     /**
      * Kills all in-network downloaders that are not present in the list of URNs
      * @param urns a current set of urns that we are downloading in-network.
      */
+    /*
     public synchronized void killDownloadersNotListed(Collection updates) {
         if (updates == null)
             return;
@@ -295,6 +298,7 @@
         hopeless.retainAll(urns);
         UpdateSettings.FAILED_UPDATES.setValue(hopeless);
     }
+    */
     
     /**
      * Schedules the runnable that pumps through waiting downloads.
@@ -329,8 +333,10 @@
                 cleanupCompletedDownload(md, false);
             } else if(hasFreeSlot() && (md.hasNewSources() || md.getRemainingStateTime() <= 0)) {
                 i.remove();
+                /*
                 if(md instanceof InNetworkDownloader)
                     innetworkCount++;
+                */
                 active.add(md);
                 md.startDownload();
             } else {
@@ -641,6 +647,7 @@
 	 *  null 
      * @throws SaveLocationException 
      */
+    /*
     public synchronized Downloader download(MagnetOptions magnet,
 			boolean overwrite,
 			File saveDir,
@@ -675,6 +682,7 @@
         initializeDownload(downloader);
         return downloader;
     }
+    */
 
     /**
      * Starts a resume download for the given incomplete file.
@@ -737,6 +745,7 @@
     /**
      * Downloads an InNetwork update, using the info from the DownloadInformation.
      */
+    /*
     public synchronized Downloader download(DownloadInformation info, long now) 
     throws SaveLocationException {
         File dir = FileManager.PREFERENCE_SHARE;
@@ -751,6 +760,7 @@
         initializeDownload(d);
         return d;
     }
+    */
         
     
     /**
@@ -775,7 +785,8 @@
      * Returns the callback that should be used for the given md.
      */
     private DownloadCallback callback(ManagedDownloader md) {
-        return (md instanceof InNetworkDownloader) ? innetworkCallback : callback;
+        //return (md instanceof InNetworkDownloader) ? innetworkCallback : callback;
+        return callback;
     }
         
 	/**
@@ -989,8 +1000,10 @@
     public synchronized void remove(ManagedDownloader downloader, 
                                     boolean completed) {
         active.remove(downloader);
+        /*
         if(downloader instanceof InNetworkDownloader)
             innetworkCount--;
+        */
         
         waiting.remove(downloader);
         if(completed)
@@ -1505,8 +1518,10 @@
         boolean c = false;
         for (Iterator iter = activeCopy.iterator(); iter.hasNext(); ) {
             BandwidthTracker bt = (BandwidthTracker)iter.next();
+            /*
             if (bt instanceof InNetworkDownloader)
                 continue;
+            */
             
             c = true;
             bt.measureBandwidth();
@@ -1531,8 +1546,10 @@
         float sum=0;
         for (Iterator iter = activeCopy.iterator(); iter.hasNext(); ) {
             BandwidthTracker bt = (BandwidthTracker)iter.next();
+            /*
             if (bt instanceof InNetworkDownloader)
                 continue;
+            */
             
             float curr = 0;
             try{
@@ -1628,6 +1645,7 @@
     /**
      * Once an in-network download finishes, the UpdateHandler is notified.
      */
+   /*
     private static class InNetworkCallback implements DownloadCallback {
         public void addDownload(Downloader d) {}
         public void removeDownload(Downloader d) {
@@ -1645,6 +1663,7 @@
         }
         public String getHostValue(String key) { return null; }
     }
+    */
 	
 
     /** Simple ConnectObserver for FWT connections. */
@@ -1662,4 +1681,13 @@
         }
     }
     
+    /* cabos */
+    public Iterator getDownloads() {
+    	List downloads = new ArrayList();
+    	synchronized (this) {
+    		downloads.addAll(active);
+    		downloads.addAll(waiting);
+    	}
+    	return downloads.iterator();
+    }
 }
Index: com/limegroup/gnutella/ExtendedEndpoint.java
===================================================================
RCS file: /cvs/core/com/limegroup/gnutella/ExtendedEndpoint.java,v
retrieving revision 1.17
diff -u -r1.17 ExtendedEndpoint.java
--- com/limegroup/gnutella/ExtendedEndpoint.java	22 May 2006 19:35:19 -0000	1.17
+++ com/limegroup/gnutella/ExtendedEndpoint.java	22 Mar 2008 13:46:32 -0000
@@ -7,6 +7,8 @@
 import java.util.Comparator;
 import java.util.Iterator;
 
+import phex.common.Ip2CountryManager;
+
 import com.limegroup.gnutella.settings.ConnectionSettings;
 import com.limegroup.gnutella.settings.ApplicationSettings;
 import com.limegroup.gnutella.util.CommonUtils;
@@ -115,6 +117,8 @@
     public ExtendedEndpoint(String host, int port) { 
         super(host, port);
         this.timeRecorded=now();
+        /* cabos */
+        _clientLocale = Ip2CountryManager.getInstance().getIP2Language(host, _clientLocale);
     }
     
     public ExtendedEndpoint(InetAddress addr, int port) { 
Index: com/limegroup/gnutella/FileManager.java
===================================================================
RCS file: /cvs/core/com/limegroup/gnutella/FileManager.java,v
retrieving revision 1.188.4.1
diff -u -r1.188.4.1 FileManager.java
--- com/limegroup/gnutella/FileManager.java	11 Jan 2007 19:34:46 -0000	1.188.4.1
+++ com/limegroup/gnutella/FileManager.java	22 Mar 2008 13:46:37 -0000
@@ -34,7 +34,7 @@
 import com.limegroup.gnutella.util.ProcessingQueue;
 import com.limegroup.gnutella.util.StringUtils;
 import com.limegroup.gnutella.util.Trie;
-import com.limegroup.gnutella.version.UpdateHandler;
+//import com.limegroup.gnutella.version.UpdateHandler;
 import com.limegroup.gnutella.xml.LimeXMLDocument;
 
 /**
@@ -644,7 +644,7 @@
         RouterService.getDownloadManager().getIncompleteFileManager().registerAllIncompleteFiles();
         save();
         SavedFileManager.instance().run();
-        UpdateHandler.instance().tryToDownloadUpdates();
+        //UpdateHandler.instance().tryToDownloadUpdates();
         RouterService.getCallback().fileManagerLoaded();
     }
     
Index: com/limegroup/gnutella/ManagedConnection.java
===================================================================
RCS file: /cvs/core/com/limegroup/gnutella/Attic/ManagedConnection.java,v
retrieving revision 1.155.4.5
diff -u -r1.155.4.5 ManagedConnection.java
--- com/limegroup/gnutella/ManagedConnection.java	2 Jul 2007 15:36:25 -0000	1.155.4.5
+++ com/limegroup/gnutella/ManagedConnection.java	22 Mar 2008 13:46:44 -0000
@@ -71,12 +71,12 @@
 import com.limegroup.gnutella.simpp.SimppManager;
 import com.limegroup.gnutella.statistics.OutOfBandThroughputStat;
 import com.limegroup.gnutella.statistics.ReceivedMessageStatHandler;
-import com.limegroup.gnutella.updates.UpdateManager;
+//import com.limegroup.gnutella.updates.UpdateManager;
 import com.limegroup.gnutella.util.BandwidthThrottle;
 import com.limegroup.gnutella.util.DataUtils;
 import com.limegroup.gnutella.util.ThreadFactory;
 import com.limegroup.gnutella.util.ThrottledOutputStream;
-import com.limegroup.gnutella.version.UpdateHandler;
+//import com.limegroup.gnutella.version.UpdateHandler;
 
 /**
  * A Connection managed by a ConnectionManager.  Includes a loopForMessages
@@ -421,7 +421,7 @@
         // Start our OutputRunner.
         startOutput();
         // See if this connection had an old-style update msg.
-        UpdateManager.instance().checkAndUpdate(this);
+        //UpdateManager.instance().checkAndUpdate(this);
     }
 
     /**
@@ -1080,6 +1080,7 @@
             }
             
             // see if there's a new update message.
+            /*
             int latestId = UpdateHandler.instance().getLatestId();
             int currentId = capVM.supportsUpdate();
             if(currentId != -1 && (!receivedCapVM || currentId > latestId)) {
@@ -1088,6 +1089,7 @@
             }
             else if(currentId == latestId)
                 UpdateHandler.instance().handleUpdateAvailable(this, currentId);
+            */
             
             receivedCapVM = true;
         }
Index: com/limegroup/gnutella/MessageRouter.java
===================================================================
RCS file: /cvs/core/com/limegroup/gnutella/MessageRouter.java,v
retrieving revision 1.247.8.10
diff -u -r1.247.8.10 MessageRouter.java
--- com/limegroup/gnutella/MessageRouter.java	2 Jul 2007 15:36:27 -0000	1.247.8.10
+++ com/limegroup/gnutella/MessageRouter.java	22 Mar 2008 13:46:51 -0000
@@ -81,7 +81,7 @@
 import com.limegroup.gnutella.util.NoMoreStorageException;
 import com.limegroup.gnutella.util.ProcessingQueue;
 import com.limegroup.gnutella.util.Sockets;
-import com.limegroup.gnutella.version.UpdateHandler;
+//import com.limegroup.gnutella.version.UpdateHandler;
 
 
 /**
@@ -329,8 +329,10 @@
         setMessageHandler(HeadPing.class, new HeadPingHandler());
         setMessageHandler(SimppRequestVM.class, new SimppRequestVMHandler());
         setMessageHandler(SimppVM.class, new SimppVMHandler());
+        /*
         setMessageHandler(UpdateRequest.class, new UpdateRequestHandler());
         setMessageHandler(UpdateResponse.class, new UpdateResponseHandler());
+        */
         setMessageHandler(HeadPong.class, new HeadPongHandler());
         setMessageHandler(VendorMessage.class, new VendorMessageHandler());
         
@@ -343,7 +345,7 @@
         setUDPMessageHandler(ReplyNumberVendorMessage.class, new UDPReplyNumberMessageHandler());
         setUDPMessageHandler(UDPCrawlerPing.class, new UDPUDPCrawlerPingHandler());
         setUDPMessageHandler(HeadPing.class, new UDPHeadPingHandler());
-        setUDPMessageHandler(UpdateRequest.class, new UDPUpdateRequestHandler());
+        //setUDPMessageHandler(UpdateRequest.class, new UDPUpdateRequestHandler());
         setUDPMessageHandler(ContentResponse.class, new UDPContentResponseHandler());
         
         setMulticastMessageHandler(QueryRequest.class, new MulticastQueryRequestHandler());
@@ -1748,7 +1750,8 @@
         // only send to at most 4 Ultrapeers, as we could have more
         // as a result of race conditions - also, don't send what is new
         // requests down too many connections
-        final int max = qr.isWhatIsNewRequest() ? 2 : 3;
+        //final int max = qr.isWhatIsNewRequest() ? 2 : 3;
+        final int max = qr.isWhatIsNewRequest() ? 2 : 4;
 	int start = !qr.isWhatIsNewRequest() ? 0 :
 		(int) (Math.floor(Math.random()*(list.size()-1)));
         int limit = Math.min(max, list.size());
@@ -2025,6 +2028,7 @@
     /**
      *  Handles an update request by sending a response.
      */
+    /*
     private void handleUpdateRequest(UpdateRequest req, ReplyHandler handler ) {
 
         byte[] data = UpdateHandler.instance().getLatestBytes();
@@ -2033,6 +2037,7 @@
             handler.reply(msg);
         }
     }
+    */
     
     /** Handles a ContentResponse msg -- passing it to the ContentManager. */
     private void handleContentResponse(ContentResponse msg, ReplyHandler handler) {
@@ -2042,9 +2047,11 @@
     /**
      * Passes the request onto the update manager.
      */
+    /*
     private void handleUpdateResponse(UpdateResponse resp, ReplyHandler handler) {
         UpdateHandler.instance().handleNewData(resp.getUpdate(), handler);
     }
+    */
 
     /**
      * The default handler for PushRequests received in
@@ -2964,17 +2971,21 @@
         }
     }
     
+    /*
     private class UpdateRequestHandler implements MessageHandler {
         public void handleMessage(Message msg, InetSocketAddress addr, ReplyHandler handler) {
             handleUpdateRequest((UpdateRequest)msg, handler);
         }
     }
+    */
     
+    /*
     private class UpdateResponseHandler implements MessageHandler {
         public void handleMessage(Message msg, InetSocketAddress addr, ReplyHandler handler) {
             handleUpdateResponse((UpdateResponse)msg, handler);
         }
     }
+    */
     
     private class HeadPongHandler implements MessageHandler {
         public void handleMessage(Message msg, InetSocketAddress addr, ReplyHandler handler) {
@@ -3076,11 +3087,13 @@
         }
     }
     
+    /*
     private class UDPUpdateRequestHandler implements MessageHandler {
         public void handleMessage(Message msg, InetSocketAddress addr, ReplyHandler handler) {
             handleUpdateRequest((UpdateRequest)msg, handler);
         }
     }
+    */
     
     private class UDPContentResponseHandler implements MessageHandler {
         public void handleMessage(Message msg, InetSocketAddress addr, ReplyHandler handler) {
Index: com/limegroup/gnutella/Response.java
===================================================================
RCS file: /cvs/core/com/limegroup/gnutella/Response.java,v
retrieving revision 1.66
diff -u -r1.66 Response.java
--- com/limegroup/gnutella/Response.java	5 Aug 2005 21:48:30 -0000	1.66
+++ com/limegroup/gnutella/Response.java	22 Mar 2008 13:46:58 -0000
@@ -23,6 +23,8 @@
 import com.limegroup.gnutella.messages.GGEP;
 import com.limegroup.gnutella.messages.HUGEExtension;
 import com.limegroup.gnutella.search.HostData;
+/* cabos */
+import com.limegroup.gnutella.util.I18NConvert;
 import com.limegroup.gnutella.util.IpPort;
 import com.limegroup.gnutella.util.NameValue;
 import com.limegroup.gnutella.util.DataUtils;
@@ -179,7 +181,8 @@
 		if (name == null)
 			this.name = "";
 		else
-			this.name = name;
+			//this.name = name;
+			this.name = I18NConvert.instance().compose(name);
 
         byte[] temp = null;
         try {
Index: com/limegroup/gnutella/ResponseVerifier.java
===================================================================
RCS file: /cvs/core/com/limegroup/gnutella/ResponseVerifier.java,v
retrieving revision 1.24
diff -u -r1.24 ResponseVerifier.java
--- com/limegroup/gnutella/ResponseVerifier.java	12 Oct 2005 18:35:48 -0000	1.24
+++ com/limegroup/gnutella/ResponseVerifier.java	22 Mar 2008 13:46:59 -0000
@@ -55,7 +55,8 @@
      *  A mapping from GUIDs to the words of the search made with that GUID.
      */
     private ForgetfulHashMap /* GUID -> RequestData */ mapper =
-        new ForgetfulHashMap(15);
+//        new ForgetfulHashMap(15);
+        new ForgetfulHashMap(100);
     /** The characters to use in stripping apart queries. */
     private static final String DELIMITERS="+ ";
     /** The size of a Mandragore worm response, i.e., 8KB. */
Index: com/limegroup/gnutella/RouterService.java
===================================================================
RCS file: /cvs/core/com/limegroup/gnutella/Attic/RouterService.java,v
retrieving revision 1.314.2.2
diff -u -r1.314.2.2 RouterService.java
--- com/limegroup/gnutella/RouterService.java	5 Apr 2007 21:07:44 -0000	1.314.2.2
+++ com/limegroup/gnutella/RouterService.java	22 Mar 2008 13:47:02 -0000
@@ -20,10 +20,10 @@
 import com.limegroup.gnutella.altlocs.AltLocManager;
 import com.limegroup.gnutella.auth.ContentManager;
 import com.limegroup.gnutella.bootstrap.BootstrapServerManager;
-import com.limegroup.gnutella.browser.HTTPAcceptor;
-import com.limegroup.gnutella.browser.MagnetOptions;
-import com.limegroup.gnutella.chat.ChatManager;
-import com.limegroup.gnutella.chat.Chatter;
+//import com.limegroup.gnutella.browser.HTTPAcceptor;
+//import com.limegroup.gnutella.browser.MagnetOptions;
+//import com.limegroup.gnutella.chat.ChatManager;
+//import com.limegroup.gnutella.chat.Chatter;
 import com.limegroup.gnutella.downloader.CantResumeException;
 import com.limegroup.gnutella.downloader.HTTPDownloader;
 import com.limegroup.gnutella.downloader.IncompleteFileManager;
@@ -53,7 +53,7 @@
 import com.limegroup.gnutella.tigertree.TigerTreeCache;
 import com.limegroup.gnutella.udpconnect.UDPMultiplexor;
 import com.limegroup.gnutella.udpconnect.UDPSelectorProvider;
-import com.limegroup.gnutella.updates.UpdateManager;
+//import com.limegroup.gnutella.updates.UpdateManager;
 import com.limegroup.gnutella.upelection.PromotionManager;
 import com.limegroup.gnutella.uploader.NormalUploadState;
 import com.limegroup.gnutella.util.IpPortSet;
@@ -62,7 +62,7 @@
 import com.limegroup.gnutella.util.SimpleTimer;
 import com.limegroup.gnutella.util.Sockets;
 import com.limegroup.gnutella.util.ThreadFactory;
-import com.limegroup.gnutella.version.UpdateHandler;
+//import com.limegroup.gnutella.version.UpdateHandler;
 import com.limegroup.gnutella.xml.MetaFileManager;
 
 
@@ -129,7 +129,7 @@
     /**
      * <tt>HTTPAcceptor</tt> instance for accepting magnet requests, etc.
      */
-    private static HTTPAcceptor httpAcceptor;
+    //private static HTTPAcceptor httpAcceptor;
 
 	/**
 	 * Initialize the class that manages all TCP connections.
@@ -432,22 +432,26 @@
             downloader.postGuiInit();
             LOG.trace("STOP DownloadManager.postGuiInit");
             
+            /*
             LOG.trace("START UpdateManager.instance");
             callback.componentLoading("UPDATE_MANAGER");
             UpdateManager.instance();
             UpdateHandler.instance();
             LOG.trace("STOP UpdateManager.instance");
+            */
 
             LOG.trace("START QueryUnicaster");
             callback.componentLoading("QUERY_UNICASTER");
     		QueryUnicaster.instance().start();
     		LOG.trace("STOP QueryUnicaster");
     		
+    		/*
     		LOG.trace("START HTTPAcceptor");
             callback.componentLoading("HTTPACCEPTOR");
             httpAcceptor = new HTTPAcceptor();  
             httpAcceptor.start();
             LOG.trace("STOP HTTPAcceptor");
+            */
             
             LOG.trace("START Pinger");
             callback.componentLoading("PINGER");
@@ -636,9 +640,11 @@
      *
      * @return the <tt>Acceptor</tt> in use
      */
+    /*
     public static HTTPAcceptor getHTTPAcceptor() {
         return httpAcceptor;
     }
+    */
 
     /** 
      * Accessor for the <tt>HostCatcher</tt> instance.
@@ -1498,6 +1504,7 @@
 	 * @throws IllegalArgumentException if the magnet is not 
 	 * {@link MagnetOptions#isDownloadable() valid}.
 	 */
+	/*
 	public static Downloader download(MagnetOptions magnet, boolean overwrite) 
 		throws SaveLocationException {
 		if (!magnet.isDownloadable()) {
@@ -1505,6 +1512,7 @@
 		}
 		return downloader.download(magnet, overwrite, null, magnet.getDisplayName());
 	}
+	*/
 
 	/**
 	 * Creates a downloader for a magnet using the given additional options.
@@ -1522,10 +1530,12 @@
 	 * @throws IllegalArgumentException if the magnet is not
 	 * {@link MagnetOptions#isDownloadable() downloadable}.
 	 */
+	/*
 	public static Downloader download(MagnetOptions magnet, boolean overwrite,
 			File saveDir, String fileName) throws SaveLocationException {
 		return downloader.download(magnet, overwrite, saveDir, fileName);
 	}
+	*/
 
    /**
      * Starts a resume download for the given incomplete file.
@@ -1541,10 +1551,12 @@
 	/**
 	 * Creates and returns a new chat to the given host and port.
 	 */
+    /*
 	public static Chatter createChat(String host, int port) {
 		Chatter chatter = ChatManager.instance().request(host, port);
 		return chatter;
 	}
+	*/
     
     /**
 	 * Browses the passed host
Index: com/limegroup/gnutella/UPnPManager.java
===================================================================
RCS file: /cvs/core/com/limegroup/gnutella/UPnPManager.java,v
retrieving revision 1.19
diff -u -r1.19 UPnPManager.java
--- com/limegroup/gnutella/UPnPManager.java	1 Mar 2006 19:24:55 -0000	1.19
+++ com/limegroup/gnutella/UPnPManager.java	22 Mar 2008 13:47:07 -0000
@@ -118,7 +118,6 @@
 	
 	private UPnPManager() {
 	    super();
-	    
         addDeviceChangeListener(this);
     }
     
@@ -266,8 +265,17 @@
 		
 		Random gen=null;
 		
+        /* cabos
 		String localAddress = NetworkUtils.ip2string(
 				RouterService.getAcceptor().getAddress(false));
+        */
+        String localAddress;
+        try {
+            localAddress = NetworkUtils.getLocalAddress().getHostAddress();
+        } catch (UnknownHostException e) {
+            localAddress = NetworkUtils.ip2string(RouterService.getAcceptor().getAddress(false));
+        }
+            
 		int localPort = port;
 	
 		// try adding new mappings with the same port
Index: com/limegroup/gnutella/UploadManager.java
===================================================================
RCS file: /cvs/core/com/limegroup/gnutella/UploadManager.java,v
retrieving revision 1.188.2.1
diff -u -r1.188.2.1 UploadManager.java
--- com/limegroup/gnutella/UploadManager.java	20 Jun 2006 20:43:33 -0000	1.188.2.1
+++ com/limegroup/gnutella/UploadManager.java	22 Mar 2008 13:47:11 -0000
@@ -1795,4 +1795,12 @@
     		ACTIVE_UPLOADS.remove(sha1);
     	}
     }
+    /* cabos */
+    public Iterator getUploads() {
+    	List uploads = new ArrayList();
+    	synchronized (this) {
+    		uploads.addAll(_activeUploadList);
+    	}
+    	return uploads.iterator();
+    }
 }
Index: com/limegroup/gnutella/bootstrap/DefaultBootstrapServers.java
===================================================================
RCS file: /cvs/core/com/limegroup/gnutella/bootstrap/Attic/DefaultBootstrapServers.java,v
retrieving revision 1.21
diff -u -r1.21 DefaultBootstrapServers.java
--- com/limegroup/gnutella/bootstrap/DefaultBootstrapServers.java	12 May 2005 19:30:15 -0000	1.21
+++ com/limegroup/gnutella/bootstrap/DefaultBootstrapServers.java	22 Mar 2008 13:47:19 -0000
@@ -27,19 +27,18 @@
 
     //These should NOT be URL encoded.
     static String[] urls=new String[] {
-        "http://cache.kicks-ass.net:8000/",
-        "http://crab2.dyndns.org:30002/gwc/",
-        "http://gwc.jooz.net:8010/gwc/",
-        "http://gwc.nonamer.ath.cx:8080/",
-        "http://gwc1.nouiz.org/servlet/GWebCache/req",
-        "http://gwcrab.sarcastro.com:8001/",
-        "http://gwebcache.linuxonly.nl/",
-        "http://kisama.ath.cx:8080/",
-        "http://krill.shacknet.nu:20095/gwc",
-        "http://loot.alumnigroup.org/",
-        "http://node02.hewson.cns.ufl.edu:8080/pwc.cgi",
-        "http://overbeer.ghostwhitecrab.de/",
-        "http://starscream.dynalias.com/",
-        "http://toadface.bishopston.net:3558/"
+        "http://bbs.robertwoolley.co.uk/gwebcache/gcache.php",
+        "http://cache.aiskacang.com/skulls/skulls.php",
+        "http://g2.tjtech.org/g2/index.php",
+        "http://gwc.dietpac.com:8080/",
+        "http://gwc.eod.cc/skulls.php",
+        "http://gwc.frodoslair.net.nyud.net/skulls/skulls.php",
+        "http://gwc.frodoslair.net/skulls/skulls.php",
+        "http://gwc.glucolene.com:8080/",
+        "http://gwc.monnsta.net/",
+        "http://gwc.nickstallman.net/",
+        "http://gwc1c.olden.ch.3557.nyud.net:8080/gwc/",
+        "http://sites.matros.cjb.net/p2p/gcache/skulls.php",
+        "http://www.dom2porno.info/skulls/skulls.php"
     };
 }
Index: com/limegroup/gnutella/bootstrap/UDPHostCache.java
===================================================================
RCS file: /cvs/core/com/limegroup/gnutella/bootstrap/UDPHostCache.java,v
retrieving revision 1.12
diff -u -r1.12 UDPHostCache.java
--- com/limegroup/gnutella/bootstrap/UDPHostCache.java	2 Sep 2005 20:16:56 -0000	1.12
+++ com/limegroup/gnutella/bootstrap/UDPHostCache.java	22 Mar 2008 13:47:19 -0000
@@ -283,6 +283,20 @@
     
     protected void loadDefaults() {
       // ADD DEFAULT UDP HOST CACHES HERE.
+    	/* cabos */
+        createAndAdd("cornflake.sirinet.net", 21000);
+        createAndAdd("galvatron.dyndns.org", 59009);
+        createAndAdd("gwc.dietpac.com", 8080);
+        createAndAdd("gwc.glucolene.com", 8080);
+        createAndAdd("kisama.ath.cx", 8080);
+        createAndAdd("krill.shacknet.nu", 20095);
+        createAndAdd("pokerface.ibiza.bishopston.net", 3558);
+        createAndAdd("secondary.udp-host-cache.com", 9999);
+        createAndAdd("uhc.udp-host-cache.com", 9999);
+        createAndAdd("uhc2.limewire.com", 20181);
+        createAndAdd("uhc3.limewire.com", 51180);
+        createAndAdd("yang.cloud.bishopston.net", 33558);
+        createAndAdd("yin.cloud.bishopston.net", 33558);
     }
     
     /**
Index: com/limegroup/gnutella/bootstrap/make_defaults.py
===================================================================
RCS file: /cvs/core/com/limegroup/gnutella/bootstrap/Attic/make_defaults.py,v
retrieving revision 1.7
diff -u -r1.7 make_defaults.py
--- com/limegroup/gnutella/bootstrap/make_defaults.py	12 May 2005 19:30:16 -0000	1.7
+++ com/limegroup/gnutella/bootstrap/make_defaults.py	22 Mar 2008 13:47:20 -0000
@@ -19,7 +19,7 @@
 #The latest complete GWebCache scan.  This is a mirror of
 #http://zero-g.net/gwc/GWebCache.net, which is currently out.
 #start_url="http://www.gnucleus.net/gwebcache/GWebCache.net"
-start_url="http://loot.alumnigroup.org/?urlfile=400&client=TEST"
+#start_url="http://loot.alumnigroup.org/?urlfile=400&client=TEST"
 #Where to write the output.  Default: console
 out=sys.stdout
 #Write bad hosts as comments?
@@ -31,8 +31,8 @@
 #The top-level main() method.
 def make_defaults():
     #1. Get unvalidated URLs
-    get_new_candidates()
     get_old_candidates()
+    #get_new_candidates()
     candidates.sort()
 
     #2. Validate and print
@@ -44,15 +44,19 @@
 ########################### Find URLs to Consider #####################
 
 #Fills up CANDIDATES with the entries of START_URL, without verifying.
-def get_new_candidates():
-    f=urlopen(start_url) 
-    while 1:
-        line=strip(f.readline())
-        if line=="":
-            break                     #eof
-        if not contains(candidates, line):
-            candidates.append(line)   #a new candidate
-    f.close()
+def get_new_candidates(url):
+    timeoutsocket.setDefaultSocketTimeout(60)
+    try:
+        f=urlopen(url+"?urlfile=1&client=LIME&version=4.12.15") 
+        while 1:
+            line=strip(f.readline())
+            if line=="":
+                break                     #eof
+            if not contains(candidates, line):
+                candidates.append(line)   #a new candidate
+        f.close()
+    except:
+        return 0
 
 #Reads old URLs from DefaultBootstrapServer.java and stores them in
 #candidates, without verifying them.
@@ -70,6 +74,7 @@
             #...and add if unique
             if not contains(candidates, url):
                 candidates.append(url)                        
+                get_new_candidates(url)
     f.close()
 
 #Returns true if list contains some url "similar" to url
@@ -104,7 +109,7 @@
         wrote=0
         try:
             #f=urlopen(url+"?hostfile=1")
-            f=urlopen(url+"?client=TEST&version=GWC0.8.5&hostfile=1")
+            f=urlopen(url+"?hostfile=1&client=LIME&version=4.12.15")
             if valid_file(f):
                 wrote=print_candidate(url, 1, first_line)
             else:
Index: com/limegroup/gnutella/downloader/DownloadWorker.java
===================================================================
RCS file: /cvs/core/com/limegroup/gnutella/downloader/DownloadWorker.java,v
retrieving revision 1.60.2.1
diff -u -r1.60.2.1 DownloadWorker.java
--- com/limegroup/gnutella/downloader/DownloadWorker.java	20 Jul 2006 17:07:34 -0000	1.60.2.1
+++ com/limegroup/gnutella/downloader/DownloadWorker.java	22 Mar 2008 13:47:31 -0000
@@ -1517,7 +1517,8 @@
          */
         public void handleConnect(Socket socket) {
             //LOG.debug(_rfd + " -- Handling connect from PushConnector");
-            HTTPDownloader dl = new HTTPDownloader(socket, _rfd, _commonOutFile, _manager instanceof InNetworkDownloader);
+            //HTTPDownloader dl = new HTTPDownloader(socket, _rfd, _commonOutFile, _manager instanceof InNetworkDownloader);
+            HTTPDownloader dl = new HTTPDownloader(socket, _rfd, _commonOutFile, false);
             try {
                dl.connectTCP(0);
                DownloadStat.CONNECT_PUSH_SUCCESS.incrementStat();
@@ -1592,7 +1593,8 @@
             //LOG.debug(_rfd + " -- Handling connect from DirectConnector");
             NumericalDownloadStat.TCP_CONNECT_TIME.addData((int) (System.currentTimeMillis() - createTime));
             DownloadStat.CONNECT_DIRECT_SUCCESS.incrementStat();
-            HTTPDownloader dl = new HTTPDownloader(socket, _rfd, _commonOutFile, _manager instanceof InNetworkDownloader);
+            //HTTPDownloader dl = new HTTPDownloader(socket, _rfd, _commonOutFile, _manager instanceof InNetworkDownloader);
+            HTTPDownloader dl = new HTTPDownloader(socket, _rfd, _commonOutFile, false);
             try {
                 dl.connectTCP(0); // already connected, timeout doesn't matter.
             } catch(IOException iox) {
Index: com/limegroup/gnutella/downloader/IncompleteFileManager.java
===================================================================
RCS file: /cvs/core/com/limegroup/gnutella/downloader/IncompleteFileManager.java,v
retrieving revision 1.49
diff -u -r1.49 IncompleteFileManager.java
--- com/limegroup/gnutella/downloader/IncompleteFileManager.java	13 Jun 2006 17:50:34 -0000	1.49
+++ com/limegroup/gnutella/downloader/IncompleteFileManager.java	22 Mar 2008 13:47:36 -0000
@@ -269,7 +269,7 @@
 		//make sure its created.. (the user might have deleted it)
 		dirsMade = incDir.mkdirs();
 		
-		String convertedName = CommonUtils.convertFileName(name);
+		//String convertedName = CommonUtils.convertFileName(name);
 
         try {
 
@@ -283,7 +283,8 @@
                 //the value set of HASHES.  Because we allow risky resumes,
                 //there's no need to look at BLOCKS as well...
                 for (int i=1 ; ; i++) {
-                    file = new File(incDir, tempName(convertedName, size, i));
+                    //file = new File(incDir, tempName(convertedName, size, i));
+                    file = new File(incDir, tempName(incDir.getAbsolutePath(), name, size, i));
                     baseFile = file;
                     file = canonicalize(file);
                     canonFile = file;
@@ -307,7 +308,8 @@
         } else {
             //No hash.
             File f = new File(incDir, 
-                        tempName(convertedName, size, 0));
+                        //tempName(convertedName, size, 0));
+                        tempName(incDir.getAbsolutePath(), name, size, 0));
             baseFile = f;
             f = canonicalize(f);
             canonFile = f;
@@ -344,20 +346,24 @@
      * @param count a suffix to attach before the file extension in parens
      *  before the file extension, or 1 for none. 
      */
-    private static String tempName(String filename, int size, int suffix) {
+    //private static String tempName(String filename, int size, int suffix) {
+    private static String tempName(String dir, String filename, int size, int suffix) {
         if (suffix<=1) {
             //a) No suffix
-            return "T-"+size+"-"+filename;
+            //return "T-"+size+"-"+filename;
+            return "T-"+size+"-"+CommonUtils.convertFileName(filename, dir+"T-"+size+"-");
         }
         int i=filename.lastIndexOf('.');
         if (i<0) {
             //b) Suffix, no extension
-            return "T-"+size+"-"+filename+" ("+suffix+")";
+            //return "T-"+size+"-"+filename+" ("+suffix+")";
+            return "T-"+size+"-"+CommonUtils.convertFileName(filename, dir+"T-"+size+"- ("+suffix+")")+" ("+suffix+")";
         } else {
             //c) Suffix, file extension
             String noExtension=filename.substring(0,i);
             String extension=filename.substring(i); //e.g., ".txt"
-            return "T-"+size+"-"+noExtension+" ("+suffix+")"+extension;
+            //return "T-"+size+"-"+noExtension+" ("+suffix+")"+extension;
+            return "T-"+size+"-"+CommonUtils.convertFileName(noExtension, dir+"T-"+size+"- ("+suffix+")"+extension)+" ("+suffix+")"+extension;
         }            
     }
 
Index: com/limegroup/gnutella/downloader/ManagedDownloader.java
===================================================================
RCS file: /cvs/core/com/limegroup/gnutella/downloader/ManagedDownloader.java,v
retrieving revision 1.382
diff -u -r1.382 ManagedDownloader.java
--- com/limegroup/gnutella/downloader/ManagedDownloader.java	14 Jun 2006 17:10:26 -0000	1.382
+++ com/limegroup/gnutella/downloader/ManagedDownloader.java	22 Mar 2008 13:47:42 -0000
@@ -1916,7 +1916,8 @@
             throw new SaveLocationException(SaveLocationException.FILESYSTEM_ERROR, candidateFile);
         }
 		
-        if (! FileUtils.setWriteable(saveDirectory))    
+//        if (! FileUtils.setWriteable(saveDirectory))    
+        if (! FileUtils.setWriteable(saveDirectory) && ! FileUtils.setWriteable(candidateFile))    
             throw new SaveLocationException(SaveLocationException.DIRECTORY_NOT_WRITEABLE,saveDirectory);
 		
         if (candidateFile.exists()) {
@@ -2793,7 +2794,8 @@
              Assert.that(false,"defaultFileName is null, "+
                          "subclass may have not overridden getDefaultFileName");
          }
-		 return CommonUtils.convertFileName(fileName);
+		 //return CommonUtils.convertFileName(fileName);
+		 return CommonUtils.convertFileName(fileName, SharingSettings.getSaveDirectory().getAbsolutePath());
     }
 
 
@@ -3121,4 +3123,33 @@
     public Object removeAttribute( String key ) {
         return attributes.remove( key );
     }
+    /* cabos */    
+    public synchronized String getActiveHostAddresses() {
+    	StringBuffer buffer = new StringBuffer();
+    	for (Iterator i = currentRFDs.iterator(); i.hasNext(); ) {
+    		RemoteFileDesc rfd = (RemoteFileDesc)i.next();
+    		if (rfd.browseHostEnabled()) {
+    			buffer.append(rfd.getAddress());
+    			buffer.append(":");
+    			buffer.append(rfd.getPort());
+    			buffer.append(",");
+    		}
+    	}
+    	return buffer.toString();
+    }
+    
+    public synchronized int getActiveHostCount() {
+    	return _activeWorkers.size();
+    }
+    
+    private boolean canceled = false;
+    
+    public boolean canceled() {
+    	return canceled;
+    }
+    
+    public void cancel() {
+    	canceled = true;
+    	stop();
+    }
 }
Index: com/limegroup/gnutella/filters/KeywordFilter.java
===================================================================
RCS file: /cvs/core/com/limegroup/gnutella/filters/KeywordFilter.java,v
retrieving revision 1.15
diff -u -r1.15 KeywordFilter.java
--- com/limegroup/gnutella/filters/KeywordFilter.java	16 Feb 2006 21:32:59 -0000	1.15
+++ com/limegroup/gnutella/filters/KeywordFilter.java	22 Mar 2008 13:47:48 -0000
@@ -66,6 +66,12 @@
         disallow("vagina");
         disallow("whore");
         disallow("xxx");
+        /* cabos */
+        disallow("orgasm");
+        disallow("sexy");
+        disallow("fucking");
+        disallow("adult");
+        disallow("porno");
     }
 
     /**
Index: com/limegroup/gnutella/handshaking/DefaultHeaders.java
===================================================================
RCS file: /cvs/core/com/limegroup/gnutella/handshaking/DefaultHeaders.java,v
retrieving revision 1.13
diff -u -r1.13 DefaultHeaders.java
--- com/limegroup/gnutella/handshaking/DefaultHeaders.java	3 Aug 2005 15:16:22 -0000	1.13
+++ com/limegroup/gnutella/handshaking/DefaultHeaders.java	22 Mar 2008 13:47:50 -0000
@@ -6,7 +6,7 @@
 import com.limegroup.gnutella.RouterService;
 import com.limegroup.gnutella.settings.ApplicationSettings;
 import com.limegroup.gnutella.settings.ConnectionSettings;
-import com.limegroup.gnutella.updates.UpdateManager;
+//import com.limegroup.gnutella.updates.UpdateManager;
 import com.limegroup.gnutella.util.CommonUtils;
 import com.limegroup.gnutella.util.NetworkUtils;
 
@@ -69,11 +69,13 @@
         
         props.put(HeaderNames.X_PONG_CACHING, "0.1");
         
+        /*
         UpdateManager updateManager = UpdateManager.instance();
         String latestVersion = updateManager.getVersion();
         // only send if we had a valid file on disk & its not @version@.
         if(updateManager.isValid() && !latestVersion.equals("@version@"))
             props.put(HeaderNames.X_VERSION, latestVersion);
+        */
     }
     
 }
Index: com/limegroup/gnutella/io/NIODispatcher.java
===================================================================
RCS file: /cvs/core/com/limegroup/gnutella/io/Attic/NIODispatcher.java,v
retrieving revision 1.37.2.1
diff -u -r1.37.2.1 NIODispatcher.java
--- com/limegroup/gnutella/io/NIODispatcher.java	22 Jun 2007 21:12:28 -0000	1.37.2.1
+++ com/limegroup/gnutella/io/NIODispatcher.java	22 Mar 2008 13:48:01 -0000
@@ -24,6 +24,8 @@
 
 import com.limegroup.gnutella.ErrorService;
 import com.limegroup.gnutella.util.ManagedThread;
+/* cabos */
+import com.limegroup.gnutella.udpconnect.UDPSocketChannel;
 
 /**
  * Dispatcher for NIO.
@@ -519,7 +521,8 @@
                 Collection selected = sel.selectedKeys();
                 if(!selected.isEmpty()) {
                     if(ret == null) {
-                        ret = selected;
+//                        ret = selected;
+                        ret = new HashSet(selected);
                     } else if(!growable) {
                         growable = true;
                         ret = new HashSet(ret);
@@ -527,6 +530,8 @@
                     } else {
                         ret.addAll(selected);
                     }
+                    /* cabos */
+                    selected.clear();
                 }
             }
         }
@@ -553,6 +558,8 @@
         }
     }
     
+    /* cabos */
+    private int pollCount = 0;
     /**
      * The actual NIO run loop
      */
@@ -567,6 +574,12 @@
             
             Collection polled = pollOtherSelectors();
             boolean immediate = !polled.isEmpty();
+            /* cabos */
+            if (immediate)
+                pollCount++;
+            else
+                pollCount = 0;
+            
             try {
                 if(!immediate && checkTime)
                     startSelect = System.currentTimeMillis();
@@ -619,8 +632,8 @@
                 }
             }
             
-            if(LOG.isTraceEnabled())
-                LOG.trace("Selected keys: (" + keys.size() + "), polled: (" + polled.size() + ").");
+            if(LOG.isTraceEnabled() && pollCount > 1)
+                LOG.trace("Selected keys: (" + keys.size() + "), polled: (" + polled.size() + "), count: (" + pollCount + ").");
             
             Collection allKeys;
             if(immediate) {
@@ -664,7 +677,8 @@
             
         proxy.lastMod = iteration + 1;
         
-        if(sk.isValid()) {
+//        if(sk.isValid()) {
+        if(sk.isValid() && !(pollCount > 100 && sk.channel().getClass() == UDPSocketChannel.class)) {
             try {
                 try {
                     int notHandled = ~proxy.handled;
Index: com/limegroup/gnutella/messages/PingReply.java
===================================================================
RCS file: /cvs/core/com/limegroup/gnutella/messages/PingReply.java,v
retrieving revision 1.40.86.1
diff -u -r1.40.86.1 PingReply.java
--- com/limegroup/gnutella/messages/PingReply.java	6 Mar 2007 17:07:06 -0000	1.40.86.1
+++ com/limegroup/gnutella/messages/PingReply.java	22 Mar 2008 13:48:11 -0000
@@ -12,6 +12,8 @@
 import java.util.Collections;
 import java.util.Collection;
 
+import phex.common.Ip2CountryManager;
+
 import com.limegroup.gnutella.Assert;
 import com.limegroup.gnutella.ByteOrder;
 import com.limegroup.gnutella.Endpoint;
@@ -756,6 +758,9 @@
                     if(bytes.length >= 3)
                         slots = ByteOrder.ubyte2int(bytes[2]);
                 } catch(BadGGEPPropertyException e) {}
+            /* cabos */
+            } else {
+                locale = Ip2CountryManager.getInstance().getIP2Language(ip.getHostAddress(), locale);
             }
             
             if (ggep.hasKey(GGEP.GGEP_HEADER_IPPORT)) {
Index: com/limegroup/gnutella/messages/vendor/CapabilitiesVM.java
===================================================================
RCS file: /cvs/core/com/limegroup/gnutella/messages/vendor/CapabilitiesVM.java,v
retrieving revision 1.14
diff -u -r1.14 CapabilitiesVM.java
--- com/limegroup/gnutella/messages/vendor/CapabilitiesVM.java	22 Jun 2005 20:54:17 -0000	1.14
+++ com/limegroup/gnutella/messages/vendor/CapabilitiesVM.java	22 Mar 2008 13:48:17 -0000
@@ -16,7 +16,7 @@
 import com.limegroup.gnutella.messages.FeatureSearchData;
 import com.limegroup.gnutella.simpp.SimppManager;
 import com.limegroup.gnutella.statistics.SentMessageStatHandler;
-import com.limegroup.gnutella.version.UpdateHandler;
+//import com.limegroup.gnutella.version.UpdateHandler;
 
 /** 
  * The message that lets other know what capabilities you support.  Everytime 
@@ -124,9 +124,11 @@
                                         SimppManager.instance().getVersion());
         hashSet.add(smp);
         
+        /*
         smp = new SupportedMessageBlock(LIME_UPDATE_BYTES,
                                         UpdateHandler.instance().getLatestId());
         hashSet.add(smp);
+        */
     }
 
 
Index: com/limegroup/gnutella/search/QueryHandler.java
===================================================================
RCS file: /cvs/core/com/limegroup/gnutella/search/QueryHandler.java,v
retrieving revision 1.44
diff -u -r1.44 QueryHandler.java
--- com/limegroup/gnutella/search/QueryHandler.java	12 Oct 2004 21:45:27 -0000	1.44
+++ com/limegroup/gnutella/search/QueryHandler.java	22 Mar 2008 13:48:37 -0000
@@ -48,7 +48,8 @@
 	 * The number of results to try to get if we're an Ultrapeer originating
 	 * the query.
 	 */
-	public static final int ULTRAPEER_RESULTS = 150;
+	//public static final int ULTRAPEER_RESULTS = 150;
+	public static final int ULTRAPEER_RESULTS = 250;
 
     /**
      * Ultrapeers seem to get less results - lets give them a little boost.
Index: com/limegroup/gnutella/settings/ChatSettings.java
===================================================================
RCS file: /cvs/core/com/limegroup/gnutella/settings/ChatSettings.java,v
retrieving revision 1.2
diff -u -r1.2 ChatSettings.java
--- com/limegroup/gnutella/settings/ChatSettings.java	24 Jul 2003 20:01:19 -0000	1.2
+++ com/limegroup/gnutella/settings/ChatSettings.java	22 Mar 2008 13:48:43 -0000
@@ -12,5 +12,6 @@
 	 * Sets whether or not chat should be enabled.
 	 */
     public static final BooleanSetting CHAT_ENABLED =
-        FACTORY.createBooleanSetting("CHAT_ENABLED", true);
+        //FACTORY.createBooleanSetting("CHAT_ENABLED", true);
+        FACTORY.createBooleanSetting("CHAT_ENABLED", false);
 }
\ No newline at end of file
Index: com/limegroup/gnutella/settings/ConnectionSettings.java
===================================================================
RCS file: /cvs/core/com/limegroup/gnutella/settings/ConnectionSettings.java,v
retrieving revision 1.60.2.4
diff -u -r1.60.2.4 ConnectionSettings.java
--- com/limegroup/gnutella/settings/ConnectionSettings.java	23 Jun 2007 00:09:55 -0000	1.60.2.4
+++ com/limegroup/gnutella/settings/ConnectionSettings.java	22 Mar 2008 13:48:43 -0000
@@ -281,7 +281,8 @@
      * match the local locale
      */
     public static final IntSetting NUM_LOCALE_PREF =
-        FACTORY.createIntSetting("NUMBER_LOCALE_PREF", 2);
+//        FACTORY.createIntSetting("NUMBER_LOCALE_PREF", 2);
+        FACTORY.createIntSetting("NUMBER_LOCALE_PREF", 3);
     
     /**
      * how many attempts to connect to a remote host must elapse
Index: com/limegroup/gnutella/settings/FilterSettings.java
===================================================================
RCS file: /cvs/core/com/limegroup/gnutella/settings/FilterSettings.java,v
retrieving revision 1.8.28.3
diff -u -r1.8.28.3 FilterSettings.java
--- com/limegroup/gnutella/settings/FilterSettings.java	5 Apr 2007 21:00:54 -0000	1.8.28.3
+++ com/limegroup/gnutella/settings/FilterSettings.java	22 Mar 2008 13:48:44 -0000
@@ -40,7 +40,8 @@
      * Sets whether or not search results of the wmv and asf types are banned.
      */
     public static final BooleanSetting FILTER_WMV_ASF =
-    	FACTORY.createBooleanSetting("FILTER_WMV_ASF",true);
+    	//FACTORY.createBooleanSetting("FILTER_WMV_ASF",true);
+    	FACTORY.createBooleanSetting("FILTER_WMV_ASF",false);
     
     /**
 	 * Sets whether or not duplicate search results are
Index: com/limegroup/gnutella/settings/SearchSettings.java
===================================================================
RCS file: /cvs/core/com/limegroup/gnutella/settings/SearchSettings.java,v
retrieving revision 1.25.28.1
diff -u -r1.25.28.1 SearchSettings.java
--- com/limegroup/gnutella/settings/SearchSettings.java	12 Jan 2007 20:18:56 -0000	1.25.28.1
+++ com/limegroup/gnutella/settings/SearchSettings.java	22 Mar 2008 13:48:46 -0000
@@ -313,7 +313,8 @@
 	 * Set how sensitive the spamfilter should be
 	 */    
     public static final FloatSetting FILTER_SPAM_RESULTS =
-        FACTORY.createFloatSetting("FILTER_SPAM_RESULTS", 0.85f);
+//        FACTORY.createFloatSetting("FILTER_SPAM_RESULTS", 0.85f);
+        FACTORY.createFloatSetting("FILTER_SPAM_RESULTS", 1.0f);
     
     /**
      * The minimum spam rating at which we stop counting results for 
Index: com/limegroup/gnutella/settings/SettingsFactory.java
===================================================================
RCS file: /cvs/core/com/limegroup/gnutella/settings/Attic/SettingsFactory.java,v
retrieving revision 1.52
diff -u -r1.52 SettingsFactory.java
--- com/limegroup/gnutella/settings/SettingsFactory.java	12 Jun 2006 18:15:45 -0000	1.52
+++ com/limegroup/gnutella/settings/SettingsFactory.java	22 Mar 2008 13:48:47 -0000
@@ -1,6 +1,6 @@
 package com.limegroup.gnutella.settings;
 
-import java.awt.Color;
+//import java.awt.Color;
 import java.io.BufferedOutputStream;
 import java.io.File;
 import java.io.FileInputStream;
@@ -468,6 +468,7 @@
      * @param key the key for the setting
      * @param defaultValue the default value for the setting
      */
+/*
     public synchronized ColorSetting createColorSetting(String key, 
                                                         Color defaultValue) {
         ColorSetting result = 
@@ -484,6 +485,7 @@
         handleSettingInternal(result, simppKey);
         return result;
     }
+*/
 
     /**
      * Creates a new <tt>CharArraySetting</tt> instance for a character array 
@@ -666,6 +668,7 @@
      * @param key the key for the setting
      * @param defaultValue the default value for the setting
      */
+/*
     public synchronized FontNameSetting createFontNameSetting(String key, 
                                                            String defaultValue){
         FontNameSetting result = 
@@ -681,6 +684,7 @@
         handleSettingInternal(result, simppKey);
         return result;
     }
+*/
     
     /**
      * Creates a new <tt>PasswordSetting</tt> instance with the specified
@@ -689,6 +693,7 @@
      * @param key the key for the setting
      * @param defaultValue the default value for the setting
      */
+/*
     public synchronized PasswordSetting createPasswordSettingMD5(
             String key, String defaultValue) {
         PasswordSetting result = 
@@ -696,6 +701,7 @@
         handleSettingInternal(result, null);
         return result;
     }
+*/
     
     private synchronized void handleSettingInternal(Setting setting, 
                                                            String simppKey) {
Index: com/limegroup/gnutella/settings/SharingSettings.java
===================================================================
RCS file: /cvs/core/com/limegroup/gnutella/settings/SharingSettings.java,v
retrieving revision 1.31
diff -u -r1.31 SharingSettings.java
--- com/limegroup/gnutella/settings/SharingSettings.java	6 Oct 2005 22:32:05 -0000	1.31
+++ com/limegroup/gnutella/settings/SharingSettings.java	22 Mar 2008 13:48:48 -0000
@@ -48,7 +48,8 @@
      */
     public static final FileSetting INCOMPLETE_DIRECTORY =
         FACTORY.createFileSetting("INCOMPLETE_DIRECTORY", 
-            (new File(DIRECTORY_FOR_SAVING_FILES.getValue().getParent(),
+            //(new File(DIRECTORY_FOR_SAVING_FILES.getValue().getParent(),
+            (new File(DIRECTORY_FOR_SAVING_FILES.getValue(),
                 "Incomplete")));
     
     /**
@@ -106,8 +107,11 @@
 			if(!saveDir.mkdirs()) throw new IOException("could not create save dir");
 		}
 
+		/*
 		String parentDir = saveDir.getParent();
 		File incDir = new File(parentDir, "Incomplete");
+		*/
+		File incDir = new File(saveDir, "Incomplete");
 		if(!incDir.isDirectory()) {
 			if(!incDir.mkdirs()) throw new IOException("could not create incomplete dir");
 		}
@@ -115,7 +119,8 @@
         FileUtils.setWriteable(saveDir);
         FileUtils.setWriteable(incDir);
 
-		if(!saveDir.canRead() || !saveDir.canWrite() ||
+//		if(!saveDir.canRead() || !saveDir.canWrite() ||
+        if(!saveDir.canRead() ||
 		   !incDir.canRead()  || !incDir.canWrite()) {
 			throw new IOException("could not write to selected directory");
 		}
Index: com/limegroup/gnutella/spam/SpamManager.java
===================================================================
RCS file: /cvs/core/com/limegroup/gnutella/spam/SpamManager.java,v
retrieving revision 1.4
diff -u -r1.4 SpamManager.java
--- com/limegroup/gnutella/spam/SpamManager.java	19 Dec 2005 21:56:29 -0000	1.4
+++ com/limegroup/gnutella/spam/SpamManager.java	22 Mar 2008 13:48:51 -0000
@@ -8,6 +8,7 @@
 import com.limegroup.gnutella.RemoteFileDesc;
 import com.limegroup.gnutella.messages.QueryRequest;
 import com.limegroup.gnutella.settings.SearchSettings;
+import com.limegroup.gnutella.xml.LimeXMLNames;
 
 public class SpamManager {
 	private static final Log LOG = LogFactory.getLog(SpamManager.class);
@@ -23,13 +24,15 @@
 	/**
 	 * inverse rating (1 - probability) for an RFD without SHA1 urn. 
 	 */
-	private static final float NO_SHA1_URN_RATING = 0.5f;
+//	private static final float NO_SHA1_URN_RATING = 0.5f;
+	private static final float NO_SHA1_URN_RATING = 0.f;
 
 	/**
 	 * incomplete file... save the user the trouble of downloading it, if he has
 	 * his spam filter enabled
 	 */
-	private static final float INCOMPLETE_FILE_RATING = 0.2f;
+//	private static final float INCOMPLETE_FILE_RATING = 0.2f;
+	private static final float INCOMPLETE_FILE_RATING = 0.f;
 
 	private static final SpamManager INSTANCE = new SpamManager();
     
@@ -77,6 +80,186 @@
 			rating = 1 - (1 - rating) * INCOMPLETE_FILE_RATING;
 		}
 
+		/* cabos */
+        String f = rfd.getFileName().toLowerCase(Locale.US);
+        int n = rfd.getSize();
+        if (
+            n ==   48139 ||
+            n ==   50327 ||
+            n ==   53379 ||
+            n ==   56993 ||
+            n ==   96191 ||
+            n ==   96268 ||
+            n ==  121836 ||
+            n ==  200706 ||
+            n ==  283692 ||
+            n ==  822182 ||
+            n ==  863798 ||
+            n ==  938820 ||
+            n == 1058868 ||
+            n == 1105392 ||
+            n == 1155729 ||
+            n == 1167481 ||
+            n == 1216226 ||
+            n == 1251562 ||
+            n == 1252087 ||
+            n == 1253906 ||
+            n == 1279141 ||
+            n == 1279142 ||
+            n == 1411929 ||
+            n == 1431124 ||
+            n == 3545425 ||
+            (
+             f.indexOf("cracked") != -1 &&
+             (f.endsWith(".html") || f.endsWith(".wma") || f.endsWith(".xml") || f.indexOf("special edition") != -1)
+            ) ||
+            f.indexOf("www.efreeclub.com") != -1 ||
+            (f.startsWith("horny ") && (f.endsWith(".html") || f.endsWith(".zip"))) ||
+            (f.startsWith("sexy ") && f.endsWith(".zip")) ||
+            f.endsWith(" (2).zip") ||
+            f.endsWith(" (album.edition).wma") ||
+            f.endsWith(" (cover).wma") ||
+            f.endsWith(" (divx).zip") ||
+            f.endsWith(" (front).wma") ||
+            f.endsWith(" (intro).wma") ||
+            f.endsWith(" (latest).wma") ||
+            f.endsWith(" (mix).wma") ||
+            f.endsWith(" (music).zip") ||
+            f.endsWith(" (new.album).wma") ||
+            f.endsWith(" (new.single).wma") ||
+            f.endsWith(" (original).zip") ||
+            f.endsWith(" (porn).zip") ||
+            f.endsWith(" (radio.edit).wma") ||
+            f.endsWith(" (radio.version).zip") ||
+            f.endsWith(" (remix).wma") ||
+            f.endsWith(" (rock).wma") ||
+            f.endsWith(" (single).zip") ||
+            f.endsWith(" (special).wma") ||
+            f.endsWith(" (special.edition).wma") ||
+            f.endsWith(" (svcd).zip") ||
+            f.endsWith(" (tool).wma") ||
+            f.endsWith(" (uncensored).html") ||
+            f.endsWith(" (uncensored).mov") ||
+            f.endsWith(" (uncensored).zip") ||
+            f.endsWith(" (unreleased).zip") ||
+            f.endsWith(" (vocal).wma") ||
+            f.endsWith(" (working) album.wma") ||
+            f.endsWith(" (working) divx.zip") ||
+            f.endsWith(" *better version* [key].zip") ||
+            f.endsWith(" *uncensored* single.wma") ||
+            f.endsWith(" *working* (full).zip") ||
+            f.endsWith(" *working* dirty.zip") ||
+            f.endsWith(" - gives blowjob.html") ||
+            f.endsWith(" - great blowjob.html") ||
+            f.endsWith(" - pics.html") ||
+            f.endsWith(" 2006.zip") ||
+            f.endsWith(" 2007.zip") ||
+            f.endsWith(" [!].zip") ||
+            f.endsWith(" [album.edition].wma") ||
+            f.endsWith(" [banned.version].zip") ||
+            f.endsWith(" [bonus].wma") ||
+            f.endsWith(" [cd].zip") ||
+            f.endsWith(" [dirty].zip") ||
+            f.endsWith(" [divx].zip") ||
+            f.endsWith(" [explicit].zip") ||
+            f.endsWith(" [extended.edition].wma") ||
+            f.endsWith(" [full].zip") ||
+            f.endsWith(" [mix].zip") ||
+            f.endsWith(" [new.single].wma") ||
+            f.endsWith(" [porn].zip") ||
+            f.endsWith(" [radio.version].zip") ||
+            f.endsWith(" [registered].wma") ||
+            f.endsWith(" [rock].wma") ||
+            f.endsWith(" [single].wma") ||
+            f.endsWith(" [soundtrack].zip") ||
+            f.endsWith(" [svcd].zip") ||
+            f.endsWith(" [techno.remix].zip") ||
+            f.endsWith(" [techno].zip") ||
+            f.endsWith(" [theme].wma") ||
+            f.endsWith(" [tool].wma") ||
+            f.endsWith(" [ultimate.edition].wma") ||
+            f.endsWith(" [vcd].zip") ||
+            f.endsWith(" [video].wma") ||
+            f.endsWith(" [x].zip") ||
+            f.endsWith(" album.edition.zip") ||
+            f.endsWith(" back.wma") ||
+            f.endsWith(" bdsm.html") ||
+            f.endsWith(" bearshare download accelerator.zip") ||
+            f.endsWith(" bittorrent downloader.zip") ||
+            f.endsWith(" bonus.zip") ||
+            f.endsWith(" by cdz intro.wma") ||
+            f.endsWith(" by cdz theme.zip") ||
+            f.endsWith(" by incite (1).zip") ||
+            f.endsWith(" by pr0nstars key.wma") ||
+            f.endsWith(" clip.zip") ||
+            f.endsWith(" cover.zip") ||
+            f.endsWith(" cute girl has orgasm on webcam.mp3") ||
+            f.endsWith(" cute girl has orgasm on webcam.mpg") ||
+            f.endsWith(" dvdrip.zip") ||
+            f.endsWith(" extended.edition.zip") ||
+            f.endsWith(" extended.wma") ||
+            f.endsWith(" fucking.html") ||
+            f.endsWith(" full.zip") ||
+            f.endsWith(" hentai anime.zip") ||
+            f.endsWith(" limewire download accelerator.zip") ||
+            f.endsWith(" mp3.html") ||
+            f.endsWith(" music.html") ||
+            f.endsWith(" naked.html") ||
+            f.endsWith(" naked.zip") ||
+            f.endsWith(" new.zip") ||
+            f.endsWith(" pictures.html") ||
+            f.endsWith(" radio.edition.zip") ||
+            f.endsWith(" remix.zip") ||
+            f.endsWith(" ringtones.html") ||
+            f.endsWith(" share accelerator.zip") ||
+            f.endsWith(" song.zip") ||
+            f.endsWith(" soul.zip") ||
+            f.endsWith(" special.edition.wma") ||
+            f.endsWith(" special.zip") ||
+            f.endsWith(" techno.zip") ||
+            f.endsWith(" ultimate.edition.zip") ||
+            f.endsWith(" video (extended).wma") ||
+            f.endsWith(" video.zip") ||
+            f.endsWith(" videos.html") ||
+            f.endsWith(" vocal.wma") ||
+            f.endsWith(" webcam.html") ||
+            f.endsWith(" webcam.mpg") ||
+            f.endsWith(" wet and wild.zip") ||
+            f.endsWith(" with bonus.zip") ||
+            f.endsWith(" with the fastest bittorrent downloader.zip") ||
+            f.endsWith(" with the ultimate player.zip") ||
+            f.endsWith(" xvid.zip") ||
+            f.endsWith(" young and cute.zip") ||
+            f.endsWith("-vids.html") ||
+            f.endsWith("-xcd.wma") ||
+            f.endsWith("-xxx.wmv") ||
+            f.endsWith("-xxx.wmv") ||
+            f.equals("official limewire pro available here.com") ||
+            f.startsWith("!!!!!!!! ") ||
+            f.startsWith("###### ") ||
+            f.startsWith("(cinemaniacs) ") ||
+            f.startsWith("(corp) ") ||
+            f.startsWith("(deviance) ") ||
+            f.startsWith("(fusion) ") ||
+            f.startsWith("(genius) ") ||
+            f.startsWith("(h2o) ") ||
+            f.startsWith("*better version* ") ||
+            f.startsWith("*myth* ") ||
+            f.startsWith("*naked* ") ||
+            f.startsWith("*strike* ") ||
+            f.startsWith("*subnet* ") ||
+            f.startsWith("- presented by ash - ") ||
+            f.startsWith("---===== ") ||
+            f.startsWith("download music ") ||
+            f.startsWith("get music ") ||
+            f.startsWith("good quality teen porn video from ") ||
+            f.startsWith("warning, visit ") ||
+            (rfd.getXMLDocument() != null &&
+             rfd.getXMLDocument().getValue(LimeXMLNames.AUDIO_TITLE) != null &&
+             rfd.getXMLDocument().getValue(LimeXMLNames.AUDIO_TITLE).startsWith("not related : "))
+            )
+			rating = 1 - (1 - rating) * 0.f;
+        
 		// apply bayesian filter
 		rating = 1 - (1 - rating) * (1 - RatingTable.instance().getRating(rfd));
 		rfd.setSpamRating(rating);
@@ -132,6 +315,17 @@
 	 * @return true if we think that this is an incomplete file
 	 */
 	private boolean isIncompleteFile(String name) {
+		/* cabos */
+		if (name.startsWith("incomplete_"))
+			return true;
+		if (name.startsWith("incomplete~"))
+			return true;
+		if (name.startsWith("inacheve_"))
+			return true;
+		if (name.startsWith("in_"))
+			return true;
+		if (name.startsWith("___arestra"))
+			return true;
 		if (name.startsWith("__incomplete"))
 			return true;
 		if (name.startsWith("___incompleted"))
Index: com/limegroup/gnutella/udpconnect/UDPConnectionProcessor.java
===================================================================
RCS file: /cvs/core/com/limegroup/gnutella/udpconnect/Attic/UDPConnectionProcessor.java,v
retrieving revision 1.23.22.1
diff -u -r1.23.22.1 UDPConnectionProcessor.java
--- com/limegroup/gnutella/udpconnect/UDPConnectionProcessor.java	14 Aug 2006 17:19:34 -0000	1.23.22.1
+++ com/limegroup/gnutella/udpconnect/UDPConnectionProcessor.java	22 Mar 2008 13:49:09 -0000
@@ -671,7 +671,7 @@
 	 */
     private synchronized void sendData(ByteBuffer chunk) {
         try {
-            assert chunk.position() == 0;
+            //assert chunk.position() == 0;
             DataMessage dm = new DataMessage(_theirConnectionID,_sequenceNumber, chunk); 
             send(dm);
 			DataRecord drec   = _sendWindow.addData(dm);  
Index: com/limegroup/gnutella/udpconnect/UDPSocketChannel.java
===================================================================
RCS file: /cvs/core/com/limegroup/gnutella/udpconnect/Attic/UDPSocketChannel.java,v
retrieving revision 1.3
diff -u -r1.3 UDPSocketChannel.java
--- com/limegroup/gnutella/udpconnect/UDPSocketChannel.java	4 Apr 2006 21:45:42 -0000	1.3
+++ com/limegroup/gnutella/udpconnect/UDPSocketChannel.java	22 Mar 2008 13:49:11 -0000
@@ -25,7 +25,8 @@
  * we can make it implement InterestReadChannel & InterestWriteChannel, so
  * we don't need the additional InterestAdapter.
  */
-class UDPSocketChannel extends SocketChannel implements InterestReadChannel,
+//class UDPSocketChannel extends SocketChannel implements InterestReadChannel,
+public class UDPSocketChannel extends SocketChannel implements InterestReadChannel,
                                                         InterestWriteChannel,
                                                         ChunkReleaser {
     
Index: com/limegroup/gnutella/util/CharSequenceKeyAnalyzer.java
===================================================================
RCS file: /cvs/core/com/limegroup/gnutella/util/Attic/CharSequenceKeyAnalyzer.java,v
retrieving revision 1.3.2.1
diff -u -r1.3.2.1 CharSequenceKeyAnalyzer.java
--- com/limegroup/gnutella/util/CharSequenceKeyAnalyzer.java	5 Apr 2007 19:59:29 -0000	1.3.2.1
+++ com/limegroup/gnutella/util/CharSequenceKeyAnalyzer.java	22 Mar 2008 13:49:22 -0000
@@ -55,7 +55,8 @@
             
             if(k != f) {
                int x = k ^ f;
-               return i * 16 + (Integer.numberOfLeadingZeros(x) - 16);
+//               return i * 16 + (Integer.numberOfLeadingZeros(x) - 16);
+               return i * 16 + (numberOfLeadingZeros(x) - 16);
             }
             
             if(k != 0)
@@ -95,4 +96,35 @@
         String s2 = key.toString();
         return s2.startsWith(s1);
     }
+    /* cabos */
+    
+    /**
+     * Return the number of leading zeros in value.
+     * @param value the value to examine
+     * @since 1.5
+     */
+    public static int numberOfLeadingZeros(int value)
+    {
+      value |= value >>> 1;
+      value |= value >>> 2;
+      value |= value >>> 4;
+      value |= value >>> 8;
+      value |= value >>> 16;
+      return bitCount(~value);
+    }
+    
+    /**
+     * Return the number of bits set in x.
+     * @param x value to examine
+     * @since 1.5
+     */
+    public static int bitCount(int x)
+    {
+      // Successively collapse alternating bit groups into a sum.
+      x = ((x >> 1) & 0x55555555) + (x & 0x55555555);
+      x = ((x >> 2) & 0x33333333) + (x & 0x33333333);
+      x = ((x >> 4) & 0x0f0f0f0f) + (x & 0x0f0f0f0f);
+      x = ((x >> 8) & 0x00ff00ff) + (x & 0x00ff00ff);
+      return ((x >> 16) & 0x0000ffff) + (x & 0x0000ffff);
+    }
 }
Index: com/limegroup/gnutella/util/CommonUtils.java
===================================================================
RCS file: /cvs/core/com/limegroup/gnutella/util/Attic/CommonUtils.java,v
retrieving revision 1.166.2.4
diff -u -r1.166.2.4 CommonUtils.java
--- com/limegroup/gnutella/util/CommonUtils.java	29 Jan 2007 20:58:59 -0000	1.166.2.4
+++ com/limegroup/gnutella/util/CommonUtils.java	22 Mar 2008 13:49:24 -0000
@@ -39,7 +39,8 @@
 	/** 
 	 * Constant for the current version of LimeWire.
 	 */
-	private static final String LIMEWIRE_VERSION = "@version@";
+	//private static final String LIMEWIRE_VERSION = "@version@";
+	private static final String LIMEWIRE_VERSION = "4.12.15";
 
     /**
      * Variable used for testing only, it's value is set to whatever the test
@@ -183,7 +184,8 @@
 	 */
 	private static final String HTTP_SERVER;
 
-    private static final String LIMEWIRE_PREFS_DIR_NAME = ".limewire";
+    //private static final String LIMEWIRE_PREFS_DIR_NAME = ".limewire";
+    private static final String LIMEWIRE_PREFS_DIR_NAME = ".cabos";
 
 	/**
 	 * Constant for the current running directory.
@@ -213,6 +215,7 @@
 	static {
 	    setOperatingSystems();
 		
+	    /*
 		if(!LIMEWIRE_VERSION.endsWith("Pro")) {
 			HTTP_SERVER = "LimeWire/" + LIMEWIRE_VERSION;
 		}
@@ -221,6 +224,8 @@
                            substring(0, LIMEWIRE_VERSION.length()-4)+" (Pro)");
             _isPro = true;
 		}
+		*/
+	    HTTP_SERVER = "LimeWire/" + LIMEWIRE_VERSION + " (Cabos/0.7.9)";
 	}
 	
 	/**
@@ -802,9 +807,9 @@
         }
 
         // make sure Windows files are moved
-        moveWindowsFiles(settingsDir);
+        //moveWindowsFiles(settingsDir);
         // make sure old metadata files are moved
-        moveXMLFiles(settingsDir);
+        //moveXMLFiles(settingsDir);
         // cache the directory.
         SETTINGS_DIRECTORY = settingsDir;
     }
@@ -861,7 +866,8 @@
                 appdata = stripQuotes(appdata);
             
             if (appdata != null && appdata.length() > 0) {
-                File tempSettingsDir = new File(appdata, "LimeWire");
+                //File tempSettingsDir = new File(appdata, "LimeWire");
+                File tempSettingsDir = new File(appdata, "Cabos");
                 if (tempSettingsDir.isDirectory() || !settingsDir.exists()) {
                     try {
                         setUserSettingsDir(tempSettingsDir);
@@ -871,7 +877,8 @@
                 }
             }
         } else if(isMacOSX()) {
-            settingsDir = new File(getUserHomeDir(), "Library/Preferences/LimeWire");
+            //settingsDir = new File(getUserHomeDir(), "Library/Preferences/LimeWire");
+            settingsDir = new File(getUserHomeDir(), "Library/Application Support/Cabos");
         }
       
         // Default behavior
@@ -898,22 +905,24 @@
     /**
      * Boolean for whether or not the windows files have been copied.
      */
-    private static boolean _windowsFilesMoved = false;
+    //private static boolean _windowsFilesMoved = false;
     
     /**
      * Boolean for whether or not XML files have been copied.
      */
-    private static boolean _xmlFilesMoved = false;
+    //private static boolean _xmlFilesMoved = false;
 
     /**
      * The array of files that should be stored in the user's home 
      * directory.
      */
+    /*
     private static final String[] USER_FILES = {
         "limewire.props",
         "gnutella.net",
         "fileurns.cache"
     };
+    */
 
     /**
      * On Windows, this copies files from the current directory to the
@@ -924,6 +933,7 @@
      * and the files that should be used, should always be saved in 
      * the user's home LimeWire preferences directory.
      */
+    /*
     private synchronized static void moveWindowsFiles(File settingsDir) {
         if(!isWindows()) return;
         if(_windowsFilesMoved) return;
@@ -943,12 +953,14 @@
         }
         _windowsFilesMoved = true;
     }
+    */
 
     /**
      * Old metadata definitions must be moved from ./lib/xml/data/*.*
      * This is done like the windows files copying, but for all files
      * in the data directory.
      */
+    /*
     private synchronized static void moveXMLFiles(File settingsDir) {
         if(_xmlFilesMoved) return;
         // We must extend the currentDir & settingsDir to look 
@@ -974,6 +986,7 @@
         }
         _xmlFilesMoved = true;
     }
+    */
 	     
     
     /**
@@ -1179,7 +1192,8 @@
      * @param name the filename to check for illegal characters
      * @return String containing the cleaned filename
      */
-    public static String convertFileName(String name) {
+    //public static String convertFileName(String name) {
+    public static String convertFileName(String name, String path) {
 		
 		// ensure that block-characters aren't in the filename.
         name = I18NConvert.instance().compose(name);
@@ -1187,6 +1201,7 @@
 		// if the name is too long, reduce it.  We don't go all the way
 		// up to 256 because we don't know how long the directory name is
 		// We want to keep the extension, though.
+        /*
 		if(name.length() > 180) {
 		    int extStart = name.lastIndexOf('.');
 		    if ( extStart == -1) { // no extension, wierd, but possible
@@ -1200,6 +1215,23 @@
 			           name.substring(extStart, extEnd);
             }          
 		}
+		*/
+		int max = Math.max(255 - path.length() * 2, 0);
+		if (name.length() * 2 > max) {
+			if (name.lastIndexOf('.') == -1) {
+				while (name.length() * 2 > max) {
+					name = name.substring(0, name.length() - 1);
+				}
+			} else {
+				while (name.length() * 2 > max) {
+					int extStart = name.lastIndexOf('.');
+					int extLength = name.length() - extStart;
+					int extEnd = extLength > 11 ? extStart + 11 : name.length();
+					name = name.substring(0, name.length() -1 - extLength)
+							+ name.substring(extStart, extEnd);
+				}
+			}
+		}
         for (int i = 0; i < ILLEGAL_CHARS_ANY_OS.length; i++) 
             name = name.replace(ILLEGAL_CHARS_ANY_OS[i], '_');
 		
Index: com/limegroup/gnutella/util/NetworkUtils.java
===================================================================
RCS file: /cvs/core/com/limegroup/gnutella/util/Attic/NetworkUtils.java,v
retrieving revision 1.42.6.1
diff -u -r1.42.6.1 NetworkUtils.java
--- com/limegroup/gnutella/util/NetworkUtils.java	5 Apr 2007 20:49:23 -0000	1.42.6.1
+++ com/limegroup/gnutella/util/NetworkUtils.java	22 Mar 2008 13:49:34 -0000
@@ -413,10 +413,12 @@
     public static InetAddress getLocalAddress() throws UnknownHostException {
         InetAddress addr = InetAddress.getLocalHost();
         
+        /*
         if (addr instanceof Inet4Address 
                 && !addr.isLoopbackAddress()) {
             return addr;
         }
+         */
         
         try {
             Enumeration interfaces = NetworkInterface.getNetworkInterfaces();
Index: com/limegroup/gnutella/util/PatriciaTrie.java
===================================================================
RCS file: /cvs/core/com/limegroup/gnutella/util/Attic/PatriciaTrie.java,v
retrieving revision 1.9.2.1
diff -u -r1.9.2.1 PatriciaTrie.java
--- com/limegroup/gnutella/util/PatriciaTrie.java	5 Apr 2007 19:59:29 -0000	1.9.2.1
+++ com/limegroup/gnutella/util/PatriciaTrie.java	22 Mar 2008 13:49:37 -0000
@@ -909,7 +909,8 @@
     
     /** Returns each entry as a string. */
     public String toString() {
-        StringBuilder buffer = new StringBuilder();
+//        StringBuilder buffer = new StringBuilder();
+        StringBuffer buffer = new StringBuffer();
         buffer.append("Trie[").append(size()).append("]={\n");
         for(Iterator i = newEntryIterator(); i.hasNext(); ) {
             buffer.append("  ").append(i.next().toString()).append("\n");
@@ -1083,7 +1084,8 @@
         }
 
         public String toString() {
-            StringBuilder buffer = new StringBuilder();
+//            StringBuilder buffer = new StringBuilder();
+            StringBuffer buffer = new StringBuffer();
             
             if (bitIndex == -1) {
                 buffer.append("RootEntry(");
Index: com/limegroup/gnutella/util/SystemUtils.java
===================================================================
RCS file: /cvs/core/com/limegroup/gnutella/util/Attic/SystemUtils.java,v
retrieving revision 1.15.2.1
diff -u -r1.15.2.1 SystemUtils.java
--- com/limegroup/gnutella/util/SystemUtils.java	4 Jan 2007 20:20:57 -0000	1.15.2.1
+++ com/limegroup/gnutella/util/SystemUtils.java	22 Mar 2008 13:49:40 -0000
@@ -1,6 +1,6 @@
 package com.limegroup.gnutella.util;
 
-import java.awt.Component;
+//import java.awt.Component;
 import java.io.File;
 
 import org.apache.commons.logging.Log;
@@ -30,7 +30,7 @@
                 if(CommonUtils.isGoodWindows()) {
                     System.loadLibrary("WindowsV5PlusUtils");
                 }
-                System.loadLibrary("WindowsFirewall");
+                //System.loadLibrary("WindowsFirewall");
             }
             canLoad = true;
         } catch(UnsatisfiedLinkError noGo) {
@@ -101,11 +101,13 @@
 	 * @return A String like "c:\Program Files\LimeWire\LimeWire.exe".
 	 *         Blank on error.
 	 */
+/*
     public static final String getRunningPath() {
     	if (CommonUtils.isWindows() && isLoaded)
     		return getRunningPathNative();
     	return "";
     }
+*/
 
     /**
      * Changes the icon of a window.
@@ -116,6 +118,7 @@
      * @param icon  The path to a .ico file on the disk
      * @return      False on error
      */
+/*
     public static final boolean setWindowIcon(Component frame, File icon) {
     	if (CommonUtils.isWindows() && isLoaded) {
     		try {
@@ -127,17 +130,20 @@
     	}
     	return false;
     }
+*/
 
     /**
      * Determine if this Windows computer has Windows Firewall on it.
      * 
      * @return True if it does, false if it does not or there was an error
      */
+/*
     public static final boolean isFirewallPresent() {
     	if (CommonUtils.isWindows() && isLoaded)
     		return firewallPresentNative();
     	return false;
     }
+*/
 
     /**
      * Determine if the Windows Firewall is enabled.
@@ -146,11 +152,13 @@
      *         False if the setting on the "General" tab is "Off (not recommended)".
      *         False on error.
      */
+/*
     public static final boolean isFirewallEnabled() {
     	if (CommonUtils.isWindows() && isLoaded)
     	    return firewallEnabledNative();
     	return false;
     }
+*/
 
     /**
      * Determine if the Windows Firewall is on with no exceptions.
@@ -159,11 +167,13 @@
      *         False if the box is not checked.
      *         False on error.
      */
+/*
     public static final boolean isFirewallExceptionsNotAllowed() {
     	if (CommonUtils.isWindows() && isLoaded)
     		return firewallExceptionsNotAllowedNative();
     	return false;
     }
+*/
 
     /**
      * Determine if a program is listed on the Windows Firewall exceptions list.
@@ -171,11 +181,13 @@
      * @param path The path to the program, like "C:\Program Files\LimeWire\LimeWire.exe"
      * @return     True if it has a listing on the Exceptions list, false if not or on error
      */
+/*
     public static final boolean isProgramListedOnFirewall(String path) {
     	if (CommonUtils.isWindows() && isLoaded)
     		return firewallIsProgramListedNative(path);
     	return false;
     }
+*/
 
     /**
      * Determine if a program's listing on the Windows Firewall exceptions list has a check box making it enabled.
@@ -183,11 +195,13 @@
      * @param path The path to the program, like "C:\Program Files\LimeWire\LimeWire.exe"
      * @return     True if it's listing's check box is checked, false if not or on error
      */
+/*
     public static final boolean isProgramEnabledOnFirewall(String path) {
     	if (CommonUtils.isWindows() && isLoaded)
     		return firewallIsProgramEnabledNative(path);
     	return false;
     }
+*/
 
     /**
      * Add a program to the Windows Firewall exceptions list.
@@ -196,11 +210,13 @@
      * @param name The name of the program, like "LimeWire", this is the text that will identify the item on the list
      * @return     False if error
      */
+/*
     public static final boolean addProgramToFirewall(String path, String name) {
     	if (CommonUtils.isWindows() && isLoaded)
     		return firewallAddNative(path, name);
     	return false;
     }
+*/
 
     /**
      * Remove a program from the Windows Firewall exceptions list.
@@ -208,6 +224,7 @@
      * @param path The path to the program, like "C:\Program Files\LimeWire\LimeWire.exe"
      * @return     False if error.
      */
+/*
     public static final boolean removeProgramFromFirewall(String path) {
     	if (CommonUtils.isWindows() && isLoaded)
     		return firewallRemoveNative(path);
@@ -224,4 +241,5 @@
     private static final native boolean firewallIsProgramEnabledNative(String path);
     private static final native boolean firewallAddNative(String path, String name);
     private static final native boolean firewallRemoveNative(String path);
+*/
 }
Index: com/limegroup/gnutella/xml/LimeXMLProperties.java
===================================================================
RCS file: /cvs/core/com/limegroup/gnutella/xml/LimeXMLProperties.java,v
retrieving revision 1.21
diff -u -r1.21 LimeXMLProperties.java
--- com/limegroup/gnutella/xml/LimeXMLProperties.java	6 Jan 2004 20:08:31 -0000	1.21
+++ com/limegroup/gnutella/xml/LimeXMLProperties.java	22 Mar 2008 13:49:46 -0000
@@ -172,10 +172,13 @@
      */
     public String getXMLSchemaDir()
     {
+    	/*
         String xmlSchemaDirRel = _properties.getProperty(XML_SCHEMA_DIR, 
                                                      XML_SCHEMA_DIR_DEF);
 
         return getPath() + xmlSchemaDirRel ;                   
+        */
+        return CommonUtils.getCurrentDirectory().getAbsolutePath();
     }
 
 
Show on old repository browser