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)
This commit is contained in:
pajlada 2020-02-22 06:05:36 -05:00 committed by GitHub
parent 03cf6e81ff
commit 2b5c6ffe33
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 3 additions and 125 deletions

View file

@ -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

View file

@ -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 \

View file

@ -1,67 +0,0 @@
#include "ChatroomChannel.hpp"
#include <QDebug>
#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<Channel>(this)](QString username) {
BttvEmotes::loadChannel(username, [this, weak](auto &&emoteMap) {
if (auto shared = weak.lock())
this->bttvEmotes_.set(
std::make_shared<EmoteMap>(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<EmoteMap>(std::move(emoteMap)));
},
[this](auto &&modBadge) {
this->ffzCustomModBadge_.set(std::move(modBadge));
});
}
const QString &ChatroomChannel::getDisplayName() const
{
return this->chatroomOwnerName;
}
} // namespace chatterino

View file

@ -1,28 +0,0 @@
#pragma once
#include "TwitchChannel.hpp"
#include <QString>
#include <atomic>
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

View file

@ -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<Channel> TwitchIrcServer::createChannel(
const QString &channelName)
{
std::shared_ptr<TwitchChannel> channel;
if (isChatroom(channelName))
{
channel = std::static_pointer_cast<TwitchChannel>(
std::shared_ptr<ChatroomChannel>(new ChatroomChannel(
channelName, this->twitchBadges, this->bttv, this->ffz)));
}
else
{
channel = std::shared_ptr<TwitchChannel>(new TwitchChannel(
channelName, this->twitchBadges, this->bttv, this->ffz));
}
auto channel = std::shared_ptr<TwitchChannel>(new TwitchChannel(
channelName, this->twitchBadges, this->bttv, this->ffz));
channel->initialize();
channel->sendMessageSignal.connect(