[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    extragear/network/ktorrent/plugins/ipfilter
From:       Ivan Vasic <ivasic () gmail ! com>
Date:       2005-11-18 17:34:19
Message-ID: 1132335259.120520.20668.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 481308 by ivasic:

Changes (IPFilterPlugin):
- Added AntiP2P class

 M  +2 -2      Makefile.am  
 A             antip2p.cpp   [License: GPL (v2+) (wrong address)]
 A             antip2p.h   [License: GPL (v2+) (wrong address)]
 M  +18 -36    ipfilterplugin.cpp  
 M  +7 -0      ipfilterplugin.h  


--- trunk/extragear/network/ktorrent/plugins/ipfilter/Makefile.am #481307:481308
@@ -1,9 +1,9 @@
 INCLUDES = $(all_includes) -I$(srcdir)/../../libktorrent
 METASOURCES = AUTO
 kde_module_LTLIBRARIES = ktipfilterplugin.la
-noinst_HEADERS = ipfilterplugin.h ipblockingprefpage.h
+noinst_HEADERS = ipfilterplugin.h ipblockingprefpage.h antip2p.h
 ktipfilterplugin_la_SOURCES = ipfilterplugin.cpp ipblockingpref.ui \
-		ipblockingprefpage.cpp ipfilterpluginsettings.kcfgc
+			ipblockingprefpage.cpp ipfilterpluginsettings.kcfgc antip2p.cpp
 
 # Libs needed by the plugin
 ktipfilterplugin_la_LIBADD = $(LIB_KHTML) $(LIB_KPARTS) \
--- trunk/extragear/network/ktorrent/plugins/ipfilter/ipfilterplugin.cpp #481307:481308
@@ -19,53 +19,23 @@
  *   51 Franklin Steet, Fifth Floor, Boston, MA 02110-1301, USA.             *
  ***************************************************************************/
 #include <kgenericfactory.h>
-#include "ipfilterplugin.h"
+
 #include <interfaces/coreinterface.h>
 #include <interfaces/guiinterface.h>
-#include <torrent/ipblocklist.h>
 #include <util/constants.h>
+
 #include <qstring.h>
-#include <qfile.h>
+
+#include "ipfilterplugin.h"
 #include "ipfilterpluginsettings.h"
+#include "antip2p.h"
 
 using namespace bt;
 
-
-
 K_EXPORT_COMPONENT_FACTORY(ktipfilterplugin,KGenericFactory<kt::IPFilterPlugin>("ipfilterplugin"))
 
 namespace kt
 {	
-	
-	Uint32 toUint32(QString& ip, bool* ok)
-	{
-		bool test;
-		*ok = true;
-
-		Uint32 ret = ip.section('.',0,0).toULongLong(&test);
-		if(!test) *ok=false;
-		ret <<= 8;
-		ret |= ip.section('.',1,1).toULong(&test);
-		if(!test) *ok=false;
-		ret <<= 8;
-		ret |= ip.section('.',2,2).toULong(&test);
-		if(!test) *ok=false;
-		ret <<= 8;
-		ret |= ip.section('.',3,3).toULong(&test);
-		if(!test) *ok=false;
-
-		if(*ok)
-		{
-// 			 			Out() << "IP: " << ip << " parsed: " << ret << endl;
-			return ret;
-		}
-		else
-		{
-// 			Out() << "Could not parse IP " << ip << ".  IP blocklist might not be working." << endl;
-			return 0;
-		}
-	}
-	
 	const QString NAME = "ipfilterplugin";
 	const QString AUTHOR = "Ivan Vasic";
 	const QString EMAIL = "ivasic@gmail.com";
@@ -75,6 +45,7 @@
 	: Plugin(parent, name, args,NAME,AUTHOR,EMAIL,DESCRIPTION)
 	{
 		// setXMLFile("ktpluginui.rc");
+		level1 = 0;
 	}
 
 
@@ -85,7 +56,6 @@
 	{
 		pref = new IPBlockingPrefPage(getCore());
 		getGUI()->addPrefPage(pref);
-		
 		pref->loadFilters();
 	}
 
@@ -94,6 +64,18 @@
 		getGUI()->removePrefPage(pref);
 		delete pref;
 		pref = 0;
+		if(level1)
+			delete level1;
 	}
+	
+	bool IPFilterPlugin::loadAntiP2P()
+	{
+		level1 = new AntiP2P();
+		if(!level1->exists())
+		{
+			delete level1;
+			level1 = 0;
+		}
+	}
 
 }
--- trunk/extragear/network/ktorrent/plugins/ipfilter/ipfilterplugin.h #481307:481308
@@ -22,7 +22,9 @@
 #define KTIPFILTERPLUGIN_H
 
 #include <interfaces/plugin.h>
+
 #include "ipblockingprefpage.h"
+#include "antip2p.h"
 
 namespace kt
 {
@@ -42,10 +44,15 @@
 		virtual void load();
 		virtual void unload();
 		
+		///Loads the KT format list filter
 		void loadFilters();
 		
+		///Loads the anti-p2p filter list
+		bool loadAntiP2P();
+						
 	private:
 		IPBlockingPrefPage* pref;
+		AntiP2P* level1;
 	};
 
 }
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic