Switch to QT Category logging (#2206)
Co-authored-by: Rasmus Karlsson <rasmus.karlsson@pajlada.com>
This commit is contained in:
@@ -133,6 +133,7 @@ SOURCES += \
|
|||||||
src/common/UsernameSet.cpp \
|
src/common/UsernameSet.cpp \
|
||||||
src/common/Version.cpp \
|
src/common/Version.cpp \
|
||||||
src/common/WindowDescriptors.cpp \
|
src/common/WindowDescriptors.cpp \
|
||||||
|
src/common/QLogging.cpp \
|
||||||
src/controllers/accounts/Account.cpp \
|
src/controllers/accounts/Account.cpp \
|
||||||
src/controllers/accounts/AccountController.cpp \
|
src/controllers/accounts/AccountController.cpp \
|
||||||
src/controllers/accounts/AccountModel.cpp \
|
src/controllers/accounts/AccountModel.cpp \
|
||||||
@@ -348,6 +349,7 @@ HEADERS += \
|
|||||||
src/common/UniqueAccess.hpp \
|
src/common/UniqueAccess.hpp \
|
||||||
src/common/UsernameSet.hpp \
|
src/common/UsernameSet.hpp \
|
||||||
src/common/Version.hpp \
|
src/common/Version.hpp \
|
||||||
|
src/common/QLogging.hpp \
|
||||||
src/controllers/accounts/Account.hpp \
|
src/controllers/accounts/Account.hpp \
|
||||||
src/controllers/accounts/AccountController.hpp \
|
src/controllers/accounts/AccountController.hpp \
|
||||||
src/controllers/accounts/AccountModel.hpp \
|
src/controllers/accounts/AccountModel.hpp \
|
||||||
@@ -418,6 +420,7 @@ HEADERS += \
|
|||||||
src/providers/IvrApi.hpp \
|
src/providers/IvrApi.hpp \
|
||||||
src/providers/LinkResolver.hpp \
|
src/providers/LinkResolver.hpp \
|
||||||
src/providers/twitch/ChannelPointReward.hpp \
|
src/providers/twitch/ChannelPointReward.hpp \
|
||||||
|
src/providers/twitch/ChatterinoWebSocketppLogger.hpp \
|
||||||
src/providers/twitch/api/Helix.hpp \
|
src/providers/twitch/api/Helix.hpp \
|
||||||
src/providers/twitch/api/Kraken.hpp \
|
src/providers/twitch/api/Kraken.hpp \
|
||||||
src/providers/twitch/EmoteValue.hpp \
|
src/providers/twitch/EmoteValue.hpp \
|
||||||
@@ -620,6 +623,7 @@ CONFIG(debug, debug|release) {
|
|||||||
message("Building Chatterino2 DEBUG")
|
message("Building Chatterino2 DEBUG")
|
||||||
} else {
|
} else {
|
||||||
message("Building Chatterino2 RELEASE")
|
message("Building Chatterino2 RELEASE")
|
||||||
|
DEFINES += DEBUG_OFF
|
||||||
}
|
}
|
||||||
|
|
||||||
message("Injected git values: $$git_commit ($$git_release) $$git_hash")
|
message("Injected git values: $$git_commit ($$git_release) $$git_hash")
|
||||||
|
|||||||
+3
-1
@@ -3,6 +3,7 @@
|
|||||||
#include <atomic>
|
#include <atomic>
|
||||||
|
|
||||||
#include "common/Args.hpp"
|
#include "common/Args.hpp"
|
||||||
|
#include "common/QLogging.hpp"
|
||||||
#include "common/Version.hpp"
|
#include "common/Version.hpp"
|
||||||
#include "controllers/accounts/AccountController.hpp"
|
#include "controllers/accounts/AccountController.hpp"
|
||||||
#include "controllers/commands/CommandController.hpp"
|
#include "controllers/commands/CommandController.hpp"
|
||||||
@@ -339,7 +340,8 @@ void Application::initPubsub()
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
qDebug() << "Couldn't find channel id of point reward";
|
qCDebug(chatterinoApp)
|
||||||
|
<< "Couldn't find channel id of point reward";
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
+2
-1
@@ -12,6 +12,7 @@
|
|||||||
#include "common/Args.hpp"
|
#include "common/Args.hpp"
|
||||||
#include "common/Modes.hpp"
|
#include "common/Modes.hpp"
|
||||||
#include "common/NetworkManager.hpp"
|
#include "common/NetworkManager.hpp"
|
||||||
|
#include "common/QLogging.hpp"
|
||||||
#include "singletons/Paths.hpp"
|
#include "singletons/Paths.hpp"
|
||||||
#include "singletons/Resources.hpp"
|
#include "singletons/Resources.hpp"
|
||||||
#include "singletons/Settings.hpp"
|
#include "singletons/Settings.hpp"
|
||||||
@@ -144,7 +145,7 @@ namespace {
|
|||||||
// improved in the future.
|
// improved in the future.
|
||||||
void clearCache(const QDir &dir)
|
void clearCache(const QDir &dir)
|
||||||
{
|
{
|
||||||
qDebug() << "[Cache] cleared cache";
|
qCDebug(chatterinoCache) << "[Cache] cleared cache";
|
||||||
|
|
||||||
QStringList toBeRemoved;
|
QStringList toBeRemoved;
|
||||||
|
|
||||||
|
|||||||
+4
-3
@@ -7,6 +7,7 @@
|
|||||||
#include <QJsonDocument>
|
#include <QJsonDocument>
|
||||||
#include <QJsonObject>
|
#include <QJsonObject>
|
||||||
#include <QStringList>
|
#include <QStringList>
|
||||||
|
#include "common/QLogging.hpp"
|
||||||
|
|
||||||
namespace chatterino {
|
namespace chatterino {
|
||||||
|
|
||||||
@@ -38,13 +39,13 @@ Args::Args(const QApplication &app)
|
|||||||
|
|
||||||
if (!parser.parse(app.arguments()))
|
if (!parser.parse(app.arguments()))
|
||||||
{
|
{
|
||||||
qDebug() << "Warning: Unhandled options:"
|
qCWarning(chatterinoArgs)
|
||||||
<< parser.unknownOptionNames();
|
<< "Unhandled options:" << parser.unknownOptionNames();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (parser.isSet("help"))
|
if (parser.isSet("help"))
|
||||||
{
|
{
|
||||||
qDebug().noquote() << parser.helpText();
|
qCInfo(chatterinoArgs).noquote() << parser.helpText();
|
||||||
::exit(EXIT_SUCCESS);
|
::exit(EXIT_SUCCESS);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -3,6 +3,7 @@
|
|||||||
#include "singletons/Paths.hpp"
|
#include "singletons/Paths.hpp"
|
||||||
|
|
||||||
#include <QDesktopServices>
|
#include <QDesktopServices>
|
||||||
|
#include "common/QLogging.hpp"
|
||||||
|
|
||||||
namespace chatterino {
|
namespace chatterino {
|
||||||
|
|
||||||
@@ -40,7 +41,8 @@ void DownloadManager::setFile(QString fileURL, const QString &channelName)
|
|||||||
|
|
||||||
void DownloadManager::onDownloadProgress(qint64 bytesRead, qint64 bytesTotal)
|
void DownloadManager::onDownloadProgress(qint64 bytesRead, qint64 bytesTotal)
|
||||||
{
|
{
|
||||||
qDebug() << "Download progress: " << bytesRead << "/" << bytesTotal;
|
qCDebug(chatterinoCommon)
|
||||||
|
<< "Download progress: " << bytesRead << "/" << bytesTotal;
|
||||||
}
|
}
|
||||||
|
|
||||||
void DownloadManager::onFinished(QNetworkReply *reply)
|
void DownloadManager::onFinished(QNetworkReply *reply)
|
||||||
@@ -48,11 +50,11 @@ void DownloadManager::onFinished(QNetworkReply *reply)
|
|||||||
switch (reply->error())
|
switch (reply->error())
|
||||||
{
|
{
|
||||||
case QNetworkReply::NoError: {
|
case QNetworkReply::NoError: {
|
||||||
qDebug("file is downloaded successfully.");
|
qCDebug(chatterinoCommon) << "file is downloaded successfully.";
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
default: {
|
default: {
|
||||||
qDebug() << reply->errorString().toLatin1();
|
qCDebug(chatterinoCommon) << reply->errorString().toLatin1();
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -11,6 +11,7 @@
|
|||||||
#include <QCryptographicHash>
|
#include <QCryptographicHash>
|
||||||
#include <QFile>
|
#include <QFile>
|
||||||
#include <QtConcurrent>
|
#include <QtConcurrent>
|
||||||
|
#include "common/QLogging.hpp"
|
||||||
|
|
||||||
namespace chatterino {
|
namespace chatterino {
|
||||||
|
|
||||||
@@ -123,7 +124,7 @@ void loadUncached(const std::shared_ptr<NetworkData> &data)
|
|||||||
|
|
||||||
if (reply == nullptr)
|
if (reply == nullptr)
|
||||||
{
|
{
|
||||||
qDebug() << "Unhandled request type";
|
qCDebug(chatterinoCommon) << "Unhandled request type";
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -131,7 +132,7 @@ void loadUncached(const std::shared_ptr<NetworkData> &data)
|
|||||||
{
|
{
|
||||||
QObject::connect(
|
QObject::connect(
|
||||||
data->timer_, &QTimer::timeout, worker, [reply, data]() {
|
data->timer_, &QTimer::timeout, worker, [reply, data]() {
|
||||||
qDebug() << "Aborted!";
|
qCDebug(chatterinoCommon) << "Aborted!";
|
||||||
reply->abort();
|
reply->abort();
|
||||||
if (data->onError_)
|
if (data->onError_)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -12,6 +12,7 @@
|
|||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
#include <QFile>
|
#include <QFile>
|
||||||
#include <QtConcurrent>
|
#include <QtConcurrent>
|
||||||
|
#include "common/QLogging.hpp"
|
||||||
|
|
||||||
#include <cassert>
|
#include <cassert>
|
||||||
|
|
||||||
@@ -167,7 +168,7 @@ void NetworkRequest::execute()
|
|||||||
if (this->data->cache_ &&
|
if (this->data->cache_ &&
|
||||||
this->data->requestType_ != NetworkRequestType::Get)
|
this->data->requestType_ != NetworkRequestType::Get)
|
||||||
{
|
{
|
||||||
qDebug() << "Can only cache GET requests!";
|
qCDebug(chatterinoCommon) << "Can only cache GET requests!";
|
||||||
this->data->cache_ = false;
|
this->data->cache_ = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -3,6 +3,7 @@
|
|||||||
#include <rapidjson/document.h>
|
#include <rapidjson/document.h>
|
||||||
#include <rapidjson/error/en.h>
|
#include <rapidjson/error/en.h>
|
||||||
#include <QJsonDocument>
|
#include <QJsonDocument>
|
||||||
|
#include "common/QLogging.hpp"
|
||||||
|
|
||||||
namespace chatterino {
|
namespace chatterino {
|
||||||
|
|
||||||
@@ -43,9 +44,9 @@ rapidjson::Document NetworkResult::parseRapidJson() const
|
|||||||
|
|
||||||
if (result.Code() != rapidjson::kParseErrorNone)
|
if (result.Code() != rapidjson::kParseErrorNone)
|
||||||
{
|
{
|
||||||
qDebug() << "JSON parse error:"
|
qCWarning(chatterinoCommon)
|
||||||
<< rapidjson::GetParseError_En(result.Code()) << "("
|
<< "JSON parse error:" << rapidjson::GetParseError_En(result.Code())
|
||||||
<< result.Offset() << ")";
|
<< "(" << result.Offset() << ")";
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,37 @@
|
|||||||
|
#include "common/QLogging.hpp"
|
||||||
|
|
||||||
|
#ifdef DEBUG_OFF
|
||||||
|
static constexpr QtMsgType logThreshold = QtWarningMsg;
|
||||||
|
#else
|
||||||
|
static constexpr QtMsgType logThreshold = QtDebugMsg;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
Q_LOGGING_CATEGORY(chatterinoApp, "chatterino.app", logThreshold);
|
||||||
|
Q_LOGGING_CATEGORY(chatterinoArgs, "chatterino.args", logThreshold);
|
||||||
|
Q_LOGGING_CATEGORY(chatterinoBenchmark, "chatterino.benchmark", logThreshold);
|
||||||
|
Q_LOGGING_CATEGORY(chatterinoBttv, "chatterino.bttv", logThreshold);
|
||||||
|
Q_LOGGING_CATEGORY(chatterinoCommon, "chatterino.cache", logThreshold);
|
||||||
|
Q_LOGGING_CATEGORY(chatterinoCache, "chatterino.common", logThreshold);
|
||||||
|
Q_LOGGING_CATEGORY(chatterinoEmoji, "chatterino.emoji", logThreshold);
|
||||||
|
Q_LOGGING_CATEGORY(chatterinoFfzemotes, "chatterino.ffzemotes", logThreshold);
|
||||||
|
Q_LOGGING_CATEGORY(chatterinoHelper, "chatterino.helper", logThreshold);
|
||||||
|
Q_LOGGING_CATEGORY(chatterinoImage, "chatterino.image", logThreshold);
|
||||||
|
Q_LOGGING_CATEGORY(chatterinoIrc, "chatterino.irc", logThreshold);
|
||||||
|
Q_LOGGING_CATEGORY(chatterinoIvr, "chatterino.ivr", logThreshold);
|
||||||
|
Q_LOGGING_CATEGORY(chatterinoMain, "chatterino.main", logThreshold);
|
||||||
|
Q_LOGGING_CATEGORY(chatterinoMessage, "chatterino.message", logThreshold);
|
||||||
|
Q_LOGGING_CATEGORY(chatterinoNativeMessage, "chatterino.nativemessage",
|
||||||
|
logThreshold);
|
||||||
|
Q_LOGGING_CATEGORY(chatterinoNotification, "chatterino.notification",
|
||||||
|
logThreshold);
|
||||||
|
Q_LOGGING_CATEGORY(chatterinoNuulsuploader, "chatterino.nuulsuploader",
|
||||||
|
logThreshold);
|
||||||
|
Q_LOGGING_CATEGORY(chatterinoPubsub, "chatterino.pubsub", logThreshold);
|
||||||
|
Q_LOGGING_CATEGORY(chatterinoStreamlink, "chatterino.streamlink", logThreshold);
|
||||||
|
Q_LOGGING_CATEGORY(chatterinoTokenizer, "chatterino.tokenizer", logThreshold);
|
||||||
|
Q_LOGGING_CATEGORY(chatterinoTwitch, "chatterino.twitch", logThreshold);
|
||||||
|
Q_LOGGING_CATEGORY(chatterinoUpdate, "chatterino.update", logThreshold);
|
||||||
|
Q_LOGGING_CATEGORY(chatterinoWebsocket, "chatterino.websocket", logThreshold);
|
||||||
|
Q_LOGGING_CATEGORY(chatterinoWidget, "chatterino.widget", logThreshold);
|
||||||
|
Q_LOGGING_CATEGORY(chatterinoWindowmanager, "chatterino.windowmanager",
|
||||||
|
logThreshold);
|
||||||
@@ -0,0 +1,29 @@
|
|||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include <QLoggingCategory>
|
||||||
|
|
||||||
|
Q_DECLARE_LOGGING_CATEGORY(chatterinoApp);
|
||||||
|
Q_DECLARE_LOGGING_CATEGORY(chatterinoArgs);
|
||||||
|
Q_DECLARE_LOGGING_CATEGORY(chatterinoBenchmark);
|
||||||
|
Q_DECLARE_LOGGING_CATEGORY(chatterinoBttv);
|
||||||
|
Q_DECLARE_LOGGING_CATEGORY(chatterinoCache);
|
||||||
|
Q_DECLARE_LOGGING_CATEGORY(chatterinoCommon);
|
||||||
|
Q_DECLARE_LOGGING_CATEGORY(chatterinoEmoji);
|
||||||
|
Q_DECLARE_LOGGING_CATEGORY(chatterinoFfzemotes);
|
||||||
|
Q_DECLARE_LOGGING_CATEGORY(chatterinoHelper);
|
||||||
|
Q_DECLARE_LOGGING_CATEGORY(chatterinoImage);
|
||||||
|
Q_DECLARE_LOGGING_CATEGORY(chatterinoIrc);
|
||||||
|
Q_DECLARE_LOGGING_CATEGORY(chatterinoIvr);
|
||||||
|
Q_DECLARE_LOGGING_CATEGORY(chatterinoMain);
|
||||||
|
Q_DECLARE_LOGGING_CATEGORY(chatterinoMessage);
|
||||||
|
Q_DECLARE_LOGGING_CATEGORY(chatterinoNativeMessage);
|
||||||
|
Q_DECLARE_LOGGING_CATEGORY(chatterinoNotification);
|
||||||
|
Q_DECLARE_LOGGING_CATEGORY(chatterinoNuulsuploader);
|
||||||
|
Q_DECLARE_LOGGING_CATEGORY(chatterinoPubsub);
|
||||||
|
Q_DECLARE_LOGGING_CATEGORY(chatterinoStreamlink);
|
||||||
|
Q_DECLARE_LOGGING_CATEGORY(chatterinoTokenizer);
|
||||||
|
Q_DECLARE_LOGGING_CATEGORY(chatterinoTwitch);
|
||||||
|
Q_DECLARE_LOGGING_CATEGORY(chatterinoUpdate);
|
||||||
|
Q_DECLARE_LOGGING_CATEGORY(chatterinoWebsocket);
|
||||||
|
Q_DECLARE_LOGGING_CATEGORY(chatterinoWidget);
|
||||||
|
Q_DECLARE_LOGGING_CATEGORY(chatterinoWindowmanager);
|
||||||
@@ -1,5 +1,6 @@
|
|||||||
#include "common/WindowDescriptors.hpp"
|
#include "common/WindowDescriptors.hpp"
|
||||||
|
|
||||||
|
#include "common/QLogging.hpp"
|
||||||
#include "widgets/Window.hpp"
|
#include "widgets/Window.hpp"
|
||||||
|
|
||||||
namespace chatterino {
|
namespace chatterino {
|
||||||
@@ -126,7 +127,7 @@ WindowLayout WindowLayout::loadFromFile(const QString &path)
|
|||||||
{
|
{
|
||||||
if (hasSetAMainWindow)
|
if (hasSetAMainWindow)
|
||||||
{
|
{
|
||||||
qDebug()
|
qCDebug(chatterinoCommon)
|
||||||
<< "Window Layout file contains more than one Main window "
|
<< "Window Layout file contains more than one Main window "
|
||||||
"- demoting to Popup type";
|
"- demoting to Popup type";
|
||||||
type = WindowType::Popup;
|
type = WindowType::Popup;
|
||||||
@@ -180,8 +181,9 @@ WindowLayout WindowLayout::loadFromFile(const QString &path)
|
|||||||
{
|
{
|
||||||
if (hasSetASelectedTab)
|
if (hasSetASelectedTab)
|
||||||
{
|
{
|
||||||
qDebug() << "Window contains more than one selected tab - "
|
qCDebug(chatterinoCommon)
|
||||||
"demoting to unselected";
|
<< "Window contains more than one selected tab - "
|
||||||
|
"demoting to unselected";
|
||||||
tab.selected_ = false;
|
tab.selected_ = false;
|
||||||
}
|
}
|
||||||
hasSetASelectedTab = true;
|
hasSetASelectedTab = true;
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
#include "controllers/filters/parser/Tokenizer.hpp"
|
#include "controllers/filters/parser/Tokenizer.hpp"
|
||||||
|
#include "common/QLogging.hpp"
|
||||||
|
|
||||||
namespace filterparser {
|
namespace filterparser {
|
||||||
|
|
||||||
@@ -70,21 +71,24 @@ void Tokenizer::debug()
|
|||||||
{
|
{
|
||||||
if (this->i_ > 0)
|
if (this->i_ > 0)
|
||||||
{
|
{
|
||||||
qDebug() << "= current" << this->tokens_.at(this->i_ - 1);
|
qCDebug(chatterinoTokenizer)
|
||||||
qDebug() << "= current type" << this->tokenTypes_.at(this->i_ - 1);
|
<< "= current" << this->tokens_.at(this->i_ - 1);
|
||||||
|
qCDebug(chatterinoTokenizer)
|
||||||
|
<< "= current type" << this->tokenTypes_.at(this->i_ - 1);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
qDebug() << "= no current";
|
qCDebug(chatterinoTokenizer) << "= no current";
|
||||||
}
|
}
|
||||||
if (this->hasNext())
|
if (this->hasNext())
|
||||||
{
|
{
|
||||||
qDebug() << "= next" << this->tokens_.at(this->i_);
|
qCDebug(chatterinoTokenizer) << "= next" << this->tokens_.at(this->i_);
|
||||||
qDebug() << "= next type" << this->tokenTypes_.at(this->i_);
|
qCDebug(chatterinoTokenizer)
|
||||||
|
<< "= next type" << this->tokenTypes_.at(this->i_);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
qDebug() << "= no next";
|
qCDebug(chatterinoTokenizer) << "= no next";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -3,6 +3,7 @@
|
|||||||
#include "Application.hpp"
|
#include "Application.hpp"
|
||||||
#include "common/NetworkRequest.hpp"
|
#include "common/NetworkRequest.hpp"
|
||||||
#include "common/Outcome.hpp"
|
#include "common/Outcome.hpp"
|
||||||
|
#include "common/QLogging.hpp"
|
||||||
#include "controllers/notifications/NotificationModel.hpp"
|
#include "controllers/notifications/NotificationModel.hpp"
|
||||||
#include "providers/twitch/TwitchIrcServer.hpp"
|
#include "providers/twitch/TwitchIrcServer.hpp"
|
||||||
#include "providers/twitch/api/Helix.hpp"
|
#include "providers/twitch/api/Helix.hpp"
|
||||||
@@ -146,8 +147,8 @@ void NotificationController::getFakeTwitchChannelLiveStatus(
|
|||||||
getHelix()->getStreamByName(
|
getHelix()->getStreamByName(
|
||||||
channelName,
|
channelName,
|
||||||
[channelName, this](bool live, const auto &stream) {
|
[channelName, this](bool live, const auto &stream) {
|
||||||
qDebug() << "[TwitchChannel" << channelName
|
qCDebug(chatterinoNotification) << "[TwitchChannel" << channelName
|
||||||
<< "] Refreshing live status";
|
<< "] Refreshing live status";
|
||||||
|
|
||||||
if (!live)
|
if (!live)
|
||||||
{
|
{
|
||||||
@@ -185,8 +186,9 @@ void NotificationController::getFakeTwitchChannelLiveStatus(
|
|||||||
fakeTwitchChannels.push_back(channelName);
|
fakeTwitchChannels.push_back(channelName);
|
||||||
},
|
},
|
||||||
[channelName, this] {
|
[channelName, this] {
|
||||||
qDebug() << "[TwitchChannel" << channelName
|
qCDebug(chatterinoNotification)
|
||||||
<< "] Refreshing live status (Missing ID)";
|
<< "[TwitchChannel" << channelName
|
||||||
|
<< "] Refreshing live status (Missing ID)";
|
||||||
this->removeFakeChannel(channelName);
|
this->removeFakeChannel(channelName);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
#include "Benchmark.hpp"
|
#include "Benchmark.hpp"
|
||||||
|
#include "common/QLogging.hpp"
|
||||||
|
|
||||||
namespace chatterino {
|
namespace chatterino {
|
||||||
|
|
||||||
@@ -10,8 +11,8 @@ BenchmarkGuard::BenchmarkGuard(const QString &_name)
|
|||||||
|
|
||||||
BenchmarkGuard::~BenchmarkGuard()
|
BenchmarkGuard::~BenchmarkGuard()
|
||||||
{
|
{
|
||||||
qDebug() << this->name_ << float(timer_.nsecsElapsed()) / 1000000.0f
|
qCDebug(chatterinoBenchmark)
|
||||||
<< "ms";
|
<< this->name_ << float(timer_.nsecsElapsed()) / 1000000.0f << "ms";
|
||||||
}
|
}
|
||||||
|
|
||||||
qreal BenchmarkGuard::getElapsedMs()
|
qreal BenchmarkGuard::getElapsedMs()
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <QDebug>
|
|
||||||
#include <QElapsedTimer>
|
#include <QElapsedTimer>
|
||||||
#include <boost/noncopyable.hpp>
|
#include <boost/noncopyable.hpp>
|
||||||
|
|
||||||
|
|||||||
+8
-7
@@ -1,6 +1,5 @@
|
|||||||
#include <QApplication>
|
#include <QApplication>
|
||||||
#include <QCommandLineParser>
|
#include <QCommandLineParser>
|
||||||
#include <QDebug>
|
|
||||||
#include <QMessageBox>
|
#include <QMessageBox>
|
||||||
#include <QStringList>
|
#include <QStringList>
|
||||||
#include <memory>
|
#include <memory>
|
||||||
@@ -9,6 +8,7 @@
|
|||||||
#include "RunGui.hpp"
|
#include "RunGui.hpp"
|
||||||
#include "common/Args.hpp"
|
#include "common/Args.hpp"
|
||||||
#include "common/Modes.hpp"
|
#include "common/Modes.hpp"
|
||||||
|
#include "common/QLogging.hpp"
|
||||||
#include "common/Version.hpp"
|
#include "common/Version.hpp"
|
||||||
#include "providers/IvrApi.hpp"
|
#include "providers/IvrApi.hpp"
|
||||||
#include "providers/twitch/api/Helix.hpp"
|
#include "providers/twitch/api/Helix.hpp"
|
||||||
@@ -37,12 +37,13 @@ int main(int argc, char **argv)
|
|||||||
else if (getArgs().printVersion)
|
else if (getArgs().printVersion)
|
||||||
{
|
{
|
||||||
auto version = Version::instance();
|
auto version = Version::instance();
|
||||||
qInfo().noquote() << QString("%1 (commit %2%3)")
|
qCInfo(chatterinoMain).noquote()
|
||||||
.arg(version.fullVersion())
|
<< QString("%1 (commit %2%3)")
|
||||||
.arg(version.commitHash())
|
.arg(version.fullVersion())
|
||||||
.arg(Modes::instance().isNightly
|
.arg(version.commitHash())
|
||||||
? ", " + version.dateOfBuild()
|
.arg(Modes::instance().isNightly
|
||||||
: "");
|
? ", " + version.dateOfBuild()
|
||||||
|
: "");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -12,6 +12,7 @@
|
|||||||
#include "Application.hpp"
|
#include "Application.hpp"
|
||||||
#include "common/Common.hpp"
|
#include "common/Common.hpp"
|
||||||
#include "common/NetworkRequest.hpp"
|
#include "common/NetworkRequest.hpp"
|
||||||
|
#include "common/QLogging.hpp"
|
||||||
#include "debug/AssertInGuiThread.hpp"
|
#include "debug/AssertInGuiThread.hpp"
|
||||||
#include "debug/Benchmark.hpp"
|
#include "debug/Benchmark.hpp"
|
||||||
#include "singletons/Emotes.hpp"
|
#include "singletons/Emotes.hpp"
|
||||||
@@ -130,8 +131,9 @@ namespace detail {
|
|||||||
|
|
||||||
if (reader.imageCount() == 0)
|
if (reader.imageCount() == 0)
|
||||||
{
|
{
|
||||||
qDebug() << "Error while reading image" << url.string << ": '"
|
qCDebug(chatterinoImage)
|
||||||
<< reader.errorString() << "'";
|
<< "Error while reading image" << url.string << ": '"
|
||||||
|
<< reader.errorString() << "'";
|
||||||
return frames;
|
return frames;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -149,8 +151,9 @@ namespace detail {
|
|||||||
|
|
||||||
if (frames.size() == 0)
|
if (frames.size() == 0)
|
||||||
{
|
{
|
||||||
qDebug() << "Error while reading image" << url.string << ": '"
|
qCDebug(chatterinoImage)
|
||||||
<< reader.errorString() << "'";
|
<< "Error while reading image" << url.string << ": '"
|
||||||
|
<< reader.errorString() << "'";
|
||||||
}
|
}
|
||||||
|
|
||||||
return frames;
|
return frames;
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
#include "messages/SharedMessageBuilder.hpp"
|
#include "messages/SharedMessageBuilder.hpp"
|
||||||
|
|
||||||
#include "Application.hpp"
|
#include "Application.hpp"
|
||||||
|
#include "common/QLogging.hpp"
|
||||||
#include "controllers/ignores/IgnorePhrase.hpp"
|
#include "controllers/ignores/IgnorePhrase.hpp"
|
||||||
#include "messages/Message.hpp"
|
#include "messages/Message.hpp"
|
||||||
#include "messages/MessageElement.hpp"
|
#include "messages/MessageElement.hpp"
|
||||||
@@ -88,8 +89,9 @@ bool SharedMessageBuilder::isIgnored() const
|
|||||||
{
|
{
|
||||||
if (phrase.isBlock() && phrase.isMatch(this->originalMessage_))
|
if (phrase.isBlock() && phrase.isMatch(this->originalMessage_))
|
||||||
{
|
{
|
||||||
qDebug() << "Blocking message because it contains ignored phrase"
|
qCDebug(chatterinoMessage)
|
||||||
<< phrase.getPattern();
|
<< "Blocking message because it contains ignored phrase"
|
||||||
|
<< phrase.getPattern();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -202,8 +204,9 @@ void SharedMessageBuilder::parseHighlights()
|
|||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
qDebug() << "Highlight because user" << this->ircMessage->nick()
|
qCDebug(chatterinoMessage)
|
||||||
<< "sent a message";
|
<< "Highlight because user" << this->ircMessage->nick()
|
||||||
|
<< "sent a message";
|
||||||
|
|
||||||
this->message().flags.set(MessageFlag::Highlighted);
|
this->message().flags.set(MessageFlag::Highlighted);
|
||||||
this->message().highlightColor = userHighlight.getColor();
|
this->message().highlightColor = userHighlight.getColor();
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
#include "messages/layouts/MessageLayoutElement.hpp"
|
#include "messages/layouts/MessageLayoutElement.hpp"
|
||||||
|
|
||||||
#include "Application.hpp"
|
#include "Application.hpp"
|
||||||
|
#include "common/QLogging.hpp"
|
||||||
#include "messages/Emote.hpp"
|
#include "messages/Emote.hpp"
|
||||||
#include "messages/Image.hpp"
|
#include "messages/Image.hpp"
|
||||||
#include "messages/MessageElement.hpp"
|
#include "messages/MessageElement.hpp"
|
||||||
@@ -422,7 +423,7 @@ void MultiColorTextLayoutElement::paint(QPainter &painter)
|
|||||||
|
|
||||||
for (const auto &segment : this->segments_)
|
for (const auto &segment : this->segments_)
|
||||||
{
|
{
|
||||||
// qDebug() << "Draw segment:" << segment.text;
|
qCDebug(chatterinoMessage) << "Draw segment:" << segment.text;
|
||||||
painter.setPen(segment.color);
|
painter.setPen(segment.color);
|
||||||
painter.drawText(QRectF(this->getRect().x() + xOffset,
|
painter.drawText(QRectF(this->getRect().x() + xOffset,
|
||||||
this->getRect().y(), 10000, 10000),
|
this->getRect().y(), 10000, 10000),
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
#include "IvrApi.hpp"
|
#include "IvrApi.hpp"
|
||||||
|
|
||||||
#include "common/Outcome.hpp"
|
#include "common/Outcome.hpp"
|
||||||
|
#include "common/QLogging.hpp"
|
||||||
|
|
||||||
#include <QUrlQuery>
|
#include <QUrlQuery>
|
||||||
|
|
||||||
@@ -23,8 +24,9 @@ void IvrApi::getSubage(QString userName, QString channelName,
|
|||||||
return Success;
|
return Success;
|
||||||
})
|
})
|
||||||
.onError([failureCallback](NetworkResult result) {
|
.onError([failureCallback](NetworkResult result) {
|
||||||
qDebug() << "Failed IVR API Call!" << result.status()
|
qCWarning(chatterinoIvr)
|
||||||
<< QString(result.getData());
|
<< "Failed IVR API Call!" << result.status()
|
||||||
|
<< QString(result.getData());
|
||||||
failureCallback();
|
failureCallback();
|
||||||
})
|
})
|
||||||
.execute();
|
.execute();
|
||||||
|
|||||||
@@ -5,6 +5,7 @@
|
|||||||
|
|
||||||
#include "common/Common.hpp"
|
#include "common/Common.hpp"
|
||||||
#include "common/NetworkRequest.hpp"
|
#include "common/NetworkRequest.hpp"
|
||||||
|
#include "common/QLogging.hpp"
|
||||||
#include "messages/Emote.hpp"
|
#include "messages/Emote.hpp"
|
||||||
#include "messages/Image.hpp"
|
#include "messages/Image.hpp"
|
||||||
#include "messages/ImageSet.hpp"
|
#include "messages/ImageSet.hpp"
|
||||||
@@ -178,15 +179,17 @@ void BttvEmotes::loadChannel(std::weak_ptr<Channel> channel,
|
|||||||
else if (result.status() == NetworkResult::timedoutStatus)
|
else if (result.status() == NetworkResult::timedoutStatus)
|
||||||
{
|
{
|
||||||
// TODO: Auto retry in case of a timeout, with a delay
|
// TODO: Auto retry in case of a timeout, with a delay
|
||||||
qDebug() << "Fetching BTTV emotes for channel" << channelId
|
qCWarning(chatterinoBttv)
|
||||||
<< "failed due to timeout";
|
<< "Fetching BTTV emotes for channel" << channelId
|
||||||
|
<< "failed due to timeout";
|
||||||
shared->addMessage(makeSystemMessage(
|
shared->addMessage(makeSystemMessage(
|
||||||
"Failed to fetch BetterTTV channel emotes. (timed out)"));
|
"Failed to fetch BetterTTV channel emotes. (timed out)"));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
qDebug() << "Error fetching BTTV emotes for channel"
|
qCWarning(chatterinoBttv)
|
||||||
<< channelId << ", error" << result.status();
|
<< "Error fetching BTTV emotes for channel" << channelId
|
||||||
|
<< ", error" << result.status();
|
||||||
shared->addMessage(
|
shared->addMessage(
|
||||||
makeSystemMessage("Failed to fetch BetterTTV channel "
|
makeSystemMessage("Failed to fetch BetterTTV channel "
|
||||||
"emotes. (unknown error)"));
|
"emotes. (unknown error)"));
|
||||||
|
|||||||
@@ -10,6 +10,7 @@
|
|||||||
#include <QFile>
|
#include <QFile>
|
||||||
#include <boost/variant.hpp>
|
#include <boost/variant.hpp>
|
||||||
#include <memory>
|
#include <memory>
|
||||||
|
#include "common/QLogging.hpp"
|
||||||
|
|
||||||
namespace chatterino {
|
namespace chatterino {
|
||||||
namespace {
|
namespace {
|
||||||
@@ -131,9 +132,9 @@ void Emojis::loadEmojis()
|
|||||||
|
|
||||||
if (result.Code() != rapidjson::kParseErrorNone)
|
if (result.Code() != rapidjson::kParseErrorNone)
|
||||||
{
|
{
|
||||||
qDebug() << "JSON parse error:"
|
qCWarning(chatterinoEmoji)
|
||||||
<< rapidjson::GetParseError_En(result.Code()) << "("
|
<< "JSON parse error:" << rapidjson::GetParseError_En(result.Code())
|
||||||
<< result.Offset() << ")";
|
<< "(" << result.Offset() << ")";
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -165,8 +166,9 @@ void Emojis::loadEmojis()
|
|||||||
auto toneNameIt = toneNames.find(tone);
|
auto toneNameIt = toneNames.find(tone);
|
||||||
if (toneNameIt == toneNames.end())
|
if (toneNameIt == toneNames.end())
|
||||||
{
|
{
|
||||||
qDebug() << "Tone with key" << tone.c_str()
|
qCDebug(chatterinoEmoji)
|
||||||
<< "does not exist in tone names map";
|
<< "Tone with key" << tone.c_str()
|
||||||
|
<< "does not exist in tone names map";
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -4,6 +4,7 @@
|
|||||||
|
|
||||||
#include "common/NetworkRequest.hpp"
|
#include "common/NetworkRequest.hpp"
|
||||||
#include "common/Outcome.hpp"
|
#include "common/Outcome.hpp"
|
||||||
|
#include "common/QLogging.hpp"
|
||||||
#include "messages/Emote.hpp"
|
#include "messages/Emote.hpp"
|
||||||
#include "messages/Image.hpp"
|
#include "messages/Image.hpp"
|
||||||
#include "messages/MessageBuilder.hpp"
|
#include "messages/MessageBuilder.hpp"
|
||||||
@@ -195,8 +196,8 @@ void FfzEmotes::loadChannel(
|
|||||||
std::function<void(boost::optional<EmotePtr>)> modBadgeCallback,
|
std::function<void(boost::optional<EmotePtr>)> modBadgeCallback,
|
||||||
bool manualRefresh)
|
bool manualRefresh)
|
||||||
{
|
{
|
||||||
qDebug() << "[FFZEmotes] Reload FFZ Channel Emotes for channel"
|
qCDebug(chatterinoFfzemotes)
|
||||||
<< channelId;
|
<< "[FFZEmotes] Reload FFZ Channel Emotes for channel" << channelId;
|
||||||
|
|
||||||
NetworkRequest("https://api.frankerfacez.com/v1/room/id/" + channelId)
|
NetworkRequest("https://api.frankerfacez.com/v1/room/id/" + channelId)
|
||||||
|
|
||||||
@@ -230,16 +231,18 @@ void FfzEmotes::loadChannel(
|
|||||||
else if (result.status() == NetworkResult::timedoutStatus)
|
else if (result.status() == NetworkResult::timedoutStatus)
|
||||||
{
|
{
|
||||||
// TODO: Auto retry in case of a timeout, with a delay
|
// TODO: Auto retry in case of a timeout, with a delay
|
||||||
qDebug() << "Fetching FFZ emotes for channel" << channelId
|
qCWarning(chatterinoFfzemotes)
|
||||||
<< "failed due to timeout";
|
<< "Fetching FFZ emotes for channel" << channelId
|
||||||
|
<< "failed due to timeout";
|
||||||
shared->addMessage(
|
shared->addMessage(
|
||||||
makeSystemMessage("Failed to fetch FrankerFaceZ channel "
|
makeSystemMessage("Failed to fetch FrankerFaceZ channel "
|
||||||
"emotes. (timed out)"));
|
"emotes. (timed out)"));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
qDebug() << "Error fetching FFZ emotes for channel" << channelId
|
qCWarning(chatterinoFfzemotes)
|
||||||
<< ", error" << result.status();
|
<< "Error fetching FFZ emotes for channel" << channelId
|
||||||
|
<< ", error" << result.status();
|
||||||
shared->addMessage(
|
shared->addMessage(
|
||||||
makeSystemMessage("Failed to fetch FrankerFaceZ channel "
|
makeSystemMessage("Failed to fetch FrankerFaceZ channel "
|
||||||
"emotes. (unknown error)"));
|
"emotes. (unknown error)"));
|
||||||
|
|||||||
@@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
#include "common/Channel.hpp"
|
#include "common/Channel.hpp"
|
||||||
#include "common/Common.hpp"
|
#include "common/Common.hpp"
|
||||||
|
#include "common/QLogging.hpp"
|
||||||
#include "messages/LimitedQueueSnapshot.hpp"
|
#include "messages/LimitedQueueSnapshot.hpp"
|
||||||
#include "messages/Message.hpp"
|
#include "messages/Message.hpp"
|
||||||
#include "messages/MessageBuilder.hpp"
|
#include "messages/MessageBuilder.hpp"
|
||||||
@@ -76,7 +77,8 @@ AbstractIrcServer::AbstractIrcServer()
|
|||||||
|
|
||||||
if (!this->readConnection_->isConnected())
|
if (!this->readConnection_->isConnected())
|
||||||
{
|
{
|
||||||
qDebug() << "Trying to reconnect..." << this->falloffCounter_;
|
qCDebug(chatterinoIrc)
|
||||||
|
<< "Trying to reconnect..." << this->falloffCounter_;
|
||||||
this->connect();
|
this->connect();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@@ -195,8 +197,8 @@ ChannelPtr AbstractIrcServer::getOrAddChannel(const QString &dirtyChannelName)
|
|||||||
chan->destroyed.connect([this, channelName] {
|
chan->destroyed.connect([this, channelName] {
|
||||||
// fourtf: issues when the server itself is destroyed
|
// fourtf: issues when the server itself is destroyed
|
||||||
|
|
||||||
qDebug() << "[AbstractIrcServer::addChannel]" << channelName
|
qCDebug(chatterinoIrc) << "[AbstractIrcServer::addChannel]"
|
||||||
<< "was destroyed";
|
<< channelName << "was destroyed";
|
||||||
this->channels.remove(channelName);
|
this->channels.remove(channelName);
|
||||||
|
|
||||||
if (this->readConnection_)
|
if (this->readConnection_)
|
||||||
|
|||||||
@@ -3,6 +3,7 @@
|
|||||||
#include <cassert>
|
#include <cassert>
|
||||||
#include <cstdlib>
|
#include <cstdlib>
|
||||||
|
|
||||||
|
#include "common/QLogging.hpp"
|
||||||
#include "messages/Message.hpp"
|
#include "messages/Message.hpp"
|
||||||
#include "providers/irc/Irc2.hpp"
|
#include "providers/irc/Irc2.hpp"
|
||||||
#include "providers/irc/IrcChannel2.hpp"
|
#include "providers/irc/IrcChannel2.hpp"
|
||||||
@@ -187,7 +188,7 @@ void IrcServer::privateMessageReceived(Communi::IrcPrivateMessage *message)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
qDebug() << "message ignored :rage:";
|
qCDebug(chatterinoIrc) << "message ignored :rage:";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
#include "ChannelPointReward.hpp"
|
#include "ChannelPointReward.hpp"
|
||||||
|
#include "common/QLogging.hpp"
|
||||||
#include "util/RapidjsonHelpers.hpp"
|
#include "util/RapidjsonHelpers.hpp"
|
||||||
|
|
||||||
namespace chatterino {
|
namespace chatterino {
|
||||||
@@ -9,7 +10,8 @@ QString parseRewardImage(const rapidjson::Value &obj, const char *key,
|
|||||||
QString url;
|
QString url;
|
||||||
if (!(result = rj::getSafe(obj, key, url)))
|
if (!(result = rj::getSafe(obj, key, url)))
|
||||||
{
|
{
|
||||||
qDebug() << "No url value found for key in reward image object:" << key;
|
qCDebug(chatterinoTwitch)
|
||||||
|
<< "No url value found for key in reward image object:" << key;
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -22,7 +24,7 @@ ChannelPointReward::ChannelPointReward(rapidjson::Value &redemption)
|
|||||||
if (!(this->hasParsedSuccessfully =
|
if (!(this->hasParsedSuccessfully =
|
||||||
rj::getSafeObject(redemption, "user", user)))
|
rj::getSafeObject(redemption, "user", user)))
|
||||||
{
|
{
|
||||||
qDebug() << "No user info found for redemption";
|
qCDebug(chatterinoTwitch) << "No user info found for redemption";
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -30,41 +32,42 @@ ChannelPointReward::ChannelPointReward(rapidjson::Value &redemption)
|
|||||||
if (!(this->hasParsedSuccessfully =
|
if (!(this->hasParsedSuccessfully =
|
||||||
rj::getSafeObject(redemption, "reward", reward)))
|
rj::getSafeObject(redemption, "reward", reward)))
|
||||||
{
|
{
|
||||||
qDebug() << "No reward info found for redemption";
|
qCDebug(chatterinoTwitch) << "No reward info found for redemption";
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!(this->hasParsedSuccessfully = rj::getSafe(reward, "id", this->id)))
|
if (!(this->hasParsedSuccessfully = rj::getSafe(reward, "id", this->id)))
|
||||||
{
|
{
|
||||||
qDebug() << "No id found for reward";
|
qCDebug(chatterinoTwitch) << "No id found for reward";
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!(this->hasParsedSuccessfully =
|
if (!(this->hasParsedSuccessfully =
|
||||||
rj::getSafe(reward, "channel_id", this->channelId)))
|
rj::getSafe(reward, "channel_id", this->channelId)))
|
||||||
{
|
{
|
||||||
qDebug() << "No channel_id found for reward";
|
qCDebug(chatterinoTwitch) << "No channel_id found for reward";
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!(this->hasParsedSuccessfully =
|
if (!(this->hasParsedSuccessfully =
|
||||||
rj::getSafe(reward, "title", this->title)))
|
rj::getSafe(reward, "title", this->title)))
|
||||||
{
|
{
|
||||||
qDebug() << "No title found for reward";
|
qCDebug(chatterinoTwitch) << "No title found for reward";
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!(this->hasParsedSuccessfully =
|
if (!(this->hasParsedSuccessfully =
|
||||||
rj::getSafe(reward, "cost", this->cost)))
|
rj::getSafe(reward, "cost", this->cost)))
|
||||||
{
|
{
|
||||||
qDebug() << "No cost found for reward";
|
qCDebug(chatterinoTwitch) << "No cost found for reward";
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!(this->hasParsedSuccessfully = rj::getSafe(
|
if (!(this->hasParsedSuccessfully = rj::getSafe(
|
||||||
reward, "is_user_input_required", this->isUserInputRequired)))
|
reward, "is_user_input_required", this->isUserInputRequired)))
|
||||||
{
|
{
|
||||||
qDebug() << "No information if user input is required found for reward";
|
qCDebug(chatterinoTwitch)
|
||||||
|
<< "No information if user input is required found for reward";
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -105,21 +108,21 @@ void ChannelPointReward::parseUser(rapidjson::Value &user)
|
|||||||
{
|
{
|
||||||
if (!(this->hasParsedSuccessfully = rj::getSafe(user, "id", this->user.id)))
|
if (!(this->hasParsedSuccessfully = rj::getSafe(user, "id", this->user.id)))
|
||||||
{
|
{
|
||||||
qDebug() << "No id found for user in reward";
|
qCDebug(chatterinoTwitch) << "No id found for user in reward";
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!(this->hasParsedSuccessfully =
|
if (!(this->hasParsedSuccessfully =
|
||||||
rj::getSafe(user, "login", this->user.login)))
|
rj::getSafe(user, "login", this->user.login)))
|
||||||
{
|
{
|
||||||
qDebug() << "No login name found for user in reward";
|
qCDebug(chatterinoTwitch) << "No login name found for user in reward";
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!(this->hasParsedSuccessfully =
|
if (!(this->hasParsedSuccessfully =
|
||||||
rj::getSafe(user, "display_name", this->user.displayName)))
|
rj::getSafe(user, "display_name", this->user.displayName)))
|
||||||
{
|
{
|
||||||
qDebug() << "No display name found for user in reward";
|
qCDebug(chatterinoTwitch) << "No display name found for user in reward";
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,199 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2020, Peter Thorson, Steve Wills. All rights reserved.
|
||||||
|
*
|
||||||
|
* Redistribution and use in source and binary forms, with or without
|
||||||
|
* modification, are permitted provided that the following conditions are met:
|
||||||
|
* * Redistributions of source code must retain the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer.
|
||||||
|
* * Redistributions in binary form must reproduce the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer in the
|
||||||
|
* documentation and/or other materials provided with the distribution.
|
||||||
|
* * Neither the name of the WebSocket++ Project nor the
|
||||||
|
* names of its contributors may be used to endorse or promote products
|
||||||
|
* derived from this software without specific prior written permission.
|
||||||
|
*
|
||||||
|
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||||
|
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||||
|
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||||
|
* ARE DISCLAIMED. IN NO EVENT SHALL PETER THORSON BE LIABLE FOR ANY
|
||||||
|
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||||
|
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||||
|
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||||
|
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||||
|
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||||
|
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef CHATTERINOWEBSOCKETPPLOGGER_HPP
|
||||||
|
#define CHATTERINOWEBSOCKETPPLOGGER_HPP
|
||||||
|
|
||||||
|
#include <string>
|
||||||
|
#include <websocketpp/common/cpp11.hpp>
|
||||||
|
#include <websocketpp/logger/basic.hpp>
|
||||||
|
#include <websocketpp/logger/levels.hpp>
|
||||||
|
#include "common/QLogging.hpp"
|
||||||
|
|
||||||
|
namespace websocketpp {
|
||||||
|
namespace log {
|
||||||
|
|
||||||
|
template <typename concurrency, typename names>
|
||||||
|
class chatterinowebsocketpplogger : public basic<concurrency, names>
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
typedef chatterinowebsocketpplogger<concurrency, names> base;
|
||||||
|
|
||||||
|
chatterinowebsocketpplogger<concurrency, names>(
|
||||||
|
channel_type_hint::value)
|
||||||
|
: m_static_channels(0xffffffff)
|
||||||
|
, m_dynamic_channels(0)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
chatterinowebsocketpplogger<concurrency, names>(std::ostream *)
|
||||||
|
: m_static_channels(0xffffffff)
|
||||||
|
, m_dynamic_channels(0)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
chatterinowebsocketpplogger<concurrency, names>(
|
||||||
|
level c, channel_type_hint::value)
|
||||||
|
: m_static_channels(c)
|
||||||
|
, m_dynamic_channels(0)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
chatterinowebsocketpplogger<concurrency, names>(level c, std::ostream *)
|
||||||
|
: m_static_channels(c)
|
||||||
|
, m_dynamic_channels(0)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
~chatterinowebsocketpplogger<concurrency, names>()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
chatterinowebsocketpplogger<concurrency, names>(
|
||||||
|
chatterinowebsocketpplogger<concurrency, names> const &other)
|
||||||
|
: m_static_channels(other.m_static_channels)
|
||||||
|
, m_dynamic_channels(other.m_dynamic_channels)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
#ifdef _WEBSOCKETPP_DEFAULT_DELETE_FUNCTIONS_
|
||||||
|
chatterinowebsocketpplogger<concurrency, names> &operator=(
|
||||||
|
chatterinowebsocketpplogger<concurrency, names> const &) = delete;
|
||||||
|
#endif // _WEBSOCKETPP_DEFAULT_DELETE_FUNCTIONS_
|
||||||
|
|
||||||
|
#ifdef _WEBSOCKETPP_MOVE_SEMANTICS_
|
||||||
|
/// Move constructor
|
||||||
|
chatterinowebsocketpplogger<concurrency, names>(
|
||||||
|
chatterinowebsocketpplogger<concurrency, names> &&other)
|
||||||
|
: m_static_channels(other.m_static_channels)
|
||||||
|
, m_dynamic_channels(other.m_dynamic_channels)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
# ifdef _WEBSOCKETPP_DEFAULT_DELETE_FUNCTIONS_
|
||||||
|
// no move assignment operator because of const member variables
|
||||||
|
chatterinowebsocketpplogger<concurrency, names> &operator=(
|
||||||
|
chatterinowebsocketpplogger<concurrency, names> &&) = delete;
|
||||||
|
# endif // _WEBSOCKETPP_DEFAULT_DELETE_FUNCTIONS_
|
||||||
|
#endif // _WEBSOCKETPP_MOVE_SEMANTICS_
|
||||||
|
|
||||||
|
/// Explicitly do nothing, this logger doesn't support changing ostream
|
||||||
|
void set_ostream(std::ostream *)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Dynamically enable the given list of channels
|
||||||
|
/**
|
||||||
|
* @param channels The package of channels to enable
|
||||||
|
*/
|
||||||
|
void set_channels(level channels)
|
||||||
|
{
|
||||||
|
if (channels == names::none)
|
||||||
|
{
|
||||||
|
clear_channels(names::all);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
scoped_lock_type lock(m_lock);
|
||||||
|
m_dynamic_channels |= (channels & m_static_channels);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Dynamically disable the given list of channels
|
||||||
|
/**
|
||||||
|
* @param channels The package of channels to disable
|
||||||
|
*/
|
||||||
|
void clear_channels(level channels)
|
||||||
|
{
|
||||||
|
scoped_lock_type lock(m_lock);
|
||||||
|
m_dynamic_channels &= ~channels;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Write a string message to the given channel
|
||||||
|
/**
|
||||||
|
* @param channel The channel to write to
|
||||||
|
* @param msg The message to write
|
||||||
|
*/
|
||||||
|
void write(level channel, std::string const &msg)
|
||||||
|
{
|
||||||
|
scoped_lock_type lock(m_lock);
|
||||||
|
if (!this->dynamic_test(channel))
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
qCDebug(chatterinoWebsocket).nospace()
|
||||||
|
<< names::channel_name(channel) << ": "
|
||||||
|
<< QString::fromStdString(msg);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Write a cstring message to the given channel
|
||||||
|
/**
|
||||||
|
* @param channel The channel to write to
|
||||||
|
* @param msg The message to write
|
||||||
|
*/
|
||||||
|
void write(level channel, char const *msg)
|
||||||
|
{
|
||||||
|
scoped_lock_type lock(m_lock);
|
||||||
|
if (!this->dynamic_test(channel))
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
qCDebug(chatterinoWebsocket).nospace()
|
||||||
|
<< names::channel_name(channel) << ": " << msg;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Test whether a channel is statically enabled
|
||||||
|
/**
|
||||||
|
* @param channel The package of channels to test
|
||||||
|
*/
|
||||||
|
|
||||||
|
_WEBSOCKETPP_CONSTEXPR_TOKEN_ bool static_test(level channel) const
|
||||||
|
{
|
||||||
|
return ((channel & m_static_channels) != 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Test whether a channel is dynamically enabled
|
||||||
|
/**
|
||||||
|
* @param channel The package of channels to test
|
||||||
|
*/
|
||||||
|
bool dynamic_test(level channel)
|
||||||
|
{
|
||||||
|
return ((channel & m_dynamic_channels) != 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected:
|
||||||
|
typedef typename concurrency::scoped_lock_type scoped_lock_type;
|
||||||
|
typedef typename concurrency::mutex_type mutex_type;
|
||||||
|
mutex_type m_lock;
|
||||||
|
|
||||||
|
private:
|
||||||
|
level const m_static_channels;
|
||||||
|
level m_dynamic_channels;
|
||||||
|
};
|
||||||
|
|
||||||
|
} // namespace log
|
||||||
|
} // namespace websocketpp
|
||||||
|
|
||||||
|
#endif // CHATTERINOWEBSOCKETPPLOGGER_HPP
|
||||||
@@ -1,6 +1,7 @@
|
|||||||
#include "IrcMessageHandler.hpp"
|
#include "IrcMessageHandler.hpp"
|
||||||
|
|
||||||
#include "Application.hpp"
|
#include "Application.hpp"
|
||||||
|
#include "common/QLogging.hpp"
|
||||||
#include "controllers/accounts/AccountController.hpp"
|
#include "controllers/accounts/AccountController.hpp"
|
||||||
#include "messages/LimitedQueue.hpp"
|
#include "messages/LimitedQueue.hpp"
|
||||||
#include "messages/Message.hpp"
|
#include "messages/Message.hpp"
|
||||||
@@ -361,8 +362,9 @@ void IrcMessageHandler::handleClearChatMessage(Communi::IrcMessage *message)
|
|||||||
|
|
||||||
if (chan->isEmpty())
|
if (chan->isEmpty())
|
||||||
{
|
{
|
||||||
qDebug() << "[IrcMessageHandler:handleClearChatMessage] Twitch channel"
|
qCDebug(chatterinoTwitch)
|
||||||
<< chanName << "not found";
|
<< "[IrcMessageHandler:handleClearChatMessage] Twitch channel"
|
||||||
|
<< chanName << "not found";
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -427,9 +429,10 @@ void IrcMessageHandler::handleClearMessageMessage(Communi::IrcMessage *message)
|
|||||||
|
|
||||||
if (chan->isEmpty())
|
if (chan->isEmpty())
|
||||||
{
|
{
|
||||||
qDebug() << "[IrcMessageHandler:handleClearMessageMessage] Twitch "
|
qCDebug(chatterinoTwitch)
|
||||||
"channel"
|
<< "[IrcMessageHandler:handleClearMessageMessage] Twitch "
|
||||||
<< chanName << "not found";
|
"channel"
|
||||||
|
<< chanName << "not found";
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -712,8 +715,9 @@ void IrcMessageHandler::handleNoticeMessage(Communi::IrcNoticeMessage *message)
|
|||||||
|
|
||||||
if (channel->isEmpty())
|
if (channel->isEmpty())
|
||||||
{
|
{
|
||||||
qDebug() << "[IrcManager:handleNoticeMessage] Channel"
|
qCDebug(chatterinoTwitch)
|
||||||
<< channelName << "not found in channel manager";
|
<< "[IrcManager:handleNoticeMessage] Channel" << channelName
|
||||||
|
<< "not found in channel manager";
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -8,7 +8,9 @@
|
|||||||
#include <rapidjson/error/en.h>
|
#include <rapidjson/error/en.h>
|
||||||
|
|
||||||
#include <exception>
|
#include <exception>
|
||||||
|
#include <iostream>
|
||||||
#include <thread>
|
#include <thread>
|
||||||
|
#include "common/QLogging.hpp"
|
||||||
|
|
||||||
#define TWITCH_PUBSUB_URL "wss://pubsub-edge.twitch.tv"
|
#define TWITCH_PUBSUB_URL "wss://pubsub-edge.twitch.tv"
|
||||||
|
|
||||||
@@ -154,7 +156,8 @@ namespace detail {
|
|||||||
|
|
||||||
if (self->awaitingPong_)
|
if (self->awaitingPong_)
|
||||||
{
|
{
|
||||||
qDebug() << "No pong response, disconnect!";
|
qCDebug(chatterinoPubsub)
|
||||||
|
<< "No pong response, disconnect!";
|
||||||
// TODO(pajlada): Label this connection as "disconnect me"
|
// TODO(pajlada): Label this connection as "disconnect me"
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@@ -178,8 +181,8 @@ namespace detail {
|
|||||||
|
|
||||||
if (ec)
|
if (ec)
|
||||||
{
|
{
|
||||||
qDebug() << "Error sending message" << payload << ":"
|
qCDebug(chatterinoPubsub) << "Error sending message" << payload
|
||||||
<< ec.message().c_str();
|
<< ":" << ec.message().c_str();
|
||||||
// TODO(pajlada): Check which error code happened and maybe
|
// TODO(pajlada): Check which error code happened and maybe
|
||||||
// gracefully handle it
|
// gracefully handle it
|
||||||
|
|
||||||
@@ -193,7 +196,7 @@ namespace detail {
|
|||||||
|
|
||||||
PubSub::PubSub()
|
PubSub::PubSub()
|
||||||
{
|
{
|
||||||
qDebug() << "init PubSub";
|
qCDebug(chatterinoPubsub) << "init PubSub";
|
||||||
|
|
||||||
this->moderationActionHandlers["clear"] = [this](const auto &data,
|
this->moderationActionHandlers["clear"] = [this](const auto &data,
|
||||||
const auto &roomID) {
|
const auto &roomID) {
|
||||||
@@ -221,7 +224,7 @@ PubSub::PubSub()
|
|||||||
|
|
||||||
if (!data.HasMember("args"))
|
if (!data.HasMember("args"))
|
||||||
{
|
{
|
||||||
qDebug() << "Missing required args member";
|
qCDebug(chatterinoPubsub) << "Missing required args member";
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -229,13 +232,14 @@ PubSub::PubSub()
|
|||||||
|
|
||||||
if (!args.IsArray())
|
if (!args.IsArray())
|
||||||
{
|
{
|
||||||
qDebug() << "args member must be an array";
|
qCDebug(chatterinoPubsub) << "args member must be an array";
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (args.Size() == 0)
|
if (args.Size() == 0)
|
||||||
{
|
{
|
||||||
qDebug() << "Missing duration argument in slowmode on";
|
qCDebug(chatterinoPubsub)
|
||||||
|
<< "Missing duration argument in slowmode on";
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -243,7 +247,7 @@ PubSub::PubSub()
|
|||||||
|
|
||||||
if (!durationArg.IsString())
|
if (!durationArg.IsString())
|
||||||
{
|
{
|
||||||
qDebug() << "Duration arg must be a string";
|
qCDebug(chatterinoPubsub) << "Duration arg must be a string";
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -336,7 +340,8 @@ PubSub::PubSub()
|
|||||||
}
|
}
|
||||||
catch (const std::runtime_error &ex)
|
catch (const std::runtime_error &ex)
|
||||||
{
|
{
|
||||||
qDebug() << "Error parsing moderation action:" << ex.what();
|
qCDebug(chatterinoPubsub)
|
||||||
|
<< "Error parsing moderation action:" << ex.what();
|
||||||
}
|
}
|
||||||
|
|
||||||
action.modded = false;
|
action.modded = false;
|
||||||
@@ -359,16 +364,18 @@ PubSub::PubSub()
|
|||||||
|
|
||||||
if (!getTargetUser(data, action.target))
|
if (!getTargetUser(data, action.target))
|
||||||
{
|
{
|
||||||
qDebug() << "Error parsing moderation action mod: Unable to get "
|
qCDebug(chatterinoPubsub)
|
||||||
"target_user_id";
|
<< "Error parsing moderation action mod: Unable to get "
|
||||||
|
"target_user_id";
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Load target name from message.data.target_user_login
|
// Load target name from message.data.target_user_login
|
||||||
if (!getTargetUserName(data, action.target))
|
if (!getTargetUserName(data, action.target))
|
||||||
{
|
{
|
||||||
qDebug() << "Error parsing moderation action mod: Unable to get "
|
qCDebug(chatterinoPubsub)
|
||||||
"target_user_name";
|
<< "Error parsing moderation action mod: Unable to get "
|
||||||
|
"target_user_name";
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -416,7 +423,8 @@ PubSub::PubSub()
|
|||||||
}
|
}
|
||||||
catch (const std::runtime_error &ex)
|
catch (const std::runtime_error &ex)
|
||||||
{
|
{
|
||||||
qDebug() << "Error parsing moderation action:" << ex.what();
|
qCDebug(chatterinoPubsub)
|
||||||
|
<< "Error parsing moderation action:" << ex.what();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -453,7 +461,8 @@ PubSub::PubSub()
|
|||||||
}
|
}
|
||||||
catch (const std::runtime_error &ex)
|
catch (const std::runtime_error &ex)
|
||||||
{
|
{
|
||||||
qDebug() << "Error parsing moderation action:" << ex.what();
|
qCDebug(chatterinoPubsub)
|
||||||
|
<< "Error parsing moderation action:" << ex.what();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -484,7 +493,8 @@ PubSub::PubSub()
|
|||||||
}
|
}
|
||||||
catch (const std::runtime_error &ex)
|
catch (const std::runtime_error &ex)
|
||||||
{
|
{
|
||||||
qDebug() << "Error parsing moderation action:" << ex.what();
|
qCDebug(chatterinoPubsub)
|
||||||
|
<< "Error parsing moderation action:" << ex.what();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -515,7 +525,8 @@ PubSub::PubSub()
|
|||||||
}
|
}
|
||||||
catch (const std::runtime_error &ex)
|
catch (const std::runtime_error &ex)
|
||||||
{
|
{
|
||||||
qDebug() << "Error parsing moderation action:" << ex.what();
|
qCDebug(chatterinoPubsub)
|
||||||
|
<< "Error parsing moderation action:" << ex.what();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -567,7 +578,8 @@ PubSub::PubSub()
|
|||||||
}
|
}
|
||||||
catch (const std::runtime_error &ex)
|
catch (const std::runtime_error &ex)
|
||||||
{
|
{
|
||||||
qDebug() << "Error parsing moderation action:" << ex.what();
|
qCDebug(chatterinoPubsub)
|
||||||
|
<< "Error parsing moderation action:" << ex.what();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -596,7 +608,8 @@ PubSub::PubSub()
|
|||||||
}
|
}
|
||||||
catch (const std::runtime_error &ex)
|
catch (const std::runtime_error &ex)
|
||||||
{
|
{
|
||||||
qDebug() << "Error parsing moderation action:" << ex.what();
|
qCDebug(chatterinoPubsub)
|
||||||
|
<< "Error parsing moderation action:" << ex.what();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -625,7 +638,8 @@ PubSub::PubSub()
|
|||||||
}
|
}
|
||||||
catch (const std::runtime_error &ex)
|
catch (const std::runtime_error &ex)
|
||||||
{
|
{
|
||||||
qDebug() << "Error parsing moderation action:" << ex.what();
|
qCDebug(chatterinoPubsub)
|
||||||
|
<< "Error parsing moderation action:" << ex.what();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -654,7 +668,8 @@ PubSub::PubSub()
|
|||||||
}
|
}
|
||||||
catch (const std::runtime_error &ex)
|
catch (const std::runtime_error &ex)
|
||||||
{
|
{
|
||||||
qDebug() << "Error parsing moderation action:" << ex.what();
|
qCDebug(chatterinoPubsub)
|
||||||
|
<< "Error parsing moderation action:" << ex.what();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -684,7 +699,8 @@ PubSub::PubSub()
|
|||||||
}
|
}
|
||||||
catch (const std::runtime_error &ex)
|
catch (const std::runtime_error &ex)
|
||||||
{
|
{
|
||||||
qDebug() << "Error parsing moderation action:" << ex.what();
|
qCDebug(chatterinoPubsub)
|
||||||
|
<< "Error parsing moderation action:" << ex.what();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -697,17 +713,20 @@ PubSub::PubSub()
|
|||||||
this->signals_.moderation.automodUserMessage.invoke(action);
|
this->signals_.moderation.automodUserMessage.invoke(action);
|
||||||
};
|
};
|
||||||
|
|
||||||
this->moderationActionHandlers["denied_automod_message"] =
|
this->moderationActionHandlers["denied_automod_message"] = [](const auto
|
||||||
[](const auto &data, const auto &roomID) {
|
&data,
|
||||||
// This message got denied by a moderator
|
const auto
|
||||||
// qDebug() << QString::fromStdString(rj::stringify(data));
|
&roomID) {
|
||||||
};
|
// This message got denied by a moderator
|
||||||
|
// qCDebug(chatterinoPubsub) << QString::fromStdString(rj::stringify(data));
|
||||||
|
};
|
||||||
|
|
||||||
this->moderationActionHandlers["approved_automod_message"] =
|
this->moderationActionHandlers
|
||||||
[](const auto &data, const auto &roomID) {
|
["approved_automod_message"] = [](const auto &data,
|
||||||
// This message got approved by a moderator
|
const auto &roomID) {
|
||||||
// qDebug() << QString::fromStdString(rj::stringify(data));
|
// This message got approved by a moderator
|
||||||
};
|
// qCDebug(chatterinoPubsub) << QString::fromStdString(rj::stringify(data));
|
||||||
|
};
|
||||||
|
|
||||||
this->websocketClient.set_access_channels(websocketpp::log::alevel::all);
|
this->websocketClient.set_access_channels(websocketpp::log::alevel::all);
|
||||||
this->websocketClient.clear_access_channels(
|
this->websocketClient.clear_access_channels(
|
||||||
@@ -737,7 +756,8 @@ void PubSub::addClient()
|
|||||||
|
|
||||||
if (ec)
|
if (ec)
|
||||||
{
|
{
|
||||||
qDebug() << "Unable to establish connection:" << ec.message().c_str();
|
qCDebug(chatterinoPubsub)
|
||||||
|
<< "Unable to establish connection:" << ec.message().c_str();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -758,7 +778,7 @@ void PubSub::listenToWhispers(std::shared_ptr<TwitchAccount> account)
|
|||||||
|
|
||||||
auto userID = account->getUserId();
|
auto userID = account->getUserId();
|
||||||
|
|
||||||
qDebug() << "Connection open!";
|
qCDebug(chatterinoPubsub) << "Connection open!";
|
||||||
websocketpp::lib::error_code ec;
|
websocketpp::lib::error_code ec;
|
||||||
|
|
||||||
std::vector<QString> topics({topicFormat.arg(userID)});
|
std::vector<QString> topics({topicFormat.arg(userID)});
|
||||||
@@ -767,8 +787,9 @@ void PubSub::listenToWhispers(std::shared_ptr<TwitchAccount> account)
|
|||||||
|
|
||||||
if (ec)
|
if (ec)
|
||||||
{
|
{
|
||||||
qDebug() << "Unable to send message to websocket server:"
|
qCDebug(chatterinoPubsub)
|
||||||
<< ec.message().c_str();
|
<< "Unable to send message to websocket server:"
|
||||||
|
<< ec.message().c_str();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -799,7 +820,7 @@ void PubSub::listenToChannelModerationActions(
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
qDebug() << "Listen to topic" << topic;
|
qCDebug(chatterinoPubsub) << "Listen to topic" << topic;
|
||||||
|
|
||||||
this->listenToTopic(topic, account);
|
this->listenToTopic(topic, account);
|
||||||
}
|
}
|
||||||
@@ -818,8 +839,7 @@ void PubSub::listenToChannelPointRewards(const QString &channelID,
|
|||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
qCDebug(chatterinoPubsub) << "Listen to topic" << topic;
|
||||||
qDebug() << "Listen to topic" << topic;
|
|
||||||
|
|
||||||
this->listenToTopic(topic, account);
|
this->listenToTopic(topic, account);
|
||||||
}
|
}
|
||||||
@@ -884,16 +904,18 @@ void PubSub::onMessage(websocketpp::connection_hdl hdl,
|
|||||||
|
|
||||||
if (!res)
|
if (!res)
|
||||||
{
|
{
|
||||||
qDebug() << "Error parsing message '" << payload.c_str()
|
qCDebug(chatterinoPubsub)
|
||||||
<< "' from PubSub:" << rapidjson::GetParseError_En(res.Code());
|
<< "Error parsing message '" << payload.c_str()
|
||||||
|
<< "' from PubSub:" << rapidjson::GetParseError_En(res.Code());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!msg.IsObject())
|
if (!msg.IsObject())
|
||||||
{
|
{
|
||||||
qDebug() << "Error parsing message '" << payload.c_str()
|
qCDebug(chatterinoPubsub)
|
||||||
<< "' from PubSub. Root object is not an "
|
<< "Error parsing message '" << payload.c_str()
|
||||||
"object";
|
<< "' from PubSub. Root object is not an "
|
||||||
|
"object";
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -901,7 +923,8 @@ void PubSub::onMessage(websocketpp::connection_hdl hdl,
|
|||||||
|
|
||||||
if (!rj::getSafe(msg, "type", type))
|
if (!rj::getSafe(msg, "type", type))
|
||||||
{
|
{
|
||||||
qDebug() << "Missing required string member `type` in message root";
|
qCDebug(chatterinoPubsub)
|
||||||
|
<< "Missing required string member `type` in message root";
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -913,7 +936,8 @@ void PubSub::onMessage(websocketpp::connection_hdl hdl,
|
|||||||
{
|
{
|
||||||
if (!msg.HasMember("data"))
|
if (!msg.HasMember("data"))
|
||||||
{
|
{
|
||||||
qDebug() << "Missing required object member `data` in message root";
|
qCDebug(chatterinoPubsub)
|
||||||
|
<< "Missing required object member `data` in message root";
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -921,7 +945,7 @@ void PubSub::onMessage(websocketpp::connection_hdl hdl,
|
|||||||
|
|
||||||
if (!data.IsObject())
|
if (!data.IsObject())
|
||||||
{
|
{
|
||||||
qDebug() << "Member `data` must be an object";
|
qCDebug(chatterinoPubsub) << "Member `data` must be an object";
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -941,7 +965,7 @@ void PubSub::onMessage(websocketpp::connection_hdl hdl,
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
qDebug() << "Unknown message type:" << type;
|
qCDebug(chatterinoPubsub) << "Unknown message type:" << type;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1002,7 +1026,8 @@ PubSub::WebsocketContextPtr PubSub::onTLSInit(websocketpp::connection_hdl hdl)
|
|||||||
}
|
}
|
||||||
catch (const std::exception &e)
|
catch (const std::exception &e)
|
||||||
{
|
{
|
||||||
qDebug() << "Exception caught in OnTLSInit:" << e.what();
|
qCDebug(chatterinoPubsub)
|
||||||
|
<< "Exception caught in OnTLSInit:" << e.what();
|
||||||
}
|
}
|
||||||
|
|
||||||
return ctx;
|
return ctx;
|
||||||
@@ -1019,12 +1044,14 @@ void PubSub::handleListenResponse(const rapidjson::Document &msg)
|
|||||||
|
|
||||||
if (error.isEmpty())
|
if (error.isEmpty())
|
||||||
{
|
{
|
||||||
qDebug() << "Successfully listened to nonce" << nonce;
|
qCDebug(chatterinoPubsub)
|
||||||
|
<< "Successfully listened to nonce" << nonce;
|
||||||
// Nothing went wrong
|
// Nothing went wrong
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
qDebug() << "PubSub error:" << error << "on nonce" << nonce;
|
qCDebug(chatterinoPubsub)
|
||||||
|
<< "PubSub error:" << error << "on nonce" << nonce;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1035,7 +1062,8 @@ void PubSub::handleMessageResponse(const rapidjson::Value &outerData)
|
|||||||
|
|
||||||
if (!rj::getSafe(outerData, "topic", topic))
|
if (!rj::getSafe(outerData, "topic", topic))
|
||||||
{
|
{
|
||||||
qDebug() << "Missing required string member `topic` in outerData";
|
qCDebug(chatterinoPubsub)
|
||||||
|
<< "Missing required string member `topic` in outerData";
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1043,7 +1071,7 @@ void PubSub::handleMessageResponse(const rapidjson::Value &outerData)
|
|||||||
|
|
||||||
if (!rj::getSafe(outerData, "message", payload))
|
if (!rj::getSafe(outerData, "message", payload))
|
||||||
{
|
{
|
||||||
qDebug() << "Expected string message in outerData";
|
qCDebug(chatterinoPubsub) << "Expected string message in outerData";
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1053,8 +1081,9 @@ void PubSub::handleMessageResponse(const rapidjson::Value &outerData)
|
|||||||
|
|
||||||
if (!res)
|
if (!res)
|
||||||
{
|
{
|
||||||
qDebug() << "Error parsing message '" << payload.c_str()
|
qCDebug(chatterinoPubsub)
|
||||||
<< "' from PubSub:" << rapidjson::GetParseError_En(res.Code());
|
<< "Error parsing message '" << payload.c_str()
|
||||||
|
<< "' from PubSub:" << rapidjson::GetParseError_En(res.Code());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1064,7 +1093,7 @@ void PubSub::handleMessageResponse(const rapidjson::Value &outerData)
|
|||||||
|
|
||||||
if (!rj::getSafe(msg, "type", whisperType))
|
if (!rj::getSafe(msg, "type", whisperType))
|
||||||
{
|
{
|
||||||
qDebug() << "Bad whisper data";
|
qCDebug(chatterinoPubsub) << "Bad whisper data";
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1082,7 +1111,8 @@ void PubSub::handleMessageResponse(const rapidjson::Value &outerData)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
qDebug() << "Invalid whisper type:" << whisperType.c_str();
|
qCDebug(chatterinoPubsub)
|
||||||
|
<< "Invalid whisper type:" << whisperType.c_str();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1096,8 +1126,8 @@ void PubSub::handleMessageResponse(const rapidjson::Value &outerData)
|
|||||||
|
|
||||||
if (!rj::getSafe(data, "moderation_action", moderationAction))
|
if (!rj::getSafe(data, "moderation_action", moderationAction))
|
||||||
{
|
{
|
||||||
qDebug() << "Missing moderation action in data:"
|
qCDebug(chatterinoPubsub) << "Missing moderation action in data:"
|
||||||
<< rj::stringify(data).c_str();
|
<< rj::stringify(data).c_str();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1105,8 +1135,9 @@ void PubSub::handleMessageResponse(const rapidjson::Value &outerData)
|
|||||||
|
|
||||||
if (handlerIt == this->moderationActionHandlers.end())
|
if (handlerIt == this->moderationActionHandlers.end())
|
||||||
{
|
{
|
||||||
qDebug() << "No handler found for moderation action"
|
qCDebug(chatterinoPubsub)
|
||||||
<< moderationAction.c_str();
|
<< "No handler found for moderation action"
|
||||||
|
<< moderationAction.c_str();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1118,7 +1149,7 @@ void PubSub::handleMessageResponse(const rapidjson::Value &outerData)
|
|||||||
std::string pointEventType;
|
std::string pointEventType;
|
||||||
if (!rj::getSafe(msg, "type", pointEventType))
|
if (!rj::getSafe(msg, "type", pointEventType))
|
||||||
{
|
{
|
||||||
qDebug() << "Bad channel point event data";
|
qCDebug(chatterinoPubsub) << "Bad channel point event data";
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1126,33 +1157,36 @@ void PubSub::handleMessageResponse(const rapidjson::Value &outerData)
|
|||||||
{
|
{
|
||||||
if (!rj::getSafeObject(msg, "data", msg))
|
if (!rj::getSafeObject(msg, "data", msg))
|
||||||
{
|
{
|
||||||
qDebug() << "No data found for redeemed reward";
|
qCDebug(chatterinoPubsub)
|
||||||
|
<< "No data found for redeemed reward";
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (!rj::getSafeObject(msg, "redemption", msg))
|
if (!rj::getSafeObject(msg, "redemption", msg))
|
||||||
{
|
{
|
||||||
qDebug() << "No redemption info found for redeemed reward";
|
qCDebug(chatterinoPubsub)
|
||||||
|
<< "No redemption info found for redeemed reward";
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
this->signals_.pointReward.redeemed.invoke(msg);
|
this->signals_.pointReward.redeemed.invoke(msg);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
qDebug() << "Invalid point event type:" << pointEventType.c_str();
|
qCDebug(chatterinoPubsub)
|
||||||
|
<< "Invalid point event type:" << pointEventType.c_str();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
qDebug() << "Unknown topic:" << topic;
|
qCDebug(chatterinoPubsub) << "Unknown topic:" << topic;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void PubSub::runThread()
|
void PubSub::runThread()
|
||||||
{
|
{
|
||||||
qDebug() << "Start pubsub manager thread";
|
qCDebug(chatterinoPubsub) << "Start pubsub manager thread";
|
||||||
this->websocketClient.run();
|
this->websocketClient.run();
|
||||||
qDebug() << "Done with pubsub manager thread";
|
qCDebug(chatterinoPubsub) << "Done with pubsub manager thread";
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace chatterino
|
} // namespace chatterino
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
#include "providers/twitch/ChatterinoWebSocketppLogger.hpp"
|
||||||
#include "providers/twitch/PubsubActions.hpp"
|
#include "providers/twitch/PubsubActions.hpp"
|
||||||
#include "providers/twitch/TwitchAccount.hpp"
|
#include "providers/twitch/TwitchAccount.hpp"
|
||||||
#include "providers/twitch/TwitchIrcServer.hpp"
|
#include "providers/twitch/TwitchIrcServer.hpp"
|
||||||
@@ -9,6 +10,8 @@
|
|||||||
#include <pajlada/signals/signal.hpp>
|
#include <pajlada/signals/signal.hpp>
|
||||||
#include <websocketpp/client.hpp>
|
#include <websocketpp/client.hpp>
|
||||||
#include <websocketpp/config/asio_client.hpp>
|
#include <websocketpp/config/asio_client.hpp>
|
||||||
|
#include <websocketpp/extensions/permessage_deflate/disabled.hpp>
|
||||||
|
#include <websocketpp/logger/basic.hpp>
|
||||||
|
|
||||||
#include <atomic>
|
#include <atomic>
|
||||||
#include <chrono>
|
#include <chrono>
|
||||||
@@ -21,8 +24,23 @@
|
|||||||
|
|
||||||
namespace chatterino {
|
namespace chatterino {
|
||||||
|
|
||||||
using WebsocketClient =
|
struct chatterinoconfig : public websocketpp::config::asio_tls_client {
|
||||||
websocketpp::client<websocketpp::config::asio_tls_client>;
|
typedef websocketpp::log::chatterinowebsocketpplogger<
|
||||||
|
concurrency_type, websocketpp::log::elevel>
|
||||||
|
elog_type;
|
||||||
|
typedef websocketpp::log::chatterinowebsocketpplogger<
|
||||||
|
concurrency_type, websocketpp::log::alevel>
|
||||||
|
alog_type;
|
||||||
|
|
||||||
|
struct permessage_deflate_config {
|
||||||
|
};
|
||||||
|
|
||||||
|
typedef websocketpp::extensions::permessage_deflate::disabled<
|
||||||
|
permessage_deflate_config>
|
||||||
|
permessage_deflate_type;
|
||||||
|
};
|
||||||
|
|
||||||
|
using WebsocketClient = websocketpp::client<chatterinoconfig>;
|
||||||
using WebsocketHandle = websocketpp::connection_hdl;
|
using WebsocketHandle = websocketpp::connection_hdl;
|
||||||
using WebsocketErrorCode = websocketpp::lib::error_code;
|
using WebsocketErrorCode = websocketpp::lib::error_code;
|
||||||
|
|
||||||
|
|||||||
@@ -3,6 +3,7 @@
|
|||||||
#include <boost/asio.hpp>
|
#include <boost/asio.hpp>
|
||||||
#include <boost/asio/steady_timer.hpp>
|
#include <boost/asio/steady_timer.hpp>
|
||||||
#include <memory>
|
#include <memory>
|
||||||
|
#include "common/QLogging.hpp"
|
||||||
#include "util/RapidjsonHelpers.hpp"
|
#include "util/RapidjsonHelpers.hpp"
|
||||||
|
|
||||||
namespace chatterino {
|
namespace chatterino {
|
||||||
@@ -34,7 +35,8 @@ void runAfter(boost::asio::io_service &ioService, Duration duration,
|
|||||||
timer->async_wait([timer, cb](const boost::system::error_code &ec) {
|
timer->async_wait([timer, cb](const boost::system::error_code &ec) {
|
||||||
if (ec)
|
if (ec)
|
||||||
{
|
{
|
||||||
qDebug() << "Error in runAfter:" << ec.message().c_str();
|
qCDebug(chatterinoPubsub)
|
||||||
|
<< "Error in runAfter:" << ec.message().c_str();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -52,7 +54,8 @@ void runAfter(std::shared_ptr<boost::asio::steady_timer> timer,
|
|||||||
timer->async_wait([timer, cb](const boost::system::error_code &ec) {
|
timer->async_wait([timer, cb](const boost::system::error_code &ec) {
|
||||||
if (ec)
|
if (ec)
|
||||||
{
|
{
|
||||||
qDebug() << "Error in runAfter:" << ec.message().c_str();
|
qCDebug(chatterinoPubsub)
|
||||||
|
<< "Error in runAfter:" << ec.message().c_str();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -6,6 +6,7 @@
|
|||||||
#include "common/Env.hpp"
|
#include "common/Env.hpp"
|
||||||
#include "common/NetworkRequest.hpp"
|
#include "common/NetworkRequest.hpp"
|
||||||
#include "common/Outcome.hpp"
|
#include "common/Outcome.hpp"
|
||||||
|
#include "common/QLogging.hpp"
|
||||||
#include "providers/twitch/TwitchCommon.hpp"
|
#include "providers/twitch/TwitchCommon.hpp"
|
||||||
#include "providers/twitch/api/Helix.hpp"
|
#include "providers/twitch/api/Helix.hpp"
|
||||||
#include "singletons/Emotes.hpp"
|
#include "singletons/Emotes.hpp"
|
||||||
@@ -133,8 +134,9 @@ void TwitchAccount::loadIgnores()
|
|||||||
TwitchUser ignoredUser;
|
TwitchUser ignoredUser;
|
||||||
if (!rj::getSafe(userIt->value, ignoredUser))
|
if (!rj::getSafe(userIt->value, ignoredUser))
|
||||||
{
|
{
|
||||||
qDebug() << "Error parsing twitch user JSON"
|
qCWarning(chatterinoTwitch)
|
||||||
<< rj::stringify(userIt->value).c_str();
|
<< "Error parsing twitch user JSON"
|
||||||
|
<< rj::stringify(userIt->value).c_str();
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -338,14 +340,15 @@ std::set<TwitchUser> TwitchAccount::getIgnores() const
|
|||||||
|
|
||||||
void TwitchAccount::loadEmotes()
|
void TwitchAccount::loadEmotes()
|
||||||
{
|
{
|
||||||
qDebug() << "Loading Twitch emotes for user" << this->getUserName();
|
qCDebug(chatterinoTwitch)
|
||||||
|
<< "Loading Twitch emotes for user" << this->getUserName();
|
||||||
|
|
||||||
const auto &clientID = this->getOAuthClient();
|
const auto &clientID = this->getOAuthClient();
|
||||||
const auto &oauthToken = this->getOAuthToken();
|
const auto &oauthToken = this->getOAuthToken();
|
||||||
|
|
||||||
if (clientID.isEmpty() || oauthToken.isEmpty())
|
if (clientID.isEmpty() || oauthToken.isEmpty())
|
||||||
{
|
{
|
||||||
qDebug() << "Missing Client ID or OAuth token";
|
qCDebug(chatterinoTwitch) << "Missing Client ID or OAuth token";
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -356,7 +359,8 @@ void TwitchAccount::loadEmotes()
|
|||||||
|
|
||||||
.authorizeTwitchV5(this->getOAuthClient(), this->getOAuthToken())
|
.authorizeTwitchV5(this->getOAuthClient(), this->getOAuthToken())
|
||||||
.onError([=](NetworkResult result) {
|
.onError([=](NetworkResult result) {
|
||||||
qDebug() << "[TwitchAccount::loadEmotes] Error" << result.status();
|
qCWarning(chatterinoTwitch)
|
||||||
|
<< "[TwitchAccount::loadEmotes] Error" << result.status();
|
||||||
if (result.status() == 203)
|
if (result.status() == 203)
|
||||||
{
|
{
|
||||||
// onFinished(FollowResult_NotFollowing);
|
// onFinished(FollowResult_NotFollowing);
|
||||||
@@ -394,8 +398,8 @@ void TwitchAccount::autoModAllow(const QString msgID)
|
|||||||
|
|
||||||
.authorizeTwitchV5(this->getOAuthClient(), this->getOAuthToken())
|
.authorizeTwitchV5(this->getOAuthClient(), this->getOAuthToken())
|
||||||
.onError([=](NetworkResult result) {
|
.onError([=](NetworkResult result) {
|
||||||
qDebug() << "[TwitchAccounts::autoModAllow] Error"
|
qCWarning(chatterinoTwitch)
|
||||||
<< result.status();
|
<< "[TwitchAccounts::autoModAllow] Error" << result.status();
|
||||||
})
|
})
|
||||||
.execute();
|
.execute();
|
||||||
}
|
}
|
||||||
@@ -413,8 +417,8 @@ void TwitchAccount::autoModDeny(const QString msgID)
|
|||||||
|
|
||||||
.authorizeTwitchV5(this->getOAuthClient(), this->getOAuthToken())
|
.authorizeTwitchV5(this->getOAuthClient(), this->getOAuthToken())
|
||||||
.onError([=](NetworkResult result) {
|
.onError([=](NetworkResult result) {
|
||||||
qDebug() << "[TwitchAccounts::autoModDeny] Error"
|
qCWarning(chatterinoTwitch)
|
||||||
<< result.status();
|
<< "[TwitchAccounts::autoModDeny] Error" << result.status();
|
||||||
})
|
})
|
||||||
.execute();
|
.execute();
|
||||||
}
|
}
|
||||||
@@ -429,7 +433,8 @@ void TwitchAccount::parseEmotes(const rapidjson::Document &root)
|
|||||||
auto emoticonSets = root.FindMember("emoticon_sets");
|
auto emoticonSets = root.FindMember("emoticon_sets");
|
||||||
if (emoticonSets == root.MemberEnd() || !emoticonSets->value.IsObject())
|
if (emoticonSets == root.MemberEnd() || !emoticonSets->value.IsObject())
|
||||||
{
|
{
|
||||||
qDebug() << "No emoticon_sets in load emotes response";
|
qCWarning(chatterinoTwitch)
|
||||||
|
<< "No emoticon_sets in load emotes response";
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -445,21 +450,22 @@ void TwitchAccount::parseEmotes(const rapidjson::Document &root)
|
|||||||
{
|
{
|
||||||
if (!emoteJSON.IsObject())
|
if (!emoteJSON.IsObject())
|
||||||
{
|
{
|
||||||
qDebug() << "Emote value was invalid";
|
qCWarning(chatterinoTwitch) << "Emote value was invalid";
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint64_t idNumber;
|
uint64_t idNumber;
|
||||||
if (!rj::getSafe(emoteJSON, "id", idNumber))
|
if (!rj::getSafe(emoteJSON, "id", idNumber))
|
||||||
{
|
{
|
||||||
qDebug() << "No ID key found in Emote value";
|
qCWarning(chatterinoTwitch) << "No ID key found in Emote value";
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
QString _code;
|
QString _code;
|
||||||
if (!rj::getSafe(emoteJSON, "code", _code))
|
if (!rj::getSafe(emoteJSON, "code", _code))
|
||||||
{
|
{
|
||||||
qDebug() << "No code key found in Emote value";
|
qCWarning(chatterinoTwitch)
|
||||||
|
<< "No code key found in Emote value";
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -486,7 +492,7 @@ void TwitchAccount::loadEmoteSetData(std::shared_ptr<EmoteSet> emoteSet)
|
|||||||
{
|
{
|
||||||
if (!emoteSet)
|
if (!emoteSet)
|
||||||
{
|
{
|
||||||
qDebug() << "null emote set sent";
|
qCWarning(chatterinoTwitch) << "null emote set sent";
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -502,8 +508,8 @@ void TwitchAccount::loadEmoteSetData(std::shared_ptr<EmoteSet> emoteSet)
|
|||||||
NetworkRequest(Env::get().twitchEmoteSetResolverUrl.arg(emoteSet->key))
|
NetworkRequest(Env::get().twitchEmoteSetResolverUrl.arg(emoteSet->key))
|
||||||
.cache()
|
.cache()
|
||||||
.onError([](NetworkResult result) {
|
.onError([](NetworkResult result) {
|
||||||
qDebug() << "Error code" << result.status()
|
qCWarning(chatterinoTwitch) << "Error code" << result.status()
|
||||||
<< "while loading emote set data";
|
<< "while loading emote set data";
|
||||||
})
|
})
|
||||||
.onSuccess([emoteSet](auto result) -> Outcome {
|
.onSuccess([emoteSet](auto result) -> Outcome {
|
||||||
auto root = result.parseRapidJson();
|
auto root = result.parseRapidJson();
|
||||||
@@ -525,7 +531,8 @@ void TwitchAccount::loadEmoteSetData(std::shared_ptr<EmoteSet> emoteSet)
|
|||||||
return Failure;
|
return Failure;
|
||||||
}
|
}
|
||||||
|
|
||||||
qDebug() << "Loaded twitch emote set data for" << emoteSet->key;
|
qCDebug(chatterinoTwitch)
|
||||||
|
<< "Loaded twitch emote set data for" << emoteSet->key;
|
||||||
|
|
||||||
auto name = channelName;
|
auto name = channelName;
|
||||||
name.detach();
|
name.detach();
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
#include "providers/twitch/TwitchAccountManager.hpp"
|
#include "providers/twitch/TwitchAccountManager.hpp"
|
||||||
|
|
||||||
#include "common/Common.hpp"
|
#include "common/Common.hpp"
|
||||||
|
#include "common/QLogging.hpp"
|
||||||
#include "providers/twitch/TwitchAccount.hpp"
|
#include "providers/twitch/TwitchAccount.hpp"
|
||||||
#include "providers/twitch/TwitchCommon.hpp"
|
#include "providers/twitch/TwitchCommon.hpp"
|
||||||
#include "providers/twitch/api/Helix.hpp"
|
#include "providers/twitch/api/Helix.hpp"
|
||||||
@@ -105,23 +106,26 @@ void TwitchAccountManager::reloadUsers()
|
|||||||
switch (this->addUser(userData))
|
switch (this->addUser(userData))
|
||||||
{
|
{
|
||||||
case AddUserResponse::UserAlreadyExists: {
|
case AddUserResponse::UserAlreadyExists: {
|
||||||
qDebug() << "User" << userData.username << "already exists";
|
qCDebug(chatterinoTwitch)
|
||||||
|
<< "User" << userData.username << "already exists";
|
||||||
// Do nothing
|
// Do nothing
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case AddUserResponse::UserValuesUpdated: {
|
case AddUserResponse::UserValuesUpdated: {
|
||||||
qDebug() << "User" << userData.username
|
qCDebug(chatterinoTwitch)
|
||||||
<< "already exists, and values updated!";
|
<< "User" << userData.username
|
||||||
|
<< "already exists, and values updated!";
|
||||||
if (userData.username == this->getCurrent()->getUserName())
|
if (userData.username == this->getCurrent()->getUserName())
|
||||||
{
|
{
|
||||||
qDebug() << "It was the current user, so we need to "
|
qCDebug(chatterinoTwitch)
|
||||||
"reconnect stuff!";
|
<< "It was the current user, so we need to "
|
||||||
|
"reconnect stuff!";
|
||||||
this->currentUserChanged.invoke();
|
this->currentUserChanged.invoke();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case AddUserResponse::UserAdded: {
|
case AddUserResponse::UserAdded: {
|
||||||
qDebug() << "Added user" << userData.username;
|
qCDebug(chatterinoTwitch) << "Added user" << userData.username;
|
||||||
listUpdated = true;
|
listUpdated = true;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@@ -142,14 +146,15 @@ void TwitchAccountManager::load()
|
|||||||
auto user = this->findUserByUsername(newUsername);
|
auto user = this->findUserByUsername(newUsername);
|
||||||
if (user)
|
if (user)
|
||||||
{
|
{
|
||||||
qDebug() << "Twitch user updated to" << newUsername;
|
qCDebug(chatterinoTwitch)
|
||||||
|
<< "Twitch user updated to" << newUsername;
|
||||||
getHelix()->update(user->getOAuthClient(), user->getOAuthToken());
|
getHelix()->update(user->getOAuthClient(), user->getOAuthToken());
|
||||||
getKraken()->update(user->getOAuthClient(), user->getOAuthToken());
|
getKraken()->update(user->getOAuthClient(), user->getOAuthToken());
|
||||||
this->currentUser_ = user;
|
this->currentUser_ = user;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
qDebug() << "Twitch user updated to anonymous";
|
qCDebug(chatterinoTwitch) << "Twitch user updated to anonymous";
|
||||||
this->currentUser_ = this->anonymousUser_;
|
this->currentUser_ = this->anonymousUser_;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -31,6 +31,7 @@
|
|||||||
#include <QJsonValue>
|
#include <QJsonValue>
|
||||||
#include <QThread>
|
#include <QThread>
|
||||||
#include <QTimer>
|
#include <QTimer>
|
||||||
|
#include "common/QLogging.hpp"
|
||||||
|
|
||||||
namespace chatterino {
|
namespace chatterino {
|
||||||
namespace {
|
namespace {
|
||||||
@@ -148,7 +149,7 @@ TwitchChannel::TwitchChannel(const QString &name,
|
|||||||
, mod_(false)
|
, mod_(false)
|
||||||
, titleRefreshedTime_(QTime::currentTime().addSecs(-TITLE_REFRESH_PERIOD))
|
, titleRefreshedTime_(QTime::currentTime().addSecs(-TITLE_REFRESH_PERIOD))
|
||||||
{
|
{
|
||||||
qDebug() << "[TwitchChannel" << name << "] Opened";
|
qCDebug(chatterinoTwitch) << "[TwitchChannel" << name << "] Opened";
|
||||||
|
|
||||||
this->liveStatusChanged.connect([this]() {
|
this->liveStatusChanged.connect([this]() {
|
||||||
if (this->isLive() == 1)
|
if (this->isLive() == 1)
|
||||||
@@ -305,8 +306,8 @@ void TwitchChannel::sendMessage(const QString &message)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
qDebug() << "[TwitchChannel" << this->getName()
|
qCDebug(chatterinoTwitch)
|
||||||
<< "] Send message:" << message;
|
<< "[TwitchChannel" << this->getName() << "] Send message:" << message;
|
||||||
|
|
||||||
// Do last message processing
|
// Do last message processing
|
||||||
QString parsedMessage = app->emotes->emojis.replaceShortCodes(message);
|
QString parsedMessage = app->emotes->emojis.replaceShortCodes(message);
|
||||||
@@ -334,7 +335,7 @@ void TwitchChannel::sendMessage(const QString &message)
|
|||||||
|
|
||||||
if (messageSent)
|
if (messageSent)
|
||||||
{
|
{
|
||||||
qDebug() << "sent";
|
qCDebug(chatterinoTwitch) << "sent";
|
||||||
this->lastSentMessage_ = parsedMessage;
|
this->lastSentMessage_ = parsedMessage;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -593,8 +594,8 @@ void TwitchChannel::refreshLiveStatus()
|
|||||||
|
|
||||||
if (roomID.isEmpty())
|
if (roomID.isEmpty())
|
||||||
{
|
{
|
||||||
qDebug() << "[TwitchChannel" << this->getName()
|
qCDebug(chatterinoTwitch) << "[TwitchChannel" << this->getName()
|
||||||
<< "] Refreshing live status (Missing ID)";
|
<< "] Refreshing live status (Missing ID)";
|
||||||
this->setLive(false);
|
this->setLive(false);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -908,7 +909,8 @@ boost::optional<CheerEmote> TwitchChannel::cheerEmote(const QString &string)
|
|||||||
int bitAmount = amount.toInt(&ok);
|
int bitAmount = amount.toInt(&ok);
|
||||||
if (!ok)
|
if (!ok)
|
||||||
{
|
{
|
||||||
qDebug() << "Error parsing bit amount in cheerEmote";
|
qCDebug(chatterinoTwitch)
|
||||||
|
<< "Error parsing bit amount in cheerEmote";
|
||||||
}
|
}
|
||||||
for (const auto &emote : set.cheerEmotes)
|
for (const auto &emote : set.cheerEmotes)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
#include "providers/twitch/TwitchHelpers.hpp"
|
#include "providers/twitch/TwitchHelpers.hpp"
|
||||||
|
#include "common/QLogging.hpp"
|
||||||
|
|
||||||
namespace chatterino {
|
namespace chatterino {
|
||||||
|
|
||||||
@@ -6,7 +7,7 @@ bool trimChannelName(const QString &channelName, QString &outChannelName)
|
|||||||
{
|
{
|
||||||
if (channelName.length() < 2)
|
if (channelName.length() < 2)
|
||||||
{
|
{
|
||||||
qDebug() << "channel name length below 2";
|
qCDebug(chatterinoTwitch) << "channel name length below 2";
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -6,6 +6,7 @@
|
|||||||
#include "Application.hpp"
|
#include "Application.hpp"
|
||||||
#include "common/Common.hpp"
|
#include "common/Common.hpp"
|
||||||
#include "common/Env.hpp"
|
#include "common/Env.hpp"
|
||||||
|
#include "common/QLogging.hpp"
|
||||||
#include "controllers/accounts/AccountController.hpp"
|
#include "controllers/accounts/AccountController.hpp"
|
||||||
#include "messages/Message.hpp"
|
#include "messages/Message.hpp"
|
||||||
#include "messages/MessageBuilder.hpp"
|
#include "messages/MessageBuilder.hpp"
|
||||||
@@ -55,7 +56,7 @@ void TwitchIrcServer::initializeConnection(IrcConnection *connection,
|
|||||||
std::shared_ptr<TwitchAccount> account =
|
std::shared_ptr<TwitchAccount> account =
|
||||||
getApp()->accounts->twitch.getCurrent();
|
getApp()->accounts->twitch.getCurrent();
|
||||||
|
|
||||||
qDebug() << "logging in as" << account->getUserName();
|
qCDebug(chatterinoTwitch) << "logging in as" << account->getUserName();
|
||||||
|
|
||||||
QString username = account->getUserName();
|
QString username = account->getUserName();
|
||||||
QString oauthToken = account->getOAuthToken();
|
QString oauthToken = account->getOAuthToken();
|
||||||
|
|||||||
@@ -25,6 +25,7 @@
|
|||||||
#include <QMediaPlayer>
|
#include <QMediaPlayer>
|
||||||
#include <QStringRef>
|
#include <QStringRef>
|
||||||
#include <boost/variant.hpp>
|
#include <boost/variant.hpp>
|
||||||
|
#include "common/QLogging.hpp"
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
|
|
||||||
@@ -712,7 +713,8 @@ void TwitchMessageBuilder::runIgnoreReplaces(
|
|||||||
{
|
{
|
||||||
if ((*copy).ptr == nullptr)
|
if ((*copy).ptr == nullptr)
|
||||||
{
|
{
|
||||||
qDebug() << "remem nullptr" << (*copy).name.string;
|
qCDebug(chatterinoTwitch)
|
||||||
|
<< "remem nullptr" << (*copy).name.string;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
std::vector<TwitchEmoteOccurence> v(it, twitchEmotes.end());
|
std::vector<TwitchEmoteOccurence> v(it, twitchEmotes.end());
|
||||||
@@ -749,7 +751,8 @@ void TwitchMessageBuilder::runIgnoreReplaces(
|
|||||||
{
|
{
|
||||||
if (emote.second == nullptr)
|
if (emote.second == nullptr)
|
||||||
{
|
{
|
||||||
qDebug() << "emote null" << emote.first.string;
|
qCDebug(chatterinoTwitch)
|
||||||
|
<< "emote null" << emote.first.string;
|
||||||
}
|
}
|
||||||
twitchEmotes.push_back(TwitchEmoteOccurence{
|
twitchEmotes.push_back(TwitchEmoteOccurence{
|
||||||
startIndex + pos,
|
startIndex + pos,
|
||||||
@@ -821,7 +824,8 @@ void TwitchMessageBuilder::runIgnoreReplaces(
|
|||||||
{
|
{
|
||||||
if (tup.ptr == nullptr)
|
if (tup.ptr == nullptr)
|
||||||
{
|
{
|
||||||
qDebug() << "v nullptr" << tup.name.string;
|
qCDebug(chatterinoTwitch)
|
||||||
|
<< "v nullptr" << tup.name.string;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
QRegularExpression emoteregex(
|
QRegularExpression emoteregex(
|
||||||
@@ -885,7 +889,8 @@ void TwitchMessageBuilder::runIgnoreReplaces(
|
|||||||
{
|
{
|
||||||
if (tup.ptr == nullptr)
|
if (tup.ptr == nullptr)
|
||||||
{
|
{
|
||||||
qDebug() << "v nullptr" << tup.name.string;
|
qCDebug(chatterinoTwitch)
|
||||||
|
<< "v nullptr" << tup.name.string;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
QRegularExpression emoteregex(
|
QRegularExpression emoteregex(
|
||||||
@@ -955,7 +960,8 @@ void TwitchMessageBuilder::appendTwitchEmote(
|
|||||||
start, end, app->emotes->twitch.getOrCreateEmote(id, name), name};
|
start, end, app->emotes->twitch.getOrCreateEmote(id, name), name};
|
||||||
if (emoteOccurence.ptr == nullptr)
|
if (emoteOccurence.ptr == nullptr)
|
||||||
{
|
{
|
||||||
qDebug() << "nullptr" << emoteOccurence.name.string;
|
qCDebug(chatterinoTwitch)
|
||||||
|
<< "nullptr" << emoteOccurence.name.string;
|
||||||
}
|
}
|
||||||
vec.push_back(std::move(emoteOccurence));
|
vec.push_back(std::move(emoteOccurence));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
#include "providers/twitch/api/Helix.hpp"
|
#include "providers/twitch/api/Helix.hpp"
|
||||||
|
|
||||||
#include "common/Outcome.hpp"
|
#include "common/Outcome.hpp"
|
||||||
|
#include "common/QLogging.hpp"
|
||||||
|
|
||||||
namespace chatterino {
|
namespace chatterino {
|
||||||
|
|
||||||
@@ -320,14 +321,14 @@ NetworkRequest Helix::makeRequest(QString url, QUrlQuery urlQuery)
|
|||||||
|
|
||||||
if (this->clientId.isEmpty())
|
if (this->clientId.isEmpty())
|
||||||
{
|
{
|
||||||
qDebug()
|
qCDebug(chatterinoTwitch)
|
||||||
<< "Helix::makeRequest called without a client ID set BabyRage";
|
<< "Helix::makeRequest called without a client ID set BabyRage";
|
||||||
// return boost::none;
|
// return boost::none;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this->oauthToken.isEmpty())
|
if (this->oauthToken.isEmpty())
|
||||||
{
|
{
|
||||||
qDebug()
|
qCDebug(chatterinoTwitch)
|
||||||
<< "Helix::makeRequest called without an oauth token set BabyRage";
|
<< "Helix::makeRequest called without an oauth token set BabyRage";
|
||||||
// return boost::none;
|
// return boost::none;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
#include "providers/twitch/api/Kraken.hpp"
|
#include "providers/twitch/api/Kraken.hpp"
|
||||||
|
|
||||||
#include "common/Outcome.hpp"
|
#include "common/Outcome.hpp"
|
||||||
|
#include "common/QLogging.hpp"
|
||||||
#include "providers/twitch/TwitchCommon.hpp"
|
#include "providers/twitch/TwitchCommon.hpp"
|
||||||
|
|
||||||
namespace chatterino {
|
namespace chatterino {
|
||||||
@@ -54,7 +55,7 @@ NetworkRequest Kraken::makeRequest(QString url, QUrlQuery urlQuery)
|
|||||||
|
|
||||||
if (this->clientId.isEmpty())
|
if (this->clientId.isEmpty())
|
||||||
{
|
{
|
||||||
qDebug()
|
qCDebug(chatterinoTwitch)
|
||||||
<< "Kraken::makeRequest called without a client ID set BabyRage";
|
<< "Kraken::makeRequest called without a client ID set BabyRage";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
#include "singletons/NativeMessaging.hpp"
|
#include "singletons/NativeMessaging.hpp"
|
||||||
|
|
||||||
#include "Application.hpp"
|
#include "Application.hpp"
|
||||||
|
#include "common/QLogging.hpp"
|
||||||
#include "providers/twitch/TwitchIrcServer.hpp"
|
#include "providers/twitch/TwitchIrcServer.hpp"
|
||||||
#include "singletons/Paths.hpp"
|
#include "singletons/Paths.hpp"
|
||||||
#include "util/PostToThread.hpp"
|
#include "util/PostToThread.hpp"
|
||||||
@@ -125,7 +126,7 @@ void NativeMessagingClient::sendMessage(const QByteArray &array)
|
|||||||
}
|
}
|
||||||
catch (ipc::interprocess_exception &ex)
|
catch (ipc::interprocess_exception &ex)
|
||||||
{
|
{
|
||||||
qDebug() << "send to gui process:" << ex.what();
|
qCDebug(chatterinoNativeMessage) << "send to gui process:" << ex.what();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -169,7 +170,8 @@ void NativeMessagingServer::ReceiverThread::run()
|
|||||||
}
|
}
|
||||||
catch (ipc::interprocess_exception &ex)
|
catch (ipc::interprocess_exception &ex)
|
||||||
{
|
{
|
||||||
qDebug() << "received from gui process:" << ex.what();
|
qCDebug(chatterinoNativeMessage)
|
||||||
|
<< "received from gui process:" << ex.what();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -183,7 +185,7 @@ void NativeMessagingServer::ReceiverThread::handleMessage(
|
|||||||
|
|
||||||
if (action.isNull())
|
if (action.isNull())
|
||||||
{
|
{
|
||||||
qDebug() << "NM action was null";
|
qCDebug(chatterinoNativeMessage) << "NM action was null";
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -203,11 +205,13 @@ void NativeMessagingServer::ReceiverThread::handleMessage(
|
|||||||
args.height = root.value("size").toObject().value("height").toInt(-1);
|
args.height = root.value("size").toObject().value("height").toInt(-1);
|
||||||
args.fullscreen = attachFullscreen;
|
args.fullscreen = attachFullscreen;
|
||||||
|
|
||||||
qDebug() << args.x << args.width << args.height << args.winId;
|
qCDebug(chatterinoNativeMessage)
|
||||||
|
<< args.x << args.width << args.height << args.winId;
|
||||||
|
|
||||||
if (_type.isNull() || args.winId.isNull())
|
if (_type.isNull() || args.winId.isNull())
|
||||||
{
|
{
|
||||||
qDebug() << "NM type, name or winId missing";
|
qCDebug(chatterinoNativeMessage)
|
||||||
|
<< "NM type, name or winId missing";
|
||||||
attach = false;
|
attach = false;
|
||||||
attachFullscreen = false;
|
attachFullscreen = false;
|
||||||
return;
|
return;
|
||||||
@@ -242,7 +246,7 @@ void NativeMessagingServer::ReceiverThread::handleMessage(
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
qDebug() << "NM unknown channel type";
|
qCDebug(chatterinoNativeMessage) << "NM unknown channel type";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (action == "detach")
|
else if (action == "detach")
|
||||||
@@ -251,20 +255,20 @@ void NativeMessagingServer::ReceiverThread::handleMessage(
|
|||||||
|
|
||||||
if (winId.isNull())
|
if (winId.isNull())
|
||||||
{
|
{
|
||||||
qDebug() << "NM winId missing";
|
qCDebug(chatterinoNativeMessage) << "NM winId missing";
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef USEWINSDK
|
#ifdef USEWINSDK
|
||||||
postToThread([winId] {
|
postToThread([winId] {
|
||||||
qDebug() << "NW detach";
|
qCDebug(chatterinoNativeMessage) << "NW detach";
|
||||||
AttachedWindow::detach(winId);
|
AttachedWindow::detach(winId);
|
||||||
});
|
});
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
qDebug() << "NM unknown action " + action;
|
qCDebug(chatterinoNativeMessage) << "NM unknown action " + action;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -9,11 +9,11 @@
|
|||||||
#include "util/CombinePath.hpp"
|
#include "util/CombinePath.hpp"
|
||||||
#include "util/PostToThread.hpp"
|
#include "util/PostToThread.hpp"
|
||||||
|
|
||||||
#include <QDebug>
|
|
||||||
#include <QDesktopServices>
|
#include <QDesktopServices>
|
||||||
#include <QMessageBox>
|
#include <QMessageBox>
|
||||||
#include <QProcess>
|
#include <QProcess>
|
||||||
#include <QRegularExpression>
|
#include <QRegularExpression>
|
||||||
|
#include "common/QLogging.hpp"
|
||||||
|
|
||||||
namespace chatterino {
|
namespace chatterino {
|
||||||
namespace {
|
namespace {
|
||||||
@@ -59,7 +59,7 @@ Updates::Updates()
|
|||||||
: currentVersion_(CHATTERINO_VERSION)
|
: currentVersion_(CHATTERINO_VERSION)
|
||||||
, updateGuideLink_("https://chatterino.com")
|
, updateGuideLink_("https://chatterino.com")
|
||||||
{
|
{
|
||||||
qDebug() << "init UpdateManager";
|
qCDebug(chatterinoUpdate) << "init UpdateManager";
|
||||||
}
|
}
|
||||||
|
|
||||||
Updates &Updates::instance()
|
Updates &Updates::instance()
|
||||||
@@ -234,7 +234,7 @@ void Updates::checkForUpdates()
|
|||||||
{
|
{
|
||||||
if (!Version::instance().isSupportedOS())
|
if (!Version::instance().isSupportedOS())
|
||||||
{
|
{
|
||||||
qDebug()
|
qCDebug(chatterinoUpdate)
|
||||||
<< "Update checking disabled because OS doesn't appear to be one "
|
<< "Update checking disabled because OS doesn't appear to be one "
|
||||||
"of Windows, GNU/Linux or macOS.";
|
"of Windows, GNU/Linux or macOS.";
|
||||||
return;
|
return;
|
||||||
@@ -260,7 +260,7 @@ void Updates::checkForUpdates()
|
|||||||
if (!version_val.isString())
|
if (!version_val.isString())
|
||||||
{
|
{
|
||||||
this->setStatus_(SearchFailed);
|
this->setStatus_(SearchFailed);
|
||||||
qDebug() << "error updating";
|
qCDebug(chatterinoUpdate) << "error updating";
|
||||||
return Failure;
|
return Failure;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -270,7 +270,7 @@ void Updates::checkForUpdates()
|
|||||||
if (!updateExe_val.isString())
|
if (!updateExe_val.isString())
|
||||||
{
|
{
|
||||||
this->setStatus_(SearchFailed);
|
this->setStatus_(SearchFailed);
|
||||||
qDebug() << "error updating";
|
qCDebug(chatterinoUpdate) << "error updating";
|
||||||
return Failure;
|
return Failure;
|
||||||
}
|
}
|
||||||
this->updateExe_ = updateExe_val.toString();
|
this->updateExe_ = updateExe_val.toString();
|
||||||
@@ -281,7 +281,7 @@ void Updates::checkForUpdates()
|
|||||||
if (!portable_val.isString())
|
if (!portable_val.isString())
|
||||||
{
|
{
|
||||||
this->setStatus_(SearchFailed);
|
this->setStatus_(SearchFailed);
|
||||||
qDebug() << "error updating";
|
qCDebug(chatterinoUpdate) << "error updating";
|
||||||
return Failure;
|
return Failure;
|
||||||
}
|
}
|
||||||
this->updatePortable_ = portable_val.toString();
|
this->updatePortable_ = portable_val.toString();
|
||||||
|
|||||||
@@ -13,6 +13,7 @@
|
|||||||
|
|
||||||
#include "Application.hpp"
|
#include "Application.hpp"
|
||||||
#include "common/Args.hpp"
|
#include "common/Args.hpp"
|
||||||
|
#include "common/QLogging.hpp"
|
||||||
#include "debug/AssertInGuiThread.hpp"
|
#include "debug/AssertInGuiThread.hpp"
|
||||||
#include "messages/MessageElement.hpp"
|
#include "messages/MessageElement.hpp"
|
||||||
#include "providers/irc/Irc2.hpp"
|
#include "providers/irc/Irc2.hpp"
|
||||||
@@ -85,7 +86,7 @@ WindowManager::WindowManager()
|
|||||||
: windowLayoutFilePath(
|
: windowLayoutFilePath(
|
||||||
combinePath(getPaths()->settingsDirectory, WINDOW_LAYOUT_FILENAME))
|
combinePath(getPaths()->settingsDirectory, WINDOW_LAYOUT_FILENAME))
|
||||||
{
|
{
|
||||||
qDebug() << "init WindowManager";
|
qCDebug(chatterinoWindowmanager) << "init WindowManager";
|
||||||
|
|
||||||
auto settings = getSettings();
|
auto settings = getSettings();
|
||||||
|
|
||||||
@@ -270,7 +271,7 @@ Window *WindowManager::windowAt(int index)
|
|||||||
{
|
{
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
qDebug() << "getting window at bad index" << index;
|
qCDebug(chatterinoWindowmanager) << "getting window at bad index" << index;
|
||||||
|
|
||||||
return this->windows_.at(index);
|
return this->windows_.at(index);
|
||||||
}
|
}
|
||||||
@@ -343,7 +344,7 @@ void WindowManager::save()
|
|||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
qDebug() << "[WindowManager] Saving";
|
qCDebug(chatterinoWindowmanager) << "[WindowManager] Saving";
|
||||||
assertInGuiThread();
|
assertInGuiThread();
|
||||||
QJsonDocument document;
|
QJsonDocument document;
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
#include "LoggingChannel.hpp"
|
#include "LoggingChannel.hpp"
|
||||||
|
|
||||||
#include "Application.hpp"
|
#include "Application.hpp"
|
||||||
|
#include "common/QLogging.hpp"
|
||||||
#include "singletons/Paths.hpp"
|
#include "singletons/Paths.hpp"
|
||||||
#include "singletons/Settings.hpp"
|
#include "singletons/Settings.hpp"
|
||||||
|
|
||||||
@@ -63,13 +64,13 @@ void LoggingChannel::openLogFile()
|
|||||||
|
|
||||||
if (!QDir().mkpath(directory))
|
if (!QDir().mkpath(directory))
|
||||||
{
|
{
|
||||||
qDebug() << "Unable to create logging path";
|
qCDebug(chatterinoHelper) << "Unable to create logging path";
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Open file handle to log file of current date
|
// Open file handle to log file of current date
|
||||||
QString fileName = directory + QDir::separator() + baseFileName;
|
QString fileName = directory + QDir::separator() + baseFileName;
|
||||||
qDebug() << "Logging to" << fileName;
|
qCDebug(chatterinoHelper) << "Logging to" << fileName;
|
||||||
this->fileHandle.setFileName(fileName);
|
this->fileHandle.setFileName(fileName);
|
||||||
|
|
||||||
this->fileHandle.open(QIODevice::Append);
|
this->fileHandle.open(QIODevice::Append);
|
||||||
|
|||||||
@@ -14,6 +14,7 @@
|
|||||||
#include <QMimeDatabase>
|
#include <QMimeDatabase>
|
||||||
#include <QMutex>
|
#include <QMutex>
|
||||||
#include <QSaveFile>
|
#include <QSaveFile>
|
||||||
|
#include "common/QLogging.hpp"
|
||||||
|
|
||||||
#define UPLOAD_DELAY 2000
|
#define UPLOAD_DELAY 2000
|
||||||
// Delay between uploads in milliseconds
|
// Delay between uploads in milliseconds
|
||||||
@@ -160,7 +161,7 @@ void uploadImageToNuuls(RawImageData imageData, ChannelPtr channel,
|
|||||||
? ""
|
? ""
|
||||||
: getLinkFromResponse(
|
: getLinkFromResponse(
|
||||||
result, getSettings()->imageUploaderDeletionLink);
|
result, getSettings()->imageUploaderDeletionLink);
|
||||||
qDebug() << link << deletionLink;
|
qCDebug(chatterinoNuulsuploader) << link << deletionLink;
|
||||||
textEdit.insertPlainText(link + " ");
|
textEdit.insertPlainText(link + " ");
|
||||||
if (uploadQueue.empty())
|
if (uploadQueue.empty())
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -8,6 +8,7 @@
|
|||||||
#include <QErrorMessage>
|
#include <QErrorMessage>
|
||||||
#include <QFileInfo>
|
#include <QFileInfo>
|
||||||
#include <QProcess>
|
#include <QProcess>
|
||||||
|
#include "common/QLogging.hpp"
|
||||||
|
|
||||||
#include <functional>
|
#include <functional>
|
||||||
|
|
||||||
@@ -92,7 +93,7 @@ namespace {
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
qDebug() << "Error occured" << err;
|
qCWarning(chatterinoStreamlink) << "Error occured" << err;
|
||||||
}
|
}
|
||||||
|
|
||||||
p->deleteLater();
|
p->deleteLater();
|
||||||
@@ -119,7 +120,7 @@ void getStreamQualities(const QString &channelURL,
|
|||||||
[=](int res) {
|
[=](int res) {
|
||||||
if (res != 0)
|
if (res != 0)
|
||||||
{
|
{
|
||||||
qDebug() << "Got error code" << res;
|
qCWarning(chatterinoStreamlink) << "Got error code" << res;
|
||||||
// return;
|
// return;
|
||||||
}
|
}
|
||||||
QString lastLine = QString(p->readAllStandardOutput());
|
QString lastLine = QString(p->readAllStandardOutput());
|
||||||
|
|||||||
@@ -7,6 +7,7 @@
|
|||||||
|
|
||||||
#include <QTimer>
|
#include <QTimer>
|
||||||
#include <QVBoxLayout>
|
#include <QVBoxLayout>
|
||||||
|
#include "common/QLogging.hpp"
|
||||||
|
|
||||||
#ifdef USEWINSDK
|
#ifdef USEWINSDK
|
||||||
# include "util/WindowsHelper.hpp"
|
# include "util/WindowsHelper.hpp"
|
||||||
@@ -192,7 +193,8 @@ void AttachedWindow::attachToHwnd(void *_attachedPtr)
|
|||||||
!qfilename.endsWith("brave.exe"))
|
!qfilename.endsWith("brave.exe"))
|
||||||
|
|
||||||
{
|
{
|
||||||
qDebug() << "NM Illegal caller" << qfilename;
|
qCWarning(chatterinoWidget)
|
||||||
|
<< "NM Illegal caller" << qfilename;
|
||||||
this->timer_.stop();
|
this->timer_.stop();
|
||||||
this->deleteLater();
|
this->deleteLater();
|
||||||
return;
|
return;
|
||||||
@@ -241,7 +243,7 @@ void AttachedWindow::updateWindowRect(void *_attachedPtr)
|
|||||||
|
|
||||||
if (::GetLastError() != 0)
|
if (::GetLastError() != 0)
|
||||||
{
|
{
|
||||||
qDebug() << "NM GetLastError()" << ::GetLastError();
|
qCWarning(chatterinoWidget) << "NM GetLastError()" << ::GetLastError();
|
||||||
|
|
||||||
this->timer_.stop();
|
this->timer_.stop();
|
||||||
this->deleteLater();
|
this->deleteLater();
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
#include "widgets/Notebook.hpp"
|
#include "widgets/Notebook.hpp"
|
||||||
|
|
||||||
#include "Application.hpp"
|
#include "Application.hpp"
|
||||||
|
#include "common/QLogging.hpp"
|
||||||
#include "singletons/Settings.hpp"
|
#include "singletons/Settings.hpp"
|
||||||
#include "singletons/Theme.hpp"
|
#include "singletons/Theme.hpp"
|
||||||
#include "singletons/WindowManager.hpp"
|
#include "singletons/WindowManager.hpp"
|
||||||
@@ -153,7 +154,7 @@ void Notebook::select(QWidget *page)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
qDebug()
|
qCDebug(chatterinoWidget)
|
||||||
<< "Notebook: selected child of page doesn't exist anymore";
|
<< "Notebook: selected child of page doesn't exist anymore";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
#include "widgets/Scrollbar.hpp"
|
#include "widgets/Scrollbar.hpp"
|
||||||
|
|
||||||
#include "Application.hpp"
|
#include "Application.hpp"
|
||||||
|
#include "common/QLogging.hpp"
|
||||||
#include "singletons/Settings.hpp"
|
#include "singletons/Settings.hpp"
|
||||||
#include "singletons/Theme.hpp"
|
#include "singletons/Theme.hpp"
|
||||||
#include "singletons/WindowManager.hpp"
|
#include "singletons/WindowManager.hpp"
|
||||||
@@ -228,11 +229,12 @@ void Scrollbar::setCurrentValue(qreal value)
|
|||||||
|
|
||||||
void Scrollbar::printCurrentState(const QString &prefix) const
|
void Scrollbar::printCurrentState(const QString &prefix) const
|
||||||
{
|
{
|
||||||
qDebug() << prefix //
|
qCDebug(chatterinoWidget)
|
||||||
<< "Current value: " << this->getCurrentValue() //
|
<< prefix //
|
||||||
<< ". Maximum: " << this->getMaximum() //
|
<< "Current value: " << this->getCurrentValue() //
|
||||||
<< ". Minimum: " << this->getMinimum() //
|
<< ". Maximum: " << this->getMaximum() //
|
||||||
<< ". Large change: " << this->getLargeChange(); //
|
<< ". Minimum: " << this->getMinimum() //
|
||||||
|
<< ". Large change: " << this->getLargeChange(); //
|
||||||
}
|
}
|
||||||
|
|
||||||
void Scrollbar::paintEvent(QPaintEvent *)
|
void Scrollbar::paintEvent(QPaintEvent *)
|
||||||
|
|||||||
@@ -3,6 +3,7 @@
|
|||||||
#include "Application.hpp"
|
#include "Application.hpp"
|
||||||
#include "common/Common.hpp"
|
#include "common/Common.hpp"
|
||||||
#include "common/NetworkRequest.hpp"
|
#include "common/NetworkRequest.hpp"
|
||||||
|
#include "common/QLogging.hpp"
|
||||||
#include "controllers/accounts/AccountController.hpp"
|
#include "controllers/accounts/AccountController.hpp"
|
||||||
#include "util/Helpers.hpp"
|
#include "util/Helpers.hpp"
|
||||||
|
|
||||||
@@ -108,11 +109,11 @@ BasicLoginWidget::BasicLoginWidget()
|
|||||||
this->ui_.layout.addWidget(&this->ui_.unableToOpenBrowserHelper);
|
this->ui_.layout.addWidget(&this->ui_.unableToOpenBrowserHelper);
|
||||||
|
|
||||||
connect(&this->ui_.loginButton, &QPushButton::clicked, [this, logInLink]() {
|
connect(&this->ui_.loginButton, &QPushButton::clicked, [this, logInLink]() {
|
||||||
qDebug() << "open login in browser";
|
qCDebug(chatterinoWidget) << "open login in browser";
|
||||||
auto res = QDesktopServices::openUrl(QUrl(logInLink));
|
auto res = QDesktopServices::openUrl(QUrl(logInLink));
|
||||||
if (!res)
|
if (!res)
|
||||||
{
|
{
|
||||||
qDebug() << "open login in browser failed";
|
qCWarning(chatterinoWidget) << "open login in browser failed";
|
||||||
this->ui_.unableToOpenBrowserHelper.show();
|
this->ui_.unableToOpenBrowserHelper.show();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@@ -152,7 +153,7 @@ BasicLoginWidget::BasicLoginWidget()
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
qDebug() << "Unknown key in code: " << key;
|
qCWarning(chatterinoWidget) << "Unknown key in code: " << key;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
#include "QualityPopup.hpp"
|
#include "QualityPopup.hpp"
|
||||||
#include "Application.hpp"
|
#include "Application.hpp"
|
||||||
|
#include "common/QLogging.hpp"
|
||||||
#include "singletons/WindowManager.hpp"
|
#include "singletons/WindowManager.hpp"
|
||||||
#include "util/StreamLink.hpp"
|
#include "util/StreamLink.hpp"
|
||||||
#include "widgets/Window.hpp"
|
#include "widgets/Window.hpp"
|
||||||
@@ -55,7 +56,8 @@ void QualityPopup::okButtonClicked()
|
|||||||
}
|
}
|
||||||
catch (const Exception &ex)
|
catch (const Exception &ex)
|
||||||
{
|
{
|
||||||
qDebug() << "Exception caught trying to open streamlink:" << ex.what();
|
qCWarning(chatterinoWidget)
|
||||||
|
<< "Exception caught trying to open streamlink:" << ex.what();
|
||||||
}
|
}
|
||||||
|
|
||||||
this->close();
|
this->close();
|
||||||
|
|||||||
@@ -15,6 +15,7 @@
|
|||||||
|
|
||||||
#include "Application.hpp"
|
#include "Application.hpp"
|
||||||
#include "common/Common.hpp"
|
#include "common/Common.hpp"
|
||||||
|
#include "common/QLogging.hpp"
|
||||||
#include "controllers/accounts/AccountController.hpp"
|
#include "controllers/accounts/AccountController.hpp"
|
||||||
#include "controllers/commands/CommandController.hpp"
|
#include "controllers/commands/CommandController.hpp"
|
||||||
#include "debug/Benchmark.hpp"
|
#include "debug/Benchmark.hpp"
|
||||||
@@ -892,8 +893,9 @@ void ChannelView::messageReplaced(size_t index, MessagePtr &replacement)
|
|||||||
auto snapshot = this->messages_.getSnapshot();
|
auto snapshot = this->messages_.getSnapshot();
|
||||||
if (index >= snapshot.size())
|
if (index >= snapshot.size())
|
||||||
{
|
{
|
||||||
qDebug() << "Tried to replace out of bounds message. Index:" << index
|
qCDebug(chatterinoWidget)
|
||||||
<< ". Length:" << snapshot.size();
|
<< "Tried to replace out of bounds message. Index:" << index
|
||||||
|
<< ". Length:" << snapshot.size();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
#include "AboutPage.hpp"
|
#include "AboutPage.hpp"
|
||||||
|
|
||||||
#include "common/Modes.hpp"
|
#include "common/Modes.hpp"
|
||||||
|
#include "common/QLogging.hpp"
|
||||||
#include "common/Version.hpp"
|
#include "common/Version.hpp"
|
||||||
#include "util/LayoutCreator.hpp"
|
#include "util/LayoutCreator.hpp"
|
||||||
#include "util/RemoveScrollAreaBackground.hpp"
|
#include "util/RemoveScrollAreaBackground.hpp"
|
||||||
@@ -166,7 +167,8 @@ AboutPage::AboutPage()
|
|||||||
|
|
||||||
if (contributorParts.size() != 4)
|
if (contributorParts.size() != 4)
|
||||||
{
|
{
|
||||||
qDebug() << "Missing parts in line" << line;
|
qCDebug(chatterinoWidget)
|
||||||
|
<< "Missing parts in line" << line;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -4,6 +4,7 @@
|
|||||||
#include <boost/variant.hpp>
|
#include <boost/variant.hpp>
|
||||||
#include "Application.hpp"
|
#include "Application.hpp"
|
||||||
#include "common/ChatterinoSetting.hpp"
|
#include "common/ChatterinoSetting.hpp"
|
||||||
|
#include "common/QLogging.hpp"
|
||||||
#include "singletons/WindowManager.hpp"
|
#include "singletons/WindowManager.hpp"
|
||||||
#include "widgets/helper/SignalLabel.hpp"
|
#include "widgets/helper/SignalLabel.hpp"
|
||||||
|
|
||||||
@@ -190,7 +191,7 @@ public:
|
|||||||
protected:
|
protected:
|
||||||
void resizeEvent(QResizeEvent *ev) override
|
void resizeEvent(QResizeEvent *ev) override
|
||||||
{
|
{
|
||||||
qDebug() << ev->size();
|
qCDebug(chatterinoWidget) << ev->size();
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|||||||
@@ -4,6 +4,7 @@
|
|||||||
#include "common/Common.hpp"
|
#include "common/Common.hpp"
|
||||||
#include "common/Env.hpp"
|
#include "common/Env.hpp"
|
||||||
#include "common/NetworkRequest.hpp"
|
#include "common/NetworkRequest.hpp"
|
||||||
|
#include "common/QLogging.hpp"
|
||||||
#include "controllers/accounts/AccountController.hpp"
|
#include "controllers/accounts/AccountController.hpp"
|
||||||
#include "providers/twitch/EmoteValue.hpp"
|
#include "providers/twitch/EmoteValue.hpp"
|
||||||
#include "providers/twitch/TwitchChannel.hpp"
|
#include "providers/twitch/TwitchChannel.hpp"
|
||||||
@@ -639,7 +640,8 @@ void Split::openInStreamlink()
|
|||||||
}
|
}
|
||||||
catch (const Exception &ex)
|
catch (const Exception &ex)
|
||||||
{
|
{
|
||||||
qDebug() << "Error in doOpenStreamlink:" << ex.what();
|
qCWarning(chatterinoWidget)
|
||||||
|
<< "Error in doOpenStreamlink:" << ex.what();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user