I run a php social network and would like our own custom Instant Messenger program similar to myspace's IM.
When a user first uses the IM they should have no contacts added even if they have 1,000 friends on our website. To add a friend they will need to either add it through the IM by entering the user's unique member_id# or unique displayname. The other option is to add someone to their IM contact list by clicking a link on the person's profile. Either way they add someone, a request is sent much like when you attempt to add someone to Yahoo messenger.
People can be online, away, or invisible or offline of course. If you send a message to an offline user they will receive the message when they come back online much like yahoo messenger. No history storage is necessary.
This application should be a standalone (downloadable) application as I have seen many problems with Java clients, etc.
Much like yahoo messenger, if a user is connected to the IM network, they should be notified in the event they receive a message on the site, a friend request on the website, a photo comment on the website, or a profile comment on the website.
Please explain as much as possible in a Private message on how to achieve this, my site is in PHP/MySQL