This commit is contained in:
fourtf 2017-01-03 22:08:20 +01:00
parent 2b4fa8071f
commit 4716894027
2 changed files with 8 additions and 1 deletions

View file

@ -5,11 +5,14 @@
#include "QThreadPool" #include "QThreadPool"
#include "QRunnable" #include "QRunnable"
#include "lambdaqrunnable.h" #include "lambdaqrunnable.h"
#include "qcoreapplication.h"
IrcConnection* IrcManager::connection = NULL; IrcConnection* IrcManager::connection = NULL;
QMutex* IrcManager::connectionMutex = new QMutex(); QMutex* IrcManager::connectionMutex = new QMutex();
long IrcManager::connectionIteration = 0; long IrcManager::connectionIteration = 0;
QObject* IrcManager::parent = new QObject();
IrcManager::IrcManager() IrcManager::IrcManager()
{ {
@ -41,7 +44,7 @@ void IrcManager::beginConnecting()
c->setUserName("justinfan123"); c->setUserName("justinfan123");
c->setNickName("justinfan123"); c->setNickName("justinfan123");
c->setRealName("justinfan123"); c->setRealName("justinfan123");
c->sendRaw("JOIN #hsdogdog"); c->sendRaw("JOIN #fourtf");
c->sendCommand(IrcCommand::createCapability("REQ", "twitch.tv/commands")); c->sendCommand(IrcCommand::createCapability("REQ", "twitch.tv/commands"));
c->sendCommand(IrcCommand::createCapability("REQ", "twitch.tv/tags")); c->sendCommand(IrcCommand::createCapability("REQ", "twitch.tv/tags"));
@ -50,6 +53,8 @@ void IrcManager::beginConnecting()
connectionMutex->lock(); connectionMutex->lock();
if (iteration == connectionIteration) { if (iteration == connectionIteration) {
delete connection;
c->moveToThread(QCoreApplication::instance()->thread());
connection = c; connection = c;
} }
else { else {

View file

@ -17,6 +17,8 @@ private:
static void beginConnecting(); static void beginConnecting();
static QObject* parent;
static IrcConnection* connection; static IrcConnection* connection;
static QMutex* connectionMutex; static QMutex* connectionMutex;
static long connectionIteration; static long connectionIteration;