You can use mIRC's own events to do what you want. It'll be much simpler and far less bug-prone than using sockets.

After all, your suggestion is essentially to make raw socket events emulate other existing events - why not use the existing events?