[mpd] correct handling of noidle command

This commit is contained in:
Wolfgang Scherer 2017-11-16 23:23:53 +01:00 committed by chme
parent 8d130cdc7c
commit fa76b6380c

View File

@ -632,6 +632,7 @@ mpd_command_currentsong(struct evbuffer *evbuf, int argc, char **argv, char **er
static int
mpd_notify_idle_client(struct mpd_client_ctx *client_ctx, short events);
/*
* Example input:
* idle "database" "mixer" "options" "output" "player" "playlist" "sticker" "update"
@ -679,41 +680,16 @@ mpd_command_idle(struct evbuffer *evbuf, int argc, char **argv, char **errmsg, s
return 0;
}
//static void
//mpd_remove_client(struct evbuffer *evbuf)
//{
// struct idle_client *client;
// struct idle_client *prev;
//
// client = idle_clients;
// prev = NULL;
//
// while (client)
// {
// if (client->evbuffer == evbuf)
// {
// DPRINTF(E_DBG, L_MPD, "Removing idle client for evbuffer\n");
//
// if (prev)
// prev->next = client->next;
// else
// idle_clients = client->next;
//
// free(client);
// break;
// }
//
// prev = client;
// client = client->next;
// }
//}
static int
mpd_command_noidle(struct evbuffer *evbuf, int argc, char **argv, char **errmsg, struct mpd_client_ctx *ctx)
{
ctx->is_idle = false;
ctx->idle_events = 0;
return 0;
/*
* The protocol specifies: "The idle command can be canceled by
* sending the command noidle (no other commands are allowed). MPD
* will then leave idle mode and print results immediately; might be
* empty at this time."
*/
return mpd_notify_idle_client(ctx, 0);
}
/*
@ -859,7 +835,7 @@ mpd_command_stats(struct evbuffer *evbuf, int argc, char **argv, char **errmsg,
"songs: %d\n"
"uptime: %d\n" //in seceonds
"db_playtime: %" PRIi64 "\n"
"db_update: %ld\n"
"db_update: %" PRIi64 "\n"
"playtime: %d\n",
artists,
albums,