Added interface for highlights to Application (#3808)

This commit is contained in:
Kasia 2022-06-09 16:37:52 +02:00 committed by GitHub
parent 9219647b6a
commit 683701623a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 17 additions and 1 deletions

View file

@ -2,6 +2,7 @@
#include "BaseSettings.hpp" #include "BaseSettings.hpp"
#include "common/Channel.hpp" #include "common/Channel.hpp"
#include "controllers/accounts/AccountController.hpp" #include "controllers/accounts/AccountController.hpp"
#include "controllers/highlights/HighlightController.hpp"
#include "controllers/highlights/HighlightPhrase.hpp" #include "controllers/highlights/HighlightPhrase.hpp"
#include "messages/Message.hpp" #include "messages/Message.hpp"
#include "messages/SharedMessageBuilder.hpp" #include "messages/SharedMessageBuilder.hpp"
@ -83,6 +84,10 @@ public:
{ {
return nullptr; return nullptr;
} }
HighlightController *getHighlights() override
{
return &this->highlights;
}
TwitchIrcServer *getTwitch() override TwitchIrcServer *getTwitch() override
{ {
return nullptr; return nullptr;
@ -97,6 +102,7 @@ public:
} }
AccountController accounts; AccountController accounts;
HighlightController highlights;
// TODO: Figure this out // TODO: Figure this out
}; };

View file

@ -46,6 +46,7 @@ public:
virtual WindowManager *getWindows() = 0; virtual WindowManager *getWindows() = 0;
virtual Toasts *getToasts() = 0; virtual Toasts *getToasts() = 0;
virtual CommandController *getCommands() = 0; virtual CommandController *getCommands() = 0;
virtual HighlightController *getHighlights() = 0;
virtual NotificationController *getNotifications() = 0; virtual NotificationController *getNotifications() = 0;
virtual TwitchIrcServer *getTwitch() = 0; virtual TwitchIrcServer *getTwitch() = 0;
virtual ChatterinoBadges *getChatterinoBadges() = 0; virtual ChatterinoBadges *getChatterinoBadges() = 0;
@ -124,6 +125,10 @@ public:
{ {
return this->notifications; return this->notifications;
} }
HighlightController *getHighlights() override
{
return this->highlights;
}
TwitchIrcServer *getTwitch() override TwitchIrcServer *getTwitch() override
{ {
return this->twitch; return this->twitch;

View file

@ -155,7 +155,7 @@ void SharedMessageBuilder::parseHighlights()
} }
auto badges = SharedMessageBuilder::parseBadgeTag(this->tags); auto badges = SharedMessageBuilder::parseBadgeTag(this->tags);
auto [highlighted, highlightResult] = getApp()->highlights->check( auto [highlighted, highlightResult] = getIApp()->getHighlights()->check(
this->args, badges, this->ircMessage->nick(), this->originalMessage_); this->args, badges, this->ircMessage->nick(), this->originalMessage_);
if (!highlighted) if (!highlighted)

View file

@ -54,6 +54,10 @@ public:
{ {
return nullptr; return nullptr;
} }
HighlightController *getHighlights() override
{
return &this->highlights;
}
TwitchIrcServer *getTwitch() override TwitchIrcServer *getTwitch() override
{ {
return nullptr; return nullptr;
@ -68,6 +72,7 @@ public:
} }
AccountController accounts; AccountController accounts;
HighlightController highlights;
// TODO: Figure this out // TODO: Figure this out
}; };