Disabled /popout and /streamlink from working in non-twitch channels (e.g. /whispers) when supplied no arguments (#3541)

Co-authored-by: Rasmus Karlsson <rasmus.karlsson@pajlada.com>
This commit is contained in:
qooq69 2022-01-23 14:24:49 +01:00 committed by GitHub
parent 4e422b3bed
commit e2eb73d817
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 35 additions and 20 deletions

View file

@ -92,6 +92,7 @@
- Bugfix: Fixed being unable to drag the user card window from certain spots. (#3508)
- Bugfix: Fixed being unable to open a usercard from inside a usercard while "Automatically close user popup when it loses focus" was enabled. (#3518)
- Bugfix: Usercards no longer close when the originating window (e.g. a search popup) is closed. (#3518)
- Bugfix: Disabled /popout and /streamlink from working in non-twitch channels (e.g. /whispers) when supplied no arguments. (#3541)
- Dev: Batch checking live status for channels with live notifications that aren't connected. (#3442)
- Dev: Add GitHub action to test builds without precompiled headers enabled. (#3327)
- Dev: Renamed CMake's build option `USE_SYSTEM_QT5KEYCHAIN` to `USE_SYSTEM_QTKEYCHAIN`. (#3103)

View file

@ -655,12 +655,18 @@ void CommandController::initialize(Settings &, Paths &paths)
return "";
});
this->registerCommand(
"/streamlink", [](const QStringList &words, ChannelPtr channel) {
QString target(words.size() < 2 ? channel->getName() : words[1]);
this->registerCommand("/streamlink", [](const QStringList &words,
ChannelPtr channel) {
QString target(words.value(1));
if (words.size() < 2 &&
(!channel->isTwitchChannel() || channel->isEmpty()))
if (target.isEmpty())
{
if (channel->getType() == Channel::Type::Twitch &&
!channel->isEmpty())
{
target = channel->getName();
}
else
{
channel->addMessage(makeSystemMessage(
"/streamlink [channel]. Open specified Twitch channel in "
@ -668,19 +674,26 @@ void CommandController::initialize(Settings &, Paths &paths)
"current Twitch channel instead."));
return "";
}
}
stripChannelName(target);
openStreamlinkForChannel(target);
stripChannelName(target);
openStreamlinkForChannel(target);
return "";
});
return "";
});
this->registerCommand(
"/popout", [](const QStringList &words, ChannelPtr channel) {
QString target(words.size() < 2 ? channel->getName() : words[1]);
this->registerCommand("/popout", [](const QStringList &words,
ChannelPtr channel) {
QString target(words.value(1));
if (words.size() < 2 &&
(!channel->isTwitchChannel() || channel->isEmpty()))
if (target.isEmpty())
{
if (channel->getType() == Channel::Type::Twitch &&
!channel->isEmpty())
{
target = channel->getName();
}
else
{
channel->addMessage(makeSystemMessage(
"Usage: /popout <channel>. You can also use the command "
@ -688,14 +701,15 @@ void CommandController::initialize(Settings &, Paths &paths)
"popout chat."));
return "";
}
}
stripChannelName(target);
QDesktopServices::openUrl(
QUrl(QString("https://www.twitch.tv/popout/%1/chat?popout=")
.arg(target)));
stripChannelName(target);
QDesktopServices::openUrl(
QUrl(QString("https://www.twitch.tv/popout/%1/chat?popout=")
.arg(target)));
return "";
});
return "";
});
this->registerCommand("/clearmessages", [](const auto & /*words*/,
ChannelPtr channel) {