bigsnitch/proxyhandler.cpp

28 lines
878 B
C++
Raw Normal View History

#include "proxyhandler.h"
2021-03-19 16:40:33 +00:00
#include <QThread>
2021-01-09 10:17:50 +00:00
bool http::ProxyHandler::loadPlugin(QObject *proxy)
{
2021-01-09 10:17:50 +00:00
auto inst = qobject_cast<ProxyInterface*>(proxy);
if(!inst) {
return false;
}
2021-03-03 16:12:12 +00:00
qDebug("loading proxy");
2021-03-19 16:40:33 +00:00
auto thread = new QThread;
proxy->moveToThread(thread);
2021-03-20 16:04:13 +00:00
// TODO: get path from config or something
inst->path = "tcp://127.0.0.1:12345";
2021-03-19 16:40:33 +00:00
QObject::connect(thread, SIGNAL (started()), proxy, SLOT (process()));
2021-03-20 16:04:13 +00:00
//QObject::connect(proxy, SIGNAL (error(QString)), this, SLOT (errorString(QString)));
//QObject::connect(proxy, SIGNAL (message(http::Flow)), current_session, SLOT (saveFlow(http::Flow)), Qt::QueuedConnection);
//QObject::connect(proxy, SIGNAL (message(http::Flow)), this, SLOT (updateHistory()), Qt::QueuedConnection);
2021-03-19 16:40:33 +00:00
thread->start();
2021-03-20 16:04:13 +00:00
//proxies.insert({"foo", inst, thread});
2021-01-09 10:17:50 +00:00
return true;
}