fix: why did this even compile???

This commit is contained in:
Nerixyz 2024-10-19 17:52:40 +02:00
parent c2caef1de4
commit da9b747089
No known key found for this signature in database
GPG key ID: 946BA188C5609CCC
4 changed files with 14 additions and 12 deletions

View file

@ -2010,7 +2010,7 @@ std::pair<MessagePtrMut, HighlightAlert> MessageBuilder::makeIrcMessage(
return {builder.release(), highlight};
}
void MessageBuilder::addEmoji(EmotePtr emote)
void MessageBuilder::addEmoji(const EmotePtr &emote)
{
this->emplace<EmoteElement>(emote, MessageElementFlag::EmojiAll);
}
@ -2667,11 +2667,12 @@ void MessageBuilder::addWords(
getApp()->getEmotes()->getEmojis()->parse(preText))
{
boost::apply_visitor(variant::Overloaded{
[&](EmotePtr emote) {
this->addEmoji(std::move(emote));
[&](const EmotePtr &emote) {
this->addEmoji(emote);
},
[&](const QString &text) {
this->addTextOrEmote(state, text);
[&](QString text) {
this->addTextOrEmote(
state, std::move(text));
},
},
variant);
@ -2691,8 +2692,8 @@ void MessageBuilder::addWords(
for (auto variant : getApp()->getEmotes()->getEmojis()->parse(word))
{
boost::apply_visitor(variant::Overloaded{
[&](EmotePtr emote) {
this->addEmoji(std::move(emote));
[&](const EmotePtr &emote) {
this->addEmoji(emote);
},
[&](QString text) {
this->addTextOrEmote(state,

View file

@ -260,7 +260,7 @@ private:
bool bitsStacked = false;
int bitsLeft = 0;
};
void addEmoji(EmotePtr emote);
void addEmoji(const EmotePtr &emote);
void addTextOrEmote(TextState &state, QString string);
Outcome tryAppendCheermote(TextState &state, const QString &string);

View file

@ -663,8 +663,9 @@ std::vector<MessagePtr> parsePrivMessage(Channel *channel,
std::vector<MessagePtr> builtMessages;
MessageParseArgs args;
auto [built, alert] = MessageBuilder::makeIrcMessage(
channel, message, args, message->content(), message->isAction(), 0);
args.isAction = message->isAction();
auto [built, alert] = MessageBuilder::makeIrcMessage(channel, message, args,
message->content(), 0);
if (built)
{
builtMessages.emplace_back(std::move(built));
@ -1019,7 +1020,7 @@ void IrcMessageHandler::handleWhisperMessage(Communi::IrcMessage *ircMessage)
auto [message, alert] = MessageBuilder::makeIrcMessage(
c, ircMessage, args, unescapeZeroWidthJoiner(ircMessage->parameter(1)),
false, 0);
0);
if (!message)
{
return;

View file

@ -286,7 +286,7 @@ TEST_F(FiltersF, TypingContextChecks)
QString originalMessage = privmsg->content();
auto [msg, alert] = MessageBuilder::makeIrcMessage(
&channel, privmsg, MessageParseArgs{}, originalMessage, false, 0);
&channel, privmsg, MessageParseArgs{}, originalMessage, 0);
EXPECT_NE(msg.get(), nullptr);