mirror of
https://github.com/badaix/snapcast.git
synced 2025-07-24 03:48:32 +02:00
delete client
This commit is contained in:
parent
3e8842b941
commit
252cda188a
3 changed files with 18 additions and 0 deletions
|
@ -161,6 +161,18 @@ void StreamServer::onMessageReceived(ControlSession* controlSession, const std::
|
|||
{"clients", jClient}
|
||||
};
|
||||
}
|
||||
else if (request.method == "System.DeleteClient")
|
||||
{
|
||||
clientInfo = Config::instance().getClientInfo(request.getParam("client").get<string>(), false);
|
||||
if (clientInfo == nullptr)
|
||||
throw JsonInternalErrorException("Client not found", request.id);
|
||||
response = clientInfo->macAddress;
|
||||
Config::instance().remove(clientInfo);
|
||||
Config::instance().save();
|
||||
json notification = JsonNotification::getJson("Client.OnDelete", clientInfo->toJson());
|
||||
controlServer_->send(notification.dump(), controlSession);
|
||||
clientInfo = nullptr;
|
||||
}
|
||||
else if (request.method == "Client.SetVolume")
|
||||
{
|
||||
clientInfo->volume.percent = request.getParam<uint16_t>("volume", 0, 100);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue