Re: Current active login session
Re: Current active login session
- Subject: Re: Current active login session
- From: Antoine Missout <email@hidden>
- Date: Sat, 21 Aug 2010 08:00:07 -0400
Unfortunately, this lists all logged-in user using a GUI session, but won't tell which one is currently active/front.
- Antoine
On Aug 20, 2010, at 10:09 PM, Dave Keck wrote:
> I use the utmpx APIs to determine the existing console users from a
> daemon process; see the UTXplorer example (which I believe Quinn
> wrote?).
>
> ==========
>
> #import <utmpx.h>
>
> - (NSSet *)userNamesForExistingUserSessions
> {
>
> struct utmpx *currentEntry = nil;
> NSMutableSet *result = nil;
>
> result = [NSMutableSet set];
>
> setutxent();
>
> while (currentEntry = getutxent())
> {
>
> /* Verify that we have a user and that currentEntry's session is a GUI ('console') session */
>
> if (currentEntry->ut_type == USER_PROCESS && !strcmp(currentEntry->ut_line, "console"))
> [result addObject: [NSString stringWithUTF8String: currentEntry->ut_user]];
>
> }
>
> endutxent();
>
> return result;
>
> }
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Darwin-kernel mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden