chore: remove dead code and get rid of MSVC warnings (#6024)

This commit is contained in:
nerix
2025-03-03 13:30:11 +01:00
committed by GitHub
parent d7166fae9f
commit cd8247f921
7 changed files with 9 additions and 46 deletions
+1
View File
@@ -52,6 +52,7 @@
- Dev: BTTV emotes are now loaded as WEBP. (#5957) - Dev: BTTV emotes are now loaded as WEBP. (#5957)
- Dev: Reduced time we wait for PubSub connections to cleanly exit from 1s to 100ms. (#6019) - Dev: Reduced time we wait for PubSub connections to cleanly exit from 1s to 100ms. (#6019)
- Dev: Added snapshot tests for EventSub. (#5965) - Dev: Added snapshot tests for EventSub. (#5965)
- Dev: Removed dead code and some MSVC warnings. (#6024)
## 2.5.2 ## 2.5.2
+2 -7
View File
@@ -283,9 +283,9 @@ void Channel::replaceMessage(size_t hint, const MessagePtr &message,
} }
} }
void Channel::disableMessage(QString messageID) void Channel::disableMessage(const QString &messageID)
{ {
auto msg = this->findMessage(messageID); auto msg = this->findMessageByID(messageID);
if (msg != nullptr) if (msg != nullptr)
{ {
msg->flags.set(MessageFlag::Disabled); msg->flags.set(MessageFlag::Disabled);
@@ -298,11 +298,6 @@ void Channel::clearMessages()
this->messagesCleared.invoke(); this->messagesCleared.invoke();
} }
MessagePtr Channel::findMessage(QString messageID)
{
return this->findMessageByID(messageID);
}
MessagePtr Channel::findMessageByID(QStringView messageID) MessagePtr Channel::findMessageByID(QStringView messageID)
{ {
MessagePtr res; MessagePtr res;
+1 -3
View File
@@ -99,13 +99,11 @@ public:
void replaceMessage(size_t index, const MessagePtr &replacement); void replaceMessage(size_t index, const MessagePtr &replacement);
void replaceMessage(size_t hint, const MessagePtr &message, void replaceMessage(size_t hint, const MessagePtr &message,
const MessagePtr &replacement); const MessagePtr &replacement);
void disableMessage(QString messageID); void disableMessage(const QString &messageID);
/// Removes all messages from this channel and invokes #messagesCleared /// Removes all messages from this channel and invokes #messagesCleared
void clearMessages(); void clearMessages();
[[deprecated("Use findMessageByID instead")]] MessagePtr findMessage(
QString messageID);
MessagePtr findMessageByID(QStringView messageID) final; MessagePtr findMessageByID(QStringView messageID) final;
bool hasMessages() const; bool hasMessages() const;
@@ -2,12 +2,10 @@
#include "Application.hpp" #include "Application.hpp"
#include "common/Channel.hpp" #include "common/Channel.hpp"
#include "common/network/NetworkResult.hpp"
#include "controllers/accounts/AccountController.hpp" #include "controllers/accounts/AccountController.hpp"
#include "controllers/commands/CommandContext.hpp" #include "controllers/commands/CommandContext.hpp"
#include "messages/Message.hpp" #include "messages/Message.hpp"
#include "messages/MessageBuilder.hpp" #include "messages/MessageBuilder.hpp"
#include "providers/twitch/api/Helix.hpp"
#include "providers/twitch/TwitchAccount.hpp" #include "providers/twitch/TwitchAccount.hpp"
#include "providers/twitch/TwitchChannel.hpp" #include "providers/twitch/TwitchChannel.hpp"
@@ -91,7 +89,7 @@ QString deleteOneMessage(const CommandContext &ctx)
return ""; return "";
} }
auto msg = ctx.channel->findMessage(messageID); auto msg = ctx.channel->findMessageByID(messageID);
if (msg != nullptr) if (msg != nullptr)
{ {
if (msg->loginName == ctx.channel->getName() && if (msg->loginName == ctx.channel->getName() &&
+1 -1
View File
@@ -512,7 +512,7 @@ void IrcMessageHandler::handleClearMessageMessage(Communi::IrcMessage *message)
QString targetID = tags.value("target-msg-id").toString(); QString targetID = tags.value("target-msg-id").toString();
auto msg = chan->findMessage(targetID); auto msg = chan->findMessageByID(targetID);
if (msg == nullptr) if (msg == nullptr)
{ {
return; return;
+2 -2
View File
@@ -924,9 +924,9 @@ void UserInfoPopup::updateUserData()
// get ignoreHighlights state // get ignoreHighlights state
bool isIgnoringHighlights = false; bool isIgnoringHighlights = false;
const auto &vector = getSettings()->blacklistedUsers.raw(); const auto &vector = getSettings()->blacklistedUsers.raw();
for (const auto &user : vector) for (const auto &blockedUser : vector)
{ {
if (this->userName_ == user.getPattern()) if (this->userName_ == blockedUser.getPattern())
{ {
isIgnoringHighlights = true; isIgnoringHighlights = true;
break; break;
+1 -30
View File
@@ -372,36 +372,7 @@ QString SplitInput::handleSendMessage(const std::vector<QString> &arguments)
auto *tc = dynamic_cast<TwitchChannel *>(c.get()); auto *tc = dynamic_cast<TwitchChannel *>(c.get());
if (!tc) if (!tc)
{ {
// Reply to message // this should not fail
auto tc = dynamic_cast<TwitchChannel *>(c.get());
if (!tc)
{
// this should not fail
return "";
}
QString message = this->ui_.textEdit->toPlainText();
if (this->enableInlineReplying_)
{
// Remove @username prefix that is inserted when doing inline replies
message.remove(0, this->replyTarget_->displayName.length() +
1); // remove "@username"
if (!message.isEmpty() && message.at(0) == ' ')
{
message.remove(0, 1); // remove possible space
}
}
message = message.replace('\n', ' ');
QString sendMessage =
getApp()->getCommands()->execCommand(message, c, false);
// Reply within TwitchChannel
tc->sendReply(sendMessage, this->replyTarget_->id);
this->postMessageSend(message, arguments);
return ""; return "";
} }