Code clean up

This commit is contained in:
Christophe Dumez
2010-11-13 21:15:52 +00:00
parent 9c13ed2635
commit 126e2e7c75
31 changed files with 279 additions and 309 deletions

View File

@@ -40,8 +40,8 @@
#include <QDebug>
#include <QTranslator>
EventManager::EventManager(QObject *parent, QBtSession *BTSession)
: QObject(parent), BTSession(BTSession)
EventManager::EventManager(QObject *parent)
: QObject(parent)
{
}
@@ -51,9 +51,9 @@ QList<QVariantMap> EventManager::getEventList() const {
QList<QVariantMap> EventManager::getPropTrackersInfo(QString hash) const {
QList<QVariantMap> trackersInfo;
QTorrentHandle h = BTSession->getTorrentHandle(hash);
QTorrentHandle h = QBtSession::instance()->getTorrentHandle(hash);
if(h.is_valid()) {
QHash<QString, TrackerInfos> trackers_data = BTSession->getTrackersInfo(hash);
QHash<QString, TrackerInfos> trackers_data = QBtSession::instance()->getTrackersInfo(hash);
std::vector<announce_entry> vect_trackers = h.trackers();
std::vector<announce_entry>::iterator it;
for(it = vect_trackers.begin(); it != vect_trackers.end(); it++) {
@@ -96,7 +96,7 @@ QList<QVariantMap> EventManager::getPropTrackersInfo(QString hash) const {
QList<QVariantMap> EventManager::getPropFilesInfo(QString hash) const {
QList<QVariantMap> files;
QTorrentHandle h = BTSession->getTorrentHandle(hash);
QTorrentHandle h = QBtSession::instance()->getTorrentHandle(hash);
if(!h.is_valid() || !h.has_metadata()) return files;
std::vector<int> priorities = h.file_priorities();
std::vector<size_type> fp;
@@ -160,7 +160,7 @@ void EventManager::setGlobalPreferences(QVariantMap m) const {
foreach(const QString &old_folder, old_folders) {
// Update deleted folders
if(!new_folders.contains(old_folder)) {
BTSession->getScanFoldersModel()->removePath(old_folder);
QBtSession::instance()->getScanFoldersModel()->removePath(old_folder);
}
}
int i = 0;
@@ -168,7 +168,7 @@ void EventManager::setGlobalPreferences(QVariantMap m) const {
qDebug("New watched folder: %s", qPrintable(new_folder));
// Update new folders
if(!old_folders.contains(new_folder)) {
BTSession->getScanFoldersModel()->addPath(new_folder, download_at_path.at(i));
QBtSession::instance()->getScanFoldersModel()->addPath(new_folder, download_at_path.at(i));
}
++i;
}
@@ -269,7 +269,7 @@ void EventManager::setGlobalPreferences(QVariantMap m) const {
if(m.contains("web_ui_password"))
Preferences::setWebUiPassword(m["web_ui_password"].toString());
// Reload preferences
BTSession->configureSession();
QBtSession::instance()->configureSession();
}
QVariantMap EventManager::getGlobalPreferences() const {
@@ -342,7 +342,7 @@ QVariantMap EventManager::getGlobalPreferences() const {
QVariantMap EventManager::getPropGeneralInfo(QString hash) const {
QVariantMap data;
QTorrentHandle h = BTSession->getTorrentHandle(hash);
QTorrentHandle h = QBtSession::instance()->getTorrentHandle(hash);
if(h.is_valid() && h.has_metadata()) {
// Save path
QString p = TorrentPersistentData::getSavePath(hash);
@@ -370,7 +370,7 @@ QVariantMap EventManager::getPropGeneralInfo(QString hash) const {
data["time_elapsed"] = elapsed_txt;
data["nb_connections"] = QVariant(QString::number(h.num_connections())+" ("+tr("%1 max", "e.g. 10 max").arg(QString::number(h.connections_limit()))+")");
// Update ratio info
double ratio = BTSession->getRealRatio(h.hash());
double ratio = QBtSession::instance()->getRealRatio(h.hash());
if(ratio > 100.)
data["share_ratio"] = QString::fromUtf8("");
else
@@ -404,7 +404,7 @@ void EventManager::modifiedTorrent(QTorrentHandle h)
event["state"] = QVariant("pausedDL");
}
} else {
if(BTSession->isQueueingEnabled() && h.is_queued()) {
if(QBtSession::instance()->isQueueingEnabled() && h.is_queued()) {
if(h.is_seed())
event["state"] = QVariant("queuedUP");
else
@@ -436,7 +436,7 @@ void EventManager::modifiedTorrent(QTorrentHandle h)
event["state"] = QVariant("downloading");
else
event["state"] = QVariant("stalledDL");
event["eta"] = misc::userFriendlyDuration(BTSession->getETA(hash));
event["eta"] = misc::userFriendlyDuration(QBtSession::instance()->getETA(hash));
break;
default:
qDebug("No status, should not happen!!! status is %d", h.state());
@@ -448,7 +448,7 @@ void EventManager::modifiedTorrent(QTorrentHandle h)
event["size"] = QVariant(misc::friendlyUnit(h.actual_size()));
event["progress"] = QVariant((double)h.progress());
event["dlspeed"] = QVariant(tr("%1/s", "e.g. 120 KiB/s").arg(misc::friendlyUnit(h.download_payload_rate())));
if(BTSession->isQueueingEnabled()) {
if(QBtSession::instance()->isQueueingEnabled()) {
if(h.queue_position() >= 0)
event["priority"] = QVariant(QString::number(h.queue_position()));
else
@@ -466,7 +466,7 @@ void EventManager::modifiedTorrent(QTorrentHandle h)
leechs += " ("+QString::number(h.num_incomplete())+")";
event["num_leechs"] = QVariant(leechs);
event["seed"] = QVariant(h.is_seed());
double ratio = BTSession->getRealRatio(hash);
double ratio = QBtSession::instance()->getRealRatio(hash);
if(ratio > 100.)
event["ratio"] = QString::fromUtf8("");
else

View File

@@ -36,8 +36,6 @@
#include <QHash>
#include <QVariant>
class QBtSession;
class EventManager : public QObject
{
Q_OBJECT
@@ -45,13 +43,12 @@ class EventManager : public QObject
private:
QHash<QString, QVariantMap> event_list;
QBtSession* BTSession;
protected:
void update(QVariantMap event);
public:
EventManager(QObject *parent, QBtSession* BTSession);
EventManager(QObject *parent);
QList<QVariantMap> getEventList() const;
QVariantMap getPropGeneralInfo(QString hash) const;
QList<QVariantMap> getPropTrackersInfo(QString hash) const;

View File

@@ -46,8 +46,8 @@
#include <QRegExp>
#include <QTemporaryFile>
HttpConnection::HttpConnection(QTcpSocket *socket, QBtSession *BTSession, HttpServer *parent)
: QObject(parent), socket(socket), parent(parent), BTSession(BTSession)
HttpConnection::HttpConnection(QTcpSocket *socket, HttpServer *parent)
: QObject(parent), socket(socket), httpserver(parent)
{
socket->setParent(this);
connect(socket, SIGNAL(readyRead()), this, SLOT(read()));
@@ -134,7 +134,7 @@ QString HttpConnection::translateDocument(QString data) {
void HttpConnection::respond() {
//qDebug("Respond called");
const QString peer_ip = socket->peerAddress().toString();
const int nb_fail = parent->NbFailedAttemptsForIp(peer_ip);
const int nb_fail = httpserver->NbFailedAttemptsForIp(peer_ip);
if(nb_fail >= MAX_AUTH_FAILED_ATTEMPTS) {
generator.setStatusLine(403, "Forbidden");
generator.setMessage(tr("Your IP address has been banned after too many failed authentication attempts."));
@@ -146,23 +146,23 @@ void HttpConnection::respond() {
// Return unauthorized header
qDebug("Auth is Empty...");
generator.setStatusLine(401, "Unauthorized");
generator.setValue("WWW-Authenticate", "Digest realm=\""+QString(QBT_REALM)+"\", nonce=\""+parent->generateNonce()+"\", opaque=\""+parent->generateNonce()+"\", stale=\"false\", algorithm=\"MD5\", qop=\"auth\"");
generator.setValue("WWW-Authenticate", "Digest realm=\""+QString(QBT_REALM)+"\", nonce=\""+httpserver->generateNonce()+"\", opaque=\""+httpserver->generateNonce()+"\", stale=\"false\", algorithm=\"MD5\", qop=\"auth\"");
write();
return;
}
//qDebug("Auth: %s", qPrintable(auth.split(" ").first()));
if (QString::compare(auth.split(" ").first(), "Digest", Qt::CaseInsensitive) != 0 || !parent->isAuthorized(auth.toLocal8Bit(), parser.method())) {
if (QString::compare(auth.split(" ").first(), "Digest", Qt::CaseInsensitive) != 0 || !httpserver->isAuthorized(auth.toLocal8Bit(), parser.method())) {
// Update failed attempt counter
parent->increaseNbFailedAttemptsForIp(peer_ip);
httpserver->increaseNbFailedAttemptsForIp(peer_ip);
qDebug("client IP: %s (%d failed attempts)", qPrintable(peer_ip), nb_fail+1);
// Return unauthorized header
generator.setStatusLine(401, "Unauthorized");
generator.setValue("WWW-Authenticate", "Digest realm=\""+QString(QBT_REALM)+"\", nonce=\""+parent->generateNonce()+"\", opaque=\""+parent->generateNonce()+"\", stale=\"false\", algorithm=\"MD5\", qop=\"auth\"");
generator.setValue("WWW-Authenticate", "Digest realm=\""+QString(QBT_REALM)+"\", nonce=\""+httpserver->generateNonce()+"\", opaque=\""+httpserver->generateNonce()+"\", stale=\"false\", algorithm=\"MD5\", qop=\"auth\"");
write();
return;
}
// Client successfully authenticated, reset number of failed attempts
parent->resetNbFailedAttemptsForIp(peer_ip);
httpserver->resetNbFailedAttemptsForIp(peer_ip);
QString url = parser.url();
// Favicon
if(url.endsWith("favicon.ico")) {
@@ -271,7 +271,7 @@ void HttpConnection::respondNotFound()
void HttpConnection::respondJson()
{
EventManager* manager = parent->eventManager();
EventManager* manager = httpserver->eventManager();
QString string = json::toJson(manager->getEventList());
generator.setStatusLine(200, "OK");
generator.setContentTypeByExt("js");
@@ -280,7 +280,7 @@ void HttpConnection::respondJson()
}
void HttpConnection::respondGenPropertiesJson(QString hash) {
EventManager* manager = parent->eventManager();
EventManager* manager = httpserver->eventManager();
QString string = json::toJson(manager->getPropGeneralInfo(hash));
generator.setStatusLine(200, "OK");
generator.setContentTypeByExt("js");
@@ -289,7 +289,7 @@ void HttpConnection::respondGenPropertiesJson(QString hash) {
}
void HttpConnection::respondTrackersPropertiesJson(QString hash) {
EventManager* manager = parent->eventManager();
EventManager* manager = httpserver->eventManager();
QString string = json::toJson(manager->getPropTrackersInfo(hash));
generator.setStatusLine(200, "OK");
generator.setContentTypeByExt("js");
@@ -298,7 +298,7 @@ void HttpConnection::respondTrackersPropertiesJson(QString hash) {
}
void HttpConnection::respondFilesPropertiesJson(QString hash) {
EventManager* manager = parent->eventManager();
EventManager* manager = httpserver->eventManager();
QString string = json::toJson(manager->getPropFilesInfo(hash));
generator.setStatusLine(200, "OK");
generator.setContentTypeByExt("js");
@@ -307,7 +307,7 @@ void HttpConnection::respondFilesPropertiesJson(QString hash) {
}
void HttpConnection::respondPreferencesJson() {
EventManager* manager = parent->eventManager();
EventManager* manager = httpserver->eventManager();
QString string = json::toJson(manager->getGlobalPreferences());
generator.setStatusLine(200, "OK");
generator.setContentTypeByExt("js");
@@ -317,7 +317,7 @@ void HttpConnection::respondPreferencesJson() {
void HttpConnection::respondGlobalTransferInfoJson() {
QVariantMap info;
session_status sessionStatus = BTSession->getSessionStatus();
session_status sessionStatus = QBtSession::instance()->getSessionStatus();
info["DlInfos"] = tr("D: %1/s - T: %2", "Download speed: x KiB/s - Transferred: x MiB").arg(misc::friendlyUnit(sessionStatus.payload_download_rate)).arg(misc::friendlyUnit(sessionStatus.total_payload_download));
info["UpInfos"] = tr("U: %1/s - T: %2", "Upload speed: x KiB/s - Transferred: x MiB").arg(misc::friendlyUnit(sessionStatus.payload_upload_rate)).arg(misc::friendlyUnit(sessionStatus.total_payload_upload));
QString string = json::toJson(info);
@@ -353,7 +353,7 @@ void HttpConnection::respondCommand(QString command)
if(command == "addTrackers") {
QString hash = parser.post("hash");
if(!hash.isEmpty()) {
QTorrentHandle h = BTSession->getTorrentHandle(hash);
QTorrentHandle h = QBtSession::instance()->getTorrentHandle(hash);
if(h.is_valid() && h.has_metadata()) {
QString urls = parser.post("urls");
QStringList list = urls.split('\n');
@@ -407,14 +407,14 @@ void HttpConnection::respondCommand(QString command)
}
if(command == "setPreferences") {
QString json_str = parser.post("json");
EventManager* manager = parent->eventManager();
EventManager* manager = httpserver->eventManager();
manager->setGlobalPreferences(json::fromJson(json_str));
}
if(command == "setFilePrio") {
QString hash = parser.post("hash");
int file_id = parser.post("id").toInt();
int priority = parser.post("priority").toInt();
QTorrentHandle h = BTSession->getTorrentHandle(hash);
QTorrentHandle h = QBtSession::instance()->getTorrentHandle(hash);
if(h.is_valid() && h.has_metadata()) {
h.file_priority(file_id, priority);
}
@@ -422,18 +422,18 @@ void HttpConnection::respondCommand(QString command)
if(command == "getGlobalUpLimit") {
generator.setStatusLine(200, "OK");
generator.setContentTypeByExt("html");
generator.setMessage(QString::number(BTSession->getSession()->upload_rate_limit()));
generator.setMessage(QString::number(QBtSession::instance()->getSession()->upload_rate_limit()));
write();
}
if(command == "getGlobalDlLimit") {
generator.setStatusLine(200, "OK");
generator.setContentTypeByExt("html");
generator.setMessage(QString::number(BTSession->getSession()->download_rate_limit()));
generator.setMessage(QString::number(QBtSession::instance()->getSession()->download_rate_limit()));
write();
}
if(command == "getTorrentUpLimit") {
QString hash = parser.post("hash");
QTorrentHandle h = BTSession->getTorrentHandle(hash);
QTorrentHandle h = QBtSession::instance()->getTorrentHandle(hash);
if(h.is_valid()) {
generator.setStatusLine(200, "OK");
generator.setContentTypeByExt("html");
@@ -443,7 +443,7 @@ void HttpConnection::respondCommand(QString command)
}
if(command == "getTorrentDlLimit") {
QString hash = parser.post("hash");
QTorrentHandle h = BTSession->getTorrentHandle(hash);
QTorrentHandle h = QBtSession::instance()->getTorrentHandle(hash);
if(h.is_valid()) {
generator.setStatusLine(200, "OK");
generator.setContentTypeByExt("html");
@@ -455,7 +455,7 @@ void HttpConnection::respondCommand(QString command)
QString hash = parser.post("hash");
qlonglong limit = parser.post("limit").toLongLong();
if(limit == 0) limit = -1;
QTorrentHandle h = BTSession->getTorrentHandle(hash);
QTorrentHandle h = QBtSession::instance()->getTorrentHandle(hash);
if(h.is_valid()) {
h.set_upload_limit(limit);
}
@@ -464,7 +464,7 @@ void HttpConnection::respondCommand(QString command)
QString hash = parser.post("hash");
qlonglong limit = parser.post("limit").toLongLong();
if(limit == 0) limit = -1;
QTorrentHandle h = BTSession->getTorrentHandle(hash);
QTorrentHandle h = QBtSession::instance()->getTorrentHandle(hash);
if(h.is_valid()) {
h.set_download_limit(limit);
}
@@ -472,13 +472,13 @@ void HttpConnection::respondCommand(QString command)
if(command == "setGlobalUpLimit") {
qlonglong limit = parser.post("limit").toLongLong();
if(limit == 0) limit = -1;
BTSession->getSession()->set_upload_rate_limit(limit);
QBtSession::instance()->getSession()->set_upload_rate_limit(limit);
Preferences::setGlobalUploadLimit(limit/1024.);
}
if(command == "setGlobalDlLimit") {
qlonglong limit = parser.post("limit").toLongLong();
if(limit == 0) limit = -1;
BTSession->getSession()->set_download_rate_limit(limit);
QBtSession::instance()->getSession()->set_download_rate_limit(limit);
Preferences::setGlobalDownloadLimit(limit/1024.);
}
if(command == "pause") {
@@ -494,22 +494,22 @@ void HttpConnection::respondCommand(QString command)
return;
}
if(command == "increasePrio") {
QTorrentHandle h = BTSession->getTorrentHandle(parser.post("hash"));
QTorrentHandle h = QBtSession::instance()->getTorrentHandle(parser.post("hash"));
if(h.is_valid()) h.queue_position_up();
return;
}
if(command == "decreasePrio") {
QTorrentHandle h = BTSession->getTorrentHandle(parser.post("hash"));
QTorrentHandle h = QBtSession::instance()->getTorrentHandle(parser.post("hash"));
if(h.is_valid()) h.queue_position_down();
return;
}
if(command == "topPrio") {
QTorrentHandle h = BTSession->getTorrentHandle(parser.post("hash"));
QTorrentHandle h = QBtSession::instance()->getTorrentHandle(parser.post("hash"));
if(h.is_valid()) h.queue_position_top();
return;
}
if(command == "bottomPrio") {
QTorrentHandle h = BTSession->getTorrentHandle(parser.post("hash"));
QTorrentHandle h = QBtSession::instance()->getTorrentHandle(parser.post("hash"));
if(h.is_valid()) h.queue_position_bottom();
return;
}
@@ -524,18 +524,18 @@ void HttpConnection::respondCommand(QString command)
}
void HttpConnection::recheckTorrent(QString hash) {
QTorrentHandle h = BTSession->getTorrentHandle(hash);
QTorrentHandle h = QBtSession::instance()->getTorrentHandle(hash);
if(h.is_valid()){
BTSession->recheckTorrent(h.hash());
QBtSession::instance()->recheckTorrent(h.hash());
}
}
void HttpConnection::recheckAllTorrents() {
std::vector<torrent_handle> torrents = BTSession->getTorrents();
std::vector<torrent_handle> torrents = QBtSession::instance()->getTorrents();
std::vector<torrent_handle>::iterator torrentIT;
for(torrentIT = torrents.begin(); torrentIT != torrents.end(); torrentIT++) {
QTorrentHandle h = QTorrentHandle(*torrentIT);
if(h.is_valid())
BTSession->recheckTorrent(h.hash());
QBtSession::instance()->recheckTorrent(h.hash());
}
}

View File

@@ -38,7 +38,6 @@
class QTcpSocket;
class HttpServer;
class QBtSession;
class HttpConnection : public QObject
{
@@ -47,8 +46,7 @@ class HttpConnection : public QObject
private:
QTcpSocket *socket;
HttpServer *parent;
QBtSession *BTSession;
HttpServer *httpserver;
protected:
HttpRequestParser parser;
@@ -71,7 +69,7 @@ protected slots:
void recheckAllTorrents();
public:
HttpConnection(QTcpSocket *socket, QBtSession* BTSession, HttpServer *parent);
HttpConnection(QTcpSocket *socket, HttpServer *httpserver);
~HttpConnection();
QString translateDocument(QString data);

View File

@@ -80,23 +80,22 @@ void HttpServer::resetNbFailedAttemptsForIp(QString ip) {
client_failed_attempts.remove(ip);
}
HttpServer::HttpServer(QBtSession *_BTSession, int msec, QObject* parent) : QTcpServer(parent) {
HttpServer::HttpServer(int msec, QObject* parent) : QTcpServer(parent) {
username = Preferences::getWebUiUsername().toLocal8Bit();
password_ha1 = Preferences::getWebUiPassword().toLocal8Bit();
connect(this, SIGNAL(newConnection()), this, SLOT(newHttpConnection()));
BTSession = _BTSession;
manager = new EventManager(this, BTSession);
manager = new EventManager(this);
//add torrents
std::vector<torrent_handle> torrents = BTSession->getTorrents();
std::vector<torrent_handle> torrents = QBtSession::instance()->getTorrents();
std::vector<torrent_handle>::iterator torrentIT;
for(torrentIT = torrents.begin(); torrentIT != torrents.end(); torrentIT++) {
QTorrentHandle h = QTorrentHandle(*torrentIT);
if(h.is_valid())
manager->addedTorrent(h);
}
//connect BTSession to manager
connect(BTSession, SIGNAL(addedTorrent(QTorrentHandle&)), manager, SLOT(addedTorrent(QTorrentHandle&)));
connect(BTSession, SIGNAL(deletedTorrent(QString)), manager, SLOT(deletedTorrent(QString)));
//connect QBtSession::instance() to manager
connect(QBtSession::instance(), SIGNAL(addedTorrent(QTorrentHandle&)), manager, SLOT(addedTorrent(QTorrentHandle&)));
connect(QBtSession::instance(), SIGNAL(deletedTorrent(QString)), manager, SLOT(deletedTorrent(QString)));
//set timer
timer = new QTimer(this);
connect(timer, SIGNAL(timeout()), this, SLOT(onTimer()));
@@ -138,21 +137,21 @@ void HttpServer::newHttpConnection()
QTcpSocket *socket;
while((socket = nextPendingConnection()))
{
HttpConnection *connection = new HttpConnection(socket, BTSession, this);
//connect connection to BTSession
connect(connection, SIGNAL(UrlReadyToBeDownloaded(QString)), BTSession, SLOT(downloadUrlAndSkipDialog(QString)));
connect(connection, SIGNAL(MagnetReadyToBeDownloaded(QString)), BTSession, SLOT(addMagnetSkipAddDlg(QString)));
connect(connection, SIGNAL(torrentReadyToBeDownloaded(QString, bool, QString, bool)), BTSession, SLOT(addTorrent(QString, bool, QString, bool)));
connect(connection, SIGNAL(deleteTorrent(QString, bool)), BTSession, SLOT(deleteTorrent(QString, bool)));
connect(connection, SIGNAL(pauseTorrent(QString)), BTSession, SLOT(pauseTorrent(QString)));
connect(connection, SIGNAL(resumeTorrent(QString)), BTSession, SLOT(resumeTorrent(QString)));
connect(connection, SIGNAL(pauseAllTorrents()), BTSession, SLOT(pauseAllTorrents()));
connect(connection, SIGNAL(resumeAllTorrents()), BTSession, SLOT(resumeAllTorrents()));
HttpConnection *connection = new HttpConnection(socket, this);
//connect connection to QBtSession::instance()
connect(connection, SIGNAL(UrlReadyToBeDownloaded(QString)), QBtSession::instance(), SLOT(downloadUrlAndSkipDialog(QString)));
connect(connection, SIGNAL(MagnetReadyToBeDownloaded(QString)), QBtSession::instance(), SLOT(addMagnetSkipAddDlg(QString)));
connect(connection, SIGNAL(torrentReadyToBeDownloaded(QString, bool, QString, bool)), QBtSession::instance(), SLOT(addTorrent(QString, bool, QString, bool)));
connect(connection, SIGNAL(deleteTorrent(QString, bool)), QBtSession::instance(), SLOT(deleteTorrent(QString, bool)));
connect(connection, SIGNAL(pauseTorrent(QString)), QBtSession::instance(), SLOT(pauseTorrent(QString)));
connect(connection, SIGNAL(resumeTorrent(QString)), QBtSession::instance(), SLOT(resumeTorrent(QString)));
connect(connection, SIGNAL(pauseAllTorrents()), QBtSession::instance(), SLOT(pauseAllTorrents()));
connect(connection, SIGNAL(resumeAllTorrents()), QBtSession::instance(), SLOT(resumeAllTorrents()));
}
}
void HttpServer::onTimer() {
std::vector<torrent_handle> torrents = BTSession->getTorrents();
std::vector<torrent_handle> torrents = QBtSession::instance()->getTorrents();
std::vector<torrent_handle>::iterator torrentIT;
for(torrentIT = torrents.begin(); torrentIT != torrents.end(); torrentIT++) {
QTorrentHandle h = QTorrentHandle(*torrentIT);

View File

@@ -38,7 +38,6 @@
#include <QHash>
#include "preferences.h"
class QBtSession;
class QTimer;
class EventManager;
@@ -49,7 +48,7 @@ class HttpServer : public QTcpServer {
Q_DISABLE_COPY(HttpServer)
public:
HttpServer(QBtSession *BTSession, int msec, QObject* parent = 0);
HttpServer(int msec, QObject* parent = 0);
~HttpServer();
void setAuthorization(QString username, QString password_ha1);
bool isAuthorized(QByteArray auth, QString method) const;
@@ -67,7 +66,6 @@ private slots:
private:
QByteArray username;
QByteArray password_ha1;
QBtSession *BTSession;
EventManager *manager;
QTimer *timer;
QHash<QString, int> client_failed_attempts;