Remove FMT dependency (#1472)
All occurrences of log() have been replaced with qDebug() bonus meme: remove a bunch of std::string usages in the pubsub client Fixes #1467
This commit is contained in:
@@ -5,7 +5,6 @@
|
||||
|
||||
#include "common/Common.hpp"
|
||||
#include "common/NetworkRequest.hpp"
|
||||
#include "debug/Log.hpp"
|
||||
#include "messages/Emote.hpp"
|
||||
#include "messages/Image.hpp"
|
||||
#include "messages/ImageSet.hpp"
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
#include "providers/emoji/Emojis.hpp"
|
||||
|
||||
#include "Application.hpp"
|
||||
#include "debug/Log.hpp"
|
||||
#include "messages/Emote.hpp"
|
||||
#include "singletons/Settings.hpp"
|
||||
|
||||
@@ -132,8 +131,9 @@ void Emojis::loadEmojis()
|
||||
|
||||
if (result.Code() != rapidjson::kParseErrorNone)
|
||||
{
|
||||
log("JSON parse error: {} ({})",
|
||||
rapidjson::GetParseError_En(result.Code()), result.Offset());
|
||||
qDebug() << "JSON parse error:"
|
||||
<< rapidjson::GetParseError_En(result.Code()) << "("
|
||||
<< result.Offset() << ")";
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -165,8 +165,8 @@ void Emojis::loadEmojis()
|
||||
auto toneNameIt = toneNames.find(tone);
|
||||
if (toneNameIt == toneNames.end())
|
||||
{
|
||||
log("Tone with key {} does not exist in tone names map",
|
||||
tone);
|
||||
qDebug() << "Tone with key" << tone.c_str()
|
||||
<< "does not exist in tone names map";
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
@@ -4,7 +4,6 @@
|
||||
|
||||
#include "common/NetworkRequest.hpp"
|
||||
#include "common/Outcome.hpp"
|
||||
#include "debug/Log.hpp"
|
||||
#include "messages/Emote.hpp"
|
||||
#include "messages/Image.hpp"
|
||||
|
||||
@@ -186,7 +185,8 @@ void FfzEmotes::loadChannel(
|
||||
const QString &channelId, std::function<void(EmoteMap &&)> emoteCallback,
|
||||
std::function<void(boost::optional<EmotePtr>)> modBadgeCallback)
|
||||
{
|
||||
log("[FFZEmotes] Reload FFZ Channel Emotes for channel {}\n", channelId);
|
||||
qDebug() << "[FFZEmotes] Reload FFZ Channel Emotes for channel"
|
||||
<< channelId;
|
||||
|
||||
NetworkRequest("https://api.frankerfacez.com/v1/room/id/" + channelId)
|
||||
|
||||
@@ -211,13 +211,13 @@ void FfzEmotes::loadChannel(
|
||||
else if (result.status() == NetworkResult::timedoutStatus)
|
||||
{
|
||||
// TODO: Auto retry in case of a timeout, with a delay
|
||||
log("Fetching FFZ emotes for channel {} failed due to timeout",
|
||||
channelId);
|
||||
qDebug() << "Fetching FFZ emotes for channel" << channelId
|
||||
<< "failed due to timeout";
|
||||
}
|
||||
else
|
||||
{
|
||||
log("Error fetching FFZ emotes for channel {}, error {}",
|
||||
channelId, result.status());
|
||||
qDebug() << "Error fetching FFZ emotes for channel" << channelId
|
||||
<< ", error" << result.status();
|
||||
}
|
||||
})
|
||||
.execute();
|
||||
|
||||
@@ -2,7 +2,6 @@
|
||||
|
||||
#include "common/Channel.hpp"
|
||||
#include "common/Common.hpp"
|
||||
#include "debug/Log.hpp"
|
||||
#include "messages/LimitedQueueSnapshot.hpp"
|
||||
#include "messages/Message.hpp"
|
||||
#include "messages/MessageBuilder.hpp"
|
||||
@@ -66,7 +65,7 @@ AbstractIrcServer::AbstractIrcServer()
|
||||
|
||||
if (!this->readConnection_->isConnected())
|
||||
{
|
||||
log("Trying to reconnect... {}", this->falloffCounter_);
|
||||
qDebug() << "Trying to reconnect..." << this->falloffCounter_;
|
||||
this->connect();
|
||||
}
|
||||
});
|
||||
@@ -159,23 +158,24 @@ ChannelPtr AbstractIrcServer::getOrAddChannel(const QString &dirtyChannelName)
|
||||
}
|
||||
|
||||
this->channels.insert(channelName, chan);
|
||||
this->connections_.emplace_back(chan->destroyed.connect([this,
|
||||
channelName] {
|
||||
// fourtf: issues when the server itself is destroyed
|
||||
this->connections_.emplace_back(
|
||||
chan->destroyed.connect([this, channelName] {
|
||||
// fourtf: issues when the server itself is destroyed
|
||||
|
||||
log("[AbstractIrcServer::addChannel] {} was destroyed", channelName);
|
||||
this->channels.remove(channelName);
|
||||
qDebug() << "[AbstractIrcServer::addChannel]" << channelName
|
||||
<< "was destroyed";
|
||||
this->channels.remove(channelName);
|
||||
|
||||
if (this->readConnection_)
|
||||
{
|
||||
this->readConnection_->sendRaw("PART #" + channelName);
|
||||
}
|
||||
if (this->readConnection_)
|
||||
{
|
||||
this->readConnection_->sendRaw("PART #" + channelName);
|
||||
}
|
||||
|
||||
if (this->writeConnection_ && this->hasSeparateWriteConnection())
|
||||
{
|
||||
this->writeConnection_->sendRaw("PART #" + channelName);
|
||||
}
|
||||
}));
|
||||
if (this->writeConnection_ && this->hasSeparateWriteConnection())
|
||||
{
|
||||
this->writeConnection_->sendRaw("PART #" + channelName);
|
||||
}
|
||||
}));
|
||||
|
||||
// join irc channel
|
||||
{
|
||||
|
||||
@@ -3,7 +3,6 @@
|
||||
#include "Application.hpp"
|
||||
#include "controllers/accounts/AccountController.hpp"
|
||||
#include "controllers/highlights/HighlightController.hpp"
|
||||
#include "debug/Log.hpp"
|
||||
#include "messages/LimitedQueue.hpp"
|
||||
#include "messages/Message.hpp"
|
||||
#include "providers/twitch/TwitchAccountManager.hpp"
|
||||
@@ -235,9 +234,8 @@ void IrcMessageHandler::handleClearChatMessage(Communi::IrcMessage *message)
|
||||
|
||||
if (chan->isEmpty())
|
||||
{
|
||||
log("[IrcMessageHandler:handleClearChatMessage] Twitch channel {} not "
|
||||
"found",
|
||||
chanName);
|
||||
qDebug() << "[IrcMessageHandler:handleClearChatMessage] Twitch channel"
|
||||
<< chanName << "not found";
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -300,10 +298,9 @@ void IrcMessageHandler::handleClearMessageMessage(Communi::IrcMessage *message)
|
||||
|
||||
if (chan->isEmpty())
|
||||
{
|
||||
log("[IrcMessageHandler:handleClearMessageMessage] Twitch channel {} "
|
||||
"not "
|
||||
"found",
|
||||
chanName);
|
||||
qDebug()
|
||||
<< "[IrcMessageHandler:handleClearMessageMessage] Twitch channel"
|
||||
<< chanName << "not found";
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -356,7 +353,7 @@ void IrcMessageHandler::handleUserStateMessage(Communi::IrcMessage *message)
|
||||
void IrcMessageHandler::handleWhisperMessage(Communi::IrcMessage *message)
|
||||
{
|
||||
auto app = getApp();
|
||||
log("Received whisper!");
|
||||
qDebug() << "Received whisper!";
|
||||
MessageParseArgs args;
|
||||
|
||||
args.isReceivedWhisper = true;
|
||||
@@ -568,10 +565,8 @@ void IrcMessageHandler::handleNoticeMessage(Communi::IrcNoticeMessage *message)
|
||||
|
||||
if (channel->isEmpty())
|
||||
{
|
||||
log("[IrcManager:handleNoticeMessage] Channel {} not found in "
|
||||
"channel "
|
||||
"manager ",
|
||||
channelName);
|
||||
qDebug() << "[IrcManager:handleNoticeMessage] Channel"
|
||||
<< channelName << "not found in channel manager";
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -2,7 +2,6 @@
|
||||
|
||||
#include "common/Common.hpp"
|
||||
#include "common/NetworkRequest.hpp"
|
||||
#include "debug/Log.hpp"
|
||||
#include "providers/twitch/TwitchCommon.hpp"
|
||||
|
||||
#include <QJsonArray>
|
||||
@@ -39,31 +38,30 @@ void PartialTwitchUser::getId(std::function<void(QString)> successCallback,
|
||||
auto root = result.parseJson();
|
||||
if (!root.value("users").isArray())
|
||||
{
|
||||
log("API Error while getting user id, users is not an array");
|
||||
qDebug()
|
||||
<< "API Error while getting user id, users is not an array";
|
||||
return Failure;
|
||||
}
|
||||
|
||||
auto users = root.value("users").toArray();
|
||||
if (users.size() != 1)
|
||||
{
|
||||
log("API Error while getting user id, users array size is not "
|
||||
"1");
|
||||
qDebug() << "API Error while getting user id, users array size "
|
||||
"is not 1";
|
||||
return Failure;
|
||||
}
|
||||
if (!users[0].isObject())
|
||||
{
|
||||
log("API Error while getting user id, first user is not an "
|
||||
"object");
|
||||
qDebug() << "API Error while getting user id, first user is "
|
||||
"not an object";
|
||||
return Failure;
|
||||
}
|
||||
auto firstUser = users[0].toObject();
|
||||
auto id = firstUser.value("_id");
|
||||
if (!id.isString())
|
||||
{
|
||||
log("API Error: while getting user id, first user object `_id` "
|
||||
"key "
|
||||
"is not a "
|
||||
"string");
|
||||
qDebug() << "API Error: while getting user id, first user "
|
||||
"object `_id` key is not a string";
|
||||
return Failure;
|
||||
}
|
||||
successCallback(id.toString());
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
#include "providers/twitch/PubsubClient.hpp"
|
||||
|
||||
#include "debug/Log.hpp"
|
||||
#include "providers/twitch/PubsubActions.hpp"
|
||||
#include "providers/twitch/PubsubHelpers.hpp"
|
||||
#include "util/Helpers.hpp"
|
||||
#include "util/RapidjsonHelpers.hpp"
|
||||
|
||||
#include <rapidjson/error/en.h>
|
||||
@@ -77,14 +77,14 @@ namespace detail {
|
||||
return true;
|
||||
}
|
||||
|
||||
void PubSubClient::unlistenPrefix(const std::string &prefix)
|
||||
void PubSubClient::unlistenPrefix(const QString &prefix)
|
||||
{
|
||||
std::vector<std::string> topics;
|
||||
std::vector<QString> topics;
|
||||
|
||||
for (auto it = this->listeners_.begin(); it != this->listeners_.end();)
|
||||
{
|
||||
const auto &listener = *it;
|
||||
if (listener.topic.find(prefix) == 0)
|
||||
if (listener.topic.startsWith(prefix))
|
||||
{
|
||||
topics.push_back(listener.topic);
|
||||
it = this->listeners_.erase(it);
|
||||
@@ -116,16 +116,14 @@ namespace detail {
|
||||
{
|
||||
assert(this->awaitingPong_);
|
||||
|
||||
log("Got pong!");
|
||||
|
||||
this->awaitingPong_ = false;
|
||||
}
|
||||
|
||||
bool PubSubClient::isListeningToTopic(const std::string &payload)
|
||||
bool PubSubClient::isListeningToTopic(const QString &topic)
|
||||
{
|
||||
for (const auto &listener : this->listeners_)
|
||||
{
|
||||
if (listener.topic == payload)
|
||||
if (listener.topic == topic)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
@@ -156,9 +154,8 @@ namespace detail {
|
||||
|
||||
if (self->awaitingPong_)
|
||||
{
|
||||
log("No pong response, disconnect!");
|
||||
// TODO(pajlada): Label this connection as "disconnect
|
||||
// me"
|
||||
qDebug() << "No pong response, disconnect!";
|
||||
// TODO(pajlada): Label this connection as "disconnect me"
|
||||
}
|
||||
});
|
||||
|
||||
@@ -181,7 +178,8 @@ namespace detail {
|
||||
|
||||
if (ec)
|
||||
{
|
||||
log("Error sending message {}: {}", payload, ec.message());
|
||||
qDebug() << "Error sending message" << payload << ":"
|
||||
<< ec.message().c_str();
|
||||
// TODO(pajlada): Check which error code happened and maybe
|
||||
// gracefully handle it
|
||||
|
||||
@@ -223,7 +221,7 @@ PubSub::PubSub()
|
||||
|
||||
if (!data.HasMember("args"))
|
||||
{
|
||||
log("Missing required args member");
|
||||
qDebug() << "Missing required args member";
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -231,13 +229,13 @@ PubSub::PubSub()
|
||||
|
||||
if (!args.IsArray())
|
||||
{
|
||||
log("args member must be an array");
|
||||
qDebug() << "args member must be an array";
|
||||
return;
|
||||
}
|
||||
|
||||
if (args.Size() == 0)
|
||||
{
|
||||
log("Missing duration argument in slowmode on");
|
||||
qDebug() << "Missing duration argument in slowmode on";
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -245,7 +243,7 @@ PubSub::PubSub()
|
||||
|
||||
if (!durationArg.IsString())
|
||||
{
|
||||
log("Duration arg must be a string");
|
||||
qDebug() << "Duration arg must be a string";
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -338,7 +336,7 @@ PubSub::PubSub()
|
||||
}
|
||||
catch (const std::runtime_error &ex)
|
||||
{
|
||||
log("Error parsing moderation action: {}", ex.what());
|
||||
qDebug() << "Error parsing moderation action:" << ex.what();
|
||||
}
|
||||
|
||||
action.modded = false;
|
||||
@@ -368,7 +366,7 @@ PubSub::PubSub()
|
||||
}
|
||||
catch (const std::runtime_error &ex)
|
||||
{
|
||||
log("Error parsing moderation action: {}", ex.what());
|
||||
qDebug() << "Error parsing moderation action:" << ex.what();
|
||||
}
|
||||
|
||||
action.modded = true;
|
||||
@@ -417,7 +415,7 @@ PubSub::PubSub()
|
||||
}
|
||||
catch (const std::runtime_error &ex)
|
||||
{
|
||||
log("Error parsing moderation action: {}", ex.what());
|
||||
qDebug() << "Error parsing moderation action:" << ex.what();
|
||||
}
|
||||
};
|
||||
|
||||
@@ -454,7 +452,7 @@ PubSub::PubSub()
|
||||
}
|
||||
catch (const std::runtime_error &ex)
|
||||
{
|
||||
log("Error parsing moderation action: {}", ex.what());
|
||||
qDebug() << "Error parsing moderation action:" << ex.what();
|
||||
}
|
||||
};
|
||||
|
||||
@@ -485,7 +483,7 @@ PubSub::PubSub()
|
||||
}
|
||||
catch (const std::runtime_error &ex)
|
||||
{
|
||||
log("Error parsing moderation action: {}", ex.what());
|
||||
qDebug() << "Error parsing moderation action:" << ex.what();
|
||||
}
|
||||
};
|
||||
|
||||
@@ -516,7 +514,7 @@ PubSub::PubSub()
|
||||
}
|
||||
catch (const std::runtime_error &ex)
|
||||
{
|
||||
log("Error parsing moderation action: {}", ex.what());
|
||||
qDebug() << "Error parsing moderation action:" << ex.what();
|
||||
}
|
||||
};
|
||||
|
||||
@@ -568,7 +566,7 @@ PubSub::PubSub()
|
||||
}
|
||||
catch (const std::runtime_error &ex)
|
||||
{
|
||||
log("Error parsing moderation action: {}", ex.what());
|
||||
qDebug() << "Error parsing moderation action:" << ex.what();
|
||||
}
|
||||
};
|
||||
|
||||
@@ -597,7 +595,7 @@ PubSub::PubSub()
|
||||
}
|
||||
catch (const std::runtime_error &ex)
|
||||
{
|
||||
log("Error parsing moderation action: {}", ex.what());
|
||||
qDebug() << "Error parsing moderation action:" << ex.what();
|
||||
}
|
||||
};
|
||||
|
||||
@@ -626,7 +624,7 @@ PubSub::PubSub()
|
||||
}
|
||||
catch (const std::runtime_error &ex)
|
||||
{
|
||||
log("Error parsing moderation action: {}", ex.what());
|
||||
qDebug() << "Error parsing moderation action:" << ex.what();
|
||||
}
|
||||
};
|
||||
|
||||
@@ -655,7 +653,7 @@ PubSub::PubSub()
|
||||
}
|
||||
catch (const std::runtime_error &ex)
|
||||
{
|
||||
log("Error parsing moderation action: {}", ex.what());
|
||||
qDebug() << "Error parsing moderation action:" << ex.what();
|
||||
}
|
||||
};
|
||||
|
||||
@@ -685,7 +683,7 @@ PubSub::PubSub()
|
||||
}
|
||||
catch (const std::runtime_error &ex)
|
||||
{
|
||||
log("Error parsing moderation action: {}", ex.what());
|
||||
qDebug() << "Error parsing moderation action:" << ex.what();
|
||||
}
|
||||
};
|
||||
|
||||
@@ -738,7 +736,7 @@ void PubSub::addClient()
|
||||
|
||||
if (ec)
|
||||
{
|
||||
log("Unable to establish connection: {}", ec.message());
|
||||
qDebug() << "Unable to establish connection:" << ec.message().c_str();
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -753,20 +751,23 @@ void PubSub::start()
|
||||
|
||||
void PubSub::listenToWhispers(std::shared_ptr<TwitchAccount> account)
|
||||
{
|
||||
static const QString topicFormat("whispers.%1");
|
||||
|
||||
assert(account != nullptr);
|
||||
|
||||
std::string userID = account->getUserId().toStdString();
|
||||
auto userID = account->getUserId();
|
||||
|
||||
log("Connection open!");
|
||||
qDebug() << "Connection open!";
|
||||
websocketpp::lib::error_code ec;
|
||||
|
||||
std::vector<std::string> topics({"whispers." + userID});
|
||||
std::vector<QString> topics({topicFormat.arg(userID)});
|
||||
|
||||
this->listen(createListenMessage(topics, account));
|
||||
|
||||
if (ec)
|
||||
{
|
||||
log("Unable to send message to websocket server: {}", ec.message());
|
||||
qDebug() << "Unable to send message to websocket server:"
|
||||
<< ec.message().c_str();
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -783,26 +784,26 @@ void PubSub::unlistenAllModerationActions()
|
||||
void PubSub::listenToChannelModerationActions(
|
||||
const QString &channelID, std::shared_ptr<TwitchAccount> account)
|
||||
{
|
||||
static const QString topicFormat("chat_moderator_actions.%1.%2");
|
||||
assert(!channelID.isEmpty());
|
||||
assert(account != nullptr);
|
||||
QString userID = account->getUserId();
|
||||
if (userID.isEmpty())
|
||||
return;
|
||||
|
||||
std::string topic(fS("chat_moderator_actions.{}.{}", userID, channelID));
|
||||
auto topic = topicFormat.arg(userID).arg(channelID);
|
||||
|
||||
if (this->isListeningToTopic(topic))
|
||||
{
|
||||
log("We are already listening to topic {}", topic);
|
||||
return;
|
||||
}
|
||||
|
||||
log("Listen to topic {}", topic);
|
||||
qDebug() << "Listen to topic" << topic;
|
||||
|
||||
this->listenToTopic(topic, account);
|
||||
}
|
||||
|
||||
void PubSub::listenToTopic(const std::string &topic,
|
||||
void PubSub::listenToTopic(const QString &topic,
|
||||
std::shared_ptr<TwitchAccount> account)
|
||||
{
|
||||
auto message = createListenMessage({topic}, account);
|
||||
@@ -814,20 +815,19 @@ void PubSub::listen(rapidjson::Document &&msg)
|
||||
{
|
||||
if (this->tryListen(msg))
|
||||
{
|
||||
log("Successfully listened!");
|
||||
return;
|
||||
}
|
||||
|
||||
this->addClient();
|
||||
|
||||
log("Added to the back of the queue");
|
||||
qDebug() << "Added to the back of the queue";
|
||||
this->requests.emplace_back(
|
||||
std::make_unique<rapidjson::Document>(std::move(msg)));
|
||||
}
|
||||
|
||||
bool PubSub::tryListen(rapidjson::Document &msg)
|
||||
{
|
||||
log("tryListen with {} clients", this->clients.size());
|
||||
qDebug() << "tryListen with" << this->clients.size() << "clients";
|
||||
for (const auto &p : this->clients)
|
||||
{
|
||||
const auto &client = p.second;
|
||||
@@ -840,7 +840,7 @@ bool PubSub::tryListen(rapidjson::Document &msg)
|
||||
return false;
|
||||
}
|
||||
|
||||
bool PubSub::isListeningToTopic(const std::string &topic)
|
||||
bool PubSub::isListeningToTopic(const QString &topic)
|
||||
{
|
||||
for (const auto &p : this->clients)
|
||||
{
|
||||
@@ -865,24 +865,24 @@ void PubSub::onMessage(websocketpp::connection_hdl hdl,
|
||||
|
||||
if (!res)
|
||||
{
|
||||
log("Error parsing message '{}' from PubSub: {}", payload,
|
||||
rapidjson::GetParseError_En(res.Code()));
|
||||
qDebug() << "Error parsing message '" << payload.c_str()
|
||||
<< "' from PubSub:" << rapidjson::GetParseError_En(res.Code());
|
||||
return;
|
||||
}
|
||||
|
||||
if (!msg.IsObject())
|
||||
{
|
||||
log("Error parsing message '{}' from PubSub. Root object is not an "
|
||||
"object",
|
||||
payload);
|
||||
qDebug() << "Error parsing message '" << payload.c_str()
|
||||
<< "' from PubSub. Root object is not an "
|
||||
"object";
|
||||
return;
|
||||
}
|
||||
|
||||
std::string type;
|
||||
QString type;
|
||||
|
||||
if (!rj::getSafe(msg, "type", type))
|
||||
{
|
||||
log("Missing required string member `type` in message root");
|
||||
qDebug() << "Missing required string member `type` in message root";
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -894,7 +894,7 @@ void PubSub::onMessage(websocketpp::connection_hdl hdl,
|
||||
{
|
||||
if (!msg.HasMember("data"))
|
||||
{
|
||||
log("Missing required object member `data` in message root");
|
||||
qDebug() << "Missing required object member `data` in message root";
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -902,7 +902,7 @@ void PubSub::onMessage(websocketpp::connection_hdl hdl,
|
||||
|
||||
if (!data.IsObject())
|
||||
{
|
||||
log("Member `data` must be an object");
|
||||
qDebug() << "Member `data` must be an object";
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -922,7 +922,7 @@ void PubSub::onMessage(websocketpp::connection_hdl hdl,
|
||||
}
|
||||
else
|
||||
{
|
||||
log("Unknown message type: {}", type);
|
||||
qDebug() << "Unknown message type:" << type;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -983,7 +983,7 @@ PubSub::WebsocketContextPtr PubSub::onTLSInit(websocketpp::connection_hdl hdl)
|
||||
}
|
||||
catch (const std::exception &e)
|
||||
{
|
||||
log("Exception caught in OnTLSInit: {}", e.what());
|
||||
qDebug() << "Exception caught in OnTLSInit:" << e.what();
|
||||
}
|
||||
|
||||
return ctx;
|
||||
@@ -991,21 +991,21 @@ PubSub::WebsocketContextPtr PubSub::onTLSInit(websocketpp::connection_hdl hdl)
|
||||
|
||||
void PubSub::handleListenResponse(const rapidjson::Document &msg)
|
||||
{
|
||||
std::string error;
|
||||
QString error;
|
||||
|
||||
if (rj::getSafe(msg, "error", error))
|
||||
{
|
||||
std::string nonce;
|
||||
QString nonce;
|
||||
rj::getSafe(msg, "nonce", nonce);
|
||||
|
||||
if (error.empty())
|
||||
if (error.isEmpty())
|
||||
{
|
||||
log("Successfully listened to nonce {}", nonce);
|
||||
qDebug() << "Successfully listened to nonce" << nonce;
|
||||
// Nothing went wrong
|
||||
return;
|
||||
}
|
||||
|
||||
log("PubSub error: {} on nonce {}", error, nonce);
|
||||
qDebug() << "PubSub error:" << error << "on nonce" << nonce;
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -1016,7 +1016,7 @@ void PubSub::handleMessageResponse(const rapidjson::Value &outerData)
|
||||
|
||||
if (!rj::getSafe(outerData, "topic", topic))
|
||||
{
|
||||
log("Missing required string member `topic` in outerData");
|
||||
qDebug() << "Missing required string member `topic` in outerData";
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -1024,7 +1024,7 @@ void PubSub::handleMessageResponse(const rapidjson::Value &outerData)
|
||||
|
||||
if (!rj::getSafe(outerData, "message", payload))
|
||||
{
|
||||
log("Expected string message in outerData");
|
||||
qDebug() << "Expected string message in outerData";
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -1034,8 +1034,8 @@ void PubSub::handleMessageResponse(const rapidjson::Value &outerData)
|
||||
|
||||
if (!res)
|
||||
{
|
||||
log("Error parsing message '{}' from PubSub: {}", payload,
|
||||
rapidjson::GetParseError_En(res.Code()));
|
||||
qDebug() << "Error parsing message '" << payload.c_str()
|
||||
<< "' from PubSub:" << rapidjson::GetParseError_En(res.Code());
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -1045,7 +1045,7 @@ void PubSub::handleMessageResponse(const rapidjson::Value &outerData)
|
||||
|
||||
if (!rj::getSafe(msg, "type", whisperType))
|
||||
{
|
||||
log("Bad whisper data");
|
||||
qDebug() << "Bad whisper data";
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -1063,7 +1063,7 @@ void PubSub::handleMessageResponse(const rapidjson::Value &outerData)
|
||||
}
|
||||
else
|
||||
{
|
||||
log("Invalid whisper type: {}", whisperType);
|
||||
qDebug() << "Invalid whisper type:" << whisperType.c_str();
|
||||
assert(false);
|
||||
return;
|
||||
}
|
||||
@@ -1078,7 +1078,8 @@ void PubSub::handleMessageResponse(const rapidjson::Value &outerData)
|
||||
|
||||
if (!rj::getSafe(data, "moderation_action", moderationAction))
|
||||
{
|
||||
log("Missing moderation action in data: {}", rj::stringify(data));
|
||||
qDebug() << "Missing moderation action in data:"
|
||||
<< rj::stringify(data).c_str();
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -1086,7 +1087,8 @@ void PubSub::handleMessageResponse(const rapidjson::Value &outerData)
|
||||
|
||||
if (handlerIt == this->moderationActionHandlers.end())
|
||||
{
|
||||
log("No handler found for moderation action {}", moderationAction);
|
||||
qDebug() << "No handler found for moderation action"
|
||||
<< moderationAction.c_str();
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -1095,16 +1097,16 @@ void PubSub::handleMessageResponse(const rapidjson::Value &outerData)
|
||||
}
|
||||
else
|
||||
{
|
||||
log("Unknown topic: {}", topic);
|
||||
qDebug() << "Unknown topic:" << topic;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
void PubSub::runThread()
|
||||
{
|
||||
log("Start pubsub manager thread");
|
||||
qDebug() << "Start pubsub manager thread";
|
||||
this->websocketClient.run();
|
||||
log("Done with pubsub manager thread");
|
||||
qDebug() << "Done with pubsub manager thread";
|
||||
}
|
||||
|
||||
} // namespace chatterino
|
||||
|
||||
@@ -15,7 +15,6 @@
|
||||
#include <map>
|
||||
#include <memory>
|
||||
#include <set>
|
||||
#include <string>
|
||||
#include <thread>
|
||||
#include <unordered_map>
|
||||
#include <vector>
|
||||
@@ -33,7 +32,7 @@ using WebsocketErrorCode = websocketpp::lib::error_code;
|
||||
namespace detail {
|
||||
|
||||
struct Listener {
|
||||
std::string topic;
|
||||
QString topic;
|
||||
bool authed;
|
||||
bool persistent;
|
||||
bool confirmed = false;
|
||||
@@ -49,11 +48,11 @@ namespace detail {
|
||||
void stop();
|
||||
|
||||
bool listen(rapidjson::Document &message);
|
||||
void unlistenPrefix(const std::string &prefix);
|
||||
void unlistenPrefix(const QString &prefix);
|
||||
|
||||
void handlePong();
|
||||
|
||||
bool isListeningToTopic(const std::string &topic);
|
||||
bool isListeningToTopic(const QString &topic);
|
||||
|
||||
private:
|
||||
void ping();
|
||||
@@ -135,13 +134,13 @@ public:
|
||||
std::vector<std::unique_ptr<rapidjson::Document>> requests;
|
||||
|
||||
private:
|
||||
void listenToTopic(const std::string &topic,
|
||||
void listenToTopic(const QString &topic,
|
||||
std::shared_ptr<TwitchAccount> account);
|
||||
|
||||
void listen(rapidjson::Document &&msg);
|
||||
bool tryListen(rapidjson::Document &msg);
|
||||
|
||||
bool isListeningToTopic(const std::string &topic);
|
||||
bool isListeningToTopic(const QString &topic);
|
||||
|
||||
void addClient();
|
||||
|
||||
|
||||
@@ -46,9 +46,8 @@ bool getTargetUser(const rapidjson::Value &data, ActionUser &user)
|
||||
return rj::getSafe(data, "target_user_id", user.id);
|
||||
}
|
||||
|
||||
rapidjson::Document createListenMessage(
|
||||
const std::vector<std::string> &topicsVec,
|
||||
std::shared_ptr<TwitchAccount> account)
|
||||
rapidjson::Document createListenMessage(const std::vector<QString> &topicsVec,
|
||||
std::shared_ptr<TwitchAccount> account)
|
||||
{
|
||||
rapidjson::Document msg(rapidjson::kObjectType);
|
||||
auto &a = msg.GetAllocator();
|
||||
@@ -75,8 +74,7 @@ rapidjson::Document createListenMessage(
|
||||
return msg;
|
||||
}
|
||||
|
||||
rapidjson::Document createUnlistenMessage(
|
||||
const std::vector<std::string> &topicsVec)
|
||||
rapidjson::Document createUnlistenMessage(const std::vector<QString> &topicsVec)
|
||||
{
|
||||
rapidjson::Document msg(rapidjson::kObjectType);
|
||||
auto &a = msg.GetAllocator();
|
||||
|
||||
@@ -3,7 +3,6 @@
|
||||
#include <boost/asio.hpp>
|
||||
#include <boost/asio/steady_timer.hpp>
|
||||
#include <memory>
|
||||
#include "debug/Log.hpp"
|
||||
#include "util/RapidjsonHelpers.hpp"
|
||||
|
||||
namespace chatterino {
|
||||
@@ -18,11 +17,10 @@ bool getCreatedByUser(const rapidjson::Value &data, ActionUser &user);
|
||||
|
||||
bool getTargetUser(const rapidjson::Value &data, ActionUser &user);
|
||||
|
||||
rapidjson::Document createListenMessage(
|
||||
const std::vector<std::string> &topicsVec,
|
||||
std::shared_ptr<TwitchAccount> account);
|
||||
rapidjson::Document createListenMessage(const std::vector<QString> &topicsVec,
|
||||
std::shared_ptr<TwitchAccount> account);
|
||||
rapidjson::Document createUnlistenMessage(
|
||||
const std::vector<std::string> &topicsVec);
|
||||
const std::vector<QString> &topicsVec);
|
||||
|
||||
// Create timer using given ioService
|
||||
template <typename Duration, typename Callback>
|
||||
@@ -35,7 +33,7 @@ void runAfter(boost::asio::io_service &ioService, Duration duration,
|
||||
timer->async_wait([timer, cb](const boost::system::error_code &ec) {
|
||||
if (ec)
|
||||
{
|
||||
log("Error in runAfter: {}", ec.message());
|
||||
qDebug() << "Error in runAfter:" << ec.message().c_str();
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -53,7 +51,7 @@ void runAfter(std::shared_ptr<boost::asio::steady_timer> timer,
|
||||
timer->async_wait([timer, cb](const boost::system::error_code &ec) {
|
||||
if (ec)
|
||||
{
|
||||
log("Error in runAfter: {}", ec.message());
|
||||
qDebug() << "Error in runAfter:" << ec.message().c_str();
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -6,7 +6,6 @@
|
||||
#include "common/Env.hpp"
|
||||
#include "common/NetworkRequest.hpp"
|
||||
#include "common/Outcome.hpp"
|
||||
#include "debug/Log.hpp"
|
||||
#include "providers/twitch/PartialTwitchUser.hpp"
|
||||
#include "providers/twitch/TwitchCommon.hpp"
|
||||
#include "singletons/Emotes.hpp"
|
||||
@@ -134,8 +133,8 @@ void TwitchAccount::loadIgnores()
|
||||
TwitchUser ignoredUser;
|
||||
if (!rj::getSafe(userIt->value, ignoredUser))
|
||||
{
|
||||
log("Error parsing twitch user JSON {}",
|
||||
rj::stringify(userIt->value));
|
||||
qDebug() << "Error parsing twitch user JSON"
|
||||
<< rj::stringify(userIt->value).c_str();
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -345,14 +344,14 @@ std::set<TwitchUser> TwitchAccount::getIgnores() const
|
||||
|
||||
void TwitchAccount::loadEmotes()
|
||||
{
|
||||
log("Loading Twitch emotes for user {}", this->getUserName());
|
||||
qDebug() << "Loading Twitch emotes for user" << this->getUserName();
|
||||
|
||||
const auto &clientID = this->getOAuthClient();
|
||||
const auto &oauthToken = this->getOAuthToken();
|
||||
|
||||
if (clientID.isEmpty() || oauthToken.isEmpty())
|
||||
{
|
||||
log("Missing Client ID or OAuth token");
|
||||
qDebug() << "Missing Client ID or OAuth token";
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -363,7 +362,7 @@ void TwitchAccount::loadEmotes()
|
||||
|
||||
.authorizeTwitchV5(this->getOAuthClient(), this->getOAuthToken())
|
||||
.onError([=](NetworkResult result) {
|
||||
log("[TwitchAccount::loadEmotes] Error {}", result.status());
|
||||
qDebug() << "[TwitchAccount::loadEmotes] Error" << result.status();
|
||||
if (result.status() == 203)
|
||||
{
|
||||
// onFinished(FollowResult_NotFollowing);
|
||||
@@ -402,7 +401,8 @@ void TwitchAccount::autoModAllow(const QString msgID)
|
||||
|
||||
.authorizeTwitchV5(this->getOAuthClient(), this->getOAuthToken())
|
||||
.onError([=](NetworkResult result) {
|
||||
log("[TwitchAccounts::autoModAllow] Error {}", result.status());
|
||||
qDebug() << "[TwitchAccounts::autoModAllow] Error"
|
||||
<< result.status();
|
||||
})
|
||||
.execute();
|
||||
}
|
||||
@@ -421,7 +421,8 @@ void TwitchAccount::autoModDeny(const QString msgID)
|
||||
|
||||
.authorizeTwitchV5(this->getOAuthClient(), this->getOAuthToken())
|
||||
.onError([=](NetworkResult result) {
|
||||
log("[TwitchAccounts::autoModDeny] Error {}", result.status());
|
||||
qDebug() << "[TwitchAccounts::autoModDeny] Error"
|
||||
<< result.status();
|
||||
})
|
||||
.execute();
|
||||
}
|
||||
@@ -436,7 +437,7 @@ void TwitchAccount::parseEmotes(const rapidjson::Document &root)
|
||||
auto emoticonSets = root.FindMember("emoticon_sets");
|
||||
if (emoticonSets == root.MemberEnd() || !emoticonSets->value.IsObject())
|
||||
{
|
||||
log("No emoticon_sets in load emotes response");
|
||||
qDebug() << "No emoticon_sets in load emotes response";
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -452,21 +453,21 @@ void TwitchAccount::parseEmotes(const rapidjson::Document &root)
|
||||
{
|
||||
if (!emoteJSON.IsObject())
|
||||
{
|
||||
log("Emote value was invalid");
|
||||
qDebug() << "Emote value was invalid";
|
||||
return;
|
||||
}
|
||||
|
||||
uint64_t idNumber;
|
||||
if (!rj::getSafe(emoteJSON, "id", idNumber))
|
||||
{
|
||||
log("No ID key found in Emote value");
|
||||
qDebug() << "No ID key found in Emote value";
|
||||
return;
|
||||
}
|
||||
|
||||
QString _code;
|
||||
if (!rj::getSafe(emoteJSON, "code", _code))
|
||||
{
|
||||
log("No code key found in Emote value");
|
||||
qDebug() << "No code key found in Emote value";
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -489,7 +490,7 @@ void TwitchAccount::loadEmoteSetData(std::shared_ptr<EmoteSet> emoteSet)
|
||||
{
|
||||
if (!emoteSet)
|
||||
{
|
||||
log("null emote set sent");
|
||||
qDebug() << "null emote set sent";
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -505,7 +506,8 @@ void TwitchAccount::loadEmoteSetData(std::shared_ptr<EmoteSet> emoteSet)
|
||||
NetworkRequest(Env::get().twitchEmoteSetResolverUrl.arg(emoteSet->key))
|
||||
.cache()
|
||||
.onError([](NetworkResult result) {
|
||||
log("Error code {} while loading emote set data", result.status());
|
||||
qDebug() << "Error code" << result.status()
|
||||
<< "while loading emote set data";
|
||||
})
|
||||
.onSuccess([emoteSet](auto result) -> Outcome {
|
||||
auto root = result.parseRapidJson();
|
||||
@@ -527,7 +529,7 @@ void TwitchAccount::loadEmoteSetData(std::shared_ptr<EmoteSet> emoteSet)
|
||||
return Failure;
|
||||
}
|
||||
|
||||
log("Loaded twitch emote set data for {}!", emoteSet->key);
|
||||
qDebug() << "Loaded twitch emote set data for" << emoteSet->key;
|
||||
|
||||
auto name = channelName;
|
||||
name.detach();
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
#include "providers/twitch/TwitchAccountManager.hpp"
|
||||
|
||||
#include "common/Common.hpp"
|
||||
#include "debug/Log.hpp"
|
||||
#include "providers/twitch/TwitchAccount.hpp"
|
||||
#include "providers/twitch/TwitchCommon.hpp"
|
||||
|
||||
@@ -103,23 +102,23 @@ void TwitchAccountManager::reloadUsers()
|
||||
switch (this->addUser(userData))
|
||||
{
|
||||
case AddUserResponse::UserAlreadyExists: {
|
||||
log("User {} already exists", userData.username);
|
||||
qDebug() << "User" << userData.username << "already exists";
|
||||
// Do nothing
|
||||
}
|
||||
break;
|
||||
case AddUserResponse::UserValuesUpdated: {
|
||||
log("User {} already exists, and values updated!",
|
||||
userData.username);
|
||||
qDebug() << "User" << userData.username
|
||||
<< "already exists, and values updated!";
|
||||
if (userData.username == this->getCurrent()->getUserName())
|
||||
{
|
||||
log("It was the current user, so we need to reconnect "
|
||||
"stuff!");
|
||||
qDebug() << "It was the current user, so we need to "
|
||||
"reconnect stuff!";
|
||||
this->currentUserChanged.invoke();
|
||||
}
|
||||
}
|
||||
break;
|
||||
case AddUserResponse::UserAdded: {
|
||||
log("Added user {}", userData.username);
|
||||
qDebug() << "Added user" << userData.username;
|
||||
listUpdated = true;
|
||||
}
|
||||
break;
|
||||
@@ -140,15 +139,12 @@ void TwitchAccountManager::load()
|
||||
auto user = this->findUserByUsername(newUsername);
|
||||
if (user)
|
||||
{
|
||||
log("[AccountManager:currentUsernameChanged] User successfully "
|
||||
"updated to {}",
|
||||
newUsername);
|
||||
qDebug() << "Twitch user updated to" << newUsername;
|
||||
this->currentUser_ = user;
|
||||
}
|
||||
else
|
||||
{
|
||||
log("[AccountManager:currentUsernameChanged] User successfully "
|
||||
"updated to anonymous");
|
||||
qDebug() << "Twitch user updated to anonymous";
|
||||
this->currentUser_ = this->anonymousUser_;
|
||||
}
|
||||
|
||||
@@ -170,11 +166,13 @@ bool TwitchAccountManager::isLoggedIn() const
|
||||
|
||||
bool TwitchAccountManager::removeUser(TwitchAccount *account)
|
||||
{
|
||||
static const QString accountFormat("/accounts/uid%1");
|
||||
|
||||
auto userID(account->getUserId());
|
||||
if (!userID.isEmpty())
|
||||
{
|
||||
pajlada::Settings::SettingManager::removeSetting(
|
||||
fS("/accounts/uid{}", userID));
|
||||
accountFormat.arg(userID).toStdString());
|
||||
}
|
||||
|
||||
if (account->getUserName() == this->currentUsername)
|
||||
|
||||
@@ -2,7 +2,6 @@
|
||||
|
||||
#include "common/Common.hpp"
|
||||
#include "common/NetworkRequest.hpp"
|
||||
#include "debug/Log.hpp"
|
||||
#include "providers/twitch/TwitchCommon.hpp"
|
||||
|
||||
#include <QString>
|
||||
@@ -23,22 +22,23 @@ void TwitchApi::findUserId(const QString user,
|
||||
auto root = result.parseJson();
|
||||
if (!root.value("users").isArray())
|
||||
{
|
||||
log("API Error while getting user id, users is not an array");
|
||||
qDebug()
|
||||
<< "API Error while getting user id, users is not an array";
|
||||
successCallback("");
|
||||
return Failure;
|
||||
}
|
||||
auto users = root.value("users").toArray();
|
||||
if (users.size() != 1)
|
||||
{
|
||||
log("API Error while getting user id, users array size is not "
|
||||
"1");
|
||||
qDebug() << "API Error while getting user id, users array size "
|
||||
"is not 1";
|
||||
successCallback("");
|
||||
return Failure;
|
||||
}
|
||||
if (!users[0].isObject())
|
||||
{
|
||||
log("API Error while getting user id, first user is not an "
|
||||
"object");
|
||||
qDebug() << "API Error while getting user id, first user is "
|
||||
"not an object";
|
||||
successCallback("");
|
||||
return Failure;
|
||||
}
|
||||
@@ -46,10 +46,8 @@ void TwitchApi::findUserId(const QString user,
|
||||
auto id = firstUser.value("_id");
|
||||
if (!id.isString())
|
||||
{
|
||||
log("API Error: while getting user id, first user object `_id` "
|
||||
"key "
|
||||
"is not a "
|
||||
"string");
|
||||
qDebug() << "API Error: while getting user id, first user "
|
||||
"object `_id` key is not a string";
|
||||
successCallback("");
|
||||
return Failure;
|
||||
}
|
||||
@@ -73,8 +71,8 @@ void TwitchApi::findUserName(const QString userid,
|
||||
auto name = root.value("name");
|
||||
if (!name.isString())
|
||||
{
|
||||
log("API Error: while getting user name, `name` is not a "
|
||||
"string");
|
||||
qDebug() << "API Error: while getting user name, `name` is not "
|
||||
"a string";
|
||||
successCallback("");
|
||||
return Failure;
|
||||
}
|
||||
|
||||
@@ -7,7 +7,6 @@
|
||||
|
||||
#include "common/NetworkRequest.hpp"
|
||||
#include "common/Outcome.hpp"
|
||||
#include "debug/Log.hpp"
|
||||
#include "messages/Emote.hpp"
|
||||
|
||||
namespace chatterino {
|
||||
|
||||
@@ -6,7 +6,6 @@
|
||||
#include "common/NetworkRequest.hpp"
|
||||
#include "controllers/accounts/AccountController.hpp"
|
||||
#include "controllers/notifications/NotificationController.hpp"
|
||||
#include "debug/Log.hpp"
|
||||
#include "messages/Message.hpp"
|
||||
#include "providers/bttv/BttvEmotes.hpp"
|
||||
#include "providers/bttv/LoadBttvChannelEmote.hpp"
|
||||
@@ -92,7 +91,7 @@ TwitchChannel::TwitchChannel(const QString &name,
|
||||
, mod_(false)
|
||||
, titleRefreshedTime_(QTime::currentTime().addSecs(-TITLE_REFRESH_PERIOD))
|
||||
{
|
||||
log("[TwitchChannel:{}] Opened", name);
|
||||
qDebug() << "[TwitchChannel" << name << "] Opened";
|
||||
|
||||
this->liveStatusChanged.connect([this]() {
|
||||
if (this->isLive() == 1)
|
||||
@@ -194,7 +193,8 @@ void TwitchChannel::sendMessage(const QString &message)
|
||||
return;
|
||||
}
|
||||
|
||||
log("[TwitchChannel:{}] Send message: {}", this->getName(), message);
|
||||
qDebug() << "[TwitchChannel" << this->getName()
|
||||
<< "] Send message:" << message;
|
||||
|
||||
// Do last message processing
|
||||
QString parsedMessage = app->emotes->emojis.replaceShortCodes(message);
|
||||
@@ -491,8 +491,8 @@ void TwitchChannel::refreshLiveStatus()
|
||||
|
||||
if (roomID.isEmpty())
|
||||
{
|
||||
log("[TwitchChannel:{}] Refreshing live status (Missing ID)",
|
||||
this->getName());
|
||||
qDebug() << "[TwitchChannel" << this->getName()
|
||||
<< "] Refreshing live status (Missing ID)";
|
||||
this->setLive(false);
|
||||
return;
|
||||
}
|
||||
@@ -517,13 +517,13 @@ Outcome TwitchChannel::parseLiveStatus(const rapidjson::Document &document)
|
||||
{
|
||||
if (!document.IsObject())
|
||||
{
|
||||
log("[TwitchChannel:refreshLiveStatus] root is not an object");
|
||||
qDebug() << "[TwitchChannel:refreshLiveStatus] root is not an object";
|
||||
return Failure;
|
||||
}
|
||||
|
||||
if (!document.HasMember("stream"))
|
||||
{
|
||||
log("[TwitchChannel:refreshLiveStatus] Missing stream in root");
|
||||
qDebug() << "[TwitchChannel:refreshLiveStatus] Missing stream in root";
|
||||
return Failure;
|
||||
}
|
||||
|
||||
@@ -539,7 +539,8 @@ Outcome TwitchChannel::parseLiveStatus(const rapidjson::Document &document)
|
||||
if (!stream.HasMember("viewers") || !stream.HasMember("game") ||
|
||||
!stream.HasMember("channel") || !stream.HasMember("created_at"))
|
||||
{
|
||||
log("[TwitchChannel:refreshLiveStatus] Missing members in stream");
|
||||
qDebug()
|
||||
<< "[TwitchChannel:refreshLiveStatus] Missing members in stream";
|
||||
this->setLive(false);
|
||||
return Failure;
|
||||
}
|
||||
@@ -548,8 +549,8 @@ Outcome TwitchChannel::parseLiveStatus(const rapidjson::Document &document)
|
||||
|
||||
if (!streamChannel.IsObject() || !streamChannel.HasMember("status"))
|
||||
{
|
||||
log("[TwitchChannel:refreshLiveStatus] Missing member \"status\" in "
|
||||
"channel");
|
||||
qDebug() << "[TwitchChannel:refreshLiveStatus] Missing member "
|
||||
"\"status\" in channel";
|
||||
return Failure;
|
||||
}
|
||||
|
||||
@@ -836,7 +837,7 @@ boost::optional<CheerEmote> TwitchChannel::cheerEmote(const QString &string)
|
||||
int bitAmount = amount.toInt(&ok);
|
||||
if (!ok)
|
||||
{
|
||||
log("Error parsing bit amount in cheerEmote");
|
||||
qDebug() << "Error parsing bit amount in cheerEmote";
|
||||
}
|
||||
for (const auto &emote : set.cheerEmotes)
|
||||
{
|
||||
|
||||
@@ -2,7 +2,6 @@
|
||||
|
||||
#include "common/NetworkRequest.hpp"
|
||||
#include "debug/Benchmark.hpp"
|
||||
#include "debug/Log.hpp"
|
||||
#include "messages/Emote.hpp"
|
||||
#include "messages/Image.hpp"
|
||||
#include "util/RapidjsonHelpers.hpp"
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
#include "providers/twitch/TwitchHelpers.hpp"
|
||||
#include "debug/Log.hpp"
|
||||
|
||||
namespace chatterino {
|
||||
|
||||
@@ -7,7 +6,7 @@ bool trimChannelName(const QString &channelName, QString &outChannelName)
|
||||
{
|
||||
if (channelName.length() < 2)
|
||||
{
|
||||
log("channel name length below 2");
|
||||
qDebug() << "channel name length below 2";
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -5,7 +5,6 @@
|
||||
#include "controllers/highlights/HighlightController.hpp"
|
||||
#include "controllers/ignores/IgnoreController.hpp"
|
||||
#include "controllers/pings/PingController.hpp"
|
||||
#include "debug/Log.hpp"
|
||||
#include "messages/Message.hpp"
|
||||
#include "providers/chatterino/ChatterinoBadges.hpp"
|
||||
#include "providers/twitch/TwitchBadges.hpp"
|
||||
@@ -90,8 +89,6 @@ namespace {
|
||||
QStringList parts = badgeInfo.split('/');
|
||||
if (parts.size() != 2)
|
||||
{
|
||||
log("Skipping badge-info because it split weird: {}",
|
||||
badgeInfo);
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -110,7 +107,6 @@ namespace {
|
||||
QStringList parts = badge.split('/');
|
||||
if (parts.size() != 2)
|
||||
{
|
||||
log("Skipping badge because it split weird: {}", badge);
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -159,8 +155,8 @@ bool TwitchMessageBuilder::isIgnored() const
|
||||
{
|
||||
if (phrase.isBlock() && phrase.isMatch(this->originalMessage_))
|
||||
{
|
||||
log("Blocking message because it contains ignored phrase {}",
|
||||
phrase.getPattern());
|
||||
qDebug() << "Blocking message because it contains ignored phrase"
|
||||
<< phrase.getPattern();
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -190,8 +186,8 @@ bool TwitchMessageBuilder::isIgnored() const
|
||||
case ShowIgnoredUsersMessages::Never:
|
||||
break;
|
||||
}
|
||||
log("Blocking message because it's from blocked user {}",
|
||||
user.name);
|
||||
qDebug() << "Blocking message because it's from blocked user"
|
||||
<< user.name;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -427,8 +423,8 @@ void TwitchMessageBuilder::addWords(
|
||||
auto emoteImage = std::get<1>(*currentTwitchEmote);
|
||||
if (emoteImage == nullptr)
|
||||
{
|
||||
log("emoteImage nullptr {}",
|
||||
std::get<2>(*currentTwitchEmote).string);
|
||||
qDebug() << "emoteImage nullptr"
|
||||
<< std::get<2>(*currentTwitchEmote).string;
|
||||
}
|
||||
this->emplace<EmoteElement>(emoteImage,
|
||||
MessageElementFlag::TwitchEmote);
|
||||
@@ -771,7 +767,7 @@ void TwitchMessageBuilder::runIgnoreReplaces(
|
||||
{
|
||||
if (std::get<1>(*copy) == nullptr)
|
||||
{
|
||||
log("remem nullptr {}", std::get<2>(*copy).string);
|
||||
qDebug() << "remem nullptr" << std::get<2>(*copy).string;
|
||||
}
|
||||
}
|
||||
std::vector<std::tuple<int, EmotePtr, EmoteName>> v(
|
||||
@@ -809,7 +805,7 @@ void TwitchMessageBuilder::runIgnoreReplaces(
|
||||
{
|
||||
if (emote.second == nullptr)
|
||||
{
|
||||
log("emote null {}", emote.first.string);
|
||||
qDebug() << "emote null" << emote.first.string;
|
||||
}
|
||||
twitchEmotes.push_back(std::tuple<int, EmotePtr, EmoteName>{
|
||||
startIndex + pos, emote.second, emote.first});
|
||||
@@ -872,7 +868,7 @@ void TwitchMessageBuilder::runIgnoreReplaces(
|
||||
{
|
||||
if (std::get<1>(tup) == nullptr)
|
||||
{
|
||||
log("v nullptr {}", std::get<2>(tup).string);
|
||||
qDebug() << "v nullptr" << std::get<2>(tup).string;
|
||||
continue;
|
||||
}
|
||||
QRegularExpression emoteregex(
|
||||
@@ -941,7 +937,7 @@ void TwitchMessageBuilder::runIgnoreReplaces(
|
||||
{
|
||||
if (std::get<1>(tup) == nullptr)
|
||||
{
|
||||
log("v nullptr {}", std::get<2>(tup).string);
|
||||
qDebug() << "v nullptr" << std::get<2>(tup).string;
|
||||
continue;
|
||||
}
|
||||
QRegularExpression emoteregex(
|
||||
@@ -991,8 +987,8 @@ void TwitchMessageBuilder::parseHighlights()
|
||||
{
|
||||
continue;
|
||||
}
|
||||
log("Highlight because user {} sent a message",
|
||||
this->ircMessage->nick());
|
||||
qDebug() << "Highlight because user" << this->ircMessage->nick()
|
||||
<< "sent a message";
|
||||
if (!this->highlightVisual_)
|
||||
{
|
||||
this->highlightVisual_ = true;
|
||||
@@ -1044,8 +1040,8 @@ void TwitchMessageBuilder::parseHighlights()
|
||||
continue;
|
||||
}
|
||||
|
||||
log("Highlight because {} matches {}", this->originalMessage_,
|
||||
highlight.getPattern());
|
||||
qDebug() << "Highlight because" << this->originalMessage_ << "matches"
|
||||
<< highlight.getPattern();
|
||||
if (!this->highlightVisual_)
|
||||
{
|
||||
this->highlightVisual_ = true;
|
||||
@@ -1130,7 +1126,7 @@ void TwitchMessageBuilder::appendTwitchEmote(
|
||||
start, app->emotes->twitch.getOrCreateEmote(id, name), name};
|
||||
if (std::get<1>(tup) == nullptr)
|
||||
{
|
||||
log("nullptr {}", std::get<2>(tup).string);
|
||||
qDebug() << "nullptr" << std::get<2>(tup).string;
|
||||
}
|
||||
vec.push_back(std::move(tup));
|
||||
}
|
||||
@@ -1216,7 +1212,7 @@ void TwitchMessageBuilder::appendTwitchBadges()
|
||||
auto badgeEmote = this->getTwitchBadge(badge);
|
||||
if (!badgeEmote)
|
||||
{
|
||||
log("No channel/global variant found {}", badge.key_);
|
||||
qDebug() << "No channel/global variant found" << badge.key_;
|
||||
continue;
|
||||
}
|
||||
auto tooltip = (*badgeEmote)->tooltip.string;
|
||||
|
||||
Reference in New Issue
Block a user