Hi!
I've done it before using Perl, here's some doc:
mIRC's /help sockets
http://www.venkydude.com/articles/yahoo.htmhttp://www.cse.iitb.ac.in/~varunk/YahooProtocol.htmhttp://libyahoo2.sourceforge.net/ymsg-9.txtfreshmeat.net > search for Yahoo clients sources.
I don't know if these pages have been updated since Yahoo! has changed his protocol.
Server is scs.msg.yahoo.com port 5050.
The best way is to reverse engineer: I recommend you a packed sniffer like Ethereal, WinDump (tcpdump for Windows). Open a Yahoo! session and dump everything received and sent. It will help you to understand (remember, everything is in hexadecimal).
Good luck.