-1

I need to fetch 'Address book person's online/off-line status' through objective C on Mac.

I need 'iChat service' whatever Address book has used to fetch online status of a Person. Can anyone help me how can I get this though code.

Thanks in Advance.

Paul Fleming
  • 24,238
  • 8
  • 76
  • 113
Neelam Verma
  • 3,232
  • 1
  • 22
  • 33
  • I have edited the requirement. I have tried Address-book framework Functions. But didn't get any property of a person(ABPerson) for getting online/offline status. – Neelam Verma Oct 31 '12 at 13:14
  • Online status is not in the address book. It's part of iChat and I don't think there's an API for it. – Black Frog Oct 31 '12 at 19:36
  • Can anybody tell y there are down votes for this question. Its really a relevant question. If you people haven't work through iChat service as Apple provides its own framework don't down-vote it. – Neelam Verma Nov 02 '12 at 06:39
  • @BlackFrog: Got the status: through NSNumber *statusKey = [NSNumber numberWithInt:[[info objectForKey:k__kIMPersonStatusKey] integerValue]]; – Neelam Verma Jan 21 '13 at 10:02
  • @BlackFrog : Can you vote for this question for reopening because its valid question and i got the answer. – Neelam Verma Jan 21 '13 at 10:04

1 Answers1

2

Use InstantMessage.framework to find the status of the current user's buddies.

Specifically, it sounds like you want to call -[IMService screenNamesForPerson:] and pass the ABPerson you want to find the status of, then call -[IMService infoForScreenName:] on each returned name.

Inspect the returned dictionary's IMPersonStatusKey value to check the status manually, or call +[IMService imageNameForStatus:] on the value to get the name of an image you can display to indicate the status (the red or green "bubble" used in Mail.app, Contacts.app, and Calendar.app).

jatoben
  • 3,079
  • 15
  • 12
  • Hey @jatoben: got the person's offline /online status with NSNumber *statusKey = [NSNumber numberWithInt:[[info objectForKey:k__kIMPersonStatusKey] integerValue]]; Thanks – Neelam Verma Jan 21 '13 at 10:01
  • Can you vote for this question for reopening because its valid question and i got the answer. – Neelam Verma Jan 21 '13 at 10:05