MCPcopy Create free account
hub / github.com/MusicPlayerDaemon/MPD / handle_protocol

Function handle_protocol

src/command/ClientCommands.cxx:139–182  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

137}
138
139CommandResult
140handle_protocol(Client &client, Request request, Response &r)
141{
142 if (request.empty()) {
143 protocol_features_print(client, r);
144 return CommandResult::OK;
145 }
146
147 const char *cmd = request.shift();
148 if (StringIsEqual(cmd, "all")) {
149 if (!request.empty()) {
150 r.Error(ACK_ERROR_ARG, "Too many arguments");
151 return CommandResult::ERROR;
152 }
153
154 client.AllProtocolFeatures();
155 return CommandResult::OK;
156 } else if (StringIsEqual(cmd, "clear")) {
157 if (!request.empty()) {
158 r.Error(ACK_ERROR_ARG, "Too many arguments");
159 return CommandResult::ERROR;
160 }
161
162 client.ClearProtocolFeatures();
163 return CommandResult::OK;
164 } else if (StringIsEqual(cmd, "enable")) {
165 client.SetProtocolFeatures(ParseProtocolFeature(request), true);
166 return CommandResult::OK;
167 } else if (StringIsEqual(cmd, "disable")) {
168 client.SetProtocolFeatures(ParseProtocolFeature(request), false);
169 return CommandResult::OK;
170 } else if (StringIsEqual(cmd, "available")) {
171 if (!request.empty()) {
172 r.Error(ACK_ERROR_ARG, "Too many arguments");
173 return CommandResult::ERROR;
174 }
175
176 protocol_features_print_all(r);
177 return CommandResult::OK;
178 } else {
179 r.Error(ACK_ERROR_ARG, "Unknown sub command");
180 return CommandResult::ERROR;
181 }
182}

Callers

nothing calls this directly

Calls 5

protocol_features_printFunction · 0.85
ParseProtocolFeatureFunction · 0.85
emptyMethod · 0.80
ErrorMethod · 0.45

Tested by

no test coverage detected