Repository navigation
chore: refactor TwitchIrcServer - #5421
Conversation
we currently don't uninitialize it (meaning we don't change anything yet)
This will be used, in the interim, for non-overloaded-TwitchIrcServer functions (e.g. getOrAddChannel), to allow for full mocking. This is not the intended final state of these classes, but will make it easier to move functionality out of things when that step is taken.
IrcMessageHandler This is ugly
2cbaaec to
c3f99c7
Compare
| return nullptr; | ||
| } | ||
|
|
||
| IAbstractIrcServer *getTwitchAbstract() override |
There was a problem hiding this comment.
warning: method 'getTwitchAbstract' can be made static [readability-convert-member-functions-to-static]
| IAbstractIrcServer *getTwitchAbstract() override | |
| static IAbstractIrcServer *getTwitchAbstract() override |
|
|
||
| IAbstractIrcServer *getTwitchAbstract() override | ||
| { | ||
| assert(false && "EmptyApplication::getTwitchAbstract was called " |
There was a problem hiding this comment.
warning: implicit conversion 'const char *' -> 'bool' [readability-implicit-bool-conversion]
assert(false && "EmptyApplication::getTwitchAbstract was called "
^this fix will not be applied because it overlaps with another fix
| IAbstractIrcServer *getTwitchAbstract() override | ||
| { | ||
| assert(false && "EmptyApplication::getTwitchAbstract was called " | ||
| "without being initialized"); |
There was a problem hiding this comment.
warning: redundant boolean literal supplied to boolean operator [readability-simplify-boolean-expr]
| "without being initialized"); | |
| assert(false); |
| @@ -2,8 +2,13 @@ | |||
|
|
|||
| #include "mocks/Channel.hpp" | |||
There was a problem hiding this comment.
warning: 'mocks/Channel.hpp' file not found [clang-diagnostic-error]
#include "mocks/Channel.hpp"
^| #include "mocks/Channel.hpp" | ||
| #include "providers/bttv/BttvEmotes.hpp" | ||
| #include "providers/bttv/BttvLiveUpdates.hpp" | ||
| #include "providers/ffz/FfzEmotes.hpp" |
There was a problem hiding this comment.
warning: included header BttvLiveUpdates.hpp is not used directly [misc-include-cleaner]
| #include "providers/ffz/FfzEmotes.hpp" | |
| #include "providers/ffz/FfzEmotes.hpp" |
| virtual void forEachChannel(std::function<void(ChannelPtr)> func) = 0; | ||
| }; | ||
|
|
||
| class AbstractIrcServer : public IAbstractIrcServer, public QObject |
There was a problem hiding this comment.
warning: no header providing "QObject" is directly included [misc-include-cleaner]
src/providers/irc/AbstractIrcServer.hpp:9:
+ #include <qobject.h>|
|
||
| void addMessage(Communi::IrcMessage *message, const ChannelPtr &chan, | ||
| const QString &originalContent, TwitchIrcServer &server, | ||
| const QString &originalContent, ITwitchIrcServer &server, |
There was a problem hiding this comment.
warning: no header providing "QString" is directly included [misc-include-cleaner]
src/providers/twitch/IrcMessageHandler.hpp:5:
+ #include <qobject.h>| sent = true; | ||
| } | ||
|
|
||
| std::unique_ptr<BttvLiveUpdates> &TwitchIrcServer::getBTTVLiveUpdates() |
There was a problem hiding this comment.
warning: no header providing "std::unique_ptr" is directly included [misc-include-cleaner]
std::unique_ptr<BttvLiveUpdates> &TwitchIrcServer::getBTTVLiveUpdates()
^| virtual ~ITwitchIrcServer() = default; | ||
|
|
||
| virtual void forEachChannelAndSpecialChannels( | ||
| std::function<void(ChannelPtr)> func) = 0; |
There was a problem hiding this comment.
warning: no header providing "std::function" is directly included [misc-include-cleaner]
src/providers/twitch/TwitchIrcServer.hpp:10:
- #include <memory>
+ #include <functional>
+ #include <memory>| std::function<void(ChannelPtr)> func) = 0; | ||
|
|
||
| virtual std::shared_ptr<Channel> getChannelOrEmptyByID( | ||
| const QString &channelID) = 0; |
There was a problem hiding this comment.
warning: no header providing "QString" is directly included [misc-include-cleaner]
src/providers/twitch/TwitchIrcServer.hpp:8:
+ #include <qhashfunctions.h>
This PR aims to remove all direct uses of
getApp()->twitch, ensuring we can add tests for anything adjacent toTwitchIrcServerThe class and its inheritance is ugly, so this refactor PR is also pretty ugly. To achieve the goal of this PR without making too many changes, I've added
getTwitchAbstract()alongsidegetTwitch()which returns theIAbstractIrcServerof theTwitchIrcServer.