static JSValueRef get_user_session_cb(JSContextRef context, JSObjectRef thisObject, JSStringRef propertyName, JSValueRef *exception) { return string_or_null(context, lightdm_user_get_session(USER)); }
JS_EXPORT_API gchar* greeter_get_user_session (const gchar *name) { gchar *session = NULL; LightDMUserList *user_list = NULL; LightDMUser *user = NULL; user_list = lightdm_user_list_get_instance (); if (user_list == NULL) { g_warning ("greeter get user session:user list is NULL\n"); return NULL; } user = lightdm_user_list_get_user_by_name (user_list, name); if (user == NULL) { g_warning ("greeter get user session:user for %s is NULL\n", name); return NULL; } session = g_strdup (lightdm_user_get_session (user)); return session; }