refactor: add Channel::addSystemMessage function (#5500)

This commit is contained in:
pajlada
2024-07-07 22:03:05 +02:00
committed by GitHub
parent 4535823ca8
commit 354079c74c
47 changed files with 443 additions and 588 deletions
+9 -11
View File
@@ -1,6 +1,7 @@
#include "Application.hpp"
#include "common/Args.hpp"
#include "common/Channel.hpp"
#include "common/QLogging.hpp"
#include "common/Version.hpp"
#include "controllers/accounts/AccountController.hpp"
@@ -233,10 +234,10 @@ void Application::initialize(Settings &settings, const Paths &paths)
{
if (auto channel = split->getChannel(); !channel->isEmpty())
{
channel->addMessage(makeSystemMessage(
channel->addSystemMessage(
"Chatterino unexpectedly crashed and restarted. "
"You can disable automatic restarts in the "
"settings."));
"settings.");
}
}
}
@@ -584,9 +585,8 @@ void Application::initPubSub()
QString text =
QString("%1 cleared the chat.").arg(action.source.login);
auto msg = makeSystemMessage(text);
postToThread([chan, msg] {
chan->addMessage(msg);
postToThread([chan, text] {
chan->addSystemMessage(text);
});
});
@@ -610,9 +610,8 @@ void Application::initPubSub()
text += QString(" (%1 seconds)").arg(action.duration);
}
auto msg = makeSystemMessage(text);
postToThread([chan, msg] {
chan->addMessage(msg);
postToThread([chan, text] {
chan->addSystemMessage(text);
});
});
@@ -631,9 +630,8 @@ void Application::initPubSub()
(action.modded ? "modded" : "unmodded"),
action.target.login);
auto msg = makeSystemMessage(text);
postToThread([chan, msg] {
chan->addMessage(msg);
postToThread([chan, text] {
chan->addSystemMessage(text);
});
});