diff options
| author | Michele Calgaro <michele.calgaro@yahoo.it> | 2025-03-02 18:37:22 +0900 |
|---|---|---|
| committer | Michele Calgaro <michele.calgaro@yahoo.it> | 2025-03-06 12:31:12 +0900 |
| commit | 44ef0bd5fe47a43e47aec5f7981b6c1d728dd9a8 (patch) | |
| tree | 2b29e921a9bccea53444ed9bbed06a25a5fe20cc /plugins/ipfilter | |
| parent | d1f24dae035c506d945ca13f2be398aa0a4de8cc (diff) | |
| download | ktorrent-44ef0bd5fe47a43e47aec5f7981b6c1d728dd9a8.tar.gz ktorrent-44ef0bd5fe47a43e47aec5f7981b6c1d728dd9a8.zip | |
Restructure source files into 'src' subfolder
Signed-off-by: Michele Calgaro <michele.calgaro@yahoo.it>
Diffstat (limited to 'plugins/ipfilter')
| -rw-r--r-- | plugins/ipfilter/Makefile.am | 31 | ||||
| -rw-r--r-- | plugins/ipfilter/antip2p.cpp | 237 | ||||
| -rw-r--r-- | plugins/ipfilter/antip2p.h | 117 | ||||
| -rw-r--r-- | plugins/ipfilter/convert_dlg.ui | 157 | ||||
| -rw-r--r-- | plugins/ipfilter/convertdialog.cpp | 262 | ||||
| -rw-r--r-- | plugins/ipfilter/convertdialog.h | 53 | ||||
| -rw-r--r-- | plugins/ipfilter/ipblockingpref.ui | 201 | ||||
| -rw-r--r-- | plugins/ipfilter/ipblockingprefpage.cpp | 258 | ||||
| -rw-r--r-- | plugins/ipfilter/ipblockingprefpage.h | 83 | ||||
| -rw-r--r-- | plugins/ipfilter/ipfilterplugin.cpp | 129 | ||||
| -rw-r--r-- | plugins/ipfilter/ipfilterplugin.h | 74 | ||||
| -rw-r--r-- | plugins/ipfilter/ipfilterpluginsettings.kcfgc | 7 | ||||
| -rw-r--r-- | plugins/ipfilter/ktipfilterplugin.desktop | 56 | ||||
| -rw-r--r-- | plugins/ipfilter/ktipfilterplugin.kcfg | 18 |
14 files changed, 0 insertions, 1683 deletions
diff --git a/plugins/ipfilter/Makefile.am b/plugins/ipfilter/Makefile.am deleted file mode 100644 index c2395b0..0000000 --- a/plugins/ipfilter/Makefile.am +++ /dev/null @@ -1,31 +0,0 @@ -INCLUDES = -I$(srcdir)/../../libktorrent $(all_includes) -METASOURCES = AUTO -kde_module_LTLIBRARIES = ktipfilterplugin.la -noinst_HEADERS = ipfilterplugin.h ipblockingprefpage.h antip2p.h \ - convertdialog.h -ktipfilterplugin_la_SOURCES = ipfilterplugin.cpp ipblockingpref.ui \ - ipblockingprefpage.cpp ipfilterpluginsettings.kcfgc antip2p.cpp convert_dlg.ui \ - convertdialog.cpp - -# Libs needed by the plugin -ktipfilterplugin_la_LIBADD = $(LIB_TDEHTML) $(LIB_TDEPARTS) \ - ../../libktorrent/libktorrent.la $(LIB_TQT) \ - $(LIB_TDECORE) $(LIB_TDEUI) $(LIB_TDEFILE) - - - -# LD flags for the plugin -# -module says: this is a module, i.e. something you're going to dlopen -# so e.g. it has no version number like a normal shared lib would have. -ktipfilterplugin_la_LDFLAGS = -module $(KDE_PLUGIN) $(all_libraries) - -# rc file containing the GUI for the plugin -# pluginsdir = $(kde_datadir)/ktsearchplugin -# plugins_DATA = ktsearchpluginui.rc - -# Install the desktop file needed to detect the plugin -kde_services_DATA = ktipfilterplugin.desktop - -kde_kcfg_DATA = ktipfilterplugin.kcfg - -KDE_CXXFLAGS = $(USE_EXCEPTIONS) $(USE_RTTI) diff --git a/plugins/ipfilter/antip2p.cpp b/plugins/ipfilter/antip2p.cpp deleted file mode 100644 index 2f9fb55..0000000 --- a/plugins/ipfilter/antip2p.cpp +++ /dev/null @@ -1,237 +0,0 @@ -/*************************************************************************** - * Copyright (C) 2005 by Joris Guisson * - * joris.guisson@gmail.com * - * ivasic@gmail.com * - * * - * This program is free software; you can redistribute it and/or modify * - * it under the terms of the GNU General Public License as published by * - * the Free Software Foundation; either version 2 of the License, or * - * (at your option) any later version. * - * * - * This program is distributed in the hope that it will be useful, * - * but WITHOUT ANY WARRANTY; without even the implied warranty of * - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * - * GNU General Public License for more details. * - * * - * You should have received a copy of the GNU General Public License * - * along with this program; if not, write to the * - * Free Software Foundation, Inc., * - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * - ***************************************************************************/ -#include "antip2p.h" - -#include <torrent/globals.h> -#include <util/log.h> -#include <util/constants.h> -#include <util/mmapfile.h> - -#include <tdeglobal.h> -#include <tdestandarddirs.h> - -#include <tqstring.h> -#include <tqvaluelist.h> - -using namespace bt; - -namespace kt -{ - - bool IPBlock::operator < (const IPBlock & b) const - { - if (ip2 < b.ip1) // a range is before b range - return true; - else if (b.ip2 < ip1) // b range is before a range - return false; - else - return ip1 < b.ip1;// a and b intersect - } - - Uint32 AntiP2P::toUint32(const TQString& ip) - { - bool test; - Uint32 ret = ip.section('.',0,0).toULongLong(&test); - ret <<= 8; - ret |= ip.section('.',1,1).toULong(&test); - ret <<= 8; - ret |= ip.section('.',2,2).toULong(&test); - ret <<= 8; - ret |= ip.section('.',3,3).toULong(&test); - - return ret; - } - - TQString fromUint32(Uint32 ip) - { - Uint32 tmp = ip; - TQString out; - - tmp = ip; - tmp &= 0x000000FF; - out.prepend(TQString("%1").arg(tmp)); - ip >>= 8; - tmp = ip; - tmp &= 0x000000FF; - out.prepend(TQString("%1.").arg(tmp)); - ip >>= 8; - tmp = ip; - tmp &= 0x000000FF; - out.prepend(TQString("%1.").arg(tmp)); - ip >>= 8; - tmp = ip; - tmp &= 0x000000FF; - out.prepend(TQString("%1.").arg(tmp)); - - return out; - } - - AntiP2P::AntiP2P() - { - header_loaded = false; - load(); - } - - AntiP2P::~AntiP2P() - { - if(file) - delete file; - - Out(SYS_IPF|LOG_ALL) << "Anti-P2P filter unloaded." << endl; - } - - void AntiP2P::load() - { - file = new MMapFile(); - if(! file->open(TDEGlobal::dirs()->saveLocation("data","ktorrent") + "level1.dat", MMapFile::READ) ) - { - Out(SYS_IPF|LOG_NOTICE) << "Anti-p2p file not loaded." << endl; - file = 0; - return; - } - Out(SYS_IPF|LOG_ALL) << "Loading Anti-P2P filter..." << endl; - } - - void AntiP2P::loadHeader() - { - if(!file) - return; - - Uint32 nrElements = file->getSize() / sizeof(IPBlock); - uint blocksize = nrElements < 100 ? 10 : 100; // number of entries that each HeaderBlock holds. If total number is < 100, than this value is 10. - HeaderBlock hb; - - for(Uint64 i = 0; i < file->getSize() ; i+= sizeof(IPBlock)*(blocksize) ) - { - IPBlock ipb; - hb.offset = i; - file->seek(MMapFile::BEGIN, i); - file->read(&ipb, sizeof(IPBlock)); - hb.ip1 = ipb.ip1; - if ( i + (blocksize-1)*sizeof(IPBlock) > file->getSize() ) //last entry - { - file->seek(MMapFile::BEGIN, file->getSize() - sizeof(IPBlock)); - file->read(&ipb, sizeof(IPBlock)); - hb.ip2 = ipb.ip2; - hb.nrEntries = nrElements % blocksize; - - blocks.push_back(hb); - break; - } - file->seek(MMapFile::BEGIN, i + (blocksize-1)*sizeof(IPBlock)); - file->read(&ipb, sizeof(IPBlock)); - hb.ip2 = ipb.ip2; - hb.nrEntries = blocksize; - blocks.push_back(hb); - } - - Out(SYS_IPF|LOG_NOTICE) << "AntiP2P header loaded." << endl; - header_loaded = true; - } - - bool AntiP2P::exists() - { - return file != 0; - } - - bool AntiP2P::isBlockedIP(const TQString& ip ) - { - Uint32 test = toUint32(ip); - return isBlockedIP(test); - } - - int AntiP2P::searchHeader(Uint32& ip, int start, int end) - { - if (end == 0) - return -1; //empty list - - if (end == 1) - { - if (blocks[start].ip1 <= ip && blocks[start].ip2 >= ip) //then our IP is somewhere in between - { - if (blocks[start].ip1 == ip || blocks[start].ip2 == ip) - return -2; //Return -2 to signal that this IP matches either IP from header. No need to search mmaped file in that case. - else - return start; //else return block index - } - else - return -1; //not found - } - else - { - int i = start + end/2; - if (blocks[i].ip1 <= ip) - return searchHeader(ip, i, end - end/2); - else - return searchHeader(ip, start, end/2); - } - } - - bool AntiP2P::isBlockedIP( Uint32& ip ) - { - if (!header_loaded) - { - Out(SYS_IPF|LOG_IMPORTANT) << "Tried to check if IP was blocked, but no AntiP2P header was loaded." << endl; - return false; - } - - int in_header = searchHeader(ip, 0, blocks.count()); - switch (in_header) - { - case -1: - return false; //ip is not blocked - case -2: - return true; //ip is blocked (we're really lucky to find it in header already) - default: - //search mmapped file - HeaderBlock to_be_searched = blocks[in_header]; - Uint8* fptr = (Uint8*) file->getDataPointer(); - fptr += to_be_searched.offset; - IPBlock* file_blocks = (IPBlock*) fptr; - return searchFile(file_blocks, ip, 0, to_be_searched.nrEntries); - break; - } - return false; - } - - bool AntiP2P::searchFile(IPBlock* file_blocks, Uint32& ip, int start, int end) - { - if (end == 0) - return false; //empty list, so not found - - if (end == 1) - { - if (file_blocks[start].ip1 <= ip && file_blocks[start].ip2 >= ip) //we have a match! - return true; - else - return false; //IP is not found. - } - - else - { - int i = start + end/2; - if (file_blocks[i].ip1 <= ip) - return searchFile(file_blocks, ip, i, end - end/2); - else - return searchFile(file_blocks, ip, start, end/2); - } - } -} diff --git a/plugins/ipfilter/antip2p.h b/plugins/ipfilter/antip2p.h deleted file mode 100644 index ce54c53..0000000 --- a/plugins/ipfilter/antip2p.h +++ /dev/null @@ -1,117 +0,0 @@ -/*************************************************************************** - * Copyright (C) 2005 by Joris Guisson * - * joris.guisson@gmail.com * - * ivasic@gmail.com * - * * - * This program is free software; you can redistribute it and/or modify * - * it under the terms of the GNU General Public License as published by * - * the Free Software Foundation; either version 2 of the License, or * - * (at your option) any later version. * - * * - * This program is distributed in the hope that it will be useful, * - * but WITHOUT ANY WARRANTY; without even the implied warranty of * - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * - * GNU General Public License for more details. * - * * - * You should have received a copy of the GNU General Public License * - * along with this program; if not, write to the * - * Free Software Foundation, Inc., * - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * - ***************************************************************************/ -#ifndef ANTIP2P_H -#define ANTIP2P_H - -#include <util/mmapfile.h> -#include <util/constants.h> - -#include <tqvaluelist.h> -#include <tqstring.h> - -namespace kt -{ - typedef struct - { - bt::Uint32 ip1; - bt::Uint32 ip2; - bt::Uint64 offset; - bt::Uint32 nrEntries; - } HeaderBlock; - - struct IPBlock - { - bt::Uint32 ip1; - bt::Uint32 ip2; - - bool operator < (const IPBlock & b) const; - }; - - /** - * @author Ivan Vasic <ivasic@gmail.com> - * @brief This class is used to manage anti-p2p filter list, so called level1. - */ - class AntiP2P - { - public: - AntiP2P(); - ~AntiP2P(); - - /** - * Checks if anti-p2p file is present. Used to check if we should use level1 list - **/ - bool exists(); - - - /** - * Creates and loads the header from antip2p filter file. - **/ - void loadHeader(); - - - /** - * Checks if specified IP is listed in filter file. - * @return TRUE if IP should be blocked, FALSE otherwise - * @param ip TQString representation of IP to be checked - **/ - bool isBlockedIP(const TQString& ip); - - /** - * Overloaded function. Uses Uint32 IP to be checked - **/ - bool isBlockedIP(bt::Uint32& ip); - - /** - * This function converts TQString IP to Uint32 format. - **/ - static bt::Uint32 toUint32(const TQString& ip); - - private: - bt::MMapFile* file; - TQValueList<HeaderBlock> blocks; - - ///Is AntiP2P header loaded - bool header_loaded; - - /** - * Loads filter file - */ - void load(); - - /** - * Binary searches AntiP2P::blocks to find range where IP could be. - * @returns - * -1 if IP cannot be in the list - * -2 if IP is already found in blocks - * or index of HeaderBlock in AntiP2P::blocks which will be used for direct file search. - **/ - int searchHeader(bt::Uint32& ip, int start, int end); - - - /** - * Binary searches AntiP2P::file to find IP. - * @returns TRUE if IP should be blocked FALSE otherwise - **/ - bool searchFile(IPBlock* file_blocks, bt::Uint32& ip, int start, int end); - - }; -} -#endif diff --git a/plugins/ipfilter/convert_dlg.ui b/plugins/ipfilter/convert_dlg.ui deleted file mode 100644 index de0aa40..0000000 --- a/plugins/ipfilter/convert_dlg.ui +++ /dev/null @@ -1,157 +0,0 @@ -<!DOCTYPE UI><UI version="3.3" stdsetdef="1"> -<class>ConvertingDlg</class> -<widget class="TQDialog"> - <property name="name"> - <cstring>ConvertingDlg</cstring> - </property> - <property name="geometry"> - <rect> - <x>0</x> - <y>0</y> - <width>414</width> - <height>156</height> - </rect> - </property> - <property name="sizePolicy"> - <sizepolicy> - <hsizetype>5</hsizetype> - <vsizetype>5</vsizetype> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="caption"> - <string>Converting...</string> - </property> - <property name="modal"> - <bool>true</bool> - </property> - <grid> - <property name="name"> - <cstring>unnamed</cstring> - </property> - <property name="resizeMode"> - <enum>Fixed</enum> - </property> - <widget class="TQLabel" row="0" column="0"> - <property name="name"> - <cstring>textLabel1</cstring> - </property> - <property name="text"> - <string>Click on the 'convert' button to start converting antip2p file. NOTE: This process could take a while even on fast machines and during that time you will not be able to use KTorrent.</string> - </property> - <property name="textFormat"> - <enum>AutoText</enum> - </property> - <property name="scaledContents"> - <bool>false</bool> - </property> - <property name="alignment"> - <set>WordBreak|AlignVCenter</set> - </property> - <property name="indent"> - <number>-2</number> - </property> - </widget> - <widget class="TQLabel" row="1" column="0"> - <property name="name"> - <cstring>lbl_progress</cstring> - </property> - <property name="text"> - <string></string> - </property> - </widget> - <widget class="KProgress" row="2" column="0"> - <property name="name"> - <cstring>kProgress1</cstring> - </property> - <property name="sizePolicy"> - <sizepolicy> - <hsizetype>0</hsizetype> - <vsizetype>0</vsizetype> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="minimumSize"> - <size> - <width>390</width> - <height>0</height> - </size> - </property> - </widget> - <widget class="TQLayoutWidget" row="3" column="0"> - <property name="name"> - <cstring>layout6</cstring> - </property> - <hbox> - <property name="name"> - <cstring>unnamed</cstring> - </property> - <widget class="TQLabel"> - <property name="name"> - <cstring>label1</cstring> - </property> - <property name="text"> - <string></string> - </property> - </widget> - <widget class="TQPushButton"> - <property name="name"> - <cstring>btnClose</cstring> - </property> - <property name="sizePolicy"> - <sizepolicy> - <hsizetype>0</hsizetype> - <vsizetype>0</vsizetype> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="text"> - <string>&Close</string> - </property> - </widget> - <widget class="TQPushButton"> - <property name="name"> - <cstring>btnCancel</cstring> - </property> - <property name="sizePolicy"> - <sizepolicy> - <hsizetype>0</hsizetype> - <vsizetype>0</vsizetype> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="text"> - <string>C&ancel</string> - </property> - </widget> - </hbox> - </widget> - </grid> -</widget> -<connections> - <connection> - <sender>btnClose</sender> - <signal>clicked()</signal> - <receiver>ConvertingDlg</receiver> - <slot>btnClose_clicked()</slot> - </connection> - <connection> - <sender>btnCancel</sender> - <signal>clicked()</signal> - <receiver>ConvertingDlg</receiver> - <slot>btnCancel_clicked()</slot> - </connection> -</connections> -<slots> - <slot>btnClose_clicked()</slot> - <slot>btnCancel_clicked()</slot> -</slots> -<layoutdefaults spacing="6" margin="11"/> -<includes> - <include location="global" impldecl="in implementation">kprogress.h</include> -</includes> -</UI> diff --git a/plugins/ipfilter/convertdialog.cpp b/plugins/ipfilter/convertdialog.cpp deleted file mode 100644 index e2686fd..0000000 --- a/plugins/ipfilter/convertdialog.cpp +++ /dev/null @@ -1,262 +0,0 @@ -/*************************************************************************** -* Copyright (C) 2005 by Joris Guisson * -* joris.guisson@gmail.com * -* * -* This program is free software; you can redistribute it and/or modify * -* it under the terms of the GNU General Public License as published by * -* the Free Software Foundation; either version 2 of the License, or * -* (at your option) any later version. * -* * -* This program is distributed in the hope that it will be useful, * -* but WITHOUT ANY WARRANTY; without even the implied warranty of * -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * -* GNU General Public License for more details. * -* * -* You should have received a copy of the GNU General Public License * -* along with this program; if not, write to the * -* Free Software Foundation, Inc., * -* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * -***************************************************************************/ -#include "convertdialog.h" - -#include <tdeapplication.h> -#include <tdeglobal.h> -#include <tdestandarddirs.h> -#include <tdelocale.h> -#include <kurl.h> -#include <tdemessagebox.h> -#include <tdeio/netaccess.h> -#include <kprogress.h> -#include <kmimetype.h> - -#include <util/log.h> -#include <util/constants.h> -#include <torrent/globals.h> -#include <interfaces/coreinterface.h> - -#include <tqfile.h> -#include <tqstringlist.h> -#include <tqtextstream.h> -#include <tqregexp.h> -#include <tqvalidator.h> -#include <tqlabel.h> -#include <tqpushbutton.h> -#include <tqevent.h> -#include <tqurloperator.h> -#include "antip2p.h" - -using namespace bt; - -namespace kt -{ - - - Uint32 toUint32(TQString& ip) - { - bool test; - Uint32 ret = ip.section('.',0,0).toULongLong(&test); - ret <<= 8; - ret |= ip.section('.',1,1).toULong(&test); - ret <<= 8; - ret |= ip.section('.',2,2).toULong(&test); - ret <<= 8; - ret |= ip.section('.',3,3).toULong(&test); - - return ret; - } - - IPBlock RangeToBlock(const TQString& range) - { - IPBlock block; - TQStringList ls = TQStringList::split('-', range); - block.ip1 = toUint32(ls[0]); - block.ip2 = toUint32(ls[1]); - return block; - } - - ConvertDialog::ConvertDialog( IPFilterPlugin* p, TQWidget *parent, const char *name ) - : ConvertingDlg( parent, name ) - { - m_plugin = p; - btnClose->setText(i18n("Convert")); - to_convert = true; - converting = false; - canceled = false; - kProgress1->setEnabled(false); - } - - void ConvertDialog::convert() - { - TQFile source( TDEGlobal::dirs() ->saveLocation( "data", "ktorrent" ) + "level1.txt" ); - TQFile target( TDEGlobal::dirs() ->saveLocation( "data", "ktorrent" ) + "level1.dat" ); - TQFile temp( TDEGlobal::dirs() ->saveLocation( "data", "ktorrent" ) + "level1.dat.tmp" ); - - if(target.exists()) - { - //make backup - TDEIO::NetAccess::file_copy(TDEGlobal::dirs() ->saveLocation( "data", "ktorrent" ) + "level1.dat", TDEGlobal::dirs() ->saveLocation( "data", "ktorrent" ) + "level1.dat.tmp", -1, true); - } - - /* READ INPUT FILE */ - TQValueList<IPBlock> list; - lbl_progress->setText( i18n( "Loading txt file..." ) ); - label1->setText( i18n("Please wait...") ); - ulong source_size = source.size(); - btnClose->setEnabled( false ); - converting = true; - - int counter = 0; - - if ( source.open( IO_ReadOnly ) ) - { - TQTextStream stream( &source ); - kProgress1->setEnabled(true); - - int i = 0; - TQRegExp rx( "[0-9]{1,3}.[0-9]{1,3}.[0-9]{1,3}.[0-9]{1,3}-[0-9]{1,3}.[0-9]{1,3}.[0-9]{1,3}.[0-9]{1,3}" ); - TQRegExpValidator v( rx, 0 ); - int poz = 0; - - while ( !stream.atEnd() ) - { - if(canceled) - return; - - tdeApp ->processEvents(); - TQString line = stream.readLine(); - i += line.length() * sizeof( char ); //rough estimation of string size - kProgress1->setProgress( i * 100 / source_size ); - ++i; - - TQString ip_part = line.section( ':' , -1 ); - if ( v.validate( ip_part, poz ) != TQValidator::Acceptable ) - continue; - else - ++counter; - - list += RangeToBlock(ip_part); - } - source.close(); - } - else - { - Out(SYS_IPF|LOG_IMPORTANT) << "Cannot find level1 file" << endl; - btnClose->setEnabled( true ); - btnClose->setText(i18n("&Close")); - label1->setText(""); - to_convert = false; - converting = false; - return ; - } - - if ( counter != 0 ) - { - qHeapSort(list); - lbl_progress->setText( i18n( "Converting..." ) ); - if ( m_plugin ) - m_plugin->unloadAntiP2P(); - - ulong blocks = list.count(); - - /** WRITE TO OUTPUT **/ - if ( !target.open( IO_WriteOnly ) ) - { - Out(SYS_IPF|LOG_IMPORTANT) << "Unable to open file for writing" << endl; - btnClose->setEnabled( true ); - btnClose->setText(i18n("&Close")); - label1->setText(""); - to_convert = false; - converting = false; - return ; - } - - Out(SYS_IPF|LOG_NOTICE) << "Loading finished. Starting conversion..." << endl; - - TQValueList<IPBlock>::iterator iter; - int i = 0; - for (iter = list.begin(); iter != list.end(); ++iter, ++i) - { - IPBlock & block = *iter; - target.writeBlock( ( char* ) & block, sizeof( IPBlock ) ); - if ( i % 1000 == 0 ) - { - kProgress1->setProgress( ( int ) 100 * i / blocks ); - if ( i % 10000 == 0 ) - Out(SYS_IPF|LOG_DEBUG) << "Block " << i << " written." << endl; - } - tdeApp->processEvents(); - - if(canceled) - return; - } - kProgress1->setProgress(100); - Out(SYS_IPF|LOG_NOTICE) << "Finished converting." << endl; - lbl_progress->setText( i18n( "File converted." ) ); - target.close(); - } - else - { - lbl_progress->setText( "<font color=\"#ff0000\">" + i18n( "Could not load filter:" ) + "</font>" + i18n( "Bad filter file. It may be corrupted or has a bad format." ) ); - target.remove(); - source.remove(); - btnClose->setEnabled( true ); - btnClose->setText(i18n("&Close")); - label1->setText(""); - to_convert = false; - converting = false; - } - - tdeApp->processEvents(); - //reload level1 filter - if ( m_plugin ) - m_plugin->loadAntiP2P(); - - btnClose->setEnabled( true ); - to_convert = false; - converting = false; - btnClose->setText(i18n("&Close")); - label1->setText(""); - } - - void ConvertDialog::btnClose_clicked() - { - if(to_convert) - convert(); - else - this->close(); - } - - void ConvertDialog::closeEvent(TQCloseEvent* e) - { - if(!converting) - e->accept(); - else - e->ignore(); - } - - void ConvertDialog::btnCancel_clicked() - { - if(converting) - { - TQFile target( TDEGlobal::dirs() ->saveLocation( "data", "ktorrent" ) + "level1.dat" ); - if(target.exists()) - target.remove(); - - TQFile temp( TDEGlobal::dirs() ->saveLocation( "data", "ktorrent" ) + "level1.dat.tmp"); - if(temp.exists()) - { - TDEIO::NetAccess::file_copy(TDEGlobal::dirs() ->saveLocation( "data", "ktorrent" ) + "level1.dat.tmp", TDEGlobal::dirs() ->saveLocation( "data", "ktorrent" ) + "level1.dat", -1, true); - temp.remove(); - } - - canceled = true; - Out(SYS_IPF|LOG_NOTICE) << "Conversion canceled." << endl; - } - - - this->reject(); - } - -} - -#include "convertdialog.moc" diff --git a/plugins/ipfilter/convertdialog.h b/plugins/ipfilter/convertdialog.h deleted file mode 100644 index cf292a3..0000000 --- a/plugins/ipfilter/convertdialog.h +++ /dev/null @@ -1,53 +0,0 @@ -/*************************************************************************** -* Copyright (C) 2005 by Joris Guisson * -* joris.guisson@gmail.com * -* * -* This program is free software; you can redistribute it and/or modify * -* it under the terms of the GNU General Public License as published by * -* the Free Software Foundation; either version 2 of the License, or * -* (at your option) any later version. * -* * -* This program is distributed in the hope that it will be useful, * -* but WITHOUT ANY WARRANTY; without even the implied warranty of * -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * -* GNU General Public License for more details. * -* * -* You should have received a copy of the GNU General Public License * -* along with this program; if not, write to the * -* Free Software Foundation, Inc., * -* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * -***************************************************************************/ -#ifndef CONVERTDIALOG_H -#define CONVERTDIALOG_H - -#include "convert_dlg.h" -#include "ipfilterplugin.h" - -#include <tqevent.h> - -namespace kt -{ - class ConvertDialog: public ConvertingDlg - { - TQ_OBJECT - - - public: - ConvertDialog( IPFilterPlugin* p, TQWidget *parent = 0, const char *name = 0 ); - - public slots: - virtual void btnClose_clicked(); - - private: - void convert(); - IPFilterPlugin* m_plugin; - bool to_convert; - bool converting; - bool canceled; - - private slots: - void closeEvent(TQCloseEvent* e); - virtual void btnCancel_clicked(); - }; -} -#endif diff --git a/plugins/ipfilter/ipblockingpref.ui b/plugins/ipfilter/ipblockingpref.ui deleted file mode 100644 index 3435167..0000000 --- a/plugins/ipfilter/ipblockingpref.ui +++ /dev/null @@ -1,201 +0,0 @@ -<!DOCTYPE UI><UI version="3.3" stdsetdef="1"> -<class>IPBlockingPref</class> -<widget class="TQWidget"> - <property name="name"> - <cstring>IPBlockingPref</cstring> - </property> - <property name="geometry"> - <rect> - <x>0</x> - <y>0</y> - <width>564</width> - <height>444</height> - </rect> - </property> - <property name="caption"> - <string>IPBlocking Preferences</string> - </property> - <grid> - <property name="name"> - <cstring>unnamed</cstring> - </property> - <spacer row="2" column="0"> - <property name="name"> - <cstring>spacer7</cstring> - </property> - <property name="orientation"> - <enum>Vertical</enum> - </property> - <property name="sizeType"> - <enum>Expanding</enum> - </property> - <property name="sizeHint"> - <size> - <width>20</width> - <height>20</height> - </size> - </property> - </spacer> - <widget class="TQGroupBox" row="0" column="0"> - <property name="name"> - <cstring>groupBox1</cstring> - </property> - <property name="enabled"> - <bool>true</bool> - </property> - <property name="title"> - <string>Select PeerGuardian Filter File </string> - </property> - <grid> - <property name="name"> - <cstring>unnamed</cstring> - </property> - <widget class="TQCheckBox" row="0" column="0"> - <property name="name"> - <cstring>checkUseLevel1</cstring> - </property> - <property name="text"> - <string>Use PeerGuardian filter?</string> - </property> - </widget> - <widget class="TQLayoutWidget" row="1" column="0"> - <property name="name"> - <cstring>layout5</cstring> - </property> - <hbox> - <property name="name"> - <cstring>unnamed</cstring> - </property> - <widget class="TQLabel"> - <property name="name"> - <cstring>textLabel1_3</cstring> - </property> - <property name="text"> - <string>IP filter file:</string> - </property> - </widget> - <widget class="KURLRequester"> - <property name="name"> - <cstring>m_url</cstring> - </property> - <property name="url" stdset="0"> - <string>http://www.bluetack.co.uk/modules.php?name=Downloads&d_op=getit&lid=8</string> - </property> - <property name="showLocalProtocol"> - <bool>false</bool> - </property> - </widget> - </hbox> - </widget> - <widget class="TQLayoutWidget" row="2" column="0"> - <property name="name"> - <cstring>layout3</cstring> - </property> - <hbox> - <property name="name"> - <cstring>unnamed</cstring> - </property> - <spacer> - <property name="name"> - <cstring>spacer3</cstring> - </property> - <property name="orientation"> - <enum>Horizontal</enum> - </property> - <property name="sizeType"> - <enum>Expanding</enum> - </property> - <property name="sizeHint"> - <size> - <width>361</width> - <height>20</height> - </size> - </property> - </spacer> - <widget class="TQPushButton"> - <property name="name"> - <cstring>btnDownload</cstring> - </property> - <property name="text"> - <string>Dow&nload/Convert</string> - </property> - </widget> - </hbox> - </widget> - <widget class="TQLabel" row="3" column="0"> - <property name="name"> - <cstring>textLabel1_2</cstring> - </property> - <property name="text"> - <string>Download PeerGuardian filter from bluetack.co.uk or blocklist.org. -NOTE: ZIP file from bluetack.co.uk is supported.</string> - </property> - </widget> - <widget class="TQLabel" row="5" column="0"> - <property name="name"> - <cstring>lbl_status1</cstring> - </property> - <property name="text"> - <string></string> - </property> - </widget> - <spacer row="4" column="0"> - <property name="name"> - <cstring>spacer6</cstring> - </property> - <property name="orientation"> - <enum>Vertical</enum> - </property> - <property name="sizeType"> - <enum>Expanding</enum> - </property> - <property name="sizeHint"> - <size> - <width>20</width> - <height>20</height> - </size> - </property> - </spacer> - </grid> - </widget> - </grid> -</widget> -<customwidgets> -</customwidgets> -<connections> - <connection> - <sender>btnDownload</sender> - <signal>clicked()</signal> - <receiver>IPBlockingPref</receiver> - <slot>btnDownload_clicked()</slot> - </connection> - <connection> - <sender>checkUseLevel1</sender> - <signal>toggled(bool)</signal> - <receiver>IPBlockingPref</receiver> - <slot>checkUseLevel1_toggled(bool)</slot> - </connection> - <connection> - <sender>checkUseLevel1</sender> - <signal>toggled(bool)</signal> - <receiver>textLabel1_2</receiver> - <slot>setEnabled(bool)</slot> - </connection> - <connection> - <sender>checkUseLevel1</sender> - <signal>toggled(bool)</signal> - <receiver>textLabel1_3</receiver> - <slot>setEnabled(bool)</slot> - </connection> -</connections> -<slots> - <slot>btnDownload_clicked()</slot> - <slot>checkUseLevel1_toggled(bool)</slot> - <slot>checkUseKTfilter_toggled(bool)</slot> -</slots> -<layoutdefaults spacing="6" margin="11"/> -<includes> - <include location="global" impldecl="in implementation">kpushbutton.h</include> - <include location="global" impldecl="in implementation">kurlrequester.h</include> -</includes> -</UI> diff --git a/plugins/ipfilter/ipblockingprefpage.cpp b/plugins/ipfilter/ipblockingprefpage.cpp deleted file mode 100644 index a797f93..0000000 --- a/plugins/ipfilter/ipblockingprefpage.cpp +++ /dev/null @@ -1,258 +0,0 @@ -/*************************************************************************** - * Copyright (C) 2005 by Joris Guisson * - * joris.guisson@gmail.com * - * ivasic@gmail.com * - * * - * This program is free software; you can redistribute it and/or modify * - * it under the terms of the GNU General Public License as published by * - * the Free Software Foundation; either version 2 of the License, or * - * (at your option) any later version. * - * * - * This program is distributed in the hope that it will be useful, * - * but WITHOUT ANY WARRANTY; without even the implied warranty of * - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * - * GNU General Public License for more details. * - * * - * You should have received a copy of the GNU General Public License * - * along with this program; if not, write to the * - * Free Software Foundation, Inc., * - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * - ***************************************************************************/ -#include "ipblockingprefpage.h" -#include "ipblockingpref.h" -#include "ipfilterpluginsettings.h" -#include "ipfilterplugin.h" -#include "convertdialog.h" - -#include <tdeapplication.h> -#include <tdeglobal.h> -#include <tdestandarddirs.h> -#include <tdelocale.h> -#include <kiconloader.h> -#include <kurlrequester.h> -#include <kurl.h> -#include <tdemessagebox.h> -#include <tdeio/netaccess.h> -#include <kprogress.h> -#include <kmimetype.h> - -#include <util/log.h> -#include <torrent/globals.h> -#include <interfaces/coreinterface.h> - -#include <tqthread.h> -#include <tqlabel.h> -#include <tqcheckbox.h> -#include <tqregexp.h> -#include <tqvalidator.h> -#include <tqlayout.h> -#include <tqdialog.h> -#include <tqobject.h> - -using namespace bt; - -#define MAX_RANGES 500 - -namespace kt -{ - IPBlockingPrefPageWidget::IPBlockingPrefPageWidget(TQWidget* parent) : IPBlockingPref(parent) - { - m_url->setURL(IPBlockingPluginSettings::filterURL()); - if (m_url->url() == "") - m_url->setURL(TQString("http://www.bluetack.co.uk/config/splist.zip")); - - bool use_level1 = IPBlockingPluginSettings::useLevel1(); - - checkUseLevel1->setChecked(use_level1); - - if(use_level1) - { - lbl_status1->setText(i18n("Status: Loaded and running.")); - m_url->setEnabled(true); - btnDownload->setEnabled(true); - } - else - { - lbl_status1->setText(i18n("Status: Not loaded.")); - m_url->setEnabled(false); - btnDownload->setEnabled(false); - } - - m_plugin = 0; - } - - void IPBlockingPrefPageWidget::apply() - { - IPBlockingPluginSettings::setFilterURL(m_url->url()); - IPBlockingPluginSettings::setUseLevel1(checkUseLevel1->isChecked()); - IPBlockingPluginSettings::writeConfig(); - - if(checkUseLevel1->isChecked()) - { - TQFile target(TDEGlobal::dirs()->saveLocation("data","ktorrent") + "level1.dat"); - if(target.exists()) - lbl_status1->setText(i18n("Status: Loaded and running.")); - else - lbl_status1->setText(i18n("Status: <font color=\"#ff0000\">Filter file not found.</font> Download and convert filter file.")); - } - else - lbl_status1->setText(i18n("Status: Not loaded.")); - } - - void IPBlockingPrefPageWidget::btnDownload_clicked() - { - TQString target(TDEGlobal::dirs()->saveLocation("data","ktorrent") + "level1"); - TQFile target_file(target); - TQFile txtfile(target + ".txt"); - KURL url(m_url->url()); - KURL dest(target); - KURL temp(TDEGlobal::dirs()->saveLocation("data","ktorrent") + "level1.tmp"); - if(TDEIO::NetAccess::exists(temp,false, this)) - TDEIO::NetAccess::del(temp,this); - - bool download = true; - - if(txtfile.exists()) - { - if((KMessageBox::questionYesNo(this, i18n("Selected file already exists, do you want to download it again?"),i18n("File Exists")) == 4)) - download = false; - else - TDEIO::NetAccess::move(target, temp); - } - - if(download) - { - if(!url.isLocalFile()) - { - if (TDEIO::NetAccess::download(url,target,NULL)) - { - //Level1 list successfully downloaded, remove temporary file - TDEIO::NetAccess::removeTempFile(target); - TDEIO::NetAccess::del(temp, this); - } - else - { - TQString err = TDEIO::NetAccess::lastErrorString(); - if(err != TQString()) - KMessageBox::error(0,TDEIO::NetAccess::lastErrorString(),i18n("Error")); - else - TDEIO::NetAccess::move(temp, target); - - - //we don't want to convert since download failed - return; - } - } - else - { - if (!TDEIO::NetAccess::file_copy(url,dest, -1, true)) - { - KMessageBox::error(0,TDEIO::NetAccess::lastErrorString(),i18n("Error")); - return; - } - } - - //now determine if it's ZIP or TXT file - KMimeType::Ptr ptr = KMimeType::findByPath(target); - if(ptr->name() == "application/x-zip") - { - KURL zipfile("zip:" + target + "/splist.txt"); - KURL destinationfile(target + ".txt"); - TDEIO::NetAccess::file_copy(zipfile,destinationfile, -1, true); - } - else - { - KURL zipfile(target); - KURL destinationfile(target + ".txt"); - TDEIO::NetAccess::file_copy(zipfile,destinationfile, -1, true); - } - - } - convert(); - } - - void IPBlockingPrefPageWidget::checkUseLevel1_toggled(bool check) - { - if(check) - { - m_url->setEnabled(true); - btnDownload->setEnabled(true); - } - else - { - lbl_status1->setText(""); - m_url->setEnabled(false); - btnDownload->setEnabled(false); - } - } - - void IPBlockingPrefPageWidget::convert() - { - TQFile target(TDEGlobal::dirs()->saveLocation("data","ktorrent") + "level1.dat"); - if(target.exists()) - { - if((KMessageBox::questionYesNo(this,i18n("Filter file (level1.dat) already exists, do you want to convert it again?"),i18n("File Exists")) == 4)) - return; -// else -// TDEIO::NetAccess::del(TDEGlobal::dirs()->saveLocation("data","ktorrent") + "level1.dat", NULL); - } - ConvertDialog dlg(m_plugin); - dlg.exec(); - } - - void IPBlockingPrefPageWidget::setPlugin(IPFilterPlugin* p) - { - m_plugin = p; - } - - void IPBlockingPrefPageWidget::setPrefPage( IPBlockingPrefPage * p ) - { - m_prefpage = p; - } - - void IPBlockingPrefPageWidget::setConverting(bool enable) - { - btnDownload->setEnabled(enable); - lbl_status1->setText(""); - } - - - //////////////////////////////////////////////////////////////////////////////////// - - IPBlockingPrefPage::IPBlockingPrefPage(CoreInterface* core, IPFilterPlugin* p) - : PrefPageInterface(i18n("IPBlocking Filter"), i18n("IPBlocking Filter Options"), TDEGlobal::iconLoader()->loadIcon("filter",TDEIcon::NoGroup)), m_core(core), m_plugin(p) - { - widget = 0; - } - - IPBlockingPrefPage::~IPBlockingPrefPage() - {} - - bool IPBlockingPrefPage::apply() - { - widget->apply(); - - if(IPBlockingPluginSettings::useLevel1()) - m_plugin->loadAntiP2P(); - else - m_plugin->unloadAntiP2P(); - - return true; - } - - void IPBlockingPrefPage::createWidget(TQWidget* parent) - { - widget = new IPBlockingPrefPageWidget(parent); - widget->setPlugin(m_plugin); - widget->setPrefPage(this); - } - - void IPBlockingPrefPage::deleteWidget() - { - delete widget; - widget = 0; - } - - void IPBlockingPrefPage::updateData() - {} -} diff --git a/plugins/ipfilter/ipblockingprefpage.h b/plugins/ipfilter/ipblockingprefpage.h deleted file mode 100644 index 1e6d19e..0000000 --- a/plugins/ipfilter/ipblockingprefpage.h +++ /dev/null @@ -1,83 +0,0 @@ -/*************************************************************************** - * Copyright (C) 2005 by Joris Guisson * - * joris.guisson@gmail.com * - * ivasic@gmail.com * - * * - * This program is free software; you can redistribute it and/or modify * - * it under the terms of the GNU General Public License as published by * - * the Free Software Foundation; either version 2 of the License, or * - * (at your option) any later version. * - * * - * This program is distributed in the hope that it will be useful, * - * but WITHOUT ANY WARRANTY; without even the implied warranty of * - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * - * GNU General Public License for more details. * - * * - * You should have received a copy of the GNU General Public License * - * along with this program; if not, write to the * - * Free Software Foundation, Inc., * - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * - ***************************************************************************/ -#ifndef IPBLOCKINGPREFPAGE_H -#define IPBLOCKINGPREFPAGE_H - -#include <interfaces/prefpageinterface.h> -#include "ipblockingpref.h" -#include "ipfilterplugin.h" -#include <interfaces/coreinterface.h> -#include <tqthread.h> -#include <tqobject.h> - -class KProgress; - -namespace kt -{ - class IPFilterPlugin; - class IPBlockingPrefPage; - - /** - @author Ivan Vasic - */ - class IPBlockingPrefPageWidget : public IPBlockingPref - { - public: - IPBlockingPrefPageWidget(TQWidget *parent = 0); - void apply(); - void convert(); - void setPlugin(IPFilterPlugin* p); - void setPrefPage(IPBlockingPrefPage* p); - - //used with ConvertThread to enable/disable controls while converting - void setConverting(bool enable); - - public slots: - virtual void btnDownload_clicked(); - virtual void checkUseLevel1_toggled(bool); - - private: - IPFilterPlugin* m_plugin; - IPBlockingPrefPage* m_prefpage; - }; - - /** - * @author Ivan Vasic - * @brief IPBlocking plugin interface page - **/ - class IPBlockingPrefPage : public PrefPageInterface - { - public: - IPBlockingPrefPage(CoreInterface* core, IPFilterPlugin* p); - virtual ~IPBlockingPrefPage(); - - virtual bool apply(); - virtual void createWidget(TQWidget* parent); - virtual void updateData(); - virtual void deleteWidget(); - - private: - CoreInterface* m_core; - IPBlockingPrefPageWidget* widget; - IPFilterPlugin* m_plugin; - }; -} -#endif diff --git a/plugins/ipfilter/ipfilterplugin.cpp b/plugins/ipfilter/ipfilterplugin.cpp deleted file mode 100644 index 96f71bf..0000000 --- a/plugins/ipfilter/ipfilterplugin.cpp +++ /dev/null @@ -1,129 +0,0 @@ -/*************************************************************************** - * Copyright (C) 2005 by Joris Guisson * - * joris.guisson@gmail.com * - * ivasic@gmail.com * - * * - * This program is free software; you can redistribute it and/or modify * - * it under the terms of the GNU General Public License as published by * - * the Free Software Foundation; either version 2 of the License, or * - * (at your option) any later version. * - * * - * This program is distributed in the hope that it will be useful, * - * but WITHOUT ANY WARRANTY; without even the implied warranty of * - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * - * GNU General Public License for more details. * - * * - * You should have received a copy of the GNU General Public License * - * along with this program; if not, write to the * - * Free Software Foundation, Inc., * - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * - ***************************************************************************/ -#include <kgenericfactory.h> - -#include <interfaces/coreinterface.h> -#include <interfaces/guiinterface.h> -#include <util/constants.h> -#include <torrent/ipblocklist.h> - -#include <tqstring.h> - -#include "ipfilterplugin.h" -#include "ipfilterpluginsettings.h" -#include "antip2p.h" - -using namespace bt; - -K_EXPORT_COMPONENT_FACTORY(ktipfilterplugin,KGenericFactory<kt::IPFilterPlugin>("ipfilterplugin")) - -namespace kt -{ - const TQString NAME = "IP Filter"; - const TQString AUTHOR = "Ivan Vasic"; - const TQString EMAIL = "ivasic@gmail.com"; - const TQString DESCRIPTION = i18n("Filters out unwanted peers based on their IP address"); - - IPFilterPlugin::IPFilterPlugin(TQObject* parent, const char* name, const TQStringList& args) - : Plugin(parent, name, args,NAME,i18n("IP Filter"),AUTHOR,EMAIL,DESCRIPTION,"filter") - { - // setXMLFile("ktpluginui.rc"); - level1 = 0; - } - - - IPFilterPlugin::~IPFilterPlugin() - { - //...just in case something goes wrong... - IPBlocklist& ipblist = IPBlocklist::instance(); - ipblist.unsetPluginInterfacePtr(); - } - - void IPFilterPlugin::load() - { - pref = new IPBlockingPrefPage(getCore(), this); - getGUI()->addPrefPage(pref); - - if(IPBlockingPluginSettings::useLevel1()) - loadAntiP2P(); - - //now we need to set a pointer to the IPBlocklist - IPBlocklist& ipblist = IPBlocklist::instance(); - ipblist.setPluginInterfacePtr(this); - } - - void IPFilterPlugin::unload() - { - //First unset pointer in IPBlocklist - IPBlocklist& ipblist = IPBlocklist::instance(); - ipblist.unsetPluginInterfacePtr(); - - getGUI()->removePrefPage(pref); - delete pref; - pref = 0; - if(level1) - { - delete level1; - level1 = 0; - } - } - - bool IPFilterPlugin::loadAntiP2P() - { - if(level1 != 0) - return true; - level1 = new AntiP2P(); - if(!level1->exists()) - { - delete level1; - level1 = 0; - return false; - } - level1->loadHeader(); - return true; - } - - bool IPFilterPlugin::unloadAntiP2P() - { - if(level1 != 0) - { - delete level1; - level1 = 0; - return true; - } - else - //anything else to check? - return true; - } - - bool IPFilterPlugin::isBlockedIP(const TQString& ip) - { - if (level1 == 0) - return false; - - return level1->isBlockedIP(ip); - } - - bool IPFilterPlugin::versionCheck(const TQString & version) const - { - return version == KT_VERSION_MACRO; - } -} diff --git a/plugins/ipfilter/ipfilterplugin.h b/plugins/ipfilter/ipfilterplugin.h deleted file mode 100644 index 2ef114a..0000000 --- a/plugins/ipfilter/ipfilterplugin.h +++ /dev/null @@ -1,74 +0,0 @@ -/*************************************************************************** - * Copyright (C) 2005 by Joris Guisson * - * joris.guisson@gmail.com * - * ivasic@gmail.com * - * * - * This program is free software; you can redistribute it and/or modify * - * it under the terms of the GNU General Public License as published by * - * the Free Software Foundation; either version 2 of the License, or * - * (at your option) any later version. * - * * - * This program is distributed in the hope that it will be useful, * - * but WITHOUT ANY WARRANTY; without even the implied warranty of * - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * - * GNU General Public License for more details. * - * * - * You should have received a copy of the GNU General Public License * - * along with this program; if not, write to the * - * Free Software Foundation, Inc., * - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * - ***************************************************************************/ -#ifndef KTIPFILTERPLUGIN_H -#define KTIPFILTERPLUGIN_H - -#include <interfaces/plugin.h> -#include <interfaces/ipblockinginterface.h> - -#include "ipblockingprefpage.h" -#include "antip2p.h" - -class TQString; - -namespace kt -{ - class IPBlockingPrefPage; - - /** - * @author Ivan Vasic <ivasic@gmail.com> - * @brief IP filter plugin - * - * This plugin will load IP ranges from specific files into KT IPBlocklist. - */ - class IPFilterPlugin : public Plugin, public kt::IPBlockingInterface - { - TQ_OBJECT - - public: - IPFilterPlugin(TQObject* parent, const char* name, const TQStringList& args); - virtual ~IPFilterPlugin(); - - virtual void load(); - virtual void unload(); - - ///Loads the KT format list filter - void loadFilters(); - - ///Loads the anti-p2p filter list - bool loadAntiP2P(); - - ///Unloads the anti-p2p filter list - bool unloadAntiP2P(); - - - ///Checks if IP is listed in AntiP2P filter list. - bool isBlockedIP(const TQString& ip); - - bool versionCheck(const TQString & version) const; - private: - IPBlockingPrefPage* pref; - AntiP2P* level1; - }; - -} - -#endif diff --git a/plugins/ipfilter/ipfilterpluginsettings.kcfgc b/plugins/ipfilter/ipfilterpluginsettings.kcfgc deleted file mode 100644 index 29f74c4..0000000 --- a/plugins/ipfilter/ipfilterpluginsettings.kcfgc +++ /dev/null @@ -1,7 +0,0 @@ -# Code generation options for tdeconfig_compiler -File=ktipfilterplugin.kcfg -ClassName=IPBlockingPluginSettings -Namespace=kt -Singleton=true -Mutators=true -# will create the necessary code for setting those variables
\ No newline at end of file diff --git a/plugins/ipfilter/ktipfilterplugin.desktop b/plugins/ipfilter/ktipfilterplugin.desktop deleted file mode 100644 index 4435c28..0000000 --- a/plugins/ipfilter/ktipfilterplugin.desktop +++ /dev/null @@ -1,56 +0,0 @@ -[Desktop Entry] -Name=IPFilterPlugin -Name[bg]=Приставка за IP-филтриране -Name[br]=Lugent Sil IP -Name[de]=IP-Filter-Modul -Name[el]=Πρόσθετο φίλτρου IP -Name[es]=Filtro de IP -Name[et]=IP-filtri plugin -Name[it]=Plugin filtro ip -Name[nb]=IP-filtermodul -Name[nds]="IP-Filter"-Moduul -Name[nl]=IPFilter-plugin -Name[pl]=Wtyczka filtru IP -Name[pt]=Filtro de IPs -Name[pt_BR]=Plugin de Filtro de IP -Name[sk]=IPFilter Plugin -Name[sr]=Прикључак IP филтера -Name[sr@Latn]=Priključak IP filtera -Name[sv]=IP-filterinsticksprogram -Name[tr]=IP Filtre Eklentisi -Name[xx]=xxIPFilterPluginxx -Name[zh_CN]=IP 过滤器插件 -Name[zh_TW]=IPFilter外掛程式 -Comment=IP filter plugin for KTorrent -Comment[ar]=قابس مرشح IP لِــ KTorrent -Comment[bg]=Приставка за IP-филтриране (KTorrent) -Comment[br]=Lugent sil IP evit KTorrentt -Comment[ca]=Connector de filtres d'IP per a Ktorrent -Comment[cs]=IP filtr modul pro KTorrent -Comment[de]=IP-Filter-Modul für KTorrent -Comment[el]=Πρόσθετο φίλτρου IP για το KTorrent -Comment[es]=Complemento de filtro de IP de KTorrent -Comment[et]=KTorrenti IP-filtri plugin -Comment[fa]=وصلۀ پالایۀ IP برای KTorrent -Comment[gl]=Plugin de filtrado de IPs para KTorrent -Comment[it]=Plugin filtro ip per KTorrent -Comment[ja]=KTorrent のための IP フィルタプラグイン -Comment[ka]=KTorrent-ის IP ფილტრაციის მოდული -Comment[nb]=IP-filtermodul for KTorrent -Comment[nds]="IP-Filter"-Moduul för KTorrent -Comment[nl]=Plugin om op IP-adressen te filteren in KTorrent -Comment[pl]=Wtyczka filtru IP dla KTorrent -Comment[pt]='Plugin' de filtragem de IPs do KTorrent -Comment[pt_BR]=Plugin de Filtro de IP para o KTorrent -Comment[sk]=IP filter plugin pre KTorrent -Comment[sr]=Прикључак IP филтера за KTorrent -Comment[sr@Latn]=Priključak IP filtera za KTorrent -Comment[sv]=IP-filterinsticksprogram för Ktorrent -Comment[tr]=KTorrent için IP filtre eklentisi -Comment[uk]=Втулок фільтрування IP для KTorrent -Comment[xx]=xxIP filter plugin for KTorrentxx -Comment[zh_CN]=KTorrent 的 IP 过滤器插件 -Comment[zh_TW]=KTorrent IP 過濾器外掛程式 -X-TDE-ServiceTypes=KTorrent/Plugin -Type=Service -X-TDE-Library=ktipfilterplugin diff --git a/plugins/ipfilter/ktipfilterplugin.kcfg b/plugins/ipfilter/ktipfilterplugin.kcfg deleted file mode 100644 index 18ab419..0000000 --- a/plugins/ipfilter/ktipfilterplugin.kcfg +++ /dev/null @@ -1,18 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<kcfg xmlns="http://www.kde.org/standards/kcfg/1.0" - xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://www.kde.org/standards/kcfg/1.0 - http://www.kde.org/standards/kcfg/1.0/kcfg.xsd" > - - <kcfgfile name="ktipfilterpluginrc"/> - <group name="general"> - <entry name="filterURL" type="String"> - <label>Level1 filter url</label> - <default></default> - </entry> - <entry name="useLevel1" type="Bool"> - <label>Use level1 filter?</label> - <default>FALSE</default> - </entry> - </group> -</kcfg> |
