diff --git a/src/controllers/ignores/IgnoreController.hpp b/src/controllers/ignores/IgnoreController.hpp index 10c83ac10..1279f4a88 100644 --- a/src/controllers/ignores/IgnoreController.hpp +++ b/src/controllers/ignores/IgnoreController.hpp @@ -12,6 +12,8 @@ class Paths; class IgnoreModel; +enum class ShowIgnoredUsersMessages { Never, IfModerator, IfBroadcaster }; + class IgnoreController final : public Singleton { public: diff --git a/src/providers/twitch/TwitchMessageBuilder.cpp b/src/providers/twitch/TwitchMessageBuilder.cpp index 3f1f94b9f..099772074 100644 --- a/src/providers/twitch/TwitchMessageBuilder.cpp +++ b/src/providers/twitch/TwitchMessageBuilder.cpp @@ -80,6 +80,19 @@ bool TwitchMessageBuilder::isIgnored() const { if (sourceUserID == user.id) { + switch (static_cast( + getSettings()->showIgnoredUsersMessages.getValue())) + { + case ShowIgnoredUsersMessages::IfModerator: + if (this->channel->isMod() || + this->channel->isBroadcaster()) + return false; + break; + case ShowIgnoredUsersMessages::IfBroadcaster: + if (this->channel->isBroadcaster()) + return false; + break; + } log("Blocking message because it's from blocked user {}", user.name); return true; diff --git a/src/singletons/Settings.hpp b/src/singletons/Settings.hpp index 953374193..ff71733cb 100644 --- a/src/singletons/Settings.hpp +++ b/src/singletons/Settings.hpp @@ -128,6 +128,7 @@ public: /// Ingored Users BoolSetting enableTwitchIgnoredUsers = {"/ignore/enableTwitchIgnoredUsers", true}; + IntSetting showIgnoredUsersMessages = {"/ignore/showIgnoredUsers", 0}; /// Moderation QStringSetting timeoutAction = {"/moderation/timeoutAction", "Disable"}; diff --git a/src/widgets/settingspages/IgnoresPage.cpp b/src/widgets/settingspages/IgnoresPage.cpp index 122dc1109..daf941cf6 100644 --- a/src/widgets/settingspages/IgnoresPage.cpp +++ b/src/widgets/settingspages/IgnoresPage.cpp @@ -77,8 +77,24 @@ void addUsersTab(IgnoresPage &page, LayoutCreator users, auto anyways = users.emplace().withoutMargin(); { - anyways.emplace("Show anyways if:"); - anyways.emplace(); + anyways.emplace("Show messages from ignored users anyways:"); + + auto combo = anyways.emplace().getElement(); + combo->addItems( + {"Never", "If you are Moderator", "If you are Broadcaster"}); + + auto &setting = getSettings()->showIgnoredUsersMessages; + + setting.connect( + [combo](const int value) { combo->setCurrentIndex(value); }); + + QObject::connect(combo, + QOverload::of(&QComboBox::currentIndexChanged), + [&setting](int index) { + if (index != -1) + setting = index; + }); + anyways->addStretch(1); }