summaryrefslogtreecommitdiff
path: root/src/login
diff options
context:
space:
mode:
Diffstat (limited to 'src/login')
-rw-r--r--src/login/logind-user.c28
-rw-r--r--src/login/sd-login.c4
2 files changed, 30 insertions, 2 deletions
diff --git a/src/login/logind-user.c b/src/login/logind-user.c
index a6672ce670..9dfead9d5d 100644
--- a/src/login/logind-user.c
+++ b/src/login/logind-user.c
@@ -180,6 +180,20 @@ int user_save(User *u) {
fputs(i->id, f);
}
+ fputs("\nONLINE_SESSIONS=", f);
+ first = true;
+ LIST_FOREACH(sessions_by_user, i, u->sessions) {
+ if (session_get_state(i) == SESSION_CLOSING)
+ continue;
+
+ if (first)
+ first = false;
+ else
+ fputc(' ', f);
+
+ fputs(i->id, f);
+ }
+
fputs("\nACTIVE_SEATS=", f);
first = true;
LIST_FOREACH(sessions_by_user, i, u->sessions) {
@@ -193,6 +207,20 @@ int user_save(User *u) {
fputs(i->seat->id, f);
}
+
+ fputs("\nONLINE_SEATS=", f);
+ first = true;
+ LIST_FOREACH(sessions_by_user, i, u->sessions) {
+ if (session_get_state(i) == SESSION_CLOSING || !i->seat)
+ continue;
+
+ if (first)
+ first = false;
+ else
+ fputc(' ', f);
+
+ fputs(i->seat->id, f);
+ }
fputc('\n', f);
}
diff --git a/src/login/sd-login.c b/src/login/sd-login.c
index 1978a05dc0..88dd510870 100644
--- a/src/login/sd-login.c
+++ b/src/login/sd-login.c
@@ -259,11 +259,11 @@ static int uid_get_array(uid_t uid, const char *variable, char ***array) {
}
_public_ int sd_uid_get_sessions(uid_t uid, int require_active, char ***sessions) {
- return uid_get_array(uid, require_active ? "ACTIVE_SESSIONS" : "SESSIONS", sessions);
+ return uid_get_array(uid, require_active == 2 ? "ONLINE_SESSIONS" : (require_active ? "ACTIVE_SESSIONS" : "SESSIONS"), sessions);
}
_public_ int sd_uid_get_seats(uid_t uid, int require_active, char ***seats) {
- return uid_get_array(uid, require_active ? "ACTIVE_SEATS" : "SEATS", seats);
+ return uid_get_array(uid, require_active == 2 ? "ONLINE_SEATS" : (require_active ? "ACTIVE_SEATS" : "SEATS"), seats);
}
static int file_of_session(const char *session, char **_p) {