From 1b4e5f197a9bef30fc13c592cbfd65d2c9a9476a Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Mon, 13 Apr 2009 22:20:48 +0200 Subject: core-util: add pa_session_id() --- src/pulsecore/core-util.c | 9 +++++++++ src/pulsecore/core-util.h | 1 + 2 files changed, 10 insertions(+) (limited to 'src') diff --git a/src/pulsecore/core-util.c b/src/pulsecore/core-util.c index 56253391..f4776f2e 100644 --- a/src/pulsecore/core-util.c +++ b/src/pulsecore/core-util.c @@ -2502,6 +2502,15 @@ char *pa_machine_id(void) { return pa_sprintf_malloc("%08lx", (unsigned long) gethostid); } +char *pa_session_id(void) { + const char *e; + + if (!(e = getenv("XDG_SESSION_COOKIE"))) + return NULL; + + return pa_utf8_filter(e); +} + char *pa_uname_string(void) { struct utsname u; diff --git a/src/pulsecore/core-util.h b/src/pulsecore/core-util.h index 0ba33f31..f96fa443 100644 --- a/src/pulsecore/core-util.h +++ b/src/pulsecore/core-util.h @@ -202,6 +202,7 @@ pa_bool_t pa_in_system_mode(void); #define pa_streq(a,b) (!strcmp((a),(b))) char *pa_machine_id(void); +char *pa_session_id(void); char *pa_uname_string(void); #ifdef HAVE_VALGRIND_MEMCHECK_H -- cgit