| 137 | } |
| 138 | |
| 139 | CommandResult |
| 140 | handle_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 | } |
nothing calls this directly
no test coverage detected