I wasn't suggesting that you modify the irssi code; rather, take inspiration from the way it functions.
// @thrrgilag