summaryrefslogtreecommitdiffstats
path: root/src/pulsecore/client.c
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2009-02-12 03:18:05 +0100
committerLennart Poettering <lennart@poettering.net>2009-02-12 03:18:05 +0100
commit823431e44732a0824658c82de29aaa92f8f39f79 (patch)
treebdad5ae9f4e0f47221905ccedf0c192c09c86aaf /src/pulsecore/client.c
parent4bd9737725b85d90a7cf12b82528c2de70a7fbfe (diff)
allow sending meta/policy events to clients
Diffstat (limited to 'src/pulsecore/client.c')
-rw-r--r--src/pulsecore/client.c29
1 files changed, 29 insertions, 0 deletions
diff --git a/src/pulsecore/client.c b/src/pulsecore/client.c
index 6f3e08e2..7ca7b97c 100644
--- a/src/pulsecore/client.c
+++ b/src/pulsecore/client.c
@@ -73,6 +73,7 @@ pa_client *pa_client_new(pa_core *core, pa_client_new_data *data) {
c->userdata = NULL;
c->kill = NULL;
+ c->send_event = NULL;
pa_assert_se(pa_idxset_put(core->clients, c, &c->index) >= 0);
@@ -144,3 +145,31 @@ void pa_client_update_proplist(pa_client *c, pa_update_mode_t mode, pa_proplist
pa_hook_fire(&c->core->hooks[PA_CORE_HOOK_CLIENT_PROPLIST_CHANGED], c);
pa_subscription_post(c->core, PA_SUBSCRIPTION_EVENT_CLIENT|PA_SUBSCRIPTION_EVENT_CHANGE, c->index);
}
+
+void pa_client_send_event(pa_client *c, const char *event, pa_proplist *data) {
+ pa_proplist *pl = NULL;
+ pa_client_send_event_hook_data hook_data;
+
+ pa_assert(c);
+ pa_assert(event);
+
+ if (!c->send_event)
+ return;
+
+ if (!data)
+ data = pl = pa_proplist_new();
+
+ hook_data.client = c;
+ hook_data.data = data;
+ hook_data.event = event;
+
+ if (pa_hook_fire(&c->core->hooks[PA_CORE_HOOK_CLIENT_SEND_EVENT], &hook_data) < 0)
+ goto finish;
+
+ c->send_event(c, event, data);
+
+finish:
+
+ if (pl)
+ pa_proplist_free(pl);
+}