command/playlist: allow range in "playlistmove"

Closes https://github.com/MusicPlayerDaemon/MPD/issues/1689
This commit is contained in:
Max Kellermann
2023-03-06 11:35:14 +01:00
parent f4adbdbe31
commit 04e60d67ae
5 changed files with 45 additions and 14 deletions

View File

@@ -202,10 +202,16 @@ handle_playlistmove([[maybe_unused]] Client &client,
Request args, [[maybe_unused]] Response &r)
{
const char *const name = args.front();
unsigned from = args.ParseUnsigned(1);
RangeArg from = args.ParseRange(1);
if (from.IsOpenEnded()) {
r.Error(ACK_ERROR_ARG, "Open-ended range not supported");
return CommandResult::ERROR;
}
unsigned to = args.ParseUnsigned(2);
if (from == to)
if (from.IsEmpty() || from.start == to)
/* this doesn't check whether the playlist exists, but
what the hell.. */
return CommandResult::OK;