This should make things a little bit safer

Quickly sending either sigint or sigterm could segfault it
because the config wasn't dispatched yet. Therefor we now
register this after we've done that. In the signal handler
we check if the bufferevent isn't NULL now as it could
segfault on that if we're executing it while the signal was
processed. There is a theoretical problem with this however
if you have many bots in the config and one is disconnected
this one could reconnect while all the others are processing
the QUIT event. This however isn't really an issue as all
the connections will drop anyway as soon as all the QUIT events
are processed.

Signed-off-by: Toon Schoenmakers <nighteyes1993@gmail.com>