Skip to content

Commit

Permalink
Fixed subscriptions and announcements not being blockable (#4748)
Browse files Browse the repository at this point in the history
* Check blocks for usernotices

* changelog

* cstd = {.name="C++20"}

* Update CHANGELOG.md

Co-authored-by: Felanbird <41973452+Felanbird@users.noreply.github.com>

---------

Co-authored-by: pajlada <rasmus.karlsson@pajlada.com>
Co-authored-by: Felanbird <41973452+Felanbird@users.noreply.github.com>
  • Loading branch information
3 people authored Aug 5, 2023
1 parent accf91a commit 5727db2
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 0 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
- Bugfix: Fixed highlights sometimes not working after changing sound device, or switching users in your operating system. (#4729)
- Bugfix: Fixed key bindings not showing in context menus on Mac. (#4722)
- Bugfix: Fixed tab completion rarely completing the wrong word. (#4735)
- Bugfix: Fixed an issue where Subscriptions & Announcements that contained ignored phrases would still appear if the Block option was enabled. (#4748)
- Dev: Added command to set Qt's logging filter/rules at runtime (`/c2-set-logging-rules`). (#4637)
- Dev: Added the ability to see & load custom themes from the Themes directory. No stable promises are made of this feature, changes might be made that breaks custom themes without notice. (#4570)
- Dev: Added test cases for emote and tab completion. (#4644)
Expand Down
22 changes: 22 additions & 0 deletions src/providers/twitch/IrcMessageHandler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
#include "common/Literals.hpp"
#include "common/QLogging.hpp"
#include "controllers/accounts/AccountController.hpp"
#include "controllers/ignores/IgnoreController.hpp"
#include "messages/LimitedQueue.hpp"
#include "messages/Link.hpp"
#include "messages/Message.hpp"
Expand Down Expand Up @@ -892,6 +893,16 @@ std::vector<MessagePtr> IrcMessageHandler::parseUserNoticeMessage(
content = parameters[1];
}

if (isIgnoredMessage({
.message = content,
.twitchUserID = tags.value("user-id").toString(),
.isMod = channel->isMod(),
.isBroadcaster = channel->isBroadcaster(),
}))
{
return {};
}

if (specialMessageTypes.contains(msgType))
{
// Messages are not required, so they might be empty
Expand Down Expand Up @@ -953,6 +964,17 @@ void IrcMessageHandler::handleUserNoticeMessage(Communi::IrcMessage *message,
content = parameters[1];
}

auto chn = server.getChannelOrEmpty(target);
if (isIgnoredMessage({
.message = content,
.twitchUserID = tags.value("user-id").toString(),
.isMod = chn->isMod(),
.isBroadcaster = chn->isBroadcaster(),
}))
{
return;
}

if (specialMessageTypes.contains(msgType))
{
// Messages are not required, so they might be empty
Expand Down

0 comments on commit 5727db2

Please sign in to comment.