Additionally, a maximum send queue length was added to avoid something like `cat /dev/urandom` from being a massive memory hog and causing OOM.
Because output is read from the process and added to the message queue in real time, this could lead to infinite memory usage without it.
Mainly I moved the command specific code from the giant message handling if statement into separate functions which are called dynamically depending on name.
I moved some functions around to have a basic structure as commented in Server().
Specifically, this corrects interrupting the main thread as it was waiting on input() if it is a tty.
Server.die() was changed to bypass the sendq for final IRC messages for a quick termination and to interrupt the main thread with os.kill and SIGINT.
This way the code exits gracefully and properly tears the connection down.
Specifically the ping is moved to the message throttling code so that every 10th
message triggers a ping.
This also allows for me to remove the multiple ping handlers.