mirror of
https://github.com/owntone/owntone-server.git
synced 2025-11-25 03:56:21 -05:00
[listener] Support passing multiple events in a single notify call
This commit is contained in:
18
src/mpd.c
18
src/mpd.c
@@ -4768,12 +4768,12 @@ mpd_notify_idle_client(struct mpd_client_ctx *client_ctx, short events)
|
||||
static enum command_state
|
||||
mpd_notify_idle(void *arg, int *retval)
|
||||
{
|
||||
enum listener_event_type type;
|
||||
short event_mask;
|
||||
struct mpd_client_ctx *client;
|
||||
int i;
|
||||
|
||||
type = *(enum listener_event_type *)arg;
|
||||
DPRINTF(E_DBG, L_MPD, "Notify clients waiting for idle results: %d\n", type);
|
||||
event_mask = *(short *)arg;
|
||||
DPRINTF(E_DBG, L_MPD, "Notify clients waiting for idle results: %d\n", event_mask);
|
||||
|
||||
i = 0;
|
||||
client = mpd_clients;
|
||||
@@ -4781,7 +4781,7 @@ mpd_notify_idle(void *arg, int *retval)
|
||||
{
|
||||
DPRINTF(E_DBG, L_MPD, "Notify client #%d\n", i);
|
||||
|
||||
mpd_notify_idle_client(client, type);
|
||||
mpd_notify_idle_client(client, event_mask);
|
||||
client = client->next;
|
||||
i++;
|
||||
}
|
||||
@@ -4791,14 +4791,14 @@ mpd_notify_idle(void *arg, int *retval)
|
||||
}
|
||||
|
||||
static void
|
||||
mpd_listener_cb(enum listener_event_type type)
|
||||
mpd_listener_cb(short event_mask)
|
||||
{
|
||||
enum listener_event_type *ptr;
|
||||
short *ptr;
|
||||
|
||||
ptr = (enum listener_event_type *)malloc(sizeof(enum listener_event_type));
|
||||
*ptr = type;
|
||||
ptr = (short *)malloc(sizeof(short));
|
||||
*ptr = event_mask;
|
||||
|
||||
DPRINTF(E_DBG, L_MPD, "Listener callback called with event type %d.\n", type);
|
||||
DPRINTF(E_DBG, L_MPD, "Listener callback called with event type %d.\n", event_mask);
|
||||
commands_exec_async(cmdbase, mpd_notify_idle, ptr);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user