• 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: Getting Available iChat Buddies
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Getting Available iChat Buddies


  • Subject: Re: Getting Available iChat Buddies
  • From: Wade Tregaskis <email@hidden>
  • Date: Sun, 20 Jun 2004 13:28:23 +1000

I'm looking for a way to get all the available iChat buddies and put them in a menu. I've seen it discussed here but with no definite answer as to how.

You can use the InstantMessage framework. Class-dump it for the interfaces. Essentially, the steps for doing what you want involve:

1) Call [AddressCard initializeGMe], and check that it returns YES, to initialise some essential stuff
2) Call _syncWithRemoteBuddies on each IMService you wish to use (the AIM one can be obtained using [IMService aimService]); this is due to a design flaw in the framework... if you don't do this, everything will be empty or NULL until "some later date"
3) Either call allPresentities on the appropriate IMService, for a list of all users in that buddy list, or go through the address book and use AddressCard's addressCardWithABPerson: method. You can refer to the relevant class-dump for AddressCard and Presentity to find out what information is available.

There are also notifications you can register for, to find out when things changed. This is how you're "supposed" to do it, rather than forcing a sync with step 2 above, but it's not always intuitive nor useful that way. Anyway, some of the key notifications are:

"AddedPeople" - Whenever a new person (Presentity?) is registered the (sent on the relevant instance of AddressBookPeople (presumably the shared one))
"PersonInfoChanged" - Attached to both Presentity's and AddressCard's (i.e. it'll be sent to both [or more] for each person])
"PersonStatusChanged" - Similar to the above
"PersonPictureChanged" - etc etc.
"ServiceLoginStatusChanged" - Sent to the appropriate IMService instance.

The list goes on and on - InstantMessage.framework spews a huge number of messages. If anyone's interested I've got some example code showing all the above, and with a generic notifications watcher (so you can discover whatever other ones you're interested in) available from <http://homepage.cs.latrobe.edu.au/wjtregaskis/InstantMessage.tbz>. It includes the class-dump'd headers with the modifications necessary for them to work (they don't by default; class-dump doesn't seem to discover the formal protocol definitions needed, so they have to be commented out of the class definitions).

As always, this is undocumented, unsupported, Apple will claim your first born children for using it, etc etc. Standard fair. Flames will go straight to /dev/null. :P

Wade Tregaskis (aim: wadetregaskis)
-- Sed quis custodiet ipsos custodes?

P.S. I'm slowly working on the InstantMessage framework; documenting important methods, figuring out how to make things work properly, etc. I'm in the middle of mid-year exams though, so progress is slow; in a week or so I'll have more time. If anyone's interested in following my progress, they can chat to me on AIM or send me an email.
_______________________________________________
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: 
 >Getting Available iChat Buddies (From: Oliver Cameron <email@hidden>)

  • Prev by Date: Re: NSURLConnection retainCount at initialisation
  • Next by Date: Re: Where's the NSWindowController in a default document-based app
  • Previous by thread: Re: Getting Available iChat Buddies
  • Next by thread: Some Questions...
  • Index(es):
    • Date
    • Thread