It is not illegal as far as I know.

Yeah, you need another program read everything directly from mirc or the log file.

Although reading from log file can be slow.