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
+3 -2
View File
@@ -1,5 +1,6 @@
#include "IrcChannel2.hpp"
#include "common/Channel.hpp"
#include "debug/AssertInGuiThread.hpp"
#include "messages/Message.hpp"
#include "messages/MessageBuilder.hpp"
@@ -28,7 +29,7 @@ void IrcChannel::sendMessage(const QString &message)
if (message.startsWith("/"))
{
int index = message.indexOf(' ', 1);
auto index = message.indexOf(' ', 1);
QString command = message.mid(1, index - 1);
QString params = index == -1 ? "" : message.mid(index + 1);
@@ -73,7 +74,7 @@ void IrcChannel::sendMessage(const QString &message)
}
else
{
this->addMessage(makeSystemMessage("You are not connected."));
this->addSystemMessage("You are not connected.");
}
}
}
+3 -3
View File
@@ -27,7 +27,7 @@ Outcome invokeIrcCommand(const QString &commandName, const QString &allParams,
if (auto it = staticMessages.find(cmd); it != staticMessages.end())
{
channel.addMessage(makeSystemMessage(it->second));
channel.addSystemMessage(it->second);
return Success;
}
@@ -57,8 +57,8 @@ Outcome invokeIrcCommand(const QString &commandName, const QString &allParams,
{
if (params.size() < 2)
{
channel.addMessage(
makeSystemMessage("Usage: /kick <channel> <client> [message]"));
channel.addSystemMessage(
"Usage: /kick <channel> <client> [message]");
return Failure;
}
const auto &channelParam = params[0];
+4 -4
View File
@@ -84,10 +84,10 @@ void IrcServer::initializeConnectionSignals(IrcConnection *connection,
{
if (auto shared = weak.lock())
{
shared->addMessage(makeSystemMessage(
shared->addSystemMessage(
QStringLiteral("Socket error: ") +
QAbstractSocket::staticMetaObject.enumerator(index)
.valueToKey(error)));
.valueToKey(error));
}
}
});
@@ -270,7 +270,7 @@ void IrcServer::readConnectionMessageReceived(Communi::IrcMessage *message)
{
if (message->nick() == this->data_->nick)
{
shared->addMessage(makeSystemMessage("joined"));
shared->addSystemMessage("joined");
}
else
{
@@ -295,7 +295,7 @@ void IrcServer::readConnectionMessageReceived(Communi::IrcMessage *message)
{
if (message->nick() == this->data_->nick)
{
shared->addMessage(makeSystemMessage("parted"));
shared->addSystemMessage("parted");
}
else
{