Re: [codepatch] Re: [discuss] block all hosts
Sam Berlin <[email protected]> Mon, 28 Mar 2005 14:33:04 -0500
| Newsgroups | gmane.network.gnutella.limewire.general |
|---|---|
| Message-ID | <[email protected]> |
Hi Chuck, Thanks for sending in the patch -- if possible, could you create the patch with the '-u' parameter? More information is at http://limewire.org/contribute.shtml . The -u parameter creates what's called a "contextual" diff, so that even if the file has changed slightly, the patch command can still figure out where to patch the file. It also makes reviewing the diff easier, since the context is included. Thanks, Sam On Mar 28, 2005, at 1:10 PM, Chuck McNulty wrote: > Hi Sam, > > Here are the promised diff files. The function blockHost() will > continue to work as it has, however SearchResultMenu.java now calls a > new function blockAllHosts(). > The meat of blockHost() has been moved to another new function called > blockOneHost(String host), which is called from both blockHost() and > blockAllHosts(), the difference being that blockAllHosts() calls > blockOneHost() for each host and alternate, whereas blockHost() > continues to only call it for the first host that it sees. > I've added a new string to MessagesBundle.properties to handle the new > string. > > I'm somewhat new to CVS (this is the first time I've used it to do > more than just look at code) so please let me know if I did the diff > files correctly. I couldn't figure out how to use WinCVS to output > the diff results directly to a file, so I had to copy the output into > a text file, and I'm not sure I copied all of the lines I needed too. > > Please let me know what you think. I've been using it to block the > search result spammers and so far it looks like it's working great. > > -Charles > > Sam Berlin wrote: > >> Hi Chuck, >> >> I guess that sounds fine. As far as translations go, if the prior >> wording >> won't fit at all with the new wording, just make a new KEY=value in >> the >> message bundle, and the old one can be deleted. >> >> The block file functionality was (and still is) on the >> 'file-filter-branch' >> ( >> http://www.limewire.org/fisheye/viewrep/~br=file-filter-branch/ >> limecvs ) . >> I don't recall if there's any particular reason we didn't merge it -- >> maybe >> just lack of time. >> >> Thanks, >> Sam >> >>> -----Original Message----- >>> From: [email protected] >>> [mailto:[email protected]] On Behalf Of Charles >>> Sent: Sunday, March 27, 2005 11:34 AM >>> To: [email protected] >>> Subject: Re: [discuss] block all hosts >>> >>> Hi, I'll send you the diffs on Monday for what I've done so far. I >>> doesn't seem to me like it would be worth it to include both "Block >>> All Hosts" and "Block First Host." I think the expected, and most >>> useful behaviour is to always block all hosts (which of course still >>> blocks just one if there is only one). I'd love to re-add the "Block >>> File" >>> selection, though, and I'll look into that on Monday as well. >>> >>> -Chuck >>> >>> Sam Berlin wrote: >>> >>> >>>> Hi Chuck, >>>> >>>> That'd be a really nice addition. Your new message sounds good >>>> (although it'd be nice to add the search result name into >>> it). There >>>> could be a new menu item "Block All Hosts" and the "Block >>> Host" could >>>> become "Block First Host". These would be selections from a new >>>> submenu "Block" (where 'Block Host' used to be). We have an >>> old branch >>>> that allows user-selected SHA1 filters too, so that could be >>> added with a 'Block File' selection. >>> >>>> There's no need to worry about translating it into other languages >>>> (unless you know some and want to translate it) -- there are >>>> scripts set up to add the message into the other languages' message >>> bundle, and >>>> eventually translations will be submitted. >>>> >>>> Thanks, >>>> Sam >>>> >>>> >>>> >>>>> -----Original Message----- >>>>> From: [email protected] >>>>> [mailto:[email protected]] On Behalf Of >>> Chuck McNulty >>> >>>>> Sent: Saturday, March 26, 2005 4:29 PM >>>>> To: [email protected] >>>>> Subject: [discuss] block all hosts >>>>> >>>>> Hi, I've just finished code that allows a user to block all hosts >>>>> (including alts) from a search result, rather than just the first >>>>> host, however this kind of messes up the confirmation string, >>>>> which now reads "Do you want to block search results from the host >>>>> at ?" Obviously the string should now read something like "Do >>> you want to >>>>> block all hosts for this search result?" My question is >>> how would I >>>>> submit this string for translation to all of the other languages. >>>>> Also, is this code desirable for the main trunk? >>>>> I'd be happy to submit the diffs to someone for review. >>>>> >>>>> -Charles >>>>> >>>>> _______________________________________________ >>>>> discuss mailing list >>>>> [email protected] >>>>> http://www.limewire.org/mailman/listinfo/discuss >>>>> >>>>> >>>> >>>> >>> _______________________________________________ >>> discuss mailing list >>> [email protected] >>> http://www.limewire.org/mailman/listinfo/discuss >>> >> >> _______________________________________________ >> discuss mailing list >> [email protected] >> http://www.limewire.org/mailman/listinfo/discuss >> > > diff -r1.181 MessagesBundle.properties > 387a388 >> SEARCH_BLOCK_ALL_HOSTS=Do you want to block all hosts for this search >> result? > diff -r1.141 ResultPanel.java > 9a10 >> import java.util.Iterator; > 11a13 >> import java.util.Set; > 24a27 >> import com.limegroup.gnutella.RemoteFileDesc; > 40a44 >> import com.limegroup.gnutella.util.IpPort; > 45a50 >> > 350a356,388 >> >> /** >> * Blocks all hosts and alternates that sent the selected result. >> */ >> void blockAllHosts() { >> TableLine line = getSelectedLine(); >> if(line == null) >> return; >> >> Set alts = line.getAlts(); >> >> RemoteFileDesc[] rfds; >> rfds = line.getAllRemoteFileDescs(); >> >> int answer = >> GUIMediator.showYesNoMessage("SEARCH_BLOCK_ALL_HOSTS"); >> if (answer == GUIMediator.YES_OPTION) { >> >> for(Iterator i = alts.iterator(); i.hasNext(); ) { >> IpPort next = (IpPort)i.next(); >> String host = next.getAddress(); >> blockOneHost(host); >> } >> >> for(int i = 0; i < rfds.length; i++) { >> RemoteFileDesc next = rfds[i]; >> String host = next.getHost(); >> blockOneHost(host); >> } >> } >> >> } >> >> > 352c390 > < * Blocks the host that sent the selected result. > --- >> * Blocks the first host (and no alternates) that sent the >> selected result. > 362,372c400 > < String[] bannedIps = > FilterSettings.BLACK_LISTED_IP_ADDRESSES.getValue(); > < // Ignore if this host is already banned. > < for (int i = 0; i < bannedIps.length; i++) > < if (host.equalsIgnoreCase(bannedIps[i])) > < return; > < String[] newBannedIps = new String[bannedIps.length + 1]; > < System.arraycopy(bannedIps, 0, newBannedIps, 0, > < bannedIps.length); > < newBannedIps[bannedIps.length] = host; > < > FilterSettings.BLACK_LISTED_IP_ADDRESSES.setValue(newBannedIps); > < RouterService.adjustSpamFilters(); > --- >> blockOneHost(host); > 375c403,422 > < > --- >> >> >> /** >> * Blocks a given host. >> */ >> void blockOneHost(String host) { >> String[] bannedIps = >> FilterSettings.BLACK_LISTED_IP_ADDRESSES.getValue(); >> // Ignore if this host is already banned. >> for (int i = 0; i < bannedIps.length; i++) >> if (host.equalsIgnoreCase(bannedIps[i])) >> return; >> String[] newBannedIps = new String[bannedIps.length + 1]; >> System.arraycopy(bannedIps, 0, newBannedIps, 0, >> bannedIps.length); >> newBannedIps[bannedIps.length] = host; >> >> FilterSettings.BLACK_LISTED_IP_ADDRESSES.setValue(newBannedIps); >> RouterService.adjustSpamFilters(); >> } >> > diff -r1.8 SearchResultMenu.java > 88c88 > < PANEL.blockHost(); > --- >> PANEL.blockAllHosts(); > _______________________________________________ > codepatch mailing list > [email protected] > http://www.limewire.org/mailman/listinfo/codepatch _______________________________________________ discuss mailing list [email protected] http://www.limewire.org/mailman/listinfo/discuss