When you send a message, that usually fits into an IP packet. That gets completely encrypted by the wifi, but you know that a data packet approximately that size has been sent at exactly that time. Simultaneously, you watch the IRC channel and see when messages are arriving from your suspect, or someone else types a message and that should correlate with another encrypted wifi package.
The mistake was a) using wifi, exposing the data in the first place and b) not torrenting while you're chatting. That would've obscured the time correlations.