1
mirror of https://github.com/qbittorrent/qBittorrent synced 2025-10-14 11:52:15 +02:00

Compare commits

...

50 Commits

Author SHA1 Message Date
Christophe Dumez
7c79537176 Tagged v2.4.11 release 2010-11-21 17:48:37 +00:00
Christophe Dumez
2b45e1baa3 Fix HTTP redirect issue that would cause the torrent addition to show up for automated RSS downloads (Closes #677565) 2010-11-21 17:38:48 +00:00
Christophe Dumez
476b395166 Fix possible crash when setting RSS proxy (closes #676288) 2010-11-17 17:20:13 +00:00
Christophe Dumez
7157996dc2 Fix RSS refresh interval saving 2010-11-16 20:18:41 +00:00
Christophe Dumez
218f386502 BUGFIX: Fix possible incorrect behavior with queueing 2010-11-15 17:53:25 +00:00
Christophe Dumez
b492051d32 Updated Italian translation 2010-11-14 15:33:07 +00:00
Christophe Dumez
39c7d884c9 Updated italian translation 2010-11-14 15:30:54 +00:00
Christophe Dumez
4d2d0bf08d BUGFIX: Do not report a progress of 100% in the Web UI unless the
torrent is really complete (closes #674349)
2010-11-12 17:15:33 +00:00
Christophe Dumez
34c1fd759b Fix compilation warning 2010-11-11 21:11:33 +00:00
Christophe Dumez
922aebec9a Fix compilation error on Mac 2010-11-11 21:08:41 +00:00
Christophe Dumez
4d39b3accd Fix failure to build on Windows 2010-11-11 17:33:55 +00:00
Christophe Dumez
c713bd56e0 Bump to v2.4.10 2010-11-10 17:45:10 +00:00
Christophe Dumez
efcd652e3d - BUGFIX: Do not create the torrent root folder at final destination if
torrent is in the temp dir (closes #673271)
2010-11-10 17:39:21 +00:00
Christophe Dumez
8d6df1f15f More reliable folder scanning for torrents 2010-11-09 19:17:08 +00:00
Christophe Dumez
ca835a105b BUGFIX: Use a pointing cursor over status bar buttons 2010-11-08 18:25:21 +00:00
Christophe Dumez
2de1a7cc30 Updated Changelog 2010-11-07 11:38:54 +00:00
Christophe Dumez
3de83319a8 Improved IP address parsing 2010-11-07 11:38:02 +00:00
Christophe Dumez
cfc75905a2 Improved IPv6 support (thanks ver) 2010-11-07 10:43:26 +00:00
Christophe Dumez
2c30d5a1ca Fix compilation with libnotify v0.7.0 2010-11-06 09:28:49 +00:00
Christophe Dumez
d162d0c3c6 Draw the qBittorrent version on the splash screen at run time 2010-11-04 19:40:14 +00:00
Christophe Dumez
509eb9bcf0 Added qBittorrent version number to the debug stack trace 2010-11-02 18:16:33 +00:00
Christophe Dumez
1766877605 BUGFIX: Fix possible crash when selecting a RSS item (really closes #575624) 2010-11-02 18:06:20 +00:00
Christophe Dumez
fa78fba559 Updated Italian translation 2010-10-31 20:05:31 +00:00
Christophe Dumez
44ff7161aa BUGFIX: Fix and improve file priorities editing (closes #669084) 2010-10-31 16:14:11 +00:00
Christophe Dumez
96837a3658 Updated Changelog 2010-10-31 14:20:15 +00:00
Christophe Dumez
e4d93a96e7 Updated Changelog 2010-10-31 14:12:12 +00:00
Christophe Dumez
ccb2ed9a69 Fix possible crash on torrent removal 2010-10-31 14:11:11 +00:00
Christophe Dumez
ae5693544d Updated Changelog 2010-10-31 13:57:19 +00:00
Christophe Dumez
3a72c11e39 Fix torrent size update in torrent addition dialog 2010-10-31 13:56:22 +00:00
Christophe Dumez
4176abd18a Fix Arabic translation 2010-10-31 12:26:16 +00:00
Christophe Dumez
cba36fcb14 Added a donate link to the Help menu 2010-10-31 12:13:06 +00:00
Christophe Dumez
9f33656e61 Updated Changelog 2010-10-31 11:19:04 +00:00
Christophe Dumez
a4123a6462 Updated the name of the Italian translator 2010-10-31 11:13:06 +00:00
Christophe Dumez
313b2630bd Updated Croatian translation 2010-10-31 11:11:28 +00:00
Christophe Dumez
87b0ae9a79 Updated Italian translation 2010-10-31 11:09:20 +00:00
Christophe Dumez
81778a0090 Some more issues with virtual 2010-10-31 08:55:15 +00:00
Christophe Dumez
5d0d63d89a Declared function as virtual when it shouldn't 2010-10-31 08:49:36 +00:00
Christophe Dumez
764e8a365b BUGFIX: Make listening on a particular interface more reliable 2010-10-30 21:51:06 +00:00
Christophe Dumez
e302042520 Display the splash screen for 2 seconds instead 2010-10-30 21:18:38 +00:00
Christophe Dumez
e453eb9a91 Updated Italian translation 2010-10-30 20:34:41 +00:00
Christophe Dumez
98fcb91dae Make sure the splash screen is displayed for 3 seconds (Thanks Leigh) 2010-10-30 14:38:41 +00:00
Christophe Dumez
c8a1f625f0 Bump to v2.4.9 (release is planned for Halloween) 2010-10-30 14:04:40 +00:00
Christophe Dumez
b70cf7c049 BUGFIX: Correctly update total number of torrents when a torrent is automatically removed (closes #668726) 2010-10-30 13:59:07 +00:00
Christophe Dumez
ecdfe63d00 Updated language files 2010-10-28 17:11:48 +00:00
Christophe Dumez
7635fe51f7 BUGFIX: Fix possible crash on clicking a RSS article (closes #575624) 2010-10-28 17:09:00 +00:00
Christophe Dumez
8cba38ac62 - BUGFIX: Fix crash when deleting a torrent with no metadata (closes #667528)
- BUGFIX: Correctly display the hash of torrents with no metadata
2010-10-28 16:57:30 +00:00
Christophe Dumez
fab63e6ffc Fix properties display for torrents without metadata 2010-10-28 16:17:59 +00:00
Christophe Dumez
27f257ba03 BUGFIX: Elide status bar text if it is too wide 2010-10-26 17:57:07 +00:00
Christophe Dumez
a2aa462030 BUGFIX: Fix crash when pressing enter in save path field in torrent addition dialog 2010-10-26 16:39:14 +00:00
Christophe Dumez
0f44804225 Updated Arabic translation 2010-10-25 20:25:55 +00:00
96 changed files with 8895 additions and 6407 deletions

View File

@@ -83,7 +83,7 @@ Translations authors:
- German: Niels Hoffmann (zentralmaschine@users.sourceforge.net)
- Greek: Tsvetan Bankov (emerge_life@users.sourceforge.net) and Stephanos Antaris (santaris@csd.auth.gr)
- Hungarian: Majoros Péter (majoros.j.p@t-online.hu)
- Italian: Mirko Ferrari (mirkoferrari@gmail.com) and Ferraro Luciano (luciano.ferraro@gmail.com)
- Italian: Matteo Sechi (bu17714@gmail.com)
- Japanese: Nardog (alphisation@gmail.com)
- Korean: Jin Woo Sin (jin828sin@users.sourceforge.net)
- Norwegian: Lars-Erik Labori (hamil@users.sourceforge.net)

View File

@@ -1,3 +1,36 @@
* Unreleased - Christophe Dumez <chris@qbittorrent.org> - v2.4.11
- BUGFIX: Do not report a progress of 100% in the Web UI unless the
torrent is really complete (closes #674349)
- BUGFIX: Fix possible incorrect behavior with queueing
- BUGFIX: Fix RSS refresh interval saving
- BUGFIX: Fix possible crash when setting RSS proxy (closes #676288)
- BUGFIX: Fix HTTP redirect issue that would cause the torrent addition to
show up for automated RSS downloads (Closes #677565)
* Wed Nov 10 2010 - Christophe Dumez <chris@qbittorrent.org> - v2.4.10
- BUGFIX: Fix possible crash when selecting a RSS item (really closes #575624)
- BUGFIX: Improved IPv6 support (IP filter and Peer list)
- BUGFIX: Make IP filter more tolerant towards strangely formatted IPs
- BUGFIX: More reliable folder scanning
- BUGFIX: Do not create the torrent root folder at final destination if
torrent is in the temp dir (closes #673271)
- BUGFIX: Fix compilation with libnotify v0.7.0 (closes #671769)
- BUGFIX: Use a pointing cursor over status bar buttons
* Sun Oct 31 2010 - Christophe Dumez <chris@qbittorrent.org> - v2.4.9
- BUGFIX: Fix crash when pressing enter in save path field in torrent addition dialog
- BUGFIX: Fix crash when deleting a torrent with no metadata (closes #667528)
- BUGFIX: Fix possible crash on clicking a RSS article (closes #575624)
- BUGFIX: Correctly update total number of torrents when a torrent is automatically removed (closes #668726)
- BUGFIX: Correctly display the hash of torrents with no metadata
- BUGFIX: Elide status bar text if it is too wide
- BUGFIX: Make sure the splash screen is displayed for 2 seconds
- BUGFIX: Make listening on a particular interface more reliable
- BUGFIX: Fix torrent size update in torrent addition dialog
- BUGFIX: Fix possible crash on qBittorrent shutdown
- BUGFIX: Fix and improve file priorities editing (closes #669084)
- I18N: Updated Arabic, Italian and Croatian translations
* Sun Oct 24 2010 - Christophe Dumez <chris@qbittorrent.org> - v2.4.8
- BUGFIX: Fix possible crash on manual peer ban
- BUGFIX: Improved hostname resolution code

View File

@@ -1035,7 +1035,12 @@ void GUI::showNotificationBaloon(QString title, QString msg) const {
#ifdef WITH_LIBNOTIFY
if (notify_init ("summary-body")) {
NotifyNotification* notification;
notification = notify_notification_new (qPrintable(title), qPrintable(msg), "qbittorrent", 0);
notification = notify_notification_new (qPrintable(title), qPrintable(msg), "qbittorrent"
#if !defined(NOTIFY_VERSION_MINOR) || (NOTIFY_VERSION_MAJOR == 0 && NOTIFY_VERSION_MINOR < 7)
, 0
#endif
);
gboolean success = notify_notification_show (notification, NULL);
g_object_unref(G_OBJECT(notification));
notify_uninit ();
@@ -1206,3 +1211,8 @@ void GUI::on_actionDownload_from_URL_triggered() {
}
}
void GUI::on_actionDonate_money_triggered()
{
QDesktopServices::openUrl(QUrl("http://sourceforge.net/donate/index.php?group_id=163414"));
}

View File

@@ -183,6 +183,7 @@ private slots:
void on_actionSpeed_in_title_bar_triggered();
void on_actionTop_tool_bar_triggered();
void on_actionShutdown_when_downloads_complete_triggered();
void on_actionDonate_money_triggered();
};
#endif

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

View File

@@ -1,6 +1,6 @@
[Desktop Entry]
Categories=Qt;Network;P2P;
Comment=V2.4.8
Comment=V2.4.11
Exec=qbittorrent %f
GenericName=Bittorrent client
GenericName[ar]=العميل Bittorrent

Binary file not shown.

Before

Width:  |  Height:  |  Size: 71 KiB

After

Width:  |  Height:  |  Size: 75 KiB

View File

@@ -47,7 +47,7 @@
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleGetInfoString</key>
<string>2.4.8</string>
<string>2.4.11</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleExecutable</key>

View File

@@ -73,7 +73,7 @@ class about : public QDialog, private Ui::AboutDlg{
<li><u>German:</u> Niels Hoffmann (zentralmaschine@users.sourceforge.net)</li>\
<li><u>Greek:</u> Tsvetan Bankov (emerge_life@users.sourceforge.net)</li>\
<li><u>Hungarian:</u> Majoros Péter (majoros.peterj@gmail.com)</li>\
<li><u>Italian:</u> Mirko Ferrari (mirkoferrari@gmail.com) and Ferraro Luciano (luciano.ferraro@gmail.com)</li>\
<li><u>Italian:</u> Matteo Sechi (bu17714@gmail.com)</li>\
<li><u>Japanese:</u> Nardog (alphisation@gmail.com)</li>\
<li><u>Korean:</u> Jin Woo Sin (jin828sin@users.sourceforge.net)</li>\
<li><u>Norwegian:</u> Lars-Erik Labori (hamil@users.sourceforge.net)</li>\

View File

@@ -748,15 +748,23 @@ void Bittorrent::deleteTorrent(QString hash, bool delete_local_files) {
qDebug("/!\\ Error: Invalid handle");
return;
}
const QString fileName(h.name());
QString fileName;
if(h.has_metadata())
fileName = h.name();
else
fileName = h.hash();
// Remove it from session
if(delete_local_files) {
if(h.has_metadata()) {
QDir save_dir(h.save_path());
if(save_dir != QDir(defaultSavePath) && (defaultTempPath.isEmpty() || save_dir != QDir(defaultTempPath)))
savePathsToRemove[hash] = save_dir.absolutePath();
}
s->remove_torrent(h.get_torrent_handle(), session::delete_files);
} else {
QStringList uneeded_files = h.uneeded_files_path();
QStringList uneeded_files;
if(h.has_metadata())
uneeded_files = h.uneeded_files_path();
s->remove_torrent(h.get_torrent_handle());
// Remove unneeded files
foreach(const QString &uneeded_file, uneeded_files) {
@@ -779,7 +787,9 @@ void Bittorrent::deleteTorrent(QString hash, bool delete_local_files) {
addConsoleMessage(tr("'%1' was removed from transfer list and hard disk.", "'xxx.avi' was removed...").arg(fileName));
else
addConsoleMessage(tr("'%1' was removed from transfer list.", "'xxx.avi' was removed...").arg(fileName));
qDebug("Torrent deleted.");
emit deletedTorrent(hash);
qDebug("Deleted signal emitted.");
}
void Bittorrent::pauseAllTorrents() {
@@ -1561,6 +1571,7 @@ void Bittorrent::saveFastResumeData() {
for(torrentIT = torrents.begin(); torrentIT != torrents.end(); torrentIT++) {
QTorrentHandle h = QTorrentHandle(*torrentIT);
if(!h.is_valid() || !h.has_metadata()) continue;
try {
if(isQueueingEnabled())
TorrentPersistentData::savePriority(h);
// Actually with should save fast resume data for paused files too
@@ -1568,6 +1579,7 @@ void Bittorrent::saveFastResumeData() {
if(h.state() == torrent_status::checking_files || h.state() == torrent_status::queued_for_checking) continue;
h.save_resume_data();
++num_resume_data;
} catch(invalid_handle&) {}
}
while (num_resume_data > 0) {
alert const* a = s->wait_for_alert(seconds(30));
@@ -1583,8 +1595,9 @@ void Bittorrent::saveFastResumeData() {
s->pop_alert();
try {
// Remove torrent from session
if(rda->handle.is_valid())
s->remove_torrent(rda->handle);
}catch(libtorrent::libtorrent_exception){}
}catch(libtorrent::libtorrent_exception&){}
continue;
}
save_resume_data_alert const* rd = dynamic_cast<save_resume_data_alert const*>(a);
@@ -1598,6 +1611,7 @@ void Bittorrent::saveFastResumeData() {
QDir torrentBackup(misc::BTBackupLocation());
const QTorrentHandle h(rd->handle);
if(!h.is_valid()) continue;
try {
// Remove old fastresume file if it exists
const QString file = torrentBackup.absoluteFilePath(h.hash()+".fastresume");
if(QFile::exists(file))
@@ -1608,6 +1622,7 @@ void Bittorrent::saveFastResumeData() {
// Remove torrent from session
s->remove_torrent(rd->handle);
s->pop_alert();
}catch(libtorrent::libtorrent_exception&){}
}
}
@@ -1814,15 +1829,27 @@ void Bittorrent::addConsoleMessage(QString msg, QString) {
}
QNetworkInterface network_iface = QNetworkInterface::interfaceFromName(iface_name);
if(!network_iface.isValid()) {
qDebug("Invalid network interface: %s", qPrintable(iface_name));
addConsoleMessage(tr("The network interface defined is invalid: %1").arg(iface_name), "red");
addConsoleMessage(tr("Trying any other network interface available instead."));
s->listen_on(ports);
return;
}
QString ip = "127.0.0.1";
if(!network_iface.addressEntries().isEmpty()) {
ip = network_iface.addressEntries().first().ip().toString();
QString ip;
qDebug("This network interface has %d IP addresses", network_iface.addressEntries().size());
foreach(const QNetworkAddressEntry &entry, network_iface.addressEntries()) {
qDebug("Trying to listen on IP %s (%s)", qPrintable(entry.ip().toString()), qPrintable(iface_name));
if(s->listen_on(ports, qPrintable(entry.ip().toString()))) {
ip = entry.ip().toString();
break;
}
}
if(s->is_listening()) {
addConsoleMessage(tr("Listening on IP address %1 on network interface %2...").arg(ip).arg(iface_name));
} else {
qDebug("Failed to listen on any of the IP addresses");
addConsoleMessage(tr("Failed to listen on network interface %1").arg(iface_name), "red");
}
qDebug("Listening on interface %s with ip %s", qPrintable(iface_name), qPrintable(ip));
s->listen_on(ports, ip.toLocal8Bit().constData());
}
// Set download rate limit
@@ -2176,7 +2203,7 @@ void Bittorrent::addConsoleMessage(QString msg, QString) {
QTorrentHandle h(p->handle);
if(h.is_valid()) {
// Attempt to remove old folder if empty
const QString& old_save_path = TorrentPersistentData::getPreviousPath(h.hash());
const QString old_save_path = TorrentPersistentData::getPreviousPath(h.hash());
const QString new_save_path = misc::toQStringU(p->path);
qDebug("Torrent moved from %s to %s", qPrintable(old_save_path), qPrintable(new_save_path));
QDir old_save_dir(old_save_path);
@@ -2254,7 +2281,7 @@ void Bittorrent::addConsoleMessage(QString msg, QString) {
else if (file_error_alert* p = dynamic_cast<file_error_alert*>(a.get())) {
QTorrentHandle h(p->handle);
if(h.is_valid()) {
h.auto_managed(false);
h.pause();
std::cerr << "File Error: " << p->message().c_str() << std::endl;
addConsoleMessage(tr("An I/O error occured, '%1' paused.").arg(h.name()));
addConsoleMessage(tr("Reason: %1").arg(misc::toQString(p->message())));

View File

@@ -73,8 +73,12 @@ void CookiesDlg::on_del_btn_clicked() {
QList<QByteArray> CookiesDlg::getCookies() const {
QList<QByteArray> ret;
for(int i=0; i<ui->cookiesTable->rowCount(); ++i) {
QString key = ui->cookiesTable->item(i, COOKIE_KEY)->text().trimmed();
QString value = ui->cookiesTable->item(i, COOKIE_VALUE)->text().trimmed();
QString key;
if(ui->cookiesTable->item(i, COOKIE_KEY))
key = ui->cookiesTable->item(i, COOKIE_KEY)->text().trimmed();
QString value;
if(ui->cookiesTable->item(i, COOKIE_VALUE))
value = ui->cookiesTable->item(i, COOKIE_VALUE)->text().trimmed();
if(!key.isEmpty() && !value.isEmpty()) {
const QString raw_cookie = key+"="+value;
qDebug("Cookie: %s", qPrintable(raw_cookie));

View File

@@ -51,7 +51,7 @@ downloadThread::downloadThread(QObject* parent) : QObject(parent) {
}
void downloadThread::processDlFinished(QNetworkReply* reply) {
QString url = reply->url().toEncoded().data();
QString url = reply->url().toString();
qDebug("Download finished: %s", qPrintable(url));
if(reply->error() != QNetworkReply::NoError) {
// Failure

View File

@@ -3,11 +3,12 @@
#include <QFileSystemWatcher>
#include <QDir>
#ifndef Q_WS_WIN
#include <QTimer>
#include <QPointer>
#include <QStringList>
#include <QTimer>
#include <QHash>
#ifndef Q_WS_WIN
#include <QSet>
#include <iostream>
#include <errno.h>
@@ -19,6 +20,8 @@
#endif
#endif
#include "misc.h"
#ifndef CIFS_MAGIC_NUMBER
#define CIFS_MAGIC_NUMBER 0xFF534D42
#endif
@@ -27,6 +30,9 @@
#define NFS_SUPER_MAGIC 0x6969
#endif
const int WATCH_INTERVAL = 10000; // 10 sec
const int MAX_PARTIAL_RETRIES = 5;
/*
* Subclassing QFileSystemWatcher in order to support Network File
* System watching (NFS, CIFS) on Linux and Mac OS.
@@ -39,11 +45,14 @@ private:
QList<QDir> watched_folders;
QPointer<QTimer> watch_timer;
#endif
QStringList filters;
QStringList m_filters;
// Partial torrents
QHash<QString, int> m_partialTorrents;
QPointer<QTimer> m_partialTorrentTimer;
#ifndef Q_WS_WIN
protected:
bool isNetworkFileSystem(QString path) {
private:
static bool isNetworkFileSystem(QString path) {
QString file = path;
if(!file.endsWith(QDir::separator()))
file += QDir::separator();
@@ -99,7 +108,7 @@ protected:
public:
FileSystemWatcher(QObject *parent): QFileSystemWatcher(parent) {
filters << "*.torrent";
m_filters << "*.torrent";
connect(this, SIGNAL(directoryChanged(QString)), this, SLOT(scanLocalFolder(QString)));
}
@@ -108,6 +117,8 @@ public:
if(watch_timer)
delete watch_timer;
#endif
if(m_partialTorrentTimer)
delete m_partialTorrentTimer;
}
QStringList directories() const {
@@ -137,7 +148,7 @@ public:
if (!watch_timer) {
watch_timer = new QTimer(this);
connect(watch_timer, SIGNAL(timeout()), this, SLOT(scanNetworkFolders()));
watch_timer->start(5000); // 5 sec
watch_timer->start(WATCH_INTERVAL); // 5 sec
}
} else {
#endif
@@ -196,21 +207,74 @@ protected slots:
#endif
}
void processPartialTorrents() {
QStringList no_longer_partial;
// Check which torrents are still partial
foreach(const QString& torrent_path, m_partialTorrents.keys()) {
if(!QFile::exists(torrent_path)) {
m_partialTorrents.remove(torrent_path);
continue;
}
if(misc::isValidTorrentFile(torrent_path)) {
no_longer_partial << torrent_path;
m_partialTorrents.remove(torrent_path);
} else {
if(m_partialTorrents[torrent_path] >= MAX_PARTIAL_RETRIES) {
m_partialTorrents.remove(torrent_path);
QFile::rename(torrent_path, torrent_path+".invalid");
} else {
m_partialTorrents[torrent_path]++;
}
}
}
// Stop the partial timer if necessary
if(m_partialTorrents.empty()) {
m_partialTorrentTimer->stop();
m_partialTorrentTimer->deleteLater();
qDebug("No longer any partial torrent.");
} else {
qDebug("Still %d partial torrents after delayed processing.", m_partialTorrents.count());
m_partialTorrentTimer->start(WATCH_INTERVAL);
}
// Notify of new torrents
if(!no_longer_partial.isEmpty())
emit torrentsAdded(no_longer_partial);
}
signals:
void torrentsAdded(QStringList &pathList);
private:
void addTorrentsFromDir(const QDir &dir, QStringList &torrents) {
const QStringList files = dir.entryList(filters, QDir::Files, QDir::Unsorted);
foreach(const QString &file, files) {
#if defined(Q_WS_WIN) || defined(Q_OS_OS2)
torrents << dir.absoluteFilePath(file).replace("/", "\\");
#else
torrents << dir.absoluteFilePath(file);
#endif
void startPartialTorrentTimer() {
Q_ASSERT(!m_partialTorrents.isEmpty());
if(!m_partialTorrentTimer) {
m_partialTorrentTimer = new QTimer();
connect(m_partialTorrentTimer, SIGNAL(timeout()), SLOT(processPartialTorrents()));
m_partialTorrentTimer->setSingleShot(true);
m_partialTorrentTimer->start(WATCH_INTERVAL);
}
}
void addTorrentsFromDir(const QDir &dir, QStringList &torrents) {
const QStringList files = dir.entryList(m_filters, QDir::Files, QDir::Unsorted);
foreach(const QString &file, files) {
const QString file_abspath = dir.absoluteFilePath(file);
if(misc::isValidTorrentFile(file_abspath)) {
torrents << file_abspath;
} else {
if(!m_partialTorrents.contains(file_abspath)) {
qDebug("Partial torrent detected at: %s", qPrintable(file_abspath));
qDebug("Delay the file's processing...");
m_partialTorrents.insert(file_abspath, 0);
}
}
}
if(!m_partialTorrents.empty())
startPartialTorrentTimer();
}
};
#endif // FILESYSTEMWATCHER_H

View File

@@ -34,8 +34,8 @@
#include <QThread>
#include <QFile>
#include <QDataStream>
#include <QRegExp>
#include <QStringList>
#include <QHostAddress>
#include <libtorrent/session.hpp>
#include <libtorrent/ip_filter.hpp>
@@ -62,6 +62,14 @@ class FilterParserThread : public QThread {
QString filePath;
protected:
QString cleanupIPAddress(QString _ip) {
QHostAddress ip(_ip.trimmed());
if(ip.isNull()) {
return QString();
}
return ip.toString();
}
void run(){
qDebug("Processing filter file");
if(filePath.endsWith(".dat", Qt::CaseInsensitive)) {
@@ -97,10 +105,6 @@ class FilterParserThread : public QThread {
// Parser for eMule ip filter in DAT format
void parseDATFilterFile(QString filePath) {
const QRegExp is_ipv6(QString::fromUtf8("^[0-9a-f]{4}(:[0-9a-f]{4}){7}$"), Qt::CaseInsensitive, QRegExp::RegExp);
const QRegExp is_ipv4(QString::fromUtf8("^(([0-1]?[0-9]?[0-9])|(2[0-4][0-9])|(25[0-5]))(\\.(([0-1]?[0-9]?[0-9])|(2[0-4][0-9])|(25[0-5]))){3}$"), Qt::CaseInsensitive, QRegExp::RegExp);
QString strStartIP, strEndIP;
bool IPv4 = true;
QFile file(filePath);
if (file.exists()){
if(!file.open(QIODevice::ReadOnly | QIODevice::Text)){
@@ -116,100 +120,64 @@ class FilterParserThread : public QThread {
if(line.isEmpty()) continue;
// Ignoring commented lines
if(line.startsWith('#') || line.startsWith("//")) continue;
// Line is not commented
// Line should be splitted by commas
QList<QByteArray> partsList = line.split(',');
unsigned int nbElem = partsList.size();
// IP Range can be splitted by a dash or a comma...
// Check if there is a dash in first part
QByteArray firstPart = partsList.at(0);
int nbAccess = 0;
if(firstPart.contains('-')) {
// Range is splitted by a dash
QList<QByteArray> IPs = firstPart.split('-');
const uint nbElem = partsList.size();
// IP Range should be splitted by a dash
QList<QByteArray> IPs = partsList.first().split('-');
if(IPs.size() != 2) {
qDebug("Ipfilter.dat: line %d is malformed.", nbLine);
qDebug("Line was %s", line.constData());
continue;
}
strStartIP = IPs.at(0).trimmed();
strEndIP = IPs.at(1).trimmed();
// Check if IPs are correct
if(strStartIP.contains(is_ipv4) && strEndIP.contains(is_ipv4)) {
IPv4 = true;
} else {
if(strStartIP.contains(is_ipv6) && strEndIP.contains(is_ipv6)) {
IPv4 = false;
} else {
// Could not determine IP format
boost::system::error_code ec;
const QString strStartIP = cleanupIPAddress(IPs.at(0));
if(strStartIP.isEmpty()) {
qDebug("Ipfilter.dat: line %d is malformed.", nbLine);
qDebug("Start IP of the range is malformated: %s", qPrintable(strStartIP));
continue;
}
libtorrent::address startAddr = libtorrent::address::from_string(qPrintable(strStartIP), ec);
if(ec) {
qDebug("Ipfilter.dat: line %d is malformed.", nbLine);
qDebug("Start IP of the range is malformated: %s", qPrintable(strStartIP));
continue;
}
const QString strEndIP = cleanupIPAddress(IPs.at(1));
if(strEndIP.isEmpty()) {
qDebug("Ipfilter.dat: line %d is malformed.", nbLine);
qDebug("End IP of the range is malformated: %s", qPrintable(strEndIP));
continue;
}
libtorrent::address endAddr = libtorrent::address::from_string(qPrintable(strEndIP), ec);
if(ec) {
qDebug("Ipfilter.dat: line %d is malformed.", nbLine);
qDebug("End IP of the range is malformated: %s", qPrintable(strEndIP));
continue;
}
if(startAddr.is_v4() != endAddr.is_v4()) {
qDebug("Ipfilter.dat: line %d is malformed.", nbLine);
qDebug("One IP is IPv4 and the other is IPv6!");
continue;
}
// Check if there is an access value (apparently not mandatory)
int nbAccess = 0;
if(nbElem > 1) {
// There is possibly one
bool ok;
nbAccess = partsList.at(1).trimmed().toInt(&ok);
if(!ok){
nbAccess = 0;
}
}
} else {
// Range is probably splitted by a comma
unsigned int nbElem = partsList.size();
if(nbElem > 1) {
strStartIP = firstPart.trimmed();
strEndIP = partsList.at(1).trimmed();
// Check if IPs are correct
if(strStartIP.contains(is_ipv4) && strEndIP.contains(is_ipv4)) {
IPv4 = true;
} else {
if(strStartIP.contains(is_ipv6) && strEndIP.contains(is_ipv6)) {
IPv4 = false;
} else {
// Could not determine IP format
qDebug("Ipfilter.dat: line %d is malformed.", nbLine);
continue;
}
}
// Check if there is an access value (apparently not mandatory)
if(nbElem > 2) {
// There is possibly one
bool ok;
nbAccess = partsList.at(2).trimmed().toInt(&ok);
if(!ok){
nbAccess = 0;
}
}
}
nbAccess = partsList.at(1).trimmed().toInt();
}
if(nbAccess > 127) {
// Ignoring this rule because access value is too high
continue;
}
// Now Add to the filter
QStringList IP;
try {
if(IPv4) {
//IPv4 addresses
IP = strStartIP.split('.');
if(IP.size() != 4)
throw exception();
address_v4 start((IP.at(0).toUInt() << 24) + (IP.at(1).toUInt() << 16) + (IP.at(2).toUInt() << 8) + IP.at(3).toUInt());
IP = strEndIP.split('.');
if(IP.size() != 4)
throw exception();
address_v4 last((IP.at(0).toUInt() << 24) + (IP.at(1).toUInt() << 16) + (IP.at(2).toUInt() << 8) + IP.at(3).toUInt());
// Apply to bittorrent session
filter.add_rule(start, last, ip_filter::blocked);
} else {
// IPv6, ex : 1fff:0000:0a88:85a3:0000:0000:ac1f:8001
IP = strStartIP.split(':');
address_v6 start = address_v6::from_string(strStartIP.remove(':', 0).toLocal8Bit().data());
IP = strEndIP.split(':');
address_v6 last = address_v6::from_string(strEndIP.remove(':', 0).toLocal8Bit().data());
// Apply to bittorrent session
filter.add_rule(start, last, ip_filter::blocked);
}
filter.add_rule(startAddr, endAddr, ip_filter::blocked);
}catch(exception){
qDebug("Bad line in filter file, avoided crash...");
}
@@ -220,7 +188,6 @@ class FilterParserThread : public QThread {
// Parser for PeerGuardian ip filter in p2p format
void parseP2PFilterFile(QString filePath) {
const QRegExp is_ipv4(QString::fromUtf8("^(([0-1]?[0-9]?[0-9])|(2[0-4][0-9])|(25[0-5]))(\\.(([0-1]?[0-9]?[0-9])|(2[0-4][0-9])|(25[0-5]))){3}$"), Qt::CaseInsensitive, QRegExp::RegExp);
QFile file(filePath);
QStringList IP;
if (file.exists()){
@@ -231,13 +198,11 @@ class FilterParserThread : public QThread {
unsigned int nbLine = 0;
while (!file.atEnd() && !abort) {
++nbLine;
QByteArray line = file.readLine();
// Ignoring empty lines
line = line.trimmed();
QByteArray line = file.readLine().trimmed();
if(line.isEmpty()) continue;
// Ignoring commented lines
if(line.startsWith('#') || line.startsWith("//")) continue;
// Line is not commented
// Line is splitted by :
QList<QByteArray> partsList = line.split(':');
if(partsList.size() < 2){
qDebug("p2p file: line %d is malformed.", nbLine);
@@ -247,21 +212,44 @@ class FilterParserThread : public QThread {
QList<QByteArray> IPs = partsList.last().split('-');
if(IPs.size() != 2) {
qDebug("p2p file: line %d is malformed.", nbLine);
qDebug("line was: %s", line.constData());
continue;
}
QString strStartIP = IPs.at(0).trimmed();
QString strEndIP = IPs.at(1).trimmed();
// Check IPs format (IPv4 only)
if(strStartIP.contains(is_ipv4) && strEndIP.contains(is_ipv4)) {
// IPv4
IP = strStartIP.split('.');
address_v4 start((IP.at(0).toUInt() << 24) + (IP.at(1).toUInt() << 16) + (IP.at(2).toUInt() << 8) + IP.at(3).toUInt());
IP = strEndIP.split('.');
address_v4 last((IP.at(0).toUInt() << 24) + (IP.at(1).toUInt() << 16) + (IP.at(2).toUInt() << 8) + IP.at(3).toUInt());
// Apply to bittorrent session
filter.add_rule(start, last, ip_filter::blocked);
} else {
boost::system::error_code ec;
QString strStartIP = cleanupIPAddress(IPs.at(0));
if(strStartIP.isEmpty()) {
qDebug("p2p file: line %d is malformed.", nbLine);
qDebug("Start IP is invalid: %s", qPrintable(strStartIP));
continue;
}
libtorrent::address startAddr = libtorrent::address::from_string(qPrintable(strStartIP), ec);
if(ec) {
qDebug("p2p file: line %d is malformed.", nbLine);
qDebug("Start IP is invalid: %s", qPrintable(strStartIP));
continue;
}
QString strEndIP = cleanupIPAddress(IPs.at(1));
if(strEndIP.isEmpty()) {
qDebug("p2p file: line %d is malformed.", nbLine);
qDebug("End IP is invalid: %s", qPrintable(strStartIP));
continue;
}
libtorrent::address endAddr = libtorrent::address::from_string(qPrintable(strEndIP), ec);
if(ec) {
qDebug("p2p file: line %d is malformed.", nbLine);
qDebug("End IP is invalid: %s", qPrintable(strStartIP));
continue;
}
if(startAddr.is_v4() != endAddr.is_v4()) {
qDebug("p2p file: line %d is malformed.", nbLine);
qDebug("Line was: %s", line.constData());
continue;
}
try {
filter.add_rule(startAddr, endAddr, ip_filter::blocked);
} catch(std::exception&) {
qDebug("p2p file: line %d is malformed.", nbLine);
qDebug("Line was: %s", line.constData());
continue;
}
}

View File

@@ -54,7 +54,7 @@ class HttpConnection : public QObject
protected slots:
void write();
virtual void respond();
void respond();
void respondJson();
void respondGenPropertiesJson(QString hash);
void respondTrackersPropertiesJson(QString hash);

View File

@@ -44,7 +44,7 @@ class HttpResponseGenerator : public QHttpResponseHeader
void setMessage(const QString message);
void stripMessage();
void setContentTypeByExt(const QString ext);
virtual QByteArray toByteArray() const;
QByteArray toByteArray() const;
};
#endif

View File

@@ -161,6 +161,7 @@
<file>Icons/oxygen/encrypted.png</file>
<file>Icons/oxygen/folder-remote16.png</file>
<file>Icons/oxygen/go-top.png</file>
<file>Icons/oxygen/emblem-favorite.png</file>
<file>Icons/oxygen/edit_clear.png</file>
<file>Icons/oxygen/bug.png</file>
<file>Icons/oxygen/gear.png</file>

Binary file not shown.

File diff suppressed because it is too large Load Diff

Binary file not shown.

File diff suppressed because it is too large Load Diff

Binary file not shown.

File diff suppressed because it is too large Load Diff

Binary file not shown.

File diff suppressed because it is too large Load Diff

Binary file not shown.

File diff suppressed because it is too large Load Diff

Binary file not shown.

File diff suppressed because it is too large Load Diff

Binary file not shown.

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

Some files were not shown because too many files have changed in this diff Show More