diff --git a/CHANGELOG.md b/CHANGELOG.md index 7085d62d2..568ae0ee4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,7 @@ - Dev: Added the ability to see & load custom themes from the Themes directory. No stable promises are made of this feature, changes might be made that breaks custom themes without notice. (#4570) - Dev: Added test cases for emote and tab completion. (#4644) - Dev: Fixed `clang-tidy-review` action not picking up dependencies. (#4648) +- Dev: Expanded upon `$$$` test channels. (#4655) ## 2.4.4 diff --git a/src/providers/twitch/TwitchIrcServer.cpp b/src/providers/twitch/TwitchIrcServer.cpp index f2b30aef3..b7cc4797b 100644 --- a/src/providers/twitch/TwitchIrcServer.cpp +++ b/src/providers/twitch/TwitchIrcServer.cpp @@ -274,24 +274,102 @@ std::shared_ptr TwitchIrcServer::getCustomChannel( return this->liveChannel; } - if (channelName == "$$$") - { - static auto channel = - std::make_shared("$$$", chatterino::Channel::Type::Misc); - static auto getTimer = [&] { + static auto getTimer = [](ChannelPtr channel, int msBetweenMessages, + bool addInitialMessages) { + if (addInitialMessages) + { for (auto i = 0; i < 1000; i++) { channel->addMessage(makeSystemMessage(QString::number(i + 1))); } + } - auto timer = new QTimer; - QObject::connect(timer, &QTimer::timeout, [] { - channel->addMessage( - makeSystemMessage(QTime::currentTime().toString())); - }); - timer->start(500); - return timer; - }(); + auto *timer = new QTimer; + QObject::connect(timer, &QTimer::timeout, [channel] { + channel->addMessage( + makeSystemMessage(QTime::currentTime().toString())); + }); + timer->start(msBetweenMessages); + return timer; + }; + + if (channelName == "$$$") + { + static auto channel = std::make_shared( + channelName, chatterino::Channel::Type::Misc); + getTimer(channel, 500, true); + + return channel; + } + if (channelName == "$$$:e") + { + static auto channel = std::make_shared( + channelName, chatterino::Channel::Type::Misc); + getTimer(channel, 500, false); + + return channel; + } + if (channelName == "$$$$") + { + static auto channel = std::make_shared( + channelName, chatterino::Channel::Type::Misc); + getTimer(channel, 250, true); + + return channel; + } + if (channelName == "$$$$:e") + { + static auto channel = std::make_shared( + channelName, chatterino::Channel::Type::Misc); + getTimer(channel, 250, false); + + return channel; + } + if (channelName == "$$$$$") + { + static auto channel = std::make_shared( + channelName, chatterino::Channel::Type::Misc); + getTimer(channel, 100, true); + + return channel; + } + if (channelName == "$$$$$:e") + { + static auto channel = std::make_shared( + channelName, chatterino::Channel::Type::Misc); + getTimer(channel, 100, false); + + return channel; + } + if (channelName == "$$$$$$") + { + static auto channel = std::make_shared( + channelName, chatterino::Channel::Type::Misc); + getTimer(channel, 50, true); + + return channel; + } + if (channelName == "$$$$$$:e") + { + static auto channel = std::make_shared( + channelName, chatterino::Channel::Type::Misc); + getTimer(channel, 50, false); + + return channel; + } + if (channelName == "$$$$$$$") + { + static auto channel = std::make_shared( + channelName, chatterino::Channel::Type::Misc); + getTimer(channel, 25, true); + + return channel; + } + if (channelName == "$$$$$$$:e") + { + static auto channel = std::make_shared( + channelName, chatterino::Channel::Type::Misc); + getTimer(channel, 25, false); return channel; } diff --git a/src/singletons/WindowManager.cpp b/src/singletons/WindowManager.cpp index 15053ccd1..cae51caee 100644 --- a/src/singletons/WindowManager.cpp +++ b/src/singletons/WindowManager.cpp @@ -631,6 +631,10 @@ void WindowManager::encodeChannel(IndirectChannel channel, QJsonObject &obj) } } break; + case Channel::Type::Misc: { + obj.insert("type", "misc"); + obj.insert("name", channel.get()->getName()); + } } } @@ -676,6 +680,10 @@ IndirectChannel WindowManager::decodeChannel(const SplitDescriptor &descriptor) return Irc::instance().getOrAddChannel(descriptor.server_, descriptor.channelName_); } + else if (descriptor.type_ == "misc") + { + return app->twitch->getChannelOrEmpty(descriptor.channelName_); + } return Channel::getEmpty(); }