Back in October, Tantek Çelik wrote an entry on the Microformats blog, featuring my online identity, jaredhanson.net, as an example of a beautifully styled hCard.
While I don’t claim to be particularly adept at web design, especially compared to the other two featured individuals (Tim Van Damme and Rogie King), my use of Ajax to display a status indicator was highlighted.
Since that time, I’ve had numerous people inquire as to how I added this functionality to my website. In response, I’m supplying the source code that I use. Download: web-presence.zip
Each of the instant messaging networks I have an account on (AIM, Google Talk, Windows Live, Skype, and Yahoo!) have some form of API or web-based badge which can be queried using HTTP. On my server, I am running PHP code which issues requests to the particular service and translates the response into a JSON object. When my page loads, Ajax requests are made to retrieve these JSON objects. Based on presence, the image is updated to reflect whether I am available or away.
For those interested in implementing similar functionality, this code should get you off the ground. Remember to use the required credentials or keys for your account. I’ve made notes where insertions are necessary. Good luck!
