diff --git a/CHANGELOG.md b/CHANGELOG.md index e4ca645b9..a3eebbe13 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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) diff --git a/src/controllers/commands/CommandController.cpp b/src/controllers/commands/CommandController.cpp index 02385e473..d9d043842 100644 --- a/src/controllers/commands/CommandController.cpp +++ b/src/controllers/commands/CommandController.cpp @@ -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 . 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) {