Clean up cross-platform compatibility.

- Move compatibility macros to a new header file.
- Sort system include files in alphabetical order.
- Clean up signal handling (thanks to Adam).
m_spanningtree UID handler: Fix parsing user modes

Spotted by @ShutterQuick
Issue #532
Add method for writing server notices.

This allows us to send a server notice to a user without worrying
about whether they are registered or not.

If a user receives a server notice and they are not registered
then the nickname field will contain an asterisk instead of their
nick name.
Merge pull request #523 from SaberUK/master+server-notice

Add method for writing server notices.
Don't leak thread handles on Windows