From cc143105b884bfcaa188c6e9f93babec5958ea87 Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Fri, 12 Dec 2014 22:12:19 +0100 Subject: sticker/Match: add operator "EQUALS" Mapped to "=" in the MPD protocol. This is the first operator, initially supporting value matches in the MPD protocol. --- src/command/StickerCommands.cxx | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) (limited to 'src/command') diff --git a/src/command/StickerCommands.cxx b/src/command/StickerCommands.cxx index b8eee55c5..07bed032e 100644 --- a/src/command/StickerCommands.cxx +++ b/src/command/StickerCommands.cxx @@ -138,7 +138,8 @@ handle_sticker_song(Client &client, ConstBuffer args) return CommandResult::OK; /* find song dir key */ - } else if (args.size == 4 && strcmp(cmd, "find") == 0) { + } else if ((args.size == 4 || args.size == 6) && + strcmp(cmd, "find") == 0) { /* "sticker find song a/directory name" */ const char *const base_uri = args[2]; @@ -146,6 +147,21 @@ handle_sticker_song(Client &client, ConstBuffer args) StickerOperator op = StickerOperator::EXISTS; const char *value = nullptr; + if (args.size == 6) { + /* match the value */ + + const char *op_s = args[4]; + value = args[5]; + + if (strcmp(op_s, "=") == 0) + op = StickerOperator::EQUALS; + else { + command_error(client, ACK_ERROR_ARG, + "bad operator"); + return CommandResult::ERROR; + } + } + bool success; struct sticker_song_find_data data = { client, -- cgit v1.2.3