From: <oms...@us...> - 2006-05-22 17:11:51
|
Revision: 977 Author: omschaub Date: 2006-05-22 10:11:48 -0700 (Mon, 22 May 2006) ViewCVS: http://svn.sourceforge.net/azcvsupdater/?rev=977&view=rev Log Message: ----------- Fix for the case sensitivity issues that have made Stuffer unusable Modified Paths: -------------- trunk/omschaub/omschaub/stuffer/main/Plugin.java Modified: trunk/omschaub/omschaub/stuffer/main/Plugin.java =================================================================== --- trunk/omschaub/omschaub/stuffer/main/Plugin.java 2006-03-20 20:49:37 UTC (rev 976) +++ trunk/omschaub/omschaub/stuffer/main/Plugin.java 2006-05-22 17:11:48 UTC (rev 977) @@ -33,78 +33,78 @@ * @author omschaub * * Stuffer -- Client Killer Plugin for Azureus - * + * */ public class Plugin implements UnloadablePlugin { - + //new API startup code UISWTInstance swtInstance = null; UISWTViewEventListener myView = null; private static Display display; - + //open up the Sets for use public static SetUtils table1_set; public static SetUtils table2_set; public static TotalPeerSetUtils totalPeer_set; public static ClientBlockSet clientBlock_set; - + //publically used static holders public static int total_blocked, total_removed; public static boolean areRulesPaused; private static UTTimer timer; - + // THE plugin Interface PluginInterface pluginInterface; private static PluginInterface pi; - + //pluginconfig public static PluginConfig config_getter; - + //The main Tab1 private static Tab1 MainTab1; - + //The main Tab2 private static Tab2 MainTab2; private static Tab2Utilities tab2Utilities; - + //The main Tab3 private static Tab3 MainTab3; - + public void initialize(final PluginInterface pluginInterface) { this.pluginInterface = pluginInterface; pi=pluginInterface; UIManager ui_manager = pluginInterface.getUIManager(); BasicPluginConfigModel config_model = ui_manager.createBasicPluginConfigModel( "plugins", "plugin.stuffer"); - + config_model.addBooleanParameter2("stuffer_military_time","stuffer.military.time",false); config_model.addBooleanParameter2("stuffer_auto_open","stuffer.auto.open",true); - + config_getter = pluginInterface.getPluginconfig(); - + //initialize strings areRulesPaused = false; total_removed = 0; total_blocked = 0; - + //Setup of the main Set for holding all of the table data table1_set = new SetUtils(); table1_set.SetUtilsforTable1(); table2_set = new SetUtils(); table2_set.SetUtilsforTable2(); totalPeer_set = new TotalPeerSetUtils(); - + clientBlock_set = new ClientBlockSet(); clientBlock_set.Initialize(); FileUtilities.readClientList(); - + BlockIPUtils.startMainClientCheck(); - + purgeCheck(); startPeerPurge(); - + //new API initializer - + pluginInterface.getUIManager().addUIListener(new UIManagerListener() { public void UIAttached(UIInstance instance) { if (instance instanceof UISWTInstance) { @@ -124,17 +124,17 @@ } } }); - + //initialize the tabs MainTab1 = new Tab1(); MainTab2 = new Tab2(); tab2Utilities = new Tab2Utilities(); MainTab3 = new Tab3(); - + }//End of Initialize - - - + + + public void unload() throws PluginException { if (swtInstance == null || myView == null) return; @@ -143,27 +143,27 @@ myView = null; } - - - + + + public static PluginInterface getPluginInterface(){ return pi; } - + public static Tab1 getTab1(){ - return MainTab1; + return MainTab1; } - + public static Tab2 getTab2(){ return MainTab2; } - + public static Tab3 getTab3(){ return MainTab3; } - + public static Tab2Utilities getTab2Utilities(){ return tab2Utilities; } @@ -171,82 +171,82 @@ private synchronized void purgeCheck() { if(Plugin.getTab1() != null){ - Plugin.getTab1().setTimeNextLabel("Next Auto Purge: " + - Utils.getNextRunTime((1000*60*config_getter.getPluginIntParameter("stuffer_time_interval",10)), - Plugin.config_getter.getPluginBooleanParameter("stuffer_military_time",false))); + Plugin.getTab1().setTimeNextLabel("Next Auto Purge: " + + Utils.getNextRunTime((1000*60*config_getter.getPluginIntParameter("stuffer_time_interval",10)), + Plugin.config_getter.getPluginBooleanParameter("stuffer_military_time",false))); } - + timer=pluginInterface.getUtilities().createTimer("stuffer_created_timer"); timer.addPeriodicEvent(1000*60*config_getter.getPluginIntParameter("stuffer_time_interval",10), - - - + + + new UTTimerEventPerformer() - + { - + public void - + perform( - + UTTimerEvent ev2 ) - + { - + try { if(Plugin.getTab1() != null){ - Plugin.getTab1().setTimeNextLabel("Next Auto Purge: " + - Utils.getNextRunTime((1000*60*config_getter.getPluginIntParameter("stuffer_time_interval",10)), - Plugin.config_getter.getPluginBooleanParameter("stuffer_military_time",false))); + Plugin.getTab1().setTimeNextLabel("Next Auto Purge: " + + Utils.getNextRunTime((1000*60*config_getter.getPluginIntParameter("stuffer_time_interval",10)), + Plugin.config_getter.getPluginBooleanParameter("stuffer_military_time",false))); } - - - - + + + + if(!Plugin.config_getter.getPluginBooleanParameter("stuffer_noauto",false)) { - + IPFilter ipf = new IPFilterImpl(); IPRange[] ipr = ipf.getRanges(); for(int i = 0; i < ipr.length; i++){ - if (ipr[i].getDescription().startsWith("stuffer")){ + if (ipr[i].getDescription().startsWith("Stuffer")){ ipr[i].delete(); if(Plugin.getTab1() != null) Plugin.getTab1().addElementPeer(ipr[i].getDescription(), ipr[i].getStartIP(), "Interval"); - + total_removed++; if(Plugin.getTab1() != null) Plugin.getTab1().totalChange(); } - } + } } - + }catch(Exception f) { System.out.println("Error in scanning IPFilter list"); - f.printStackTrace(); + f.printStackTrace(); } - + } - + }); - + } - - + + public static void resetTimer(){ if(timer != null){ timer.destroy(); - + } - + if(Plugin.getTab1() != null){ - Plugin.getTab1().setTimeNextLabel("Next Auto Purge: " - + Utils.getNextRunTime((1000*60*config_getter.getPluginIntParameter("stuffer_time_interval",10)), - Plugin.config_getter.getPluginBooleanParameter("stuffer_military_time",false))); + Plugin.getTab1().setTimeNextLabel("Next Auto Purge: " + + Utils.getNextRunTime((1000*60*config_getter.getPluginIntParameter("stuffer_time_interval",10)), + Plugin.config_getter.getPluginBooleanParameter("stuffer_military_time",false))); } - - + + timer=pi.getUtilities().createTimer("stuffer_created_timer"); timer.addPeriodicEvent(1000 * 60 * config_getter.getPluginIntParameter("stuffer_time_interval",10), new UTTimerEventPerformer() @@ -263,47 +263,47 @@ try { if(Plugin.getTab1() != null){ - Plugin.getTab1().setTimeNextLabel("Next Auto Purge: " - + Utils.getNextRunTime((1000*60*config_getter.getPluginIntParameter("stuffer_time_interval",10)), - Plugin.config_getter.getPluginBooleanParameter("stuffer_military_time",false))); + Plugin.getTab1().setTimeNextLabel("Next Auto Purge: " + + Utils.getNextRunTime((1000*60*config_getter.getPluginIntParameter("stuffer_time_interval",10)), + Plugin.config_getter.getPluginBooleanParameter("stuffer_military_time",false))); } - + if(!Plugin.config_getter.getPluginBooleanParameter("stuffer_noauto",false)) { - + IPFilter ipf = new IPFilterImpl(); IPRange[] ipr = ipf.getRanges(); for(int i = 0; i < ipr.length; i++){ - if (ipr[i].getDescription().startsWith("stuffer")){ - ipr[i].delete(); - if(Plugin.getTab1() != null) + if (ipr[i].getDescription().startsWith("Stuffer")){ + ipr[i].delete(); + if(Plugin.getTab1() != null) Plugin.getTab1().addElementPeer(ipr[i].getDescription(), ipr[i].getStartIP(), "Interval"); //System.out.println("Interval Deleting Stuffit IP Rule: " + ipr[i].getDescription() + " " + ipr[i].getStartIP()); total_removed++; if(Plugin.getTab1() != null) Plugin.getTab1().totalChange(); } - } + } } - + }catch(Exception f) { System.out.println("Error in scanning IPFilter list"); - f.printStackTrace(); + f.printStackTrace(); } - + } }); } - - + + public static void manualPurge(){ try { IPFilter ipf = new IPFilterImpl(); IPRange[] ipr = ipf.getRanges(); for(int i = 0; i < ipr.length; i++){ - if (ipr[i].getDescription().startsWith("stuffer")){ + if (ipr[i].getDescription().startsWith("Stuffer")){ ipr[i].delete(); if(Plugin.getTab1() != null) Plugin.getTab1().addElementPeer(ipr[i].getDescription(), ipr[i].getStartIP(), "Manual"); @@ -311,16 +311,16 @@ if(Plugin.getTab1() != null) Plugin.getTab1().totalChange(); } - } - - + } + + }catch(Exception f) { System.out.println("Error in scanning IPFilter list"); - f.printStackTrace(); + f.printStackTrace(); } } - - + + public static void startPeerPurge(){ UTTimer peer_timer=pi.getUtilities().createTimer("stuffer_purge_timer"); peer_timer.addPeriodicEvent(1000*6, @@ -337,36 +337,36 @@ { try { - + Utils.killConnectedPeers(); - - + + /*//System.out.println("Peers in TotalPeerSet: " + totalPeer_set.getSize()); Runtime runTime = Runtime.getRuntime(); float used = (runTime.totalMemory()-runTime.freeMemory())/1024/1024; float max = runTime.totalMemory() / 1024 / 1024; Tab3.setMemoryLabel(used, max); - + TotalPeerContainer[] tpc = Plugin.totalPeer_set.getAllTotalPeerContainers(); for(int i = 0; i < tpc.length; i++){ - + if(tpc[i].getTotalConnectionTime() > 5*60*1000 && tpc[i].getPercentDone() > 900){ //System.out.println(tpc[i].getIP().getAsString() + " failed with " + tpc[i].getPercentDone()); } } - + */ - + }catch(Exception e){ e.printStackTrace(); } } - + }); - + } - - + + public static void startTPCRuleRun(){ UTTimer peer_timer=pi.getUtilities().createTimer("stuffer_tpc_timer"); peer_timer.addPeriodicEvent(1000*6, @@ -383,39 +383,39 @@ { try { - + Runtime runTime = Runtime.getRuntime(); float used = (runTime.totalMemory()-runTime.freeMemory())/1024/1024; float max = runTime.totalMemory() / 1024 / 1024; MainTab3.setMemoryLabel(used, max); - + TotalPeerContainer[] tpc = Plugin.totalPeer_set.getAllTotalPeerContainers(); for(int i = 0; i < tpc.length; i++){ - + if(tpc[i].getTotalConnectionTime() > 5*60*1000 && tpc[i].getPercentDone() > 900){ //System.out.println(tpc[i].getIP().getAsString() + " failed with " + tpc[i].getPercentDone()); } } - - - + + + }catch(Exception e){ e.printStackTrace(); } } - + }); - + } - - + + public static Display getDisplay(){ return display; } public static void setDisplay(Display new_display){ display=new_display; } - + //EOF - + } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |