Sanitize topic message

The code handling the topic message isn't expecting any new lines
since it is usually not possible to have any from the IRC specs.
But we can have some Unicode new lines instead!
Qt is happily converting them to simple new lines which then crashes
the client with a stack overflow.
Fix build without SSL

This one slipped in.
Make protocol messages structs instead of classes

Encapsulation with private members and accessors is nice, but for something
that is just a POD and will most probably stay that way, it's overkill [1].
So we're turning the classes into structs with direct member access.

Most beneficially, this makes protocol.h much nicer to read.

As a bonus, we introduce a common baseclass that holds the handler() method to
remove duplication.

[1] Even Qt sets a precedent for that, e.g. QPair and many other PODs that are
    implemented as structs with public member access even in the public API.
Add handshake message types to protocol.h

These are all the message types that are needed for the initial
handshake, before things get handed over to the SignalProxy.
Abstract away the protocol handshake code

This continues (and hopefully mostly concludes) the work begun
in 0e1b154 - abstracting away everything protocol-related from the
rest of the code, so we can later add another protocol. It's also
nice to not have all sorts of network- and protocol-related stuff
intertwined into central classes like Core and CoreConnection.

Note that nothing should change for end-users, modulo bugs. So new
and old client and core should work together in all combinations,
with and without SSL and/or compression. Please let me know if
something's wonky. That's also true for things like connection failure
handling and reconnects, as there have been many changes in those areas.

Turns out that abstracting the handshake stuff was much harder and
much more invasive than the previous work in SignalProxy. Turns also
out that the legacy handshake protocol is not the best ever. So
this touches lots of places in the code; sorry for a diff with over
3000 lines, but there was no way to sanely split the commits.

Anyway, here's the gist of it:

* Add auth handlers on both core and client side that process the
  handshake based on the generic message types in protocol.h - lots
  of code moved from CoreConnection and Core into the new classes.
  Note that "AuthHandler" is a stupid name for what it does, so we'll
  probably rename it to HandshakeHandler or something later.

* Extend LegacyPeer to translate the new message types to and from the
  legacy format, moving protocol-specific code out of the existing classes.
  Right now only "compat mode" is supported, i.e. the handshake we've
  been using for what feels like a decade. In the future, some of that
  should be done much nicer whilst keeping the same wire format. For now,
  there's several quirks in LegacyPeer to somehow map the insanities in
  the existing protocol to something that won't bite us in the future once
  we want to clean up that mess.

* Auth handlers will create the peer now - this is because later on the
  peer we need will be determined by protocol detection, which is part
  of the handshake.

* Use the generic protocol message types directly where it makes sense
  (in particular for things like SessionState) - instead of QVariantMaps.

* Lots of cleanups, API changes etc. were done in passing.

* Probably more that I choose to not remember right now.
Always send disconnected() on socket errors

Some socket errors (e.g. connection refused) don't trigger a disconnected()
from the socket, mostly because the socket hadn't been opened in the
first place.

To simplify the logic elsewhere, let's always send (exactly) one disconnected()
from the AuthHandler in case of socket errors. That way, we don't have to
introduce the mess we used to have in the reconnection logic in CoreConnection.
SessionState needs to be a registered meta type

This is because the mono client sends the session state through
a queued signal connection.
Fix flushing of sockets, causing random sync errors

TIL that flushing a socket may trigger a readyRead(). In certain cases
this would lead to compression being enabled on the client side too late
(because we would flush the socket before), breaking the sync to core.

As (contrary to starting SSL) enabling the compression does not care if
there's still uncompressed data in the socket's write buffer, we can just
remove this flush.

Also, let's make it explicit that we flush immediately before starting
encryption, rather than hiding that somewhere in the LegacyPeer, to avoid
introducing weird bugs later. And also flush the socket before handing the
peer over to the CoreSession, as we used to do before the refactoring -
we don't want bug #682 back.
Fix datatypes in the legacy handshake

Turns out we accidentally some datatypes. SupportsCompression should
be a bool, and protocolVersion an uint. Changing this breaks QuasselDroid
and wasn't done on purpose anyway.
Rename settingspages.inc to settingspages.cmake

While CMake itself doesn't care about the file extension, it seems to make
recent KDevelop crash.
Fix expression in IrcEvent::create()

We need to inverse the mask, obviously. Thanks to Tucos for pointing
this out.
Fix the Phonon notification backend not playing any sound

Phonon won't report its capabilities before a player has been created,
which leads to Quassel thinking that it can't play audio since we checked
for that before instantiating the player.

Some reordering in the ctor fixes this.
Avoid Phonon's deprecation warnings

MediaSource prefers a QUrl now. This shouldn't break with older Phonon
versions, I hope, since it seems MediaSource(QUrl) has been around since
forever.
Merge branch 'master' of https://github.com/quassel/quassel
fixed crash with systray backend