File tree 2 files changed +0
-48
lines changed
2 files changed +0
-48
lines changed Original file line number Diff line number Diff line change @@ -9,20 +9,6 @@ extern NSInteger const SSYUserInfoCouldNotGetLoginTimeError;
9
9
__attribute__ ((visibility(" default" ))) @interface SSYUserInfo : NSObject {
10
10
}
11
11
12
- /* !
13
- @brief Returns first name, last name and primary email
14
- address of from the "me" entry in Address Book.
15
-
16
- @details Warning! Starting with macOS 10.8, invoking
17
- this method will produce an ugly, scary and vague dialog box
18
- asking the user if it is OK for your app to access their
19
- Contacts. This method will block until the dialog is
20
- dismissed by the user.
21
- */
22
- + (void )fromAddressBookFirstName_p:(NSString **)ptrFirstName
23
- lastName_p:(NSString **)ptrLastName
24
- email_p:(NSString **)ptrEmail ;
25
-
26
12
/* !
27
13
@brief Returns the string name, unix user ID (uid) and
28
14
unix group ID (id) of the current console user.
Original file line number Diff line number Diff line change 1
1
#import " SSYUserInfo.h"
2
2
#import < SystemConfiguration/SCDynamicStoreCopySpecific.h>
3
- #import < AddressBook/ABAddressBook.h>
4
- #import < AddressBook/ABMultiValue.h>
5
3
#import < utmpx.h>
6
4
#import < string.h>
7
5
10
8
11
9
@implementation SSYUserInfo
12
10
13
- + (void )fromAddressBookFirstName_p : (NSString **)ptrFirstName
14
- lastName_p : (NSString **)ptrLastName
15
- email_p : (NSString **)ptrEmail {
16
- ABPerson * me = [[ABAddressBook sharedAddressBook ] me ] ;
17
-
18
- if (ptrEmail) {
19
- ABMultiValue *emails = [me valueForProperty: kABEmailProperty ];
20
- *ptrEmail = nil ;
21
- NSString * emailIdentifier = [emails primaryIdentifier ] ;
22
- if (emailIdentifier) {
23
- *ptrEmail = [emails valueAtIndex: [emails indexForIdentifier: emailIdentifier]];
24
- }
25
- if (!(*ptrEmail)) {
26
- *ptrEmail = @" " ;
27
- }
28
- }
29
-
30
- if (ptrFirstName) {
31
- *ptrFirstName = [me valueForProperty: kABFirstNameProperty ];
32
- if (!(*ptrFirstName)) {
33
- *ptrFirstName = @" " ;
34
- }
35
- }
36
-
37
- if (ptrLastName) {
38
- *ptrLastName = [me valueForProperty: kABLastNameProperty ];
39
- if (!(*ptrLastName)) {
40
- *ptrLastName = @" " ;
41
- }
42
- }
43
- }
44
-
45
11
+ (NSString *)consoleUserNameAndUid_p : (uid_t *)uid_p
46
12
gid_p : (gid_t *)gid_p {
47
13
NSString * name = (NSString *)SCDynamicStoreCopyConsoleUser (NULL , uid_p, gid_p) ;
You can’t perform that action at this time.
0 commit comments