• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag
 

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Determinating iChat status
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Determinating iChat status


  • Subject: Re: Determinating iChat status
  • From: Wade Tregaskis <email@hidden>
  • Date: Tue, 1 Jun 2004 16:46:54 +1000

[NSClassFromString(@"AddressBookPeople") loadBuddyList];
[NSClassFromString(@"DaemonicService") connectToDaemonWithLaunch:YES];

IMService *service=[IMService mostLoggedInService];
int chatstatus=[service serviceLoginStatus];

Just another note, you should be careful with the above, since the most logged in service is likely to be Rendezvous, not AIM. If you want AIM (or any other service, if you're forward thinking), you should use [[IMService aimService] serviceLoginStatus] or similar as appropriate (you can also get the Rendezvous one specifically using "subnetService").

Note that you can also use just [IMService myStatus] to determine the actual available/away status, once you've determined there is at least one online service.

You can also remove the connectToDaemonWithLaunch bit... that makes no difference.... I think loadBuddyList does that implicitly as necessary.

FWIW, also, the codes are, for the serviceLoginStatus method:

0 - Offline
3 - Connecting
4 - Online

The codes for myStatus are:

1 - Offline
3 - Away (or any variation thereof)
4 - Available (or any variation thereof)

Obviously there's a few missing values, but I can't figure out what they are - I can't find any way to produce them.

What hasn't been considered so far is when the daemon isn't running - you probably don't want to launch it. I think you should be able to call connectToDaemonWithLaunch:NO before anything else, and it will only return YES if the daemon is already running - if it's not, don't call loadBuddyList or any other methods (as they will presumably launch it).

Wade Tregaskis (aim: wadetregaskis)
-- Sed quis custodiet ipsos custodes?
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.


References: 
 >Re: Determinating iChat status (From: Aidas Dailide <email@hidden>)

  • Prev by Date: Re: Determinating iChat status
  • Next by Date: Re: Determinating iChat status
  • Previous by thread: Re: Determinating iChat status
  • Next by thread: Re: Determinating iChat status
  • Index(es):
    • Date
    • Thread