hi,
I have done a project on chat application few years back.
I was involved in the whole LC of the project.
I also retain the entire application source code.
But there is no point in passing you all the code right now.I dont think that would help you.
But its sure that I can help you on this to the best of my knowledge.
Mean while you can google for more information.
cheers and get ready,