Dana's script worked for me, but only the first time as it leaves the query window open, so if you recieve another message while the window is still open it doesn't do the ignore command again. You can put the line "window -c $nick" after the ignore line to fix that.