Fix high CPU use on Windows when connecting to a server

When getting a write event for an EventHandler that wanted a single write only, remove it from the WriteSet (socketengine_select)

Fixes #556 reported by @WindowsUser
m_spanningtree FJOIN handler: Merge and take maxmodes into consideration when applying non-prefix modes
Prevent m_cgiirc from blocking indefinitely, resulting in registration timeouts on e.g. Mibbit when webirc is not used
Merge pull request #563 from ElementalAlchemist/patch-1

Prevent m_cgiirc from blocking indefinitely
Fix low risk crash when we can't determine maximum open socket count.
Fix the Poll socket engine on BSD.
Do not send too much data over SSL in one go

Some clients fail to read it entirely and the remaining data stays in their read buffer until new data arrives
m_userip Fix incorrect "variable may be used uninitialized" warning shown by older GCC versions
Merge pull request #588 from SaberUK/insp20+fix-socketengines

[2.0] Fix various socket engine bugs.
Clean up error handling in threadengine_win32
Use the correct socket related error messages on Windows
m_ssl_openssl Fix inverted check that prevented certificates from being recognized as trusted
Fix generated snomask mode change string being incosistent with the input in certain cases, spotted by @Robby-
Use server ids when propagating squits
m_ssl_gnutls Fix feature testing and cipher suite related errors on older GnuTLS versions

Use the (old) LIBGNUTLS_VERSION_* defines as a fallback when GNUTLS_VERSION_* is unavailable

Fixes #595 reported by @rhylan
m_dnsbl Fix possible use-after-free after a rehash
m_spanningtree When an IOHook goes away close all pending connections that use it
Fix Windows build and a few more problems
m_spanningtree Changes to TreeSocket::WriteLine() to avoid string copies

- Change argument type to a reference to avoid copies of the string object
- If the std::string implementation is using copy-on-write then calling operator[] on a mutable string results in a copy; avoid this by calling .c_str() instead
m_spanningtree Introduce command builders