From 2b5c6ffe338eb4229d612206cce4d185a0828bab Mon Sep 17 00:00:00 2001 From: pajlada Date: Sat, 22 Feb 2020 06:05:36 -0500 Subject: [PATCH] Remove chatroom code (#1561) People who had chatrooms still open should notice no difference at all, since it will just try to join a channel with the chatroom name. Documentation for the closing/deprecation of twitch chat rooms: https://discuss.dev.twitch.tv/t/rooms-are-closing-how-it-affects-the-api-and-irc/22996 https://dev.twitch.tv/docs/change-log (see 2020-01-10 entry) --- CHANGELOG.md | 1 + chatterino.pro | 2 - src/providers/twitch/ChatroomChannel.cpp | 67 ------------------------ src/providers/twitch/ChatroomChannel.hpp | 28 ---------- src/providers/twitch/TwitchIrcServer.cpp | 30 +---------- 5 files changed, 3 insertions(+), 125 deletions(-) delete mode 100644 src/providers/twitch/ChatroomChannel.cpp delete mode 100644 src/providers/twitch/ChatroomChannel.hpp diff --git a/CHANGELOG.md b/CHANGELOG.md index 1e69784f5..a76cf906f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,3 +4,4 @@ - Minor: Emotes in the emote popup are now sorted in the same order as the tab completion (#1549) - Bugfix: Fix preview on hover not working when Animated emotes options was disabled (#1546) - Settings open faster +- Dev: Fully remove Twitch Chatroom support diff --git a/chatterino.pro b/chatterino.pro index 6cf3d8128..029508395 100644 --- a/chatterino.pro +++ b/chatterino.pro @@ -178,7 +178,6 @@ SOURCES += \ src/providers/irc/IrcConnection2.cpp \ src/providers/irc/IrcServer.cpp \ src/providers/LinkResolver.cpp \ - src/providers/twitch/ChatroomChannel.cpp \ src/providers/twitch/IrcMessageHandler.cpp \ src/providers/twitch/PartialTwitchUser.cpp \ src/providers/twitch/PubsubActions.cpp \ @@ -382,7 +381,6 @@ HEADERS += \ src/providers/irc/IrcConnection2.hpp \ src/providers/irc/IrcServer.hpp \ src/providers/LinkResolver.hpp \ - src/providers/twitch/ChatroomChannel.hpp \ src/providers/twitch/EmoteValue.hpp \ src/providers/twitch/IrcMessageHandler.hpp \ src/providers/twitch/PartialTwitchUser.hpp \ diff --git a/src/providers/twitch/ChatroomChannel.cpp b/src/providers/twitch/ChatroomChannel.cpp deleted file mode 100644 index 5f393e427..000000000 --- a/src/providers/twitch/ChatroomChannel.cpp +++ /dev/null @@ -1,67 +0,0 @@ -#include "ChatroomChannel.hpp" - -#include -#include "TwitchApi.hpp" -#include "common/Common.hpp" -#include "messages/Emote.hpp" -#include "providers/bttv/BttvEmotes.hpp" -#include "providers/bttv/LoadBttvChannelEmote.hpp" -#include "singletons/Emotes.hpp" - -namespace chatterino { - -ChatroomChannel::ChatroomChannel(const QString &channelName, - TwitchBadges &globalTwitchBadges, - BttvEmotes &globalBttv, FfzEmotes &globalFfz) - : TwitchChannel(channelName, globalTwitchBadges, globalBttv, globalFfz) -{ - auto listRef = channelName.splitRef(":"); - if (listRef.size() > 2) - { - this->chatroomOwnerId = listRef[1].toString(); - } -} - -void ChatroomChannel::refreshBTTVChannelEmotes() -{ - if (this->chatroomOwnerId.isEmpty()) - { - return; - } - TwitchApi::findUserName( - this->chatroomOwnerId, - [this, weak = weakOf(this)](QString username) { - BttvEmotes::loadChannel(username, [this, weak](auto &&emoteMap) { - if (auto shared = weak.lock()) - this->bttvEmotes_.set( - std::make_shared(std::move(emoteMap))); - }); - if (auto shared = weak.lock()) - { - this->chatroomOwnerName = username; - } - }); -} -void ChatroomChannel::refreshFFZChannelEmotes() -{ - if (this->chatroomOwnerId.isEmpty()) - { - return; - } - FfzEmotes::loadChannel( - this->chatroomOwnerId, - [this](auto &&emoteMap) { - this->ffzEmotes_.set( - std::make_shared(std::move(emoteMap))); - }, - [this](auto &&modBadge) { - this->ffzCustomModBadge_.set(std::move(modBadge)); - }); -} - -const QString &ChatroomChannel::getDisplayName() const -{ - return this->chatroomOwnerName; -} - -} // namespace chatterino diff --git a/src/providers/twitch/ChatroomChannel.hpp b/src/providers/twitch/ChatroomChannel.hpp deleted file mode 100644 index 2ed249141..000000000 --- a/src/providers/twitch/ChatroomChannel.hpp +++ /dev/null @@ -1,28 +0,0 @@ -#pragma once - -#include "TwitchChannel.hpp" - -#include -#include - -namespace chatterino { - -class ChatroomChannel : public TwitchChannel -{ -protected: - explicit ChatroomChannel(const QString &channelName, - TwitchBadges &globalTwitchBadges, - BttvEmotes &globalBttv, FfzEmotes &globalFfz); - virtual void refreshBTTVChannelEmotes() override; - virtual void refreshFFZChannelEmotes() override; - virtual const QString &getDisplayName() const override; - - QString chatroomOwnerId; - QString chatroomOwnerName; - - friend class TwitchIrcServer; - friend class TwitchMessageBuilder; - friend class IrcMessageHandler; -}; - -} // namespace chatterino diff --git a/src/providers/twitch/TwitchIrcServer.cpp b/src/providers/twitch/TwitchIrcServer.cpp index 45f50cecd..d13850b46 100644 --- a/src/providers/twitch/TwitchIrcServer.cpp +++ b/src/providers/twitch/TwitchIrcServer.cpp @@ -10,7 +10,6 @@ #include "controllers/highlights/HighlightController.hpp" #include "messages/Message.hpp" #include "messages/MessageBuilder.hpp" -#include "providers/twitch/ChatroomChannel.hpp" #include "providers/twitch/IrcMessageHandler.hpp" #include "providers/twitch/PubsubClient.hpp" #include "providers/twitch/TwitchAccount.hpp" @@ -24,21 +23,6 @@ using namespace std::chrono_literals; namespace chatterino { -namespace { - bool isChatroom(const QString &channel) - { - if (channel.left(10) == "chatrooms:") - { - auto reflist = channel.splitRef(':'); - if (reflist.size() == 3) - { - return true; - } - } - return false; - } -} // namespace - TwitchIrcServer::TwitchIrcServer() : whispersChannel(new Channel("/whispers", Channel::Type::TwitchWhispers)) , mentionsChannel(new Channel("/mentions", Channel::Type::TwitchMentions)) @@ -100,18 +84,8 @@ void TwitchIrcServer::initializeConnection(IrcConnection *connection, std::shared_ptr TwitchIrcServer::createChannel( const QString &channelName) { - std::shared_ptr channel; - if (isChatroom(channelName)) - { - channel = std::static_pointer_cast( - std::shared_ptr(new ChatroomChannel( - channelName, this->twitchBadges, this->bttv, this->ffz))); - } - else - { - channel = std::shared_ptr(new TwitchChannel( - channelName, this->twitchBadges, this->bttv, this->ffz)); - } + auto channel = std::shared_ptr(new TwitchChannel( + channelName, this->twitchBadges, this->bttv, this->ffz)); channel->initialize(); channel->sendMessageSignal.connect(