I suggest to add each msg'd nick to a [$network- or $cid-specific] hash table (and to check for $hget(table,nick) of course), which will be destroyed if the OP is back (raw for "no longer marked away") or automatically on mirc exit.

I cannot write it down right now (there's no mirc on the machine I'm typing at atm) - sorry 4 that, hope it helps none the less.