Clean up

Make some code easier to read.

The network controller now connects to IRC on its own thread, rather
than blocking in startNetCtl.

The JSON core protocol now prints error messages when it receives an
invalid message.
Implement system for writing chat logs