Forwardport dazeus/dazeus@4c7a33a069e2a12a7d0081a0f6a99b6a57ca43db to utils.cpp of libdazeus-irc.